diff --git a/pr/3488/docs/iroh/endpoint/index.html b/pr/3488/docs/iroh/endpoint/index.html index b373895ed9..81d6eeddf4 100644 --- a/pr/3488/docs/iroh/endpoint/index.html +++ b/pr/3488/docs/iroh/endpoint/index.html @@ -1,4 +1,4 @@ -iroh::endpoint - Rust

Module endpoint

Source
Expand description

The Endpoint allows establishing connections to other iroh nodes.

+iroh::endpoint - Rust

Module endpoint

Source
Expand description

The Endpoint allows establishing connections to other iroh nodes.

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

diff --git a/pr/3488/docs/iroh/endpoint/struct.Endpoint.html b/pr/3488/docs/iroh/endpoint/struct.Endpoint.html index d977be96f9..5723d10256 100644 --- a/pr/3488/docs/iroh/endpoint/struct.Endpoint.html +++ b/pr/3488/docs/iroh/endpoint/struct.Endpoint.html @@ -26,7 +26,7 @@ Note that this overrides the current list of ALPNs.

alpn: &[u8], ) -> Result<Connection, ConnectError>

Connects to a remote Endpoint.

A value that can be converted into a NodeAddr is required. This can be either a -NodeAddr, a NodeId or a [iroh_base::ticket::NodeTicket].

+NodeAddr, a NodeId or a iroh_base::ticket::NodeTicket.

The NodeAddr must contain the NodeId to dial and may also contain a RelayUrl and direct addresses. If direct addresses are provided, they will be used to try and establish a direct connection without involving a relay server.

diff --git a/pr/3488/docs/iroh/enum.KeyParsingError.html b/pr/3488/docs/iroh/enum.KeyParsingError.html index 87685ad6a5..7657cd5f2a 100644 --- a/pr/3488/docs/iroh/enum.KeyParsingError.html +++ b/pr/3488/docs/iroh/enum.KeyParsingError.html @@ -1,4 +1,4 @@ -KeyParsingError in iroh - Rust

Enum KeyParsingError

