diff --git a/pr/3610/docs/iroh/endpoint/index.html b/pr/3610/docs/iroh/endpoint/index.html index b8d884b9e3..ddad1490bd 100644 --- a/pr/3610/docs/iroh/endpoint/index.html +++ b/pr/3610/docs/iroh/endpoint/index.html @@ -1,4 +1,4 @@ -iroh::endpoint - Rust

Module endpoint

Module endpoint 

Source
Expand description

The Endpoint allows establishing connections to other iroh endpoints.

+iroh::endpoint - Rust

Module endpoint

Module endpoint 

Source
Expand description

The Endpoint allows establishing connections to other iroh endpoints.

The Endpoint is the main API interface to manage a local iroh endpoint. It allows connecting to and accepting connections from other endpoints. See the module docs for more details on how iroh connections work.

diff --git a/pr/3610/docs/iroh_relay/client/struct.ClientBuilder.html b/pr/3610/docs/iroh_relay/client/struct.ClientBuilder.html index de819a1c74..830b5dd104 100644 --- a/pr/3610/docs/iroh_relay/client/struct.ClientBuilder.html +++ b/pr/3610/docs/iroh_relay/client/struct.ClientBuilder.html @@ -1,7 +1,7 @@ ClientBuilder in iroh_relay::client - Rust

ClientBuilder

Struct ClientBuilder 

Source
pub struct ClientBuilder { /* private fields */ }
Expand description

Build a Client.

Implementations§

Source§

impl ClientBuilder

Source

pub fn new( - url: impl Into<RelayUrl>, - secret_key: SecretKey, + url: impl Into<RelayUrl>, + secret_key: SecretKey, dns_resolver: DnsResolver, ) -> Self

Create a new ClientBuilder

Source

pub fn address_family_selector<S>(self, selector: S) -> Self
where diff --git a/pr/3610/docs/iroh_relay/dns/struct.DnsResolver.html b/pr/3610/docs/iroh_relay/dns/struct.DnsResolver.html index 4e44e10789..d2274e46dd 100644 --- a/pr/3610/docs/iroh_relay/dns/struct.DnsResolver.html +++ b/pr/3610/docs/iroh_relay/dns/struct.DnsResolver.html @@ -73,9 +73,9 @@ at T+0ms, T+200ms and T+300ms. The timeout is applied as stated in summary of all errors otherwise.

Source

pub async fn lookup_endpoint_by_id( &self, - endpoint_id: &EndpointId, + endpoint_id: &EndpointId, origin: &str, -) -> Result<EndpointInfo, LookupError>

Looks up endpoint info by EndpointId and origin domain name.

+) -> Result<EndpointInfo, LookupError>

Looks up endpoint info by [EndpointId] and origin domain name.

To lookup endpoints that published their endpoint info to the DNS servers run by n0, pass N0_DNS_ENDPOINT_ORIGIN_PROD as origin.

Source

pub async fn lookup_endpoint_by_domain_name( @@ -93,10 +93,10 @@ at T+0ms, T+200ms and T+300ms. The result of the first successful call is return summary of all errors otherwise.

Source

pub async fn lookup_endpoint_by_id_staggered( &self, - endpoint_id: &EndpointId, + endpoint_id: &EndpointId, origin: &str, delays_ms: &[u64], -) -> Result<EndpointInfo, StaggeredError<LookupError>>

Looks up endpoint info by EndpointId and origin domain name.

+) -> Result<EndpointInfo, StaggeredError<LookupError>>

Looks up endpoint info by [EndpointId] and origin domain name.

From the moment this function is called, each lookup is scheduled after the delays in delays_ms with the first call being done immediately. [200ms, 300ms] results in calls at T+0ms, T+200ms and T+300ms. The result of the first successful call is returned, or a diff --git a/pr/3610/docs/iroh_relay/endpoint_info/enum.DecodingError.html b/pr/3610/docs/iroh_relay/endpoint_info/enum.DecodingError.html index 6fe4394ef8..9cc19471d3 100644 --- a/pr/3610/docs/iroh_relay/endpoint_info/enum.DecodingError.html +++ b/pr/3610/docs/iroh_relay/endpoint_info/enum.DecodingError.html @@ -8,12 +8,12 @@ meta: Meta, }, InvalidKey { - source: KeyParsingError, + source: KeyParsingError, meta: Meta, }, }

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

InvalidEncodingZ32

Fields

§source: Z32Error
§meta: Meta

Captured call-site metadata

§

InvalidLength

Fields

§len: usize
§meta: Meta

Captured call-site metadata

-
§

InvalidKey

Fields

§meta: Meta

Captured call-site metadata

+
§

InvalidKey

Fields

§source: KeyParsingError
§meta: Meta

Captured call-site metadata

Trait Implementations§

Source§

impl Debug for DecodingError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for DecodingError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for DecodingError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<DecodingError> for AnyError

Source§

fn from(value: DecodingError) -> AnyError

Converts to this type from the input type.
Source§

impl From<DecodingError> for ParseError

Source§

fn from(source: DecodingError) -> Self

Converts to this type from the input type.
Source§

impl StackError for DecodingError

Source§

