Expand description
Tools for spawning an accept loop that routes incoming requests to the right protocol.
+Expand description
Tools for spawning an accept loop that routes incoming requests to the right protocol.
§Example
let endpoint = Endpoint::builder().discovery_n0().bind().await?;
diff --git a/pr/3355/docs/iroh/protocol/struct.AccessLimit.html b/pr/3355/docs/iroh/protocol/struct.AccessLimit.html
index 1a6f10ee25..2eee17ec97 100644
--- a/pr/3355/docs/iroh/protocol/struct.AccessLimit.html
+++ b/pr/3355/docs/iroh/protocol/struct.AccessLimit.html
@@ -1,15 +1,15 @@
-AccessLimit in iroh::protocol - Rust pub struct AccessLimit<P: ProtocolHandler + Clone> { /* private fields */ }
Expand description
Wraps an existing protocol, limiting its access,
+
AccessLimit in iroh::protocol - Rust pub struct AccessLimit<P: ProtocolHandler + Clone> { /* private fields */ }
Expand description
Wraps an existing protocol, limiting its access,
based on the provided function.
Any refused connection will be closed with an error code of 0 and reason not allowed.
-Implementations§
Source§impl<P: ProtocolHandler + Clone> AccessLimit<P>
Implementations§
Trait Implementations§
Source§impl<P: Clone + ProtocolHandler + Clone> Clone for AccessLimit<P>
Source§fn clone(&self) -> AccessLimit<P>
Returns a copy of the value. Read more1.0.0 · Source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read moreSource§impl<P> Debug for AccessLimit<P>
Source§impl<P: ProtocolHandler + Clone> ProtocolHandler for AccessLimit<P>
Source§fn on_connecting(
+
Trait Implementations§
Source§impl<P: Clone + ProtocolHandler + Clone> Clone for AccessLimit<P>
Source§fn clone(&self) -> AccessLimit<P>
Returns a copy of the value. Read more1.0.0 · Source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read moreSource§impl<P> Debug for AccessLimit<P>
Source§impl<P: ProtocolHandler + Clone> ProtocolHandler for AccessLimit<P>
Source§fn on_connecting(
&self,
conn: Connecting,
-) -> impl Future<Output = Result<Connection, AcceptError>> + Send
Optional interception point to handle the Connecting state. Read moreSource§async fn accept(&self, conn: Connection) -> Result<(), AcceptError>
Handle an incoming connection. Read moreAuto Trait Implementations§
§impl<P> Freeze for AccessLimit<P>where
+) -> impl Future<Output = Result<Connection, AcceptError>> + SendOptional interception point to handle the Connecting state. Read moreSource§async fn accept(&self, conn: Connection) -> Result<(), AcceptError>
Handle an incoming connection. Read more
Auto Trait Implementations§
§impl<P> Freeze for AccessLimit<P>where
P: Freeze,
§impl<P> !RefUnwindSafe for AccessLimit<P>
§impl<P> Send for AccessLimit<P>
§impl<P> Sync for AccessLimit<P>
§impl<P> Unpin for AccessLimit<P>where
P: Unpin,
§impl<P> !UnwindSafe for AccessLimit<P>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
diff --git a/pr/3355/docs/iroh/protocol/struct.Router.html b/pr/3355/docs/iroh/protocol/struct.Router.html
index a3af7f766d..2d9f170024 100644
--- a/pr/3355/docs/iroh/protocol/struct.Router.html
+++ b/pr/3355/docs/iroh/protocol/struct.Router.html
@@ -15,26 +15,31 @@ wait for [tokio::signal::ctrl_c()]:
// wait until the user wants to
tokio::signal::ctrl_c().await.context("ctrl+c")?;
router.shutdown().await.context("shutdown")?;
-
Implementations§
Source§impl Router
Sourcepub fn builder(endpoint: Endpoint) -> RouterBuilder
Implementations§
Sourcepub async fn accept(
&self,
alpn: impl AsRef<[u8]>,
handler: impl ProtocolHandler,
-) -> Result<AddProtocolOutcome, RouterError>
Adds a protocol to the list of accepted protocols.
-Configures the router to accept the ProtocolHandler when receiving a connection
-with this alpn.
-Once the function yields, new connections with this alpn will be handled.
-If a protocol handler was already registered for alpn, the previous handler will be shutdown.
-Returns true if
-Sourcepub async fn stop_accepting(
+) -> Result<AddProtocolOutcome, RouterError>
Accepts incoming connections with this alpn via ProtocolHandler.
+After this function returns, new connections with this alpn will be handled
+by the passed handler.
+If a protocol handler was already registered for alpn, the previous handler will be
+shutdown. Existing connections will not be aborted by the router, but some protocol
+handlers may abort existing connnections in their Router::shutdown implementation.
+Consult the documentation of the protocol handler to see if that is the case.
+Sourcepub async fn stop_accepting(
&self,
alpn: impl AsRef<[u8]>,
-) -> Result<(), StopAcceptingError>
Stops accepting a protocol.
-Note that this has only an effect on new connections. Existing connections that were
-accepted with alpn won’t be closed when calling Router::stop_accepting.
-Sourcepub async fn shutdown(&self) -> Result<(), JoinError>
Shuts down the accept loop cleanly.
+) -> Result<(), StopAcceptingError>Stops accepting connections with this alpn.
+After this function returns, new connections with alpn will no longer be accepted.
+If a protocol handler was registered for alpn, the handler will be
+shutdown. Existing connections will not be aborted by the router, but some protocol
+handlers may abort existing connnections in their Router::shutdown implementation.
+Consult the documentation of the protocol handler to see if that is the case.
+Returns an error if the router has been shutdown or no protocol is registered for alpn.
+Sourcepub async fn shutdown(&self) -> Result<(), JoinError>
Shuts down the accept loop and endpoint cleanly.
When this function returns, all ProtocolHandlers will be shutdown and
Endpoint::close will have been called.
If already shutdown, it returns Ok.
diff --git a/pr/3355/docs/iroh/protocol/struct.RouterBuilder.html b/pr/3355/docs/iroh/protocol/struct.RouterBuilder.html
index 14d81340eb..442ab74731 100644
--- a/pr/3355/docs/iroh/protocol/struct.RouterBuilder.html
+++ b/pr/3355/docs/iroh/protocol/struct.RouterBuilder.html
@@ -1,13 +1,12 @@
RouterBuilder in iroh::protocol - Rust pub struct RouterBuilder { /* private fields */ }
Expand description
Builder for creating a Router for accepting protocols.
-Implementations§
Source§impl RouterBuilder
Implementations§
Source§impl RouterBuilder
Sourcepub fn accept(
self,
alpn: impl AsRef<[u8]>,
handler: impl ProtocolHandler,
-) -> Self
Configures the router to accept the ProtocolHandler when receiving a connection
-with this alpn.
-Sourcepub fn spawn(self) -> Router
Spawns an accept loop and returns a handle to it encapsulated as the Router.
+) -> SelfConfigures the router to accept incoming connections with this alpn via ProtocolHandler.
+Trait Implementations§
Auto Trait Implementations§
§impl !Freeze for RouterBuilder
§impl !RefUnwindSafe for RouterBuilder
§impl Send for RouterBuilder
§impl Sync for RouterBuilder
§impl Unpin for RouterBuilder
§impl !UnwindSafe for RouterBuilder
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
diff --git a/pr/3355/docs/iroh/protocol/trait.ProtocolHandler.html b/pr/3355/docs/iroh/protocol/trait.ProtocolHandler.html
index 1d99f398f2..002bfa773c 100644
--- a/pr/3355/docs/iroh/protocol/trait.ProtocolHandler.html
+++ b/pr/3355/docs/iroh/protocol/trait.ProtocolHandler.html
@@ -47,4 +47,4 @@ the router closes the endpoint.
) -> Result<Connection, AcceptError>Source§async fn accept(&self, conn: Connection) -> Result<(), AcceptError>
Source§async fn shutdown(&self)
Source§impl<T: ProtocolHandler> ProtocolHandler for Arc<T>
Source§async fn on_connecting(
&self,
conn: Connecting,
-) -> Result<Connection, AcceptError>
Source§async fn accept(&self, conn: Connection) -> Result<(), AcceptError>
Source§async fn shutdown(&self)
Implementors§
Source§impl<P: ProtocolHandler + Clone> ProtocolHandler for AccessLimit<P>
\ No newline at end of file
+) -> Result<Connection, AcceptError>Source§async fn accept(&self, conn: Connection) -> Result<(), AcceptError>
Source§async fn shutdown(&self)
Implementors§
Source§impl<P: ProtocolHandler + Clone> ProtocolHandler for AccessLimit<P>
\ No newline at end of file
diff --git a/pr/3355/docs/search.desc/iroh/iroh-desc-0-.js b/pr/3355/docs/search.desc/iroh/iroh-desc-0-.js
index 76f07a0778..e0101e7c0d 100644
--- a/pr/3355/docs/search.desc/iroh/iroh-desc-0-.js
+++ b/pr/3355/docs/search.desc/iroh/iroh-desc-0-.js
@@ -1 +1 @@
-searchState.loadedDescShard("iroh", 0, "Peer-to-peer QUIC connections.\nError when decoding.\nThe encoded information had the wrong length.\nError when decoding the public key.\nError when deserialising a PublicKey or a SecretKey.\nThe length of an ed25519 PublicKey, in bytes.\nNetwork-level addressing information for an iroh node.\nThe identifier for a node in the (iroh) network.\nA public key.\nRelays over the custom relaying protocol with a custom …\nConfiguration of all the relay servers that can be used.\nInformation on a specific relay server.\nThe HTTP upgrade protocol used for relaying.\nA URL identifying a relay server.\nCan occur when parsing a string into a RelayUrl.\nA secret key.\nRelays over websockets.\nGet this public key as a byte array.\nIs this a known node?\nDefault values used in iroh\nReturns the direct addresses of this peer.\nSocket addresses where the peer might be reached directly.\nNode address discovery.\nThis module exports a DNS resolver, which is also the …\nCreate an empty relay map.\nThe Endpoint allows establishing connections to other iroh …\nConvert to a hex string limited to the first 5 bytes for a …\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the addressing info from given ticket.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCreates a RelayMap from a RelayUrl.\nReturns the argument unchanged.\nReturns the argument unchanged.\nConstruct a PublicKey from a slice of bytes.\nCreate a secret key from its byte representation.\nCreates a RelayMap from an iterator of RelayUrl.\nCreates a new NodeAddr from its parts.\nGenerate a new SecretKey with a randomness generator.\nGet the given node.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nReturns true, if only a NodeId is present.\nAre there any nodes in this map?\nHow many nodes are known?\nCo-locating all of the iroh metrics structs\nChecks the network conditions from the current host.\nCreates a new NodeAddr with no relay_url and no …\nThe node’s identifier.\nSupport for handling DNS resource records for dialing by …\nReturns an Iterator over all known nodes.\nTries to match the value of an HTTP upgrade header to …\nTools for spawning an accept loop that routes incoming …\nReturns the VerifyingKey for this PublicKey.\nThe public key of this SecretKey.\nConfiguration to speak to the QUIC endpoint on the relay …\nReturns the relay url of this peer.\nThe node’s home relay url.\nReturns the SigningKey for this SecretKey.\nSign the given message and return a digital signature\nWhether this relay server should only be used for STUN …\nThe stun port of the relay server.\nInternal utilities to support testing.\nConvert this to the bytes representing the secret part. …\nThe HTTP upgrade header used or expected.\nThe RelayUrl where this relay server can be dialed.\nReturns the sorted relay URLs.\nVerify a signature on a message with this secret key’s …\nAdds the given direct addresses.\nAdds a relay url.\nThe default HTTPS port used by the Relay server.\nThe default HTTP port used by the Relay server.\nThe default metrics port used by the Relay server.\nThe default QUIC port used by the Relay server to accept …\nThe default STUN port used by the Relay server.\nProduction configuration.\nStaging configuration.\nHostname of the default Asia-Pacific relay.\nHostname of the default EU relay.\nHostname of the default NA relay.\nGet the default RelayNode for Asia-Pacific\nGet the default RelayNode for EU.\nGet the default RelayNode for NA.\nGet the default RelayMap.\nHostname of the default EU relay.\nHostname of the default NA relay.\nGet the default RelayNode for EU.\nGet the default RelayNode for NA.\nGet the default RelayMap.\nA discovery service that combines multiple discovery …\nNode discovery for super::Endpoint.\nDiscovery errors\nNode discovery results from Discovery services.\nError returned when a discovery watch stream lagged too …\nThe max byte length allowed for user-defined data.\nData about a node that may be published to and resolved …\nInformation about a node that may be published to and …\nUnder the hood this is a UTF-8 String is no longer than …\nAdds a Discovery service.\nAdds direct addresses to the node data.\nRemoves all direct addresses from the node data.\nThe information published about the node.\nReturns the direct addresses of the node.\nDNS node discovery for iroh\nCreates an empty ConcurrentDiscovery.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCreates a new user error from an arbitrary error type.\nCreates a new user error from an arbitrary boxed error …\nCreates a new NodeInfo from its parts.\nParses a NodeInfo from a pkarr::SignedPacket.\nCreates a new ConcurrentDiscovery.\nParses a NodeInfo from a TXT records lookup.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nConverts into a NodeAddr without cloning.\nConverts into a NodeAddr without cloning.\nReturns the optional timestamp when this node info was …\nA discovery service that uses an mdns-like service to …\nCreates a new NodeData with a relay URL and a set of …\nCreates a new NodeInfo with an empty NodeData.\nCreates a new DiscoveryItem from a NodeInfo.\nReturns the node id of the discovered node.\nThe NodeId of the node this is about.\nReturns the NodeInfo for the discovered node.\nA discovery service which publishes and resolves node …\nReturns the provenance of this discovery item.\nPublishes the given NodeData to the discovery mechanism.\nReturns the relay URL of the node.\nResolves the DiscoveryItem for the given NodeId.\nSets the relay URL of the node data.\nSets the user-defined data of the node data.\nA static node discovery to manually add node addressing …\nSubscribe to all addresses that get passively discovered.\nConverts into a NodeAddr by cloning the needed fields.\nConverts into a NodeAddr by cloning the needed fields.\nCreates a pkarr::SignedPacket.\nConverts into a list of {key}={value} strings.\nReturns the optional user-defined data of the node.\nReturns any user-defined data.\nThe number of skipped messages\nSets the direct addresses and returns the updated node …\nSets the direct addresses and returns the updated node …\nSets the relay URL and returns the updated node data.\nSets the relay URL and returns the updated node info.\nSets the user-defined data and returns the updated node …\nSets the user-defined data and returns the updated node …\nDNS node discovery\nThe n0 testing DNS node origin, for production.\nThe n0 testing DNS node origin, for testing.\nReturns the argument unchanged.\nCalls U::from(self).\nCreates a new DNS discovery using the iroh.link domain.\nCreates a new DNS discovery.\nDiscovery using swarm-discovery, a variation on mdns\nName of this discovery service.\nReturns the argument unchanged.\nCalls U::from(self).\nCreate a new MdnsDiscovery Service.\nDefault TTL for the records in the pkarr signed packet.\nInterval in which to republish the node info even if …\nThe production pkarr relay run by number 0.\nThe testing pkarr relay run by number 0.\nPublisher of node discovery information to a pkarr relay.\nA pkarr client to publish pkarr::SignedPackets to a pkarr …\nResolver of node discovery information from a pkarr relay.\nPkarr based node discovery for iroh, supporting both relay …\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCreates a pkarr publisher which uses the number 0 pkarr …\nCreates a pkarr resolver which uses the number 0 pkarr …\nCreates a new publisher for the SecretKey.\nCreates a new publisher using the pkarr relay server at …\nCreates a new client.\nPublishes a SignedPacket.\nResolves a SignedPacket for the given NodeId.\nPublishes the addressing information about this node to a …\nCreates a new PkarrPublisher with a custom TTL and …\nBuilder for DhtDiscovery.\nPkarr Mainline DHT and relay server node discovery.\nBuilds the discovery mechanism.\nCreates a new builder for DhtDiscovery.\nExplicitly sets the pkarr client to use.\nSets whether to publish to the Mainline DHT.\nReturns the argument unchanged.\nReturns the argument unchanged.\nSets whether to include the direct addresses in the DNS …\nSets the initial delay before the first publish.\nCalls U::from(self).\nCalls U::from(self).\nUses the default number 0 pkarr relay URL.\nSets the pkarr relay URL to use.\nSets the republish delay for the DHT.\nSets the secret key to use for signing the DNS packets.\nSets the time-to-live value for the DNS packets.\nThe provenance string for this discovery implementation.\nA static node discovery to manually add node addressing …\nAugments node addressing information for the given node ID.\nReturns the argument unchanged.\nCreates a static discovery instance from node addresses.\nReturns node addressing information for the given node ID.\nCalls U::from(self).\nCreates a new static discovery instance.\nRemoves all node addressing information for the given node …\nSets node addressing information for the given node ID.\nThe DNS resolver used throughout iroh.\nThe n0 testing DNS node origin, for production.\nThe n0 testing DNS node origin, for testing.\nRemoves all entries from the cache.\nReturns the argument unchanged.\nCalls U::from(self).\nPerform an ipv4 lookup with a timeout.\nResolve IPv4 and IPv6 in parallel with a timeout.\nRace an ipv4 and ipv6 lookup with a timeout in a staggered …\nPerform an ipv4 lookup with a timeout in a staggered …\nPerform an ipv6 lookup with a timeout.\nPerform an ipv6 lookup with a timeout in a staggered …\nLooks up node info by DNS name.\nLooks up node info by DNS name in a staggered fashion.\nLooks up node info by NodeId and origin domain name.\nLooks up node info by NodeId and origin domain name.\nLookup a TXT record.\nCreate a new DNS resolver with sensible cross-platform …\nResolve a hostname from a URL to an IP address.\nCreate a new DNS resolver configured with a single UDP DNS …\nthe endpoint has reached the confidentiality or integrity …\nthe application or application protocol caused the …\nFuture produced by Endpoint::accept.\nFuture produced by Connection::accept_bi\nFuture produced by Connection::accept_uni\nParameters for controlling the peer’s acknowledgement …\nA key for sealing data with AEAD-based algorithms\nUses all available paths\nApplication layer added the address directly.\nReason given by an application for closing the connection\nThe peer closed the connection\nBuilder for Endpoint.\nthe number of connection IDs provided by the peer exceeds …\nthe server refused to accept a new connection\nreceived more data in CRYPTO frames than can be buffered\nWe received a CallMeMaybe.\nA chunk of data from the receive stream\nThe connection could not be created because not enough of …\nError indicating that a stream has not been opened or has …\nThe stream has already been stopped, finished, or reset\nThe stream has already been finished or reset\nOptions for the Endpoint::connect_with_opts function.\nIn-progress connection attempt future\nA QUIC connection.\nReason given by the transport for closing the connection\nThe peer’s QUIC stack aborted the connection …\nReasons why a connection might be lost\nThe connection was lost\nThe connection was lost\nThe connection was lost\nThe connection was lost\nThe connection was lost\nConnection statistics\nThe type of connection we have to the endpoint.\nThe type of control message we have received.\nCommon interface for different congestion controllers\nConstructs controllers on demand\nGeneric crypto errors\nServer-side configuration for the crypto protocol\nUse a custom relay map.\nUse the default relay map, with production relay servers …\nDirect UDP connection\nA direct address on which an iroh-node might be …\nInformation about a direct address.\nThe type of direct address.\nDatagram support is disabled locally\nDisable relay servers completely.\nThe address was discovered by a discovery service.\nEnvironment variable to force the use of staging relays.\nControls an iroh node, establishing connections with other …\nError returned by Session::export_keying_material.\nreceived a STREAM frame or a RESET_STREAM frame containing …\nreceived more data than permitted in advertised data limits\nreceived a frame that was badly formatted\nThe stream finished before all bytes were read\nNumber of frames transmitted of each frame type\nA pseudo random key for HKDF\nthe endpoint encountered an internal error and cannot …\nreceived an invalid Retry Token in a client Initial\nAttempted an ordered read following an unordered read\nAn incoming connection for which the server has not yet …\nAdaptor to let Incoming be awaited like a Connecting.\nkey update error\nA locally bound socket address.\nThe local application closed the connection\nThe largest representable value\nThe largest encoded value length\nBoth a UDP and a relay connection are used.\nParameters governing MTU discovery.\nthe connection is being closed abruptly in the absence of …\nno viable network path exists\nApplication layer with a specific name added the node …\nWe have no verified connection to this PublicKey\nFuture produced by Connection::open_bi\nFuture produced by Connection::open_uni\ndetected an error with protocol compliance that was not …\nDefines the mode of path selection for all traffic flowing …\nStatistics related to a transmission path\nWe received a Ping from the node.\nWe received a Pong from the node.\nAn address assigned by the router using port mapping.\nAn error occurred during reading\nFuture produced by Connection::read_datagram\nErrors that arise from reading from a stream.\nA read error occurred\nErrors that arise from reading from a stream.\nErrors from RecvStream::read_to_end\nA stream that can only be used to receive data\nRelay connection over relay\nA node communicated with us first via relay.\nConfiguration of the relay servers for an Endpoint.\nForces all traffic to go exclusively through relays\nDetails about a remote iroh node which is known to this …\nThe peer abandoned transmitting data on this stream\nThe peer is unable to continue processing this connection, …\nErrors that arise while waiting for a stream to be reset\nError for attempting to retry an Incoming which already …\nreceived a frame for a stream identifier that exceeded …\nreceived a frame for a stream that was not in a state that …\nAddress was loaded from the fs.\nErrors that can arise when sending a datagram\nA stream that can only be used to send data\nParameters governing incoming connections\nThe origin or source through which an address associated …\nUse the staging relay servers from n0.\nThe peer is no longer accepting data on this stream\nErrors that arise while monitoring for a send stream stop …\nIdentifier for a stream within a particular connection\nPublic internet address discovered via STUN.\nHard NAT: STUN’ed IPv4 address + local fixed port.\nreceived transport parameters that were badly formatted, …\nCommunication with the peer has lapsed for longer than the …\nThe datagram is larger than the connection can currently …\nThe stream is larger than the user-supplied limit\nParameters governing the core QUIC state machine\nTransport-level errors occur when a peer violates the …\nThe peer violated the QUIC specification as understood by …\nTransport-level error code\nA node communicated with us first via UDP.\nStatistics about UDP datagrams transmitted or received on …\nNot yet determined..\nThe peer does not support receiving datagram frames\nError indicating that the specified QUIC version is not …\nAn integer less than 2^62\nThe peer doesn’t implement any supported version\nA handle to some connection internals, use with care.\nErrors that arise from writing to a stream\nIndicates how many bytes and chunks had been transferred …\nFuture that completes when a connection is fully …\nThis was a 0-RTT stream and the server rejected it\nThis was a 0-RTT stream and the server rejected it\nThis was a 0-RTT stream and the server rejected it\nThis was a 0-RTT stream and the server rejected it\nAccepts an incoming connection on the endpoint.\nAttempts to accept this incoming connection (an error may …\nAccept the next incoming bidirectional stream.\nAccepts the next incoming uni-directional stream.\nAccepts this incoming connection using a custom …\nThe ack-eliciting threshold we will request the peer to use\nSpecifies the ACK frequency config (see AckFrequencyConfig …\nAdds a discovery mechanism for this endpoint.\nInforms this Endpoint about addresses of the iroh node.\nInforms this Endpoint about addresses of the iroh node, …\nThe UDP address reported by the remote node.\nThe address.\nThe addresses at which this node might be reachable.\nDerive AEAD using hkdf\nWhether the implementation is permitted to set the spin …\nExtracts the ALPN protocol from the peer’s handshake …\nExtracts the ALPN protocol from the peer’s handshake …\nSets the ALPN protocols that this endpoint will accept on …\nBinds the magic endpoint.\nSets the IPv4 bind address.\nSets the IPv6 bind address.\nSpecifies the amount of time that MTU discovery should …\nThe number of times a black hole was detected in the path\nReturns the local socket addresses on which the underlying …\nConstruct a fresh Controller\nReturns the builder for an Endpoint, with a production …\nThe contents of the chunk\nThe total amount of bytes which have been transferred …\nThe amount of bytes which had been written\nThe amount of full chunks which had been written\nRemoves all discovery services from the builder.\nDuplicate the controller’s state\nCloses the QUIC endpoint and the magic socket.\nCloses the connection immediately.\nIf the connection is closed, the reason why.\nWait for the connection to be closed for any reason.\nType of error\nHow to construct new congestion::Controllers\nCongestion events on the connection\nCurrent state of the congestion control algorithm, for …\nReturns a Watcher that reports the current connection type …\nThe type of connection we have to the node, either direct …\nConnects to a remote Endpoint.\nStarts a connection attempt with a remote Endpoint.\nCreate QUIC error code from TLS alert code\nTLS configuration used for incoming connections\nMaximum quantity of out-of-order crypto layer data to …\nLargest UDP payload size the path currently supports\nCurrent congestion window of the connection\nMaximum number of incoming application datagram bytes to …\nMaximum number of outgoing application datagram bytes to …\nBytes available in the outgoing datagram buffer.\nThe amount of UDP datagrams observed\nReturns the default relay mode.\nWhich directions data flows in\nReturns a Watcher for the direct addresses of this Endpoint…\nOptionally sets a discovery mechanism for this endpoint.\nReturns the discovery mechanism, if configured.\nConfigures the endpoint to also use the mainline DHT with …\nConfigures the endpoint to also use local network …\nConfigures the endpoint to use the default n0 DNS …\nReturns a stream of all remote nodes discovered through …\nOptionally sets a custom DNS resolver to use for this …\nReturns the DNS resolver used in this Endpoint.\nWhether to use “Generic Segmentation Offload” to …\nClass of error as encoded in the specification\nApplication-specific reason code\nDerives keying material from this connection’s TLS …\nNotify the peer that no more data will ever be written to …\nReturns true if the use of staging relays is forced.\nFrame type that triggered the error\nStatistics about frames received on a connection\nStatistics about frames transmitted on a connection\nType of frame that caused the close\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nConstruct a VarInt infallibly\nSucceeds iff x < 2^62\nCreate a VarInt without ensuring it’s in range\nParameters negotiated during the handshake\nParameters negotiated during the handshake.\nWhether there is a possible known network path to the …\nReturns a Watcher for the RelayUrl of the Relay server …\nGet the identity of this stream\nGet the identity of this stream\nIgnores this incoming connection attempt, not sending any …\nMaximum number of received bytes to buffer for each …\nMaximum number of received bytes to buffer for all Incoming\nDistinguishes streams of the same initiator and …\nCreate the initial set of keys given the client’s …\nThe initial value to be used as the maximum UDP payload …\nThe RTT used before an RTT sample is taken\nInitial congestion window\nWhich side of a connection initiated the stream\nSkip verification of SSL certificates from relay servers\nSpecifies the time to wait after completing MTU discovery …\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nConverts this Connecting into a 0-RTT or 0.5-RTT …\nReturns Self for use in down-casting to extract …\nGet the Incoming\nExtract the integer value\nThe amount of I/O operations executed\nCheck if this stream has been opened during 0-RTT.\nReturns true if the Connection associated with this handle …\nCheck if this endpoint is still alive, or already closed.\nPeriod of inactivity before sending a keep-alive packet\nEnables saving the TLS pre-master key for connections.\nOptionally set a list of known nodes.\nElapsed time since this network path was known to exist.\nLast control message received by this node about this …\nElapsed time since the last payload message was received …\nGet the duration since the last activity we received from …\nTime elapsed time since last we have sent to or received …\nThe latency to the remote node over this network path.\nThe latency of the current network path to the remote node.\nReturns the local IP address which was used when the peer …\nThe amount of bytes lost on this path\nThe amount of packets lost on this path\nThe amount of PLPMTUD probe packets lost on this path …\nThe max_ack_delay we will request the peer to use\nMaximum number of incoming bidirectional streams that may …\nVariant of max_concurrent_bidi_streams affecting …\nComputes the maximum size of datagrams that may be passed …\nMaximum duration of inactivity to accept before timing out …\nMaximum number of Incoming to allow to exist at a time\nReturns metrics collected for this endpoint.\nWhether to allow clients to migrate to new addresses\nThe maximum UDP payload size guaranteed to be supported by …\nSpecifies the minimum MTU change to stop the MTU discovery …\nSpecifies the MTU discovery config (see MtuDiscoveryConfig …\nNotifies the system of potential network changes.\nResets path-specific state.\nCreate a default config with a particular handshake token …\nCreate a new StreamId\nInitializes new connection options.\nReturns a Watcher for the current NodeAddr for this …\nReturns the node id of this endpoint.\nThe globally unique identifier for this node.\nThe offset in the stream\nPacket deliveries were confirmed\nPackets were deemed lost or marked congested\nPackets are acked in batches, all with the same now …\nThe known MTU for the current network path has been updated\nOne or more packets were just sent\nMethod for opening a sealed message data\nInitiates a new outgoing bidirectional stream.\nInitiates a new outgoing unidirectional stream.\nMaximum reordering in packet number space before FACK …\nStatistics related to the current transmission path\nThis implies we only use the relay to communicate and do …\nCryptographic identity of the peer.\nNumber of consecutive PTOs after which network is …\nAttempts to read from the stream into buf.\nAttempt to write bytes from buf into the stream.\nThe preferred IPv4 address that will be communicated to …\nThe preferred IPv6 address that will be communicated to …\nGet the priority of the send stream\nSets the proxy url from the environment, in this order:\nSets an explicit proxy url to proxy all HTTP(S) traffic …\nRead data contiguously from the stream.\nRead the next segment of data\nRead the next segments of data\nReceives an application datagram.\nRead an exact number of bytes contiguously from the stream.\nConvenience method to read all remaining data into a buffer\nHuman-readable reason for the close\nHuman-readable reason for the close\nHuman-readable explanation of the reason\nWhether to receive observed address reports from other …\nMaximum number of bytes the peer may transmit across all …\nCompletes when the stream has been reset by the peer or …\nRejects this incoming connection attempt.\nSets the protocol to use for relay connections.\nReturns the relay map for this mode.\nSets the relay servers to assist in establishing …\nRelay server information, if available.\nReturns the peer’s UDP address.\nWhether the socket address that is initiating this …\nReturns information about the remote node identified by a …\nReturns information about all the remote nodes this …\nReturns the NodeId from the peer’s TLS certificate.\nThe reordering threshold we will request the peer to use\nClose the send stream immediately.\nResponds with a retry packet.\nGenerate the integrity tag for a retry packet\nDuration after a retry token was issued for which it’s …\nCurrent best estimate of this connection’s latency …\nCurrent best estimate of this connection’s latency …\nSaturating integer addition. Computes self + rhs, …\nMethod for sealing message data\nSets a secret key to authenticate with other peers.\nReturns the secret_key of this endpoint.\nTransmits data as an unreliable, unordered application …\nWhether to implement fair queuing for send streams having …\nWhether to send observed address reports to peers.\nMaximum number of bytes to transmit to a peer without …\nThe amount of packets sent on this path\nThe amount of PLPMTUD probe packets sent on this path …\nSets the list of accepted ALPN protocols.\nModifies the number of bidirectional streams that may be …\nModifies the number of unidirectional streams that may be …\nSet the priority of the send stream\nSee quinn_proto::TransportConfig::receive_window.\nSets the initial user-defined data to be published in …\nReturns a deduplicated list of Sources merged from all …\nA HashMap of Sources to Durations.\nA stable identifier for this connection.\nStart a server session with this configuration\nReturns connection statistics.\nStop accepting data\nCompletes when the peer stops the stream or reads the …\nMaximum number of bytes the peer may transmit without …\nObject to get current SystemTime\nMaximum reordering in time space before time based loss …\nPrivate key used to authenticate data included in …\nTransport configuration to use for incoming connections\nSet a custom TransportConfig\nSets a custom quinn::TransportConfig for this endpoint.\nSucceeds iff x < 2^62\nSucceeds iff x < 2^62\nSucceeds iff x < 2^62\nThe origin of this direct address.\nStatistics about UDP datagrams received on a connection\nStatistics about UDP datagrams transmitted on a connection\nSpecifies the upper bound to the max UDP payload size that …\nSets the initial user-defined data to be published in …\nConfiguration for sending and handling validation tokens\nSet a custom ValidationTokenConfig\nNumber of ack-eliciting bytes that may be in flight\nSets ALPN identifiers that should be signaled as supported …\nCreate a server config with the given crypto::ServerConfig\nCreate a server config with the given certificate chain to …\nSets the QUIC transport config options for this connection.\nWrite bytes to the stream\nConvenience method to write an entire buffer to the stream\nConvenience method to write an entire list of chunks to …\nConvenience method to write a single chunk in its entirety …\nWrite chunks to the stream\nThe name of the discovery service that discovered the …\nThe name of the application that added the node\nMetrics collected by an crate::endpoint::Endpoint.\nEnum of metrics for the module\nEnum of metrics for the module\nMetrics tracked for the relay server\nNumber of times this server has accepted a connection.\nBytes received from a FrameType::SendPacket\nBytes sent from a FrameType::SendPacket\nNumber of connections with a successful handshake that …\nNumber of connections with a successful handshake.\nNumber of client connections which have had any frames …\nFrameType::SendPacket dropped that are disco messages\nFrameType::SendPacket received that are disco messages\nFrameType::SendPacket sent that are disco messages\nNumber of connections we have removed because of an error\nNumber of times the external address obtained via port …\nNumber of frames received from client connection which …\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nNumber of FrameType::Pings received\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nNumber of updates to the local port.\nMetrics collected by the endpoint’s socket.\nNumber of mapping tasks started.\nNumber of failed mapping tasks.\nMetrics collected by net reports.\nNumber of nodes we have attempted to contact.\nNumber of nodes we have managed to contact directly.\nThe number of direct connections we have made to peers.\nThe number of direct connections we have lost to peers.\nThe number of connections to peers we have added over …\nThe number of connections to peers we have removed over …\nPackets of other FrameTypes dropped\nPackets of other FrameTypes received\nPackets of other FrameTypes sent\nNumber of PCP probes that found it available.\nNumber of PCP probes executed.\nMetrics collected by the portmapper service.\nNumber of probing tasks started.\nNumber of QUIC datagrams received.\nNumber of datagrams received using GRO\nNumber of accepted ‘iroh derp http’ connection upgrades\nFrameType::SendPacket dropped, that are not disco messages\nFrameType::SendPacket received, that are not disco messages\nFrameType::SendPacket sent, that are not disco messages\nNumber of FrameType::Pongs sent\nNumber of unique client keys per day\nNumber of FrameType::Unknown received\nNumber of UPnP probes that found it available.\nNumber of UPnP probes that resulted in a gateway different …\nNumber of UPnP probes executed.\nNumber of failed Upnp probes.\nNumber of accepted websocket connections\nSender to the main service.\nClient to run net_reports.\nEnum of metrics for the module\nOptions for running probes\nPieces needed to do QUIC address discovery.\nLatencies per relay node.\nA net_report report.\nReturns a new address to send messages to this actor.\nAttempts to bind a local socket to send STUN packets from.\nCaptivePortal is set when we think there’s a captive …\nA client config.\nCreate an Options that disables all probes\nA QUIC Endpoint\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nRuns a net_report, returning the report.\nip:port of global IPv4\n[ip]:port of global IPv6\nWhether the router supports communicating between two …\nEnable or disable https probe\nEnable or disable icmp_v4 probe\nEnable or disable icmp_v6 probe\nAn ICMPv4 round trip completed, None if not checked.\nAn ICMPv6 round trip completed, None if not checked.\nSkip cert verification\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nEnable ipv4 QUIC address discovery probes\nAn IPv4 STUN round trip completed.\nan IPv4 packet was able to be sent\nEnable ipv6 QUIC address discovery probes\nAn IPv6 STUN round trip completed.\nAn IPv6 packet was able to be sent\nReturns an iterator over all the relays and their …\nWhether STUN results depend on which STUN server you’re …\nWhether STUN results depend on which STUN server you’re …\nCreates a new net_report client.\ncould bind a socket to ::1\nProbe indicating the presence of port mapping protocols on …\nNone for unknown\nEnable quic probes\nPass a received STUN packet to the net_reporter.\nkeyed by relay Url\nkeyed by relay Url\nkeyed by relay Url\nNumber of reports executed by net_report, including full …\nNumber of full reports executed by net_report\nIncoming STUN packets dropped due to a full receiving …\nNumber of IPv4 STUN packets received.\nNumber of IPv6 STUN packets received.\nNumber of IPv4 STUN packets sent.\nNumber of IPv6 STUN packets sent.\nSet the ipv4 stun socket and enable ipv4 stun probes\nSet the ipv6 stun socket and enable ipv6 stun probes\nA UDP STUN round trip completed.\nThe DNS name for the iroh TXT record.\nError returned when an input value is too long for UserData…\nData about a node that may be published to and resolved …\nExtension methods for NodeId to encode to and decode from …\nInformation about a node that may be published to and …\nUnder the hood this is a UTF-8 String is no longer than …\nThe information published about the node.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nParses a NodeId from [z-base-32] encoding.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nThe NodeId of the node this is about.\nEncodes a NodeId in [z-base-32] encoding.\nWraps an existing protocol, limiting its access, based on …\nReturned from Router::accept\nThe protocol handler has been newly inserted.\nHandler for incoming connections.\nThe protocol handler replaced a previously registered …\nThe built router.\nBuilder for creating a Router for accepting protocols.\nHandle an incoming connection.\nAdds a protocol to the list of accepted protocols.\nConfigures the router to accept the ProtocolHandler when …\nCreates a new Router using given Endpoint.\nReturns the Endpoint stored in this router.\nReturns the Endpoint of the node.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCreates a new user error from an arbitrary error type.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nChecks if the router is already shutdown.\nCreates a new router builder using given Endpoint.\nCreate a new AccessLimit.\nOptional interception point to handle the Connecting state.\nCalled when the router shuts down.\nShuts down the accept loop cleanly.\nSpawns an accept loop and returns a handle to it …\nStops accepting a protocol.\nA drop guard to clean up test infrastructure.\nHandle and drop guard for test DNS and Pkarr servers.\nCreate a ConcurrentDiscovery with DnsDiscovery and …\nCreate a DnsResolver configured to use the test DNS server.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nThe socket address of the DNS server.\nThe node origin domain.\nWait until a Pkarr announce for a node is published to the …\nThe HTTP URL of the Pkarr server.\nRun DNS and Pkarr servers on localhost.\nRuns a relay server with STUN and QUIC enabled suitable …\nRuns a relay server.\nRuns a relay server with STUN enabled suitable for tests.\nRun DNS and Pkarr servers on localhost with the specified …")
\ No newline at end of file
+searchState.loadedDescShard("iroh", 0, "Peer-to-peer QUIC connections.\nError when decoding.\nThe encoded information had the wrong length.\nError when decoding the public key.\nError when deserialising a PublicKey or a SecretKey.\nThe length of an ed25519 PublicKey, in bytes.\nNetwork-level addressing information for an iroh node.\nThe identifier for a node in the (iroh) network.\nA public key.\nRelays over the custom relaying protocol with a custom …\nConfiguration of all the relay servers that can be used.\nInformation on a specific relay server.\nThe HTTP upgrade protocol used for relaying.\nA URL identifying a relay server.\nCan occur when parsing a string into a RelayUrl.\nA secret key.\nRelays over websockets.\nGet this public key as a byte array.\nIs this a known node?\nDefault values used in iroh\nReturns the direct addresses of this peer.\nSocket addresses where the peer might be reached directly.\nNode address discovery.\nThis module exports a DNS resolver, which is also the …\nCreate an empty relay map.\nThe Endpoint allows establishing connections to other iroh …\nConvert to a hex string limited to the first 5 bytes for a …\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the addressing info from given ticket.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCreates a RelayMap from a RelayUrl.\nReturns the argument unchanged.\nReturns the argument unchanged.\nConstruct a PublicKey from a slice of bytes.\nCreate a secret key from its byte representation.\nCreates a RelayMap from an iterator of RelayUrl.\nCreates a new NodeAddr from its parts.\nGenerate a new SecretKey with a randomness generator.\nGet the given node.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nReturns true, if only a NodeId is present.\nAre there any nodes in this map?\nHow many nodes are known?\nCo-locating all of the iroh metrics structs\nChecks the network conditions from the current host.\nCreates a new NodeAddr with no relay_url and no …\nThe node’s identifier.\nSupport for handling DNS resource records for dialing by …\nReturns an Iterator over all known nodes.\nTries to match the value of an HTTP upgrade header to …\nTools for spawning an accept loop that routes incoming …\nReturns the VerifyingKey for this PublicKey.\nThe public key of this SecretKey.\nConfiguration to speak to the QUIC endpoint on the relay …\nReturns the relay url of this peer.\nThe node’s home relay url.\nReturns the SigningKey for this SecretKey.\nSign the given message and return a digital signature\nWhether this relay server should only be used for STUN …\nThe stun port of the relay server.\nInternal utilities to support testing.\nConvert this to the bytes representing the secret part. …\nThe HTTP upgrade header used or expected.\nThe RelayUrl where this relay server can be dialed.\nReturns the sorted relay URLs.\nVerify a signature on a message with this secret key’s …\nAdds the given direct addresses.\nAdds a relay url.\nThe default HTTPS port used by the Relay server.\nThe default HTTP port used by the Relay server.\nThe default metrics port used by the Relay server.\nThe default QUIC port used by the Relay server to accept …\nThe default STUN port used by the Relay server.\nProduction configuration.\nStaging configuration.\nHostname of the default Asia-Pacific relay.\nHostname of the default EU relay.\nHostname of the default NA relay.\nGet the default RelayNode for Asia-Pacific\nGet the default RelayNode for EU.\nGet the default RelayNode for NA.\nGet the default RelayMap.\nHostname of the default EU relay.\nHostname of the default NA relay.\nGet the default RelayNode for EU.\nGet the default RelayNode for NA.\nGet the default RelayMap.\nA discovery service that combines multiple discovery …\nNode discovery for super::Endpoint.\nDiscovery errors\nNode discovery results from Discovery services.\nError returned when a discovery watch stream lagged too …\nThe max byte length allowed for user-defined data.\nData about a node that may be published to and resolved …\nInformation about a node that may be published to and …\nUnder the hood this is a UTF-8 String is no longer than …\nAdds a Discovery service.\nAdds direct addresses to the node data.\nRemoves all direct addresses from the node data.\nThe information published about the node.\nReturns the direct addresses of the node.\nDNS node discovery for iroh\nCreates an empty ConcurrentDiscovery.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCreates a new user error from an arbitrary error type.\nCreates a new user error from an arbitrary boxed error …\nCreates a new NodeInfo from its parts.\nParses a NodeInfo from a pkarr::SignedPacket.\nCreates a new ConcurrentDiscovery.\nParses a NodeInfo from a TXT records lookup.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nConverts into a NodeAddr without cloning.\nConverts into a NodeAddr without cloning.\nReturns the optional timestamp when this node info was …\nA discovery service that uses an mdns-like service to …\nCreates a new NodeData with a relay URL and a set of …\nCreates a new NodeInfo with an empty NodeData.\nCreates a new DiscoveryItem from a NodeInfo.\nReturns the node id of the discovered node.\nThe NodeId of the node this is about.\nReturns the NodeInfo for the discovered node.\nA discovery service which publishes and resolves node …\nReturns the provenance of this discovery item.\nPublishes the given NodeData to the discovery mechanism.\nReturns the relay URL of the node.\nResolves the DiscoveryItem for the given NodeId.\nSets the relay URL of the node data.\nSets the user-defined data of the node data.\nA static node discovery to manually add node addressing …\nSubscribe to all addresses that get passively discovered.\nConverts into a NodeAddr by cloning the needed fields.\nConverts into a NodeAddr by cloning the needed fields.\nCreates a pkarr::SignedPacket.\nConverts into a list of {key}={value} strings.\nReturns the optional user-defined data of the node.\nReturns any user-defined data.\nThe number of skipped messages\nSets the direct addresses and returns the updated node …\nSets the direct addresses and returns the updated node …\nSets the relay URL and returns the updated node data.\nSets the relay URL and returns the updated node info.\nSets the user-defined data and returns the updated node …\nSets the user-defined data and returns the updated node …\nDNS node discovery\nThe n0 testing DNS node origin, for production.\nThe n0 testing DNS node origin, for testing.\nReturns the argument unchanged.\nCalls U::from(self).\nCreates a new DNS discovery using the iroh.link domain.\nCreates a new DNS discovery.\nDiscovery using swarm-discovery, a variation on mdns\nName of this discovery service.\nReturns the argument unchanged.\nCalls U::from(self).\nCreate a new MdnsDiscovery Service.\nDefault TTL for the records in the pkarr signed packet.\nInterval in which to republish the node info even if …\nThe production pkarr relay run by number 0.\nThe testing pkarr relay run by number 0.\nPublisher of node discovery information to a pkarr relay.\nA pkarr client to publish pkarr::SignedPackets to a pkarr …\nResolver of node discovery information from a pkarr relay.\nPkarr based node discovery for iroh, supporting both relay …\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCreates a pkarr publisher which uses the number 0 pkarr …\nCreates a pkarr resolver which uses the number 0 pkarr …\nCreates a new publisher for the SecretKey.\nCreates a new publisher using the pkarr relay server at …\nCreates a new client.\nPublishes a SignedPacket.\nResolves a SignedPacket for the given NodeId.\nPublishes the addressing information about this node to a …\nCreates a new PkarrPublisher with a custom TTL and …\nBuilder for DhtDiscovery.\nPkarr Mainline DHT and relay server node discovery.\nBuilds the discovery mechanism.\nCreates a new builder for DhtDiscovery.\nExplicitly sets the pkarr client to use.\nSets whether to publish to the Mainline DHT.\nReturns the argument unchanged.\nReturns the argument unchanged.\nSets whether to include the direct addresses in the DNS …\nSets the initial delay before the first publish.\nCalls U::from(self).\nCalls U::from(self).\nUses the default number 0 pkarr relay URL.\nSets the pkarr relay URL to use.\nSets the republish delay for the DHT.\nSets the secret key to use for signing the DNS packets.\nSets the time-to-live value for the DNS packets.\nThe provenance string for this discovery implementation.\nA static node discovery to manually add node addressing …\nAugments node addressing information for the given node ID.\nReturns the argument unchanged.\nCreates a static discovery instance from node addresses.\nReturns node addressing information for the given node ID.\nCalls U::from(self).\nCreates a new static discovery instance.\nRemoves all node addressing information for the given node …\nSets node addressing information for the given node ID.\nThe DNS resolver used throughout iroh.\nThe n0 testing DNS node origin, for production.\nThe n0 testing DNS node origin, for testing.\nRemoves all entries from the cache.\nReturns the argument unchanged.\nCalls U::from(self).\nPerform an ipv4 lookup with a timeout.\nResolve IPv4 and IPv6 in parallel with a timeout.\nRace an ipv4 and ipv6 lookup with a timeout in a staggered …\nPerform an ipv4 lookup with a timeout in a staggered …\nPerform an ipv6 lookup with a timeout.\nPerform an ipv6 lookup with a timeout in a staggered …\nLooks up node info by DNS name.\nLooks up node info by DNS name in a staggered fashion.\nLooks up node info by NodeId and origin domain name.\nLooks up node info by NodeId and origin domain name.\nLookup a TXT record.\nCreate a new DNS resolver with sensible cross-platform …\nResolve a hostname from a URL to an IP address.\nCreate a new DNS resolver configured with a single UDP DNS …\nthe endpoint has reached the confidentiality or integrity …\nthe application or application protocol caused the …\nFuture produced by Endpoint::accept.\nFuture produced by Connection::accept_bi\nFuture produced by Connection::accept_uni\nParameters for controlling the peer’s acknowledgement …\nA key for sealing data with AEAD-based algorithms\nUses all available paths\nApplication layer added the address directly.\nReason given by an application for closing the connection\nThe peer closed the connection\nBuilder for Endpoint.\nthe number of connection IDs provided by the peer exceeds …\nthe server refused to accept a new connection\nreceived more data in CRYPTO frames than can be buffered\nWe received a CallMeMaybe.\nA chunk of data from the receive stream\nThe connection could not be created because not enough of …\nError indicating that a stream has not been opened or has …\nThe stream has already been stopped, finished, or reset\nThe stream has already been finished or reset\nOptions for the Endpoint::connect_with_opts function.\nIn-progress connection attempt future\nA QUIC connection.\nReason given by the transport for closing the connection\nThe peer’s QUIC stack aborted the connection …\nReasons why a connection might be lost\nThe connection was lost\nThe connection was lost\nThe connection was lost\nThe connection was lost\nThe connection was lost\nConnection statistics\nThe type of connection we have to the endpoint.\nThe type of control message we have received.\nCommon interface for different congestion controllers\nConstructs controllers on demand\nGeneric crypto errors\nServer-side configuration for the crypto protocol\nUse a custom relay map.\nUse the default relay map, with production relay servers …\nDirect UDP connection\nA direct address on which an iroh-node might be …\nInformation about a direct address.\nThe type of direct address.\nDatagram support is disabled locally\nDisable relay servers completely.\nThe address was discovered by a discovery service.\nEnvironment variable to force the use of staging relays.\nControls an iroh node, establishing connections with other …\nError returned by Session::export_keying_material.\nreceived a STREAM frame or a RESET_STREAM frame containing …\nreceived more data than permitted in advertised data limits\nreceived a frame that was badly formatted\nThe stream finished before all bytes were read\nNumber of frames transmitted of each frame type\nA pseudo random key for HKDF\nthe endpoint encountered an internal error and cannot …\nreceived an invalid Retry Token in a client Initial\nAttempted an ordered read following an unordered read\nAn incoming connection for which the server has not yet …\nAdaptor to let Incoming be awaited like a Connecting.\nkey update error\nA locally bound socket address.\nThe local application closed the connection\nThe largest representable value\nThe largest encoded value length\nBoth a UDP and a relay connection are used.\nParameters governing MTU discovery.\nthe connection is being closed abruptly in the absence of …\nno viable network path exists\nApplication layer with a specific name added the node …\nWe have no verified connection to this PublicKey\nFuture produced by Connection::open_bi\nFuture produced by Connection::open_uni\ndetected an error with protocol compliance that was not …\nDefines the mode of path selection for all traffic flowing …\nStatistics related to a transmission path\nWe received a Ping from the node.\nWe received a Pong from the node.\nAn address assigned by the router using port mapping.\nAn error occurred during reading\nFuture produced by Connection::read_datagram\nErrors that arise from reading from a stream.\nA read error occurred\nErrors that arise from reading from a stream.\nErrors from RecvStream::read_to_end\nA stream that can only be used to receive data\nRelay connection over relay\nA node communicated with us first via relay.\nConfiguration of the relay servers for an Endpoint.\nForces all traffic to go exclusively through relays\nDetails about a remote iroh node which is known to this …\nThe peer abandoned transmitting data on this stream\nThe peer is unable to continue processing this connection, …\nErrors that arise while waiting for a stream to be reset\nError for attempting to retry an Incoming which already …\nreceived a frame for a stream identifier that exceeded …\nreceived a frame for a stream that was not in a state that …\nAddress was loaded from the fs.\nErrors that can arise when sending a datagram\nA stream that can only be used to send data\nParameters governing incoming connections\nThe origin or source through which an address associated …\nUse the staging relay servers from n0.\nThe peer is no longer accepting data on this stream\nErrors that arise while monitoring for a send stream stop …\nIdentifier for a stream within a particular connection\nPublic internet address discovered via STUN.\nHard NAT: STUN’ed IPv4 address + local fixed port.\nreceived transport parameters that were badly formatted, …\nCommunication with the peer has lapsed for longer than the …\nThe datagram is larger than the connection can currently …\nThe stream is larger than the user-supplied limit\nParameters governing the core QUIC state machine\nTransport-level errors occur when a peer violates the …\nThe peer violated the QUIC specification as understood by …\nTransport-level error code\nA node communicated with us first via UDP.\nStatistics about UDP datagrams transmitted or received on …\nNot yet determined..\nThe peer does not support receiving datagram frames\nError indicating that the specified QUIC version is not …\nAn integer less than 2^62\nThe peer doesn’t implement any supported version\nA handle to some connection internals, use with care.\nErrors that arise from writing to a stream\nIndicates how many bytes and chunks had been transferred …\nFuture that completes when a connection is fully …\nThis was a 0-RTT stream and the server rejected it\nThis was a 0-RTT stream and the server rejected it\nThis was a 0-RTT stream and the server rejected it\nThis was a 0-RTT stream and the server rejected it\nAccepts an incoming connection on the endpoint.\nAttempts to accept this incoming connection (an error may …\nAccept the next incoming bidirectional stream.\nAccepts the next incoming uni-directional stream.\nAccepts this incoming connection using a custom …\nThe ack-eliciting threshold we will request the peer to use\nSpecifies the ACK frequency config (see AckFrequencyConfig …\nAdds a discovery mechanism for this endpoint.\nInforms this Endpoint about addresses of the iroh node.\nInforms this Endpoint about addresses of the iroh node, …\nThe UDP address reported by the remote node.\nThe address.\nThe addresses at which this node might be reachable.\nDerive AEAD using hkdf\nWhether the implementation is permitted to set the spin …\nExtracts the ALPN protocol from the peer’s handshake …\nExtracts the ALPN protocol from the peer’s handshake …\nSets the ALPN protocols that this endpoint will accept on …\nBinds the magic endpoint.\nSets the IPv4 bind address.\nSets the IPv6 bind address.\nSpecifies the amount of time that MTU discovery should …\nThe number of times a black hole was detected in the path\nReturns the local socket addresses on which the underlying …\nConstruct a fresh Controller\nReturns the builder for an Endpoint, with a production …\nThe contents of the chunk\nThe total amount of bytes which have been transferred …\nThe amount of bytes which had been written\nThe amount of full chunks which had been written\nRemoves all discovery services from the builder.\nDuplicate the controller’s state\nCloses the QUIC endpoint and the magic socket.\nCloses the connection immediately.\nIf the connection is closed, the reason why.\nWait for the connection to be closed for any reason.\nType of error\nHow to construct new congestion::Controllers\nCongestion events on the connection\nCurrent state of the congestion control algorithm, for …\nReturns a Watcher that reports the current connection type …\nThe type of connection we have to the node, either direct …\nConnects to a remote Endpoint.\nStarts a connection attempt with a remote Endpoint.\nCreate QUIC error code from TLS alert code\nTLS configuration used for incoming connections\nMaximum quantity of out-of-order crypto layer data to …\nLargest UDP payload size the path currently supports\nCurrent congestion window of the connection\nMaximum number of incoming application datagram bytes to …\nMaximum number of outgoing application datagram bytes to …\nBytes available in the outgoing datagram buffer.\nThe amount of UDP datagrams observed\nReturns the default relay mode.\nWhich directions data flows in\nReturns a Watcher for the direct addresses of this Endpoint…\nOptionally sets a discovery mechanism for this endpoint.\nReturns the discovery mechanism, if configured.\nConfigures the endpoint to also use the mainline DHT with …\nConfigures the endpoint to also use local network …\nConfigures the endpoint to use the default n0 DNS …\nReturns a stream of all remote nodes discovered through …\nOptionally sets a custom DNS resolver to use for this …\nReturns the DNS resolver used in this Endpoint.\nWhether to use “Generic Segmentation Offload” to …\nClass of error as encoded in the specification\nApplication-specific reason code\nDerives keying material from this connection’s TLS …\nNotify the peer that no more data will ever be written to …\nReturns true if the use of staging relays is forced.\nFrame type that triggered the error\nStatistics about frames received on a connection\nStatistics about frames transmitted on a connection\nType of frame that caused the close\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nConstruct a VarInt infallibly\nSucceeds iff x < 2^62\nCreate a VarInt without ensuring it’s in range\nParameters negotiated during the handshake\nParameters negotiated during the handshake.\nWhether there is a possible known network path to the …\nReturns a Watcher for the RelayUrl of the Relay server …\nGet the identity of this stream\nGet the identity of this stream\nIgnores this incoming connection attempt, not sending any …\nMaximum number of received bytes to buffer for each …\nMaximum number of received bytes to buffer for all Incoming\nDistinguishes streams of the same initiator and …\nCreate the initial set of keys given the client’s …\nThe initial value to be used as the maximum UDP payload …\nThe RTT used before an RTT sample is taken\nInitial congestion window\nWhich side of a connection initiated the stream\nSkip verification of SSL certificates from relay servers\nSpecifies the time to wait after completing MTU discovery …\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nConverts this Connecting into a 0-RTT or 0.5-RTT …\nReturns Self for use in down-casting to extract …\nGet the Incoming\nExtract the integer value\nThe amount of I/O operations executed\nCheck if this stream has been opened during 0-RTT.\nReturns true if the Connection associated with this handle …\nCheck if this endpoint is still alive, or already closed.\nPeriod of inactivity before sending a keep-alive packet\nEnables saving the TLS pre-master key for connections.\nOptionally set a list of known nodes.\nElapsed time since this network path was known to exist.\nLast control message received by this node about this …\nElapsed time since the last payload message was received …\nGet the duration since the last activity we received from …\nTime elapsed time since last we have sent to or received …\nThe latency to the remote node over this network path.\nThe latency of the current network path to the remote node.\nReturns the local IP address which was used when the peer …\nThe amount of bytes lost on this path\nThe amount of packets lost on this path\nThe amount of PLPMTUD probe packets lost on this path …\nThe max_ack_delay we will request the peer to use\nMaximum number of incoming bidirectional streams that may …\nVariant of max_concurrent_bidi_streams affecting …\nComputes the maximum size of datagrams that may be passed …\nMaximum duration of inactivity to accept before timing out …\nMaximum number of Incoming to allow to exist at a time\nReturns metrics collected for this endpoint.\nWhether to allow clients to migrate to new addresses\nThe maximum UDP payload size guaranteed to be supported by …\nSpecifies the minimum MTU change to stop the MTU discovery …\nSpecifies the MTU discovery config (see MtuDiscoveryConfig …\nNotifies the system of potential network changes.\nResets path-specific state.\nCreate a default config with a particular handshake token …\nCreate a new StreamId\nInitializes new connection options.\nReturns a Watcher for the current NodeAddr for this …\nReturns the node id of this endpoint.\nThe globally unique identifier for this node.\nThe offset in the stream\nPacket deliveries were confirmed\nPackets were deemed lost or marked congested\nPackets are acked in batches, all with the same now …\nThe known MTU for the current network path has been updated\nOne or more packets were just sent\nMethod for opening a sealed message data\nInitiates a new outgoing bidirectional stream.\nInitiates a new outgoing unidirectional stream.\nMaximum reordering in packet number space before FACK …\nStatistics related to the current transmission path\nThis implies we only use the relay to communicate and do …\nCryptographic identity of the peer.\nNumber of consecutive PTOs after which network is …\nAttempts to read from the stream into buf.\nAttempt to write bytes from buf into the stream.\nThe preferred IPv4 address that will be communicated to …\nThe preferred IPv6 address that will be communicated to …\nGet the priority of the send stream\nSets the proxy url from the environment, in this order:\nSets an explicit proxy url to proxy all HTTP(S) traffic …\nRead data contiguously from the stream.\nRead the next segment of data\nRead the next segments of data\nReceives an application datagram.\nRead an exact number of bytes contiguously from the stream.\nConvenience method to read all remaining data into a buffer\nHuman-readable reason for the close\nHuman-readable reason for the close\nHuman-readable explanation of the reason\nWhether to receive observed address reports from other …\nMaximum number of bytes the peer may transmit across all …\nCompletes when the stream has been reset by the peer or …\nRejects this incoming connection attempt.\nSets the protocol to use for relay connections.\nReturns the relay map for this mode.\nSets the relay servers to assist in establishing …\nRelay server information, if available.\nReturns the peer’s UDP address.\nWhether the socket address that is initiating this …\nReturns information about the remote node identified by a …\nReturns information about all the remote nodes this …\nReturns the NodeId from the peer’s TLS certificate.\nThe reordering threshold we will request the peer to use\nClose the send stream immediately.\nResponds with a retry packet.\nGenerate the integrity tag for a retry packet\nDuration after a retry token was issued for which it’s …\nCurrent best estimate of this connection’s latency …\nCurrent best estimate of this connection’s latency …\nSaturating integer addition. Computes self + rhs, …\nMethod for sealing message data\nSets a secret key to authenticate with other peers.\nReturns the secret_key of this endpoint.\nTransmits data as an unreliable, unordered application …\nWhether to implement fair queuing for send streams having …\nWhether to send observed address reports to peers.\nMaximum number of bytes to transmit to a peer without …\nThe amount of packets sent on this path\nThe amount of PLPMTUD probe packets sent on this path …\nSets the list of accepted ALPN protocols.\nModifies the number of bidirectional streams that may be …\nModifies the number of unidirectional streams that may be …\nSet the priority of the send stream\nSee quinn_proto::TransportConfig::receive_window.\nSets the initial user-defined data to be published in …\nReturns a deduplicated list of Sources merged from all …\nA HashMap of Sources to Durations.\nA stable identifier for this connection.\nStart a server session with this configuration\nReturns connection statistics.\nStop accepting data\nCompletes when the peer stops the stream or reads the …\nMaximum number of bytes the peer may transmit without …\nObject to get current SystemTime\nMaximum reordering in time space before time based loss …\nPrivate key used to authenticate data included in …\nTransport configuration to use for incoming connections\nSet a custom TransportConfig\nSets a custom quinn::TransportConfig for this endpoint.\nSucceeds iff x < 2^62\nSucceeds iff x < 2^62\nSucceeds iff x < 2^62\nThe origin of this direct address.\nStatistics about UDP datagrams received on a connection\nStatistics about UDP datagrams transmitted on a connection\nSpecifies the upper bound to the max UDP payload size that …\nSets the initial user-defined data to be published in …\nConfiguration for sending and handling validation tokens\nSet a custom ValidationTokenConfig\nNumber of ack-eliciting bytes that may be in flight\nSets ALPN identifiers that should be signaled as supported …\nCreate a server config with the given crypto::ServerConfig\nCreate a server config with the given certificate chain to …\nSets the QUIC transport config options for this connection.\nWrite bytes to the stream\nConvenience method to write an entire buffer to the stream\nConvenience method to write an entire list of chunks to …\nConvenience method to write a single chunk in its entirety …\nWrite chunks to the stream\nThe name of the discovery service that discovered the …\nThe name of the application that added the node\nMetrics collected by an crate::endpoint::Endpoint.\nEnum of metrics for the module\nEnum of metrics for the module\nMetrics tracked for the relay server\nNumber of times this server has accepted a connection.\nBytes received from a FrameType::SendPacket\nBytes sent from a FrameType::SendPacket\nNumber of connections with a successful handshake that …\nNumber of connections with a successful handshake.\nNumber of client connections which have had any frames …\nFrameType::SendPacket dropped that are disco messages\nFrameType::SendPacket received that are disco messages\nFrameType::SendPacket sent that are disco messages\nNumber of connections we have removed because of an error\nNumber of times the external address obtained via port …\nNumber of frames received from client connection which …\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nNumber of FrameType::Pings received\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nNumber of updates to the local port.\nMetrics collected by the endpoint’s socket.\nNumber of mapping tasks started.\nNumber of failed mapping tasks.\nMetrics collected by net reports.\nNumber of nodes we have attempted to contact.\nNumber of nodes we have managed to contact directly.\nThe number of direct connections we have made to peers.\nThe number of direct connections we have lost to peers.\nThe number of connections to peers we have added over …\nThe number of connections to peers we have removed over …\nPackets of other FrameTypes dropped\nPackets of other FrameTypes received\nPackets of other FrameTypes sent\nNumber of PCP probes that found it available.\nNumber of PCP probes executed.\nMetrics collected by the portmapper service.\nNumber of probing tasks started.\nNumber of QUIC datagrams received.\nNumber of datagrams received using GRO\nNumber of accepted ‘iroh derp http’ connection upgrades\nFrameType::SendPacket dropped, that are not disco messages\nFrameType::SendPacket received, that are not disco messages\nFrameType::SendPacket sent, that are not disco messages\nNumber of FrameType::Pongs sent\nNumber of unique client keys per day\nNumber of FrameType::Unknown received\nNumber of UPnP probes that found it available.\nNumber of UPnP probes that resulted in a gateway different …\nNumber of UPnP probes executed.\nNumber of failed Upnp probes.\nNumber of accepted websocket connections\nSender to the main service.\nClient to run net_reports.\nEnum of metrics for the module\nOptions for running probes\nPieces needed to do QUIC address discovery.\nLatencies per relay node.\nA net_report report.\nReturns a new address to send messages to this actor.\nAttempts to bind a local socket to send STUN packets from.\nCaptivePortal is set when we think there’s a captive …\nA client config.\nCreate an Options that disables all probes\nA QUIC Endpoint\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nRuns a net_report, returning the report.\nip:port of global IPv4\n[ip]:port of global IPv6\nWhether the router supports communicating between two …\nEnable or disable https probe\nEnable or disable icmp_v4 probe\nEnable or disable icmp_v6 probe\nAn ICMPv4 round trip completed, None if not checked.\nAn ICMPv6 round trip completed, None if not checked.\nSkip cert verification\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nEnable ipv4 QUIC address discovery probes\nAn IPv4 STUN round trip completed.\nan IPv4 packet was able to be sent\nEnable ipv6 QUIC address discovery probes\nAn IPv6 STUN round trip completed.\nAn IPv6 packet was able to be sent\nReturns an iterator over all the relays and their …\nWhether STUN results depend on which STUN server you’re …\nWhether STUN results depend on which STUN server you’re …\nCreates a new net_report client.\ncould bind a socket to ::1\nProbe indicating the presence of port mapping protocols on …\nNone for unknown\nEnable quic probes\nPass a received STUN packet to the net_reporter.\nkeyed by relay Url\nkeyed by relay Url\nkeyed by relay Url\nNumber of reports executed by net_report, including full …\nNumber of full reports executed by net_report\nIncoming STUN packets dropped due to a full receiving …\nNumber of IPv4 STUN packets received.\nNumber of IPv6 STUN packets received.\nNumber of IPv4 STUN packets sent.\nNumber of IPv6 STUN packets sent.\nSet the ipv4 stun socket and enable ipv4 stun probes\nSet the ipv6 stun socket and enable ipv6 stun probes\nA UDP STUN round trip completed.\nThe DNS name for the iroh TXT record.\nError returned when an input value is too long for UserData…\nData about a node that may be published to and resolved …\nExtension methods for NodeId to encode to and decode from …\nInformation about a node that may be published to and …\nUnder the hood this is a UTF-8 String is no longer than …\nThe information published about the node.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nParses a NodeId from [z-base-32] encoding.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nThe NodeId of the node this is about.\nEncodes a NodeId in [z-base-32] encoding.\nWraps an existing protocol, limiting its access, based on …\nReturned from Router::accept\nThe protocol handler has been newly inserted.\nHandler for incoming connections.\nThe protocol handler replaced a previously registered …\nThe built router.\nBuilder for creating a Router for accepting protocols.\nHandle an incoming connection.\nAccepts incoming connections with this alpn via …\nConfigures the router to accept incoming connections with …\nCreates a new Router using given Endpoint.\nReturns the Endpoint stored in this router.\nReturns the Endpoint of the node.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCreates a new user error from an arbitrary error type.\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nCalls U::from(self).\nChecks if the router is already shutdown.\nCreates a new router builder using given Endpoint.\nCreate a new AccessLimit.\nOptional interception point to handle the Connecting state.\nCalled when the router shuts down.\nShuts down the accept loop and endpoint cleanly.\nSpawns an accept loop and returns a handle to it …\nStops accepting connections with this alpn.\nA drop guard to clean up test infrastructure.\nHandle and drop guard for test DNS and Pkarr servers.\nCreate a ConcurrentDiscovery with DnsDiscovery and …\nCreate a DnsResolver configured to use the test DNS server.\nReturns the argument unchanged.\nReturns the argument unchanged.\nCalls U::from(self).\nCalls U::from(self).\nThe socket address of the DNS server.\nThe node origin domain.\nWait until a Pkarr announce for a node is published to the …\nThe HTTP URL of the Pkarr server.\nRun DNS and Pkarr servers on localhost.\nRuns a relay server with STUN and QUIC enabled suitable …\nRuns a relay server.\nRuns a relay server with STUN enabled suitable for tests.\nRun DNS and Pkarr servers on localhost with the specified …")
\ No newline at end of file
diff --git a/pr/3355/docs/src/iroh/protocol.rs.html b/pr/3355/docs/src/iroh/protocol.rs.html
index ecf05076c2..82f899880a 100644
--- a/pr/3355/docs/src/iroh/protocol.rs.html
+++ b/pr/3355/docs/src/iroh/protocol.rs.html
@@ -155,7 +155,7 @@
155#[derive(Debug, Snafu)]
156#[non_exhaustive]
157pub enum RouterError {
-158 #[snafu(display("The router actor closed"))]
+158 #[snafu(display("Endpoint closed"))]
159 Closed {},
160}
161
@@ -164,7 +164,7 @@
164#[snafu(module)]
165#[non_exhaustive]
166pub enum StopAcceptingError {
-167 #[snafu(display("The router actor closed"))]
+167 #[snafu(display("Endpoint closed"))]
168 Closed {},
169 #[snafu(display("The ALPN requested to be removed is not registered"))]
170 UnknownAlpn {},
@@ -381,536 +381,540 @@
381 self.cancel_token.is_cancelled()
382 }
383
-384 /// Adds a protocol to the list of accepted protocols.
+384 /// Accepts incoming connections with this `alpn` via [`ProtocolHandler`].
385 ///
-386 /// Configures the router to accept the [`ProtocolHandler`] when receiving a connection
-387 /// with this `alpn`.
+386 /// After this function returns, new connections with this `alpn` will be handled
+387 /// by the passed `handler`.
388 ///
-389 /// Once the function yields, new connections with this `alpn` will be handled.
-390 ///
-391 /// If a protocol handler was already registered for `alpn`, the previous handler will be shutdown.
-392 ///
-393 /// Returns `true` if
-394 pub async fn accept(
-395 &self,
-396 alpn: impl AsRef<[u8]>,
-397 handler: impl ProtocolHandler,
-398 ) -> Result<AddProtocolOutcome, RouterError> {
-399 let (reply, reply_rx) = oneshot::channel();
-400 self.tx
-401 .send(ToRouterTask::Accept {
-402 alpn: alpn.as_ref().to_vec(),
-403 handler: Arc::new(handler),
-404 reply,
-405 })
-406 .await
-407 .map_err(|_| RouterError::Closed {})?;
-408 reply_rx.await.map_err(|_| RouterError::Closed {})
-409 }
-410
-411 /// Stops accepting a protocol.
-412 ///
-413 /// Note that this has only an effect on new connections. Existing connections that were
-414 /// accepted with `alpn` won't be closed when calling [`Router::stop_accepting`].
-415 pub async fn stop_accepting(&self, alpn: impl AsRef<[u8]>) -> Result<(), StopAcceptingError> {
-416 let (reply, reply_rx) = oneshot::channel();
-417 self.tx
-418 .send(ToRouterTask::StopAccepting {
-419 alpn: alpn.as_ref().to_vec(),
-420 reply,
-421 })
-422 .await
-423 .map_err(|_| StopAcceptingError::Closed {})?;
-424 reply_rx.await.map_err(|_| StopAcceptingError::Closed {})?
-425 }
-426
-427 /// Shuts down the accept loop cleanly.
-428 ///
-429 /// When this function returns, all [`ProtocolHandler`]s will be shutdown and
-430 /// `Endpoint::close` will have been called.
-431 ///
-432 /// If already shutdown, it returns `Ok`.
+389 /// If a protocol handler was already registered for `alpn`, the previous handler will be
+390 /// shutdown. Existing connections will not be aborted by the router, but some protocol
+391 /// handlers may abort existing connnections in their [`Router::shutdown`] implementation.
+392 /// Consult the documentation of the protocol handler to see if that is the case.
+393 pub async fn accept(
+394 &self,
+395 alpn: impl AsRef<[u8]>,
+396 handler: impl ProtocolHandler,
+397 ) -> Result<AddProtocolOutcome, RouterError> {
+398 let (reply, reply_rx) = oneshot::channel();
+399 self.tx
+400 .send(ToRouterTask::Accept {
+401 alpn: alpn.as_ref().to_vec(),
+402 handler: Arc::new(handler),
+403 reply,
+404 })
+405 .await
+406 .map_err(|_| RouterError::Closed {})?;
+407 reply_rx.await.map_err(|_| RouterError::Closed {})
+408 }
+409
+410 /// Stops accepting connections with this `alpn`.
+411 ///
+412 /// After this function returns, new connections with `alpn` will no longer be accepted.
+413 ///
+414 /// If a protocol handler was registered for `alpn`, the handler will be
+415 /// shutdown. Existing connections will not be aborted by the router, but some protocol
+416 /// handlers may abort existing connnections in their [`Router::shutdown`] implementation.
+417 /// Consult the documentation of the protocol handler to see if that is the case.
+418 ///
+419 /// Returns an error if the router has been shutdown or no protocol is registered for `alpn`.
+420 pub async fn stop_accepting(&self, alpn: impl AsRef<[u8]>) -> Result<(), StopAcceptingError> {
+421 let (reply, reply_rx) = oneshot::channel();
+422 self.tx
+423 .send(ToRouterTask::StopAccepting {
+424 alpn: alpn.as_ref().to_vec(),
+425 reply,
+426 })
+427 .await
+428 .map_err(|_| StopAcceptingError::Closed {})?;
+429 reply_rx.await.map_err(|_| StopAcceptingError::Closed {})?
+430 }
+431
+432 /// Shuts down the accept loop and endpoint cleanly.
433 ///
-434 /// If some [`ProtocolHandler`] panicked in the accept loop, this will propagate
-435 /// that panic into the result here.
-436 pub async fn shutdown(&self) -> Result<(), n0_future::task::JoinError> {
-437 if self.is_shutdown() {
-438 return Ok(());
-439 }
-440
-441 // Trigger shutdown of the main run task by activating the cancel token.
-442 self.cancel_token.cancel();
-443
-444 // Wait for the main task to terminate.
-445 if let Some(task) = self.task.lock().await.take() {
-446 task.await?;
-447 }
+434 /// When this function returns, all [`ProtocolHandler`]s will be shutdown and
+435 /// `Endpoint::close` will have been called.
+436 ///
+437 /// If already shutdown, it returns `Ok`.
+438 ///
+439 /// If some [`ProtocolHandler`] panicked in the accept loop, this will propagate
+440 /// that panic into the result here.
+441 pub async fn shutdown(&self) -> Result<(), n0_future::task::JoinError> {
+442 if self.is_shutdown() {
+443 return Ok(());
+444 }
+445
+446 // Trigger shutdown of the main run task by activating the cancel token.
+447 self.cancel_token.cancel();
448
-449 Ok(())
-450 }
-451}
-452
-453impl RouterBuilder {
-454 /// Creates a new router builder using given [`Endpoint`].
-455 pub fn new(endpoint: Endpoint) -> Self {
-456 Self {
-457 endpoint,
-458 protocols: ProtocolMap::default(),
-459 }
-460 }
-461
-462 /// Configures the router to accept the [`ProtocolHandler`] when receiving a connection
-463 /// with this `alpn`.
-464 pub fn accept(self, alpn: impl AsRef<[u8]>, handler: impl ProtocolHandler) -> Self {
-465 self.protocols
-466 .insert(alpn.as_ref().to_vec(), Arc::new(handler));
-467 self
-468 }
-469
-470 /// Returns the [`Endpoint`] of the node.
-471 pub fn endpoint(&self) -> &Endpoint {
-472 &self.endpoint
-473 }
-474
-475 /// Spawns an accept loop and returns a handle to it encapsulated as the [`Router`].
-476 pub fn spawn(self) -> Router {
-477 // Update the endpoint with our alpns.
-478 self.endpoint.set_alpns(self.protocols.alpns());
-479
-480 let protocols = Arc::new(self.protocols);
-481
-482 let mut join_set = JoinSet::new();
-483 let endpoint = self.endpoint.clone();
-484
-485 // Our own shutdown works with a cancellation token.
-486 let cancel = CancellationToken::new();
-487 let cancel_token = cancel.clone();
+449 // Wait for the main task to terminate.
+450 if let Some(task) = self.task.lock().await.take() {
+451 task.await?;
+452 }
+453
+454 Ok(())
+455 }
+456}
+457
+458impl RouterBuilder {
+459 /// Creates a new router builder using given [`Endpoint`].
+460 pub fn new(endpoint: Endpoint) -> Self {
+461 Self {
+462 endpoint,
+463 protocols: ProtocolMap::default(),
+464 }
+465 }
+466
+467 /// Configures the router to accept incoming connections with this `alpn` via [`ProtocolHandler`].
+468 pub fn accept(self, alpn: impl AsRef<[u8]>, handler: impl ProtocolHandler) -> Self {
+469 self.protocols
+470 .insert(alpn.as_ref().to_vec(), Arc::new(handler));
+471 self
+472 }
+473
+474 /// Returns the [`Endpoint`] of the node.
+475 pub fn endpoint(&self) -> &Endpoint {
+476 &self.endpoint
+477 }
+478
+479 /// Spawns an accept loop and returns a handle to it encapsulated as the [`Router`].
+480 pub fn spawn(self) -> Router {
+481 // Update the endpoint with our alpns.
+482 self.endpoint.set_alpns(self.protocols.alpns());
+483
+484 let protocols = Arc::new(self.protocols);
+485
+486 let mut join_set = JoinSet::new();
+487 let endpoint = self.endpoint.clone();
488
-489 let (tx, mut rx) = mpsc::channel(8);
-490
-491 let run_loop_fut = async move {
-492 // Make sure to cancel the token, if this future ever exits.
-493 let _cancel_guard = cancel_token.clone().drop_guard();
-494 // We create a separate cancellation token to stop any `ProtocolHandler::accept` futures
-495 // that are still running after `ProtocolHandler::shutdown` was called.
-496 let handler_cancel_token = CancellationToken::new();
-497
-498 loop {
-499 tokio::select! {
-500 biased;
-501 _ = cancel_token.cancelled() => {
-502 break;
-503 },
-504 Some(msg) = rx.recv() => {
-505 match msg {
-506 ToRouterTask::Accept { alpn, handler, reply } => {
-507 let outcome = if let Some(previous) = protocols.insert(alpn.clone(), handler) {
-508 join_set.spawn(shutdown_timeout(alpn, previous));
-509 AddProtocolOutcome::Replaced
-510 } else {
-511 AddProtocolOutcome::Inserted
-512 };
-513 endpoint.set_alpns(protocols.alpns());
-514 reply.send(outcome).ok();
-515 }
-516 ToRouterTask::StopAccepting { alpn, reply } => {
-517 if let Some(handler) = protocols.remove(&alpn) {
-518 join_set.spawn(shutdown_timeout(alpn, handler));
-519 endpoint.set_alpns(protocols.alpns());
-520 reply.send(Ok(())).ok();
-521 } else {
-522 reply.send(Err(StopAcceptingError::UnknownAlpn {})).ok();
-523 }
-524 }
-525 }
-526 }
-527 // handle task terminations and quit on panics.
-528 Some(res) = join_set.join_next() => {
-529 match res {
-530 Err(outer) => {
-531 if outer.is_panic() {
-532 error!("Task panicked: {outer:?}");
-533 break;
-534 } else if outer.is_cancelled() {
-535 trace!("Task cancelled: {outer:?}");
-536 } else {
-537 error!("Task failed: {outer:?}");
-538 break;
-539 }
-540 }
-541 Ok(Some(())) => {
-542 trace!("Task finished");
-543 }
-544 Ok(None) => {
-545 trace!("Task cancelled");
-546 }
-547 }
-548 },
-549
-550 // handle incoming p2p connections.
-551 incoming = endpoint.accept() => {
-552 let Some(incoming) = incoming else {
-553 break; // Endpoint is closed.
-554 };
-555
-556 let protocols = protocols.clone();
-557 let token = handler_cancel_token.child_token();
-558 join_set.spawn(async move {
-559 token.run_until_cancelled(handle_connection(incoming, protocols)).await
-560 }.instrument(info_span!("router.accept")));
-561 },
-562 }
-563 }
-564
-565 // We first shutdown the protocol handlers to give them a chance to close connections gracefully.
-566 protocols.shutdown().await;
-567 // We now cancel the remaining `ProtocolHandler::accept` futures.
-568 handler_cancel_token.cancel();
-569 // Now we close the endpoint. This will force-close all connections that are not yet closed.
-570 endpoint.close().await;
-571 // Finally, we abort the remaining accept tasks. This should be a noop because we already cancelled
-572 // the futures above.
-573 debug!("Shutting down remaining tasks");
-574 join_set.abort_all();
-575 while let Some(res) = join_set.join_next().await {
-576 match res {
-577 Err(err) if err.is_panic() => error!("Task panicked: {err:?}"),
-578 _ => {}
-579 }
-580 }
-581 };
-582 let task = task::spawn(run_loop_fut);
-583 let task = AbortOnDropHandle::new(task);
-584
-585 Router {
-586 endpoint: self.endpoint,
-587 task: Arc::new(Mutex::new(Some(task))),
-588 cancel_token: cancel,
-589 tx,
-590 }
-591 }
-592}
-593
-594async fn handle_connection(incoming: crate::endpoint::Incoming, protocols: Arc<ProtocolMap>) {
-595 let mut connecting = match incoming.accept() {
-596 Ok(conn) => conn,
-597 Err(err) => {
-598 warn!("Ignoring connection: accepting failed: {err:#}");
-599 return;
-600 }
-601 };
-602 let alpn = match connecting.alpn().await {
-603 Ok(alpn) => alpn,
-604 Err(err) => {
-605 warn!("Ignoring connection: invalid handshake: {err:#}");
-606 return;
-607 }
-608 };
-609 let Some(handler) = protocols.get(&alpn) else {
-610 warn!("Ignoring connection: unsupported ALPN protocol");
-611 return;
+489 // Our own shutdown works with a cancellation token.
+490 let cancel = CancellationToken::new();
+491 let cancel_token = cancel.clone();
+492
+493 let (tx, mut rx) = mpsc::channel(8);
+494
+495 let run_loop_fut = async move {
+496 // Make sure to cancel the token, if this future ever exits.
+497 let _cancel_guard = cancel_token.clone().drop_guard();
+498 // We create a separate cancellation token to stop any `ProtocolHandler::accept` futures
+499 // that are still running after `ProtocolHandler::shutdown` was called.
+500 let handler_cancel_token = CancellationToken::new();
+501
+502 loop {
+503 tokio::select! {
+504 biased;
+505 _ = cancel_token.cancelled() => {
+506 break;
+507 },
+508 Some(msg) = rx.recv() => {
+509 match msg {
+510 ToRouterTask::Accept { alpn, handler, reply } => {
+511 let outcome = if let Some(previous) = protocols.insert(alpn.clone(), handler) {
+512 join_set.spawn(shutdown_timeout(alpn, previous));
+513 AddProtocolOutcome::Replaced
+514 } else {
+515 AddProtocolOutcome::Inserted
+516 };
+517 endpoint.set_alpns(protocols.alpns());
+518 reply.send(outcome).ok();
+519 }
+520 ToRouterTask::StopAccepting { alpn, reply } => {
+521 if let Some(handler) = protocols.remove(&alpn) {
+522 join_set.spawn(shutdown_timeout(alpn, handler));
+523 endpoint.set_alpns(protocols.alpns());
+524 reply.send(Ok(())).ok();
+525 } else {
+526 reply.send(Err(StopAcceptingError::UnknownAlpn {})).ok();
+527 }
+528 }
+529 }
+530 }
+531 // handle task terminations and quit on panics.
+532 Some(res) = join_set.join_next() => {
+533 match res {
+534 Err(outer) => {
+535 if outer.is_panic() {
+536 error!("Task panicked: {outer:?}");
+537 break;
+538 } else if outer.is_cancelled() {
+539 trace!("Task cancelled: {outer:?}");
+540 } else {
+541 error!("Task failed: {outer:?}");
+542 break;
+543 }
+544 }
+545 Ok(Some(())) => {
+546 trace!("Task finished");
+547 }
+548 Ok(None) => {
+549 trace!("Task cancelled");
+550 }
+551 }
+552 },
+553
+554 // handle incoming p2p connections.
+555 incoming = endpoint.accept() => {
+556 let Some(incoming) = incoming else {
+557 break; // Endpoint is closed.
+558 };
+559
+560 let protocols = protocols.clone();
+561 let token = handler_cancel_token.child_token();
+562 join_set.spawn(async move {
+563 token.run_until_cancelled(handle_connection(incoming, protocols)).await
+564 }.instrument(info_span!("router.accept")));
+565 },
+566 }
+567 }
+568
+569 // We first shutdown the protocol handlers to give them a chance to close connections gracefully.
+570 protocols.shutdown().await;
+571 // We now cancel the remaining `ProtocolHandler::accept` futures.
+572 handler_cancel_token.cancel();
+573 // Now we close the endpoint. This will force-close all connections that are not yet closed.
+574 endpoint.close().await;
+575 // Finally, we abort the remaining accept tasks. This should be a noop because we already cancelled
+576 // the futures above.
+577 debug!("Shutting down remaining tasks");
+578 join_set.abort_all();
+579 while let Some(res) = join_set.join_next().await {
+580 match res {
+581 Err(err) if err.is_panic() => error!("Task panicked: {err:?}"),
+582 _ => {}
+583 }
+584 }
+585 };
+586 let task = task::spawn(run_loop_fut);
+587 let task = AbortOnDropHandle::new(task);
+588
+589 Router {
+590 endpoint: self.endpoint,
+591 task: Arc::new(Mutex::new(Some(task))),
+592 cancel_token: cancel,
+593 tx,
+594 }
+595 }
+596}
+597
+598async fn handle_connection(incoming: crate::endpoint::Incoming, protocols: Arc<ProtocolMap>) {
+599 let mut connecting = match incoming.accept() {
+600 Ok(conn) => conn,
+601 Err(err) => {
+602 warn!("Ignoring connection: accepting failed: {err:#}");
+603 return;
+604 }
+605 };
+606 let alpn = match connecting.alpn().await {
+607 Ok(alpn) => alpn,
+608 Err(err) => {
+609 warn!("Ignoring connection: invalid handshake: {err:#}");
+610 return;
+611 }
612 };
-613 match handler.on_connecting(connecting).await {
-614 Ok(connection) => {
-615 if let Err(err) = handler.accept(connection).await {
-616 warn!("Handling incoming connection ended with error: {err}");
-617 }
-618 }
-619 Err(err) => {
-620 warn!("Handling incoming connecting ended with error: {err}");
-621 }
-622 }
-623}
-624
-625/// Wraps an existing protocol, limiting its access,
-626/// based on the provided function.
-627///
-628/// Any refused connection will be closed with an error code of `0` and reason `not allowed`.
-629#[derive(derive_more::Debug, Clone)]
-630pub struct AccessLimit<P: ProtocolHandler + Clone> {
-631 proto: P,
-632 #[debug("limiter")]
-633 limiter: Arc<dyn Fn(NodeId) -> bool + Send + Sync + 'static>,
-634}
-635
-636impl<P: ProtocolHandler + Clone> AccessLimit<P> {
-637 /// Create a new `AccessLimit`.
-638 ///
-639 /// The function should return `true` for nodes that are allowed to
-640 /// connect, and `false` otherwise.
-641 pub fn new<F>(proto: P, limiter: F) -> Self
-642 where
-643 F: Fn(NodeId) -> bool + Send + Sync + 'static,
-644 {
-645 Self {
-646 proto,
-647 limiter: Arc::new(limiter),
-648 }
-649 }
-650}
-651
-652impl<P: ProtocolHandler + Clone> ProtocolHandler for AccessLimit<P> {
-653 fn on_connecting(
-654 &self,
-655 conn: Connecting,
-656 ) -> impl Future<Output = Result<Connection, AcceptError>> + Send {
-657 self.proto.on_connecting(conn)
-658 }
-659
-660 async fn accept(&self, conn: Connection) -> Result<(), AcceptError> {
-661 let remote = conn.remote_node_id()?;
-662 let is_allowed = (self.limiter)(remote);
-663 if !is_allowed {
-664 conn.close(0u32.into(), b"not allowed");
-665 return Err(NotAllowedSnafu.build());
-666 }
-667 self.proto.accept(conn).await?;
-668 Ok(())
-669 }
-670
-671 fn shutdown(&self) -> impl Future<Output = ()> + Send {
-672 self.proto.shutdown()
+613 let Some(handler) = protocols.get(&alpn) else {
+614 warn!("Ignoring connection: unsupported ALPN protocol");
+615 return;
+616 };
+617 match handler.on_connecting(connecting).await {
+618 Ok(connection) => {
+619 if let Err(err) = handler.accept(connection).await {
+620 warn!("Handling incoming connection ended with error: {err}");
+621 }
+622 }
+623 Err(err) => {
+624 warn!("Handling incoming connecting ended with error: {err}");
+625 }
+626 }
+627}
+628
+629/// Wraps an existing protocol, limiting its access,
+630/// based on the provided function.
+631///
+632/// Any refused connection will be closed with an error code of `0` and reason `not allowed`.
+633#[derive(derive_more::Debug, Clone)]
+634pub struct AccessLimit<P: ProtocolHandler + Clone> {
+635 proto: P,
+636 #[debug("limiter")]
+637 limiter: Arc<dyn Fn(NodeId) -> bool + Send + Sync + 'static>,
+638}
+639
+640impl<P: ProtocolHandler + Clone> AccessLimit<P> {
+641 /// Create a new `AccessLimit`.
+642 ///
+643 /// The function should return `true` for nodes that are allowed to
+644 /// connect, and `false` otherwise.
+645 pub fn new<F>(proto: P, limiter: F) -> Self
+646 where
+647 F: Fn(NodeId) -> bool + Send + Sync + 'static,
+648 {
+649 Self {
+650 proto,
+651 limiter: Arc::new(limiter),
+652 }
+653 }
+654}
+655
+656impl<P: ProtocolHandler + Clone> ProtocolHandler for AccessLimit<P> {
+657 fn on_connecting(
+658 &self,
+659 conn: Connecting,
+660 ) -> impl Future<Output = Result<Connection, AcceptError>> + Send {
+661 self.proto.on_connecting(conn)
+662 }
+663
+664 async fn accept(&self, conn: Connection) -> Result<(), AcceptError> {
+665 let remote = conn.remote_node_id()?;
+666 let is_allowed = (self.limiter)(remote);
+667 if !is_allowed {
+668 conn.close(0u32.into(), b"not allowed");
+669 return Err(NotAllowedSnafu.build());
+670 }
+671 self.proto.accept(conn).await?;
+672 Ok(())
673 }
-674}
-675
-676#[cfg(test)]
-677mod tests {
-678 use std::{sync::Mutex, time::Duration};
+674
+675 fn shutdown(&self) -> impl Future<Output = ()> + Send {
+676 self.proto.shutdown()
+677 }
+678}
679
-680 use iroh_base::NodeAddr;
-681 use n0_snafu::{Result, ResultExt};
-682 use n0_watcher::Watcher;
-683 use quinn::{ApplicationClose, TransportErrorCode};
-684
-685 use super::*;
-686 use crate::{
-687 endpoint::{ConnectError, ConnectionError},
-688 RelayMode,
-689 };
-690
-691 #[tokio::test]
-692 async fn test_shutdown() -> Result {
-693 let endpoint = Endpoint::builder().bind().await?;
-694 let router = Router::builder(endpoint.clone()).spawn();
-695
-696 assert!(!router.is_shutdown());
-697 assert!(!endpoint.is_closed());
-698
-699 router.shutdown().await.e()?;
-700
-701 assert!(router.is_shutdown());
-702 assert!(endpoint.is_closed());
-703
-704 Ok(())
-705 }
-706
-707 // The protocol definition:
-708 #[derive(Debug, Clone)]
-709 struct Echo;
+680#[cfg(test)]
+681mod tests {
+682 use std::{sync::Mutex, time::Duration};
+683
+684 use iroh_base::NodeAddr;
+685 use n0_snafu::{Result, ResultExt};
+686 use n0_watcher::Watcher;
+687 use quinn::{ApplicationClose, TransportErrorCode};
+688
+689 use super::*;
+690 use crate::{
+691 endpoint::{ConnectError, ConnectionError},
+692 RelayMode,
+693 };
+694
+695 #[tokio::test]
+696 async fn test_shutdown() -> Result {
+697 let endpoint = Endpoint::builder().bind().await?;
+698 let router = Router::builder(endpoint.clone()).spawn();
+699
+700 assert!(!router.is_shutdown());
+701 assert!(!endpoint.is_closed());
+702
+703 router.shutdown().await.e()?;
+704
+705 assert!(router.is_shutdown());
+706 assert!(endpoint.is_closed());
+707
+708 Ok(())
+709 }
710
-711 const ECHO_ALPN: &[u8] = b"/iroh/echo/1";
-712
-713 impl ProtocolHandler for Echo {
-714 async fn accept(&self, connection: Connection) -> Result<(), AcceptError> {
-715 println!("accepting echo");
-716 let (mut send, mut recv) = connection.accept_bi().await?;
-717
-718 // Echo any bytes received back directly.
-719 let _bytes_sent = tokio::io::copy(&mut recv, &mut send).await?;
-720
-721 send.finish()?;
-722 connection.closed().await;
-723
-724 Ok(())
-725 }
-726 }
+711 // The protocol definition:
+712 #[derive(Debug, Clone)]
+713 struct Echo;
+714
+715 const ECHO_ALPN: &[u8] = b"/iroh/echo/1";
+716
+717 impl ProtocolHandler for Echo {
+718 async fn accept(&self, connection: Connection) -> Result<(), AcceptError> {
+719 println!("accepting echo");
+720 let (mut send, mut recv) = connection.accept_bi().await?;
+721
+722 // Echo any bytes received back directly.
+723 let _bytes_sent = tokio::io::copy(&mut recv, &mut send).await?;
+724
+725 send.finish()?;
+726 connection.closed().await;
727
-728 #[tokio::test]
-729 async fn test_limiter() -> Result {
-730 // tracing_subscriber::fmt::try_init().ok();
-731 let e1 = Endpoint::builder()
-732 .relay_mode(RelayMode::Disabled)
-733 .bind()
-734 .await?;
-735 // deny all access
-736 let proto = AccessLimit::new(Echo, |_node_id| false);
-737 let r1 = Router::builder(e1.clone()).accept(ECHO_ALPN, proto).spawn();
-738
-739 let addr1 = r1.endpoint().node_addr().initialized().await?;
-740 dbg!(&addr1);
-741 let e2 = Endpoint::builder()
-742 .relay_mode(RelayMode::Disabled)
-743 .bind()
-744 .await?;
-745
-746 println!("connecting");
-747 let conn = e2.connect(addr1, ECHO_ALPN).await?;
-748
-749 let (_send, mut recv) = conn.open_bi().await.e()?;
-750 let response = recv.read_to_end(1000).await.unwrap_err();
-751 assert!(format!("{:#?}", response).contains("not allowed"));
+728 Ok(())
+729 }
+730 }
+731
+732 #[tokio::test]
+733 async fn test_limiter() -> Result {
+734 // tracing_subscriber::fmt::try_init().ok();
+735 let e1 = Endpoint::builder()
+736 .relay_mode(RelayMode::Disabled)
+737 .bind()
+738 .await?;
+739 // deny all access
+740 let proto = AccessLimit::new(Echo, |_node_id| false);
+741 let r1 = Router::builder(e1.clone()).accept(ECHO_ALPN, proto).spawn();
+742
+743 let addr1 = r1.endpoint().node_addr().initialized().await?;
+744 dbg!(&addr1);
+745 let e2 = Endpoint::builder()
+746 .relay_mode(RelayMode::Disabled)
+747 .bind()
+748 .await?;
+749
+750 println!("connecting");
+751 let conn = e2.connect(addr1, ECHO_ALPN).await?;
752
-753 r1.shutdown().await.e()?;
-754 e2.close().await;
-755
-756 Ok(())
-757 }
-758
-759 #[tokio::test]
-760 async fn test_graceful_shutdown() -> Result {
-761 #[derive(Debug, Clone, Default)]
-762 struct TestProtocol {
-763 connections: Arc<Mutex<Vec<Connection>>>,
-764 }
-765
-766 const TEST_ALPN: &[u8] = b"/iroh/test/1";
-767
-768 impl ProtocolHandler for TestProtocol {
-769 async fn accept(&self, connection: Connection) -> Result<(), AcceptError> {
-770 self.connections.lock().expect("poisoned").push(connection);
-771 Ok(())
-772 }
-773
-774 async fn shutdown(&self) {
-775 tokio::time::sleep(Duration::from_millis(100)).await;
-776 let mut connections = self.connections.lock().expect("poisoned");
-777 for conn in connections.drain(..) {
-778 conn.close(42u32.into(), b"shutdown");
-779 }
-780 }
-781 }
-782
-783 eprintln!("creating ep1");
-784 let endpoint = Endpoint::builder()
-785 .relay_mode(RelayMode::Disabled)
-786 .bind()
-787 .await?;
-788 let router = Router::builder(endpoint)
-789 .accept(TEST_ALPN, TestProtocol::default())
-790 .spawn();
-791 eprintln!("waiting for node addr");
-792 let addr = router.endpoint().node_addr().initialized().await?;
-793
-794 eprintln!("creating ep2");
-795 let endpoint2 = Endpoint::builder()
-796 .relay_mode(RelayMode::Disabled)
-797 .bind()
-798 .await?;
-799 eprintln!("connecting to {:?}", addr);
-800 let conn = endpoint2.connect(addr, TEST_ALPN).await?;
-801
-802 eprintln!("starting shutdown");
-803 router.shutdown().await.e()?;
-804
-805 eprintln!("waiting for closed conn");
-806 let reason = conn.closed().await;
-807 assert_eq!(
-808 reason,
-809 ConnectionError::ApplicationClosed(ApplicationClose {
-810 error_code: 42u32.into(),
-811 reason: b"shutdown".to_vec().into()
-812 })
-813 );
-814 Ok(())
-815 }
-816
-817 #[tokio::test]
-818 async fn test_add_and_remove_protocol() -> Result {
-819 async fn connect_assert_ok(
-820 endpoint: &Endpoint,
-821 addr: &NodeAddr,
-822 alpn: &[u8],
-823 expected_code: u32,
-824 ) {
-825 let conn = endpoint
-826 .connect(addr.clone(), alpn)
-827 .await
-828 .expect("expected connection to succeed");
-829 let reason = conn.closed().await;
-830 assert!(matches!(reason,
-831 ConnectionError::ApplicationClosed(ApplicationClose { error_code, .. }) if error_code == expected_code.into()
-832 ));
-833 }
-834
-835 async fn connect_assert_fail(endpoint: &Endpoint, addr: &NodeAddr, alpn: &[u8]) {
-836 let conn = endpoint.connect(addr.clone(), alpn).await;
-837 assert!(matches!(
-838 &conn,
-839 Err(ConnectError::Connection { source, .. })
-840 if matches!(
-841 source.as_ref(),
-842 ConnectionError::ConnectionClosed(frame)
-843 if frame.error_code == TransportErrorCode::crypto(rustls::AlertDescription::NoApplicationProtocol.into())
-844 )
-845 ));
-846 }
-847
-848 #[derive(Debug, Clone, Default)]
-849 struct TestProtocol(u32);
-850
-851 const ALPN_1: &[u8] = b"/iroh/test/1";
-852 const ALPN_2: &[u8] = b"/iroh/test/2";
-853
-854 impl ProtocolHandler for TestProtocol {
-855 async fn accept(&self, connection: Connection) -> Result<(), AcceptError> {
-856 connection.close(self.0.into(), b"bye");
-857 Ok(())
-858 }
-859 }
-860
-861 let server = Endpoint::builder()
-862 .relay_mode(RelayMode::Disabled)
-863 .bind()
-864 .await?;
-865 let router = Router::builder(server)
-866 .accept(ALPN_1, TestProtocol(1))
-867 .spawn();
-868
-869 let addr = router.endpoint().node_addr().initialized().await?;
-870
-871 let client = Endpoint::builder()
-872 .relay_mode(RelayMode::Disabled)
-873 .bind()
-874 .await?;
-875
-876 connect_assert_ok(&client, &addr, ALPN_1, 1).await;
-877 connect_assert_fail(&client, &addr, ALPN_2).await;
-878
-879 router.stop_accepting(ALPN_1).await?;
-880 connect_assert_fail(&client, &addr, ALPN_1).await;
+753 let (_send, mut recv) = conn.open_bi().await.e()?;
+754 let response = recv.read_to_end(1000).await.unwrap_err();
+755 assert!(format!("{:#?}", response).contains("not allowed"));
+756
+757 r1.shutdown().await.e()?;
+758 e2.close().await;
+759
+760 Ok(())
+761 }
+762
+763 #[tokio::test]
+764 async fn test_graceful_shutdown() -> Result {
+765 #[derive(Debug, Clone, Default)]
+766 struct TestProtocol {
+767 connections: Arc<Mutex<Vec<Connection>>>,
+768 }
+769
+770 const TEST_ALPN: &[u8] = b"/iroh/test/1";
+771
+772 impl ProtocolHandler for TestProtocol {
+773 async fn accept(&self, connection: Connection) -> Result<(), AcceptError> {
+774 self.connections.lock().expect("poisoned").push(connection);
+775 Ok(())
+776 }
+777
+778 async fn shutdown(&self) {
+779 tokio::time::sleep(Duration::from_millis(100)).await;
+780 let mut connections = self.connections.lock().expect("poisoned");
+781 for conn in connections.drain(..) {
+782 conn.close(42u32.into(), b"shutdown");
+783 }
+784 }
+785 }
+786
+787 eprintln!("creating ep1");
+788 let endpoint = Endpoint::builder()
+789 .relay_mode(RelayMode::Disabled)
+790 .bind()
+791 .await?;
+792 let router = Router::builder(endpoint)
+793 .accept(TEST_ALPN, TestProtocol::default())
+794 .spawn();
+795 eprintln!("waiting for node addr");
+796 let addr = router.endpoint().node_addr().initialized().await?;
+797
+798 eprintln!("creating ep2");
+799 let endpoint2 = Endpoint::builder()
+800 .relay_mode(RelayMode::Disabled)
+801 .bind()
+802 .await?;
+803 eprintln!("connecting to {:?}", addr);
+804 let conn = endpoint2.connect(addr, TEST_ALPN).await?;
+805
+806 eprintln!("starting shutdown");
+807 router.shutdown().await.e()?;
+808
+809 eprintln!("waiting for closed conn");
+810 let reason = conn.closed().await;
+811 assert_eq!(
+812 reason,
+813 ConnectionError::ApplicationClosed(ApplicationClose {
+814 error_code: 42u32.into(),
+815 reason: b"shutdown".to_vec().into()
+816 })
+817 );
+818 Ok(())
+819 }
+820
+821 #[tokio::test]
+822 async fn test_add_and_remove_protocol() -> Result {
+823 async fn connect_assert_ok(
+824 endpoint: &Endpoint,
+825 addr: &NodeAddr,
+826 alpn: &[u8],
+827 expected_code: u32,
+828 ) {
+829 let conn = endpoint
+830 .connect(addr.clone(), alpn)
+831 .await
+832 .expect("expected connection to succeed");
+833 let reason = conn.closed().await;
+834 assert!(matches!(reason,
+835 ConnectionError::ApplicationClosed(ApplicationClose { error_code, .. }) if error_code == expected_code.into()
+836 ));
+837 }
+838
+839 async fn connect_assert_fail(endpoint: &Endpoint, addr: &NodeAddr, alpn: &[u8]) {
+840 let conn = endpoint.connect(addr.clone(), alpn).await;
+841 assert!(matches!(
+842 &conn,
+843 Err(ConnectError::Connection { source, .. })
+844 if matches!(
+845 source.as_ref(),
+846 ConnectionError::ConnectionClosed(frame)
+847 if frame.error_code == TransportErrorCode::crypto(rustls::AlertDescription::NoApplicationProtocol.into())
+848 )
+849 ));
+850 }
+851
+852 #[derive(Debug, Clone, Default)]
+853 struct TestProtocol(u32);
+854
+855 const ALPN_1: &[u8] = b"/iroh/test/1";
+856 const ALPN_2: &[u8] = b"/iroh/test/2";
+857
+858 impl ProtocolHandler for TestProtocol {
+859 async fn accept(&self, connection: Connection) -> Result<(), AcceptError> {
+860 connection.close(self.0.into(), b"bye");
+861 Ok(())
+862 }
+863 }
+864
+865 let server = Endpoint::builder()
+866 .relay_mode(RelayMode::Disabled)
+867 .bind()
+868 .await?;
+869 let router = Router::builder(server)
+870 .accept(ALPN_1, TestProtocol(1))
+871 .spawn();
+872
+873 let addr = router.endpoint().node_addr().initialized().await?;
+874
+875 let client = Endpoint::builder()
+876 .relay_mode(RelayMode::Disabled)
+877 .bind()
+878 .await?;
+879
+880 connect_assert_ok(&client, &addr, ALPN_1, 1).await;
881 connect_assert_fail(&client, &addr, ALPN_2).await;
882
-883 let outcome = router.accept(ALPN_2, TestProtocol(2)).await?;
-884 assert_eq!(outcome, AddProtocolOutcome::Inserted);
-885 connect_assert_fail(&client, &addr, ALPN_1).await;
-886 connect_assert_ok(&client, &addr, ALPN_2, 2).await;
-887
-888 let outcome = router.accept(ALPN_1, TestProtocol(3)).await?;
-889 assert_eq!(outcome, AddProtocolOutcome::Inserted);
-890 connect_assert_ok(&client, &addr, ALPN_1, 3).await;
-891 connect_assert_ok(&client, &addr, ALPN_2, 2).await;
-892
-893 let outcome = router.accept(ALPN_1, TestProtocol(4)).await?;
-894 assert_eq!(outcome, AddProtocolOutcome::Replaced);
-895 connect_assert_ok(&client, &addr, ALPN_1, 4).await;
+883 router.stop_accepting(ALPN_1).await?;
+884 connect_assert_fail(&client, &addr, ALPN_1).await;
+885 connect_assert_fail(&client, &addr, ALPN_2).await;
+886
+887 let outcome = router.accept(ALPN_2, TestProtocol(2)).await?;
+888 assert_eq!(outcome, AddProtocolOutcome::Inserted);
+889 connect_assert_fail(&client, &addr, ALPN_1).await;
+890 connect_assert_ok(&client, &addr, ALPN_2, 2).await;
+891
+892 let outcome = router.accept(ALPN_1, TestProtocol(3)).await?;
+893 assert_eq!(outcome, AddProtocolOutcome::Inserted);
+894 connect_assert_ok(&client, &addr, ALPN_1, 3).await;
+895 connect_assert_ok(&client, &addr, ALPN_2, 2).await;
896
-897 router.stop_accepting(ALPN_2).await?;
-898 connect_assert_ok(&client, &addr, ALPN_1, 4).await;
-899 connect_assert_fail(&client, &addr, ALPN_2).await;
+897 let outcome = router.accept(ALPN_1, TestProtocol(4)).await?;
+898 assert_eq!(outcome, AddProtocolOutcome::Replaced);
+899 connect_assert_ok(&client, &addr, ALPN_1, 4).await;
900
-901 router.stop_accepting(ALPN_1).await?;
-902 connect_assert_fail(&client, &addr, ALPN_1).await;
+901 router.stop_accepting(ALPN_2).await?;
+902 connect_assert_ok(&client, &addr, ALPN_1, 4).await;
903 connect_assert_fail(&client, &addr, ALPN_2).await;
904
-905 assert!(matches!(
-906 router.stop_accepting(ALPN_1).await,
-907 Err(StopAcceptingError::UnknownAlpn {})
-908 ));
+905 router.stop_accepting(ALPN_1).await?;
+906 connect_assert_fail(&client, &addr, ALPN_1).await;
+907 connect_assert_fail(&client, &addr, ALPN_2).await;
+908
909 assert!(matches!(
-910 router.stop_accepting(ALPN_2).await,
+910 router.stop_accepting(ALPN_1).await,
911 Err(StopAcceptingError::UnknownAlpn {})
912 ));
-913
-914 Ok(())
-915 }
-916}
\ No newline at end of file
+913 assert!(matches!(
+914 router.stop_accepting(ALPN_2).await,
+915 Err(StopAcceptingError::UnknownAlpn {})
+916 ));
+917
+918 Ok(())
+919 }
+920}
\ No newline at end of file