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
3 changes: 1 addition & 2 deletions Cargo.lock

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

9 changes: 3 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "flexaccess-iroh"
version = "0.0.3"
version = "0.0.5"
edition = "2024"
description = "Shared iroh transport layer for FlexAccess applications: relay configuration and probing, endpoint building and rebuilding, the home-relay watchdog, and the endpoint-bound public-key auth transcript"
description = "Shared iroh transport layer for FlexAccess applications: relay configuration and probing, endpoint building and rebuilding, and the endpoint-bound public-key auth transcript"
repository = "https://github.com/flexaccessdev/flexaccess-iroh"

[features]
Expand Down Expand Up @@ -34,7 +34,4 @@ tokio = { version = "1", features = ["macros", "rt", "sync", "time"] }
iroh-mdns-address-lookup = { version = "0.5", optional = true }

[dev-dependencies]
# Test double for iroh's `Watcher`-based status APIs (the relay watchdog tests
# drive a plain `Watchable`); the same crate iroh itself re-exports `Watcher` from.
n0-watcher = "1"
tokio = { version = "1", features = ["full", "test-util"] }
tokio = { version = "1", features = ["full"] }
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Shared iroh transport layer for FlexAccess applications, as a Rust crate.
The programs built on iroh in this org — [tunnel-rs], [ezvpn], [flextunnel] —
share one transport foundation. Its design is documented once in
[iroh-common-architecture]; this crate is that design as code, so a fix to the
relay watchdog or the relay probe lands here once instead of being ported by
relay probe or endpoint construction lands here once instead of being ported by
hand into every repo.

[tunnel-rs]: https://github.com/flexaccessdev/tunnel-rs
Expand All @@ -19,7 +19,6 @@ hand into every repo.
|---|---|
| `relay` | `RelayConfig` (default vs custom relays, which also decides whether n0 internet discovery is on), the shared relay auth token, the strict per-relay startup probe |
| `endpoint` | the common endpoint builder, `create_endpoint` (strict first creation) vs `rebuild_endpoint` (tolerant mid-run replacement), `RebuildableEndpoint` |
| `relay_watchdog` | the server-side home-relay watchdog: nudge with `network_change()`, then ask for a rebuild |
| `auth` | the endpoint-bound public-key auth transcript over the [flexaccess-keys] format; each application passes its own domain-separation context |

Deliberately **not** in it: ALPNs, handshake wire formats, QUIC transport
Expand All @@ -31,13 +30,22 @@ takes the resulting `iroh::SecretKey` / `flexaccess_keys` values.

[flexaccess-keys]: https://github.com/flexaccessdev/flexaccess-keys

## Server relay recovery

Servers rely on iroh 1.1.x for relay reconnects and keep the same endpoint
during relay outages. The former server watchdog has been removed; see the
[relay recovery history and workaround](https://github.com/flexaccessdev/iroh-common-architecture/blob/9eacd43b80d867a8a4a76e3051237b854b4b0cd5/home-relay-watchdog.md)
if permanent loss of relay registration recurs.

The client-side `RebuildableEndpoint` remains available for reconnect escalation.

## Depending on it

```toml
[dependencies]
flexaccess-iroh = { git = "https://github.com/flexaccessdev/flexaccess-iroh", tag = "v0.0.3" }
flexaccess-iroh = { git = "https://github.com/flexaccessdev/flexaccess-iroh", tag = "v0.0.5" }
# or, with mDNS local-network discovery on every endpoint (compiled out on iOS):
flexaccess-iroh = { git = "...", tag = "v0.0.3", features = ["mdns"] }
flexaccess-iroh = { git = "...", tag = "v0.0.5", features = ["mdns"] }
```

The `flexaccess_keys` crate is re-exported so a consumer signs and verifies
Expand Down
6 changes: 2 additions & 4 deletions src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ pub async fn create_endpoint(relay_config: &RelayConfig, builder: EndpointBuilde
/// would block recovery through the one relay that still answers.
/// - **The online wait is tolerated failing.** A fresh endpoint is no worse
/// than the wedged one it replaces — LAN peers can still find it over mDNS —
/// and whatever tripped the rebuild (the relay watchdog, a client's
/// reconnect escalation) trips again if the relays stay unreachable.
/// and the client's reconnect escalation retries if the relays stay unreachable.
pub async fn rebuild_endpoint(builder: EndpointBuilder) -> Result<Endpoint> {
let endpoint = builder.bind().await.context("Failed to create iroh endpoint")?;
if let Err(e) = wait_online(&endpoint).await {
Expand All @@ -147,8 +146,7 @@ pub async fn rebuild_endpoint(builder: EndpointBuilder) -> Result<Endpoint> {
}

/// Recipe producing a fresh, fully bound endpoint — how a
/// [`RebuildableEndpoint`] replaces itself mid-session, or how a server
/// replaces a wedged endpoint when the relay watchdog gives up on it.
/// [`RebuildableEndpoint`] replaces itself mid-session.
pub type EndpointFactory = Arc<dyn Fn() -> BoxFuture<'static, Result<Endpoint>> + Send + Sync>;

/// Bound wait on the old endpoint's graceful close during a rebuild. The close
Expand Down
3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
//! - [`endpoint`]: the common endpoint builder, the bind-and-come-online policy
//! for first creation versus a mid-run rebuild, and a
//! [`endpoint::RebuildableEndpoint`] handle.
//! - [`relay_watchdog`]: the server-side home-relay watchdog that nudges, then
//! asks for a rebuild, when iroh silently loses its home relay.
//! - [`auth`]: the endpoint-bound public-key authentication transcript over the
//! shared [`flexaccess_keys`] format; each application supplies its own
//! domain-separation context.
Expand All @@ -32,6 +30,5 @@
pub mod auth;
pub mod endpoint;
pub mod relay;
pub mod relay_watchdog;

pub use flexaccess_keys;
Loading
Loading