fn as_std(&self) -> &(dyn Error + Send + Sync + 'static)

Returns this error as a std error reference.
Source§

fn into_std(self: Box<Self>) -> Box<dyn Error + Send + Sync>

Returns this error as a std error.
Source§

fn as_dyn(&self) -> &dyn StackError

Returns this error as a dyn StackError.
Source§

fn fmt_message(&self, f: &mut Formatter<'_>) -> Result

Returns the next source in the chain, if any.
Source§

fn meta(&self) -> Option<&Meta>

Returns metadata captured at creation time, if available.
Source§

fn source(&self) -> Option<ErrorRef<'_>>

Returns the next source in the chain, if any.
Source§

fn is_transparent(&self) -> bool

Returns whether this error is transparent and should be skipped in reports.
§

fn as_ref(&self) -> ErrorRef<'_>

Returns this error as an [ErrorRef]. Read more
§

fn stack(&self) -> Chain<'_>

Returns an iterator over this error followed by its sources.
§

fn sources(&self) -> Chain<'_>

Returns an iterator over sources of this error (skipping self).
§

fn report(&self) -> Report<'_>

Returns a [Report] to output the error with configurable formatting.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where diff --git a/pr/3610/docs/iroh_relay/endpoint_info/index.html b/pr/3610/docs/iroh_relay/endpoint_info/index.html index 6e1c5daa93..092869f706 100644 --- a/pr/3610/docs/iroh_relay/endpoint_info/index.html +++ b/pr/3610/docs/iroh_relay/endpoint_info/index.html @@ -1,5 +1,5 @@ -iroh_relay::endpoint_info - Rust

Module endpoint_info

Module endpoint_info 

Source
Expand description

Support for handling DNS resource records for dialing by EndpointId.

-

Dialing by EndpointId is supported by iroh endpoints publishing Pkarr records to DNS +iroh_relay::endpoint_info - Rust

Module endpoint_info

Module endpoint_info 

Source
Expand description

Support for handling DNS resource records for dialing by [EndpointId].

+

Dialing by [EndpointId] is supported by iroh endpoints publishing Pkarr records to DNS servers or the Mainline DHT. This module supports creating and parsing these records.

DNS records are published under the following names:

_iroh.<z32-endpoint-id>.<origin-domain> TXT

@@ -8,7 +8,7 @@ servers or the Mainline DHT. This module supports creating and parsing these re

_iroh is the record name as defined by IROH_TXT_NAME.

  • -

    <z32-endpoint-id> is the z-base-32 encoding of the EndpointId.

    +

    <z32-endpoint-id> is the z-base-32 encoding of the [EndpointId].

  • <origin-domain> is the domain name of the publishing DNS server, @@ -23,12 +23,12 @@ servers or the Mainline DHT. This module supports creating and parsing these re in RFC1464. The following attributes are defined:

    • -

      relay=<url>: The home RelayUrl of this endpoint.

      +

      relay=<url>: The home RelayUrl of this endpoint.

    • addr=<addr> <addr>: A space-separated list of sockets addresses for this iroh endpoint. Each address is an IPv4 or IPv6 address with a port.

    -
  • Structs§

    EndpointData
    Data about an endpoint that may be published to and resolved from discovery services.
    EndpointInfo
    Information about an endpoint that may be published to and resolved from discovery services.
    MaxLengthExceededError
    Error returned when an input value is too long for UserData.
    UserData
    Under the hood this is a UTF-8 String is no longer than UserData::MAX_LENGTH bytes.

    Enums§

    DecodingError
    EncodingError
    ParseError

    Constants§

    IROH_TXT_NAME
    The DNS name for the iroh TXT record.

    Traits§

    EndpointIdExt
    Extension methods for EndpointId to encode to and decode from [z32], +

    Structs§

    EndpointData
    Data about an endpoint that may be published to and resolved from discovery services.
    EndpointInfo
    Information about an endpoint that may be published to and resolved from discovery services.
    MaxLengthExceededError
    Error returned when an input value is too long for UserData.
    UserData
    Under the hood this is a UTF-8 String is no longer than UserData::MAX_LENGTH bytes.

    Enums§

    DecodingError
    EncodingError
    ParseError

    Constants§

    IROH_TXT_NAME
    The DNS name for the iroh TXT record.

    Traits§

    EndpointIdExt
    Extension methods for [EndpointId] to encode to and decode from [z32], which is the encoding used in [pkarr] domain names.
    \ No newline at end of file diff --git a/pr/3610/docs/iroh_relay/endpoint_info/struct.EndpointData.html b/pr/3610/docs/iroh_relay/endpoint_info/struct.EndpointData.html index cc9b58d1d6..490df1b4d2 100644 --- a/pr/3610/docs/iroh_relay/endpoint_info/struct.EndpointData.html +++ b/pr/3610/docs/iroh_relay/endpoint_info/struct.EndpointData.html @@ -1,23 +1,23 @@ EndpointData in iroh_relay::endpoint_info - Rust

    EndpointData

    Struct EndpointData 

    Source
    pub struct EndpointData { /* private fields */ }
    Expand description

    Data about an endpoint that may be published to and resolved from discovery services.

    -

    This includes an optional RelayUrl, a set of direct addresses, and the optional +

    This includes an optional [RelayUrl], a set of direct addresses, and the optional UserData, a string that can be set by applications and is not parsed or used by iroh itself.

    -

    This struct does not include the endpoint’s EndpointId, only the data about a certain -endpoint. See EndpointInfo for a struct that contains a EndpointId with associated EndpointData.

    -

    Implementations§

    Source§

    impl EndpointData

    Source

    pub fn new(addrs: impl IntoIterator<Item = TransportAddr>) -> Self

    Creates a new EndpointData with a relay URL and a set of direct addresses.

    -
    Source

    pub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self

    Sets the relay URL and returns the updated endpoint data.

    +

    This struct does not include the endpoint’s [EndpointId], only the data about a certain +endpoint. See EndpointInfo for a struct that contains a [EndpointId] with associated EndpointData.

    +

    Implementations§

    Source§

    impl EndpointData

    Source

    pub fn new(addrs: impl IntoIterator<Item = TransportAddr>) -> Self

    Creates a new EndpointData with a relay URL and a set of direct addresses.

    +
    Source

    pub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self

    Sets the relay URL and returns the updated endpoint data.

    Source

    pub fn with_ip_addrs(self, addresses: BTreeSet<SocketAddr>) -> Self

    Sets the direct addresses and returns the updated endpoint data.

    Source

    pub fn with_user_data(self, user_data: Option<UserData>) -> Self

    Sets the user-defined data and returns the updated endpoint data.

    -
    Source

    pub fn relay_urls(&self) -> impl Iterator<Item = &RelayUrl>

    Returns the relay URL of the endpoint.

    +
    Source

    pub fn relay_urls(&self) -> impl Iterator<Item = &RelayUrl>

    Returns the relay URL of the endpoint.

    Source

    pub fn user_data(&self) -> Option<&UserData>

    Returns the optional user-defined data of the endpoint.

    Source

    pub fn ip_addrs(&self) -> impl Iterator<Item = &SocketAddr>

    Returns the direct addresses of the endpoint.

    Source

    pub fn clear_ip_addrs(&mut self)

    Removes all direct addresses from the endpoint data.

    Source

    pub fn clear_relay_urls(&mut self)

    Removes all direct addresses from the endpoint data.

    -
    Source

    pub fn add_addrs(&mut self, addrs: impl IntoIterator<Item = TransportAddr>)

    Add addresses to the endpoint data.

    +
    Source

    pub fn add_addrs(&mut self, addrs: impl IntoIterator<Item = TransportAddr>)

    Add addresses to the endpoint data.

    Source

    pub fn set_user_data(&mut self, user_data: Option<UserData>)

    Sets the user-defined data of the endpoint data.

    -
    Source

    pub fn addrs(&self) -> impl Iterator<Item = &TransportAddr>

    Returns the full list of all known addresses

    +
    Source

    pub fn addrs(&self) -> impl Iterator<Item = &TransportAddr>

    Returns the full list of all known addresses

    Source

    pub fn has_addrs(&self) -> bool

    Does this have any addresses?

    -

    Trait Implementations§

    Source§

    impl Clone for EndpointData

    Source§

    fn clone(&self) -> EndpointData

    Returns a duplicate of the value. Read more
    1.0.0 · Source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    Source§

    impl Debug for EndpointData

    Source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    Source§

    impl Default for EndpointData

    Source§

    fn default() -> EndpointData

    Returns the “default value” for a type. Read more
    Source§

    impl From<EndpointAddr> for EndpointData

    Source§

    fn from(endpoint_addr: EndpointAddr) -> Self

    Converts to this type from the input type.
    Source§

    impl PartialEq for EndpointData

    Source§

    fn eq(&self, other: &EndpointData) -> bool

    Tests for self and other values to be equal, and is used by ==.
    1.0.0 · Source§

    fn ne(&self, other: &Rhs) -> bool

    Tests for !=. The default implementation is almost always sufficient, +

    Trait Implementations§

    Source§

    impl Clone for EndpointData

    Source§

    fn clone(&self) -> EndpointData

    Returns a duplicate of the value. Read more
    1.0.0 · Source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    Source§

    impl Debug for EndpointData

    Source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    Source§

    impl Default for EndpointData

    Source§

    fn default() -> EndpointData

    Returns the “default value” for a type. Read more
    Source§

    impl From<EndpointAddr> for EndpointData

    Source§

    fn from(endpoint_addr: EndpointAddr) -> Self

    Converts to this type from the input type.
    Source§

    impl PartialEq for EndpointData

    Source§

    fn eq(&self, other: &EndpointData) -> bool

    Tests for self and other values to be equal, and is used by ==.
    1.0.0 · Source§

    fn ne(&self, other: &Rhs) -> bool

    Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
    Source§

    impl Eq for EndpointData

    Source§

    impl StructuralPartialEq for EndpointData

    Auto Trait Implementations§

    Blanket Implementations§

    Source§

    impl<T> Any for T
    where T: 'static + ?Sized,

    Source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    §

    impl<'a, T, E> AsTaggedExplicit<'a, E> for T
    where T: 'a,

    §

    fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

    §

    impl<'a, T, E> AsTaggedImplicit<'a, E> for T
    where diff --git a/pr/3610/docs/iroh_relay/endpoint_info/struct.EndpointInfo.html b/pr/3610/docs/iroh_relay/endpoint_info/struct.EndpointInfo.html index 47877b4eae..190e8f7546 100644 --- a/pr/3610/docs/iroh_relay/endpoint_info/struct.EndpointInfo.html +++ b/pr/3610/docs/iroh_relay/endpoint_info/struct.EndpointInfo.html @@ -1,17 +1,17 @@ EndpointInfo in iroh_relay::endpoint_info - Rust

    EndpointInfo

    Struct EndpointInfo 

    Source
    pub struct EndpointInfo {
    -    pub endpoint_id: EndpointId,
    +    pub endpoint_id: EndpointId,
         pub data: EndpointData,
     }
    Expand description

    Information about an endpoint that may be published to and resolved from discovery services.

    -

    This struct couples a EndpointId with its associated EndpointData.

    -

    Fields§

    §endpoint_id: EndpointId

    The EndpointId of the endpoint this is about.

    +

    This struct couples a [EndpointId] with its associated EndpointData.

    +

    Fields§

    §endpoint_id: EndpointId

    The [EndpointId] of the endpoint this is about.

    §data: EndpointData

    The information published about the endpoint.

    -

    Implementations§

    Source§

    impl EndpointInfo

    Source

    pub fn new(endpoint_id: EndpointId) -> Self

    Creates a new EndpointInfo with an empty EndpointData.

    -
    Source

    pub fn from_parts(endpoint_id: EndpointId, data: EndpointData) -> Self

    Creates a new EndpointInfo from its parts.

    -
    Source

    pub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self

    Sets the relay URL and returns the updated endpoint info.

    +

    Implementations§

    Source§

    impl EndpointInfo

    Source

    pub fn new(endpoint_id: EndpointId) -> Self

    Creates a new EndpointInfo with an empty EndpointData.

    +
    Source

    pub fn from_parts(endpoint_id: EndpointId, data: EndpointData) -> Self

    Creates a new EndpointInfo from its parts.

    +
    Source

    pub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self

    Sets the relay URL and returns the updated endpoint info.

    Source

    pub fn with_ip_addrs(self, addrs: BTreeSet<SocketAddr>) -> Self

    Sets the IP based addresses and returns the updated endpoint info.

    Source

    pub fn with_user_data(self, user_data: Option<UserData>) -> Self

    Sets the user-defined data and returns the updated endpoint info.

    -
    Source

    pub fn to_endpoint_addr(&self) -> EndpointAddr

    Converts into a EndpointAddr by cloning the needed fields.

    -
    Source

    pub fn into_endpoint_addr(self) -> EndpointAddr

    Converts into a EndpointAddr without cloning.

    +
    Source

    pub fn to_endpoint_addr(&self) -> EndpointAddr

    Converts into a [EndpointAddr] by cloning the needed fields.

    +
    Source

    pub fn into_endpoint_addr(self) -> EndpointAddr

    Converts into a [EndpointAddr] without cloning.

    Source

    pub fn from_txt_lookup( domain_name: String, lookup: impl Iterator<Item = TxtRecordData>, @@ -21,21 +21,21 @@ ) -> Result<Self, ParseError>

    Parses a EndpointInfo from a [pkarr::SignedPacket].

    Source

    pub fn to_pkarr_signed_packet( &self, - secret_key: &SecretKey, + secret_key: &SecretKey, ttl: u32, ) -> Result<SignedPacket, EncodingError>

    Creates a [pkarr::SignedPacket].

    -

    This constructs a DNS packet and signs it with a SecretKey.

    +

    This constructs a DNS packet and signs it with a [SecretKey].

    Source

    pub fn to_txt_strings(&self) -> Vec<String>

    Converts into a list of {key}={value} strings.

    -

    Methods from Deref<Target = EndpointData>§

    Source

    pub fn relay_urls(&self) -> impl Iterator<Item = &RelayUrl>

    Returns the relay URL of the endpoint.

    +

    Methods from Deref<Target = EndpointData>§

    Source

    pub fn relay_urls(&self) -> impl Iterator<Item = &RelayUrl>

    Returns the relay URL of the endpoint.

    Source

    pub fn user_data(&self) -> Option<&UserData>

    Returns the optional user-defined data of the endpoint.

    Source

    pub fn ip_addrs(&self) -> impl Iterator<Item = &SocketAddr>

    Returns the direct addresses of the endpoint.

    Source

    pub fn clear_ip_addrs(&mut self)

    Removes all direct addresses from the endpoint data.

    Source

    pub fn clear_relay_urls(&mut self)

    Removes all direct addresses from the endpoint data.

    -
    Source

    pub fn add_addrs(&mut self, addrs: impl IntoIterator<Item = TransportAddr>)

    Add addresses to the endpoint data.

    +
    Source

    pub fn add_addrs(&mut self, addrs: impl IntoIterator<Item = TransportAddr>)

    Add addresses to the endpoint data.

    Source

    pub fn set_user_data(&mut self, user_data: Option<UserData>)

    Sets the user-defined data of the endpoint data.

    -
    Source

    pub fn addrs(&self) -> impl Iterator<Item = &TransportAddr>

    Returns the full list of all known addresses

    +
    Source

    pub fn addrs(&self) -> impl Iterator<Item = &TransportAddr>

    Returns the full list of all known addresses

    Source

    pub fn has_addrs(&self) -> bool

    Does this have any addresses?

    -

    Trait Implementations§

    Source§

    impl Clone for EndpointInfo

    Source§

    fn clone(&self) -> EndpointInfo

    Returns a duplicate of the value. Read more
    1.0.0 · Source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    Source§

    impl Debug for EndpointInfo

    Source§

    fn fmt(&self, __derive_more_f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    Source§

    impl Deref for EndpointInfo

    Source§

    type Target = EndpointData

    The resulting type after dereferencing.
    Source§

    fn deref(&self) -> &Self::Target

    Dereferences the value.
    Source§

    impl DerefMut for EndpointInfo

    Source§

    fn deref_mut(&mut self) -> &mut Self::Target

    Mutably dereferences the value.
    Source§

    impl From<EndpointAddr> for EndpointInfo

    Source§

    fn from(addr: EndpointAddr) -> Self

    Converts to this type from the input type.
    Source§

    impl From<EndpointInfo> for EndpointAddr

    Source§

    fn from(value: EndpointInfo) -> Self

    Converts to this type from the input type.
    Source§

    impl PartialEq for EndpointInfo

    Source§

    fn eq(&self, other: &EndpointInfo) -> bool

    Tests for self and other values to be equal, and is used by ==.
    1.0.0 · Source§

    fn ne(&self, other: &Rhs) -> bool

    Tests for !=. The default implementation is almost always sufficient, +

    Trait Implementations§

    Source§

    impl Clone for EndpointInfo

    Source§

    fn clone(&self) -> EndpointInfo

    Returns a duplicate of the value. Read more
    1.0.0 · Source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    Source§

    impl Debug for EndpointInfo

    Source§

    fn fmt(&self, __derive_more_f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    Source§

    impl Deref for EndpointInfo

    Source§

    type Target = EndpointData

    The resulting type after dereferencing.
    Source§

    fn deref(&self) -> &Self::Target

    Dereferences the value.
    Source§

    impl DerefMut for EndpointInfo

    Source§

    fn deref_mut(&mut self) -> &mut Self::Target

    Mutably dereferences the value.
    Source§

    impl From<EndpointAddr> for EndpointInfo

    Source§

    fn from(addr: EndpointAddr) -> Self

    Converts to this type from the input type.
    Source§

    impl From<EndpointInfo> for EndpointAddr

    Source§

    fn from(value: EndpointInfo) -> Self

    Converts to this type from the input type.
    Source§

    impl PartialEq for EndpointInfo

    Source§

    fn eq(&self, other: &EndpointInfo) -> bool

    Tests for self and other values to be equal, and is used by ==.
    1.0.0 · Source§

    fn ne(&self, other: &Rhs) -> bool

    Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
    Source§

    impl Eq for EndpointInfo

    Source§

    impl StructuralPartialEq for EndpointInfo

    Auto Trait Implementations§

    Blanket Implementations§

    Source§

    impl<T> Any for T
    where T: 'static + ?Sized,

    Source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    §

    impl<'a, T, E> AsTaggedExplicit<'a, E> for T
    where T: 'a,

    §

    fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

    §

    impl<'a, T, E> AsTaggedImplicit<'a, E> for T
    where diff --git a/pr/3610/docs/iroh_relay/endpoint_info/trait.EndpointIdExt.html b/pr/3610/docs/iroh_relay/endpoint_info/trait.EndpointIdExt.html index 7fbf71df72..a2b5047423 100644 --- a/pr/3610/docs/iroh_relay/endpoint_info/trait.EndpointIdExt.html +++ b/pr/3610/docs/iroh_relay/endpoint_info/trait.EndpointIdExt.html @@ -1,9 +1,9 @@ EndpointIdExt in iroh_relay::endpoint_info - Rust

    EndpointIdExt

    Trait EndpointIdExt 

    Source
    pub trait EndpointIdExt {
         // Required methods
         fn to_z32(&self) -> String;
    -    fn from_z32(s: &str) -> Result<EndpointId, DecodingError>;
    -}
    Expand description

    Extension methods for EndpointId to encode to and decode from [z32], + fn from_z32(s: &str) -> Result<EndpointId, DecodingError>; +}

    Expand description

    Extension methods for [EndpointId] to encode to and decode from [z32], which is the encoding used in [pkarr] domain names.

    -

    Required Methods§

    Source

    fn to_z32(&self) -> String

    Encodes a EndpointId in z-base-32 encoding.

    -
    Source

    fn from_z32(s: &str) -> Result<EndpointId, DecodingError>

    Parses a EndpointId from z-base-32 encoding.

    -

    Dyn Compatibility§

    This trait is not dyn compatible.

    In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

    Implementations on Foreign Types§

    Source§

    impl EndpointIdExt for EndpointId

    Implementors§

    \ No newline at end of file +

    Required Methods§

    Source

    fn to_z32(&self) -> String

    Encodes a [EndpointId] in z-base-32 encoding.

    +
    Source

    fn from_z32(s: &str) -> Result<EndpointId, DecodingError>

    Parses a [EndpointId] from z-base-32 encoding.

    +

    Dyn Compatibility§

    This trait is not dyn compatible.

    In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

    Implementations on Foreign Types§

    Source§

    impl EndpointIdExt for EndpointId

    Source§

    fn to_z32(&self) -> String

    Source§

    fn from_z32(s: &str) -> Result<EndpointId, DecodingError>

    Implementors§

    \ No newline at end of file diff --git a/pr/3610/docs/iroh_relay/index.html b/pr/3610/docs/iroh_relay/index.html index 715e389fe5..4f8da8c2ae 100644 --- a/pr/3610/docs/iroh_relay/index.html +++ b/pr/3610/docs/iroh_relay/index.html @@ -25,6 +25,6 @@ Tailscale.

    QAD support and expose metrics.

    -

    Re-exports§

    pub use protos::relay::MAX_PACKET_SIZE;

    Modules§

    client
    Exposes Client, which allows to establish connections to a relay server.
    defaults
    Default values used in the relay.
    dnsNon-wasm_browser
    DNS resolver
    endpoint_info
    Support for handling DNS resource records for dialing by EndpointId.
    http
    HTTP-specific constants for the relay server and client.
    protos
    Protocols used by the iroh-relay
    quic
    Create a QUIC server that accepts connections +

    Re-exports§

    pub use protos::relay::MAX_PACKET_SIZE;

    Modules§

    client
    Exposes Client, which allows to establish connections to a relay server.
    defaults
    Default values used in the relay.
    dnsNon-wasm_browser
    DNS resolver
    endpoint_info
    Support for handling DNS resource records for dialing by [EndpointId].
    http
    HTTP-specific constants for the relay server and client.
    protos
    Protocols used by the iroh-relay
    quic
    Create a QUIC server that accepts connections for QUIC address discovery.
    serverserver
    A fully-fledged iroh-relay server over HTTP or HTTPS.

    Structs§

    PingTracker
    Tracks pings on a single relay connection.
    RelayConfig
    Information on a specific relay server.
    RelayMap
    List of relay server configurations to be used in an iroh endpoint.
    RelayQuicConfig
    Configuration for speaking to the QUIC endpoint on the relay server to do QUIC address discovery.
    \ No newline at end of file diff --git a/pr/3610/docs/iroh_relay/protos/relay/enum.ClientToRelayMsg.html b/pr/3610/docs/iroh_relay/protos/relay/enum.ClientToRelayMsg.html index deb49e2bef..5d8b086ce0 100644 --- a/pr/3610/docs/iroh_relay/protos/relay/enum.ClientToRelayMsg.html +++ b/pr/3610/docs/iroh_relay/protos/relay/enum.ClientToRelayMsg.html @@ -2,7 +2,7 @@ Ping([u8; 8]), Pong([u8; 8]), Datagrams { - dst_endpoint_id: EndpointId, + dst_endpoint_id: EndpointId, datagrams: Datagrams, }, }
    Expand description

    Messages that clients send to relays.

    @@ -11,7 +11,7 @@ other side with a §

    Pong([u8; 8])

    Reply to a RelayToClientMsg::Ping from a server with the payload sent previously in the ping.

    §

    Datagrams

    Request from the client to relay datagrams to given remote endpoint.

    -

    Fields

    §dst_endpoint_id: EndpointId

    The remote endpoint to relay to.

    +

    Fields

    §dst_endpoint_id: EndpointId

    The remote endpoint to relay to.

    §datagrams: Datagrams

    The datagrams and related metadata to relay.

    Trait Implementations§

    Source§

    impl Clone for ClientToRelayMsg

    Source§

    fn clone(&self) -> ClientToRelayMsg

    Returns a duplicate of the value. Read more
    1.0.0 · Source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    Source§

    impl Debug for ClientToRelayMsg

    Source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    Source§

    impl PartialEq for ClientToRelayMsg

    Source§

    fn eq(&self, other: &ClientToRelayMsg) -> bool

    Tests for self and other values to be equal, and is used by ==.
    1.0.0 · Source§

    fn ne(&self, other: &Rhs) -> bool

    Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
    Source§

    impl Sink<ClientToRelayMsg> for Client

    Source§

    type Error = SendError

    The type of value produced by the sink when an error occurs.
    Source§

    fn poll_ready( diff --git a/pr/3610/docs/iroh_relay/protos/relay/enum.Error.html b/pr/3610/docs/iroh_relay/protos/relay/enum.Error.html index f673ea41dd..792473f4e1 100644 --- a/pr/3610/docs/iroh_relay/protos/relay/enum.Error.html +++ b/pr/3610/docs/iroh_relay/protos/relay/enum.Error.html @@ -17,7 +17,7 @@ meta: Meta, }, InvalidPublicKey { - source: KeyParsingError, + source: KeyParsingError, meta: Meta, }, InvalidFrame { @@ -39,12 +39,12 @@

    §

    FrameTooLarge

    Fields

    §frame_len: usize
    §meta: Meta

    Captured call-site metadata

    §

    SerDe

    Fields

    §source: Error
    §meta: Meta

    Captured call-site metadata

    §

    FrameTypeError

    Fields

    §meta: Meta

    Captured call-site metadata

    -
    §

    InvalidPublicKey

    Fields

    §meta: Meta

    Captured call-site metadata

    +
    §

    InvalidPublicKey

    Fields

    §source: KeyParsingError
    §meta: Meta

    Captured call-site metadata

    §

    InvalidFrame

    Fields

    §meta: Meta

    Captured call-site metadata

    §

    InvalidFrameType

    Fields

    §frame_type: FrameType
    §meta: Meta

    Captured call-site metadata

    §

    InvalidProtocolMessageEncoding

    Fields

    §source: Utf8Error
    §meta: Meta

    Captured call-site metadata

    §

    TooSmall

    Fields

    §meta: Meta

    Captured call-site metadata

    -

    Trait Implementations§

    Source§

    impl Debug for Error

    Source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    Source§

    impl Display for Error

    Source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    Source§

    impl Error for Error

    Source§

    fn source(&self) -> Option<&(dyn Error + 'static)>

    Returns the lower-level source of this error, if any. Read more
    1.0.0 · Source§

    fn description(&self) -> &str

    👎Deprecated since 1.42.0: use the Display impl or to_string()
    1.0.0 · Source§

    fn cause(&self) -> Option<&dyn Error>

    👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
    Source§

    fn provide<'a>(&'a self, request: &mut Request<'a>)

    🔬This is a nightly-only experimental API. (error_generic_member_access)
    Provides type-based access to context intended for error reports. Read more
    Source§

    impl From<Error> for AnyError

    Source§

    fn from(value: Error) -> AnyError

    Converts to this type from the input type.
    Source§

    impl From<Error> for Error

    Source§

    fn from(source: Error) -> Self

    Converts to this type from the input type.
    Source§

    impl From<Error> for RecvError

    Source§

    fn from(source: ProtoError) -> Self

    Converts to this type from the input type.
    Source§

    impl From<FrameTypeError> for Error

    Source§

    fn from(source: FrameTypeError) -> Self

    Converts to this type from the input type.
    Source§

    impl From<KeyParsingError> for Error

    Source§

    fn from(source: KeyParsingError) -> Self

    Converts to this type from the input type.
    Source§

    impl From<Utf8Error> for Error

    Source§

    fn from(source: Utf8Error) -> Self

    Converts to this type from the input type.
    Source§

    impl StackError for Error

    Source§

    fn as_std(&self) -> &(dyn Error + Send + Sync + 'static)

    Returns this error as a std error reference.
    Source§

    fn into_std(self: Box<Self>) -> Box<dyn Error + Send + Sync>

    Returns this error as a std error.
    Source§

    fn as_dyn(&self) -> &dyn StackError

    Returns this error as a dyn StackError.
    Source§

    fn fmt_message(&self, f: &mut Formatter<'_>) -> Result

    Returns the next source in the chain, if any.
    Source§

    fn meta(&self) -> Option<&Meta>

    Returns metadata captured at creation time, if available.
    Source§

    fn source(&self) -> Option<ErrorRef<'_>>

    Returns the next source in the chain, if any.
    Source§

    fn is_transparent(&self) -> bool

    Returns whether this error is transparent and should be skipped in reports.
    §

    fn as_ref(&self) -> ErrorRef<'_>

    Returns this error as an [ErrorRef]. Read more
    §

    fn stack(&self) -> Chain<'_>

    Returns an iterator over this error followed by its sources.
    §

    fn sources(&self) -> Chain<'_>

    Returns an iterator over sources of this error (skipping self).
    §

    fn report(&self) -> Report<'_>

    Returns a [Report] to output the error with configurable formatting.

    Auto Trait Implementations§

    §

    impl Freeze for Error

    §

    impl !RefUnwindSafe for Error

    §

    impl Send for Error

    §

    impl Sync for Error

    §

    impl Unpin for Error

    §

    impl !UnwindSafe for Error

    Blanket Implementations§

    Source§

    impl<T> Any for T
    where +

    Trait Implementations§

    Source§

    impl Debug for Error

    Source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    Source§

    impl Display for Error

    Source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    Source§

    impl Error for Error

    Source§

    fn source(&self) -> Option<&(dyn Error + 'static)>

    Returns the lower-level source of this error, if any. Read more
    1.0.0 · Source§

    fn description(&self) -> &str

    👎Deprecated since 1.42.0: use the Display impl or to_string()
    1.0.0 · Source§

    fn cause(&self) -> Option<&dyn Error>

    👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
    Source§

    fn provide<'a>(&'a self, request: &mut Request<'a>)

    🔬This is a nightly-only experimental API. (error_generic_member_access)
    Provides type-based access to context intended for error reports. Read more
    Source§

    impl From<Error> for AnyError

    Source§

    fn from(value: Error) -> AnyError

    Converts to this type from the input type.
    Source§

    impl From<Error> for Error

    Source§

    fn from(source: Error) -> Self

    Converts to this type from the input type.
    Source§

    impl From<Error> for RecvError

    Source§

    fn from(source: ProtoError) -> Self

    Converts to this type from the input type.
    Source§

    impl From<FrameTypeError> for Error

    Source§

    fn from(source: FrameTypeError) -> Self

    Converts to this type from the input type.
    Source§

    impl From<KeyParsingError> for Error

    Source§

    fn from(source: KeyParsingError) -> Self

    Converts to this type from the input type.
    Source§

    impl From<Utf8Error> for Error

    Source§

    fn from(source: Utf8Error) -> Self

    Converts to this type from the input type.
    Source§

    impl StackError for Error

    Source§

    fn as_std(&self) -> &(dyn Error + Send + Sync + 'static)

    Returns this error as a std error reference.
    Source§

    fn into_std(self: Box<Self>) -> Box<dyn Error + Send + Sync>

    Returns this error as a std error.
    Source§

    fn as_dyn(&self) -> &dyn StackError

    Returns this error as a dyn StackError.
    Source§

    fn fmt_message(&self, f: &mut Formatter<'_>) -> Result

    Returns the next source in the chain, if any.
    Source§

    fn meta(&self) -> Option<&Meta>

    Returns metadata captured at creation time, if available.
    Source§

    fn source(&self) -> Option<ErrorRef<'_>>

    Returns the next source in the chain, if any.
    Source§

    fn is_transparent(&self) -> bool

    Returns whether this error is transparent and should be skipped in reports.
    §

    fn as_ref(&self) -> ErrorRef<'_>

    Returns this error as an [ErrorRef]. Read more
    §

    fn stack(&self) -> Chain<'_>

    Returns an iterator over this error followed by its sources.
    §

    fn sources(&self) -> Chain<'_>

    Returns an iterator over sources of this error (skipping self).
    §

    fn report(&self) -> Report<'_>

    Returns a [Report] to output the error with configurable formatting.

    Auto Trait Implementations§

    §

    impl Freeze for Error

    §

    impl !RefUnwindSafe for Error

    §

    impl Send for Error

    §

    impl Sync for Error

    §

    impl Unpin for Error

    §

    impl !UnwindSafe for Error

    Blanket Implementations§

    Source§

    impl<T> Any for T
    where T: 'static + ?Sized,

    Source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    §

    impl<'a, T, E> AsTaggedExplicit<'a, E> for T
    where T: 'a,

    §

    fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

    §

    impl<'a, T, E> AsTaggedImplicit<'a, E> for T
    where T: 'a,

    §

    fn implicit( diff --git a/pr/3610/docs/iroh_relay/protos/relay/enum.RelayToClientMsg.html b/pr/3610/docs/iroh_relay/protos/relay/enum.RelayToClientMsg.html index 6d14964f00..d51fc65f1f 100644 --- a/pr/3610/docs/iroh_relay/protos/relay/enum.RelayToClientMsg.html +++ b/pr/3610/docs/iroh_relay/protos/relay/enum.RelayToClientMsg.html @@ -1,9 +1,9 @@ RelayToClientMsg in iroh_relay::protos::relay - Rust

    RelayToClientMsg

    Enum RelayToClientMsg 

    Source
    pub enum RelayToClientMsg {
         Datagrams {
    -        remote_endpoint_id: EndpointId,
    +        remote_endpoint_id: EndpointId,
             datagrams: Datagrams,
         },
    -    EndpointGone(EndpointId),
    +    EndpointGone(EndpointId),
         Health {
             problem: String,
         },
    @@ -15,9 +15,9 @@
         Pong([u8; 8]),
     }
    Expand description

    The messages that a relay sends to clients or the clients receive from the relay.

    Variants§

    §

    Datagrams

    Represents datagrams sent from relays (originally sent to them by another client).

    -

    Fields

    §remote_endpoint_id: EndpointId

    The EndpointId of the original sender.

    +

    Fields

    §remote_endpoint_id: EndpointId

    The [EndpointId] of the original sender.

    §datagrams: Datagrams

    The datagrams and related metadata.

    -
    §

    EndpointGone(EndpointId)

    Indicates that the client identified by the underlying public key had previously sent you a +

    §

    EndpointGone(EndpointId)

    Indicates that the client identified by the underlying public key had previously sent you a packet but has now disconnected from the relay.

    §

    Health

    A one-way message from relay to client, declaring the connection health state.

    Fields

    §problem: String

    If set, is a description of why the connection is unhealthy.

    diff --git a/pr/3610/docs/iroh_relay/server/enum.AccessConfig.html b/pr/3610/docs/iroh_relay/server/enum.AccessConfig.html index a7e978331b..04b407ff2e 100644 --- a/pr/3610/docs/iroh_relay/server/enum.AccessConfig.html +++ b/pr/3610/docs/iroh_relay/server/enum.AccessConfig.html @@ -1,10 +1,10 @@ AccessConfig in iroh_relay::server - Rust

    AccessConfig

    Enum AccessConfig 

    Source
    pub enum AccessConfig {
         Everyone,
    -    Restricted(Box<dyn Fn(EndpointId) -> Boxed<Access> + Send + Sync + 'static>),
    +    Restricted(Box<dyn Fn(EndpointId) -> Boxed<Access> + Send + Sync + 'static>),
     }
    Available on crate feature server only.
    Expand description

    Controls which endpoints are allowed to use the relay.

    Variants§

    §

    Everyone

    Everyone

    -
    §

    Restricted(Box<dyn Fn(EndpointId) -> Boxed<Access> + Send + Sync + 'static>)

    Only endpoints for which the function returns Access::Allow.

    -

    Implementations§

    Source§

    impl AccessConfig

    Source

    pub async fn is_allowed(&self, endpoint: EndpointId) -> bool

    Is this endpoint allowed?

    +
    §

    Restricted(Box<dyn Fn(EndpointId) -> Boxed<Access> + Send + Sync + 'static>)

    Only endpoints for which the function returns Access::Allow.

    +

    Implementations§

    Source§

    impl AccessConfig

    Source

    pub async fn is_allowed(&self, endpoint: EndpointId) -> bool

    Is this endpoint allowed?

    Trait Implementations§

    Source§

    impl Debug for AccessConfig

    Source§

    fn fmt(&self, __derive_more_f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more

    Auto Trait Implementations§

    Blanket Implementations§

    Source§

    impl<T> Any for T
    where T: 'static + ?Sized,

    Source§

    fn type_id(&self) -> TypeId

    Gets the TypeId of self. Read more
    §

    impl<'a, T, E> AsTaggedExplicit<'a, E> for T
    where T: 'a,

    §

    fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

    §

    impl<'a, T, E> AsTaggedImplicit<'a, E> for T
    where diff --git a/pr/3610/docs/iroh_relay/server/struct.Server.html b/pr/3610/docs/iroh_relay/server/struct.Server.html index e7bc2a6e75..52b3941cb6 100644 --- a/pr/3610/docs/iroh_relay/server/struct.Server.html +++ b/pr/3610/docs/iroh_relay/server/struct.Server.html @@ -17,9 +17,9 @@ case there is an error in the server before it is shut down.

    Source

    pub fn http_addr(&self) -> Option<SocketAddr>

    The socket address the HTTP server is listening on.

    Source

    pub fn quic_addr(&self) -> Option<SocketAddr>

    The socket address the QUIC server is listening on.

    Source

    pub fn certificates(&self) -> Option<Vec<CertificateDer<'static>>>

    The certificates chain if configured with manual TLS certificates.

    -
    Source

    pub fn https_url(&self) -> Option<RelayUrl>

    Available on crate feature test-utils only.

    Get the server’s https RelayUrl.

    +
    Source

    pub fn https_url(&self) -> Option<RelayUrl>

    Available on crate feature test-utils only.

    Get the server’s https [RelayUrl].

    This uses Self::https_addr so it’s mostly useful for local development.

    -
    Source

    pub fn http_url(&self) -> Option<RelayUrl>

    Available on crate feature test-utils only.

    Get the server’s http RelayUrl.

    +
    Source

    pub fn http_url(&self) -> Option<RelayUrl>

    Available on crate feature test-utils only.

    Get the server’s http [RelayUrl].

    This uses Self::http_addr so it’s mostly useful for local development.

    Source

    pub fn metrics(&self) -> &RelayMetrics

    Returns the metrics collected in the relay server.

    Trait Implementations§

    Source§

    impl Debug for Server

    Source§

    fn fmt(&self, __derive_more_f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more

    Auto Trait Implementations§

    §

    impl Freeze for Server

    §

    impl RefUnwindSafe for Server

    §

    impl Send for Server

    §

    impl Sync for Server

    §

    impl Unpin for Server

    §

    impl UnwindSafe for Server

    Blanket Implementations§

    Source§

    impl<T> Any for T
    where diff --git a/pr/3610/docs/iroh_relay/struct.RelayConfig.html b/pr/3610/docs/iroh_relay/struct.RelayConfig.html index 4599fb72cc..032f02b791 100644 --- a/pr/3610/docs/iroh_relay/struct.RelayConfig.html +++ b/pr/3610/docs/iroh_relay/struct.RelayConfig.html @@ -1,14 +1,14 @@ RelayConfig in iroh_relay - Rust

    RelayConfig

    Struct RelayConfig 

    Source
    pub struct RelayConfig {
    -    pub url: RelayUrl,
    +    pub url: RelayUrl,
         pub quic: Option<RelayQuicConfig>,
     }
    Expand description

    Information on a specific relay server.

    Includes the Url where it can be dialed.

    -

    Fields§

    §url: RelayUrl

    The RelayUrl where this relay server can be dialed.

    +

    Fields§

    §url: RelayUrl

    The [RelayUrl] where this relay server can be dialed.

    §quic: Option<RelayQuicConfig>

    Configuration to speak to the QUIC endpoint on the relay server.

    When None, we will not attempt to do QUIC address discovery with this relay server.

    Trait Implementations§

    Source§

    impl Clone for RelayConfig

    Source§

    fn clone(&self) -> RelayConfig

    Returns a duplicate of the value. Read more
    1.0.0 · Source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    Source§

    impl Debug for RelayConfig

    Source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    Source§

    impl<'de> Deserialize<'de> for RelayConfig

    Source§

    fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
    where - __D: Deserializer<'de>,

    Deserialize this value from the given Serde deserializer. Read more
    Source§

    impl Display for RelayConfig

    Source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    Source§

    impl From<RelayConfig> for RelayMap

    Source§

    fn from(value: RelayConfig) -> Self

    Converts to this type from the input type.
    Source§

    impl From<RelayUrl> for RelayConfig

    Source§

    fn from(value: RelayUrl) -> Self

    Converts to this type from the input type.
    Source§

    impl FromIterator<RelayConfig> for RelayMap

    Source§

    fn from_iter<T: IntoIterator<Item = RelayConfig>>(iter: T) -> Self

    Creates a value from an iterator. Read more
    Source§

    impl Ord for RelayConfig

    Source§

    fn cmp(&self, other: &RelayConfig) -> Ordering

    This method returns an Ordering between self and other. Read more
    1.21.0 · Source§

    fn max(self, other: Self) -> Self
    where + __D: Deserializer<'de>,

    Deserialize this value from the given Serde deserializer. Read more
    Source§

    impl Display for RelayConfig

    Source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    Source§

    impl From<RelayConfig> for RelayMap

    Source§

    fn from(value: RelayConfig) -> Self

    Converts to this type from the input type.
    Source§

    impl From<RelayUrl> for RelayConfig

    Source§

    fn from(value: RelayUrl) -> Self

    Converts to this type from the input type.
    Source§

    impl FromIterator<RelayConfig> for RelayMap

    Source§

    fn from_iter<T: IntoIterator<Item = RelayConfig>>(iter: T) -> Self

    Creates a value from an iterator. Read more
    Source§

    impl Ord for RelayConfig

    Source§

    fn cmp(&self, other: &RelayConfig) -> Ordering

    This method returns an Ordering between self and other. Read more
    1.21.0 · Source§

    fn max(self, other: Self) -> Self
    where Self: Sized,

    Compares and returns the maximum of two values. Read more
    1.21.0 · Source§

    fn min(self, other: Self) -> Self
    where Self: Sized,

    Compares and returns the minimum of two values. Read more
    1.50.0 · Source§

    fn clamp(self, min: Self, max: Self) -> Self
    where Self: Sized,

    Restrict a value to a certain interval. Read more
    Source§

    impl PartialEq for RelayConfig

    Source§

    fn eq(&self, other: &RelayConfig) -> bool

    Tests for self and other values to be equal, and is used by ==.
    1.0.0 · Source§

    fn ne(&self, other: &Rhs) -> bool

    Tests for !=. The default implementation is almost always sufficient, diff --git a/pr/3610/docs/iroh_relay/struct.RelayMap.html b/pr/3610/docs/iroh_relay/struct.RelayMap.html index 68cedd8dcb..4b333a3a13 100644 --- a/pr/3610/docs/iroh_relay/struct.RelayMap.html +++ b/pr/3610/docs/iroh_relay/struct.RelayMap.html @@ -8,28 +8,28 @@ or by creating an empty relay map with let relay2 = RelayUrl::from_str("https://relay2.example.org").unwrap(); let map = RelayMap::from_iter(vec![relay1, relay2]);

    Implementations§

    Source§

    impl RelayMap

    Source

    pub fn empty() -> Self

    Creates an empty relay map.

    Source

    pub fn urls<T>(&self) -> T
    where - T: FromIterator<RelayUrl>,

    Returns the URLs of all servers in this relay map.

    + T: FromIterator<RelayUrl>,

    Returns the URLs of all servers in this relay map.

    This function is generic over the container to collect into. If you simply want a list of URLs, call this with map.urls::<Vec<_>>() to get a Vec<RelayUrl>.

    Source

    pub fn relays<T>(&self) -> T

    Returns a list with the RelayConfig for each relay in this relay map.

    This function is generic over the container to collect into. If you simply want a list of URLs, call this with map.relays::<Vec<_>>() to get a Vec<RelayConfig>.

    -
    Source

    pub fn contains(&self, url: &RelayUrl) -> bool

    Returns true if a relay with url is contained in this this relay map.

    -
    Source

    pub fn get(&self, url: &RelayUrl) -> Option<Arc<RelayConfig>>

    Returns the config for a relay.

    +
    Source

    pub fn contains(&self, url: &RelayUrl) -> bool

    Returns true if a relay with url is contained in this this relay map.

    +
    Source

    pub fn get(&self, url: &RelayUrl) -> Option<Arc<RelayConfig>>

    Returns the config for a relay.

    Source

    pub fn len(&self) -> usize

    Returns the number of relays in this relay map.

    Source

    pub fn is_empty(&self) -> bool

    Returns true if this relay map is empty.

    Source

    pub fn insert( &self, - url: RelayUrl, + url: RelayUrl, endpoint: Arc<RelayConfig>, ) -> Option<Arc<RelayConfig>>

    Inserts a new relay into the relay map.

    -
    Source

    pub fn remove(&self, url: &RelayUrl) -> Option<Arc<RelayConfig>>

    Removes an existing relay by its URL.

    +
    Source

    pub fn remove(&self, url: &RelayUrl) -> Option<Arc<RelayConfig>>

    Removes an existing relay by its URL.

    Source

    pub fn extend(&self, other: &RelayMap)

    Extends this RelayMap with another one.

    -

    Trait Implementations§

    Source§

    impl Clone for RelayMap

    Source§

    fn clone(&self) -> RelayMap

    Returns a duplicate of the value. Read more
    1.0.0 · Source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    Source§

    impl Debug for RelayMap

    Source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    Source§

    impl Display for RelayMap

    Source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    Source§

    impl From<RelayConfig> for RelayMap

    Source§

    fn from(value: RelayConfig) -> Self

    Converts to this type from the input type.
    Source§

    impl From<RelayUrl> for RelayMap

    Source§

    fn from(value: RelayUrl) -> Self

    Creates a RelayMap from a RelayUrl.

    +

    Trait Implementations§

    Source§

    impl Clone for RelayMap

    Source§

    fn clone(&self) -> RelayMap

    Returns a duplicate of the value. Read more
    1.0.0 · Source§

    fn clone_from(&mut self, source: &Self)

    Performs copy-assignment from source. Read more
    Source§

    impl Debug for RelayMap

    Source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    Source§

    impl Display for RelayMap

    Source§

    fn fmt(&self, f: &mut Formatter<'_>) -> Result

    Formats the value using the given formatter. Read more
    Source§

    impl From<RelayConfig> for RelayMap

    Source§

    fn from(value: RelayConfig) -> Self

    Converts to this type from the input type.
    Source§

    impl From<RelayUrl> for RelayMap

    Source§

    fn from(value: RelayUrl) -> Self

    Creates a RelayMap from a [RelayUrl].

    The RelayConfigs in the RelayMap will have the default QUIC address discovery ports.

    -
    Source§

    impl FromIterator<Arc<RelayConfig>> for RelayMap

    Source§

    fn from_iter<T: IntoIterator<Item = Arc<RelayConfig>>>(iter: T) -> Self

    Creates a value from an iterator. Read more
    Source§

    impl FromIterator<RelayConfig> for RelayMap

    Source§

    fn from_iter<T: IntoIterator<Item = RelayConfig>>(iter: T) -> Self

    Creates a value from an iterator. Read more
    Source§

    impl FromIterator<RelayUrl> for RelayMap

    Source§

    fn from_iter<T: IntoIterator<Item = RelayUrl>>(iter: T) -> Self

    Creates a RelayMap from an iterator of RelayUrl.

    +
    Source§

    impl FromIterator<Arc<RelayConfig>> for RelayMap

    Source§

    fn from_iter<T: IntoIterator<Item = Arc<RelayConfig>>>(iter: T) -> Self

    Creates a value from an iterator. Read more
    Source§

    impl FromIterator<RelayConfig> for RelayMap

    Source§

    fn from_iter<T: IntoIterator<Item = RelayConfig>>(iter: T) -> Self

    Creates a value from an iterator. Read more
    Source§

    impl FromIterator<RelayUrl> for RelayMap

    Source§

    fn from_iter<T: IntoIterator<Item = RelayUrl>>(iter: T) -> Self

    Creates a RelayMap from an iterator of [RelayUrl].

    The RelayConfigs in the RelayMap will have the default QUIC address discovery ports.

    Source§

    impl PartialEq for RelayMap

    Source§

    fn eq(&self, other: &Self) -> bool

    Tests for self and other values to be equal, and is used by ==.
    1.0.0 · Source§

    fn ne(&self, other: &Rhs) -> bool

    Tests for !=. The default implementation is almost always sufficient, diff --git a/pr/3610/docs/search.index/path/0632033d4c68.js b/pr/3610/docs/search.index/path/0632033d4c68.js deleted file mode 100644 index 594b3555ce..0000000000 --- a/pr/3610/docs/search.index/path/0632033d4c68.js +++ /dev/null @@ -1 +0,0 @@ -rd_("f[1,\"\"]0Al[10,\"core::cmp\",\"core::cmp\"]Al[10,\"core::ops\",\"core::ops\"]Ce[5,\"clap_builder::util::id\",\"clap_builder::util::id\"]Bd[15,\"iroh_relay::client::DialError\"]Cg[5,\"iroh::endpoint::presets\",\"iroh::endpoint::presets\"]Eg[5,\"tower_http::follow_redirect::policy::or\",\"tower_http::follow_redirect::policy::or\"]66Ei[5,\"tower_http::follow_redirect::policy::and\",\"tower_http::follow_redirect::policy::and\"]A`[10,\"core::any\"]Ao[5,\"alloc::sync\",\"alloc::sync\"]Ba[5,\"alloc::boxed\",\"alloc::boxed\"]Cb[10,\"bytes::buf::buf_impl\",\"bytes::buf::buf_impl\"]Bi[6,\"iroh_quinn_proto\",\"iroh_quinn_proto\"]8Am[5,\"n0_watcher\",\"n0_watcher\"]Am[5,\"iroh_bench\",\"iroh_bench\"]Bg[5,\"iroh_bench::s2n\",\"iroh_bench::s2n\"]A`[10,\"core::cmp\"]Ak[5,\"core::pin\",\"core::pin\"]Bg[15,\"iroh_relay::client::ConnectError\"]o[5,\"url\",\"url\"]Am[5,\"alloc::vec\",\"alloc::vec\"]Al[2,\"iroh::discovery::pkarr\"]j[2,\"iroh\"]Ae[2,\"iroh::discovery\"]A`[2,\"iroh_relay\"]Ae[2,\"iroh_dns_server\"]f[1,\"\"]00Ao[2,\"iroh::net_report::options\"]o[2,\"iroh_base\"]f[0,\"\"]A`[2,\"iroh_bench\"]4Ak[2,\"iroh_dns_server::http\"]555Ak[10,\"clap_builder::derive\"]>Af[10,\"core::ops::drop\"]Ad[10,\"core::convert\"]Aa[10,\"core::hash\"]1g[17,\"\"]Ci[5,\"iroh_quinn_proto::crypto\",\"iroh_quinn_proto::crypto\"]Be[5,\"n0_error::meta\",\"n0_error::meta\"]Cc[5,\"reqwest::dns::resolve\",\"reqwest::dns::resolve\"]Dg[5,\"hickory_proto::rr::domain::name\",\"hickory_proto::rr::domain::name\"]Ak[5,\"std::path\",\"std::path\"]Bi[6,\"core::task::poll\",\"core::task::poll\"]Bb[10,\"core::marker\",\"core::marker\"]Bi[6,\"iroh_quinn_proto\",\"iroh_quinn_proto\"]Ac[10,\"futures_sink\"]2Bf[15,\"iroh::discovery::DiscoveryError\"]Bj[15,\"iroh::discovery::IntoDiscoveryError\"]Bb[15,\"iroh::protocol::AcceptError\"]Bb[15,\"iroh::discovery::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Ah[10,\"ppv_lite86::types\"]f[1,\"\"]f[3,\"\"]Ah[2,\"iroh_relay::client\"]A`[2,\"iroh_relay\"]Ae[2,\"iroh_dns_server\"]A`[2,\"iroh_bench\"]4Ae[2,\"iroh::discovery\"]Ad[2,\"iroh::defaults\"]4Bk[2,\"iroh_quinn_proto::connection::streams\"]88Ad[10,\"core::convert\"]Ca[8,\"futures_lite::future\",\"futures_lite::future\"]Ca[8,\"futures_lite::stream\",\"futures_lite::stream\"]Ba[5,\"bytes::bytes\",\"bytes::bytes\"]Ad[5,\"iroh::endpoint\"]Ab[10,\"core::clone\"]Cg[6,\"iroh_quinn_proto::frame\",\"iroh_quinn_proto::frame\"]Ao[10,\"iroh_quinn_proto::coding\"]A`[10,\"core::fmt\"]Ag[10,\"core::ops::deref\"]Bk[15,\"iroh::endpoint::AddEndpointAddrError\"]Ak[5,\"core::fmt\",\"core::fmt\"]Ab[10,\"core::error\"]Be[5,\"std::io::error\",\"std::io::error\"]Bc[6,\"rustls::error\",\"rustls::error\"]Ba[8,\"clap_builder\",\"clap_builder\"]Bi[5,\"signature::error\",\"signature::error\"]Af[2,\"iroh_relay::quic\"]Bc[2,\"iroh_relay::protos::handshake\"]Ao[2,\"iroh_relay::protos::relay\"]Ba[5,\"hyper::error\",\"hyper::error\"]Ee[6,\"iroh_quinn_proto::transport_parameters\",\"iroh_quinn_proto::transport_parameters\"]Be[5,\"reqwest::error\",\"reqwest::error\"]Bg[6,\"postcard::error\",\"postcard::error\"]Cg[6,\"tokio_websockets::error\",\"tokio_websockets::error\"]Bi[6,\"iroh_relay::quic\",\"iroh_relay::quic\"]Dc[6,\"iroh_relay::protos::handshake\",\"iroh_relay::protos::handshake\"]Ck[6,\"iroh_relay::protos::relay\",\"iroh_relay::protos::relay\"]Ca[6,\"iroh::net_report\",\"iroh::net_report::probes\"]Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Bb[10,\"core::marker\",\"core::marker\"]Bk[5,\"iroh_bench::stats\",\"iroh_bench::stats\"]1g[17,\"\"]f[1,\"\"]Ah[2,\"iroh_relay::protos\"]Af[2,\"iroh_quinn_proto\"]Ae[2,\"iroh::discovery\"]A`[2,\"iroh_bench\"]34Ae[2,\"iroh_dns_server\"]1Bb[2,\"iroh_quinn_proto::connection\"]166Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Ac[10,\"core::borrow\"]C`[10,\"bytes::buf::buf_mut\",\"bytes::buf::buf_mut\"]Bc[5,\"pkarr::client\",\"pkarr::client\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Ba[5,\"async_compat\",\"async_compat\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Cb[10,\"core::future::future\",\"core::future::future\"]Ca[5,\"iroh_dns_server::dns\",\"iroh_dns_server::dns\"]An[10,\"core::hash\",\"core::hash\"]Cb[15,\"iroh_relay::protos::relay::RelayToClientMsg\"]Bm[6,\"core::net::ip_addr\",\"core::net::ip_addr\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Bh[10,\"reloadable_core\",\"reloadable_core\"]Be[15,\"iroh_relay::server::CertConfig\"]Bj[15,\"iroh::endpoint::AuthenticationError\"]Ad[5,\"iroh::endpoint\"]Ba[6,\"core::option\",\"core::option\"]g[17,\"\"]Do[5,\"iroh_quinn_proto::connection::paths\",\"iroh_quinn_proto::connection::paths\"]E`[10,\"tower_http::follow_redirect::policy\",\"tower_http::follow_redirect::policy\"]Ch[10,\"iroh::endpoint::presets\",\"iroh::endpoint::presets\"]Co[5,\"hickory_proto::rr::resource\",\"hickory_proto::rr::resource\"]Ca[5,\"iroh::net_report\",\"iroh::net_report::report\"]Ak[8,\"core::fmt\",\"core::fmt\"]Ba[6,\"core::result\",\"core::result\"]Be[8,\"std::io::error\",\"std::io::error\"]Ai[8,\"n0_error\",\"n0_error\"]Be[5,\"iroh::protocol\",\"iroh::protocol\"]Cg[5,\"iroh_dns_server::server\",\"iroh_dns_server::server\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Ad[2,\"iroh::endpoint\"]Cd[6,\"iroh::endpoint\",\"iroh::magicsock::endpoint_map\"]Ak[10,\"futures_core::stream\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Bc[5,\"alloc::string\",\"alloc::string\"]Ak[5,\"core::any\",\"core::any\"]Ci[5,\"iroh_quinn_proto::varint\",\"iroh_quinn_proto::varint\"]Ad[5,\"iroh::endpoint\"]Bi[15,\"iroh::discovery::pkarr::PkarrError\"]A`[2,\"iroh_relay\"]Ah[2,\"iroh_relay::protos\"]Af[2,\"iroh_quinn_proto\"]Ae[2,\"iroh_dns_server\"]1Af[2,\"iroh::net_report\"]40412Ae[10,\"iroh::endpoint\"]Bg[8,\"iroh_relay::dns\",\"iroh_relay::dns\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Co[5,\"iroh::discovery::pkarr::dht\",\"iroh::discovery::pkarr::dht\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]De[5,\"clap_builder::builder::command\",\"clap_builder::builder::command\"]Bc[15,\"iroh::endpoint::ConnectError\"]An[15,\"iroh_relay::quic::Error\"]Bi[5,\"core::task::wake\",\"core::task::wake\"]Cc[5,\"iroh_metrics::metrics\",\"iroh_metrics::metrics\"]Ad[10,\"core::default\"]A`[10,\"core::fmt\"]Bm[5,\"tokio::time::error\",\"tokio::time::error\"]Bl[15,\"iroh::discovery::mdns::DiscoveryEvent\"]Bc[10,\"axum_core::extract::from_ref\"]Ah[10,\"core::str::traits\"]Co[5,\"std::collections::hash::map\",\"std::collections::hash::map\"]Ak[5,\"std::time\",\"std::time\"]Bj[15,\"iroh_relay::server::SupervisorError\"]Cb[5,\"iroh::net_report\",\"iroh::net_report::metrics\"]Ci[5,\"iroh_dns_server::metrics\",\"iroh_dns_server::metrics\"]Cf[5,\"iroh_relay::server\",\"iroh_relay::server::metrics\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Ad[5,\"iroh::endpoint\"]Cg[5,\"iroh::net_report\",\"iroh::net_report::options::imp\"]Ak[5,\"std::path\",\"std::path\"]Bk[5,\"dyn_clone::sealed\",\"dyn_clone::sealed\"]Bo[5,\"tokio::io::read_buf\",\"tokio::io::read_buf\"]Eg[5,\"hickory_server::server::request_handler\",\"hickory_server::server::request_handler\"]B`[15,\"iroh_relay::dns::DnsError\"]Al[10,\"reqwest::dns::resolve\"]Cg[5,\"tokio::runtime::runtime\",\"tokio::runtime::runtime\"]Cj[10,\"iroh_quinn_proto::crypto\",\"iroh_quinn_proto::crypto\"]Bd[15,\"iroh_relay::client::DialError\"]4Ad[10,\"alloc::borrow\"]Ad[10,\"core::convert\"]0Bg[15,\"iroh_relay::client::ConnectError\"]k[10,\"iroh\"]>j[2,\"iroh\"]Af[2,\"iroh::net_report\"]Ah[2,\"iroh_relay::server\"]Ae[2,\"iroh_dns_server\"]f[1,\"\"]Ad[2,\"iroh::endpoint\"]Ad[2,\"iroh::defaults\"]Bb[2,\"iroh_quinn_proto::connection\"]5Ad[5,\"iroh::endpoint\"]Bc[5,\"n0_error::any\",\"n0_error::any\"]Ce[5,\"iroh_dns_server::state\",\"iroh_dns_server::state\"]De[5,\"alloc::collections::btree::set\",\"alloc::collections::btree::set\"]Ch[6,\"iroh_dns_server::http\",\"iroh_dns_server::http::tls\"]Am[6,\"iroh_bench\",\"iroh_bench\"]Ag[10,\"core::ops::deref\"]Bm[15,\"iroh::endpoint::GetMappingAddressError\"]Ae[2,\"iroh_relay::dns\"]Bg[6,\"iroh_relay::dns\",\"iroh_relay::dns\"]Am[5,\"core::time\",\"core::time\"]A`[10,\"dyn_clone\"]Bi[15,\"iroh::discovery::pkarr::PkarrError\"]Ca[5,\"iroh_quinn::endpoint\",\"iroh_quinn::endpoint\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Bg[6,\"n0_error::error\",\"n0_error::error\"]3Ca[5,\"iroh_quinn::incoming\",\"iroh_quinn::incoming\"]Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Bm[5,\"core::net::ip_addr\",\"core::net::ip_addr\"]0Ck[6,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]Am[10,\"iroh_metrics::iterable\"]Db[10,\"core::iter::traits::iterator\",\"core::iter::traits::iterator\"]Am[15,\"iroh::endpoint::Source\"]An[10,\"n0_watcher\",\"n0_watcher\"]Ak[6,\"core::cmp\",\"core::cmp\"]Dd[5,\"iroh::endpoint\",\"iroh::magicsock::endpoint_map::endpoint_state\"]Bd[15,\"iroh_relay::client::RecvError\"]j[5,\"iroh\"]Bh[5,\"iroh_relay\",\"iroh_relay::relay_map\"]Ca[5,\"iroh_base::relay_url\",\"iroh_base::relay_url\"]2Bf[5,\"iroh_base\",\"iroh_base::relay_url\"]Bj[15,\"iroh::endpoint::AuthenticationError\"]Bh[10,\"iroh_relay::dns\",\"iroh_relay::dns\"]Ad[5,\"iroh::endpoint\"]Ad[10,\"alloc::string\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Ck[5,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]3Ae[5,\"iroh::discovery\"]1o[6,\"z32\",\"z32\"]j[2,\"iroh\"]A`[2,\"iroh_relay\"]1A`[2,\"iroh_quinn\"]2Ah[2,\"iroh_relay::server\"]B`[2,\"iroh::net_report::defaults\"]:Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Ci[5,\"tokio_rustls_acme::state\",\"tokio_rustls_acme::state\"]Ad[2,\"iroh::endpoint\"]Ca[6,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Al[10,\"tokio::io::async_read\"]2Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]Ac[10,\"core::borrow\"]Ac[10,\"async_compat\"]Al[10,\"rand_core\",\"rand_core\"]Cb[15,\"iroh_relay::protos::relay::ClientToRelayMsg\"]Cb[15,\"iroh_relay::protos::relay::RelayToClientMsg\"]Ck[5,\"iroh_relay::protos::relay\",\"iroh_relay::protos::relay\"]Ah[2,\"iroh_relay::client\"]Bm[6,\"iroh_relay::client\",\"iroh_relay::client\"]Am[15,\"iroh::endpoint::Source\"]B`[15,\"iroh::endpoint::BindError\"]Bh[10,\"iroh::discovery\",\"iroh::discovery\"]Ca[5,\"iroh_dns_server::dns\",\"iroh_dns_server::dns\"]0Ak[5,\"core::fmt\",\"core::fmt\"]Cm[6,\"iroh_relay::protos::common\",\"iroh_relay::protos::common\"]Bg[15,\"iroh_relay::client::ConnectError\"]Cc[5,\"iroh_metrics::metrics\",\"iroh_metrics::metrics\"]Ba[5,\"hdrhistogram\",\"hdrhistogram\"]Co[5,\"tokio::runtime::task::error\",\"tokio::runtime::task::error\"]Bj[15,\"iroh_relay::server::SupervisorError\"]Be[15,\"iroh_relay::server::SpawnError\"]Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]Bm[15,\"iroh::endpoint::GetMappingAddressError\"]Bf[15,\"iroh::discovery::DiscoveryError\"]Bb[15,\"iroh::discovery::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]A`[10,\"core::cmp\"]Ad[5,\"iroh::endpoint\"]Dd[8,\"iroh::endpoint\",\"iroh::magicsock::endpoint_map::endpoint_state\"]An[10,\"crossbeam_epoch::atomic\"]Bj[10,\"tower_http::follow_redirect::policy\"]Bi[15,\"iroh::discovery::pkarr::PkarrError\"]j[5,\"iroh\"]B`[5,\"iroh_base\",\"iroh_base::key\"]=Ad[6,\"iroh::endpoint\"]Ck[5,\"hickory_proto::rr::rr_set\",\"hickory_proto::rr::rr_set\"]Ck[5,\"tokio::sync::watch::error\",\"tokio::sync::watch::error\"]Ah[2,\"iroh_relay::client\"]Cc[6,\"iroh_relay::client\",\"iroh_relay::client::conn\"]Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]Cc[8,\"reqwest::dns::resolve\",\"reqwest::dns::resolve\"]Be[5,\"iroh_base::key\",\"iroh_base::key\"]9843Af[10,\"serde_core::ser\"]:9Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Ak[10,\"futures_core::future\"]Ak[10,\"futures_core::stream\"]Bi[5,\"core::str::error\",\"core::str::error\"]An[15,\"iroh_relay::quic::Error\"]Bg[15,\"iroh_relay::client::ConnectError\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]Bn[5,\"iroh_dns_server\",\"iroh_dns_server::store\"]Bb[2,\"iroh_quinn_proto::connection\"]j[2,\"iroh\"]Ah[2,\"iroh_relay::protos\"]f[3,\"\"]2f[1,\"\"]A`[2,\"iroh_relay\"]o[2,\"iroh_base\"]Af[2,\"iroh::net_report\"]An[2,\"iroh_quinn_proto::config\"]Em[5,\"clap_builder::parser::matches::arg_matches\",\"clap_builder::parser::matches::arg_matches\"]Am[10,\"tokio::io::async_write\"]Ah[2,\"iroh_relay::server\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Aa[10,\"equivalent\"]Bc[15,\"iroh::endpoint::ConnectError\"]Bb[15,\"iroh::protocol::AcceptError\"]Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Cm[5,\"iroh::endpoint::connection\",\"iroh::endpoint::connection\"]32An[15,\"iroh_relay::quic::Error\"]Ce[5,\"iroh_quinn::connection\",\"iroh_quinn::connection\"]3Ae[10,\"iroh::endpoint\"]Bf[5,\"iroh::endpoint\",\"iroh::magicsock\"]Bl[15,\"iroh::discovery::mdns::DiscoveryEvent\"]Ca[5,\"iroh_dns_server::dns\",\"iroh_dns_server::dns\"]Ak[8,\"iroh\",\"iroh_base::key\"]B`[8,\"iroh_base\",\"iroh_base::key\"]Be[8,\"iroh_base::key\",\"iroh_base::key\"]A`[10,\"hashbrown\"]>Ad[5,\"iroh::endpoint\"]Bm[5,\"http::header::name\",\"http::header::name\"]Cc[5,\"iroh_dns_server::http\",\"iroh_dns_server::http\"]0B`[10,\"core::future::into_future\"]Bi[15,\"iroh::endpoint_info::DecodingError\"]Bo[15,\"iroh_relay::endpoint_info::DecodingError\"]Bd[15,\"iroh_relay::client::DialError\"]B`[15,\"iroh::endpoint::BindError\"]Bm[5,\"iroh_metrics::base\",\"iroh_metrics::base\"]B`[15,\"iroh_relay::dns::DnsError\"]Bm[8,\"core::num::nonzero\",\"core::num::nonzero\"]Bb[15,\"iroh::protocol::AcceptError\"]Bk[15,\"iroh::endpoint::AddEndpointAddrError\"]Ae[2,\"iroh::discovery\"]Ao[6,\"url::parser\",\"url::parser\"]Bc[15,\"iroh_relay::dns::LookupError\"]Ao[2,\"iroh_relay::endpoint_info\"]Ae[6,\"iroh::discovery\"]Ck[6,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]A`[10,\"core::cmp\"]Al[2,\"iroh::discovery::pkarr\"]Ce[6,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]Bi[5,\"iroh_relay::quic\",\"iroh_relay::quic\"]Cd[5,\"iroh::net_report\",\"iroh::net_report::reportgen\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]De[6,\"hickory_proto::rr::record_type\",\"hickory_proto::rr::record_type\"]Ad[5,\"iroh::endpoint\"]Ad[6,\"iroh::endpoint\"]Cb[15,\"iroh_relay::protos::relay::RelayToClientMsg\"]22Bh[10,\"serde_core::ser\",\"serde_core::ser\"]Ce[6,\"core::net::socket_addr\",\"core::net::socket_addr\"]Ah[2,\"iroh_relay::server\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Af[10,\"n0_error::error\"]Ba[5,\"http::status\",\"http::status\"]Ak[10,\"clap_builder::derive\"]Cj[10,\"iroh_quinn_proto::config\",\"iroh_quinn_proto::config\"]9Af[2,\"iroh_quinn_proto\"]Ad[2,\"iroh::endpoint\"]1A`[2,\"iroh_quinn\"]f[3,\"\"]00j[2,\"iroh\"]0Ad[2,\"iroh::protocol\"]Be[6,\"iroh::protocol\",\"iroh::protocol\"]Be[5,\"iroh::protocol\",\"iroh::protocol\"]Co[5,\"rustls::server::server_conn\",\"rustls::server::server_conn\"]Am[5,\"iroh_bench\",\"iroh_bench\"]Ad[5,\"iroh::endpoint\"]Bc[5,\"data_encoding\",\"data_encoding\"]Ae[10,\"serde_core::de\"]Bg[6,\"iroh_relay::dns\",\"iroh_relay::dns\"]o[5,\"iroh::dns\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]Bd[15,\"iroh_relay::client::SendError\"]Bk[15,\"iroh::endpoint::AddEndpointAddrError\"]Bo[5,\"http::header::value\",\"http::header::value\"]Bi[15,\"iroh::discovery::pkarr::PkarrError\"]0Cc[5,\"iroh_dns_server::http\",\"iroh_dns_server::http\"]Do[5,\"iroh_quinn_proto::config::transport\",\"iroh_quinn_proto::config::transport\"]Be[15,\"iroh_relay::server::CertConfig\"]Ae[2,\"iroh_relay::dns\"]:B`[15,\"iroh_relay::dns::DnsError\"]Bg[15,\"iroh_relay::client::ConnectError\"]Be[15,\"iroh_relay::server::SpawnError\"]Bk[5,\"iroh_relay\",\"iroh_relay::ping_tracker\"]j[5,\"iroh\"]Bh[5,\"iroh_relay\",\"iroh_relay::relay_map\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]6Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Bd[15,\"iroh_relay::client::RecvError\"]Bd[15,\"iroh_relay::client::SendError\"]Bk[5,\"iroh_bench::stats\",\"iroh_bench::stats\"]B`[15,\"iroh::endpoint::AlpnError\"]Ci[5,\"ring::error::unspecified\",\"ring::error::unspecified\"]A`[2,\"iroh_quinn\"]0Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Ce[5,\"rustls::crypto::signer\",\"rustls::crypto::signer\"]Co[5,\"rustls::client::client_conn\",\"rustls::client::client_conn\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Ad[5,\"iroh::endpoint\"]Ad[2,\"iroh::endpoint\"]Ah[2,\"iroh_relay::client\"]Cm[6,\"iroh_quinn_proto::endpoint\",\"iroh_quinn_proto::endpoint\"]Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]Bm[6,\"iroh_relay::client\",\"iroh_relay::client\"]Ci[5,\"iroh_quinn_proto::shared\",\"iroh_quinn_proto::shared\"]Bf[10,\"serde_core::de\",\"serde_core::de\"]Co[5,\"iroh::discovery::pkarr::dht\",\"iroh::discovery::pkarr::dht\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Ca[5,\"iroh::discovery::dns\",\"iroh::discovery::dns\"]Ci[5,\"iroh_base::endpoint_addr\",\"iroh_base::endpoint_addr\"]j[5,\"iroh\"]Bj[5,\"iroh_base\",\"iroh_base::endpoint_addr\"]Ae[5,\"iroh::discovery\"]Ck[5,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]10Bb[10,\"core::iter::traits::collect\"]Am[10,\"iroh_metrics::iterable\"]D`[10,\"core::iter::traits::collect\",\"core::iter::traits::collect\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Cg[5,\"iroh_quinn_proto::frame\",\"iroh_quinn_proto::frame\"]Bc[15,\"iroh_relay::dns::LookupError\"]Ai[10,\"iroh_metrics::base\"]Bd[15,\"iroh_relay::client::DialError\"]Ad[5,\"iroh::endpoint\"]Ac[5,\"iroh::metrics\"]Cf[5,\"iroh_relay::server\",\"iroh_relay::server::metrics\"]Cg[5,\"hickory_resolver::error\",\"hickory_resolver::error\"]Do[5,\"iroh_quinn_proto::connection::paths\",\"iroh_quinn_proto::connection::paths\"]Co[5,\"rustls::server::server_conn\",\"rustls::server::server_conn\"]5Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Ca[5,\"pkarr::signed_packet\",\"pkarr::signed_packet\"]Ce[5,\"core::net::socket_addr\",\"core::net::socket_addr\"]0Ad[6,\"iroh::endpoint\"]Ae[2,\"iroh::magicsock\"]A`[2,\"iroh_relay\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Ab[10,\"core::clone\"]Bb[15,\"iroh::discovery::ParseError\"]Ai[2,\"iroh::endpoint_info\"]Ao[2,\"iroh_relay::endpoint_info\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Ai[6,\"iroh::endpoint_info\"]Ck[6,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]Bg[5,\"iroh::discovery\",\"iroh::discovery\"]5421Aj[10,\"iroh::endpoint_info\"]Cl[10,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Bh[10,\"iroh::discovery\",\"iroh::discovery\"]Bi[15,\"iroh::endpoint_info::DecodingError\"]Bo[15,\"iroh_relay::endpoint_info::DecodingError\"]Cc[5,\"iroh::discovery::mdns\",\"iroh::discovery::mdns\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]Ce[5,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]Bi[6,\"rustls_pki_types\",\"rustls_pki_types\"]Eo[6,\"iroh_quinn_proto::connection::streams::recv\",\"iroh_quinn_proto::connection::streams::recv\"]Be[5,\"iroh::protocol\",\"iroh::protocol\"]Bj[15,\"iroh_relay::server::SupervisorError\"]Ci[6,\"iroh_base::endpoint_addr\",\"iroh_base::endpoint_addr\"]j[6,\"iroh\"]Bj[6,\"iroh_base\",\"iroh_base::endpoint_addr\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]Ca[15,\"iroh_relay::protos::common::FrameTypeError\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]Ci[5,\"iroh_quinn_proto::coding\",\"iroh_quinn_proto::coding\"]Ca[6,\"iroh::endpoint\",\"iroh::endpoint::connection\"]o[2,\"iroh_base\"]j[2,\"iroh\"]A`[2,\"iroh_relay\"]Ak[2,\"iroh_dns_server::http\"]Bb[15,\"iroh::discovery::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Bi[5,\"rustls_pki_types\",\"rustls_pki_types\"]Ak[10,\"clap_builder::derive\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Dd[6,\"iroh::endpoint\",\"iroh::magicsock::endpoint_map::endpoint_state\"]Bf[6,\"iroh::endpoint\",\"iroh::magicsock\"]Ae[2,\"iroh::discovery\"]Bg[6,\"iroh::discovery\",\"iroh::discovery\"]Ak[2,\"iroh::discovery::mdns\"]Cc[6,\"iroh::discovery::mdns\",\"iroh::discovery::mdns\"]Bm[15,\"iroh::endpoint::GetMappingAddressError\"]D`[5,\"iroh::test_utils\",\"iroh::test_utils::dns_and_pkarr_servers\"]B`[2,\"iroh_relay::protos::common\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Cm[6,\"iroh_relay::protos::common\",\"iroh_relay::protos::common\"]>Am[5,\"n0_watcher\",\"n0_watcher\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Ce[5,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]Ac[5,\"iroh::metrics\"]Ao[6,\"pkarr::keys\",\"pkarr::keys\"]Ad[6,\"iroh::endpoint\"]0Ca[5,\"iroh::net_report\",\"iroh::net_report::report\"]Bn[10,\"hickory_server::server::request_handler\"]Cc[8,\"ed25519_dalek::errors\",\"ed25519_dalek::errors\"]j[5,\"iroh\"]B`[5,\"iroh_base\",\"iroh_base::key\"]Da[6,\"simple_dns::simple_dns_error\",\"simple_dns::simple_dns_error\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]Di[5,\"iroh::discovery::static_provider\",\"iroh::discovery::static_provider\"]Be[15,\"iroh_relay::server::SpawnError\"]Bk[5,\"iroh_bench::stats\",\"iroh_bench::stats\"]Ad[5,\"iroh::endpoint\"]Bc[2,\"iroh::magicsock::endpoint_map\"]Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]44Cg[6,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Ad[2,\"iroh::endpoint\"]Ca[6,\"iroh::endpoint\",\"iroh::endpoint::connection\"]6B`[15,\"iroh::endpoint::AlpnError\"]Bj[15,\"iroh::endpoint::AuthenticationError\"]Bf[15,\"iroh::endpoint::ConnectingError\"]Da[6,\"iroh_quinn_proto::connection\",\"iroh_quinn_proto::connection\"]Ad[6,\"iroh::endpoint\"];Bc[5,\"iroh::metrics\",\"iroh::metrics\"]Bi[15,\"iroh::discovery::pkarr::PkarrError\"]Bg[15,\"iroh_relay::client::ConnectError\"]B`[15,\"iroh_relay::dns::DnsError\"]Bi[15,\"iroh::endpoint_info::EncodingError\"]Bo[15,\"iroh_relay::endpoint_info::EncodingError\"]j[2,\"iroh\"]o[2,\"iroh_base\"]Be[6,\"iroh_base::key\",\"iroh_base::key\"]j[6,\"iroh\"]B`[6,\"iroh_base\",\"iroh_base::key\"]Eo[5,\"hickory_server::authority::message_response\",\"hickory_server::authority::message_response\"]Ai[10,\"iroh_metrics::base\"]Bb[15,\"iroh::discovery::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Bf[10,\"iroh::protocol\",\"iroh::protocol\"]Bd[15,\"iroh_relay::client::DialError\"]Db[6,\"iroh_dns_server::http\",\"iroh_dns_server::http::rate_limiting\"]Bh[5,\"iroh_relay\",\"iroh_relay::relay_map\"]Bo[10,\"hickory_server::server::response_handler\"]Ah[2,\"iroh_relay::server\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Do[5,\"iroh_quinn_proto::config::transport\",\"iroh_quinn_proto::config::transport\"]Ad[5,\"iroh::endpoint\"]Bm[5,\"alloc::collections\",\"alloc::collections\"]Bg[15,\"iroh_relay::protos::relay::Error\"]f[3,\"\"]Ae[2,\"iroh::discovery\"]4Bi[5,\"iroh::test_utils\",\"iroh::test_utils\"]Ao[2,\"iroh_relay::protos::relay\"]Ck[6,\"iroh_relay::protos::relay\",\"iroh_relay::protos::relay\"]Am[6,\"iroh_bench\",\"iroh_bench\"]Bf[15,\"iroh::endpoint::ConnectingError\"]77Ac[5,\"iroh::metrics\"]Ce[5,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]54Bk[15,\"iroh_relay::protos::handshake::Error\"]Ai[10,\"iri_string::format\"]o[10,\"num_enum\"]Bb[15,\"iroh::discovery::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Ca[15,\"iroh_relay::protos::common::FrameTypeError\"]B`[15,\"iroh::endpoint::AlpnError\"]?Dg[5,\"tokio_util::task::abort_on_drop\",\"tokio_util::task::abort_on_drop\"]Bf[10,\"iroh::endpoint\",\"iroh::endpoint\"]Ae[10,\"iroh::endpoint\"]Da[5,\"iroh_quinn_proto::congestion\",\"iroh_quinn_proto::congestion\"]1Bd[15,\"iroh_relay::client::DialError\"]Cg[5,\"iroh_relay::server\",\"iroh_relay::server::resolver\"]Ad[6,\"iroh::endpoint\"]Ad[5,\"iroh::endpoint\"]Am[6,\"iroh_bench\",\"iroh_bench\"]6Bf[10,\"iroh::protocol\",\"iroh::protocol\"]Ae[2,\"iroh::discovery\"]Bg[6,\"iroh::discovery\",\"iroh::discovery\"]Bi[15,\"iroh::endpoint_info::DecodingError\"]Bo[15,\"iroh_relay::endpoint_info::DecodingError\"]Bo[5,\"http::header::value\",\"http::header::value\"]7j[5,\"iroh\"]Bf[5,\"iroh_base\",\"iroh_base::relay_url\"]Bb[10,\"rustls::server::server_conn\"]::Ad[2,\"iroh::endpoint\"]Ca[6,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Bg[5,\"iroh::discovery\",\"iroh::discovery\"]Al[15,\"iroh::KeyParsingError\"]Ba[15,\"iroh_base::KeyParsingError\"]Ca[5,\"iroh::discovery::dns\",\"iroh::discovery::dns\"]Bg[15,\"iroh_relay::client::ConnectError\"]Bf[15,\"iroh::discovery::DiscoveryError\"]Ee[5,\"iroh_quinn_proto::transport_parameters\",\"iroh_quinn_proto::transport_parameters\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]9Bf[6,\"iroh::endpoint\",\"iroh::magicsock\"]:Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]2Bd[15,\"iroh_relay::client::SendError\"]Bi[15,\"iroh::endpoint_info::EncodingError\"]Bo[15,\"iroh_relay::endpoint_info::EncodingError\"]8Cc[5,\"iroh::discovery::mdns\",\"iroh::discovery::mdns\"]Ce[5,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]Ci[5,\"iroh_quinn_proto::varint\",\"iroh_quinn_proto::varint\"]Ad[5,\"iroh::endpoint\"]2Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Ai[5,\"num_enum\",\"num_enum\"]Ci[5,\"iroh_quinn_proto::config\",\"iroh_quinn_proto::config\"]Af[2,\"iroh::test_utils\"]Ad[2,\"iroh::endpoint\"]Af[10,\"core::ops::drop\"]Ad[10,\"core::convert\"]Aa[10,\"core::hash\"]1g[17,\"\"]Ci[5,\"iroh_quinn_proto::crypto\",\"iroh_quinn_proto::crypto\"]Be[5,\"n0_error::meta\",\"n0_error::meta\"]Cc[5,\"reqwest::dns::resolve\",\"reqwest::dns::resolve\"]Dg[5,\"hickory_proto::rr::domain::name\",\"hickory_proto::rr::domain::name\"]Ak[5,\"std::path\",\"std::path\"]Bi[6,\"core::task::poll\",\"core::task::poll\"]Bb[10,\"core::marker\",\"core::marker\"]Bi[6,\"iroh_quinn_proto\",\"iroh_quinn_proto\"]Ac[10,\"futures_sink\"]2Bf[15,\"iroh::discovery::DiscoveryError\"]Bj[15,\"iroh::discovery::IntoDiscoveryError\"]Bb[15,\"iroh::protocol::AcceptError\"]Bb[15,\"iroh::discovery::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Ah[10,\"ppv_lite86::types\"]f[1,\"\"]f[3,\"\"]Ah[2,\"iroh_relay::client\"]A`[2,\"iroh_relay\"]Ae[2,\"iroh_dns_server\"]A`[2,\"iroh_bench\"]4Ae[2,\"iroh::discovery\"]Ad[2,\"iroh::defaults\"]4Bk[2,\"iroh_quinn_proto::connection::streams\"]88Bd[10,\"core::convert\",\"core::convert\"]Ca[8,\"futures_lite::future\",\"futures_lite::future\"]Ca[8,\"futures_lite::stream\",\"futures_lite::stream\"]Ba[5,\"bytes::bytes\",\"bytes::bytes\"]Ad[5,\"iroh::endpoint\"]Ab[10,\"core::clone\"]Cg[6,\"iroh_quinn_proto::frame\",\"iroh_quinn_proto::frame\"]Ao[10,\"iroh_quinn_proto::coding\"]A`[10,\"core::fmt\"]Ag[10,\"core::ops::deref\"]Bk[15,\"iroh::endpoint::AddEndpointAddrError\"]Ak[5,\"core::fmt\",\"core::fmt\"]Ab[10,\"core::error\"]Be[5,\"std::io::error\",\"std::io::error\"]Bc[6,\"rustls::error\",\"rustls::error\"]Ba[8,\"clap_builder\",\"clap_builder\"]Bi[5,\"signature::error\",\"signature::error\"]Af[2,\"iroh_relay::quic\"]Bc[2,\"iroh_relay::protos::handshake\"]Ao[2,\"iroh_relay::protos::relay\"]Ba[5,\"hyper::error\",\"hyper::error\"]Ee[6,\"iroh_quinn_proto::transport_parameters\",\"iroh_quinn_proto::transport_parameters\"]Be[5,\"reqwest::error\",\"reqwest::error\"]Bg[6,\"postcard::error\",\"postcard::error\"]Cg[6,\"tokio_websockets::error\",\"tokio_websockets::error\"]Bi[6,\"iroh_relay::quic\",\"iroh_relay::quic\"]Dc[6,\"iroh_relay::protos::handshake\",\"iroh_relay::protos::handshake\"]Ck[6,\"iroh_relay::protos::relay\",\"iroh_relay::protos::relay\"]Ca[6,\"iroh::net_report\",\"iroh::net_report::probes\"]Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Bb[10,\"core::marker\",\"core::marker\"]Bk[5,\"iroh_bench::stats\",\"iroh_bench::stats\"]1g[17,\"\"]f[1,\"\"]Ah[2,\"iroh_relay::protos\"]Af[2,\"iroh_quinn_proto\"]Ae[2,\"iroh::discovery\"]A`[2,\"iroh_bench\"]34Ae[2,\"iroh_dns_server\"]1Bb[2,\"iroh_quinn_proto::connection\"]166Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Ac[10,\"core::borrow\"]C`[10,\"bytes::buf::buf_mut\",\"bytes::buf::buf_mut\"]Bc[5,\"pkarr::client\",\"pkarr::client\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Ba[5,\"async_compat\",\"async_compat\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Cb[10,\"core::future::future\",\"core::future::future\"]Ca[5,\"iroh_dns_server::dns\",\"iroh_dns_server::dns\"]An[10,\"core::hash\",\"core::hash\"]Cb[15,\"iroh_relay::protos::relay::RelayToClientMsg\"]Bm[6,\"core::net::ip_addr\",\"core::net::ip_addr\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Bh[10,\"reloadable_core\",\"reloadable_core\"]Be[15,\"iroh_relay::server::CertConfig\"]Bj[15,\"iroh::endpoint::AuthenticationError\"]Ad[5,\"iroh::endpoint\"]Ba[6,\"core::option\",\"core::option\"]g[17,\"\"]Do[5,\"iroh_quinn_proto::connection::paths\",\"iroh_quinn_proto::connection::paths\"]E`[10,\"tower_http::follow_redirect::policy\",\"tower_http::follow_redirect::policy\"]Ch[10,\"iroh::endpoint::presets\",\"iroh::endpoint::presets\"]Co[5,\"hickory_proto::rr::resource\",\"hickory_proto::rr::resource\"]Ca[5,\"iroh::net_report\",\"iroh::net_report::report\"]Ak[8,\"core::fmt\",\"core::fmt\"]Ba[6,\"core::result\",\"core::result\"]Be[8,\"std::io::error\",\"std::io::error\"]Ai[8,\"n0_error\",\"n0_error\"]Be[5,\"iroh::protocol\",\"iroh::protocol\"]Cg[5,\"iroh_dns_server::server\",\"iroh_dns_server::server\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Ad[2,\"iroh::endpoint\"]Cd[6,\"iroh::endpoint\",\"iroh::magicsock::endpoint_map\"]Ak[10,\"futures_core::stream\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Bc[5,\"alloc::string\",\"alloc::string\"]Ak[5,\"core::any\",\"core::any\"]Ci[5,\"iroh_quinn_proto::varint\",\"iroh_quinn_proto::varint\"]Ad[5,\"iroh::endpoint\"]Bi[15,\"iroh::discovery::pkarr::PkarrError\"]A`[2,\"iroh_relay\"]Ah[2,\"iroh_relay::protos\"]Af[2,\"iroh_quinn_proto\"]Ae[2,\"iroh_dns_server\"]1Af[2,\"iroh::net_report\"]40412Ae[10,\"iroh::endpoint\"]Bg[8,\"iroh_relay::dns\",\"iroh_relay::dns\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Co[5,\"iroh::discovery::pkarr::dht\",\"iroh::discovery::pkarr::dht\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]De[5,\"clap_builder::builder::command\",\"clap_builder::builder::command\"]Bc[15,\"iroh::endpoint::ConnectError\"]An[15,\"iroh_relay::quic::Error\"]Bi[5,\"core::task::wake\",\"core::task::wake\"]Cc[5,\"iroh_metrics::metrics\",\"iroh_metrics::metrics\"]Ad[10,\"core::default\"]A`[10,\"core::fmt\"]Bm[5,\"tokio::time::error\",\"tokio::time::error\"]Bl[15,\"iroh::discovery::mdns::DiscoveryEvent\"]Bc[10,\"axum_core::extract::from_ref\"]Ah[10,\"core::str::traits\"]Co[5,\"std::collections::hash::map\",\"std::collections::hash::map\"]Ak[5,\"std::time\",\"std::time\"]Bj[15,\"iroh_relay::server::SupervisorError\"]Cb[5,\"iroh::net_report\",\"iroh::net_report::metrics\"]Ci[5,\"iroh_dns_server::metrics\",\"iroh_dns_server::metrics\"]Cf[5,\"iroh_relay::server\",\"iroh_relay::server::metrics\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Ad[5,\"iroh::endpoint\"]Cg[5,\"iroh::net_report\",\"iroh::net_report::options::imp\"]Ak[5,\"std::path\",\"std::path\"]Bk[5,\"dyn_clone::sealed\",\"dyn_clone::sealed\"]Bo[5,\"tokio::io::read_buf\",\"tokio::io::read_buf\"]Eg[5,\"hickory_server::server::request_handler\",\"hickory_server::server::request_handler\"]B`[15,\"iroh_relay::dns::DnsError\"]Al[10,\"reqwest::dns::resolve\"]Cg[5,\"tokio::runtime::runtime\",\"tokio::runtime::runtime\"]Cj[10,\"iroh_quinn_proto::crypto\",\"iroh_quinn_proto::crypto\"]Bd[15,\"iroh_relay::client::DialError\"]4Ad[10,\"alloc::borrow\"]Ad[10,\"core::convert\"]0Bg[15,\"iroh_relay::client::ConnectError\"]k[10,\"iroh\"]>j[2,\"iroh\"]Af[2,\"iroh::net_report\"]Ah[2,\"iroh_relay::server\"]Ae[2,\"iroh_dns_server\"]f[1,\"\"]Ad[2,\"iroh::endpoint\"]Ad[2,\"iroh::defaults\"]Bb[2,\"iroh_quinn_proto::connection\"]5Ad[5,\"iroh::endpoint\"]Bc[5,\"n0_error::any\",\"n0_error::any\"]Ce[5,\"iroh_dns_server::state\",\"iroh_dns_server::state\"]De[5,\"alloc::collections::btree::set\",\"alloc::collections::btree::set\"]Ch[6,\"iroh_dns_server::http\",\"iroh_dns_server::http::tls\"]Am[6,\"iroh_bench\",\"iroh_bench\"]Ag[10,\"core::ops::deref\"]Bm[15,\"iroh::endpoint::GetMappingAddressError\"]Ae[2,\"iroh_relay::dns\"]Bg[6,\"iroh_relay::dns\",\"iroh_relay::dns\"]Am[5,\"core::time\",\"core::time\"]A`[10,\"dyn_clone\"]Bi[15,\"iroh::discovery::pkarr::PkarrError\"]Ca[5,\"iroh_quinn::endpoint\",\"iroh_quinn::endpoint\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Bg[6,\"n0_error::error\",\"n0_error::error\"]3Ca[5,\"iroh_quinn::incoming\",\"iroh_quinn::incoming\"]Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Bm[5,\"core::net::ip_addr\",\"core::net::ip_addr\"]0Ck[6,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]Am[10,\"iroh_metrics::iterable\"]Db[10,\"core::iter::traits::iterator\",\"core::iter::traits::iterator\"]Am[15,\"iroh::endpoint::Source\"]An[10,\"n0_watcher\",\"n0_watcher\"]Ak[6,\"core::cmp\",\"core::cmp\"]Dd[5,\"iroh::endpoint\",\"iroh::magicsock::endpoint_map::endpoint_state\"]Bd[15,\"iroh_relay::client::RecvError\"]j[5,\"iroh\"]Bh[5,\"iroh_relay\",\"iroh_relay::relay_map\"]Ca[5,\"iroh_base::relay_url\",\"iroh_base::relay_url\"]2Bf[5,\"iroh_base\",\"iroh_base::relay_url\"]Bj[15,\"iroh::endpoint::AuthenticationError\"]Bh[10,\"iroh_relay::dns\",\"iroh_relay::dns\"]Ad[5,\"iroh::endpoint\"]Ad[10,\"alloc::string\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Ck[5,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]3Ae[5,\"iroh::discovery\"]1o[6,\"z32\",\"z32\"]j[2,\"iroh\"]A`[2,\"iroh_relay\"]1A`[2,\"iroh_quinn\"]2Ah[2,\"iroh_relay::server\"]B`[2,\"iroh::net_report::defaults\"]:Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Ci[5,\"tokio_rustls_acme::state\",\"tokio_rustls_acme::state\"]Ad[2,\"iroh::endpoint\"]Ca[6,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Al[10,\"tokio::io::async_read\"]2Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]Ac[10,\"core::borrow\"]Ac[10,\"async_compat\"]Al[10,\"rand_core\",\"rand_core\"]Cb[15,\"iroh_relay::protos::relay::ClientToRelayMsg\"]Cb[15,\"iroh_relay::protos::relay::RelayToClientMsg\"]Ck[5,\"iroh_relay::protos::relay\",\"iroh_relay::protos::relay\"]Ah[2,\"iroh_relay::client\"]Bm[6,\"iroh_relay::client\",\"iroh_relay::client\"]Am[15,\"iroh::endpoint::Source\"]B`[15,\"iroh::endpoint::BindError\"]Bh[10,\"iroh::discovery\",\"iroh::discovery\"]Ca[5,\"iroh_dns_server::dns\",\"iroh_dns_server::dns\"]0Ak[5,\"core::fmt\",\"core::fmt\"]Cm[6,\"iroh_relay::protos::common\",\"iroh_relay::protos::common\"]Bg[15,\"iroh_relay::client::ConnectError\"]Cc[5,\"iroh_metrics::metrics\",\"iroh_metrics::metrics\"]Ba[5,\"hdrhistogram\",\"hdrhistogram\"]Co[5,\"tokio::runtime::task::error\",\"tokio::runtime::task::error\"]Bj[15,\"iroh_relay::server::SupervisorError\"]Be[15,\"iroh_relay::server::SpawnError\"]Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]Bm[15,\"iroh::endpoint::GetMappingAddressError\"]Bf[15,\"iroh::discovery::DiscoveryError\"]Bb[15,\"iroh::discovery::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]A`[10,\"core::cmp\"]Ad[5,\"iroh::endpoint\"]Dd[8,\"iroh::endpoint\",\"iroh::magicsock::endpoint_map::endpoint_state\"]An[10,\"crossbeam_epoch::atomic\"]Bj[10,\"tower_http::follow_redirect::policy\"]Bi[15,\"iroh::discovery::pkarr::PkarrError\"]j[5,\"iroh\"]B`[5,\"iroh_base\",\"iroh_base::key\"]=Ad[6,\"iroh::endpoint\"]Ck[5,\"hickory_proto::rr::rr_set\",\"hickory_proto::rr::rr_set\"]Ck[5,\"tokio::sync::watch::error\",\"tokio::sync::watch::error\"]Ah[2,\"iroh_relay::client\"]Cc[6,\"iroh_relay::client\",\"iroh_relay::client::conn\"]Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]Cc[8,\"reqwest::dns::resolve\",\"reqwest::dns::resolve\"]Be[5,\"iroh_base::key\",\"iroh_base::key\"]9843Af[10,\"serde_core::ser\"]:9Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Ak[10,\"futures_core::future\"]Ak[10,\"futures_core::stream\"]Bi[5,\"core::str::error\",\"core::str::error\"]An[15,\"iroh_relay::quic::Error\"]Bg[15,\"iroh_relay::client::ConnectError\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]Bn[5,\"iroh_dns_server\",\"iroh_dns_server::store\"]Bb[2,\"iroh_quinn_proto::connection\"]j[2,\"iroh\"]Ah[2,\"iroh_relay::protos\"]f[3,\"\"]2f[1,\"\"]A`[2,\"iroh_relay\"]o[2,\"iroh_base\"]Af[2,\"iroh::net_report\"]An[2,\"iroh_quinn_proto::config\"]Em[5,\"clap_builder::parser::matches::arg_matches\",\"clap_builder::parser::matches::arg_matches\"]Am[10,\"tokio::io::async_write\"]Ah[2,\"iroh_relay::server\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Aa[10,\"equivalent\"]Bc[15,\"iroh::endpoint::ConnectError\"]Bb[15,\"iroh::protocol::AcceptError\"]Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Cm[5,\"iroh::endpoint::connection\",\"iroh::endpoint::connection\"]32An[15,\"iroh_relay::quic::Error\"]Ce[5,\"iroh_quinn::connection\",\"iroh_quinn::connection\"]3Ae[10,\"iroh::endpoint\"]Bf[5,\"iroh::endpoint\",\"iroh::magicsock\"]Bl[15,\"iroh::discovery::mdns::DiscoveryEvent\"]Ca[5,\"iroh_dns_server::dns\",\"iroh_dns_server::dns\"]Ak[8,\"iroh\",\"iroh_base::key\"]B`[8,\"iroh_base\",\"iroh_base::key\"]Be[8,\"iroh_base::key\",\"iroh_base::key\"]A`[10,\"hashbrown\"]>Ad[5,\"iroh::endpoint\"]Bm[5,\"http::header::name\",\"http::header::name\"]Cc[5,\"iroh_dns_server::http\",\"iroh_dns_server::http\"]0B`[10,\"core::future::into_future\"]Bi[15,\"iroh::endpoint_info::DecodingError\"]Bo[15,\"iroh_relay::endpoint_info::DecodingError\"]Bd[15,\"iroh_relay::client::DialError\"]B`[15,\"iroh::endpoint::BindError\"]Bm[5,\"iroh_metrics::base\",\"iroh_metrics::base\"]B`[15,\"iroh_relay::dns::DnsError\"]Bm[8,\"core::num::nonzero\",\"core::num::nonzero\"]Bb[15,\"iroh::protocol::AcceptError\"]Bk[15,\"iroh::endpoint::AddEndpointAddrError\"]Ae[2,\"iroh::discovery\"]Ao[6,\"url::parser\",\"url::parser\"]Bc[15,\"iroh_relay::dns::LookupError\"]Ao[2,\"iroh_relay::endpoint_info\"]Ae[6,\"iroh::discovery\"]Ck[6,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]A`[10,\"core::cmp\"]Al[2,\"iroh::discovery::pkarr\"]Ce[6,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]Bi[5,\"iroh_relay::quic\",\"iroh_relay::quic\"]Cd[5,\"iroh::net_report\",\"iroh::net_report::reportgen\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]De[6,\"hickory_proto::rr::record_type\",\"hickory_proto::rr::record_type\"]Ad[5,\"iroh::endpoint\"]Ad[6,\"iroh::endpoint\"]Cb[15,\"iroh_relay::protos::relay::RelayToClientMsg\"]22Bh[10,\"serde_core::ser\",\"serde_core::ser\"]Ce[6,\"core::net::socket_addr\",\"core::net::socket_addr\"]Ah[2,\"iroh_relay::server\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Af[10,\"n0_error::error\"]Ba[5,\"http::status\",\"http::status\"]Ak[10,\"clap_builder::derive\"]Cj[10,\"iroh_quinn_proto::config\",\"iroh_quinn_proto::config\"]9Af[2,\"iroh_quinn_proto\"]Ad[2,\"iroh::endpoint\"]1A`[2,\"iroh_quinn\"]f[3,\"\"]00j[2,\"iroh\"]0Ad[2,\"iroh::protocol\"]Be[6,\"iroh::protocol\",\"iroh::protocol\"]Be[5,\"iroh::protocol\",\"iroh::protocol\"]Co[5,\"rustls::server::server_conn\",\"rustls::server::server_conn\"]Am[5,\"iroh_bench\",\"iroh_bench\"]Ad[5,\"iroh::endpoint\"]Bc[5,\"data_encoding\",\"data_encoding\"]Ae[10,\"serde_core::de\"]Bg[6,\"iroh_relay::dns\",\"iroh_relay::dns\"]o[5,\"iroh::dns\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]Bd[15,\"iroh_relay::client::SendError\"]Bk[15,\"iroh::endpoint::AddEndpointAddrError\"]Bo[5,\"http::header::value\",\"http::header::value\"]Bi[15,\"iroh::discovery::pkarr::PkarrError\"]0Cc[5,\"iroh_dns_server::http\",\"iroh_dns_server::http\"]Do[5,\"iroh_quinn_proto::config::transport\",\"iroh_quinn_proto::config::transport\"]Be[15,\"iroh_relay::server::CertConfig\"]Ae[2,\"iroh_relay::dns\"]:B`[15,\"iroh_relay::dns::DnsError\"]Bg[15,\"iroh_relay::client::ConnectError\"]Be[15,\"iroh_relay::server::SpawnError\"]Bk[5,\"iroh_relay\",\"iroh_relay::ping_tracker\"]j[5,\"iroh\"]Bh[5,\"iroh_relay\",\"iroh_relay::relay_map\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]6Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Bd[15,\"iroh_relay::client::RecvError\"]Bd[15,\"iroh_relay::client::SendError\"]Bk[5,\"iroh_bench::stats\",\"iroh_bench::stats\"]B`[15,\"iroh::endpoint::AlpnError\"]Ci[5,\"ring::error::unspecified\",\"ring::error::unspecified\"]A`[2,\"iroh_quinn\"]0Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Ce[5,\"rustls::crypto::signer\",\"rustls::crypto::signer\"]Co[5,\"rustls::client::client_conn\",\"rustls::client::client_conn\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Ad[5,\"iroh::endpoint\"]Ad[2,\"iroh::endpoint\"]Ah[2,\"iroh_relay::client\"]Cm[6,\"iroh_quinn_proto::endpoint\",\"iroh_quinn_proto::endpoint\"]Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]Bm[6,\"iroh_relay::client\",\"iroh_relay::client\"]Ci[5,\"iroh_quinn_proto::shared\",\"iroh_quinn_proto::shared\"]Bf[10,\"serde_core::de\",\"serde_core::de\"]Co[5,\"iroh::discovery::pkarr::dht\",\"iroh::discovery::pkarr::dht\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Ca[5,\"iroh::discovery::dns\",\"iroh::discovery::dns\"]Ci[5,\"iroh_base::endpoint_addr\",\"iroh_base::endpoint_addr\"]j[5,\"iroh\"]Bj[5,\"iroh_base\",\"iroh_base::endpoint_addr\"]Ae[5,\"iroh::discovery\"]Ck[5,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]10Bb[10,\"core::iter::traits::collect\"]Am[10,\"iroh_metrics::iterable\"]D`[10,\"core::iter::traits::collect\",\"core::iter::traits::collect\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Cg[5,\"iroh_quinn_proto::frame\",\"iroh_quinn_proto::frame\"]Bc[15,\"iroh_relay::dns::LookupError\"]Ai[10,\"iroh_metrics::base\"]Bd[15,\"iroh_relay::client::DialError\"]Ad[5,\"iroh::endpoint\"]Ac[5,\"iroh::metrics\"]Cf[5,\"iroh_relay::server\",\"iroh_relay::server::metrics\"]Cg[5,\"hickory_resolver::error\",\"hickory_resolver::error\"]Do[5,\"iroh_quinn_proto::connection::paths\",\"iroh_quinn_proto::connection::paths\"]Co[5,\"rustls::server::server_conn\",\"rustls::server::server_conn\"]5Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Ca[5,\"pkarr::signed_packet\",\"pkarr::signed_packet\"]Ce[5,\"core::net::socket_addr\",\"core::net::socket_addr\"]0Ad[6,\"iroh::endpoint\"]Ae[2,\"iroh::magicsock\"]A`[2,\"iroh_relay\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Ab[10,\"core::clone\"]Bb[15,\"iroh::discovery::ParseError\"]Ai[2,\"iroh::endpoint_info\"]Ao[2,\"iroh_relay::endpoint_info\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Ai[6,\"iroh::endpoint_info\"]Ck[6,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]Bg[5,\"iroh::discovery\",\"iroh::discovery\"]5421Aj[10,\"iroh::endpoint_info\"]Cl[10,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Bh[10,\"iroh::discovery\",\"iroh::discovery\"]Bi[15,\"iroh::endpoint_info::DecodingError\"]Bo[15,\"iroh_relay::endpoint_info::DecodingError\"]Cc[5,\"iroh::discovery::mdns\",\"iroh::discovery::mdns\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]Ce[5,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]Bi[6,\"rustls_pki_types\",\"rustls_pki_types\"]Eo[6,\"iroh_quinn_proto::connection::streams::recv\",\"iroh_quinn_proto::connection::streams::recv\"]Be[5,\"iroh::protocol\",\"iroh::protocol\"]Bj[15,\"iroh_relay::server::SupervisorError\"]Ci[6,\"iroh_base::endpoint_addr\",\"iroh_base::endpoint_addr\"]j[6,\"iroh\"]Bj[6,\"iroh_base\",\"iroh_base::endpoint_addr\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]Ca[15,\"iroh_relay::protos::common::FrameTypeError\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]Ci[5,\"iroh_quinn_proto::coding\",\"iroh_quinn_proto::coding\"]Ca[6,\"iroh::endpoint\",\"iroh::endpoint::connection\"]o[2,\"iroh_base\"]j[2,\"iroh\"]A`[2,\"iroh_relay\"]Ak[2,\"iroh_dns_server::http\"]Bb[15,\"iroh::discovery::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Bi[5,\"rustls_pki_types\",\"rustls_pki_types\"]Ak[10,\"clap_builder::derive\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Dd[6,\"iroh::endpoint\",\"iroh::magicsock::endpoint_map::endpoint_state\"]Bf[6,\"iroh::endpoint\",\"iroh::magicsock\"]Ae[2,\"iroh::discovery\"]Bg[6,\"iroh::discovery\",\"iroh::discovery\"]Ak[2,\"iroh::discovery::mdns\"]Cc[6,\"iroh::discovery::mdns\",\"iroh::discovery::mdns\"]Bm[15,\"iroh::endpoint::GetMappingAddressError\"]D`[5,\"iroh::test_utils\",\"iroh::test_utils::dns_and_pkarr_servers\"]B`[2,\"iroh_relay::protos::common\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Cm[6,\"iroh_relay::protos::common\",\"iroh_relay::protos::common\"]>Am[5,\"n0_watcher\",\"n0_watcher\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Ce[5,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]Ac[5,\"iroh::metrics\"]Ao[6,\"pkarr::keys\",\"pkarr::keys\"]Ad[6,\"iroh::endpoint\"]0Ca[5,\"iroh::net_report\",\"iroh::net_report::report\"]Bn[10,\"hickory_server::server::request_handler\"]Cc[8,\"ed25519_dalek::errors\",\"ed25519_dalek::errors\"]j[5,\"iroh\"]B`[5,\"iroh_base\",\"iroh_base::key\"]Da[6,\"simple_dns::simple_dns_error\",\"simple_dns::simple_dns_error\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]Di[5,\"iroh::discovery::static_provider\",\"iroh::discovery::static_provider\"]Be[15,\"iroh_relay::server::SpawnError\"]Bk[5,\"iroh_bench::stats\",\"iroh_bench::stats\"]Ad[5,\"iroh::endpoint\"]Bc[2,\"iroh::magicsock::endpoint_map\"]Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]44Cg[6,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Ad[2,\"iroh::endpoint\"]Ca[6,\"iroh::endpoint\",\"iroh::endpoint::connection\"]6B`[15,\"iroh::endpoint::AlpnError\"]Bj[15,\"iroh::endpoint::AuthenticationError\"]Bf[15,\"iroh::endpoint::ConnectingError\"]Da[6,\"iroh_quinn_proto::connection\",\"iroh_quinn_proto::connection\"]Ad[6,\"iroh::endpoint\"];Bc[5,\"iroh::metrics\",\"iroh::metrics\"]Bi[15,\"iroh::discovery::pkarr::PkarrError\"]Bg[15,\"iroh_relay::client::ConnectError\"]B`[15,\"iroh_relay::dns::DnsError\"]Bi[15,\"iroh::endpoint_info::EncodingError\"]Bo[15,\"iroh_relay::endpoint_info::EncodingError\"]j[2,\"iroh\"]o[2,\"iroh_base\"]Be[6,\"iroh_base::key\",\"iroh_base::key\"]j[6,\"iroh\"]B`[6,\"iroh_base\",\"iroh_base::key\"]Eo[5,\"hickory_server::authority::message_response\",\"hickory_server::authority::message_response\"]Ai[10,\"iroh_metrics::base\"]Bb[15,\"iroh::discovery::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Bf[10,\"iroh::protocol\",\"iroh::protocol\"]Bd[15,\"iroh_relay::client::DialError\"]Db[6,\"iroh_dns_server::http\",\"iroh_dns_server::http::rate_limiting\"]Bh[5,\"iroh_relay\",\"iroh_relay::relay_map\"]Bo[10,\"hickory_server::server::response_handler\"]Ah[2,\"iroh_relay::server\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Do[5,\"iroh_quinn_proto::config::transport\",\"iroh_quinn_proto::config::transport\"]Ad[5,\"iroh::endpoint\"]Bm[5,\"alloc::collections\",\"alloc::collections\"]Bg[15,\"iroh_relay::protos::relay::Error\"]f[3,\"\"]Ae[2,\"iroh::discovery\"]4Bi[5,\"iroh::test_utils\",\"iroh::test_utils\"]Ao[2,\"iroh_relay::protos::relay\"]Ck[6,\"iroh_relay::protos::relay\",\"iroh_relay::protos::relay\"]Am[6,\"iroh_bench\",\"iroh_bench\"]Bf[15,\"iroh::endpoint::ConnectingError\"]77Ac[5,\"iroh::metrics\"]Ce[5,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]54Bk[15,\"iroh_relay::protos::handshake::Error\"]Ai[10,\"iri_string::format\"]o[10,\"num_enum\"]Bb[15,\"iroh::discovery::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Ca[15,\"iroh_relay::protos::common::FrameTypeError\"]B`[15,\"iroh::endpoint::AlpnError\"]?Dg[5,\"tokio_util::task::abort_on_drop\",\"tokio_util::task::abort_on_drop\"]Bf[10,\"iroh::endpoint\",\"iroh::endpoint\"]Ae[10,\"iroh::endpoint\"]Da[5,\"iroh_quinn_proto::congestion\",\"iroh_quinn_proto::congestion\"]1Bd[15,\"iroh_relay::client::DialError\"]Cg[5,\"iroh_relay::server\",\"iroh_relay::server::resolver\"]Ad[6,\"iroh::endpoint\"]Ad[5,\"iroh::endpoint\"]Am[6,\"iroh_bench\",\"iroh_bench\"]6Bf[10,\"iroh::protocol\",\"iroh::protocol\"]Ae[2,\"iroh::discovery\"]Bg[6,\"iroh::discovery\",\"iroh::discovery\"]Bi[15,\"iroh::endpoint_info::DecodingError\"]Bo[15,\"iroh_relay::endpoint_info::DecodingError\"]Bo[5,\"http::header::value\",\"http::header::value\"]7j[5,\"iroh\"]Bf[5,\"iroh_base\",\"iroh_base::relay_url\"]Bb[10,\"rustls::server::server_conn\"]::Ad[2,\"iroh::endpoint\"]Ca[6,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Bg[5,\"iroh::discovery\",\"iroh::discovery\"]Al[15,\"iroh::KeyParsingError\"]Ba[15,\"iroh_base::KeyParsingError\"]Ca[5,\"iroh::discovery::dns\",\"iroh::discovery::dns\"]Bg[15,\"iroh_relay::client::ConnectError\"]Bf[15,\"iroh::discovery::DiscoveryError\"]Ee[5,\"iroh_quinn_proto::transport_parameters\",\"iroh_quinn_proto::transport_parameters\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]9Bf[6,\"iroh::endpoint\",\"iroh::magicsock\"]:Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]2Bd[15,\"iroh_relay::client::SendError\"]Bi[15,\"iroh::endpoint_info::EncodingError\"]Bo[15,\"iroh_relay::endpoint_info::EncodingError\"]8Cc[5,\"iroh::discovery::mdns\",\"iroh::discovery::mdns\"]Ce[5,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]Ci[5,\"iroh_quinn_proto::varint\",\"iroh_quinn_proto::varint\"]Ad[5,\"iroh::endpoint\"]2Ca[5,\"iroh::endpoint\",\"iroh::endpoint::connection\"]Ai[5,\"num_enum\",\"num_enum\"]Ci[5,\"iroh_quinn_proto::config\",\"iroh_quinn_proto::config\"]Af[2,\"iroh::test_utils\"]Ad[2,\"iroh::endpoint\"]1464// https://github.com/n0-computer/iroh/issues/1183 1465#[cfg(test)] 1466mod tests { -1467 use std::{ -1468 sync::Arc, -1469 time::{Duration, Instant}, -1470 }; -1471 -1472 use iroh_base::{EndpointAddr, EndpointId, SecretKey, TransportAddr}; -1473 use n0_error::{AnyError as Error, Result, StdResultExt}; -1474 use n0_future::{BufferedStreamExt, StreamExt, stream, task::AbortOnDropHandle, time}; -1475 use n0_watcher::Watcher; -1476 use quinn::ConnectionError; -1477 use rand::SeedableRng; -1478 use tokio::{ -1479 sync::{ -1480 mpsc::{UnboundedReceiver, UnboundedSender}, -1481 oneshot, -1482 }, -1483 task::JoinSet, -1484 }; -1485 use tracing::{Instrument, error_span, info, info_span, instrument}; -1486 use tracing_test::traced_test; +1467 use std::time::{Duration, Instant}; +1468 +1469 use iroh_base::{EndpointAddr, EndpointId, SecretKey, TransportAddr}; +1470 use n0_error::{AnyError as Error, Result, StdResultExt}; +1471 use n0_future::{BufferedStreamExt, StreamExt, stream, task::AbortOnDropHandle, time}; +1472 use n0_watcher::Watcher; +1473 use quinn::ConnectionError; +1474 use rand::SeedableRng; +1475 use tokio::sync::oneshot; +1476 use tracing::{Instrument, error_span, info, info_span, instrument}; +1477 use tracing_test::traced_test; +1478 +1479 use super::Endpoint; +1480 use crate::{ +1481 RelayMap, RelayMode, +1482 discovery::static_provider::StaticProvider, +1483 endpoint::{ConnectOptions, Connection, ConnectionType}, +1484 protocol::{AcceptError, ProtocolHandler, Router}, +1485 test_utils::{run_relay_server, run_relay_server_with}, +1486 }; 1487 -1488 use super::Endpoint; -1489 use crate::{ -1490 RelayMap, RelayMode, -1491 discovery::static_provider::StaticProvider, -1492 endpoint::{ConnectOptions, Connection, ConnectionInfo, ConnectionMonitor, ConnectionType}, -1493 protocol::{AcceptError, ProtocolHandler, Router}, -1494 test_utils::{run_relay_server, run_relay_server_with}, -1495 }; -1496 -1497 const TEST_ALPN: &[u8] = b"n0/iroh/test"; -1498 -1499 #[tokio::test] -1500 #[traced_test] -1501 async fn test_connect_self() -> Result { -1502 let ep = Endpoint::empty_builder(RelayMode::Disabled) -1503 .alpns(vec![TEST_ALPN.to_vec()]) -1504 .bind() -1505 .await -1506 .unwrap(); -1507 let my_addr = ep.addr(); -1508 let res = ep.connect(my_addr.clone(), TEST_ALPN).await; -1509 assert!(res.is_err()); -1510 let err = res.err().unwrap(); -1511 assert!(err.to_string().starts_with("Connecting to ourself")); -1512 -1513 Ok(()) -1514 } -1515 -1516 #[tokio::test] -1517 #[traced_test] -1518 async fn endpoint_connect_close() -> Result { -1519 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0u64); -1520 let (relay_map, relay_url, _guard) = run_relay_server().await?; -1521 let server_secret_key = SecretKey::generate(&mut rng); -1522 let server_peer_id = server_secret_key.public(); -1523 -1524 // Wait for the endpoint to be started to make sure it's up before clients try to connect -1525 let ep = Endpoint::empty_builder(RelayMode::Custom(relay_map.clone())) -1526 .secret_key(server_secret_key) -1527 .alpns(vec![TEST_ALPN.to_vec()]) -1528 .insecure_skip_relay_cert_verify(true) -1529 .bind() -1530 .await?; -1531 // Wait for the endpoint to be reachable via relay -1532 ep.online().await; -1533 -1534 let server = tokio::spawn( -1535 async move { -1536 info!("accepting connection"); -1537 let incoming = ep.accept().await.anyerr()?; -1538 let conn = incoming.await.anyerr()?; -1539 let mut stream = conn.accept_uni().await.anyerr()?; -1540 let mut buf = [0u8; 5]; -1541 stream.read_exact(&mut buf).await.anyerr()?; -1542 info!("Accepted 1 stream, received {buf:?}. Closing now."); -1543 // close the connection -1544 conn.close(7u8.into(), b"bye"); -1545 -1546 let res = conn.accept_uni().await; -1547 assert_eq!(res.unwrap_err(), quinn::ConnectionError::LocallyClosed); -1548 -1549 let res = stream.read_to_end(10).await; -1550 assert_eq!( -1551 res.unwrap_err(), -1552 quinn::ReadToEndError::Read(quinn::ReadError::ConnectionLost( -1553 quinn::ConnectionError::LocallyClosed -1554 )) -1555 ); -1556 info!("server test completed"); -1557 Ok::<_, Error>(()) -1558 } -1559 .instrument(info_span!("test-server")), -1560 ); -1561 -1562 let client = tokio::spawn( -1563 async move { -1564 let ep = Endpoint::empty_builder(RelayMode::Custom(relay_map)) -1565 .alpns(vec![TEST_ALPN.to_vec()]) -1566 .insecure_skip_relay_cert_verify(true) -1567 .bind() -1568 .await?; -1569 info!("client connecting"); -1570 let endpoint_addr = EndpointAddr::new(server_peer_id).with_relay_url(relay_url); -1571 let conn = ep.connect(endpoint_addr, TEST_ALPN).await?; -1572 let mut stream = conn.open_uni().await.anyerr()?; -1573 -1574 // First write is accepted by server. We need this bit of synchronisation -1575 // because if the server closes after simply accepting the connection we can -1576 // not be sure our .open_uni() call would succeed as it may already receive -1577 // the error. -1578 stream.write_all(b"hello").await.anyerr()?; -1579 -1580 info!("waiting for closed"); -1581 // Remote now closes the connection, we should see an error sometime soon. -1582 let err = conn.closed().await; -1583 let expected_err = -1584 quinn::ConnectionError::ApplicationClosed(quinn::ApplicationClose { -1585 error_code: 7u8.into(), -1586 reason: b"bye".to_vec().into(), -1587 }); -1588 assert_eq!(err, expected_err); +1488 const TEST_ALPN: &[u8] = b"n0/iroh/test"; +1489 +1490 #[tokio::test] +1491 #[traced_test] +1492 async fn test_connect_self() -> Result { +1493 let ep = Endpoint::empty_builder(RelayMode::Disabled) +1494 .alpns(vec![TEST_ALPN.to_vec()]) +1495 .bind() +1496 .await +1497 .unwrap(); +1498 let my_addr = ep.addr(); +1499 let res = ep.connect(my_addr.clone(), TEST_ALPN).await; +1500 assert!(res.is_err()); +1501 let err = res.err().unwrap(); +1502 assert!(err.to_string().starts_with("Connecting to ourself")); +1503 +1504 Ok(()) +1505 } +1506 +1507 #[tokio::test] +1508 #[traced_test] +1509 async fn endpoint_connect_close() -> Result { +1510 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0u64); +1511 let (relay_map, relay_url, _guard) = run_relay_server().await?; +1512 let server_secret_key = SecretKey::generate(&mut rng); +1513 let server_peer_id = server_secret_key.public(); +1514 +1515 // Wait for the endpoint to be started to make sure it's up before clients try to connect +1516 let ep = Endpoint::empty_builder(RelayMode::Custom(relay_map.clone())) +1517 .secret_key(server_secret_key) +1518 .alpns(vec![TEST_ALPN.to_vec()]) +1519 .insecure_skip_relay_cert_verify(true) +1520 .bind() +1521 .await?; +1522 // Wait for the endpoint to be reachable via relay +1523 ep.online().await; +1524 +1525 let server = tokio::spawn( +1526 async move { +1527 info!("accepting connection"); +1528 let incoming = ep.accept().await.anyerr()?; +1529 let conn = incoming.await.anyerr()?; +1530 let mut stream = conn.accept_uni().await.anyerr()?; +1531 let mut buf = [0u8; 5]; +1532 stream.read_exact(&mut buf).await.anyerr()?; +1533 info!("Accepted 1 stream, received {buf:?}. Closing now."); +1534 // close the connection +1535 conn.close(7u8.into(), b"bye"); +1536 +1537 let res = conn.accept_uni().await; +1538 assert_eq!(res.unwrap_err(), quinn::ConnectionError::LocallyClosed); +1539 +1540 let res = stream.read_to_end(10).await; +1541 assert_eq!( +1542 res.unwrap_err(), +1543 quinn::ReadToEndError::Read(quinn::ReadError::ConnectionLost( +1544 quinn::ConnectionError::LocallyClosed +1545 )) +1546 ); +1547 info!("server test completed"); +1548 Ok::<_, Error>(()) +1549 } +1550 .instrument(info_span!("test-server")), +1551 ); +1552 +1553 let client = tokio::spawn( +1554 async move { +1555 let ep = Endpoint::empty_builder(RelayMode::Custom(relay_map)) +1556 .alpns(vec![TEST_ALPN.to_vec()]) +1557 .insecure_skip_relay_cert_verify(true) +1558 .bind() +1559 .await?; +1560 info!("client connecting"); +1561 let endpoint_addr = EndpointAddr::new(server_peer_id).with_relay_url(relay_url); +1562 let conn = ep.connect(endpoint_addr, TEST_ALPN).await?; +1563 let mut stream = conn.open_uni().await.anyerr()?; +1564 +1565 // First write is accepted by server. We need this bit of synchronisation +1566 // because if the server closes after simply accepting the connection we can +1567 // not be sure our .open_uni() call would succeed as it may already receive +1568 // the error. +1569 stream.write_all(b"hello").await.anyerr()?; +1570 +1571 info!("waiting for closed"); +1572 // Remote now closes the connection, we should see an error sometime soon. +1573 let err = conn.closed().await; +1574 let expected_err = +1575 quinn::ConnectionError::ApplicationClosed(quinn::ApplicationClose { +1576 error_code: 7u8.into(), +1577 reason: b"bye".to_vec().into(), +1578 }); +1579 assert_eq!(err, expected_err); +1580 +1581 info!("opening new - expect it to fail"); +1582 let res = conn.open_uni().await; +1583 assert_eq!(res.unwrap_err(), expected_err); +1584 info!("client test completed"); +1585 Ok::<_, Error>(()) +1586 } +1587 .instrument(info_span!("test-client")), +1588 ); 1589 -1590 info!("opening new - expect it to fail"); -1591 let res = conn.open_uni().await; -1592 assert_eq!(res.unwrap_err(), expected_err); -1593 info!("client test completed"); -1594 Ok::<_, Error>(()) -1595 } -1596 .instrument(info_span!("test-client")), -1597 ); -1598 -1599 let (server, client) = tokio::time::timeout( -1600 Duration::from_secs(30), -1601 n0_future::future::zip(server, client), -1602 ) -1603 .await -1604 .anyerr()?; -1605 server.anyerr()??; -1606 client.anyerr()??; -1607 Ok(()) -1608 } -1609 -1610 #[tokio::test] -1611 #[traced_test] -1612 async fn endpoint_relay_connect_loop() -> Result { -1613 let test_start = Instant::now(); -1614 let n_clients = 5; -1615 let n_chunks_per_client = 2; -1616 let chunk_size = 10; -1617 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(42); -1618 let (relay_map, relay_url, _relay_guard) = run_relay_server().await.unwrap(); -1619 let server_secret_key = SecretKey::generate(&mut rng); -1620 let server_endpoint_id = server_secret_key.public(); -1621 -1622 // Make sure the server is bound before having clients connect to it: -1623 let ep = Endpoint::empty_builder(RelayMode::Custom(relay_map.clone())) -1624 .insecure_skip_relay_cert_verify(true) -1625 .secret_key(server_secret_key) -1626 .alpns(vec![TEST_ALPN.to_vec()]) -1627 .bind() -1628 .await?; -1629 // Also make sure the server has a working relay connection -1630 ep.online().await; -1631 -1632 info!(time = ?test_start.elapsed(), "test setup done"); -1633 -1634 // The server accepts the connections of the clients sequentially. -1635 let server = tokio::spawn( -1636 async move { -1637 let eps = ep.bound_sockets(); -1638 -1639 info!(me = %ep.id().fmt_short(), eps = ?eps, "server listening on"); -1640 for i in 0..n_clients { -1641 let round_start = Instant::now(); -1642 info!("[server] round {i}"); -1643 let incoming = ep.accept().await.anyerr()?; -1644 let conn = incoming.await.anyerr()?; -1645 let endpoint_id = conn.remote_id(); -1646 info!(%i, peer = %endpoint_id.fmt_short(), "accepted connection"); -1647 let (mut send, mut recv) = conn.accept_bi().await.anyerr()?; -1648 let mut buf = vec![0u8; chunk_size]; -1649 for _i in 0..n_chunks_per_client { -1650 recv.read_exact(&mut buf).await.anyerr()?; -1651 send.write_all(&buf).await.anyerr()?; -1652 } -1653 send.finish().anyerr()?; -1654 conn.closed().await; // we're the last to send data, so we wait for the other side to close -1655 info!(%i, peer = %endpoint_id.fmt_short(), "finished"); -1656 info!("[server] round {i} done in {:?}", round_start.elapsed()); -1657 } -1658 Ok::<_, Error>(()) -1659 } -1660 .instrument(error_span!("server")), -1661 ); -1662 -1663 let start = Instant::now(); -1664 -1665 for i in 0..n_clients { -1666 let round_start = Instant::now(); -1667 info!("[client] round {i}"); -1668 let client_secret_key = SecretKey::generate(&mut rng); -1669 async { -1670 info!("client binding"); -1671 let ep = Endpoint::empty_builder(RelayMode::Custom(relay_map.clone())) -1672 .alpns(vec![TEST_ALPN.to_vec()]) -1673 .insecure_skip_relay_cert_verify(true) -1674 .secret_key(client_secret_key) -1675 .bind() -1676 .await?; -1677 let eps = ep.bound_sockets(); -1678 -1679 info!(me = %ep.id().fmt_short(), eps=?eps, "client bound"); -1680 let endpoint_addr = -1681 EndpointAddr::new(server_endpoint_id).with_relay_url(relay_url.clone()); -1682 info!(to = ?endpoint_addr, "client connecting"); -1683 let conn = ep.connect(endpoint_addr, TEST_ALPN).await.anyerr()?; -1684 info!("client connected"); -1685 let (mut send, mut recv) = conn.open_bi().await.anyerr()?; -1686 -1687 for i in 0..n_chunks_per_client { -1688 let mut buf = vec![i; chunk_size]; -1689 send.write_all(&buf).await.anyerr()?; -1690 recv.read_exact(&mut buf).await.anyerr()?; -1691 assert_eq!(buf, vec![i; chunk_size]); -1692 } -1693 // we're the last to receive data, so we close -1694 conn.close(0u32.into(), b"bye!"); -1695 info!("client finished"); -1696 ep.close().await; -1697 info!("client closed"); -1698 Ok::<_, Error>(()) -1699 } -1700 .instrument(error_span!("client", %i)) -1701 .await?; -1702 info!("[client] round {i} done in {:?}", round_start.elapsed()); +1590 let (server, client) = tokio::time::timeout( +1591 Duration::from_secs(30), +1592 n0_future::future::zip(server, client), +1593 ) +1594 .await +1595 .anyerr()?; +1596 server.anyerr()??; +1597 client.anyerr()??; +1598 Ok(()) +1599 } +1600 +1601 #[tokio::test] +1602 #[traced_test] +1603 async fn endpoint_relay_connect_loop() -> Result { +1604 let test_start = Instant::now(); +1605 let n_clients = 5; +1606 let n_chunks_per_client = 2; +1607 let chunk_size = 10; +1608 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(42); +1609 let (relay_map, relay_url, _relay_guard) = run_relay_server().await.unwrap(); +1610 let server_secret_key = SecretKey::generate(&mut rng); +1611 let server_endpoint_id = server_secret_key.public(); +1612 +1613 // Make sure the server is bound before having clients connect to it: +1614 let ep = Endpoint::empty_builder(RelayMode::Custom(relay_map.clone())) +1615 .insecure_skip_relay_cert_verify(true) +1616 .secret_key(server_secret_key) +1617 .alpns(vec![TEST_ALPN.to_vec()]) +1618 .bind() +1619 .await?; +1620 // Also make sure the server has a working relay connection +1621 ep.online().await; +1622 +1623 info!(time = ?test_start.elapsed(), "test setup done"); +1624 +1625 // The server accepts the connections of the clients sequentially. +1626 let server = tokio::spawn( +1627 async move { +1628 let eps = ep.bound_sockets(); +1629 +1630 info!(me = %ep.id().fmt_short(), eps = ?eps, "server listening on"); +1631 for i in 0..n_clients { +1632 let round_start = Instant::now(); +1633 info!("[server] round {i}"); +1634 let incoming = ep.accept().await.anyerr()?; +1635 let conn = incoming.await.anyerr()?; +1636 let endpoint_id = conn.remote_id(); +1637 info!(%i, peer = %endpoint_id.fmt_short(), "accepted connection"); +1638 let (mut send, mut recv) = conn.accept_bi().await.anyerr()?; +1639 let mut buf = vec![0u8; chunk_size]; +1640 for _i in 0..n_chunks_per_client { +1641 recv.read_exact(&mut buf).await.anyerr()?; +1642 send.write_all(&buf).await.anyerr()?; +1643 } +1644 send.finish().anyerr()?; +1645 conn.closed().await; // we're the last to send data, so we wait for the other side to close +1646 info!(%i, peer = %endpoint_id.fmt_short(), "finished"); +1647 info!("[server] round {i} done in {:?}", round_start.elapsed()); +1648 } +1649 Ok::<_, Error>(()) +1650 } +1651 .instrument(error_span!("server")), +1652 ); +1653 +1654 let start = Instant::now(); +1655 +1656 for i in 0..n_clients { +1657 let round_start = Instant::now(); +1658 info!("[client] round {i}"); +1659 let client_secret_key = SecretKey::generate(&mut rng); +1660 async { +1661 info!("client binding"); +1662 let ep = Endpoint::empty_builder(RelayMode::Custom(relay_map.clone())) +1663 .alpns(vec![TEST_ALPN.to_vec()]) +1664 .insecure_skip_relay_cert_verify(true) +1665 .secret_key(client_secret_key) +1666 .bind() +1667 .await?; +1668 let eps = ep.bound_sockets(); +1669 +1670 info!(me = %ep.id().fmt_short(), eps=?eps, "client bound"); +1671 let endpoint_addr = +1672 EndpointAddr::new(server_endpoint_id).with_relay_url(relay_url.clone()); +1673 info!(to = ?endpoint_addr, "client connecting"); +1674 let conn = ep.connect(endpoint_addr, TEST_ALPN).await.anyerr()?; +1675 info!("client connected"); +1676 let (mut send, mut recv) = conn.open_bi().await.anyerr()?; +1677 +1678 for i in 0..n_chunks_per_client { +1679 let mut buf = vec![i; chunk_size]; +1680 send.write_all(&buf).await.anyerr()?; +1681 recv.read_exact(&mut buf).await.anyerr()?; +1682 assert_eq!(buf, vec![i; chunk_size]); +1683 } +1684 // we're the last to receive data, so we close +1685 conn.close(0u32.into(), b"bye!"); +1686 info!("client finished"); +1687 ep.close().await; +1688 info!("client closed"); +1689 Ok::<_, Error>(()) +1690 } +1691 .instrument(error_span!("client", %i)) +1692 .await?; +1693 info!("[client] round {i} done in {:?}", round_start.elapsed()); +1694 } +1695 +1696 server.await.anyerr()??; +1697 +1698 // We appear to have seen this being very slow at times. So ensure we fail if this +1699 // test is too slow. We're only making two connections transferring very little +1700 // data, this really shouldn't take long. +1701 if start.elapsed() > Duration::from_secs(15) { +1702 panic!("Test too slow, something went wrong"); 1703 } 1704 -1705 server.await.anyerr()??; -1706 -1707 // We appear to have seen this being very slow at times. So ensure we fail if this -1708 // test is too slow. We're only making two connections transferring very little -1709 // data, this really shouldn't take long. -1710 if start.elapsed() > Duration::from_secs(15) { -1711 panic!("Test too slow, something went wrong"); -1712 } -1713 -1714 Ok(()) -1715 } -1716 -1717 #[tokio::test] -1718 #[traced_test] -1719 async fn endpoint_send_relay() -> Result { -1720 let (relay_map, _relay_url, _guard) = run_relay_server().await?; -1721 let client = Endpoint::empty_builder(RelayMode::Custom(relay_map.clone())) -1722 .insecure_skip_relay_cert_verify(true) -1723 .bind() -1724 .await?; -1725 let server = Endpoint::empty_builder(RelayMode::Custom(relay_map)) -1726 .insecure_skip_relay_cert_verify(true) -1727 .alpns(vec![TEST_ALPN.to_vec()]) -1728 .bind() -1729 .await?; -1730 -1731 let task = tokio::spawn({ -1732 let server = server.clone(); -1733 async move { -1734 let Some(conn) = server.accept().await else { -1735 n0_error::bail_any!("Expected an incoming connection"); -1736 }; -1737 let conn = conn.await.anyerr()?; -1738 let (mut send, mut recv) = conn.accept_bi().await.anyerr()?; -1739 let data = recv.read_to_end(1000).await.anyerr()?; -1740 send.write_all(&data).await.anyerr()?; -1741 send.finish().anyerr()?; -1742 conn.closed().await; -1743 -1744 Ok::<_, Error>(()) -1745 } -1746 }); -1747 -1748 let addr = server.addr(); -1749 let conn = client.connect(addr, TEST_ALPN).await?; -1750 let (mut send, mut recv) = conn.open_bi().await.anyerr()?; -1751 send.write_all(b"Hello, world!").await.anyerr()?; -1752 send.finish().anyerr()?; -1753 let data = recv.read_to_end(1000).await.anyerr()?; -1754 conn.close(0u32.into(), b"bye!"); -1755 -1756 task.await.anyerr()??; -1757 -1758 client.close().await; -1759 server.close().await; -1760 -1761 assert_eq!(&data, b"Hello, world!"); -1762 -1763 Ok(()) -1764 } -1765 -1766 #[tokio::test] -1767 #[traced_test] -1768 async fn endpoint_two_direct_only() -> Result { -1769 // Connect two endpoints on the same network, without a relay server, without -1770 // discovery. -1771 let ep1 = { -1772 let span = info_span!("server"); +1705 Ok(()) +1706 } +1707 +1708 #[tokio::test] +1709 #[traced_test] +1710 async fn endpoint_send_relay() -> Result { +1711 let (relay_map, _relay_url, _guard) = run_relay_server().await?; +1712 let client = Endpoint::empty_builder(RelayMode::Custom(relay_map.clone())) +1713 .insecure_skip_relay_cert_verify(true) +1714 .bind() +1715 .await?; +1716 let server = Endpoint::empty_builder(RelayMode::Custom(relay_map)) +1717 .insecure_skip_relay_cert_verify(true) +1718 .alpns(vec![TEST_ALPN.to_vec()]) +1719 .bind() +1720 .await?; +1721 +1722 let task = tokio::spawn({ +1723 let server = server.clone(); +1724 async move { +1725 let Some(conn) = server.accept().await else { +1726 n0_error::bail_any!("Expected an incoming connection"); +1727 }; +1728 let conn = conn.await.anyerr()?; +1729 let (mut send, mut recv) = conn.accept_bi().await.anyerr()?; +1730 let data = recv.read_to_end(1000).await.anyerr()?; +1731 send.write_all(&data).await.anyerr()?; +1732 send.finish().anyerr()?; +1733 conn.closed().await; +1734 +1735 Ok::<_, Error>(()) +1736 } +1737 }); +1738 +1739 let addr = server.addr(); +1740 let conn = client.connect(addr, TEST_ALPN).await?; +1741 let (mut send, mut recv) = conn.open_bi().await.anyerr()?; +1742 send.write_all(b"Hello, world!").await.anyerr()?; +1743 send.finish().anyerr()?; +1744 let data = recv.read_to_end(1000).await.anyerr()?; +1745 conn.close(0u32.into(), b"bye!"); +1746 +1747 task.await.anyerr()??; +1748 +1749 client.close().await; +1750 server.close().await; +1751 +1752 assert_eq!(&data, b"Hello, world!"); +1753 +1754 Ok(()) +1755 } +1756 +1757 #[tokio::test] +1758 #[traced_test] +1759 async fn endpoint_two_direct_only() -> Result { +1760 // Connect two endpoints on the same network, without a relay server, without +1761 // discovery. +1762 let ep1 = { +1763 let span = info_span!("server"); +1764 let _guard = span.enter(); +1765 Endpoint::builder() +1766 .alpns(vec![TEST_ALPN.to_vec()]) +1767 .relay_mode(RelayMode::Disabled) +1768 .bind() +1769 .await? +1770 }; +1771 let ep2 = { +1772 let span = info_span!("client"); 1773 let _guard = span.enter(); 1774 Endpoint::builder() 1775 .alpns(vec![TEST_ALPN.to_vec()]) @@ -1777,928 +1777,830 @@ 1777 .bind() 1778 .await? 1779 }; -1780 let ep2 = { -1781 let span = info_span!("client"); -1782 let _guard = span.enter(); -1783 Endpoint::builder() -1784 .alpns(vec![TEST_ALPN.to_vec()]) -1785 .relay_mode(RelayMode::Disabled) -1786 .bind() -1787 .await? -1788 }; -1789 let ep1_nodeaddr = ep1.addr(); -1790 -1791 #[instrument(name = "client", skip_all)] -1792 async fn connect(ep: Endpoint, dst: EndpointAddr) -> Result<quinn::ConnectionError> { -1793 info!(me = %ep.id().fmt_short(), "client starting"); -1794 let conn = ep.connect(dst, TEST_ALPN).await?; -1795 let mut send = conn.open_uni().await.anyerr()?; -1796 send.write_all(b"hello").await.anyerr()?; -1797 send.finish().anyerr()?; -1798 Ok(conn.closed().await) -1799 } -1800 -1801 #[instrument(name = "server", skip_all)] -1802 async fn accept(ep: Endpoint, src: EndpointId) -> Result { -1803 info!(me = %ep.id().fmt_short(), "server starting"); -1804 let conn = ep.accept().await.anyerr()?.await.anyerr()?; -1805 let node_id = conn.remote_id(); -1806 assert_eq!(node_id, src); -1807 let mut recv = conn.accept_uni().await.anyerr()?; -1808 let msg = recv.read_to_end(100).await.anyerr()?; -1809 assert_eq!(msg, b"hello"); -1810 // Dropping the connection closes it just fine. -1811 Ok(()) -1812 } -1813 -1814 let ep1_accept = tokio::spawn(accept(ep1.clone(), ep2.id())); -1815 let ep2_connect = tokio::spawn(connect(ep2.clone(), ep1_nodeaddr)); -1816 -1817 ep1_accept.await.anyerr()??; -1818 let conn_closed = dbg!(ep2_connect.await.anyerr()??); -1819 assert!(matches!( -1820 conn_closed, -1821 ConnectionError::ApplicationClosed(quinn::ApplicationClose { .. }) -1822 )); -1823 -1824 Ok(()) -1825 } -1826 -1827 #[tokio::test] -1828 #[traced_test] -1829 async fn endpoint_two_relay_only() -> Result { -1830 // Connect two endpoints on the same network, via a relay server, without -1831 // discovery. -1832 let (relay_map, _relay_url, _relay_server_guard) = run_relay_server().await?; -1833 let (node_addr_tx, node_addr_rx) = oneshot::channel(); -1834 -1835 #[instrument(name = "client", skip_all)] -1836 async fn connect( -1837 relay_map: RelayMap, -1838 node_addr_rx: oneshot::Receiver<EndpointAddr>, -1839 ) -> Result<quinn::ConnectionError> { -1840 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0u64); -1841 let secret = SecretKey::generate(&mut rng); -1842 let ep = Endpoint::builder() -1843 .secret_key(secret) -1844 .alpns(vec![TEST_ALPN.to_vec()]) -1845 .insecure_skip_relay_cert_verify(true) -1846 .relay_mode(RelayMode::Custom(relay_map)) -1847 .bind() -1848 .await?; -1849 info!(me = %ep.id().fmt_short(), "client starting"); -1850 let dst = node_addr_rx.await.anyerr()?; -1851 -1852 info!(me = %ep.id().fmt_short(), "client connecting"); -1853 let conn = ep.connect(dst, TEST_ALPN).await?; -1854 let mut send = conn.open_uni().await.anyerr()?; -1855 send.write_all(b"hello").await.anyerr()?; -1856 let mut paths = conn.paths_info().stream(); -1857 info!("Waiting for direct connection"); -1858 while let Some(infos) = paths.next().await { -1859 info!(?infos, "new PathInfos"); -1860 if infos.keys().any(|addr| addr.is_ip()) { -1861 break; -1862 } -1863 } -1864 info!("Have direct connection"); -1865 send.write_all(b"close please").await.anyerr()?; -1866 send.finish().anyerr()?; -1867 Ok(conn.closed().await) -1868 } -1869 -1870 #[instrument(name = "server", skip_all)] -1871 async fn accept( -1872 relay_map: RelayMap, -1873 node_addr_tx: oneshot::Sender<EndpointAddr>, -1874 ) -> Result { -1875 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(1u64); -1876 let secret = SecretKey::generate(&mut rng); -1877 let ep = Endpoint::builder() -1878 .secret_key(secret) -1879 .alpns(vec![TEST_ALPN.to_vec()]) -1880 .insecure_skip_relay_cert_verify(true) -1881 .relay_mode(RelayMode::Custom(relay_map)) -1882 .bind() -1883 .await?; -1884 ep.online().await; -1885 let mut node_addr = ep.addr(); -1886 node_addr.addrs.retain(|addr| addr.is_relay()); -1887 node_addr_tx.send(node_addr).unwrap(); -1888 -1889 info!(me = %ep.id().fmt_short(), "server starting"); -1890 let conn = ep.accept().await.anyerr()?.await.anyerr()?; -1891 // let node_id = conn.remote_node_id()?; -1892 // assert_eq!(node_id, src); -1893 let mut recv = conn.accept_uni().await.anyerr()?; -1894 let mut msg = [0u8; 5]; -1895 recv.read_exact(&mut msg).await.anyerr()?; -1896 assert_eq!(&msg, b"hello"); -1897 info!("received hello"); -1898 let msg = recv.read_to_end(100).await.anyerr()?; -1899 assert_eq!(msg, b"close please"); -1900 info!("received 'close please'"); -1901 // Dropping the connection closes it just fine. -1902 Ok(()) -1903 } -1904 -1905 let server_task = tokio::spawn(accept(relay_map.clone(), node_addr_tx)); -1906 let client_task = tokio::spawn(connect(relay_map, node_addr_rx)); -1907 -1908 server_task.await.anyerr()??; -1909 let conn_closed = dbg!(client_task.await.anyerr()??); -1910 assert!(matches!( -1911 conn_closed, -1912 ConnectionError::ApplicationClosed(quinn::ApplicationClose { .. }) -1913 )); -1914 -1915 Ok(()) -1916 } -1917 -1918 #[tokio::test] -1919 #[traced_test] -1920 async fn endpoint_two_direct_add_relay() -> Result { -1921 // Connect two endpoints on the same network, without relay server and without -1922 // discovery. Add a relay connection later. -1923 let (relay_map, _relay_url, _relay_server_guard) = run_relay_server().await?; -1924 let (node_addr_tx, node_addr_rx) = oneshot::channel(); -1925 -1926 #[instrument(name = "client", skip_all)] -1927 async fn connect( -1928 relay_map: RelayMap, -1929 node_addr_rx: oneshot::Receiver<EndpointAddr>, -1930 ) -> Result<()> { -1931 let secret = SecretKey::from([0u8; 32]); -1932 let ep = Endpoint::builder() -1933 .secret_key(secret) -1934 .alpns(vec![TEST_ALPN.to_vec()]) -1935 .insecure_skip_relay_cert_verify(true) -1936 .relay_mode(RelayMode::Custom(relay_map)) -1937 .bind() -1938 .await?; -1939 info!(me = %ep.id().fmt_short(), "client starting"); -1940 let dst = node_addr_rx.await.anyerr()?; +1780 let ep1_nodeaddr = ep1.addr(); +1781 +1782 #[instrument(name = "client", skip_all)] +1783 async fn connect(ep: Endpoint, dst: EndpointAddr) -> Result<quinn::ConnectionError> { +1784 info!(me = %ep.id().fmt_short(), "client starting"); +1785 let conn = ep.connect(dst, TEST_ALPN).await?; +1786 let mut send = conn.open_uni().await.anyerr()?; +1787 send.write_all(b"hello").await.anyerr()?; +1788 send.finish().anyerr()?; +1789 Ok(conn.closed().await) +1790 } +1791 +1792 #[instrument(name = "server", skip_all)] +1793 async fn accept(ep: Endpoint, src: EndpointId) -> Result { +1794 info!(me = %ep.id().fmt_short(), "server starting"); +1795 let conn = ep.accept().await.anyerr()?.await.anyerr()?; +1796 let node_id = conn.remote_id(); +1797 assert_eq!(node_id, src); +1798 let mut recv = conn.accept_uni().await.anyerr()?; +1799 let msg = recv.read_to_end(100).await.anyerr()?; +1800 assert_eq!(msg, b"hello"); +1801 // Dropping the connection closes it just fine. +1802 Ok(()) +1803 } +1804 +1805 let ep1_accept = tokio::spawn(accept(ep1.clone(), ep2.id())); +1806 let ep2_connect = tokio::spawn(connect(ep2.clone(), ep1_nodeaddr)); +1807 +1808 ep1_accept.await.anyerr()??; +1809 let conn_closed = dbg!(ep2_connect.await.anyerr()??); +1810 assert!(matches!( +1811 conn_closed, +1812 ConnectionError::ApplicationClosed(quinn::ApplicationClose { .. }) +1813 )); +1814 +1815 Ok(()) +1816 } +1817 +1818 #[tokio::test] +1819 #[traced_test] +1820 async fn endpoint_two_relay_only() -> Result { +1821 // Connect two endpoints on the same network, via a relay server, without +1822 // discovery. +1823 let (relay_map, _relay_url, _relay_server_guard) = run_relay_server().await?; +1824 let (node_addr_tx, node_addr_rx) = oneshot::channel(); +1825 +1826 #[instrument(name = "client", skip_all)] +1827 async fn connect( +1828 relay_map: RelayMap, +1829 node_addr_rx: oneshot::Receiver<EndpointAddr>, +1830 ) -> Result<quinn::ConnectionError> { +1831 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0u64); +1832 let secret = SecretKey::generate(&mut rng); +1833 let ep = Endpoint::builder() +1834 .secret_key(secret) +1835 .alpns(vec![TEST_ALPN.to_vec()]) +1836 .insecure_skip_relay_cert_verify(true) +1837 .relay_mode(RelayMode::Custom(relay_map)) +1838 .bind() +1839 .await?; +1840 info!(me = %ep.id().fmt_short(), "client starting"); +1841 let dst = node_addr_rx.await.anyerr()?; +1842 +1843 info!(me = %ep.id().fmt_short(), "client connecting"); +1844 let conn = ep.connect(dst, TEST_ALPN).await?; +1845 let mut send = conn.open_uni().await.anyerr()?; +1846 send.write_all(b"hello").await.anyerr()?; +1847 let mut paths = conn.paths_info().stream(); +1848 info!("Waiting for direct connection"); +1849 while let Some(infos) = paths.next().await { +1850 info!(?infos, "new PathInfos"); +1851 if infos.keys().any(|addr| addr.is_ip()) { +1852 break; +1853 } +1854 } +1855 info!("Have direct connection"); +1856 send.write_all(b"close please").await.anyerr()?; +1857 send.finish().anyerr()?; +1858 Ok(conn.closed().await) +1859 } +1860 +1861 #[instrument(name = "server", skip_all)] +1862 async fn accept( +1863 relay_map: RelayMap, +1864 node_addr_tx: oneshot::Sender<EndpointAddr>, +1865 ) -> Result { +1866 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(1u64); +1867 let secret = SecretKey::generate(&mut rng); +1868 let ep = Endpoint::builder() +1869 .secret_key(secret) +1870 .alpns(vec![TEST_ALPN.to_vec()]) +1871 .insecure_skip_relay_cert_verify(true) +1872 .relay_mode(RelayMode::Custom(relay_map)) +1873 .bind() +1874 .await?; +1875 ep.online().await; +1876 let mut node_addr = ep.addr(); +1877 node_addr.addrs.retain(|addr| addr.is_relay()); +1878 node_addr_tx.send(node_addr).unwrap(); +1879 +1880 info!(me = %ep.id().fmt_short(), "server starting"); +1881 let conn = ep.accept().await.anyerr()?.await.anyerr()?; +1882 // let node_id = conn.remote_node_id()?; +1883 // assert_eq!(node_id, src); +1884 let mut recv = conn.accept_uni().await.anyerr()?; +1885 let mut msg = [0u8; 5]; +1886 recv.read_exact(&mut msg).await.anyerr()?; +1887 assert_eq!(&msg, b"hello"); +1888 info!("received hello"); +1889 let msg = recv.read_to_end(100).await.anyerr()?; +1890 assert_eq!(msg, b"close please"); +1891 info!("received 'close please'"); +1892 // Dropping the connection closes it just fine. +1893 Ok(()) +1894 } +1895 +1896 let server_task = tokio::spawn(accept(relay_map.clone(), node_addr_tx)); +1897 let client_task = tokio::spawn(connect(relay_map, node_addr_rx)); +1898 +1899 server_task.await.anyerr()??; +1900 let conn_closed = dbg!(client_task.await.anyerr()??); +1901 assert!(matches!( +1902 conn_closed, +1903 ConnectionError::ApplicationClosed(quinn::ApplicationClose { .. }) +1904 )); +1905 +1906 Ok(()) +1907 } +1908 +1909 #[tokio::test] +1910 #[traced_test] +1911 async fn endpoint_two_direct_add_relay() -> Result { +1912 // Connect two endpoints on the same network, without relay server and without +1913 // discovery. Add a relay connection later. +1914 let (relay_map, _relay_url, _relay_server_guard) = run_relay_server().await?; +1915 let (node_addr_tx, node_addr_rx) = oneshot::channel(); +1916 +1917 #[instrument(name = "client", skip_all)] +1918 async fn connect( +1919 relay_map: RelayMap, +1920 node_addr_rx: oneshot::Receiver<EndpointAddr>, +1921 ) -> Result<()> { +1922 let secret = SecretKey::from([0u8; 32]); +1923 let ep = Endpoint::builder() +1924 .secret_key(secret) +1925 .alpns(vec![TEST_ALPN.to_vec()]) +1926 .insecure_skip_relay_cert_verify(true) +1927 .relay_mode(RelayMode::Custom(relay_map)) +1928 .bind() +1929 .await?; +1930 info!(me = %ep.id().fmt_short(), "client starting"); +1931 let dst = node_addr_rx.await.anyerr()?; +1932 +1933 info!(me = %ep.id().fmt_short(), "client connecting"); +1934 let conn = ep.connect(dst, TEST_ALPN).await?; +1935 +1936 // We should be connected via IP, because it is faster than the relay server. +1937 // TODO: Maybe not panic if this is not true? +1938 let path_info = conn.paths_info().get(); +1939 assert_eq!(path_info.len(), 1); +1940 assert!(path_info.keys().next().unwrap().is_ip()); 1941 -1942 info!(me = %ep.id().fmt_short(), "client connecting"); -1943 let conn = ep.connect(dst, TEST_ALPN).await?; -1944 -1945 // We should be connected via IP, because it is faster than the relay server. -1946 // TODO: Maybe not panic if this is not true? -1947 let path_info = conn.paths_info().get(); -1948 assert_eq!(path_info.len(), 1); -1949 assert!(path_info.keys().next().unwrap().is_ip()); -1950 -1951 let mut paths = conn.paths_info().stream(); -1952 time::timeout(Duration::from_secs(5), async move { -1953 while let Some(infos) = paths.next().await { -1954 info!(?infos, "new PathInfos"); -1955 if infos.keys().any(|a| a.is_relay()) { -1956 break; -1957 } -1958 } -1959 }) -1960 .await -1961 .anyerr()?; -1962 -1963 // wait for the server to signal it has the relay connection -1964 let mut stream = conn.accept_uni().await.anyerr()?; -1965 stream.read_to_end(100).await.anyerr()?; -1966 -1967 info!("client closing"); -1968 conn.close(0u8.into(), b""); -1969 ep.close().await; -1970 Ok(()) -1971 } -1972 -1973 #[instrument(name = "server", skip_all)] -1974 async fn accept( -1975 relay_map: RelayMap, -1976 node_addr_tx: oneshot::Sender<EndpointAddr>, -1977 ) -> Result<quinn::ConnectionError> { -1978 let secret = SecretKey::from([1u8; 32]); -1979 let ep = Endpoint::builder() -1980 .secret_key(secret) -1981 .alpns(vec![TEST_ALPN.to_vec()]) -1982 .insecure_skip_relay_cert_verify(true) -1983 .relay_mode(RelayMode::Custom(relay_map)) -1984 .bind() -1985 .await?; -1986 ep.online().await; -1987 let node_addr = ep.addr(); -1988 node_addr_tx.send(node_addr).unwrap(); -1989 -1990 info!(me = %ep.id().fmt_short(), "server starting"); -1991 let conn = ep.accept().await.anyerr()?.await.anyerr()?; -1992 -1993 // Wait for a relay connection to be added. Client does all the asserting here, -1994 // we just want to wait so we get to see all the mechanics of the connection -1995 // being added on this side too. -1996 let mut paths = conn.paths_info().stream(); -1997 time::timeout(Duration::from_secs(5), async move { -1998 while let Some(infos) = paths.next().await { -1999 info!(?infos, "new PathInfos"); -2000 if infos.keys().any(|a| a.is_relay()) { -2001 break; -2002 } -2003 } -2004 }) -2005 .await -2006 .anyerr()?; +1942 let mut paths = conn.paths_info().stream(); +1943 time::timeout(Duration::from_secs(5), async move { +1944 while let Some(infos) = paths.next().await { +1945 info!(?infos, "new PathInfos"); +1946 if infos.keys().any(|a| a.is_relay()) { +1947 break; +1948 } +1949 } +1950 }) +1951 .await +1952 .anyerr()?; +1953 +1954 // wait for the server to signal it has the relay connection +1955 let mut stream = conn.accept_uni().await.anyerr()?; +1956 stream.read_to_end(100).await.anyerr()?; +1957 +1958 info!("client closing"); +1959 conn.close(0u8.into(), b""); +1960 ep.close().await; +1961 Ok(()) +1962 } +1963 +1964 #[instrument(name = "server", skip_all)] +1965 async fn accept( +1966 relay_map: RelayMap, +1967 node_addr_tx: oneshot::Sender<EndpointAddr>, +1968 ) -> Result<quinn::ConnectionError> { +1969 let secret = SecretKey::from([1u8; 32]); +1970 let ep = Endpoint::builder() +1971 .secret_key(secret) +1972 .alpns(vec![TEST_ALPN.to_vec()]) +1973 .insecure_skip_relay_cert_verify(true) +1974 .relay_mode(RelayMode::Custom(relay_map)) +1975 .bind() +1976 .await?; +1977 ep.online().await; +1978 let node_addr = ep.addr(); +1979 node_addr_tx.send(node_addr).unwrap(); +1980 +1981 info!(me = %ep.id().fmt_short(), "server starting"); +1982 let conn = ep.accept().await.anyerr()?.await.anyerr()?; +1983 +1984 // Wait for a relay connection to be added. Client does all the asserting here, +1985 // we just want to wait so we get to see all the mechanics of the connection +1986 // being added on this side too. +1987 let mut paths = conn.paths_info().stream(); +1988 time::timeout(Duration::from_secs(5), async move { +1989 while let Some(infos) = paths.next().await { +1990 info!(?infos, "new PathInfos"); +1991 if infos.keys().any(|a| a.is_relay()) { +1992 break; +1993 } +1994 } +1995 }) +1996 .await +1997 .anyerr()?; +1998 +1999 let mut stream = conn.open_uni().await.anyerr()?; +2000 stream.write_all(b"have relay").await.anyerr()?; +2001 +2002 Ok(conn.closed().await) +2003 } +2004 +2005 let server_task = tokio::spawn(accept(relay_map.clone(), node_addr_tx)); +2006 let client_task = tokio::spawn(connect(relay_map, node_addr_rx)); 2007 -2008 let mut stream = conn.open_uni().await.anyerr()?; -2009 stream.write_all(b"have relay").await.anyerr()?; -2010 -2011 Ok(conn.closed().await) -2012 } -2013 -2014 let server_task = tokio::spawn(accept(relay_map.clone(), node_addr_tx)); -2015 let client_task = tokio::spawn(connect(relay_map, node_addr_rx)); -2016 -2017 client_task.await.anyerr()??; -2018 let conn_closed = dbg!(server_task.await.anyerr()??); -2019 assert!(matches!( -2020 conn_closed, -2021 ConnectionError::ApplicationClosed(quinn::ApplicationClose { .. }) -2022 )); -2023 -2024 Ok(()) -2025 } -2026 -2027 #[tokio::test] -2028 #[traced_test] -2029 async fn endpoint_relay_map_change() -> Result { -2030 let (relay_map, relay_url, _guard1) = run_relay_server().await?; -2031 let client = Endpoint::empty_builder(RelayMode::Custom(relay_map.clone())) -2032 .insecure_skip_relay_cert_verify(true) -2033 .bind() -2034 .await?; -2035 let server = Endpoint::empty_builder(RelayMode::Custom(relay_map)) -2036 .insecure_skip_relay_cert_verify(true) -2037 .alpns(vec![TEST_ALPN.to_vec()]) -2038 .bind() -2039 .await?; -2040 -2041 let task = tokio::spawn({ -2042 let server = server.clone(); -2043 async move { -2044 for i in 0..2 { -2045 println!("accept: round {i}"); -2046 let Some(conn) = server.accept().await else { -2047 n0_error::bail_any!("Expected an incoming connection"); -2048 }; -2049 let conn = conn.await.anyerr()?; -2050 let (mut send, mut recv) = conn.accept_bi().await.anyerr()?; -2051 let data = recv.read_to_end(1000).await.anyerr()?; -2052 send.write_all(&data).await.anyerr()?; -2053 send.finish().anyerr()?; -2054 conn.closed().await; -2055 } -2056 Ok::<_, Error>(()) -2057 } -2058 }); +2008 client_task.await.anyerr()??; +2009 let conn_closed = dbg!(server_task.await.anyerr()??); +2010 assert!(matches!( +2011 conn_closed, +2012 ConnectionError::ApplicationClosed(quinn::ApplicationClose { .. }) +2013 )); +2014 +2015 Ok(()) +2016 } +2017 +2018 #[tokio::test] +2019 #[traced_test] +2020 async fn endpoint_relay_map_change() -> Result { +2021 let (relay_map, relay_url, _guard1) = run_relay_server().await?; +2022 let client = Endpoint::empty_builder(RelayMode::Custom(relay_map.clone())) +2023 .insecure_skip_relay_cert_verify(true) +2024 .bind() +2025 .await?; +2026 let server = Endpoint::empty_builder(RelayMode::Custom(relay_map)) +2027 .insecure_skip_relay_cert_verify(true) +2028 .alpns(vec![TEST_ALPN.to_vec()]) +2029 .bind() +2030 .await?; +2031 +2032 let task = tokio::spawn({ +2033 let server = server.clone(); +2034 async move { +2035 for i in 0..2 { +2036 println!("accept: round {i}"); +2037 let Some(conn) = server.accept().await else { +2038 n0_error::bail_any!("Expected an incoming connection"); +2039 }; +2040 let conn = conn.await.anyerr()?; +2041 let (mut send, mut recv) = conn.accept_bi().await.anyerr()?; +2042 let data = recv.read_to_end(1000).await.anyerr()?; +2043 send.write_all(&data).await.anyerr()?; +2044 send.finish().anyerr()?; +2045 conn.closed().await; +2046 } +2047 Ok::<_, Error>(()) +2048 } +2049 }); +2050 +2051 server.online().await; +2052 +2053 let mut addr = server.addr(); +2054 println!("round1: {:?}", addr); +2055 +2056 // remove direct addrs to force relay usage +2057 addr.addrs +2058 .retain(|addr| !matches!(addr, TransportAddr::Ip(_))); 2059 -2060 server.online().await; -2061 -2062 let mut addr = server.addr(); -2063 println!("round1: {:?}", addr); -2064 -2065 // remove direct addrs to force relay usage -2066 addr.addrs -2067 .retain(|addr| !matches!(addr, TransportAddr::Ip(_))); +2060 let conn = client.connect(addr, TEST_ALPN).await?; +2061 let (mut send, mut recv) = conn.open_bi().await.anyerr()?; +2062 send.write_all(b"Hello, world!").await.anyerr()?; +2063 send.finish().anyerr()?; +2064 let data = recv.read_to_end(1000).await.anyerr()?; +2065 conn.close(0u32.into(), b"bye!"); +2066 +2067 assert_eq!(&data, b"Hello, world!"); 2068 -2069 let conn = client.connect(addr, TEST_ALPN).await?; -2070 let (mut send, mut recv) = conn.open_bi().await.anyerr()?; -2071 send.write_all(b"Hello, world!").await.anyerr()?; -2072 send.finish().anyerr()?; -2073 let data = recv.read_to_end(1000).await.anyerr()?; -2074 conn.close(0u32.into(), b"bye!"); -2075 -2076 assert_eq!(&data, b"Hello, world!"); -2077 -2078 // setup a second relay server -2079 let (new_relay_map, new_relay_url, _guard2) = run_relay_server().await?; -2080 let new_endpoint = new_relay_map -2081 .get(&new_relay_url) -2082 .expect("missing endpoint") -2083 .clone(); -2084 dbg!(&new_relay_map); -2085 -2086 let addr_watcher = server.watch_addr(); -2087 -2088 // add new new relay -2089 assert!( -2090 server -2091 .insert_relay(new_relay_url.clone(), new_endpoint.clone()) -2092 .await -2093 .is_none() -2094 ); -2095 // remove the old relay -2096 assert!(server.remove_relay(&relay_url).await.is_some()); -2097 -2098 println!("------- changed ----- "); -2099 -2100 let mut addr = tokio::time::timeout(Duration::from_secs(10), async move { -2101 let mut stream = addr_watcher.stream(); -2102 while let Some(addr) = stream.next().await { -2103 if addr.relay_urls().next() != Some(&relay_url) { -2104 return addr; -2105 } -2106 } -2107 panic!("failed to change relay"); -2108 }) -2109 .await -2110 .anyerr()?; -2111 -2112 println!("round2: {:?}", addr); -2113 assert_eq!(addr.relay_urls().next(), Some(&new_relay_url)); -2114 -2115 // remove direct addrs to force relay usage -2116 addr.addrs -2117 .retain(|addr| !matches!(addr, TransportAddr::Ip(_))); +2069 // setup a second relay server +2070 let (new_relay_map, new_relay_url, _guard2) = run_relay_server().await?; +2071 let new_endpoint = new_relay_map +2072 .get(&new_relay_url) +2073 .expect("missing endpoint") +2074 .clone(); +2075 dbg!(&new_relay_map); +2076 +2077 let addr_watcher = server.watch_addr(); +2078 +2079 // add new new relay +2080 assert!( +2081 server +2082 .insert_relay(new_relay_url.clone(), new_endpoint.clone()) +2083 .await +2084 .is_none() +2085 ); +2086 // remove the old relay +2087 assert!(server.remove_relay(&relay_url).await.is_some()); +2088 +2089 println!("------- changed ----- "); +2090 +2091 let mut addr = tokio::time::timeout(Duration::from_secs(10), async move { +2092 let mut stream = addr_watcher.stream(); +2093 while let Some(addr) = stream.next().await { +2094 if addr.relay_urls().next() != Some(&relay_url) { +2095 return addr; +2096 } +2097 } +2098 panic!("failed to change relay"); +2099 }) +2100 .await +2101 .anyerr()?; +2102 +2103 println!("round2: {:?}", addr); +2104 assert_eq!(addr.relay_urls().next(), Some(&new_relay_url)); +2105 +2106 // remove direct addrs to force relay usage +2107 addr.addrs +2108 .retain(|addr| !matches!(addr, TransportAddr::Ip(_))); +2109 +2110 let conn = client.connect(addr, TEST_ALPN).await?; +2111 let (mut send, mut recv) = conn.open_bi().await.anyerr()?; +2112 send.write_all(b"Hello, world!").await.anyerr()?; +2113 send.finish().anyerr()?; +2114 let data = recv.read_to_end(1000).await.anyerr()?; +2115 conn.close(0u32.into(), b"bye!"); +2116 +2117 task.await.anyerr()??; 2118 -2119 let conn = client.connect(addr, TEST_ALPN).await?; -2120 let (mut send, mut recv) = conn.open_bi().await.anyerr()?; -2121 send.write_all(b"Hello, world!").await.anyerr()?; -2122 send.finish().anyerr()?; -2123 let data = recv.read_to_end(1000).await.anyerr()?; -2124 conn.close(0u32.into(), b"bye!"); -2125 -2126 task.await.anyerr()??; -2127 -2128 client.close().await; -2129 server.close().await; -2130 -2131 assert_eq!(&data, b"Hello, world!"); -2132 -2133 Ok(()) -2134 } -2135 -2136 #[tokio::test] -2137 #[traced_test] -2138 async fn endpoint_bidi_send_recv() -> Result { -2139 let disco = StaticProvider::new(); -2140 let ep1 = Endpoint::empty_builder(RelayMode::Disabled) -2141 .discovery(disco.clone()) -2142 .alpns(vec![TEST_ALPN.to_vec()]) -2143 .bind() -2144 .await?; +2119 client.close().await; +2120 server.close().await; +2121 +2122 assert_eq!(&data, b"Hello, world!"); +2123 +2124 Ok(()) +2125 } +2126 +2127 #[tokio::test] +2128 #[traced_test] +2129 async fn endpoint_bidi_send_recv() -> Result { +2130 let disco = StaticProvider::new(); +2131 let ep1 = Endpoint::empty_builder(RelayMode::Disabled) +2132 .discovery(disco.clone()) +2133 .alpns(vec![TEST_ALPN.to_vec()]) +2134 .bind() +2135 .await?; +2136 +2137 let ep2 = Endpoint::empty_builder(RelayMode::Disabled) +2138 .discovery(disco.clone()) +2139 .alpns(vec![TEST_ALPN.to_vec()]) +2140 .bind() +2141 .await?; +2142 +2143 disco.add_endpoint_info(ep1.addr()); +2144 disco.add_endpoint_info(ep2.addr()); 2145 -2146 let ep2 = Endpoint::empty_builder(RelayMode::Disabled) -2147 .discovery(disco.clone()) -2148 .alpns(vec![TEST_ALPN.to_vec()]) -2149 .bind() -2150 .await?; -2151 -2152 disco.add_endpoint_info(ep1.addr()); -2153 disco.add_endpoint_info(ep2.addr()); -2154 -2155 let ep1_endpointid = ep1.id(); -2156 let ep2_endpointid = ep2.id(); -2157 eprintln!("endpoint id 1 {ep1_endpointid}"); -2158 eprintln!("endpoint id 2 {ep2_endpointid}"); -2159 -2160 async fn connect_hello(ep: Endpoint, dst: EndpointId) -> Result { -2161 let conn = ep.connect(dst, TEST_ALPN).await?; -2162 let (mut send, mut recv) = conn.open_bi().await.anyerr()?; -2163 info!("sending hello"); -2164 send.write_all(b"hello").await.anyerr()?; -2165 send.finish().anyerr()?; -2166 info!("receiving world"); -2167 let m = recv.read_to_end(100).await.anyerr()?; -2168 assert_eq!(m, b"world"); -2169 conn.close(1u8.into(), b"done"); -2170 Ok(()) -2171 } -2172 -2173 async fn accept_world(ep: Endpoint, src: EndpointId) -> Result { -2174 let incoming = ep.accept().await.anyerr()?; -2175 let mut iconn = incoming.accept().anyerr()?; -2176 let alpn = iconn.alpn().await?; -2177 let conn = iconn.await.anyerr()?; -2178 let endpoint_id = conn.remote_id(); -2179 assert_eq!(endpoint_id, src); -2180 assert_eq!(alpn, TEST_ALPN); -2181 let (mut send, mut recv) = conn.accept_bi().await.anyerr()?; -2182 info!("receiving hello"); -2183 let m = recv.read_to_end(100).await.anyerr()?; -2184 assert_eq!(m, b"hello"); -2185 info!("sending hello"); -2186 send.write_all(b"world").await.anyerr()?; -2187 send.finish().anyerr()?; -2188 match conn.closed().await { -2189 ConnectionError::ApplicationClosed(closed) => { -2190 assert_eq!(closed.error_code, 1u8.into()); -2191 Ok(()) -2192 } -2193 _ => panic!("wrong close error"), -2194 } -2195 } -2196 -2197 let p1_accept = tokio::spawn(accept_world(ep1.clone(), ep2_endpointid).instrument( -2198 info_span!( -2199 "p1_accept", -2200 ep1 = %ep1.id().fmt_short(), -2201 dst = %ep2_endpointid.fmt_short(), -2202 ), -2203 )); -2204 let p2_accept = tokio::spawn(accept_world(ep2.clone(), ep1_endpointid).instrument( -2205 info_span!( -2206 "p2_accept", -2207 ep2 = %ep2.id().fmt_short(), -2208 dst = %ep1_endpointid.fmt_short(), -2209 ), -2210 )); -2211 let p1_connect = tokio::spawn(connect_hello(ep1.clone(), ep2_endpointid).instrument( -2212 info_span!( -2213 "p1_connect", -2214 ep1 = %ep1.id().fmt_short(), -2215 dst = %ep2_endpointid.fmt_short(), -2216 ), -2217 )); -2218 let p2_connect = tokio::spawn(connect_hello(ep2.clone(), ep1_endpointid).instrument( -2219 info_span!( -2220 "p2_connect", -2221 ep2 = %ep2.id().fmt_short(), -2222 dst = %ep1_endpointid.fmt_short(), -2223 ), -2224 )); -2225 -2226 p1_accept.await.anyerr()??; -2227 p2_accept.await.anyerr()??; -2228 p1_connect.await.anyerr()??; -2229 p2_connect.await.anyerr()??; -2230 -2231 Ok(()) -2232 } -2233 -2234 #[tokio::test] -2235 #[traced_test] -2236 async fn endpoint_conn_type_becomes_direct() -> Result { -2237 const TIMEOUT: Duration = std::time::Duration::from_secs(15); -2238 let (relay_map, _relay_url, _relay_guard) = run_relay_server().await?; -2239 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(42); -2240 let ep1_secret_key = SecretKey::generate(&mut rng); -2241 let ep2_secret_key = SecretKey::generate(&mut rng); -2242 let ep1 = Endpoint::empty_builder(RelayMode::Custom(relay_map.clone())) -2243 .secret_key(ep1_secret_key) -2244 .insecure_skip_relay_cert_verify(true) -2245 .alpns(vec![TEST_ALPN.to_vec()]) -2246 .bind() -2247 .await?; -2248 let ep2 = Endpoint::empty_builder(RelayMode::Custom(relay_map)) -2249 .secret_key(ep2_secret_key) -2250 .insecure_skip_relay_cert_verify(true) -2251 .alpns(vec![TEST_ALPN.to_vec()]) -2252 .bind() -2253 .await?; -2254 -2255 async fn wait_for_conn_type_direct(ep: &Endpoint, endpoint_id: EndpointId) -> Result { -2256 let mut stream = ep -2257 .conn_type(endpoint_id) -2258 .expect("connection exists") -2259 .stream(); -2260 let src = ep.id().fmt_short(); -2261 let dst = endpoint_id.fmt_short(); -2262 while let Some(conn_type) = stream.next().await { -2263 tracing::info!(me = %src, dst = %dst, conn_type = ?conn_type); -2264 if matches!(conn_type, ConnectionType::Direct(_)) { -2265 return Ok(()); -2266 } -2267 } -2268 n0_error::bail_any!("conn_type stream ended before `ConnectionType::Direct`"); -2269 } -2270 -2271 async fn accept(ep: &Endpoint) -> Result<Connection> { -2272 let incoming = ep.accept().await.expect("ep closed"); -2273 let conn = incoming.await.anyerr()?; -2274 let endpoint_id = conn.remote_id(); -2275 tracing::info!(endpoint_id=%endpoint_id.fmt_short(), "accepted connection"); -2276 Ok(conn) -2277 } -2278 -2279 let ep1_endpointid = ep1.id(); -2280 let ep2_endpointid = ep2.id(); -2281 -2282 let ep1_endpointaddr = ep1.addr(); -2283 tracing::info!( -2284 "endpoint id 1 {ep1_endpointid}, relay URL {:?}", -2285 ep1_endpointaddr.relay_urls().next() -2286 ); -2287 tracing::info!("endpoint id 2 {ep2_endpointid}"); -2288 -2289 let ep1_side = tokio::time::timeout(TIMEOUT, async move { -2290 let conn = accept(&ep1).await?; -2291 let mut send = conn.open_uni().await.anyerr()?; -2292 wait_for_conn_type_direct(&ep1, ep2_endpointid).await?; -2293 send.write_all(b"Conn is direct").await.anyerr()?; -2294 send.finish().anyerr()?; -2295 conn.closed().await; -2296 Ok::<(), Error>(()) -2297 }); -2298 -2299 let ep2_side = tokio::time::timeout(TIMEOUT, async move { -2300 let conn = ep2.connect(ep1_endpointaddr, TEST_ALPN).await?; -2301 let mut recv = conn.accept_uni().await.anyerr()?; -2302 wait_for_conn_type_direct(&ep2, ep1_endpointid).await?; -2303 let read = recv.read_to_end(100).await.anyerr()?; -2304 assert_eq!(read, b"Conn is direct".to_vec()); -2305 conn.close(0u32.into(), b"done"); -2306 conn.closed().await; -2307 Ok::<(), Error>(()) -2308 }); -2309 -2310 let res_ep1 = AbortOnDropHandle::new(tokio::spawn(ep1_side)); -2311 let res_ep2 = AbortOnDropHandle::new(tokio::spawn(ep2_side)); -2312 -2313 let (r1, r2) = tokio::try_join!(res_ep1, res_ep2).anyerr()?; -2314 r1.anyerr()??; -2315 r2.anyerr()??; -2316 -2317 Ok(()) -2318 } -2319 -2320 #[tokio::test] -2321 #[traced_test] -2322 async fn test_direct_addresses_no_qad_relay() -> Result { -2323 let (relay_map, _, _guard) = run_relay_server_with(false).await.unwrap(); -2324 -2325 let ep = Endpoint::empty_builder(RelayMode::Custom(relay_map)) -2326 .alpns(vec![TEST_ALPN.to_vec()]) -2327 .insecure_skip_relay_cert_verify(true) -2328 .bind() -2329 .await?; -2330 -2331 assert!(ep.addr().ip_addrs().count() > 0); -2332 -2333 Ok(()) -2334 } -2335 -2336 #[cfg_attr(target_os = "windows", ignore = "flaky")] -2337 #[tokio::test] -2338 #[traced_test] -2339 async fn graceful_close() -> Result { -2340 let client = Endpoint::empty_builder(RelayMode::Disabled).bind().await?; -2341 let server = Endpoint::empty_builder(RelayMode::Disabled) -2342 .alpns(vec![TEST_ALPN.to_vec()]) -2343 .bind() -2344 .await?; -2345 let server_addr = server.addr(); -2346 let server_task = tokio::spawn(async move { -2347 let incoming = server.accept().await.anyerr()?; -2348 let conn = incoming.await.anyerr()?; -2349 let (mut send, mut recv) = conn.accept_bi().await.anyerr()?; -2350 let msg = recv.read_to_end(1_000).await.anyerr()?; -2351 send.write_all(&msg).await.anyerr()?; -2352 send.finish().anyerr()?; -2353 let close_reason = conn.closed().await; -2354 Ok::<_, Error>(close_reason) -2355 }); -2356 -2357 let conn = client.connect(server_addr, TEST_ALPN).await?; -2358 let (mut send, mut recv) = conn.open_bi().await.anyerr()?; -2359 send.write_all(b"Hello, world!").await.anyerr()?; -2360 send.finish().anyerr()?; -2361 recv.read_to_end(1_000).await.anyerr()?; -2362 conn.close(42u32.into(), b"thanks, bye!"); -2363 client.close().await; -2364 -2365 let close_err = server_task.await.anyerr()??; -2366 let ConnectionError::ApplicationClosed(app_close) = close_err else { -2367 panic!("Unexpected close reason: {close_err:?}"); -2368 }; -2369 -2370 assert_eq!(app_close.error_code, 42u32.into()); -2371 assert_eq!(app_close.reason.as_ref(), b"thanks, bye!"); +2146 let ep1_endpointid = ep1.id(); +2147 let ep2_endpointid = ep2.id(); +2148 eprintln!("endpoint id 1 {ep1_endpointid}"); +2149 eprintln!("endpoint id 2 {ep2_endpointid}"); +2150 +2151 async fn connect_hello(ep: Endpoint, dst: EndpointId) -> Result { +2152 let conn = ep.connect(dst, TEST_ALPN).await?; +2153 let (mut send, mut recv) = conn.open_bi().await.anyerr()?; +2154 info!("sending hello"); +2155 send.write_all(b"hello").await.anyerr()?; +2156 send.finish().anyerr()?; +2157 info!("receiving world"); +2158 let m = recv.read_to_end(100).await.anyerr()?; +2159 assert_eq!(m, b"world"); +2160 conn.close(1u8.into(), b"done"); +2161 Ok(()) +2162 } +2163 +2164 async fn accept_world(ep: Endpoint, src: EndpointId) -> Result { +2165 let incoming = ep.accept().await.anyerr()?; +2166 let mut iconn = incoming.accept().anyerr()?; +2167 let alpn = iconn.alpn().await?; +2168 let conn = iconn.await.anyerr()?; +2169 let endpoint_id = conn.remote_id(); +2170 assert_eq!(endpoint_id, src); +2171 assert_eq!(alpn, TEST_ALPN); +2172 let (mut send, mut recv) = conn.accept_bi().await.anyerr()?; +2173 info!("receiving hello"); +2174 let m = recv.read_to_end(100).await.anyerr()?; +2175 assert_eq!(m, b"hello"); +2176 info!("sending hello"); +2177 send.write_all(b"world").await.anyerr()?; +2178 send.finish().anyerr()?; +2179 match conn.closed().await { +2180 ConnectionError::ApplicationClosed(closed) => { +2181 assert_eq!(closed.error_code, 1u8.into()); +2182 Ok(()) +2183 } +2184 _ => panic!("wrong close error"), +2185 } +2186 } +2187 +2188 let p1_accept = tokio::spawn(accept_world(ep1.clone(), ep2_endpointid).instrument( +2189 info_span!( +2190 "p1_accept", +2191 ep1 = %ep1.id().fmt_short(), +2192 dst = %ep2_endpointid.fmt_short(), +2193 ), +2194 )); +2195 let p2_accept = tokio::spawn(accept_world(ep2.clone(), ep1_endpointid).instrument( +2196 info_span!( +2197 "p2_accept", +2198 ep2 = %ep2.id().fmt_short(), +2199 dst = %ep1_endpointid.fmt_short(), +2200 ), +2201 )); +2202 let p1_connect = tokio::spawn(connect_hello(ep1.clone(), ep2_endpointid).instrument( +2203 info_span!( +2204 "p1_connect", +2205 ep1 = %ep1.id().fmt_short(), +2206 dst = %ep2_endpointid.fmt_short(), +2207 ), +2208 )); +2209 let p2_connect = tokio::spawn(connect_hello(ep2.clone(), ep1_endpointid).instrument( +2210 info_span!( +2211 "p2_connect", +2212 ep2 = %ep2.id().fmt_short(), +2213 dst = %ep1_endpointid.fmt_short(), +2214 ), +2215 )); +2216 +2217 p1_accept.await.anyerr()??; +2218 p2_accept.await.anyerr()??; +2219 p1_connect.await.anyerr()??; +2220 p2_connect.await.anyerr()??; +2221 +2222 Ok(()) +2223 } +2224 +2225 #[tokio::test] +2226 #[traced_test] +2227 async fn endpoint_conn_type_becomes_direct() -> Result { +2228 const TIMEOUT: Duration = std::time::Duration::from_secs(15); +2229 let (relay_map, _relay_url, _relay_guard) = run_relay_server().await?; +2230 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(42); +2231 let ep1_secret_key = SecretKey::generate(&mut rng); +2232 let ep2_secret_key = SecretKey::generate(&mut rng); +2233 let ep1 = Endpoint::empty_builder(RelayMode::Custom(relay_map.clone())) +2234 .secret_key(ep1_secret_key) +2235 .insecure_skip_relay_cert_verify(true) +2236 .alpns(vec![TEST_ALPN.to_vec()]) +2237 .bind() +2238 .await?; +2239 let ep2 = Endpoint::empty_builder(RelayMode::Custom(relay_map)) +2240 .secret_key(ep2_secret_key) +2241 .insecure_skip_relay_cert_verify(true) +2242 .alpns(vec![TEST_ALPN.to_vec()]) +2243 .bind() +2244 .await?; +2245 +2246 async fn wait_for_conn_type_direct(ep: &Endpoint, endpoint_id: EndpointId) -> Result { +2247 let mut stream = ep +2248 .conn_type(endpoint_id) +2249 .expect("connection exists") +2250 .stream(); +2251 let src = ep.id().fmt_short(); +2252 let dst = endpoint_id.fmt_short(); +2253 while let Some(conn_type) = stream.next().await { +2254 tracing::info!(me = %src, dst = %dst, conn_type = ?conn_type); +2255 if matches!(conn_type, ConnectionType::Direct(_)) { +2256 return Ok(()); +2257 } +2258 } +2259 n0_error::bail_any!("conn_type stream ended before `ConnectionType::Direct`"); +2260 } +2261 +2262 async fn accept(ep: &Endpoint) -> Result<Connection> { +2263 let incoming = ep.accept().await.expect("ep closed"); +2264 let conn = incoming.await.anyerr()?; +2265 let endpoint_id = conn.remote_id(); +2266 tracing::info!(endpoint_id=%endpoint_id.fmt_short(), "accepted connection"); +2267 Ok(conn) +2268 } +2269 +2270 let ep1_endpointid = ep1.id(); +2271 let ep2_endpointid = ep2.id(); +2272 +2273 let ep1_endpointaddr = ep1.addr(); +2274 tracing::info!( +2275 "endpoint id 1 {ep1_endpointid}, relay URL {:?}", +2276 ep1_endpointaddr.relay_urls().next() +2277 ); +2278 tracing::info!("endpoint id 2 {ep2_endpointid}"); +2279 +2280 let ep1_side = tokio::time::timeout(TIMEOUT, async move { +2281 let conn = accept(&ep1).await?; +2282 let mut send = conn.open_uni().await.anyerr()?; +2283 wait_for_conn_type_direct(&ep1, ep2_endpointid).await?; +2284 send.write_all(b"Conn is direct").await.anyerr()?; +2285 send.finish().anyerr()?; +2286 conn.closed().await; +2287 Ok::<(), Error>(()) +2288 }); +2289 +2290 let ep2_side = tokio::time::timeout(TIMEOUT, async move { +2291 let conn = ep2.connect(ep1_endpointaddr, TEST_ALPN).await?; +2292 let mut recv = conn.accept_uni().await.anyerr()?; +2293 wait_for_conn_type_direct(&ep2, ep1_endpointid).await?; +2294 let read = recv.read_to_end(100).await.anyerr()?; +2295 assert_eq!(read, b"Conn is direct".to_vec()); +2296 conn.close(0u32.into(), b"done"); +2297 conn.closed().await; +2298 Ok::<(), Error>(()) +2299 }); +2300 +2301 let res_ep1 = AbortOnDropHandle::new(tokio::spawn(ep1_side)); +2302 let res_ep2 = AbortOnDropHandle::new(tokio::spawn(ep2_side)); +2303 +2304 let (r1, r2) = tokio::try_join!(res_ep1, res_ep2).anyerr()?; +2305 r1.anyerr()??; +2306 r2.anyerr()??; +2307 +2308 Ok(()) +2309 } +2310 +2311 #[tokio::test] +2312 #[traced_test] +2313 async fn test_direct_addresses_no_qad_relay() -> Result { +2314 let (relay_map, _, _guard) = run_relay_server_with(false).await.unwrap(); +2315 +2316 let ep = Endpoint::empty_builder(RelayMode::Custom(relay_map)) +2317 .alpns(vec![TEST_ALPN.to_vec()]) +2318 .insecure_skip_relay_cert_verify(true) +2319 .bind() +2320 .await?; +2321 +2322 assert!(ep.addr().ip_addrs().count() > 0); +2323 +2324 Ok(()) +2325 } +2326 +2327 #[cfg_attr(target_os = "windows", ignore = "flaky")] +2328 #[tokio::test] +2329 #[traced_test] +2330 async fn graceful_close() -> Result { +2331 let client = Endpoint::empty_builder(RelayMode::Disabled).bind().await?; +2332 let server = Endpoint::empty_builder(RelayMode::Disabled) +2333 .alpns(vec![TEST_ALPN.to_vec()]) +2334 .bind() +2335 .await?; +2336 let server_addr = server.addr(); +2337 let server_task = tokio::spawn(async move { +2338 let incoming = server.accept().await.anyerr()?; +2339 let conn = incoming.await.anyerr()?; +2340 let (mut send, mut recv) = conn.accept_bi().await.anyerr()?; +2341 let msg = recv.read_to_end(1_000).await.anyerr()?; +2342 send.write_all(&msg).await.anyerr()?; +2343 send.finish().anyerr()?; +2344 let close_reason = conn.closed().await; +2345 Ok::<_, Error>(close_reason) +2346 }); +2347 +2348 let conn = client.connect(server_addr, TEST_ALPN).await?; +2349 let (mut send, mut recv) = conn.open_bi().await.anyerr()?; +2350 send.write_all(b"Hello, world!").await.anyerr()?; +2351 send.finish().anyerr()?; +2352 recv.read_to_end(1_000).await.anyerr()?; +2353 conn.close(42u32.into(), b"thanks, bye!"); +2354 client.close().await; +2355 +2356 let close_err = server_task.await.anyerr()??; +2357 let ConnectionError::ApplicationClosed(app_close) = close_err else { +2358 panic!("Unexpected close reason: {close_err:?}"); +2359 }; +2360 +2361 assert_eq!(app_close.error_code, 42u32.into()); +2362 assert_eq!(app_close.reason.as_ref(), b"thanks, bye!"); +2363 +2364 Ok(()) +2365 } +2366 +2367 #[cfg(feature = "metrics")] +2368 #[tokio::test] +2369 #[traced_test] +2370 async fn metrics_smoke() -> Result { +2371 use iroh_metrics::{MetricsSource, Registry}; 2372 -2373 Ok(()) -2374 } -2375 -2376 #[cfg(feature = "metrics")] -2377 #[tokio::test] -2378 #[traced_test] -2379 async fn metrics_smoke() -> Result { -2380 use iroh_metrics::{MetricsSource, Registry}; -2381 -2382 let secret_key = SecretKey::from_bytes(&[0u8; 32]); -2383 let client = Endpoint::empty_builder(RelayMode::Disabled) -2384 .secret_key(secret_key) -2385 .bind() -2386 .await?; -2387 let secret_key = SecretKey::from_bytes(&[1u8; 32]); -2388 let server = Endpoint::empty_builder(RelayMode::Disabled) -2389 .secret_key(secret_key) -2390 .alpns(vec![TEST_ALPN.to_vec()]) -2391 .bind() -2392 .await?; -2393 let server_addr = server.addr(); -2394 let server_task = tokio::task::spawn(async move { -2395 let conn = server.accept().await.anyerr()?.await.anyerr()?; -2396 let mut uni = conn.accept_uni().await.anyerr()?; -2397 uni.read_to_end(10).await.anyerr()?; -2398 drop(conn); -2399 Ok::<_, Error>(server) -2400 }); -2401 let conn = client.connect(server_addr, TEST_ALPN).await?; -2402 let mut uni = conn.open_uni().await.anyerr()?; -2403 uni.write_all(b"helloworld").await.anyerr()?; -2404 uni.finish().anyerr()?; -2405 conn.closed().await; -2406 drop(conn); -2407 let server = server_task.await.anyerr()??; -2408 -2409 let m = client.metrics(); -2410 assert_eq!(m.magicsock.num_direct_conns_added.get(), 1); -2411 assert_eq!(m.magicsock.connection_became_direct.get(), 1); -2412 assert_eq!(m.magicsock.connection_handshake_success.get(), 1); -2413 assert_eq!(m.magicsock.endpoints_contacted_directly.get(), 1); -2414 assert!(m.magicsock.recv_datagrams.get() > 0); -2415 -2416 let m = server.metrics(); -2417 assert_eq!(m.magicsock.num_direct_conns_added.get(), 1); -2418 assert_eq!(m.magicsock.connection_became_direct.get(), 1); -2419 assert_eq!(m.magicsock.endpoints_contacted_directly.get(), 1); -2420 assert_eq!(m.magicsock.connection_handshake_success.get(), 1); -2421 assert!(m.magicsock.recv_datagrams.get() > 0); -2422 -2423 // test openmetrics encoding with labeled subregistries per endpoint -2424 fn register_endpoint(registry: &mut Registry, endpoint: &Endpoint) { -2425 let id = endpoint.id().fmt_short(); -2426 let sub_registry = registry.sub_registry_with_label("id", id.to_string()); -2427 sub_registry.register_all(endpoint.metrics()); -2428 } -2429 let mut registry = Registry::default(); -2430 register_endpoint(&mut registry, &client); -2431 register_endpoint(&mut registry, &server); -2432 let s = registry.encode_openmetrics_to_string().anyerr()?; -2433 assert!(s.contains(r#"magicsock_endpoints_contacted_directly_total{id="3b6a27bcce"} 1"#)); -2434 assert!(s.contains(r#"magicsock_endpoints_contacted_directly_total{id="8a88e3dd74"} 1"#)); -2435 Ok(()) -2436 } -2437 -2438 /// Configures the accept side to take `accept_alpns` ALPNs, then connects to it with `primary_connect_alpn` -2439 /// with `secondary_connect_alpns` set, and finally returns the negotiated ALPN. -2440 async fn alpn_connection_test( -2441 accept_alpns: Vec<Vec<u8>>, -2442 primary_connect_alpn: &[u8], -2443 secondary_connect_alpns: Vec<Vec<u8>>, -2444 ) -> Result<Vec<u8>> { -2445 let client = Endpoint::empty_builder(RelayMode::Disabled).bind().await?; -2446 let server = Endpoint::empty_builder(RelayMode::Disabled) -2447 .alpns(accept_alpns) -2448 .bind() -2449 .await?; -2450 let server_addr = server.addr(); -2451 let server_task = tokio::spawn({ -2452 let server = server.clone(); -2453 async move { -2454 let incoming = server.accept().await.anyerr()?; -2455 let conn = incoming.await.anyerr()?; -2456 conn.close(0u32.into(), b"bye!"); -2457 n0_error::Ok(conn.alpn().to_vec()) -2458 } -2459 }); -2460 -2461 let conn = client -2462 .connect_with_opts( -2463 server_addr, -2464 primary_connect_alpn, -2465 ConnectOptions::new().with_additional_alpns(secondary_connect_alpns), -2466 ) -2467 .await?; -2468 let conn = conn.await.anyerr()?; -2469 let client_alpn = conn.alpn(); -2470 conn.closed().await; -2471 client.close().await; -2472 server.close().await; -2473 -2474 let server_alpn = server_task.await.anyerr()??; -2475 -2476 assert_eq!(client_alpn, server_alpn); +2373 let secret_key = SecretKey::from_bytes(&[0u8; 32]); +2374 let client = Endpoint::empty_builder(RelayMode::Disabled) +2375 .secret_key(secret_key) +2376 .bind() +2377 .await?; +2378 let secret_key = SecretKey::from_bytes(&[1u8; 32]); +2379 let server = Endpoint::empty_builder(RelayMode::Disabled) +2380 .secret_key(secret_key) +2381 .alpns(vec![TEST_ALPN.to_vec()]) +2382 .bind() +2383 .await?; +2384 let server_addr = server.addr(); +2385 let server_task = tokio::task::spawn(async move { +2386 let conn = server.accept().await.anyerr()?.await.anyerr()?; +2387 let mut uni = conn.accept_uni().await.anyerr()?; +2388 uni.read_to_end(10).await.anyerr()?; +2389 drop(conn); +2390 Ok::<_, Error>(server) +2391 }); +2392 let conn = client.connect(server_addr, TEST_ALPN).await?; +2393 let mut uni = conn.open_uni().await.anyerr()?; +2394 uni.write_all(b"helloworld").await.anyerr()?; +2395 uni.finish().anyerr()?; +2396 conn.closed().await; +2397 drop(conn); +2398 let server = server_task.await.anyerr()??; +2399 +2400 let m = client.metrics(); +2401 assert_eq!(m.magicsock.num_direct_conns_added.get(), 1); +2402 assert_eq!(m.magicsock.connection_became_direct.get(), 1); +2403 assert_eq!(m.magicsock.connection_handshake_success.get(), 1); +2404 assert_eq!(m.magicsock.endpoints_contacted_directly.get(), 1); +2405 assert!(m.magicsock.recv_datagrams.get() > 0); +2406 +2407 let m = server.metrics(); +2408 assert_eq!(m.magicsock.num_direct_conns_added.get(), 1); +2409 assert_eq!(m.magicsock.connection_became_direct.get(), 1); +2410 assert_eq!(m.magicsock.endpoints_contacted_directly.get(), 1); +2411 assert_eq!(m.magicsock.connection_handshake_success.get(), 1); +2412 assert!(m.magicsock.recv_datagrams.get() > 0); +2413 +2414 // test openmetrics encoding with labeled subregistries per endpoint +2415 fn register_endpoint(registry: &mut Registry, endpoint: &Endpoint) { +2416 let id = endpoint.id().fmt_short(); +2417 let sub_registry = registry.sub_registry_with_label("id", id.to_string()); +2418 sub_registry.register_all(endpoint.metrics()); +2419 } +2420 let mut registry = Registry::default(); +2421 register_endpoint(&mut registry, &client); +2422 register_endpoint(&mut registry, &server); +2423 let s = registry.encode_openmetrics_to_string().anyerr()?; +2424 assert!(s.contains(r#"magicsock_endpoints_contacted_directly_total{id="3b6a27bcce"} 1"#)); +2425 assert!(s.contains(r#"magicsock_endpoints_contacted_directly_total{id="8a88e3dd74"} 1"#)); +2426 Ok(()) +2427 } +2428 +2429 /// Configures the accept side to take `accept_alpns` ALPNs, then connects to it with `primary_connect_alpn` +2430 /// with `secondary_connect_alpns` set, and finally returns the negotiated ALPN. +2431 async fn alpn_connection_test( +2432 accept_alpns: Vec<Vec<u8>>, +2433 primary_connect_alpn: &[u8], +2434 secondary_connect_alpns: Vec<Vec<u8>>, +2435 ) -> Result<Vec<u8>> { +2436 let client = Endpoint::empty_builder(RelayMode::Disabled).bind().await?; +2437 let server = Endpoint::empty_builder(RelayMode::Disabled) +2438 .alpns(accept_alpns) +2439 .bind() +2440 .await?; +2441 let server_addr = server.addr(); +2442 let server_task = tokio::spawn({ +2443 let server = server.clone(); +2444 async move { +2445 let incoming = server.accept().await.anyerr()?; +2446 let conn = incoming.await.anyerr()?; +2447 conn.close(0u32.into(), b"bye!"); +2448 n0_error::Ok(conn.alpn().to_vec()) +2449 } +2450 }); +2451 +2452 let conn = client +2453 .connect_with_opts( +2454 server_addr, +2455 primary_connect_alpn, +2456 ConnectOptions::new().with_additional_alpns(secondary_connect_alpns), +2457 ) +2458 .await?; +2459 let conn = conn.await.anyerr()?; +2460 let client_alpn = conn.alpn(); +2461 conn.closed().await; +2462 client.close().await; +2463 server.close().await; +2464 +2465 let server_alpn = server_task.await.anyerr()??; +2466 +2467 assert_eq!(client_alpn, server_alpn); +2468 +2469 Ok(server_alpn.to_vec()) +2470 } +2471 +2472 #[tokio::test] +2473 #[traced_test] +2474 async fn connect_multiple_alpn_negotiated() -> Result { +2475 const ALPN_ONE: &[u8] = b"alpn/1"; +2476 const ALPN_TWO: &[u8] = b"alpn/2"; 2477 -2478 Ok(server_alpn.to_vec()) -2479 } -2480 -2481 #[tokio::test] -2482 #[traced_test] -2483 async fn connect_multiple_alpn_negotiated() -> Result { -2484 const ALPN_ONE: &[u8] = b"alpn/1"; -2485 const ALPN_TWO: &[u8] = b"alpn/2"; -2486 -2487 assert_eq!( -2488 alpn_connection_test( -2489 // Prefer version 2 over version 1 on the accept side -2490 vec![ALPN_TWO.to_vec(), ALPN_ONE.to_vec()], -2491 ALPN_TWO, -2492 vec![ALPN_ONE.to_vec()], -2493 ) -2494 .await?, -2495 ALPN_TWO.to_vec(), -2496 "accept side prefers version 2 over 1" -2497 ); -2498 -2499 assert_eq!( -2500 alpn_connection_test( -2501 // Only support the old version -2502 vec![ALPN_ONE.to_vec()], -2503 ALPN_TWO, -2504 vec![ALPN_ONE.to_vec()], -2505 ) -2506 .await?, -2507 ALPN_ONE.to_vec(), -2508 "accept side only supports the old version" -2509 ); -2510 -2511 assert_eq!( -2512 alpn_connection_test( -2513 vec![ALPN_TWO.to_vec(), ALPN_ONE.to_vec()], -2514 ALPN_ONE, -2515 vec![ALPN_TWO.to_vec()], -2516 ) -2517 .await?, -2518 ALPN_TWO.to_vec(), -2519 "connect side ALPN order doesn't matter" -2520 ); -2521 -2522 assert_eq!( -2523 alpn_connection_test(vec![ALPN_TWO.to_vec(), ALPN_ONE.to_vec()], ALPN_ONE, vec![],) -2524 .await?, -2525 ALPN_ONE.to_vec(), -2526 "connect side only supports the old version" -2527 ); -2528 -2529 Ok(()) -2530 } -2531 -2532 #[tokio::test] -2533 #[traced_test] -2534 async fn watch_net_report() -> Result { -2535 let endpoint = Endpoint::empty_builder(RelayMode::Staging).bind().await?; -2536 -2537 // can get a first report -2538 endpoint.net_report().updated().await.anyerr()?; -2539 -2540 Ok(()) -2541 } -2542 -2543 /// Tests that initial connection establishment isn't extremely slow compared -2544 /// to subsequent connections. -2545 /// -2546 /// This is a time based test, but uses a very large ratio to reduce flakiness. -2547 /// It also does a number of connections to average out any anomalies. -2548 #[tokio::test] -2549 #[traced_test] -2550 async fn connect_multi_time() -> Result { -2551 let n = 32; -2552 -2553 const NOOP_ALPN: &[u8] = b"noop"; -2554 -2555 #[derive(Debug, Clone)] -2556 struct Noop; -2557 -2558 impl ProtocolHandler for Noop { -2559 async fn accept(&self, connection: Connection) -> Result<(), AcceptError> { -2560 connection.closed().await; -2561 Ok(()) -2562 } -2563 } -2564 -2565 async fn noop_server() -> Result<(Router, EndpointAddr)> { -2566 let endpoint = Endpoint::empty_builder(RelayMode::Disabled) -2567 .bind() -2568 .await -2569 .anyerr()?; -2570 let addr = endpoint.addr(); -2571 let router = Router::builder(endpoint).accept(NOOP_ALPN, Noop).spawn(); -2572 Ok((router, addr)) -2573 } +2478 assert_eq!( +2479 alpn_connection_test( +2480 // Prefer version 2 over version 1 on the accept side +2481 vec![ALPN_TWO.to_vec(), ALPN_ONE.to_vec()], +2482 ALPN_TWO, +2483 vec![ALPN_ONE.to_vec()], +2484 ) +2485 .await?, +2486 ALPN_TWO.to_vec(), +2487 "accept side prefers version 2 over 1" +2488 ); +2489 +2490 assert_eq!( +2491 alpn_connection_test( +2492 // Only support the old version +2493 vec![ALPN_ONE.to_vec()], +2494 ALPN_TWO, +2495 vec![ALPN_ONE.to_vec()], +2496 ) +2497 .await?, +2498 ALPN_ONE.to_vec(), +2499 "accept side only supports the old version" +2500 ); +2501 +2502 assert_eq!( +2503 alpn_connection_test( +2504 vec![ALPN_TWO.to_vec(), ALPN_ONE.to_vec()], +2505 ALPN_ONE, +2506 vec![ALPN_TWO.to_vec()], +2507 ) +2508 .await?, +2509 ALPN_TWO.to_vec(), +2510 "connect side ALPN order doesn't matter" +2511 ); +2512 +2513 assert_eq!( +2514 alpn_connection_test(vec![ALPN_TWO.to_vec(), ALPN_ONE.to_vec()], ALPN_ONE, vec![],) +2515 .await?, +2516 ALPN_ONE.to_vec(), +2517 "connect side only supports the old version" +2518 ); +2519 +2520 Ok(()) +2521 } +2522 +2523 #[tokio::test] +2524 #[traced_test] +2525 async fn watch_net_report() -> Result { +2526 let endpoint = Endpoint::empty_builder(RelayMode::Staging).bind().await?; +2527 +2528 // can get a first report +2529 endpoint.net_report().updated().await.anyerr()?; +2530 +2531 Ok(()) +2532 } +2533 +2534 /// Tests that initial connection establishment isn't extremely slow compared +2535 /// to subsequent connections. +2536 /// +2537 /// This is a time based test, but uses a very large ratio to reduce flakiness. +2538 /// It also does a number of connections to average out any anomalies. +2539 #[tokio::test] +2540 #[traced_test] +2541 async fn connect_multi_time() -> Result { +2542 let n = 32; +2543 +2544 const NOOP_ALPN: &[u8] = b"noop"; +2545 +2546 #[derive(Debug, Clone)] +2547 struct Noop; +2548 +2549 impl ProtocolHandler for Noop { +2550 async fn accept(&self, connection: Connection) -> Result<(), AcceptError> { +2551 connection.closed().await; +2552 Ok(()) +2553 } +2554 } +2555 +2556 async fn noop_server() -> Result<(Router, EndpointAddr)> { +2557 let endpoint = Endpoint::empty_builder(RelayMode::Disabled) +2558 .bind() +2559 .await +2560 .anyerr()?; +2561 let addr = endpoint.addr(); +2562 let router = Router::builder(endpoint).accept(NOOP_ALPN, Noop).spawn(); +2563 Ok((router, addr)) +2564 } +2565 +2566 let routers = stream::iter(0..n) +2567 .map(|_| noop_server()) +2568 .buffered_unordered(32) +2569 .collect::<Vec<_>>() +2570 .await +2571 .into_iter() +2572 .collect::<Result<Vec<_>, _>>() +2573 .anyerr()?; 2574 -2575 let routers = stream::iter(0..n) -2576 .map(|_| noop_server()) -2577 .buffered_unordered(32) -2578 .collect::<Vec<_>>() -2579 .await -2580 .into_iter() -2581 .collect::<Result<Vec<_>, _>>() -2582 .anyerr()?; -2583 -2584 let addrs = routers -2585 .iter() -2586 .map(|(_, addr)| addr.clone()) -2587 .collect::<Vec<_>>(); -2588 let ids = addrs.iter().map(|addr| addr.id).collect::<Vec<_>>(); -2589 let discovery = StaticProvider::from_endpoint_info(addrs); -2590 let endpoint = Endpoint::empty_builder(RelayMode::Disabled) -2591 .discovery(discovery) -2592 .bind() -2593 .await -2594 .anyerr()?; -2595 // wait for the endpoint to be initialized. This should not be needed, -2596 // but we don't want to measure endpoint init time but connection time -2597 // from a fully initialized endpoint. -2598 endpoint.addr(); -2599 let t0 = Instant::now(); -2600 for id in &ids { -2601 let conn = endpoint.connect(*id, NOOP_ALPN).await?; -2602 conn.close(0u32.into(), b"done"); -2603 } -2604 let dt0 = t0.elapsed().as_secs_f64(); -2605 let t1 = Instant::now(); -2606 for id in &ids { -2607 let conn = endpoint.connect(*id, NOOP_ALPN).await?; -2608 conn.close(0u32.into(), b"done"); -2609 } -2610 let dt1 = t1.elapsed().as_secs_f64(); -2611 -2612 assert!(dt0 / dt1 < 20.0, "First round: {dt0}s, second round {dt1}s"); -2613 Ok(()) -2614 } -2615 -2616 // Not yet an actual test, only a demo. -2617 #[tokio::test] -2618 // #[traced_test] -2619 async fn watch_connections() -> Result { -2620 tracing_subscriber::fmt::init(); -2621 let alpn = b"asdf"; -2622 -2623 #[derive(Clone)] -2624 struct Monitor { -2625 tx: UnboundedSender<ConnectionInfo>, -2626 _task: Arc<AbortOnDropHandle<()>>, -2627 } -2628 -2629 impl ConnectionMonitor for Monitor { -2630 fn on_connection(&self, connection: ConnectionInfo) { -2631 self.tx.send(connection).ok(); -2632 } -2633 } -2634 -2635 impl Monitor { -2636 fn new() -> Self { -2637 let (tx, rx) = tokio::sync::mpsc::unbounded_channel(); -2638 let task = tokio::spawn(Self::run(rx).instrument(info_span!("watcher"))); -2639 Self { -2640 tx, -2641 _task: Arc::new(AbortOnDropHandle::new(task)), -2642 } -2643 } -2644 -2645 async fn run(mut rx: UnboundedReceiver<ConnectionInfo>) { -2646 let mut tasks = JoinSet::new(); -2647 loop { -2648 tokio::select! { -2649 Some(conn) = rx.recv() => { -2650 info!(remote=%conn.remote_id().fmt_short(), rtt=?conn.latency(), "new connection"); -2651 tasks.spawn(async move { -2652 match conn.closed().await { -2653 None => { -2654 info!(remote=%conn.remote_id.fmt_short(), "connection closed before tracking started"); -2655 } -2656 Some((close_reason, stats)) => { -2657 info!(remote=%conn.remote_id.fmt_short(), ?close_reason, udp_rx=stats.udp_rx.bytes, "connection closed"); -2658 } -2659 } -2660 }.instrument(tracing::Span::current())); -2661 } -2662 Some(res) = tasks.join_next(), if !tasks.is_empty() => { -2663 res.expect("conn close task panicked"); -2664 }, -2665 else => break, -2666 } -2667 while let Some(res) = tasks.join_next().await { -2668 res.expect("conn close task panicked"); -2669 } -2670 } -2671 } -2672 } -2673 -2674 let monitor = Monitor::new(); -2675 let server = Endpoint::empty_builder(RelayMode::Disabled) -2676 .alpns(vec![alpn.to_vec()]) -2677 .monitor_connections(monitor.clone()) -2678 .bind() -2679 .await?; -2680 let server_addr = server.addr(); -2681 let server_task = tokio::spawn(async move { -2682 let mut tasks = Vec::new(); -2683 while let Some(conn) = server.accept().await { -2684 let conn = conn.await?; -2685 let handle = tokio::spawn(async move { -2686 conn.close(0u32.into(), b""); -2687 }); -2688 tasks.push(AbortOnDropHandle::new(handle)); -2689 } -2690 n0_error::Ok(()) -2691 }); -2692 -2693 let client = Endpoint::empty_builder(RelayMode::Disabled).bind().await?; -2694 let conn1 = client.connect(server_addr.clone(), alpn).await?; -2695 let conn2 = client.connect(server_addr.clone(), alpn).await?; -2696 conn1.closed().await; -2697 conn2.closed().await; -2698 drop(client); -2699 tokio::time::sleep(Duration::from_secs(1)).await; -2700 server_task.abort(); -2701 -2702 Ok(()) -2703 } -2704}
    \ No newline at end of file +2575 let addrs = routers +2576 .iter() +2577 .map(|(_, addr)| addr.clone()) +2578 .collect::<Vec<_>>(); +2579 let ids = addrs.iter().map(|addr| addr.id).collect::<Vec<_>>(); +2580 let discovery = StaticProvider::from_endpoint_info(addrs); +2581 let endpoint = Endpoint::empty_builder(RelayMode::Disabled) +2582 .discovery(discovery) +2583 .bind() +2584 .await +2585 .anyerr()?; +2586 // wait for the endpoint to be initialized. This should not be needed, +2587 // but we don't want to measure endpoint init time but connection time +2588 // from a fully initialized endpoint. +2589 endpoint.addr(); +2590 let t0 = Instant::now(); +2591 for id in &ids { +2592 let conn = endpoint.connect(*id, NOOP_ALPN).await?; +2593 conn.close(0u32.into(), b"done"); +2594 } +2595 let dt0 = t0.elapsed().as_secs_f64(); +2596 let t1 = Instant::now(); +2597 for id in &ids { +2598 let conn = endpoint.connect(*id, NOOP_ALPN).await?; +2599 conn.close(0u32.into(), b"done"); +2600 } +2601 let dt1 = t1.elapsed().as_secs_f64(); +2602 +2603 assert!(dt0 / dt1 < 20.0, "First round: {dt0}s, second round {dt1}s"); +2604 Ok(()) +2605 } +2606}
    \ No newline at end of file diff --git a/pr/3610/docs/trait.impl/core/convert/trait.From.js b/pr/3610/docs/trait.impl/core/convert/trait.From.js index 0cebe6b8f8..34a5306f46 100644 --- a/pr/3610/docs/trait.impl/core/convert/trait.From.js +++ b/pr/3610/docs/trait.impl/core/convert/trait.From.js @@ -1,9 +1,9 @@ (function() { - var implementors = Object.fromEntries([["iroh",[["impl From<DiscoveryError> for AnyError"],["impl From<IntoDiscoveryError> for BindError"],["impl From<IntoDiscoveryError> for AnyError"],["impl From<PkarrError> for DiscoveryError"],["impl From<PkarrError> for AnyError"],["impl From<AddEndpointAddrError> for ConnectWithOptsError"],["impl From<AddEndpointAddrError> for AnyError"],["impl From<AlpnError> for AnyError"],["impl From<AuthenticationError> for ConnectingError"],["impl From<AuthenticationError> for AnyError"],["impl From<BindError> for AnyError"],["impl From<ConnectError> for AnyError"],["impl From<ConnectWithOptsError> for ConnectError"],["impl From<ConnectWithOptsError> for AnyError"],["impl From<ConnectingError> for ConnectError"],["impl From<ConnectingError> for AcceptError"],["impl From<ConnectingError> for AnyError"],["impl From<ConnectionError> for AlpnError"],["impl From<ConnectionError> for AuthenticationError"],["impl From<ConnectionError> for ConnectError"],["impl From<ConnectionError> for ConnectingError"],["impl From<ConnectionError> for AcceptError"],["impl From<GetMappingAddressError> for ConnectWithOptsError"],["impl From<GetMappingAddressError> for AnyError"],["impl From<AcceptError> for AnyError"],["impl From<Error> for AcceptError"],["impl From<DiscoveryItem> for EndpointInfo"],["impl From<ClosedStream> for AcceptError"],["impl From<RemoteEndpointIdError> for AuthenticationError"],["impl From<RemoteEndpointIdError> for AcceptError"],["impl From<RemoteEndpointIdError> for AnyError"],["impl From<AnyError> for AcceptError"],["impl From<ConnectError> for ConnectWithOptsError"],["impl<T> From<T> for ConcurrentDiscovery
    where\n T: IntoIterator<Item = Box<dyn Discovery>>,
    "],["impl<T: ProtocolHandler> From<T> for Box<dyn DynProtocolHandler>"]]],["iroh_base",[["impl From<KeyParsingError> for AnyError"],["impl From<Url> for RelayUrl"],["impl From<PublicKey> for EndpointAddr"],["impl From<RelayUrl> for Url"],["impl From<RelayUrlParseError> for AnyError"],["impl From<SignatureError> for AnyError"],["impl From<DecodeError> for KeyParsingError"],["impl From<Error> for KeyParsingError"],["impl From<[u8; 32]> for SecretKey"]]],["iroh_relay",[["impl From<KeyParsingError> for Error"],["impl From<ConnectError> for AnyError"],["impl From<DialError> for ConnectError"],["impl From<DialError> for AnyError"],["impl From<RecvError> for AnyError"],["impl From<SendError> for AnyError"],["impl From<DnsError> for DialError"],["impl From<DnsError> for LookupError"],["impl From<DnsError> for AnyError"],["impl From<LookupError> for AnyError"],["impl From<DecodingError> for ParseError"],["impl From<DecodingError> for AnyError"],["impl From<EncodingError> for AnyError"],["impl From<ParseError> for LookupError"],["impl From<ParseError> for AnyError"],["impl From<FrameType> for u32"],["impl From<FrameType> for VarInt"],["impl From<FrameTypeError> for Error"],["impl From<FrameTypeError> for Error"],["impl From<FrameTypeError> for AnyError"],["impl From<Error> for ConnectError"],["impl From<Error> for AnyError"],["impl From<Error> for RecvError"],["impl From<Error> for AnyError"],["impl From<Error> for AnyError"],["impl From<SpawnError> for AnyError"],["impl From<SupervisorError> for AnyError"],["impl From<Vec<Box<[u8]>>> for TxtRecordData"],["impl From<Utf8Error> for ParseError"],["impl From<Utf8Error> for Error"],["impl From<Error> for ConnectError"],["impl From<Error> for DialError"],["impl From<EndpointAddr> for EndpointData"],["impl From<EndpointAddr> for EndpointInfo"],["impl From<RelayUrl> for RelayConfig"],["impl From<RelayUrl> for RelayMap"],["impl From<EndpointInfo> for EndpointAddr"],["impl From<MaxLengthExceededError> for AnyError"],["impl From<RelayConfig> for RelayMap"],["impl From<ConnectError> for Error"],["impl From<ConnectionError> for Error"],["impl From<Elapsed> for DialError"],["impl From<Elapsed> for DnsError"],["impl From<Error> for ConnectError"],["impl From<Error> for ConnectError"],["impl From<Error> for DialError"],["impl From<Error> for RecvError"],["impl From<Error> for SendError"],["impl From<Error> for Error"],["impl From<Error> for Error"],["impl From<JoinError> for SupervisorError"],["impl From<RecvError> for Error"],["impl From<ResolveError> for DnsError"],["impl<E: StackError + 'static> From<StaggeredError<E>> for AnyError"],["impl<T: AsRef<[u8]>> From<T> for Datagrams"]]]]); + var implementors = Object.fromEntries([["iroh",[["impl From<DiscoveryError> for AnyError"],["impl From<IntoDiscoveryError> for BindError"],["impl From<IntoDiscoveryError> for AnyError"],["impl From<PkarrError> for DiscoveryError"],["impl From<PkarrError> for AnyError"],["impl From<AddEndpointAddrError> for ConnectWithOptsError"],["impl From<AddEndpointAddrError> for AnyError"],["impl From<AlpnError> for AnyError"],["impl From<AuthenticationError> for ConnectingError"],["impl From<AuthenticationError> for AnyError"],["impl From<BindError> for AnyError"],["impl From<ConnectError> for AnyError"],["impl From<ConnectWithOptsError> for ConnectError"],["impl From<ConnectWithOptsError> for AnyError"],["impl From<ConnectingError> for ConnectError"],["impl From<ConnectingError> for AcceptError"],["impl From<ConnectingError> for AnyError"],["impl From<ConnectionError> for AlpnError"],["impl From<ConnectionError> for AuthenticationError"],["impl From<ConnectionError> for ConnectError"],["impl From<ConnectionError> for ConnectingError"],["impl From<ConnectionError> for AcceptError"],["impl From<GetMappingAddressError> for ConnectWithOptsError"],["impl From<GetMappingAddressError> for AnyError"],["impl From<AcceptError> for AnyError"],["impl From<Error> for AcceptError"],["impl From<DiscoveryItem> for EndpointInfo"],["impl From<ClosedStream> for AcceptError"],["impl From<RemoteEndpointIdError> for AuthenticationError"],["impl From<RemoteEndpointIdError> for AcceptError"],["impl From<RemoteEndpointIdError> for AnyError"],["impl From<AnyError> for AcceptError"],["impl From<ConnectError> for ConnectWithOptsError"],["impl<T> From<T> for ConcurrentDiscovery
    where\n T: IntoIterator<Item = Box<dyn Discovery>>,
    "],["impl<T: ProtocolHandler> From<T> for Box<dyn DynProtocolHandler>"]]],["iroh_base",[["impl From<KeyParsingError> for AnyError"],["impl From<Url> for RelayUrl"],["impl From<PublicKey> for EndpointAddr"],["impl From<RelayUrl> for Url"],["impl From<RelayUrlParseError> for AnyError"],["impl From<SignatureError> for AnyError"],["impl From<DecodeError> for KeyParsingError"],["impl From<Error> for KeyParsingError"],["impl From<[u8; 32]> for SecretKey"]]],["iroh_relay",[["impl From<ConnectError> for AnyError"],["impl From<DialError> for ConnectError"],["impl From<DialError> for AnyError"],["impl From<RecvError> for AnyError"],["impl From<SendError> for AnyError"],["impl From<DnsError> for DialError"],["impl From<DnsError> for LookupError"],["impl From<DnsError> for AnyError"],["impl From<LookupError> for AnyError"],["impl From<DecodingError> for ParseError"],["impl From<DecodingError> for AnyError"],["impl From<EncodingError> for AnyError"],["impl From<ParseError> for LookupError"],["impl From<ParseError> for AnyError"],["impl From<FrameType> for u32"],["impl From<FrameType> for VarInt"],["impl From<FrameTypeError> for Error"],["impl From<FrameTypeError> for Error"],["impl From<FrameTypeError> for AnyError"],["impl From<Error> for ConnectError"],["impl From<Error> for AnyError"],["impl From<Error> for RecvError"],["impl From<Error> for AnyError"],["impl From<Error> for AnyError"],["impl From<SpawnError> for AnyError"],["impl From<SupervisorError> for AnyError"],["impl From<Vec<Box<[u8]>>> for TxtRecordData"],["impl From<Utf8Error> for ParseError"],["impl From<Utf8Error> for Error"],["impl From<Error> for ConnectError"],["impl From<Error> for DialError"],["impl From<EndpointInfo> for EndpointAddr"],["impl From<MaxLengthExceededError> for AnyError"],["impl From<RelayConfig> for RelayMap"],["impl From<ConnectError> for Error"],["impl From<ConnectionError> for Error"],["impl From<Elapsed> for DialError"],["impl From<Elapsed> for DnsError"],["impl From<EndpointAddr> for EndpointData"],["impl From<EndpointAddr> for EndpointInfo"],["impl From<Error> for ConnectError"],["impl From<Error> for ConnectError"],["impl From<Error> for DialError"],["impl From<Error> for RecvError"],["impl From<Error> for SendError"],["impl From<Error> for Error"],["impl From<Error> for Error"],["impl From<JoinError> for SupervisorError"],["impl From<KeyParsingError> for Error"],["impl From<RecvError> for Error"],["impl From<RelayUrl> for RelayConfig"],["impl From<RelayUrl> for RelayMap"],["impl From<ResolveError> for DnsError"],["impl<E: StackError + 'static> From<StaggeredError<E>> for AnyError"],["impl<T: AsRef<[u8]>> From<T> for Datagrams"]]]]); if (window.register_implementors) { window.register_implementors(implementors); } else { window.pending_implementors = implementors; } })() -//{"start":57,"fragment_lengths":[13657,3090,19611]} \ No newline at end of file +//{"start":57,"fragment_lengths":[13657,3090,18835]} \ No newline at end of file diff --git a/pr/3610/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js b/pr/3610/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js index 6823ee20ab..53eb8f19b7 100644 --- a/pr/3610/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js +++ b/pr/3610/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js @@ -1,9 +1,9 @@ (function() { - var implementors = Object.fromEntries([["iroh_relay",[["impl FromIterator<Box<[u8]>> for TxtRecordData"],["impl FromIterator<Arc<RelayConfig>> for RelayMap"],["impl FromIterator<RelayUrl> for RelayMap"],["impl FromIterator<RelayConfig> for RelayMap"]]]]); + var implementors = Object.fromEntries([["iroh_relay",[["impl FromIterator<Box<[u8]>> for TxtRecordData"],["impl FromIterator<Arc<RelayConfig>> for RelayMap"],["impl FromIterator<RelayConfig> for RelayMap"],["impl FromIterator<RelayUrl> for RelayMap"]]]]); if (window.register_implementors) { window.register_implementors(implementors); } else { window.pending_implementors = implementors; } })() -//{"start":57,"fragment_lengths":[2062]} \ No newline at end of file +//{"start":57,"fragment_lengths":[1940]} \ No newline at end of file