pub enum KeyParsingError {
+KeyParsingError in iroh - Rust

Enum KeyParsingError

Source
pub enum KeyParsingError {
     Decode {
         source: DecodeError,
         backtrace: Option<Backtrace>,
@@ -17,14 +17,14 @@
 

Variants§

§

Decode

Error when decoding.

Fields

§source: DecodeError
§backtrace: Option<Backtrace>
§span_trace: SpanTrace
§

Key

Error when decoding the public key.

Fields

§source: Error
§backtrace: Option<Backtrace>
§span_trace: SpanTrace
§

DecodeInvalidLength

The encoded information had the wrong length.

-

Fields

§backtrace: Option<Backtrace>
§span_trace: SpanTrace

Trait Implementations§

§

impl Debug for KeyParsingError

§

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

Formats the value using the given formatter. Read more
§

impl Display for KeyParsingError

§

fn fmt( +

Fields

§backtrace: Option<Backtrace>
§span_trace: SpanTrace

Trait Implementations§

Source§

impl Debug for KeyParsingError

Source§

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

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

impl Display for KeyParsingError

Source§

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

Formats the value using the given formatter. Read more
§

impl Error for KeyParsingError

§

fn description(&self) -> &str

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

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

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

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

Returns the lower-level source of this error, if any. Read more
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
§

impl ErrorCompat for KeyParsingError

§

fn backtrace(&self) -> Option<&Backtrace>

Returns a [Backtrace][] that may be printed.
§

fn iter_chain(&self) -> ChainCompat<'_, '_>
where +) -> Result<(), Error>

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

impl Error for KeyParsingError

Source§

fn description(&self) -> &str

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

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

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

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

Returns the lower-level source of this error, if any. Read more
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 ErrorCompat for KeyParsingError

Source§

fn backtrace(&self) -> Option<&Backtrace>

Returns a [Backtrace][] that may be printed.
§

fn iter_chain(&self) -> ChainCompat<'_, '_>
where Self: AsErrorSource,

Returns an iterator for traversing the chain of errors, starting with the current error -and continuing with recursive calls to Error::source. Read more
§

impl From<DecodeError> for KeyParsingError

§

fn from(error: DecodeError) -> KeyParsingError

Converts to this type from the input type.
§

impl From<Error> for KeyParsingError

§

fn from(error: Error) -> KeyParsingError

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where +and continuing with recursive calls to Error::source. Read more

Source§

impl From<DecodeError> for KeyParsingError

Source§

fn from(error: DecodeError) -> KeyParsingError

Converts to this type from the input type.
Source§

impl From<Error> for KeyParsingError

Source§

fn from(error: Error) -> KeyParsingError

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for KeyParsingError

§

impl !RefUnwindSafe for KeyParsingError

§

impl Send for KeyParsingError

§

impl Sync for KeyParsingError

§

impl Unpin for KeyParsingError

§

impl !UnwindSafe for KeyParsingError

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<T> AsErrorSource for T
where T: Error + 'static,

§

fn as_error_source(&self) -> &(dyn Error + 'static)

For maximum effectiveness, this needs to be called as a method to benefit from Rust’s automatic dereferencing of method diff --git a/pr/3488/docs/iroh/struct.NodeAddr.html b/pr/3488/docs/iroh/struct.NodeAddr.html index 1dc72a5f9e..2e22b4a2dc 100644 --- a/pr/3488/docs/iroh/struct.NodeAddr.html +++ b/pr/3488/docs/iroh/struct.NodeAddr.html @@ -1,4 +1,4 @@ -NodeAddr in iroh - Rust

Struct NodeAddr

pub struct NodeAddr {
+NodeAddr in iroh - Rust

Struct NodeAddr

Source
pub struct NodeAddr {
     pub node_id: PublicKey,
     pub relay_url: Option<RelayUrl>,
     pub direct_addresses: BTreeSet<SocketAddr>,
@@ -27,39 +27,39 @@ whenever a connection to other nodes needs to be established.

Fields§

§node_id: PublicKey

The node’s identifier.

§relay_url: Option<RelayUrl>

The node’s home relay url.

§direct_addresses: BTreeSet<SocketAddr>

Socket addresses where the peer might be reached directly.

-

Implementations§

§

impl NodeAddr

pub fn new(node_id: PublicKey) -> NodeAddr

Creates a new NodeAddr with no relay_url and no direct_addresses.

-

pub fn with_relay_url(self, relay_url: RelayUrl) -> NodeAddr

Adds a relay url.

-

pub fn with_direct_addresses( +

Implementations§

Source§

impl NodeAddr

Source

pub fn new(node_id: PublicKey) -> NodeAddr

Creates a new NodeAddr with no relay_url and no direct_addresses.

+
Source

pub fn with_relay_url(self, relay_url: RelayUrl) -> NodeAddr

Adds a relay url.

+
Source

pub fn with_direct_addresses( self, addresses: impl IntoIterator<Item = SocketAddr>, ) -> NodeAddr

Adds the given direct addresses.

-

pub fn from_parts( +

Source

pub fn from_parts( node_id: PublicKey, relay_url: Option<RelayUrl>, direct_addresses: impl IntoIterator<Item = SocketAddr>, ) -> NodeAddr

Creates a new NodeAddr from its parts.

-

pub fn is_empty(&self) -> bool

Returns true, if only a NodeId is present.

-

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

Returns the direct addresses of this peer.

-

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

Returns the relay url of this peer.

-

Trait Implementations§

§

impl Clone for NodeAddr

§

fn clone(&self) -> NodeAddr

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

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

Performs copy-assignment from source. Read more
§

impl Debug for NodeAddr

§

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

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for NodeAddr

§

fn deserialize<__D>( +

Source

pub fn is_empty(&self) -> bool

Returns true, if only a NodeId is present.

+
Source

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

Returns the direct addresses of this peer.

+
Source

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

Returns the relay url of this peer.

+

Trait Implementations§

Source§

impl Clone for NodeAddr

Source§

fn clone(&self) -> NodeAddr

Returns a copy 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 NodeAddr

Source§

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

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

impl<'de> Deserialize<'de> for NodeAddr

Source§

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

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

impl From<(PublicKey, Option<RelayUrl>, &[SocketAddr])> for NodeAddr

§

fn from(value: (PublicKey, Option<RelayUrl>, &[SocketAddr])) -> NodeAddr

Converts to this type from the input type.
Source§

impl From<NodeAddr> for NodeData

Source§

fn from(node_addr: NodeAddr) -> NodeData

Converts to this type from the input type.
Source§

impl From<NodeAddr> for NodeInfo

Source§

fn from(addr: NodeAddr) -> NodeInfo

Converts to this type from the input type.
Source§

impl From<NodeInfo> for NodeAddr

Source§

fn from(value: NodeInfo) -> NodeAddr

Converts to this type from the input type.
§

impl From<NodeTicket> for NodeAddr

§

fn from(ticket: NodeTicket) -> NodeAddr

Returns the addressing info from given ticket.

-
§

impl From<PublicKey> for NodeAddr

§

fn from(node_id: PublicKey) -> NodeAddr

Converts to this type from the input type.
§

impl Hash for NodeAddr

§

fn hash<__H>(&self, state: &mut __H)
where + __D: Deserializer<'de>,

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

impl From<(PublicKey, Option<RelayUrl>, &[SocketAddr])> for NodeAddr

Source§

fn from(value: (PublicKey, Option<RelayUrl>, &[SocketAddr])) -> NodeAddr

Converts to this type from the input type.
Source§

impl From<NodeAddr> for NodeData

Source§

fn from(node_addr: NodeAddr) -> NodeData

Converts to this type from the input type.
Source§

impl From<NodeAddr> for NodeInfo

Source§

fn from(addr: NodeAddr) -> NodeInfo

Converts to this type from the input type.
Source§

impl From<NodeInfo> for NodeAddr

Source§

fn from(value: NodeInfo) -> NodeAddr

Converts to this type from the input type.
Source§

impl From<NodeTicket> for NodeAddr

Source§

fn from(ticket: NodeTicket) -> NodeAddr

Returns the addressing info from given ticket.

+
Source§

impl From<PublicKey> for NodeAddr

Source§

fn from(node_id: PublicKey) -> NodeAddr

Converts to this type from the input type.
Source§

impl Hash for NodeAddr

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, - Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl Ord for NodeAddr

§

fn cmp(&self, other: &NodeAddr) -> 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,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for NodeAddr

Source§

fn cmp(&self, other: &NodeAddr) -> 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
§

impl PartialEq for NodeAddr

§

fn eq(&self, other: &NodeAddr) -> 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.
§

impl PartialOrd for NodeAddr

§

fn partial_cmp(&self, other: &NodeAddr) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the + Self: Sized,
Restrict a value to a certain interval. Read more
Source§

impl PartialEq for NodeAddr

Source§

fn eq(&self, other: &NodeAddr) -> 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 PartialOrd for NodeAddr

Source§

fn partial_cmp(&self, other: &NodeAddr) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by -the >= operator. Read more
§

impl Serialize for NodeAddr

§

fn serialize<__S>( +the >= operator. Read more

Source§

impl Serialize for NodeAddr

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where - __S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl Eq for NodeAddr

§

impl StructuralPartialEq for NodeAddr

Auto Trait Implementations§

§

impl Freeze for NodeAddr

§

impl RefUnwindSafe for NodeAddr

§

impl Send for NodeAddr

§

impl Sync for NodeAddr

§

impl Unpin for NodeAddr

§

impl UnwindSafe for NodeAddr

Blanket Implementations§

Source§

impl<T> Any for T
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for NodeAddr

Source§

impl StructuralPartialEq for NodeAddr

Auto Trait Implementations§

§

impl Freeze for NodeAddr

§

impl RefUnwindSafe for NodeAddr

§

impl Send for NodeAddr

§

impl Sync for NodeAddr

§

impl Unpin for NodeAddr

§

impl UnwindSafe for NodeAddr

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/3488/docs/iroh/struct.PublicKey.html b/pr/3488/docs/iroh/struct.PublicKey.html index 9721fd4ad4..c5897f6c4b 100644 --- a/pr/3488/docs/iroh/struct.PublicKey.html +++ b/pr/3488/docs/iroh/struct.PublicKey.html @@ -1,18 +1,18 @@ -PublicKey in iroh - Rust

Struct PublicKey

pub struct PublicKey(/* private fields */);
Expand description

A public key.

+PublicKey in iroh - Rust

Struct PublicKey

Source
pub struct PublicKey(/* private fields */);
Expand description

A public key.

The key itself is stored as the CompressedEdwards y coordinate of the public key It is verified to decompress into a valid key when created.

-

Implementations§

§

impl PublicKey

pub const LENGTH: usize = 32usize

The length of an ed25519 PublicKey, in bytes.

-

pub fn as_bytes(&self) -> &[u8; 32]

Get this public key as a byte array.

-

pub fn public(&self) -> VerifyingKey

Returns the [VerifyingKey] for this PublicKey.

-

pub fn from_bytes(bytes: &[u8; 32]) -> Result<PublicKey, Error>

Construct a PublicKey from a slice of bytes.

+

Implementations§

Source§

impl PublicKey

Source

pub const LENGTH: usize = 32usize

The length of an ed25519 PublicKey, in bytes.

+
Source

pub fn as_bytes(&self) -> &[u8; 32]

Get this public key as a byte array.

+
Source

pub fn public(&self) -> VerifyingKey

Returns the [VerifyingKey] for this PublicKey.

+
Source

pub fn from_bytes(bytes: &[u8; 32]) -> Result<PublicKey, Error>

Construct a PublicKey from a slice of bytes.

§Warning

This will return a [SignatureError] if the bytes passed into this method do not represent a valid ed25519_dalek curve point. Will never fail for bytes return from Self::as_bytes. See [VerifyingKey::from_bytes] for details.

-

pub fn verify(&self, message: &[u8], signature: &Signature) -> Result<(), Error>

Verify a signature on a message with this secret key’s public key.

+
Source

pub fn verify(&self, message: &[u8], signature: &Signature) -> Result<(), Error>

Verify a signature on a message with this secret key’s public key.

§Return

Returns Ok(()) if the signature is valid, and Err otherwise.

-

pub fn fmt_short(&self) -> impl Display + 'static

Convert to a hex string limited to the first 5 bytes for a friendly string +

Source

pub fn fmt_short(&self) -> impl Display + 'static

Convert to a hex string limited to the first 5 bytes for a friendly string representation of the key.

Methods from Deref<Target = [u8; 32]>§

Source

pub fn as_ascii(&self) -> Option<&[AsciiChar; N]>

🔬This is a nightly-only experimental API. (ascii_char)

Converts this array of bytes into an array of ASCII characters, or returns None if any of the characters is non-ASCII.

@@ -101,30 +101,30 @@ indices from [N - M, N) (excluding the index N itself) assert_eq!(left, &[]); assert_eq!(right, &[1, 2, 3, 4, 5, 6]); }
-

Trait Implementations§

§

impl AsRef<[u8]> for PublicKey

§

fn as_ref(&self) -> &[u8] ⓘ

Converts this type into a shared reference of the (usually inferred) input type.
§

impl Borrow<[u8; 32]> for PublicKey

§

fn borrow(&self) -> &[u8; 32]

Immutably borrows from an owned value. Read more
§

impl Clone for PublicKey

§

fn clone(&self) -> PublicKey

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

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

Performs copy-assignment from source. Read more
§

impl Debug for PublicKey

§

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

Formats the value using the given formatter. Read more
§

impl Deref for PublicKey

§

type Target = [u8; 32]

The resulting type after dereferencing.
§

fn deref(&self) -> &<PublicKey as Deref>::Target

Dereferences the value.
§

impl<'de> Deserialize<'de> for PublicKey

§

fn deserialize<D>( +

Trait Implementations§

Source§

impl AsRef<[u8]> for PublicKey

Source§

fn as_ref(&self) -> &[u8] ⓘ

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Borrow<[u8; 32]> for PublicKey

Source§

fn borrow(&self) -> &[u8; 32]

Immutably borrows from an owned value. Read more
Source§

impl Clone for PublicKey

Source§

fn clone(&self) -> PublicKey

Returns a copy 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 PublicKey

Source§

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

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

impl Deref for PublicKey

Source§

type Target = [u8; 32]

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<PublicKey as Deref>::Target

Dereferences the value.
Source§

impl<'de> Deserialize<'de> for PublicKey

Source§

fn deserialize<D>( deserializer: D, ) -> Result<PublicKey, <D as Deserializer<'de>>::Error>
where - D: Deserializer<'de>,

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

impl Display for PublicKey

§

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

Formats the value using the given formatter. Read more
§

impl From<PublicKey> for NodeAddr

§

fn from(node_id: PublicKey) -> NodeAddr

Converts to this type from the input type.
§

impl From<VerifyingKey> for PublicKey

§

fn from(verifying_key: VerifyingKey) -> PublicKey

Converts to this type from the input type.
§

impl FromStr for PublicKey

Deserialises the PublicKey from it’s base32 encoding.

+ D: Deserializer<'de>,

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

impl Display for PublicKey

Source§

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

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

impl From<PublicKey> for NodeAddr

Source§

fn from(node_id: PublicKey) -> NodeAddr

Converts to this type from the input type.
Source§

impl From<VerifyingKey> for PublicKey

Source§

fn from(verifying_key: VerifyingKey) -> PublicKey

Converts to this type from the input type.
Source§

impl FromStr for PublicKey

Deserialises the PublicKey from it’s base32 encoding.

Display is capable of serialising this format.

-
§

type Err = KeyParsingError

The associated error which can be returned from parsing.
§

fn from_str(s: &str) -> Result<PublicKey, <PublicKey as FromStr>::Err>

Parses a string s to return a value of this type. Read more
§

impl Hash for PublicKey

§

fn hash<H>(&self, state: &mut H)
where +
Source§

type Err = KeyParsingError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<PublicKey, <PublicKey as FromStr>::Err>

Parses a string s to return a value of this type. Read more

Source§

impl Hash for PublicKey

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, - Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl NodeIdExt for PublicKey

Source§

fn to_z32(&self) -> String

Encodes a NodeId in [z-base-32] encoding.
Source§

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

Parses a NodeId from [z-base-32] encoding.
§

impl Ord for PublicKey

§

fn cmp(&self, other: &PublicKey) -> 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,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl NodeIdExt for PublicKey

Source§

fn to_z32(&self) -> String

Encodes a NodeId in [z-base-32] encoding.
Source§

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

Parses a NodeId from [z-base-32] encoding.
Source§

impl Ord for PublicKey

Source§

fn cmp(&self, other: &PublicKey) -> 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
§

impl PartialEq for PublicKey

§

fn eq(&self, other: &PublicKey) -> 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.
§

impl PartialOrd for PublicKey

§

fn partial_cmp(&self, other: &PublicKey) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the + Self: Sized,
Restrict a value to a certain interval. Read more
Source§

impl PartialEq for PublicKey

Source§

fn eq(&self, other: &PublicKey) -> 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 PartialOrd for PublicKey

Source§

fn partial_cmp(&self, other: &PublicKey) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by -the >= operator. Read more
§

impl Serialize for PublicKey

§

fn serialize<S>( +the >= operator. Read more

Source§

impl Serialize for PublicKey

Source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where - S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl TryFrom<&[u8]> for PublicKey

§

type Error = Error

The type returned in the event of a conversion error.
§

fn try_from( + S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<&[u8]> for PublicKey

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from( bytes: &[u8], -) -> Result<PublicKey, <PublicKey as TryFrom<&[u8]>>::Error>

Performs the conversion.
§

impl TryFrom<&[u8; 32]> for PublicKey

§

type Error = Error

The type returned in the event of a conversion error.
§

fn try_from( +) -> Result<PublicKey, <PublicKey as TryFrom<&[u8]>>::Error>

Performs the conversion.
Source§

impl TryFrom<&[u8; 32]> for PublicKey

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from( bytes: &[u8; 32], -) -> Result<PublicKey, <PublicKey as TryFrom<&[u8; 32]>>::Error>

Performs the conversion.
§

impl Copy for PublicKey

§

impl Eq for PublicKey

§

impl StructuralPartialEq for PublicKey

Auto Trait Implementations§

§

impl Freeze for PublicKey

§

impl RefUnwindSafe for PublicKey

§

impl Send for PublicKey

§

impl Sync for PublicKey

§

impl Unpin for PublicKey

§

impl UnwindSafe for PublicKey

Blanket Implementations§

Source§

impl<T> Any for T
where +) -> Result<PublicKey, <PublicKey as TryFrom<&[u8; 32]>>::Error>

Performs the conversion.
Source§

impl Copy for PublicKey

Source§

impl Eq for PublicKey

Source§

impl StructuralPartialEq for PublicKey

Auto Trait Implementations§

§

impl Freeze for PublicKey

§

impl RefUnwindSafe for PublicKey

§

impl Send for PublicKey

§

impl Sync for PublicKey

§

impl Unpin for PublicKey

§

impl UnwindSafe for PublicKey

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/3488/docs/iroh/struct.RelayUrl.html b/pr/3488/docs/iroh/struct.RelayUrl.html index 804ad59856..eb4838d47e 100644 --- a/pr/3488/docs/iroh/struct.RelayUrl.html +++ b/pr/3488/docs/iroh/struct.RelayUrl.html @@ -1,4 +1,4 @@ -RelayUrl in iroh - Rust

Struct RelayUrl

pub struct RelayUrl(/* private fields */);
Expand description

A URL identifying a relay server.

+RelayUrl in iroh - Rust

Struct RelayUrl

Source
pub struct RelayUrl(/* private fields */);
Expand description

A URL identifying a relay server.

It is cheaply clonable, as the underlying type is wrapped into an Arc. The main type under the hood though is Url, with a few custom tweaks:

    @@ -457,37 +457,37 @@ or if Path::new_opt() returns None. (That is, if the percent-decoded path contains a NUL byte or, for a Windows path, is not UTF-8.)

    This method is only available if the std Cargo feature is enabled.

    -

Trait Implementations§

§

impl Clone for RelayUrl

§

fn clone(&self) -> RelayUrl

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

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

Performs copy-assignment from source. Read more
§

impl Debug for RelayUrl

§

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

Formats the value using the given formatter. Read more
§

impl Deref for RelayUrl

Dereferences to the wrapped Url.

+

Trait Implementations§

Source§

impl Clone for RelayUrl

Source§

fn clone(&self) -> RelayUrl

Returns a copy 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 RelayUrl

Source§

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

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

impl Deref for RelayUrl

Dereferences to the wrapped Url.

Note that DerefMut is not implemented on purpose, so this type has more flexibility to change the inner later.

-
§

type Target = Url

The resulting type after dereferencing.
§

fn deref(&self) -> &<RelayUrl as Deref>::Target

Dereferences the value.
§

impl<'de> Deserialize<'de> for RelayUrl

§

fn deserialize<__D>( +

Source§

type Target = Url

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<RelayUrl as Deref>::Target

Dereferences the value.
Source§

impl<'de> Deserialize<'de> for RelayUrl

Source§

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

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

impl Display for RelayUrl

§

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

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

impl From<RelayUrl> for RelayMap

Source§

fn from(value: RelayUrl) -> RelayMap

Creates a RelayMap from a RelayUrl.

+ __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for RelayUrl

Source§

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

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

impl From<RelayUrl> for RelayMap

Source§

fn from(value: RelayUrl) -> RelayMap

Creates a RelayMap from a RelayUrl.

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

-
Source§

impl From<RelayUrl> for RelayNode

Source§

fn from(value: RelayUrl) -> RelayNode

Converts to this type from the input type.
§

impl From<RelayUrl> for Url

§

fn from(value: RelayUrl) -> Url

Converts to this type from the input type.
§

impl From<Url> for RelayUrl

§

fn from(url: Url) -> RelayUrl

Converts to this type from the input type.
Source§

impl FromIterator<RelayUrl> for RelayMap

Source§

fn from_iter<T>(iter: T) -> RelayMap
where +

Source§

impl From<RelayUrl> for RelayNode

Source§

fn from(value: RelayUrl) -> RelayNode

Converts to this type from the input type.
Source§

impl From<RelayUrl> for Url

Source§

fn from(value: RelayUrl) -> Url

Converts to this type from the input type.
Source§

impl From<Url> for RelayUrl

Source§

fn from(url: Url) -> RelayUrl

Converts to this type from the input type.
Source§

impl FromIterator<RelayUrl> for RelayMap

Source§

fn from_iter<T>(iter: T) -> RelayMap
where T: IntoIterator<Item = RelayUrl>,

Creates a RelayMap from an iterator of RelayUrl.

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

-
§

impl FromStr for RelayUrl

Support for parsing strings directly.

+
Source§

impl FromStr for RelayUrl

Support for parsing strings directly.

If you need more control over the error first create a Url and use RelayUrl::from instead.

-
§

type Err = RelayUrlParseError

The associated error which can be returned from parsing.
§

fn from_str(s: &str) -> Result<RelayUrl, <RelayUrl as FromStr>::Err>

Parses a string s to return a value of this type. Read more
§

impl Hash for RelayUrl

§

fn hash<__H>(&self, state: &mut __H)
where +
Source§

type Err = RelayUrlParseError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<RelayUrl, <RelayUrl as FromStr>::Err>

Parses a string s to return a value of this type. Read more

Source§

impl Hash for RelayUrl

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, - Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl Ord for RelayUrl

§

fn cmp(&self, other: &RelayUrl) -> 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,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for RelayUrl

Source§

fn cmp(&self, other: &RelayUrl) -> 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
§

impl PartialEq for RelayUrl

§

fn eq(&self, other: &RelayUrl) -> 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.
§

impl PartialOrd for RelayUrl

§

fn partial_cmp(&self, other: &RelayUrl) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the + Self: Sized,
Restrict a value to a certain interval. Read more
Source§

impl PartialEq for RelayUrl

Source§

fn eq(&self, other: &RelayUrl) -> 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 PartialOrd for RelayUrl

Source§

fn partial_cmp(&self, other: &RelayUrl) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by -the >= operator. Read more
§

impl Serialize for RelayUrl

§

fn serialize<__S>( +the >= operator. Read more

Source§

impl Serialize for RelayUrl

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where - __S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl Eq for RelayUrl

§

impl StructuralPartialEq for RelayUrl

Auto Trait Implementations§

§

impl Freeze for RelayUrl

§

impl RefUnwindSafe for RelayUrl

§

impl Send for RelayUrl

§

impl Sync for RelayUrl

§

impl Unpin for RelayUrl

§

impl UnwindSafe for RelayUrl

Blanket Implementations§

Source§

impl<T> Any for T
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for RelayUrl

Source§

impl StructuralPartialEq for RelayUrl

Auto Trait Implementations§

§

impl Freeze for RelayUrl

§

impl RefUnwindSafe for RelayUrl

§

impl Send for RelayUrl

§

impl Sync for RelayUrl

§

impl Unpin for RelayUrl

§

impl UnwindSafe for RelayUrl

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/3488/docs/iroh/struct.RelayUrlParseError.html b/pr/3488/docs/iroh/struct.RelayUrlParseError.html index a03d4b0829..0ffc0ac9dd 100644 --- a/pr/3488/docs/iroh/struct.RelayUrlParseError.html +++ b/pr/3488/docs/iroh/struct.RelayUrlParseError.html @@ -1,9 +1,9 @@ -RelayUrlParseError in iroh - Rust

Struct RelayUrlParseError

pub struct RelayUrlParseError { /* private fields */ }
Expand description

Can occur when parsing a string into a RelayUrl.

-

Trait Implementations§

§

impl Debug for RelayUrlParseError

§

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

Formats the value using the given formatter. Read more
§

impl Display for RelayUrlParseError

§

fn fmt( +RelayUrlParseError in iroh - Rust

Struct RelayUrlParseError

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

Can occur when parsing a string into a RelayUrl.

+

Trait Implementations§

Source§

impl Debug for RelayUrlParseError

Source§

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

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

impl Display for RelayUrlParseError

Source§

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

Formats the value using the given formatter. Read more
§

impl Error for RelayUrlParseError

§

fn description(&self) -> &str

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

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

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

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

Returns the lower-level source of this error, if any. Read more
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
§

impl ErrorCompat for RelayUrlParseError

§

fn backtrace(&self) -> Option<&Backtrace>

Returns a [Backtrace][] that may be printed.
§

fn iter_chain(&self) -> ChainCompat<'_, '_>
where +) -> Result<(), Error>

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

impl Error for RelayUrlParseError

Source§

fn description(&self) -> &str

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

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

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

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

Returns the lower-level source of this error, if any. Read more
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 ErrorCompat for RelayUrlParseError

Source§

fn backtrace(&self) -> Option<&Backtrace>

Returns a [Backtrace][] that may be printed.
§

fn iter_chain(&self) -> ChainCompat<'_, '_>
where Self: AsErrorSource,

Returns an iterator for traversing the chain of errors, starting with the current error and continuing with recursive calls to Error::source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where diff --git a/pr/3488/docs/iroh/struct.SecretKey.html b/pr/3488/docs/iroh/struct.SecretKey.html index 05ed28d1d6..e248a4610e 100644 --- a/pr/3488/docs/iroh/struct.SecretKey.html +++ b/pr/3488/docs/iroh/struct.SecretKey.html @@ -1,23 +1,23 @@ -SecretKey in iroh - Rust

Struct SecretKey

pub struct SecretKey { /* private fields */ }
Expand description

A secret key.

-

Implementations§

§

impl SecretKey

pub fn public(&self) -> PublicKey

The public key of this SecretKey.

-

pub fn generate<R>(csprng: &mut R) -> SecretKey
where +SecretKey in iroh - Rust

Struct SecretKey

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

A secret key.

+

Implementations§

Source§

impl SecretKey

Source

pub fn public(&self) -> PublicKey

The public key of this SecretKey.

+
Source

pub fn generate<R>(csprng: &mut R) -> SecretKey
where R: CryptoRng + ?Sized,

Generate a new SecretKey with a randomness generator.

// use the OsRng option for OS depedndent most secure RNG.
 let _key = iroh_base::SecretKey::generate(&mut rand::rng());
-

pub fn sign(&self, msg: &[u8]) -> Signature

Sign the given message and return a digital signature

-

pub fn to_bytes(&self) -> [u8; 32]

Convert this to the bytes representing the secret part. +

Source

pub fn sign(&self, msg: &[u8]) -> Signature

Sign the given message and return a digital signature

+
Source

pub fn to_bytes(&self) -> [u8; 32]

Convert this to the bytes representing the secret part. The public part can always be recovered.

-

pub fn from_bytes(bytes: &[u8; 32]) -> SecretKey

Create a secret key from its byte representation.

-

pub fn secret(&self) -> &SigningKey

Returns the [SigningKey] for this SecretKey.

-

Trait Implementations§

§

impl Clone for SecretKey

§

fn clone(&self) -> SecretKey

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

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

Performs copy-assignment from source. Read more
§

impl Debug for SecretKey

§

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

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for SecretKey

§

fn deserialize<D>( +

Source

pub fn from_bytes(bytes: &[u8; 32]) -> SecretKey

Create a secret key from its byte representation.

+
Source

pub fn secret(&self) -> &SigningKey

Returns the [SigningKey] for this SecretKey.

+

Trait Implementations§

Source§

impl Clone for SecretKey

Source§

fn clone(&self) -> SecretKey

Returns a copy 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 SecretKey

Source§

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

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

impl<'de> Deserialize<'de> for SecretKey

Source§

fn deserialize<D>( deserializer: D, ) -> Result<SecretKey, <D as Deserializer<'de>>::Error>
where - D: Deserializer<'de>,

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

impl From<[u8; 32]> for SecretKey

§

fn from(value: [u8; 32]) -> SecretKey

Converts to this type from the input type.
§

impl From<SigningKey> for SecretKey

§

fn from(secret: SigningKey) -> SecretKey

Converts to this type from the input type.
§

impl FromStr for SecretKey

§

type Err = KeyParsingError

The associated error which can be returned from parsing.
§

fn from_str(s: &str) -> Result<SecretKey, <SecretKey as FromStr>::Err>

Parses a string s to return a value of this type. Read more
§

impl Serialize for SecretKey

§

fn serialize<S>( + D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Source§

impl From<[u8; 32]> for SecretKey

Source§

fn from(value: [u8; 32]) -> SecretKey

Converts to this type from the input type.
Source§

impl From<SigningKey> for SecretKey

Source§

fn from(secret: SigningKey) -> SecretKey

Converts to this type from the input type.
Source§

impl FromStr for SecretKey

Source§

type Err = KeyParsingError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<SecretKey, <SecretKey as FromStr>::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Serialize for SecretKey

Source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where - S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl TryFrom<&[u8]> for SecretKey

§

type Error = Error

The type returned in the event of a conversion error.
§

fn try_from( + S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<&[u8]> for SecretKey

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from( bytes: &[u8], ) -> Result<SecretKey, <SecretKey as TryFrom<&[u8]>>::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl Freeze for SecretKey

§

impl RefUnwindSafe for SecretKey

§

impl Send for SecretKey

§

impl Sync for SecretKey

§

impl Unpin for SecretKey

§

impl UnwindSafe for SecretKey

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 diff --git a/pr/3488/docs/iroh/type.NodeId.html b/pr/3488/docs/iroh/type.NodeId.html index c107660e42..4d69a71fb8 100644 --- a/pr/3488/docs/iroh/type.NodeId.html +++ b/pr/3488/docs/iroh/type.NodeId.html @@ -1,4 +1,4 @@ -NodeId in iroh - Rust

Type Alias NodeId

pub type NodeId = PublicKey;
Expand description

The identifier for a node in the (iroh) network.

+NodeId in iroh - Rust

Type Alias NodeId

Source
pub type NodeId = PublicKey;
Expand description

The identifier for a node in the (iroh) network.

Each node in iroh has a unique identifier created as a cryptographic key. This can be used to globally identify a node. Since it is also a cryptographic key it is also the mechanism by which all traffic is always encrypted for a specific node only.

diff --git a/pr/3488/docs/iroh_bench/enum.ConnectionSelector.html b/pr/3488/docs/iroh_bench/enum.ConnectionSelector.html index 768b878c9d..ff78a2b646 100644 --- a/pr/3488/docs/iroh_bench/enum.ConnectionSelector.html +++ b/pr/3488/docs/iroh_bench/enum.ConnectionSelector.html @@ -1,7 +1,7 @@ ConnectionSelector in iroh_bench - Rust

Enum ConnectionSelector

Source
pub enum ConnectionSelector {
-    Iroh(Connection),
+    Iroh(Connection),
     Quinn(Connection),
-}

Variants§

§

Iroh(Connection)

§

Quinn(Connection)

Implementations§

Source§

impl ConnectionSelector

Source

pub fn stats(&self)

Source

pub fn close(&self, error_code: u32, reason: &[u8])

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where +}

Variants§

§

Iroh(Connection)

§

Quinn(Connection)

Implementations§

Source§

impl ConnectionSelector

Source

pub fn stats(&self)

Source

pub fn close(&self, error_code: u32, reason: &[u8])

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 T: 'a,

§

fn implicit( diff --git a/pr/3488/docs/iroh_bench/enum.EndpointSelector.html b/pr/3488/docs/iroh_bench/enum.EndpointSelector.html index 99f6d02ab0..837adbb723 100644 --- a/pr/3488/docs/iroh_bench/enum.EndpointSelector.html +++ b/pr/3488/docs/iroh_bench/enum.EndpointSelector.html @@ -1,7 +1,7 @@ EndpointSelector in iroh_bench - Rust

Enum EndpointSelector

Source
pub enum EndpointSelector {
-    Iroh(Endpoint),
+    Iroh(Endpoint),
     Quinn(Endpoint),
-}

Variants§

§

Iroh(Endpoint)

§

Quinn(Endpoint)

Implementations§

Source§

impl EndpointSelector

Source

pub async fn close(self)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where +}

Variants§

§

Iroh(Endpoint)

§

Quinn(Endpoint)

Implementations§

Source§

impl EndpointSelector

Source

pub async fn close(self)

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 T: 'a,

§

fn implicit( diff --git a/pr/3488/docs/iroh_bench/iroh/fn.client.html b/pr/3488/docs/iroh_bench/iroh/fn.client.html index 5311605e5c..d9658287c7 100644 --- a/pr/3488/docs/iroh_bench/iroh/fn.client.html +++ b/pr/3488/docs/iroh_bench/iroh/fn.client.html @@ -1,6 +1,6 @@ client in iroh_bench::iroh - Rust

Function client

Source
pub async fn client(
-    server_addr: NodeAddr,
-    relay_url: Option<RelayUrl>,
+    server_addr: NodeAddr,
+    relay_url: Option<RelayUrl>,
     opt: Opt,
 ) -> Result<ClientStats>
Expand description

Create and run a client

\ No newline at end of file diff --git a/pr/3488/docs/iroh_bench/iroh/fn.connect_client.html b/pr/3488/docs/iroh_bench/iroh/fn.connect_client.html index ee5532854c..e3e551f3d9 100644 --- a/pr/3488/docs/iroh_bench/iroh/fn.connect_client.html +++ b/pr/3488/docs/iroh_bench/iroh/fn.connect_client.html @@ -1,6 +1,6 @@ connect_client in iroh_bench::iroh - Rust

Function connect_client

Source
pub async fn connect_client(
-    server_addr: NodeAddr,
-    relay_url: Option<RelayUrl>,
+    server_addr: NodeAddr,
+    relay_url: Option<RelayUrl>,
     opt: Opt,
-) -> Result<(Endpoint, Connection)>
Expand description

Create a client endpoint and client connection

+) -> Result<(Endpoint, Connection)>
Expand description

Create a client endpoint and client connection

\ No newline at end of file diff --git a/pr/3488/docs/iroh_bench/iroh/fn.handle_client_stream.html b/pr/3488/docs/iroh_bench/iroh/fn.handle_client_stream.html index 7b42a7d7f4..03baed259b 100644 --- a/pr/3488/docs/iroh_bench/iroh/fn.handle_client_stream.html +++ b/pr/3488/docs/iroh_bench/iroh/fn.handle_client_stream.html @@ -1,5 +1,5 @@ handle_client_stream in iroh_bench::iroh - Rust

Function handle_client_stream

Source
pub async fn handle_client_stream(
-    connection: &Connection,
+    connection: &Connection,
     upload_size: u64,
     read_unordered: bool,
 ) -> Result<(TransferResult, TransferResult)>
\ No newline at end of file diff --git a/pr/3488/docs/iroh_bench/iroh/fn.server.html b/pr/3488/docs/iroh_bench/iroh/fn.server.html index af566cc041..25780222ba 100644 --- a/pr/3488/docs/iroh_bench/iroh/fn.server.html +++ b/pr/3488/docs/iroh_bench/iroh/fn.server.html @@ -1,2 +1,2 @@ -server in iroh_bench::iroh - Rust

Function server

Source
pub async fn server(endpoint: Endpoint, opt: Opt) -> Result<()>
Expand description

Take the provided endpoint and run the server

+server in iroh_bench::iroh - Rust

Function server

Source
pub async fn server(endpoint: Endpoint, opt: Opt) -> Result<()>
Expand description

Take the provided endpoint and run the server

\ No newline at end of file diff --git a/pr/3488/docs/iroh_bench/iroh/fn.server_endpoint.html b/pr/3488/docs/iroh_bench/iroh/fn.server_endpoint.html index 4c650d0a8a..2a9675adc3 100644 --- a/pr/3488/docs/iroh_bench/iroh/fn.server_endpoint.html +++ b/pr/3488/docs/iroh_bench/iroh/fn.server_endpoint.html @@ -1,6 +1,6 @@ server_endpoint in iroh_bench::iroh - Rust

Function server_endpoint

Source
pub fn server_endpoint(
     rt: &Runtime,
-    relay_url: &Option<RelayUrl>,
+    relay_url: &Option<RelayUrl>,
     opt: &Opt,
-) -> (NodeAddr, Endpoint)
Expand description

Creates a server endpoint which runs on the given runtime

+) -> (NodeAddr, Endpoint)
Expand description

Creates a server endpoint which runs on the given runtime

\ No newline at end of file diff --git a/pr/3488/docs/iroh_relay/client/struct.ClientBuilder.html b/pr/3488/docs/iroh_relay/client/struct.ClientBuilder.html index 8e7a5d8b2f..8133c5e844 100644 --- a/pr/3488/docs/iroh_relay/client/struct.ClientBuilder.html +++ b/pr/3488/docs/iroh_relay/client/struct.ClientBuilder.html @@ -1,7 +1,7 @@ ClientBuilder in iroh_relay::client - Rust

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/3488/docs/iroh_relay/dns/struct.DnsResolver.html b/pr/3488/docs/iroh_relay/dns/struct.DnsResolver.html index 4194f57d1c..461652d290 100644 --- a/pr/3488/docs/iroh_relay/dns/struct.DnsResolver.html +++ b/pr/3488/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_node_by_id( &self, - node_id: &NodeId, + node_id: &NodeId, origin: &str, -) -> Result<NodeInfo, LookupError>

Looks up node info by [NodeId] and origin domain name.

+) -> Result<NodeInfo, LookupError>

Looks up node info by NodeId and origin domain name.

To lookup nodes that published their node info to the DNS servers run by n0, pass N0_DNS_NODE_ORIGIN_PROD as origin.

Source

pub async fn lookup_node_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_node_by_id_staggered( &self, - node_id: &NodeId, + node_id: &NodeId, origin: &str, delays_ms: &[u64], -) -> Result<NodeInfo, StaggeredError<LookupError>>

Looks up node info by [NodeId] and origin domain name.

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

Looks up node info by NodeId 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/3488/docs/iroh_relay/index.html b/pr/3488/docs/iroh_relay/index.html index 9dd0d5205d..d5b305c8bf 100644 --- a/pr/3488/docs/iroh_relay/index.html +++ b/pr/3488/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
http
HTTP-specific constants for the relay server and client.
node_info
Support for handling DNS resource records for dialing by [NodeId].
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
http
HTTP-specific constants for the relay server and client.
node_info
Support for handling DNS resource records for dialing by NodeId.
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.
RelayMap
Configuration of all the relay servers that can be used.
RelayNode
Information on a specific relay server.
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/3488/docs/iroh_relay/node_info/index.html b/pr/3488/docs/iroh_relay/node_info/index.html index d1636a860a..4dbacf4a4e 100644 --- a/pr/3488/docs/iroh_relay/node_info/index.html +++ b/pr/3488/docs/iroh_relay/node_info/index.html @@ -1,5 +1,5 @@ -iroh_relay::node_info - Rust

Module node_info

Source
Expand description

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

-

Dialing by [NodeId] is supported by iroh nodes publishing Pkarr records to DNS +iroh_relay::node_info - Rust

Module node_info

Source
Expand description

Support for handling DNS resource records for dialing by NodeId.

+

Dialing by NodeId is supported by iroh nodes 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-node-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-node-id> is the z-base-32 encoding of the [NodeId].

    +

    <z32-node-id> is the z-base-32 encoding of the NodeId.

  • <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 node.

      +

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

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

    -
  • Structs§

    MaxLengthExceededError
    Error returned when an input value is too long for UserData.
    NodeData
    Data about a node that may be published to and resolved from discovery services.
    NodeInfo
    Information about a node that may be published to and resolved from discovery services.
    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§

    NodeIdExt
    Extension methods for [NodeId] to encode to and decode from [z32], +

    Structs§

    MaxLengthExceededError
    Error returned when an input value is too long for UserData.
    NodeData
    Data about a node that may be published to and resolved from discovery services.
    NodeInfo
    Information about a node that may be published to and resolved from discovery services.
    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§

    NodeIdExt
    Extension methods for NodeId 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/3488/docs/iroh_relay/node_info/struct.NodeData.html b/pr/3488/docs/iroh_relay/node_info/struct.NodeData.html index 503a826667..3fac18c2bb 100644 --- a/pr/3488/docs/iroh_relay/node_info/struct.NodeData.html +++ b/pr/3488/docs/iroh_relay/node_info/struct.NodeData.html @@ -1,20 +1,20 @@ NodeData in iroh_relay::node_info - Rust

    Struct NodeData

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

    Data about a node 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 node’s [NodeId], only the data about a certain -node. See NodeInfo for a struct that contains a [NodeId] with associated NodeData.

    +

    This struct does not include the node’s NodeId, only the data about a certain +node. See NodeInfo for a struct that contains a NodeId with associated NodeData.

    Implementations§

    Source§

    impl NodeData

    Source

    pub fn new( - relay_url: Option<RelayUrl>, + relay_url: Option<RelayUrl>, direct_addresses: BTreeSet<SocketAddr>, ) -> Self

    Creates a new NodeData 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 node data.

    +
    Source

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

    Sets the relay URL and returns the updated node data.

    Source

    pub fn with_direct_addresses( self, direct_addresses: BTreeSet<SocketAddr>, ) -> Self

    Sets the direct addresses and returns the updated node data.

    Source

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

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

    -
    Source

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

    Returns the relay URL of the node.

    +
    Source

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

    Returns the relay URL of the node.

    Source

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

    Returns the optional user-defined data of the node.

    Source

    pub fn direct_addresses(&self) -> &BTreeSet<SocketAddr>

    Returns the direct addresses of the node.

    Source

    pub fn clear_direct_addresses(&mut self)

    Removes all direct addresses from the node data.

    @@ -22,9 +22,9 @@ node. See IntoIterator<Item = SocketAddr>, )

    Adds direct addresses to the node data.

    -
    Source

    pub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)

    Sets the relay URL of the node data.

    +
    Source

    pub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)

    Sets the relay URL of the node data.

    Source

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

    Sets the user-defined data of the node data.

    -

    Trait Implementations§

    Source§

    impl Clone for NodeData

    Source§

    fn clone(&self) -> NodeData

    Returns a copy 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 NodeData

    Source§

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

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

    impl Default for NodeData

    Source§

    fn default() -> NodeData

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

    impl From<NodeAddr> for NodeData

    Source§

    fn from(node_addr: NodeAddr) -> Self

    Converts to this type from the input type.
    Source§

    impl PartialEq for NodeData

    Source§

    fn eq(&self, other: &NodeData) -> 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 NodeData

    Source§

    fn clone(&self) -> NodeData

    Returns a copy 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 NodeData

    Source§

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

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

    impl Default for NodeData

    Source§

    fn default() -> NodeData

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

    impl From<NodeAddr> for NodeData

    Source§

    fn from(node_addr: NodeAddr) -> Self

    Converts to this type from the input type.
    Source§

    impl PartialEq for NodeData

    Source§

    fn eq(&self, other: &NodeData) -> 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 NodeData

    Source§

    impl StructuralPartialEq for NodeData

    Auto Trait Implementations§

    §

    impl Freeze for NodeData

    §

    impl RefUnwindSafe for NodeData

    §

    impl Send for NodeData

    §

    impl Sync for NodeData

    §

    impl Unpin for NodeData

    §

    impl UnwindSafe for NodeData

    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/3488/docs/iroh_relay/node_info/struct.NodeInfo.html b/pr/3488/docs/iroh_relay/node_info/struct.NodeInfo.html index 751b323700..fbcf4eeaa8 100644 --- a/pr/3488/docs/iroh_relay/node_info/struct.NodeInfo.html +++ b/pr/3488/docs/iroh_relay/node_info/struct.NodeInfo.html @@ -1,20 +1,20 @@ NodeInfo in iroh_relay::node_info - Rust

    Struct NodeInfo

    Source
    pub struct NodeInfo {
    -    pub node_id: NodeId,
    +    pub node_id: NodeId,
         pub data: NodeData,
     }
    Expand description

    Information about a node that may be published to and resolved from discovery services.

    -

    This struct couples a [NodeId] with its associated NodeData.

    -

    Fields§

    §node_id: NodeId

    The [NodeId] of the node this is about.

    +

    This struct couples a NodeId with its associated NodeData.

    +

    Fields§

    §node_id: NodeId

    The NodeId of the node this is about.

    §data: NodeData

    The information published about the node.

    -

    Implementations§

    Source§

    impl NodeInfo

    Source

    pub fn new(node_id: NodeId) -> Self

    Creates a new NodeInfo with an empty NodeData.

    -
    Source

    pub fn from_parts(node_id: NodeId, data: NodeData) -> Self

    Creates a new NodeInfo from its parts.

    -
    Source

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

    Sets the relay URL and returns the updated node info.

    +

    Implementations§

    Source§

    impl NodeInfo

    Source

    pub fn new(node_id: NodeId) -> Self

    Creates a new NodeInfo with an empty NodeData.

    +
    Source

    pub fn from_parts(node_id: NodeId, data: NodeData) -> Self

    Creates a new NodeInfo from its parts.

    +
    Source

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

    Sets the relay URL and returns the updated node info.

    Source

    pub fn with_direct_addresses( self, direct_addresses: BTreeSet<SocketAddr>, ) -> Self

    Sets the direct addresses and returns the updated node info.

    Source

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

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

    -
    Source

    pub fn to_node_addr(&self) -> NodeAddr

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

    -
    Source

    pub fn into_node_addr(self) -> NodeAddr

    Converts into a [NodeAddr] without cloning.

    +
    Source

    pub fn to_node_addr(&self) -> NodeAddr

    Converts into a NodeAddr by cloning the needed fields.

    +
    Source

    pub fn into_node_addr(self) -> NodeAddr

    Converts into a NodeAddr without cloning.

    Source

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

    Parses a NodeInfo 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 = NodeData>§

    Source

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

    Returns the relay URL of the node.

    +

    Methods from Deref<Target = NodeData>§

    Source

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

    Returns the relay URL of the node.

    Source

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

    Returns the optional user-defined data of the node.

    Source

    pub fn direct_addresses(&self) -> &BTreeSet<SocketAddr>

    Returns the direct addresses of the node.

    Source

    pub fn clear_direct_addresses(&mut self)

    Removes all direct addresses from the node data.

    @@ -37,9 +37,9 @@ &mut self, addrs: impl IntoIterator<Item = SocketAddr>, )

    Adds direct addresses to the node data.

    -
    Source

    pub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)

    Sets the relay URL of the node data.

    +
    Source

    pub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)

    Sets the relay URL of the node data.

    Source

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

    Sets the user-defined data of the node data.

    -

    Trait Implementations§

    Source§

    impl Clone for NodeInfo

    Source§

    fn clone(&self) -> NodeInfo

    Returns a copy 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 NodeInfo

    Source§

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

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

    impl Deref for NodeInfo

    Source§

    type Target = NodeData

    The resulting type after dereferencing.
    Source§

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

    Dereferences the value.
    Source§

    impl DerefMut for NodeInfo

    Source§

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

    Mutably dereferences the value.
    Source§

    impl From<NodeAddr> for NodeInfo

    Source§

    fn from(addr: NodeAddr) -> Self

    Converts to this type from the input type.
    Source§

    impl From<NodeInfo> for NodeAddr

    Source§

    fn from(value: NodeInfo) -> Self

    Converts to this type from the input type.
    Source§

    impl PartialEq for NodeInfo

    Source§

    fn eq(&self, other: &NodeInfo) -> 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 NodeInfo

    Source§

    fn clone(&self) -> NodeInfo

    Returns a copy 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 NodeInfo

    Source§

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

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

    impl Deref for NodeInfo

    Source§

    type Target = NodeData

    The resulting type after dereferencing.
    Source§

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

    Dereferences the value.
    Source§

    impl DerefMut for NodeInfo

    Source§

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

    Mutably dereferences the value.
    Source§

    impl From<NodeAddr> for NodeInfo

    Source§

    fn from(addr: NodeAddr) -> Self

    Converts to this type from the input type.
    Source§

    impl From<NodeInfo> for NodeAddr

    Source§

    fn from(value: NodeInfo) -> Self

    Converts to this type from the input type.
    Source§

    impl PartialEq for NodeInfo

    Source§

    fn eq(&self, other: &NodeInfo) -> 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 NodeInfo

    Source§

    impl StructuralPartialEq for NodeInfo

    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/3488/docs/iroh_relay/node_info/trait.NodeIdExt.html b/pr/3488/docs/iroh_relay/node_info/trait.NodeIdExt.html index b3f095d994..b3969acf4e 100644 --- a/pr/3488/docs/iroh_relay/node_info/trait.NodeIdExt.html +++ b/pr/3488/docs/iroh_relay/node_info/trait.NodeIdExt.html @@ -1,9 +1,9 @@ NodeIdExt in iroh_relay::node_info - Rust

    Trait NodeIdExt

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

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

    Expand description

    Extension methods for NodeId 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 [NodeId] in [z-base-32] encoding.

    -
    Source

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

    Parses a [NodeId] 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 NodeIdExt for NodeId

    Implementors§

    \ No newline at end of file +

    Required Methods§

    Source

    fn to_z32(&self) -> String

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

    +
    Source

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

    Parses a NodeId 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 NodeIdExt for NodeId

    Implementors§

    \ No newline at end of file diff --git a/pr/3488/docs/iroh_relay/protos/relay/enum.ClientToRelayMsg.html b/pr/3488/docs/iroh_relay/protos/relay/enum.ClientToRelayMsg.html index e783096e10..a581f81160 100644 --- a/pr/3488/docs/iroh_relay/protos/relay/enum.ClientToRelayMsg.html +++ b/pr/3488/docs/iroh_relay/protos/relay/enum.ClientToRelayMsg.html @@ -2,7 +2,7 @@ Ping([u8; 8]), Pong([u8; 8]), Datagrams { - dst_node_id: NodeId, + dst_node_id: NodeId, 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 node.

    -

    Fields

    §dst_node_id: NodeId

    The remote node to relay to.

    +

    Fields

    §dst_node_id: NodeId

    The remote node 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 copy 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/3488/docs/iroh_relay/protos/relay/enum.RelayToClientMsg.html b/pr/3488/docs/iroh_relay/protos/relay/enum.RelayToClientMsg.html index 4761a28ea7..8088ab854f 100644 --- a/pr/3488/docs/iroh_relay/protos/relay/enum.RelayToClientMsg.html +++ b/pr/3488/docs/iroh_relay/protos/relay/enum.RelayToClientMsg.html @@ -1,9 +1,9 @@ RelayToClientMsg in iroh_relay::protos::relay - Rust

    Enum RelayToClientMsg

    Source
    pub enum RelayToClientMsg {
         Datagrams {
    -        remote_node_id: NodeId,
    +        remote_node_id: NodeId,
             datagrams: Datagrams,
         },
    -    NodeGone(NodeId),
    +    NodeGone(NodeId),
         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_node_id: NodeId

    The [NodeId] of the original sender.

    +

    Fields

    §remote_node_id: NodeId

    The NodeId of the original sender.

    §datagrams: Datagrams

    The datagrams and related metadata.

    -
    §

    NodeGone(NodeId)

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

    §

    NodeGone(NodeId)

    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/3488/docs/iroh_relay/server/enum.AccessConfig.html b/pr/3488/docs/iroh_relay/server/enum.AccessConfig.html index b3289fa763..2ff198317a 100644 --- a/pr/3488/docs/iroh_relay/server/enum.AccessConfig.html +++ b/pr/3488/docs/iroh_relay/server/enum.AccessConfig.html @@ -1,10 +1,10 @@ AccessConfig in iroh_relay::server - Rust

    Enum AccessConfig

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

    Controls which nodes are allowed to use the relay.

    Variants§

    §

    Everyone

    Everyone

    -
    §

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

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

    -

    Implementations§

    Source§

    impl AccessConfig

    Source

    pub async fn is_allowed(&self, node: NodeId) -> bool

    Is this node allowed?

    +
    §

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

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

    +

    Implementations§

    Source§

    impl AccessConfig

    Source

    pub async fn is_allowed(&self, node: NodeId) -> bool

    Is this node 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/3488/docs/iroh_relay/server/struct.Server.html b/pr/3488/docs/iroh_relay/server/struct.Server.html index 7ae78d71ca..fb84064009 100644 --- a/pr/3488/docs/iroh_relay/server/struct.Server.html +++ b/pr/3488/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/3488/docs/iroh_relay/struct.RelayMap.html b/pr/3488/docs/iroh_relay/struct.RelayMap.html index c9660c60d3..5d938ac446 100644 --- a/pr/3488/docs/iroh_relay/struct.RelayMap.html +++ b/pr/3488/docs/iroh_relay/struct.RelayMap.html @@ -1,15 +1,15 @@ RelayMap in iroh_relay - Rust

    Struct RelayMap

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

    Configuration of all the relay servers that can be used.

    -

    Implementations§

    Source§

    impl RelayMap

    Source

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

    Returns the sorted relay URLs.

    +

    Implementations§

    Source§

    impl RelayMap

    Source

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

    Returns the sorted relay URLs.

    Source

    pub fn empty() -> Self

    Create an empty relay map.

    Source

    pub fn nodes(&self) -> impl Iterator<Item = &Arc<RelayNode>>

    Returns an Iterator over all known nodes.

    -
    Source

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

    Is this a known node?

    -
    Source

    pub fn get_node(&self, url: &RelayUrl) -> Option<&Arc<RelayNode>>

    Get the given node.

    +
    Source

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

    Is this a known node?

    +
    Source

    pub fn get_node(&self, url: &RelayUrl) -> Option<&Arc<RelayNode>>

    Get the given node.

    Source

    pub fn len(&self) -> usize

    How many nodes are known?

    Source

    pub fn is_empty(&self) -> bool

    Are there any nodes in this map?

    -

    Trait Implementations§

    Source§

    impl Clone for RelayMap

    Source§

    fn clone(&self) -> RelayMap

    Returns a copy 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<RelayNode> for RelayMap

    Source§

    fn from(value: RelayNode) -> 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 copy 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<RelayNode> for RelayMap

    Source§

    fn from(value: RelayNode) -> 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 RelayNodes in the RelayMap will have the default QUIC address discovery ports.

    -
    Source§

    impl FromIterator<RelayNode> for RelayMap

    Source§

    fn from_iter<T: IntoIterator<Item = RelayNode>>(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<RelayNode> for RelayMap

    Source§

    fn from_iter<T: IntoIterator<Item = RelayNode>>(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 RelayNodes in the RelayMap will have the default QUIC address discovery ports.

    Source§

    impl PartialEq for RelayMap

    Source§

    fn eq(&self, other: &RelayMap) -> 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/3488/docs/iroh_relay/struct.RelayNode.html b/pr/3488/docs/iroh_relay/struct.RelayNode.html index 85dcdfce9a..a84a68ace4 100644 --- a/pr/3488/docs/iroh_relay/struct.RelayNode.html +++ b/pr/3488/docs/iroh_relay/struct.RelayNode.html @@ -1,14 +1,14 @@ RelayNode in iroh_relay - Rust

    Struct RelayNode

    Source
    pub struct RelayNode {
    -    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 RelayNode

    Source§

    fn clone(&self) -> RelayNode

    Returns a copy 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 RelayNode

    Source§

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

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

    impl<'de> Deserialize<'de> for RelayNode

    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 RelayNode

    Source§

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

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

    impl From<RelayNode> for RelayMap

    Source§

    fn from(value: RelayNode) -> Self

    Converts to this type from the input type.
    Source§

    impl From<RelayUrl> for RelayNode

    Source§

    fn from(value: RelayUrl) -> Self

    Converts to this type from the input type.
    Source§

    impl FromIterator<RelayNode> for RelayMap

    Source§

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

    Creates a value from an iterator. Read more
    Source§

    impl Ord for RelayNode

    Source§

    fn cmp(&self, other: &RelayNode) -> 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 RelayNode

    Source§

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

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

    impl From<RelayNode> for RelayMap

    Source§

    fn from(value: RelayNode) -> Self

    Converts to this type from the input type.
    Source§

    impl From<RelayUrl> for RelayNode

    Source§

    fn from(value: RelayUrl) -> Self

    Converts to this type from the input type.
    Source§

    impl FromIterator<RelayNode> for RelayMap

    Source§

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

    Creates a value from an iterator. Read more
    Source§

    impl Ord for RelayNode

    Source§

    fn cmp(&self, other: &RelayNode) -> 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 RelayNode

    Source§

    fn eq(&self, other: &RelayNode) -> 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/3488/docs/src/iroh/endpoint.rs.html b/pr/3488/docs/src/iroh/endpoint.rs.html index e07a25244d..d9bf57ac44 100644 --- a/pr/3488/docs/src/iroh/endpoint.rs.html +++ b/pr/3488/docs/src/iroh/endpoint.rs.html @@ -2729,461 +2729,506 @@ 2729 tokio::spawn({ 2730 let server = server.clone(); 2731 async move { -2732 while let Some(incoming) = server.accept().await { -2733 let connecting = incoming.accept().e()?; -2734 let conn = match connecting.into_0rtt() { -2735 Ok((conn, _)) => { -2736 info!("0rtt accepted"); -2737 conn -2738 } -2739 Err(connecting) => { -2740 info!("0rtt denied"); -2741 connecting.await.e()? -2742 } -2743 }; -2744 let (mut send, mut recv) = conn.accept_bi().await.e()?; -2745 let data = recv.read_to_end(10_000_000).await.e()?; -2746 send.write_all(&data).await.e()?; -2747 send.finish().e()?; -2748 -2749 // Stay alive until the other side closes the connection. -2750 conn.closed().await; -2751 } -2752 Ok::<_, Error>(()) -2753 } -2754 .instrument(log_span) -2755 }); -2756 -2757 Ok(server) -2758 } -2759 -2760 async fn connect_client_0rtt_expect_err(client: &Endpoint, server_addr: NodeAddr) -> Result { -2761 let conn = client -2762 .connect_with_opts(server_addr, TEST_ALPN, ConnectOptions::new()) -2763 .await? -2764 .into_0rtt() -2765 .expect_err("expected 0rtt to fail") -2766 .await -2767 .e()?; -2768 -2769 let (mut send, mut recv) = conn.open_bi().await.e()?; -2770 send.write_all(b"hello").await.e()?; -2771 send.finish().e()?; -2772 let received = recv.read_to_end(1_000).await.e()?; -2773 assert_eq!(&received, b"hello"); -2774 conn.close(0u32.into(), b"thx"); -2775 Ok(()) -2776 } +2732 tracing::trace!("Server accept loop started"); +2733 while let Some(incoming) = server.accept().await { +2734 tracing::trace!("Server received incoming connection"); +2735 // Handle connection errors gracefully instead of exiting the task +2736 let connecting = match incoming.accept() { +2737 Ok(c) => c, +2738 Err(e) => { +2739 tracing::warn!("Failed to accept incoming connection: {e:?}"); +2740 continue; +2741 } +2742 }; +2743 +2744 let conn = match connecting.into_0rtt() { +2745 Ok((conn, _)) => { +2746 info!("0rtt accepted"); +2747 conn +2748 } +2749 Err(connecting) => { +2750 info!("0rtt denied"); +2751 match connecting.await { +2752 Ok(c) => c, +2753 Err(e) => { +2754 tracing::warn!("Connection failed: {e:?}"); +2755 continue; +2756 } +2757 } +2758 } +2759 }; +2760 +2761 // Handle stream errors gracefully +2762 let (mut send, mut recv) = match conn.accept_bi().await { +2763 Ok(s) => s, +2764 Err(e) => { +2765 tracing::warn!("Failed to accept bi stream: {e:?}"); +2766 continue; +2767 } +2768 }; +2769 +2770 let data = match recv.read_to_end(10_000_000).await { +2771 Ok(d) => d, +2772 Err(e) => { +2773 tracing::warn!("Failed to read data: {e:?}"); +2774 continue; +2775 } +2776 }; 2777 -2778 async fn connect_client_0rtt_expect_ok( -2779 client: &Endpoint, -2780 server_addr: NodeAddr, -2781 expect_server_accepts: bool, -2782 ) -> Result { -2783 let (conn, accepted_0rtt) = client -2784 .connect_with_opts(server_addr, TEST_ALPN, ConnectOptions::new()) -2785 .await? -2786 .into_0rtt() -2787 .ok() -2788 .e()?; -2789 -2790 // This is how we send data in 0-RTT: -2791 let (mut send, recv) = conn.open_bi().await.e()?; -2792 send.write_all(b"hello").await.e()?; -2793 send.finish().e()?; -2794 // When this resolves, we've gotten a response from the server about whether the 0-RTT data above was accepted: -2795 let accepted = accepted_0rtt.await; -2796 assert_eq!(accepted, expect_server_accepts); -2797 let mut recv = if accepted { -2798 recv -2799 } else { -2800 // in this case we need to re-send data by re-creating the connection. -2801 let (mut send, recv) = conn.open_bi().await.e()?; -2802 send.write_all(b"hello").await.e()?; -2803 send.finish().e()?; -2804 recv -2805 }; -2806 let received = recv.read_to_end(1_000).await.e()?; -2807 assert_eq!(&received, b"hello"); -2808 conn.close(0u32.into(), b"thx"); -2809 Ok(()) -2810 } -2811 -2812 #[tokio::test] -2813 #[traced_test] -2814 async fn test_0rtt() -> Result { -2815 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(42); -2816 let client = Endpoint::builder() -2817 .relay_mode(RelayMode::Disabled) -2818 .bind() -2819 .await?; -2820 let server = spawn_0rtt_server(SecretKey::generate(&mut rng), info_span!("server")).await?; -2821 -2822 connect_client_0rtt_expect_err(&client, server.watch_node_addr().initialized().await) -2823 .await?; -2824 // The second 0rtt attempt should work -2825 connect_client_0rtt_expect_ok(&client, server.watch_node_addr().initialized().await, true) -2826 .await?; -2827 -2828 client.close().await; -2829 server.close().await; -2830 -2831 Ok(()) -2832 } -2833 -2834 // We have this test, as this would've failed at some point. -2835 // This effectively tests that we correctly categorize the TLS session tickets we -2836 // receive into the respective "bucket" for the recipient. -2837 #[tokio::test] -2838 #[traced_test] -2839 async fn test_0rtt_non_consecutive() -> Result { -2840 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(42); -2841 let client = Endpoint::builder() -2842 .relay_mode(RelayMode::Disabled) -2843 .bind() -2844 .await?; -2845 let server = spawn_0rtt_server(SecretKey::generate(&mut rng), info_span!("server")).await?; -2846 -2847 connect_client_0rtt_expect_err(&client, server.watch_node_addr().initialized().await) -2848 .await?; -2849 -2850 // connecting with another endpoint should not interfere with our -2851 // TLS session ticket cache for the first endpoint: -2852 let another = -2853 spawn_0rtt_server(SecretKey::generate(&mut rng), info_span!("another")).await?; -2854 connect_client_0rtt_expect_err(&client, another.watch_node_addr().initialized().await) -2855 .await?; -2856 another.close().await; -2857 -2858 connect_client_0rtt_expect_ok(&client, server.watch_node_addr().initialized().await, true) -2859 .await?; -2860 -2861 client.close().await; -2862 server.close().await; -2863 -2864 Ok(()) -2865 } +2778 if let Err(e) = send.write_all(&data).await { +2779 tracing::warn!("Failed to write data: {e:?}"); +2780 continue; +2781 } +2782 +2783 if let Err(e) = send.finish() { +2784 tracing::warn!("Failed to finish send: {e:?}"); +2785 continue; +2786 } +2787 +2788 // Stay alive until the other side closes the connection. +2789 conn.closed().await; +2790 tracing::trace!("Connection closed, ready for next"); +2791 } +2792 tracing::trace!("Server accept loop exiting"); +2793 Ok::<_, Error>(()) +2794 } +2795 .instrument(log_span) +2796 }); +2797 +2798 Ok(server) +2799 } +2800 +2801 async fn connect_client_0rtt_expect_err(client: &Endpoint, server_addr: NodeAddr) -> Result { +2802 let conn = client +2803 .connect_with_opts(server_addr, TEST_ALPN, ConnectOptions::new()) +2804 .await? +2805 .into_0rtt() +2806 .expect_err("expected 0rtt to fail") +2807 .await +2808 .e()?; +2809 +2810 let (mut send, mut recv) = conn.open_bi().await.e()?; +2811 send.write_all(b"hello").await.e()?; +2812 send.finish().e()?; +2813 let received = recv.read_to_end(1_000).await.e()?; +2814 assert_eq!(&received, b"hello"); +2815 conn.close(0u32.into(), b"thx"); +2816 Ok(()) +2817 } +2818 +2819 async fn connect_client_0rtt_expect_ok( +2820 client: &Endpoint, +2821 server_addr: NodeAddr, +2822 expect_server_accepts: bool, +2823 ) -> Result { +2824 tracing::trace!(?server_addr, "Client connecting with 0-RTT"); +2825 let (conn, accepted_0rtt) = client +2826 .connect_with_opts(server_addr, TEST_ALPN, ConnectOptions::new()) +2827 .await? +2828 .into_0rtt() +2829 .ok() +2830 .e()?; +2831 +2832 tracing::trace!("Client established 0-RTT connection"); +2833 // This is how we send data in 0-RTT: +2834 let (mut send, recv) = conn.open_bi().await.e()?; +2835 send.write_all(b"hello").await.e()?; +2836 send.finish().e()?; +2837 tracing::trace!("Client sent 0-RTT data, waiting for server response"); +2838 // When this resolves, we've gotten a response from the server about whether the 0-RTT data above was accepted: +2839 let accepted = accepted_0rtt.await; +2840 tracing::trace!(?accepted, "Server responded to 0-RTT"); +2841 assert_eq!(accepted, expect_server_accepts); +2842 let mut recv = if accepted { +2843 recv +2844 } else { +2845 // in this case we need to re-send data by re-creating the connection. +2846 let (mut send, recv) = conn.open_bi().await.e()?; +2847 send.write_all(b"hello").await.e()?; +2848 send.finish().e()?; +2849 recv +2850 }; +2851 let received = recv.read_to_end(1_000).await.e()?; +2852 assert_eq!(&received, b"hello"); +2853 conn.close(0u32.into(), b"thx"); +2854 Ok(()) +2855 } +2856 +2857 #[tokio::test] +2858 #[traced_test] +2859 async fn test_0rtt() -> Result { +2860 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(42); +2861 let client = Endpoint::builder() +2862 .relay_mode(RelayMode::Disabled) +2863 .bind() +2864 .await?; +2865 let server = spawn_0rtt_server(SecretKey::generate(&mut rng), info_span!("server")).await?; 2866 -2867 // Test whether 0-RTT is possible after a restart: -2868 #[tokio::test] -2869 #[traced_test] -2870 async fn test_0rtt_after_server_restart() -> Result { -2871 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(42); -2872 let client = Endpoint::builder() -2873 .relay_mode(RelayMode::Disabled) -2874 .bind() -2875 .await?; -2876 let server_key = SecretKey::generate(&mut rng); -2877 let server = spawn_0rtt_server(server_key.clone(), info_span!("server-initial")).await?; +2867 connect_client_0rtt_expect_err(&client, server.watch_node_addr().initialized().await) +2868 .await?; +2869 // The second 0rtt attempt should work +2870 connect_client_0rtt_expect_ok(&client, server.watch_node_addr().initialized().await, true) +2871 .await?; +2872 +2873 client.close().await; +2874 server.close().await; +2875 +2876 Ok(()) +2877 } 2878 -2879 connect_client_0rtt_expect_err(&client, server.watch_node_addr().initialized().await) -2880 .await?; -2881 connect_client_0rtt_expect_ok(&client, server.watch_node_addr().initialized().await, true) -2882 .await?; -2883 -2884 server.close().await; -2885 -2886 let server = spawn_0rtt_server(server_key, info_span!("server-restart")).await?; -2887 -2888 // we expect the client to *believe* it can 0-RTT connect to the server (hence expect_ok), -2889 // but the server will reject the early data because it discarded necessary state -2890 // to decrypt it when restarting. -2891 connect_client_0rtt_expect_ok(&client, server.watch_node_addr().initialized().await, false) -2892 .await?; -2893 -2894 client.close().await; -2895 -2896 Ok(()) -2897 } -2898 -2899 #[cfg_attr(target_os = "windows", ignore = "flaky")] -2900 #[tokio::test] -2901 #[traced_test] -2902 async fn graceful_close() -> Result { -2903 let client = Endpoint::builder().bind().await?; -2904 let server = Endpoint::builder() -2905 .alpns(vec![TEST_ALPN.to_vec()]) -2906 .bind() -2907 .await?; -2908 let server_addr = server.watch_node_addr().initialized().await; -2909 let server_task = tokio::spawn(async move { -2910 let incoming = server.accept().await.e()?; -2911 let conn = incoming.await.e()?; -2912 let (mut send, mut recv) = conn.accept_bi().await.e()?; -2913 let msg = recv.read_to_end(1_000).await.e()?; -2914 send.write_all(&msg).await.e()?; -2915 send.finish().e()?; -2916 let close_reason = conn.closed().await; -2917 Ok::<_, Error>(close_reason) -2918 }); -2919 -2920 let conn = client.connect(server_addr, TEST_ALPN).await?; -2921 let (mut send, mut recv) = conn.open_bi().await.e()?; -2922 send.write_all(b"Hello, world!").await.e()?; -2923 send.finish().e()?; -2924 recv.read_to_end(1_000).await.e()?; -2925 conn.close(42u32.into(), b"thanks, bye!"); -2926 client.close().await; -2927 -2928 let close_err = server_task.await.e()??; -2929 let ConnectionError::ApplicationClosed(app_close) = close_err else { -2930 panic!("Unexpected close reason: {close_err:?}"); -2931 }; +2879 // We have this test, as this would've failed at some point. +2880 // This effectively tests that we correctly categorize the TLS session tickets we +2881 // receive into the respective "bucket" for the recipient. +2882 #[tokio::test] +2883 #[traced_test] +2884 async fn test_0rtt_non_consecutive() -> Result { +2885 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(42); +2886 let client = Endpoint::builder() +2887 .relay_mode(RelayMode::Disabled) +2888 .bind() +2889 .await?; +2890 let server = spawn_0rtt_server(SecretKey::generate(&mut rng), info_span!("server")).await?; +2891 +2892 connect_client_0rtt_expect_err(&client, server.watch_node_addr().initialized().await) +2893 .await?; +2894 +2895 // connecting with another endpoint should not interfere with our +2896 // TLS session ticket cache for the first endpoint: +2897 let another = +2898 spawn_0rtt_server(SecretKey::generate(&mut rng), info_span!("another")).await?; +2899 connect_client_0rtt_expect_err(&client, another.watch_node_addr().initialized().await) +2900 .await?; +2901 another.close().await; +2902 +2903 connect_client_0rtt_expect_ok(&client, server.watch_node_addr().initialized().await, true) +2904 .await?; +2905 +2906 client.close().await; +2907 server.close().await; +2908 +2909 Ok(()) +2910 } +2911 +2912 // Test whether 0-RTT is possible after a restart: +2913 #[tokio::test] +2914 #[traced_test] +2915 async fn test_0rtt_after_server_restart() -> Result { +2916 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(42); +2917 let client = Endpoint::builder() +2918 .relay_mode(RelayMode::Disabled) +2919 .bind() +2920 .await?; +2921 let server_key = SecretKey::generate(&mut rng); +2922 let server = spawn_0rtt_server(server_key.clone(), info_span!("server-initial")).await?; +2923 +2924 connect_client_0rtt_expect_err(&client, server.watch_node_addr().initialized().await) +2925 .await?; +2926 connect_client_0rtt_expect_ok(&client, server.watch_node_addr().initialized().await, true) +2927 .await?; +2928 +2929 server.close().await; +2930 +2931 let server = spawn_0rtt_server(server_key, info_span!("server-restart")).await?; 2932 -2933 assert_eq!(app_close.error_code, 42u32.into()); -2934 assert_eq!(app_close.reason.as_ref(), b"thanks, bye!"); -2935 -2936 Ok(()) -2937 } +2933 // we expect the client to *believe* it can 0-RTT connect to the server (hence expect_ok), +2934 // but the server will reject the early data because it discarded necessary state +2935 // to decrypt it when restarting. +2936 connect_client_0rtt_expect_ok(&client, server.watch_node_addr().initialized().await, false) +2937 .await?; 2938 -2939 #[cfg(feature = "metrics")] -2940 #[tokio::test] -2941 #[traced_test] -2942 async fn metrics_smoke() -> Result { -2943 use iroh_metrics::{MetricsSource, Registry}; -2944 -2945 let secret_key = SecretKey::from_bytes(&[0u8; 32]); -2946 let client = Endpoint::builder() -2947 .secret_key(secret_key) -2948 .relay_mode(RelayMode::Disabled) -2949 .bind() -2950 .await?; -2951 let secret_key = SecretKey::from_bytes(&[1u8; 32]); -2952 let server = Endpoint::builder() -2953 .secret_key(secret_key) -2954 .relay_mode(RelayMode::Disabled) -2955 .alpns(vec![TEST_ALPN.to_vec()]) -2956 .bind() -2957 .await?; -2958 let server_addr = server.watch_node_addr().initialized().await; -2959 let server_task = tokio::task::spawn(async move { -2960 let conn = server.accept().await.e()?.accept().e()?.await.e()?; -2961 let mut uni = conn.accept_uni().await.e()?; -2962 uni.read_to_end(10).await.e()?; -2963 drop(conn); -2964 Ok::<_, Error>(server) -2965 }); -2966 let conn = client.connect(server_addr, TEST_ALPN).await?; -2967 let mut uni = conn.open_uni().await.e()?; -2968 uni.write_all(b"helloworld").await.e()?; -2969 uni.finish().e()?; -2970 conn.closed().await; -2971 drop(conn); -2972 let server = server_task.await.e()??; -2973 -2974 let m = client.metrics(); -2975 assert_eq!(m.magicsock.num_direct_conns_added.get(), 1); -2976 assert_eq!(m.magicsock.connection_became_direct.get(), 1); -2977 assert_eq!(m.magicsock.connection_handshake_success.get(), 1); -2978 assert_eq!(m.magicsock.nodes_contacted_directly.get(), 1); -2979 assert!(m.magicsock.recv_datagrams.get() > 0); +2939 client.close().await; +2940 +2941 Ok(()) +2942 } +2943 +2944 #[cfg_attr(target_os = "windows", ignore = "flaky")] +2945 #[tokio::test] +2946 #[traced_test] +2947 async fn graceful_close() -> Result { +2948 let client = Endpoint::builder().bind().await?; +2949 let server = Endpoint::builder() +2950 .alpns(vec![TEST_ALPN.to_vec()]) +2951 .bind() +2952 .await?; +2953 let server_addr = server.watch_node_addr().initialized().await; +2954 let server_task = tokio::spawn(async move { +2955 let incoming = server.accept().await.e()?; +2956 let conn = incoming.await.e()?; +2957 let (mut send, mut recv) = conn.accept_bi().await.e()?; +2958 let msg = recv.read_to_end(1_000).await.e()?; +2959 send.write_all(&msg).await.e()?; +2960 send.finish().e()?; +2961 let close_reason = conn.closed().await; +2962 Ok::<_, Error>(close_reason) +2963 }); +2964 +2965 let conn = client.connect(server_addr, TEST_ALPN).await?; +2966 let (mut send, mut recv) = conn.open_bi().await.e()?; +2967 send.write_all(b"Hello, world!").await.e()?; +2968 send.finish().e()?; +2969 recv.read_to_end(1_000).await.e()?; +2970 conn.close(42u32.into(), b"thanks, bye!"); +2971 client.close().await; +2972 +2973 let close_err = server_task.await.e()??; +2974 let ConnectionError::ApplicationClosed(app_close) = close_err else { +2975 panic!("Unexpected close reason: {close_err:?}"); +2976 }; +2977 +2978 assert_eq!(app_close.error_code, 42u32.into()); +2979 assert_eq!(app_close.reason.as_ref(), b"thanks, bye!"); 2980 -2981 let m = server.metrics(); -2982 assert_eq!(m.magicsock.num_direct_conns_added.get(), 1); -2983 assert_eq!(m.magicsock.connection_became_direct.get(), 1); -2984 assert_eq!(m.magicsock.nodes_contacted_directly.get(), 1); -2985 assert_eq!(m.magicsock.connection_handshake_success.get(), 1); -2986 assert!(m.magicsock.recv_datagrams.get() > 0); -2987 -2988 // test openmetrics encoding with labeled subregistries per endpoint -2989 fn register_endpoint(registry: &mut Registry, endpoint: &Endpoint) { -2990 let id = endpoint.node_id().fmt_short(); -2991 let sub_registry = registry.sub_registry_with_label("id", id.to_string()); -2992 sub_registry.register_all(endpoint.metrics()); -2993 } -2994 let mut registry = Registry::default(); -2995 register_endpoint(&mut registry, &client); -2996 register_endpoint(&mut registry, &server); -2997 let s = registry.encode_openmetrics_to_string()?; -2998 assert!(s.contains(r#"magicsock_nodes_contacted_directly_total{id="3b6a27bcce"} 1"#)); -2999 assert!(s.contains(r#"magicsock_nodes_contacted_directly_total{id="8a88e3dd74"} 1"#)); -3000 Ok(()) -3001 } -3002 -3003 /// Configures the accept side to take `accept_alpns` ALPNs, then connects to it with `primary_connect_alpn` -3004 /// with `secondary_connect_alpns` set, and finally returns the negotiated ALPN. -3005 async fn alpn_connection_test( -3006 accept_alpns: Vec<Vec<u8>>, -3007 primary_connect_alpn: &[u8], -3008 secondary_connect_alpns: Vec<Vec<u8>>, -3009 ) -> Result<Option<Vec<u8>>> { -3010 let client = Endpoint::builder() -3011 .relay_mode(RelayMode::Disabled) -3012 .bind() -3013 .await?; -3014 let server = Endpoint::builder() -3015 .relay_mode(RelayMode::Disabled) -3016 .alpns(accept_alpns) -3017 .bind() -3018 .await?; -3019 let server_addr = server.watch_node_addr().initialized().await; -3020 let server_task = tokio::spawn({ -3021 let server = server.clone(); -3022 async move { -3023 let incoming = server.accept().await.e()?; -3024 let conn = incoming.await.e()?; -3025 conn.close(0u32.into(), b"bye!"); -3026 Ok::<_, n0_snafu::Error>(conn.alpn()) -3027 } -3028 }); -3029 -3030 let conn = client -3031 .connect_with_opts( -3032 server_addr, -3033 primary_connect_alpn, -3034 ConnectOptions::new().with_additional_alpns(secondary_connect_alpns), -3035 ) -3036 .await?; -3037 let conn = conn.await.e()?; -3038 let client_alpn = conn.alpn(); -3039 conn.closed().await; -3040 client.close().await; -3041 server.close().await; -3042 -3043 let server_alpn = server_task.await.e()??; -3044 -3045 assert_eq!(client_alpn, server_alpn); -3046 -3047 Ok(server_alpn) -3048 } -3049 -3050 #[tokio::test] -3051 #[traced_test] -3052 async fn connect_multiple_alpn_negotiated() -> Result { -3053 const ALPN_ONE: &[u8] = b"alpn/1"; -3054 const ALPN_TWO: &[u8] = b"alpn/2"; -3055 -3056 assert_eq!( -3057 alpn_connection_test( -3058 // Prefer version 2 over version 1 on the accept side -3059 vec![ALPN_TWO.to_vec(), ALPN_ONE.to_vec()], -3060 ALPN_TWO, -3061 vec![ALPN_ONE.to_vec()], -3062 ) -3063 .await?, -3064 Some(ALPN_TWO.to_vec()), -3065 "accept side prefers version 2 over 1" -3066 ); -3067 -3068 assert_eq!( -3069 alpn_connection_test( -3070 // Only support the old version -3071 vec![ALPN_ONE.to_vec()], -3072 ALPN_TWO, -3073 vec![ALPN_ONE.to_vec()], -3074 ) -3075 .await?, -3076 Some(ALPN_ONE.to_vec()), -3077 "accept side only supports the old version" -3078 ); -3079 -3080 assert_eq!( -3081 alpn_connection_test( -3082 vec![ALPN_TWO.to_vec(), ALPN_ONE.to_vec()], -3083 ALPN_ONE, -3084 vec![ALPN_TWO.to_vec()], -3085 ) -3086 .await?, -3087 Some(ALPN_TWO.to_vec()), -3088 "connect side ALPN order doesn't matter" -3089 ); -3090 -3091 assert_eq!( -3092 alpn_connection_test(vec![ALPN_TWO.to_vec(), ALPN_ONE.to_vec()], ALPN_ONE, vec![],) -3093 .await?, -3094 Some(ALPN_ONE.to_vec()), -3095 "connect side only supports the old version" -3096 ); -3097 -3098 Ok(()) -3099 } +2981 Ok(()) +2982 } +2983 +2984 #[cfg(feature = "metrics")] +2985 #[tokio::test] +2986 #[traced_test] +2987 async fn metrics_smoke() -> Result { +2988 use iroh_metrics::{MetricsSource, Registry}; +2989 +2990 let secret_key = SecretKey::from_bytes(&[0u8; 32]); +2991 let client = Endpoint::builder() +2992 .secret_key(secret_key) +2993 .relay_mode(RelayMode::Disabled) +2994 .bind() +2995 .await?; +2996 let secret_key = SecretKey::from_bytes(&[1u8; 32]); +2997 let server = Endpoint::builder() +2998 .secret_key(secret_key) +2999 .relay_mode(RelayMode::Disabled) +3000 .alpns(vec![TEST_ALPN.to_vec()]) +3001 .bind() +3002 .await?; +3003 let server_addr = server.watch_node_addr().initialized().await; +3004 let server_task = tokio::task::spawn(async move { +3005 let conn = server.accept().await.e()?.accept().e()?.await.e()?; +3006 let mut uni = conn.accept_uni().await.e()?; +3007 uni.read_to_end(10).await.e()?; +3008 drop(conn); +3009 Ok::<_, Error>(server) +3010 }); +3011 let conn = client.connect(server_addr, TEST_ALPN).await?; +3012 let mut uni = conn.open_uni().await.e()?; +3013 uni.write_all(b"helloworld").await.e()?; +3014 uni.finish().e()?; +3015 conn.closed().await; +3016 drop(conn); +3017 let server = server_task.await.e()??; +3018 +3019 let m = client.metrics(); +3020 assert_eq!(m.magicsock.num_direct_conns_added.get(), 1); +3021 assert_eq!(m.magicsock.connection_became_direct.get(), 1); +3022 assert_eq!(m.magicsock.connection_handshake_success.get(), 1); +3023 assert_eq!(m.magicsock.nodes_contacted_directly.get(), 1); +3024 assert!(m.magicsock.recv_datagrams.get() > 0); +3025 +3026 let m = server.metrics(); +3027 assert_eq!(m.magicsock.num_direct_conns_added.get(), 1); +3028 assert_eq!(m.magicsock.connection_became_direct.get(), 1); +3029 assert_eq!(m.magicsock.nodes_contacted_directly.get(), 1); +3030 assert_eq!(m.magicsock.connection_handshake_success.get(), 1); +3031 assert!(m.magicsock.recv_datagrams.get() > 0); +3032 +3033 // test openmetrics encoding with labeled subregistries per endpoint +3034 fn register_endpoint(registry: &mut Registry, endpoint: &Endpoint) { +3035 let id = endpoint.node_id().fmt_short(); +3036 let sub_registry = registry.sub_registry_with_label("id", id.to_string()); +3037 sub_registry.register_all(endpoint.metrics()); +3038 } +3039 let mut registry = Registry::default(); +3040 register_endpoint(&mut registry, &client); +3041 register_endpoint(&mut registry, &server); +3042 let s = registry.encode_openmetrics_to_string()?; +3043 assert!(s.contains(r#"magicsock_nodes_contacted_directly_total{id="3b6a27bcce"} 1"#)); +3044 assert!(s.contains(r#"magicsock_nodes_contacted_directly_total{id="8a88e3dd74"} 1"#)); +3045 Ok(()) +3046 } +3047 +3048 /// Configures the accept side to take `accept_alpns` ALPNs, then connects to it with `primary_connect_alpn` +3049 /// with `secondary_connect_alpns` set, and finally returns the negotiated ALPN. +3050 async fn alpn_connection_test( +3051 accept_alpns: Vec<Vec<u8>>, +3052 primary_connect_alpn: &[u8], +3053 secondary_connect_alpns: Vec<Vec<u8>>, +3054 ) -> Result<Option<Vec<u8>>> { +3055 let client = Endpoint::builder() +3056 .relay_mode(RelayMode::Disabled) +3057 .bind() +3058 .await?; +3059 let server = Endpoint::builder() +3060 .relay_mode(RelayMode::Disabled) +3061 .alpns(accept_alpns) +3062 .bind() +3063 .await?; +3064 let server_addr = server.watch_node_addr().initialized().await; +3065 let server_task = tokio::spawn({ +3066 let server = server.clone(); +3067 async move { +3068 let incoming = server.accept().await.e()?; +3069 let conn = incoming.await.e()?; +3070 conn.close(0u32.into(), b"bye!"); +3071 Ok::<_, n0_snafu::Error>(conn.alpn()) +3072 } +3073 }); +3074 +3075 let conn = client +3076 .connect_with_opts( +3077 server_addr, +3078 primary_connect_alpn, +3079 ConnectOptions::new().with_additional_alpns(secondary_connect_alpns), +3080 ) +3081 .await?; +3082 let conn = conn.await.e()?; +3083 let client_alpn = conn.alpn(); +3084 conn.closed().await; +3085 client.close().await; +3086 server.close().await; +3087 +3088 let server_alpn = server_task.await.e()??; +3089 +3090 assert_eq!(client_alpn, server_alpn); +3091 +3092 Ok(server_alpn) +3093 } +3094 +3095 #[tokio::test] +3096 #[traced_test] +3097 async fn connect_multiple_alpn_negotiated() -> Result { +3098 const ALPN_ONE: &[u8] = b"alpn/1"; +3099 const ALPN_TWO: &[u8] = b"alpn/2"; 3100 -3101 #[tokio::test] -3102 #[traced_test] -3103 async fn watch_net_report() -> Result { -3104 let endpoint = Endpoint::builder() -3105 .relay_mode(RelayMode::Staging) -3106 .bind() -3107 .await?; -3108 -3109 // can get a first report -3110 endpoint.net_report().updated().await?; -3111 -3112 Ok(()) -3113 } -3114 -3115 /// Tests that initial connection establishment isn't extremely slow compared -3116 /// to subsequent connections. -3117 /// -3118 /// This is a time based test, but uses a very large ratio to reduce flakiness. -3119 /// It also does a number of connections to average out any anomalies. -3120 #[tokio::test] -3121 #[traced_test] -3122 async fn connect_multi_time() -> Result { -3123 let n = 32; +3101 assert_eq!( +3102 alpn_connection_test( +3103 // Prefer version 2 over version 1 on the accept side +3104 vec![ALPN_TWO.to_vec(), ALPN_ONE.to_vec()], +3105 ALPN_TWO, +3106 vec![ALPN_ONE.to_vec()], +3107 ) +3108 .await?, +3109 Some(ALPN_TWO.to_vec()), +3110 "accept side prefers version 2 over 1" +3111 ); +3112 +3113 assert_eq!( +3114 alpn_connection_test( +3115 // Only support the old version +3116 vec![ALPN_ONE.to_vec()], +3117 ALPN_TWO, +3118 vec![ALPN_ONE.to_vec()], +3119 ) +3120 .await?, +3121 Some(ALPN_ONE.to_vec()), +3122 "accept side only supports the old version" +3123 ); 3124 -3125 const NOOP_ALPN: &[u8] = b"noop"; -3126 -3127 #[derive(Debug, Clone)] -3128 struct Noop; -3129 -3130 impl ProtocolHandler for Noop { -3131 async fn accept(&self, connection: Connection) -> Result<(), AcceptError> { -3132 connection.closed().await; -3133 Ok(()) -3134 } -3135 } -3136 -3137 async fn noop_server() -> Result<(Router, NodeAddr)> { -3138 let endpoint = Endpoint::builder() -3139 .relay_mode(RelayMode::Disabled) -3140 .bind() -3141 .await -3142 .e()?; -3143 let addr = endpoint.watch_node_addr().initialized().await; -3144 let router = Router::builder(endpoint).accept(NOOP_ALPN, Noop).spawn(); -3145 Ok((router, addr)) -3146 } -3147 -3148 let routers = stream::iter(0..n) -3149 .map(|_| noop_server()) -3150 .buffered_unordered(32) -3151 .collect::<Vec<_>>() -3152 .await -3153 .into_iter() -3154 .collect::<Result<Vec<_>, _>>() -3155 .e()?; +3125 assert_eq!( +3126 alpn_connection_test( +3127 vec![ALPN_TWO.to_vec(), ALPN_ONE.to_vec()], +3128 ALPN_ONE, +3129 vec![ALPN_TWO.to_vec()], +3130 ) +3131 .await?, +3132 Some(ALPN_TWO.to_vec()), +3133 "connect side ALPN order doesn't matter" +3134 ); +3135 +3136 assert_eq!( +3137 alpn_connection_test(vec![ALPN_TWO.to_vec(), ALPN_ONE.to_vec()], ALPN_ONE, vec![],) +3138 .await?, +3139 Some(ALPN_ONE.to_vec()), +3140 "connect side only supports the old version" +3141 ); +3142 +3143 Ok(()) +3144 } +3145 +3146 #[tokio::test] +3147 #[traced_test] +3148 async fn watch_net_report() -> Result { +3149 let endpoint = Endpoint::builder() +3150 .relay_mode(RelayMode::Staging) +3151 .bind() +3152 .await?; +3153 +3154 // can get a first report +3155 endpoint.net_report().updated().await?; 3156 -3157 let addrs = routers -3158 .iter() -3159 .map(|(_, addr)| addr.clone()) -3160 .collect::<Vec<_>>(); -3161 let ids = addrs.iter().map(|addr| addr.node_id).collect::<Vec<_>>(); -3162 let discovery = StaticProvider::from_node_info(addrs); -3163 let endpoint = Endpoint::builder() -3164 .relay_mode(RelayMode::Disabled) -3165 .discovery(discovery) -3166 .bind() -3167 .await -3168 .e()?; -3169 // wait for the endpoint to be initialized. This should not be needed, -3170 // but we don't want to measure endpoint init time but connection time -3171 // from a fully initialized endpoint. -3172 endpoint.watch_node_addr().initialized().await; -3173 let t0 = Instant::now(); -3174 for id in &ids { -3175 let conn = endpoint.connect(*id, NOOP_ALPN).await?; -3176 conn.close(0u32.into(), b"done"); -3177 } -3178 let dt0 = t0.elapsed().as_secs_f64(); -3179 let t1 = Instant::now(); -3180 for id in &ids { -3181 let conn = endpoint.connect(*id, NOOP_ALPN).await?; -3182 conn.close(0u32.into(), b"done"); -3183 } -3184 let dt1 = t1.elapsed().as_secs_f64(); -3185 -3186 assert!(dt0 / dt1 < 20.0, "First round: {dt0}s, second round {dt1}s"); -3187 Ok(()) -3188 } -3189}
    \ No newline at end of file +3157 Ok(()) +3158 } +3159 +3160 /// Tests that initial connection establishment isn't extremely slow compared +3161 /// to subsequent connections. +3162 /// +3163 /// This is a time based test, but uses a very large ratio to reduce flakiness. +3164 /// It also does a number of connections to average out any anomalies. +3165 #[tokio::test] +3166 #[traced_test] +3167 async fn connect_multi_time() -> Result { +3168 let n = 32; +3169 +3170 const NOOP_ALPN: &[u8] = b"noop"; +3171 +3172 #[derive(Debug, Clone)] +3173 struct Noop; +3174 +3175 impl ProtocolHandler for Noop { +3176 async fn accept(&self, connection: Connection) -> Result<(), AcceptError> { +3177 connection.closed().await; +3178 Ok(()) +3179 } +3180 } +3181 +3182 async fn noop_server() -> Result<(Router, NodeAddr)> { +3183 let endpoint = Endpoint::builder() +3184 .relay_mode(RelayMode::Disabled) +3185 .bind() +3186 .await +3187 .e()?; +3188 let addr = endpoint.watch_node_addr().initialized().await; +3189 let router = Router::builder(endpoint).accept(NOOP_ALPN, Noop).spawn(); +3190 Ok((router, addr)) +3191 } +3192 +3193 let routers = stream::iter(0..n) +3194 .map(|_| noop_server()) +3195 .buffered_unordered(32) +3196 .collect::<Vec<_>>() +3197 .await +3198 .into_iter() +3199 .collect::<Result<Vec<_>, _>>() +3200 .e()?; +3201 +3202 let addrs = routers +3203 .iter() +3204 .map(|(_, addr)| addr.clone()) +3205 .collect::<Vec<_>>(); +3206 let ids = addrs.iter().map(|addr| addr.node_id).collect::<Vec<_>>(); +3207 let discovery = StaticProvider::from_node_info(addrs); +3208 let endpoint = Endpoint::builder() +3209 .relay_mode(RelayMode::Disabled) +3210 .discovery(discovery) +3211 .bind() +3212 .await +3213 .e()?; +3214 // wait for the endpoint to be initialized. This should not be needed, +3215 // but we don't want to measure endpoint init time but connection time +3216 // from a fully initialized endpoint. +3217 endpoint.watch_node_addr().initialized().await; +3218 let t0 = Instant::now(); +3219 for id in &ids { +3220 let conn = endpoint.connect(*id, NOOP_ALPN).await?; +3221 conn.close(0u32.into(), b"done"); +3222 } +3223 let dt0 = t0.elapsed().as_secs_f64(); +3224 let t1 = Instant::now(); +3225 for id in &ids { +3226 let conn = endpoint.connect(*id, NOOP_ALPN).await?; +3227 conn.close(0u32.into(), b"done"); +3228 } +3229 let dt1 = t1.elapsed().as_secs_f64(); +3230 +3231 assert!(dt0 / dt1 < 20.0, "First round: {dt0}s, second round {dt1}s"); +3232 Ok(()) +3233 } +3234}

    \ No newline at end of file diff --git a/pr/3488/docs/src/iroh/magicsock/transports/ip.rs.html b/pr/3488/docs/src/iroh/magicsock/transports/ip.rs.html index 8b9d231df9..e272e3fe92 100644 --- a/pr/3488/docs/src/iroh/magicsock/transports/ip.rs.html +++ b/pr/3488/docs/src/iroh/magicsock/transports/ip.rs.html @@ -129,119 +129,134 @@ 129} 130 131impl IpSender { -132 pub(super) fn is_valid_send_addr(&self, addr: &SocketAddr) -> bool { -133 #[allow(clippy::match_like_matches_macro)] -134 match (self.bind_addr, addr) { -135 (SocketAddr::V4(_), SocketAddr::V4(..)) => true, -136 (SocketAddr::V6(_), SocketAddr::V6(..)) => true, -137 _ => false, -138 } -139 } -140 -141 pub(super) async fn send( -142 &self, -143 destination: SocketAddr, -144 src: Option<IpAddr>, -145 transmit: &Transmit<'_>, -146 ) -> io::Result<()> { -147 trace!("sending to {}", destination); -148 let total_bytes = transmit.contents.len() as u64; -149 let res = self -150 .sender -151 .send(&quinn_udp::Transmit { -152 destination, -153 ecn: transmit.ecn, -154 contents: transmit.contents, -155 segment_size: transmit.segment_size, -156 src_ip: src, -157 }) -158 .await; -159 trace!("send res: {:?}", res); -160 -161 match res { -162 Ok(res) => { -163 match destination { -164 SocketAddr::V4(_) => { -165 self.metrics.send_ipv4.inc_by(total_bytes); -166 } -167 SocketAddr::V6(_) => { -168 self.metrics.send_ipv6.inc_by(total_bytes); -169 } -170 } -171 Ok(res) -172 } -173 Err(err) => Err(err), -174 } -175 } -176 -177 pub(super) fn poll_send( -178 mut self: Pin<&mut Self>, -179 cx: &mut std::task::Context, -180 destination: SocketAddr, -181 src: Option<IpAddr>, -182 transmit: &Transmit<'_>, -183 ) -> Poll<io::Result<()>> { -184 trace!("sending to {}", destination); -185 let total_bytes = transmit.contents.len() as u64; -186 let res = Pin::new(&mut self.sender).poll_send( -187 &quinn_udp::Transmit { -188 destination, -189 ecn: transmit.ecn, -190 contents: transmit.contents, -191 segment_size: transmit.segment_size, -192 src_ip: src, -193 }, -194 cx, -195 ); -196 trace!("send res: {:?}", res); -197 -198 match res { -199 Poll::Ready(Ok(res)) => { -200 match destination { -201 SocketAddr::V4(_) => { -202 self.metrics.send_ipv4.inc_by(total_bytes); -203 } -204 SocketAddr::V6(_) => { -205 self.metrics.send_ipv6.inc_by(total_bytes); -206 } -207 } -208 Poll::Ready(Ok(res)) -209 } -210 Poll::Ready(Err(err)) => Poll::Ready(Err(err)), -211 Poll::Pending => Poll::Pending, -212 } -213 } -214 -215 pub(super) fn try_send( -216 &self, -217 destination: SocketAddr, -218 src: Option<IpAddr>, -219 transmit: &Transmit<'_>, -220 ) -> io::Result<()> { -221 trace!("sending to {}", destination); -222 let total_bytes = transmit.contents.len() as u64; -223 let res = self.sender.try_send(&quinn_udp::Transmit { -224 destination, -225 ecn: transmit.ecn, -226 contents: transmit.contents, -227 segment_size: transmit.segment_size, -228 src_ip: src, -229 }); -230 trace!("send res: {:?}", res); -231 -232 match res { -233 Ok(res) => { -234 match destination { -235 SocketAddr::V4(_) => { -236 self.metrics.send_ipv4.inc_by(total_bytes); -237 } -238 SocketAddr::V6(_) => { -239 self.metrics.send_ipv6.inc_by(total_bytes); -240 } -241 } -242 Ok(res) -243 } -244 Err(err) => Err(err), -245 } -246 } -247}
    \ No newline at end of file +132 pub(super) fn is_valid_send_addr(&self, dst: &SocketAddr) -> bool { +133 // Our net-tools crate binds sockets to their specific family. This means an IPv6 +134 // socket can not sent to IPv4, on any platform. So we need to convert and +135 // IPv4-mapped IPv6 address back to it's canonical IPv4 address. +136 let dst_ip = dst.ip().to_canonical(); +137 +138 #[allow(clippy::match_like_matches_macro)] +139 match (self.bind_addr.ip(), dst_ip) { +140 (IpAddr::V4(_), IpAddr::V4(_)) => true, +141 (IpAddr::V6(_), IpAddr::V6(_)) => true, +142 _ => false, +143 } +144 } +145 +146 pub(super) async fn send( +147 &self, +148 destination: SocketAddr, +149 src: Option<IpAddr>, +150 transmit: &Transmit<'_>, +151 ) -> io::Result<()> { +152 trace!("sending to {}", destination); +153 let total_bytes = transmit.contents.len() as u64; +154 let res = self +155 .sender +156 .send(&quinn_udp::Transmit { +157 destination: Self::canonical_addr(destination), +158 ecn: transmit.ecn, +159 contents: transmit.contents, +160 segment_size: transmit.segment_size, +161 src_ip: src, +162 }) +163 .await; +164 trace!("send res: {:?}", res); +165 +166 match res { +167 Ok(res) => { +168 match destination { +169 SocketAddr::V4(_) => { +170 self.metrics.send_ipv4.inc_by(total_bytes); +171 } +172 SocketAddr::V6(_) => { +173 self.metrics.send_ipv6.inc_by(total_bytes); +174 } +175 } +176 Ok(res) +177 } +178 Err(err) => Err(err), +179 } +180 } +181 +182 /// Creates a canonical socket address. +183 /// +184 /// We may be asked to send IPv4-mapped IPv6 addresses. But our sockets are configured +185 /// to only send their actual family. So we need to map those back to the canonical +186 /// addresses. +187 #[inline] +188 fn canonical_addr(addr: SocketAddr) -> SocketAddr { +189 SocketAddr::new(addr.ip().to_canonical(), addr.port()) +190 } +191 +192 pub(super) fn poll_send( +193 mut self: Pin<&mut Self>, +194 cx: &mut std::task::Context, +195 destination: SocketAddr, +196 src: Option<IpAddr>, +197 transmit: &Transmit<'_>, +198 ) -> Poll<io::Result<()>> { +199 trace!("sending to {}", destination); +200 let total_bytes = transmit.contents.len() as u64; +201 let res = Pin::new(&mut self.sender).poll_send( +202 &quinn_udp::Transmit { +203 destination: Self::canonical_addr(destination), +204 ecn: transmit.ecn, +205 contents: transmit.contents, +206 segment_size: transmit.segment_size, +207 src_ip: src, +208 }, +209 cx, +210 ); +211 trace!("send res: {:?}", res); +212 +213 match res { +214 Poll::Ready(Ok(res)) => { +215 match destination { +216 SocketAddr::V4(_) => { +217 self.metrics.send_ipv4.inc_by(total_bytes); +218 } +219 SocketAddr::V6(_) => { +220 self.metrics.send_ipv6.inc_by(total_bytes); +221 } +222 } +223 Poll::Ready(Ok(res)) +224 } +225 Poll::Ready(Err(err)) => Poll::Ready(Err(err)), +226 Poll::Pending => Poll::Pending, +227 } +228 } +229 +230 pub(super) fn try_send( +231 &self, +232 destination: SocketAddr, +233 src: Option<IpAddr>, +234 transmit: &Transmit<'_>, +235 ) -> io::Result<()> { +236 trace!("sending to {}", destination); +237 let total_bytes = transmit.contents.len() as u64; +238 let res = self.sender.try_send(&quinn_udp::Transmit { +239 destination, +240 ecn: transmit.ecn, +241 contents: transmit.contents, +242 segment_size: transmit.segment_size, +243 src_ip: src, +244 }); +245 trace!("send res: {:?}", res); +246 +247 match res { +248 Ok(res) => { +249 match destination { +250 SocketAddr::V4(_) => { +251 self.metrics.send_ipv4.inc_by(total_bytes); +252 } +253 SocketAddr::V6(_) => { +254 self.metrics.send_ipv6.inc_by(total_bytes); +255 } +256 } +257 Ok(res) +258 } +259 Err(err) => Err(err), +260 } +261 } +262}

    \ No newline at end of file diff --git a/pr/3488/docs/trait.impl/core/convert/trait.From.js b/pr/3488/docs/trait.impl/core/convert/trait.From.js index a83a0d9d12..0ab33d9df3 100644 --- a/pr/3488/docs/trait.impl/core/convert/trait.From.js +++ b/pr/3488/docs/trait.impl/core/convert/trait.From.js @@ -1,9 +1,9 @@ (function() { - var implementors = Object.fromEntries([["iroh",[["impl From<PkarrError> for DiscoveryError"],["impl From<AddNodeAddrError> for ConnectWithOptsError"],["impl From<ConnectWithOptsError> for ConnectError"],["impl From<ConnectionError> for AlpnError"],["impl From<ConnectionError> for ConnectError"],["impl From<ConnectionError> for AcceptError"],["impl From<Box<dyn Error + Send + Sync>> for AcceptError"],["impl From<Error> for AcceptError"],["impl From<DiscoveryItem> for NodeInfo"],["impl From<ClosedStream> for AcceptError"],["impl From<RemoteNodeIdError> for AcceptError"],["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<(PublicKey, Option<RelayUrl>, &[SocketAddr])> for NodeAddr"],["impl From<Url> for RelayUrl"],["impl From<NodeAddr> for NodeTicket"],["impl From<PublicKey> for NodeAddr"],["impl From<RelayUrl> for Url"],["impl From<NodeTicket> for NodeAddr"],["impl From<DecodeError> for KeyParsingError"],["impl From<DecodeError> for ParseError"],["impl From<Error> for KeyParsingError"],["impl From<Error> for ParseError"],["impl From<SigningKey> for SecretKey"],["impl From<VerifyingKey> for PublicKey"],["impl From<[u8; 32]> for SecretKey"]]],["iroh_relay",[["impl From<DialError> for ConnectError"],["impl From<DnsError> for DialError"],["impl From<DecodingError> for ParseError"],["impl From<FrameType> for u32"],["impl From<FrameType> for VarInt"],["impl From<FrameTypeError> for Error"],["impl From<FrameTypeError> for Error"],["impl From<Error> for ConnectError"],["impl From<Error> for RecvError"],["impl From<Vec<Box<[u8]>>> for TxtRecordData"],["impl From<Error> for DialError"],["impl From<NodeInfo> for NodeAddr"],["impl From<RelayNode> 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 RecvError"],["impl From<Error> for SendError"],["impl From<Error> for Error"],["impl From<Error> for Error"],["impl From<JoinError> for SupervisorError"],["impl From<NodeAddr> for NodeData"],["impl From<NodeAddr> for NodeInfo"],["impl From<RecvError> for Error"],["impl From<RelayUrl> for RelayMap"],["impl From<RelayUrl> for RelayNode"],["impl From<ResolveError> for DnsError"],["impl From<SignedPacketBuildError> for EncodingError"],["impl<T: AsRef<[u8]>> From<T> for Datagrams"]]]]); + var implementors = Object.fromEntries([["iroh",[["impl From<PkarrError> for DiscoveryError"],["impl From<AddNodeAddrError> for ConnectWithOptsError"],["impl From<ConnectWithOptsError> for ConnectError"],["impl From<ConnectionError> for AlpnError"],["impl From<ConnectionError> for ConnectError"],["impl From<ConnectionError> for AcceptError"],["impl From<Box<dyn Error + Send + Sync>> for AcceptError"],["impl From<Error> for AcceptError"],["impl From<DiscoveryItem> for NodeInfo"],["impl From<ClosedStream> for AcceptError"],["impl From<RemoteNodeIdError> for AcceptError"],["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<(PublicKey, Option<RelayUrl>, &[SocketAddr])> for NodeAddr"],["impl From<Url> for RelayUrl"],["impl From<NodeAddr> for NodeTicket"],["impl From<PublicKey> for NodeAddr"],["impl From<RelayUrl> for Url"],["impl From<NodeTicket> for NodeAddr"],["impl From<DecodeError> for KeyParsingError"],["impl From<DecodeError> for ParseError"],["impl From<Error> for KeyParsingError"],["impl From<Error> for ParseError"],["impl From<SigningKey> for SecretKey"],["impl From<VerifyingKey> for PublicKey"],["impl From<[u8; 32]> for SecretKey"]]],["iroh_relay",[["impl From<DialError> for ConnectError"],["impl From<DnsError> for DialError"],["impl From<DecodingError> for ParseError"],["impl From<FrameType> for u32"],["impl From<FrameType> for VarInt"],["impl From<FrameTypeError> for Error"],["impl From<FrameTypeError> for Error"],["impl From<Error> for ConnectError"],["impl From<Error> for RecvError"],["impl From<Vec<Box<[u8]>>> for TxtRecordData"],["impl From<Error> for DialError"],["impl From<NodeAddr> for NodeData"],["impl From<NodeAddr> for NodeInfo"],["impl From<RelayUrl> for RelayMap"],["impl From<RelayUrl> for RelayNode"],["impl From<NodeInfo> for NodeAddr"],["impl From<RelayNode> 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 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 From<SignedPacketBuildError> for EncodingError"],["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":[6459,4938,10893]} \ No newline at end of file +//{"start":57,"fragment_lengths":[6459,4938,11503]} \ No newline at end of file diff --git a/pr/3488/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js b/pr/3488/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js index bdc1bf6fa3..8c038d8a54 100644 --- a/pr/3488/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js +++ b/pr/3488/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<RelayNode> for RelayMap"],["impl FromIterator<RelayUrl> for RelayMap"]]]]); + var implementors = Object.fromEntries([["iroh_relay",[["impl FromIterator<Box<[u8]>> for TxtRecordData"],["impl FromIterator<RelayUrl> for RelayMap"],["impl FromIterator<RelayNode> for RelayMap"]]]]); if (window.register_implementors) { window.register_implementors(implementors); } else { window.pending_implementors = implementors; } })() -//{"start":57,"fragment_lengths":[1356]} \ No newline at end of file +//{"start":57,"fragment_lengths":[1478]} \ No newline at end of file diff --git a/pr/3488/docs/type.impl/iroh/struct.PublicKey.js b/pr/3488/docs/type.impl/iroh/struct.PublicKey.js index 1ce01933e1..b2a9a8cc23 100644 --- a/pr/3488/docs/type.impl/iroh/struct.PublicKey.js +++ b/pr/3488/docs/type.impl/iroh/struct.PublicKey.js @@ -1,9 +1,9 @@ (function() { - var type_impls = Object.fromEntries([["iroh",[["
    §

    impl AsRef<[u8]> for PublicKey

    §

    fn as_ref(&self) -> &[u8] ⓘ

    Converts this type into a shared reference of the (usually inferred) input type.
    ","AsRef<[u8]>","iroh::NodeId"],["
    §

    impl Borrow<[u8; 32]> for PublicKey

    §

    fn borrow(&self) -> &[u8; 32]

    Immutably borrows from an owned value. Read more
    ","Borrow<[u8; 32]>","iroh::NodeId"],["
    §

    impl Clone for PublicKey

    §

    fn clone(&self) -> PublicKey

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

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

    Performs copy-assignment from source. Read more
    ","Clone","iroh::NodeId"],["
    §

    impl Debug for PublicKey

    §

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

    Formats the value using the given formatter. Read more
    ","Debug","iroh::NodeId"],["
    §

    impl Deref for PublicKey

    §

    type Target = [u8; 32]

    The resulting type after dereferencing.
    §

    fn deref(&self) -> &<PublicKey as Deref>::Target

    Dereferences the value.
    ","Deref","iroh::NodeId"],["
    §

    impl<'de> Deserialize<'de> for PublicKey

    §

    fn deserialize<D>(\n deserializer: D,\n) -> Result<PublicKey, <D as Deserializer<'de>>::Error>
    where\n D: Deserializer<'de>,

    Deserialize this value from the given Serde deserializer. Read more
    ","Deserialize<'de>","iroh::NodeId"],["
    §

    impl Display for PublicKey

    §

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

    Formats the value using the given formatter. Read more
    ","Display","iroh::NodeId"],["
    §

    impl From<VerifyingKey> for PublicKey

    §

    fn from(verifying_key: VerifyingKey) -> PublicKey

    Converts to this type from the input type.
    ","From","iroh::NodeId"],["
    §

    impl FromStr for PublicKey

    Deserialises the PublicKey from it’s base32 encoding.

    \n

    Display is capable of serialising this format.

    \n
    §

    type Err = KeyParsingError

    The associated error which can be returned from parsing.
    §

    fn from_str(s: &str) -> Result<PublicKey, <PublicKey as FromStr>::Err>

    Parses a string s to return a value of this type. Read more
    ","FromStr","iroh::NodeId"],["
    §

    impl Hash for PublicKey

    §

    fn hash<H>(&self, state: &mut H)
    where\n H: Hasher,

    Feeds this value into the given Hasher. Read more
    1.3.0 · Source§

    fn hash_slice<H>(data: &[Self], state: &mut H)
    where\n H: Hasher,\n Self: Sized,

    Feeds a slice of this type into the given Hasher. Read more
    ","Hash","iroh::NodeId"],["
    Source§

    impl NodeIdExt for PublicKey

    Source§

    fn to_z32(&self) -> String

    Encodes a NodeId in [z-base-32] encoding.
    Source§

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

    Parses a NodeId from [z-base-32] encoding.
    ","NodeIdExt","iroh::NodeId"],["
    §

    impl Ord for PublicKey

    §

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

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

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

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

    fn min(self, other: Self) -> Self
    where\n 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\n Self: Sized,

    Restrict a value to a certain interval. Read more
    ","Ord","iroh::NodeId"],["
    §

    impl PartialEq for PublicKey

    §

    fn eq(&self, other: &PublicKey) -> 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,\nand should not be overridden without very good reason.
    ","PartialEq","iroh::NodeId"],["
    §

    impl PartialOrd for PublicKey

    §

    fn partial_cmp(&self, other: &PublicKey) -> Option<Ordering>

    This method returns an ordering between self and other values if one exists. Read more
    1.0.0 · Source§

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

    Tests less than (for self and other) and is used by the < operator. Read more
    1.0.0 · Source§

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

    Tests less than or equal to (for self and other) and is used by the\n<= operator. Read more
    1.0.0 · Source§

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

    Tests greater than (for self and other) and is used by the >\noperator. Read more
    1.0.0 · Source§

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

    Tests greater than or equal to (for self and other) and is used by\nthe >= operator. Read more
    ","PartialOrd","iroh::NodeId"],["
    §

    impl PublicKey

    pub const LENGTH: usize = 32usize

    The length of an ed25519 PublicKey, in bytes.

    \n

    pub fn as_bytes(&self) -> &[u8; 32]

    Get this public key as a byte array.

    \n

    pub fn public(&self) -> VerifyingKey

    Returns the [VerifyingKey] for this PublicKey.

    \n

    pub fn from_bytes(bytes: &[u8; 32]) -> Result<PublicKey, Error>

    Construct a PublicKey from a slice of bytes.

    \n
    §Warning
    \n

    This will return a [SignatureError] if the bytes passed into this method do not represent\na valid ed25519_dalek curve point. Will never fail for bytes return from Self::as_bytes.\nSee [VerifyingKey::from_bytes] for details.

    \n

    pub fn verify(&self, message: &[u8], signature: &Signature) -> Result<(), Error>

    Verify a signature on a message with this secret key’s public key.

    \n
    §Return
    \n

    Returns Ok(()) if the signature is valid, and Err otherwise.

    \n

    pub fn fmt_short(&self) -> impl Display + 'static

    Convert to a hex string limited to the first 5 bytes for a friendly string\nrepresentation of the key.

    \n
    ",0,"iroh::NodeId"],["
    §

    impl Serialize for PublicKey

    §

    fn serialize<S>(\n &self,\n serializer: S,\n) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
    where\n S: Serializer,

    Serialize this value into the given Serde serializer. Read more
    ","Serialize","iroh::NodeId"],["
    §

    impl TryFrom<&[u8]> for PublicKey

    §

    type Error = Error

    The type returned in the event of a conversion error.
    §

    fn try_from(\n bytes: &[u8],\n) -> Result<PublicKey, <PublicKey as TryFrom<&[u8]>>::Error>

    Performs the conversion.
    ","TryFrom<&[u8]>","iroh::NodeId"],["
    §

    impl TryFrom<&[u8; 32]> for PublicKey

    §

    type Error = Error

    The type returned in the event of a conversion error.
    §

    fn try_from(\n bytes: &[u8; 32],\n) -> Result<PublicKey, <PublicKey as TryFrom<&[u8; 32]>>::Error>

    Performs the conversion.
    ","TryFrom<&[u8; 32]>","iroh::NodeId"],["
    §

    impl Copy for PublicKey

    ","Copy","iroh::NodeId"],["
    §

    impl Eq for PublicKey

    ","Eq","iroh::NodeId"],["
    §

    impl StructuralPartialEq for PublicKey

    ","StructuralPartialEq","iroh::NodeId"]]]]); + var type_impls = Object.fromEntries([["iroh",[["
    Source§

    impl AsRef<[u8]> for PublicKey

    Source§

    fn as_ref(&self) -> &[u8] ⓘ

    Converts this type into a shared reference of the (usually inferred) input type.
    ","AsRef<[u8]>","iroh::NodeId"],["
    Source§

    impl Borrow<[u8; 32]> for PublicKey

    Source§

    fn borrow(&self) -> &[u8; 32]

    Immutably borrows from an owned value. Read more
    ","Borrow<[u8; 32]>","iroh::NodeId"],["
    Source§

    impl Clone for PublicKey

    Source§

    fn clone(&self) -> PublicKey

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

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

    Performs copy-assignment from source. Read more
    ","Clone","iroh::NodeId"],["
    Source§

    impl Debug for PublicKey

    Source§

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

    Formats the value using the given formatter. Read more
    ","Debug","iroh::NodeId"],["
    Source§

    impl Deref for PublicKey

    Source§

    type Target = [u8; 32]

    The resulting type after dereferencing.
    Source§

    fn deref(&self) -> &<PublicKey as Deref>::Target

    Dereferences the value.
    ","Deref","iroh::NodeId"],["
    Source§

    impl<'de> Deserialize<'de> for PublicKey

    Source§

    fn deserialize<D>(\n deserializer: D,\n) -> Result<PublicKey, <D as Deserializer<'de>>::Error>
    where\n D: Deserializer<'de>,

    Deserialize this value from the given Serde deserializer. Read more
    ","Deserialize<'de>","iroh::NodeId"],["
    Source§

    impl Display for PublicKey

    Source§

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

    Formats the value using the given formatter. Read more
    ","Display","iroh::NodeId"],["
    Source§

    impl From<VerifyingKey> for PublicKey

    Source§

    fn from(verifying_key: VerifyingKey) -> PublicKey

    Converts to this type from the input type.
    ","From","iroh::NodeId"],["
    Source§

    impl FromStr for PublicKey

    Deserialises the PublicKey from it’s base32 encoding.

    \n

    Display is capable of serialising this format.

    \n
    Source§

    type Err = KeyParsingError

    The associated error which can be returned from parsing.
    Source§

    fn from_str(s: &str) -> Result<PublicKey, <PublicKey as FromStr>::Err>

    Parses a string s to return a value of this type. Read more
    ","FromStr","iroh::NodeId"],["
    Source§

    impl Hash for PublicKey

    Source§

    fn hash<H>(&self, state: &mut H)
    where\n H: Hasher,

    Feeds this value into the given Hasher. Read more
    1.3.0 · Source§

    fn hash_slice<H>(data: &[Self], state: &mut H)
    where\n H: Hasher,\n Self: Sized,

    Feeds a slice of this type into the given Hasher. Read more
    ","Hash","iroh::NodeId"],["
    Source§

    impl NodeIdExt for PublicKey

    Source§

    fn to_z32(&self) -> String

    Encodes a NodeId in [z-base-32] encoding.
    Source§

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

    Parses a NodeId from [z-base-32] encoding.
    ","NodeIdExt","iroh::NodeId"],["
    Source§

    impl Ord for PublicKey

    Source§

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

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

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

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

    fn min(self, other: Self) -> Self
    where\n 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\n Self: Sized,

    Restrict a value to a certain interval. Read more
    ","Ord","iroh::NodeId"],["
    Source§

    impl PartialEq for PublicKey

    Source§

    fn eq(&self, other: &PublicKey) -> 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,\nand should not be overridden without very good reason.
    ","PartialEq","iroh::NodeId"],["
    Source§

    impl PartialOrd for PublicKey

    Source§

    fn partial_cmp(&self, other: &PublicKey) -> Option<Ordering>

    This method returns an ordering between self and other values if one exists. Read more
    1.0.0 · Source§

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

    Tests less than (for self and other) and is used by the < operator. Read more
    1.0.0 · Source§

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

    Tests less than or equal to (for self and other) and is used by the\n<= operator. Read more
    1.0.0 · Source§

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

    Tests greater than (for self and other) and is used by the >\noperator. Read more
    1.0.0 · Source§

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

    Tests greater than or equal to (for self and other) and is used by\nthe >= operator. Read more
    ","PartialOrd","iroh::NodeId"],["
    Source§

    impl PublicKey

    Source

    pub const LENGTH: usize = 32usize

    The length of an ed25519 PublicKey, in bytes.

    \n
    Source

    pub fn as_bytes(&self) -> &[u8; 32]

    Get this public key as a byte array.

    \n
    Source

    pub fn public(&self) -> VerifyingKey

    Returns the [VerifyingKey] for this PublicKey.

    \n
    Source

    pub fn from_bytes(bytes: &[u8; 32]) -> Result<PublicKey, Error>

    Construct a PublicKey from a slice of bytes.

    \n
    §Warning
    \n

    This will return a [SignatureError] if the bytes passed into this method do not represent\na valid ed25519_dalek curve point. Will never fail for bytes return from Self::as_bytes.\nSee [VerifyingKey::from_bytes] for details.

    \n
    Source

    pub fn verify(&self, message: &[u8], signature: &Signature) -> Result<(), Error>

    Verify a signature on a message with this secret key’s public key.

    \n
    §Return
    \n

    Returns Ok(()) if the signature is valid, and Err otherwise.

    \n
    Source

    pub fn fmt_short(&self) -> impl Display + 'static

    Convert to a hex string limited to the first 5 bytes for a friendly string\nrepresentation of the key.

    \n
    ",0,"iroh::NodeId"],["
    Source§

    impl Serialize for PublicKey

    Source§

    fn serialize<S>(\n &self,\n serializer: S,\n) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
    where\n S: Serializer,

    Serialize this value into the given Serde serializer. Read more
    ","Serialize","iroh::NodeId"],["
    Source§

    impl TryFrom<&[u8]> for PublicKey

    Source§

    type Error = Error

    The type returned in the event of a conversion error.
    Source§

    fn try_from(\n bytes: &[u8],\n) -> Result<PublicKey, <PublicKey as TryFrom<&[u8]>>::Error>

    Performs the conversion.
    ","TryFrom<&[u8]>","iroh::NodeId"],["
    Source§

    impl TryFrom<&[u8; 32]> for PublicKey

    Source§

    type Error = Error

    The type returned in the event of a conversion error.
    Source§

    fn try_from(\n bytes: &[u8; 32],\n) -> Result<PublicKey, <PublicKey as TryFrom<&[u8; 32]>>::Error>

    Performs the conversion.
    ","TryFrom<&[u8; 32]>","iroh::NodeId"],["
    Source§

    impl Copy for PublicKey

    ","Copy","iroh::NodeId"],["
    Source§

    impl Eq for PublicKey

    ","Eq","iroh::NodeId"],["
    Source§

    impl StructuralPartialEq for PublicKey

    ","StructuralPartialEq","iroh::NodeId"]]]]); if (window.register_type_impls) { window.register_type_impls(type_impls); } else { window.pending_type_impls = type_impls; } })() -//{"start":55,"fragment_lengths":[46932]} \ No newline at end of file +//{"start":55,"fragment_lengths":[50412]} \ No newline at end of file