Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
- the desktop client (`flextunnel-desktop`) normally stores its config in the system keychain; set `FLEXTUNNEL_DEV_CONFIG=1` (or a file path) to store it as plaintext JSON instead, avoiding the macOS keychain access prompt on every unsigned rebuild. Development only β€” never set it for a real install (the auth secret key is stored unencrypted).
- after rust changes that affect iOS (flextunnel-core or flextunnel-ffi, including the FFI config schema and `ios/flextunnel.h`), run `./build-ios.sh release` to rebuild `libflextunnel.xcframework` into `dist/ios/` (this script no longer writes into `../flextunnel-ios`). The iOS app links via its own Swift package (`../flextunnel-ios/Packages/Flextunnel`), which **defaults to the pinned GitHub release**, so it won't see local changes unless you build the app with `FLEXTUNNEL_LOCAL_XCFRAMEWORK=1` β€” that links this fresh `dist/ios` build through a committed symlink (set it for both `xcodegen generate` and `xcodebuild`, then clean-rebuild). This is an **extra step only needed when actively working on the iOS app side by side** (and only possible on macOS with Xcode + the iOS Rust targets); otherwise just skip it.
- the iroh transport layer shared with tunnel-rs and ezvpn β€” relays and address lookup, the per-relay startup probe, relay auth tokens, relay self-hosting β€” is documented once in https://github.com/flexaccessdev/iroh-common-architecture. Do not duplicate it in this repo; update it there and link to it.
- that shared layer's code β€” `RelayConfig` and the relay probe, endpoint building and rebuild, the home-relay watchdog, the endpoint-bound auth transcript β€” lives in the `flexaccess-iroh` crate (`../flexaccess-iroh`, consumed by git tag). Fix it there, tag a release, and bump the tag here; never re-implement or fork a copy of it in this repo. Only flextunnel-specific pieces (ALPNs, the allowlist hook, the auth context, QUIC tuning) belong in `transport/` and `auth.rs`.
- that shared layer's code β€” `RelayConfig` and the relay probe, endpoint building (bound without the relays that fail the probe), the server's in-place home-relay failover, the endpoint-bound auth transcript β€” lives in the `flexaccess-iroh` crate (`../flexaccess-iroh`, consumed by git tag). Fix it there, tag a release, and bump the tag here; never re-implement or fork a copy of it in this repo. Only flextunnel-specific pieces (ALPNs, the allowlist hook, the auth context, QUIC tuning, and the client's rebuildable endpoint `ClientEndpoint` β€” the reconnect loop's escalation, which the crate does not carry) belong in `transport/` and `auth.rs`.
48 changes: 24 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ default-members = [
]

[workspace.package]
version = "0.0.75"
version = "0.0.76"
edition = "2024"
description = "SOCKS5/HTTP-proxy-over-QUIC split tunnel via iroh P2P"

Expand All @@ -31,7 +31,7 @@ hickory-resolver = { version = "0.26", default-features = false, features = ["to
# Shared iroh transport layer (relay config + probe, endpoint building and
# rebuild, home-relay watchdog, endpoint-bound auth transcript). `mdns` turns on
# local-network discovery on every endpoint (compiled out on iOS by the crate).
flexaccess-iroh = { git = "https://github.com/flexaccessdev/flexaccess-iroh", tag = "v0.0.3", features = ["mdns"] }
flexaccess-iroh = { git = "https://github.com/flexaccessdev/flexaccess-iroh", tag = "v0.0.8", features = ["mdns"] }
iroh = "1.1.0"
libc = "0.2"
log = "0.4"
Expand Down
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ Client auth keypairs are generated with the standalone
| `--default-config` | Load `~/.config/flextunnel/server.toml`. |
| `--secret-file <FILE>` | Server identity key. |
| `--authorized-keys-file <FILE>` | File of authorized client public keys, one `ed25519-pub:…` per line (optional trailing comment, ssh `authorized_keys` style). |
| `--relay-url <URL>` | Custom relay URL(s) for failover (repeatable). Configuring custom relays disables n0 internet discovery: clients reach this server via relay hints, and outbound bridges attach the same hints when dialing peer servers. mDNS local discovery stays on. |
| `--relay-url <URL>` | Custom relay URLs (repeatable; at least two distinct relays, since the server rides out a relay outage by moving onto another one). Configuring custom relays disables n0 internet discovery: clients reach this server via relay hints, and outbound bridges attach the same hints when dialing peer servers. mDNS local discovery stays on. |
| `--relay-auth-token <TOKEN>` | Shared bearer token sent to every custom relay's WebSocket upgrade. Only valid with `--relay-url` (rejected with the default relays). |
| `--quick` | Ephemeral one-off server: prompt for the client's EndpointId (shown by `client start --quick`) and natively allowlist it as the only allowed client β€” no auth keypair β€” then mint an in-memory identity, full-tunnel all traffic, print this server's EndpointId, and exit if the client doesn't connect within 5 minutes. Needs an interactive terminal. Takes no single-instance lock; nothing is persisted. Conflicts with `-c`/`--secret-file`/`--authorized-keys-file`. |

Expand All @@ -413,7 +413,7 @@ Client auth keypairs are generated with the standalone
| `--socks-port <PORT>` | Optional SOCKS5 listener port, e.g. `1080`. Binds `127.0.0.1` only. Disabled unless set. |
| `--http-port <PORT>` | Optional HTTP proxy listener port (CONNECT + plain-HTTP forwarding). Binds `127.0.0.1` only. |
| `--auth-key <SECRET>` / `--auth-key-file <FILE>` | Client auth keypair (one required): the inline `ed25519-sec:…` secret, or the key file from `flexaccess-keys generate-auth-key`. |
| `--relay-url <URL>` | Custom relay URL(s) for failover (repeatable). Configuring custom relays disables n0 internet discovery (the server is reached via relay hints); mDNS local discovery stays on. |
| `--relay-url <URL>` | Custom relay URLs (repeatable; at least two distinct relays, the same set as the server). Configuring custom relays disables n0 internet discovery (the server is reached via relay hints); mDNS local discovery stays on. |
| `--relay-auth-token <TOKEN>` | Shared bearer token sent to every custom relay's WebSocket upgrade. Only valid with `--relay-url` (rejected with the default relays). |
| `--auto-reconnect` | Force auto-reconnect on (overrides `auto_reconnect = false` in the config). |
| `--no-auto-reconnect` | Exit on the first disconnection instead of reconnecting. |
Expand Down Expand Up @@ -620,11 +620,13 @@ Auto-reconnect is **enabled by default** (`auto_reconnect = true`); pass
and only then fail with a network-unreachable reply.

A **server** with custom relays watches its own home-relay registration: if it
has no connected home relay for 60s it re-checks the network, and if that
has not helped by 180s it rebuilds its endpoint in place (same server id) β€”
the in-process equivalent of a restart, so relay-only clients (the iOS app,
anything off the LAN) are not stranded until someone restarts the service.
See [`docs/architecture.md`](docs/architecture.md#relay-watchdog-server-custom-relays).
has no connected home relay for 60s and iroh has not re-homed it on its own,
it takes the wedged relay out of its relay map and homes on another configured
relay in place (same server id, same sockets, nothing dropped), so clients off
the LAN (the iOS app) are not stranded until someone restarts the service. The
relay is put back once it is connectable again. A custom relay set is
therefore at least two distinct relays. See
[`docs/architecture.md`](docs/architecture.md#relay-failover-server-custom-relays).

## Logging

Expand Down
Loading
Loading