Expand description
A discovery service which publishes and resolves node information using a pkarr relay.
+Expand description
A discovery service which publishes and resolves node information using a pkarr relay.
Public-Key Addressable Resource Records, pkarr, is a system which allows publishing
DNS Resource Records owned by a particular SecretKey under a name derived from its
corresponding PublicKey, also known as the NodeId. Additionally this pkarr
diff --git a/pr/3279/docs/iroh/discovery/pkarr/struct.PkarrRelayClient.html b/pr/3279/docs/iroh/discovery/pkarr/struct.PkarrRelayClient.html
index 9ef36dfb70..c4a06679ed 100644
--- a/pr/3279/docs/iroh/discovery/pkarr/struct.PkarrRelayClient.html
+++ b/pr/3279/docs/iroh/discovery/pkarr/struct.PkarrRelayClient.html
@@ -1,7 +1,7 @@
pub struct PkarrRelayClient { /* private fields */ }Expand description
A pkarr client to publish [pkarr::SignedPacket]s to a pkarr relay.
Implementations§
Source§impl PkarrRelayClient
impl PkarrRelayClient
Implementations§
Trait Implementations§
Source§impl Clone for PkarrRelayClient
impl Clone for PkarrRelayClient
Source§fn clone(&self) -> PkarrRelayClient
fn clone(&self) -> PkarrRelayClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PkarrRelayClient
impl !RefUnwindSafe for PkarrRelayClient
impl Send for PkarrRelayClient
impl Sync for PkarrRelayClient
impl Unpin for PkarrRelayClient
impl !UnwindSafe for PkarrRelayClient
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
diff --git a/pr/3279/docs/iroh/endpoint/enum.DirectAddrType.html b/pr/3279/docs/iroh/endpoint/enum.DirectAddrType.html
index 250f32b184..cd03fde0cc 100644
--- a/pr/3279/docs/iroh/endpoint/enum.DirectAddrType.html
+++ b/pr/3279/docs/iroh/endpoint/enum.DirectAddrType.html
@@ -1,4 +1,4 @@
-DirectAddrType in iroh::endpoint - Rust pub enum DirectAddrType {
+DirectAddrType in iroh::endpoint - Rust pub enum DirectAddrType {
Unknown,
Local,
Stun,
@@ -20,16 +20,16 @@ get a publicly routable direct address.
It is possible to configure iroh to bound to a specific port and independently
configure the router to forward this port to the iroh node. This indicates a
situation like this, which still uses STUN to discover the public address.
-
Trait Implementations§
Source§impl Clone for DirectAddrType
Source§fn clone(&self) -> DirectAddrType
Returns a copy of the value. Read more1.0.0 · Source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read moreSource§impl Debug for DirectAddrType
Source§impl Display for DirectAddrType
Source§impl Hash for DirectAddrType
1.3.0 · Source§fn hash_slice<H>(data: &[Self], state: &mut H)where
+
Trait Implementations§
Source§impl Clone for DirectAddrType
Source§fn clone(&self) -> DirectAddrType
Returns a copy of the value. Read more1.0.0 · Source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read moreSource§impl Debug for DirectAddrType
Source§impl Display for DirectAddrType
Source§impl Hash for DirectAddrType
Source§impl Ord for DirectAddrType
Source§impl Ord for DirectAddrType
Source§fn cmp(&self, other: &DirectAddrType) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read moreSource§impl PartialEq for DirectAddrType
Source§impl PartialOrd for DirectAddrType
Source§impl PartialEq for DirectAddrType
Source§impl PartialOrd for DirectAddrType
Source§impl Copy for DirectAddrType
Source§impl Eq for DirectAddrType
Source§impl StructuralPartialEq for DirectAddrType
Auto Trait Implementations§
§impl Freeze for DirectAddrType
§impl RefUnwindSafe for DirectAddrType
§impl Send for DirectAddrType
§impl Sync for DirectAddrType
§impl Unpin for DirectAddrType
§impl UnwindSafe for DirectAddrType
Blanket Implementations§
Source§impl Copy for DirectAddrType
Source§impl Eq for DirectAddrType
Source§impl StructuralPartialEq for DirectAddrType
Auto Trait Implementations§
§impl Freeze for DirectAddrType
§impl RefUnwindSafe for DirectAddrType
§impl Send for DirectAddrType
§impl Sync for DirectAddrType
§impl Unpin for DirectAddrType
§impl UnwindSafe for DirectAddrType
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§fn implicit(
diff --git a/pr/3279/docs/iroh/endpoint/struct.DirectAddr.html b/pr/3279/docs/iroh/endpoint/struct.DirectAddr.html
index 60737b50aa..79ccfcbde2 100644
--- a/pr/3279/docs/iroh/endpoint/struct.DirectAddr.html
+++ b/pr/3279/docs/iroh/endpoint/struct.DirectAddr.html
@@ -1,4 +1,4 @@
-DirectAddr in iroh::endpoint - Rust pub struct DirectAddr {
+DirectAddr in iroh::endpoint - Rust pub struct DirectAddr {
pub addr: SocketAddr,
pub typ: DirectAddrType,
}
Expand description
A direct address on which an iroh-node might be contactable.
@@ -7,16 +7,16 @@ contacted. These can come from various sources depending on the network topolog
iroh node, see DirectAddrType for the several kinds of sources.
Fields§
§addr: SocketAddrThe address.
§typ: DirectAddrTypeThe origin of this direct address.
-Trait Implementations§
Source§impl Clone for DirectAddr
Source§fn clone(&self) -> DirectAddr
Returns a copy of the value. Read more1.0.0 · Source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read moreSource§impl Debug for DirectAddr
Source§impl Hash for DirectAddr
1.3.0 · Source§fn hash_slice<H>(data: &[Self], state: &mut H)where
+Trait Implementations§
Source§impl Clone for DirectAddr
Source§fn clone(&self) -> DirectAddr
Returns a copy of the value. Read more1.0.0 · Source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read moreSource§impl Debug for DirectAddr
Source§impl Hash for DirectAddr
Source§impl Ord for DirectAddr
Source§impl Ord for DirectAddr
Source§fn cmp(&self, other: &DirectAddr) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read moreSource§impl PartialEq for DirectAddr
Source§impl PartialOrd for DirectAddr
Source§impl PartialEq for DirectAddr
Source§impl PartialOrd for DirectAddr
Source§impl Eq for DirectAddr
Source§impl StructuralPartialEq for DirectAddr
Auto Trait Implementations§
§impl Freeze for DirectAddr
§impl RefUnwindSafe for DirectAddr
§impl Send for DirectAddr
§impl Sync for DirectAddr
§impl Unpin for DirectAddr
§impl UnwindSafe for DirectAddr
Blanket Implementations§
Source§impl Eq for DirectAddr
Source§impl StructuralPartialEq for DirectAddr
Auto Trait Implementations§
§impl Freeze for DirectAddr
§impl RefUnwindSafe for DirectAddr
§impl Send for DirectAddr
§impl Sync for DirectAddr
§impl Unpin for DirectAddr
§impl UnwindSafe for DirectAddr
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§fn implicit(
diff --git a/pr/3279/docs/iroh_dns_server/struct.ZoneStore.html b/pr/3279/docs/iroh_dns_server/struct.ZoneStore.html
index f4933c29e4..4eedd7f167 100644
--- a/pr/3279/docs/iroh_dns_server/struct.ZoneStore.html
+++ b/pr/3279/docs/iroh_dns_server/struct.ZoneStore.html
@@ -1,7 +1,7 @@
ZoneStore in iroh_dns_server - Rust pub struct ZoneStore { /* private fields */ }
Expand description
A store for pkarr signed packets.
Packets are stored in the persistent SignedPacketStore, and cached on-demand in an in-memory LRU
cache used for resolving DNS queries.
-Implementations§
Source§impl ZoneStore
Sourcepub fn persistent(
+
Implementations§
Sourcepub async fn resolve(
&self,
pubkey: &PublicKeyBytes,
name: &Name,
record_type: RecordType,
) -> Result<Option<Arc<RecordSet>>>
Resolve a DNS query.
-Sourcepub async fn get_signed_packet(
+
Sourcepub async fn get_signed_packet(
&self,
pubkey: &PublicKeyBytes,
) -> Result<Option<SignedPacket>>
Get the latest signed packet for a pubkey.
-Sourcepub async fn insert(
&self,
signed_packet: SignedPacket,
_source: PacketSource,
diff --git a/pr/3279/docs/iroh_relay/client/enum.ReceivedMessage.html b/pr/3279/docs/iroh_relay/client/enum.ReceivedMessage.html
index 535193a6c8..d612779969 100644
--- a/pr/3279/docs/iroh_relay/client/enum.ReceivedMessage.html
+++ b/pr/3279/docs/iroh_relay/client/enum.ReceivedMessage.html
@@ -1,9 +1,9 @@
ReceivedMessage in iroh_relay::client - Rust pub enum ReceivedMessage {
ReceivedPacket {
- remote_node_id: NodeId,
+ remote_node_id: NodeId,
data: Bytes,
},
- NodeGone(NodeId),
+ NodeGone(NodeId),
Ping([u8; 8]),
Pong([u8; 8]),
KeepAlive,
@@ -17,9 +17,9 @@
}
Expand description
The messages received from a framed relay stream.
This is a type-validated version of the Frames on the RelayCodec.
Variants§
§ReceivedPacket
Represents an incoming packet.
-Fields
§NodeGone(NodeId)
Indicates that the client identified by the underlying public key had previously sent you a
packet but has now disconnected from the server.
§Ping([u8; 8])
Request from a client or server to reply to the
other side with a ReceivedMessage::Pong with the given payload.
diff --git a/pr/3279/docs/iroh_relay/client/enum.SendMessage.html b/pr/3279/docs/iroh_relay/client/enum.SendMessage.html
index 55d5cca41d..cf87651734 100644
--- a/pr/3279/docs/iroh_relay/client/enum.SendMessage.html
+++ b/pr/3279/docs/iroh_relay/client/enum.SendMessage.html
@@ -1,9 +1,9 @@
SendMessage in iroh_relay::client - Rust pub enum SendMessage {
- SendPacket(NodeId, Bytes),
+ SendPacket(NodeId, Bytes),
Ping([u8; 8]),
Pong([u8; 8]),
}
Expand description
Messages we can send to a relay server.
-Variants§
§SendPacket(NodeId, Bytes)
Send a packet of data to the [NodeId].
+Variants§
§SendPacket(NodeId, Bytes)
Send a packet of data to the NodeId.
§Ping([u8; 8])
Sends a ping message to the connected relay server.
§Pong([u8; 8])
Sends a pong message to the connected relay server.
Trait Implementations§
Source§impl Debug for SendMessage
Source§impl Sink<SendMessage> for Client
Source§type Error = ConnSendError
The type of value produced by the sink when an error occurs.Source§fn poll_ready(
diff --git a/pr/3279/docs/iroh_relay/client/struct.ClientBuilder.html b/pr/3279/docs/iroh_relay/client/struct.ClientBuilder.html
index 22ed2c5e40..4f94efe715 100644
--- a/pr/3279/docs/iroh_relay/client/struct.ClientBuilder.html
+++ b/pr/3279/docs/iroh_relay/client/struct.ClientBuilder.html
@@ -1,7 +1,7 @@
ClientBuilder in iroh_relay::client - Rust pub struct ClientBuilder { /* private fields */ }
Expand description
Build a Client.
Implementations§
Source§impl ClientBuilder
Sourcepub fn new(
- url: impl Into<RelayUrl>,
- secret_key: SecretKey,
+ url: impl Into<RelayUrl>,
+ secret_key: SecretKey,
dns_resolver: DnsResolver,
) -> Self
Create a new ClientBuilder
Sourcepub fn protocol(self, protocol: Protocol) -> Self
Sets whether to connect to the relay via websockets or not.
diff --git a/pr/3279/docs/iroh_relay/dns/struct.DnsResolver.html b/pr/3279/docs/iroh_relay/dns/struct.DnsResolver.html
index ea537effea..7c5a185de6 100644
--- a/pr/3279/docs/iroh_relay/dns/struct.DnsResolver.html
+++ b/pr/3279/docs/iroh_relay/dns/struct.DnsResolver.html
@@ -67,9 +67,9 @@ at T+0ms, T+200ms and T+300ms. The timeout is applied as stated in
summary of all errors otherwise.
Sourcepub async fn lookup_node_by_id(
&self,
- node_id: &NodeId,
+ node_id: &NodeId,
origin: &str,
-) -> Result<NodeInfo>
Looks up node info by [NodeId] and origin domain name.
+) -> Result<NodeInfo>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.
Sourcepub async fn lookup_node_by_domain_name(&self, name: &str) -> Result<NodeInfo>
Looks up node info by DNS name.
@@ -84,10 +84,10 @@ at T+0ms, T+200ms and T+300ms. The result of the first successful call is return
summary of all errors otherwise.
Sourcepub async fn lookup_node_by_id_staggered(
&self,
- node_id: &NodeId,
+ node_id: &NodeId,
origin: &str,
delays_ms: &[u64],
-) -> Result<NodeInfo>
Looks up node info by [NodeId] and origin domain name.
+) -> Result<NodeInfo>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/3279/docs/iroh_relay/index.html b/pr/3279/docs/iroh_relay/index.html
index aa17a382d4..b45ccff8c4 100644
--- a/pr/3279/docs/iroh_relay/index.html
+++ b/pr/3279/docs/iroh_relay/index.html
@@ -25,6 +25,6 @@ Tailscale.
STUN support and expose metrics.
-Re-exports§
pub use protos::relay::MAX_PACKET_SIZE;
Modules§
- Exposes
Client, which allows to establish connections to a relay server. - Default values used in the relay.
- dns
Non-wasm_browser DNS resolver - HTTP-specific constants for the relay server and client.
- Support for handling DNS resource records for dialing by [
NodeId]. - Protocols used by the iroh-relay
- Create a QUIC server that accepts connections
+
Re-exports§
pub use protos::relay::MAX_PACKET_SIZE;
Modules§
- Exposes
Client, which allows to establish connections to a relay server. - Default values used in the relay.
- dns
Non-wasm_browser DNS resolver - HTTP-specific constants for the relay server and client.
- Support for handling DNS resource records for dialing by
NodeId. - Protocols used by the iroh-relay
- Create a QUIC server that accepts connections
for QUIC address discovery.
- server
server A fully-fledged iroh-relay server over HTTP or HTTPS.
Structs§
- Tracks pings on a single relay connection.
- Configuration of all the relay servers that can be used.
- Information on a specific relay server.
- 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/3279/docs/iroh_relay/node_info/index.html b/pr/3279/docs/iroh_relay/node_info/index.html
index daa1aa3c65..e55baaed6c 100644
--- a/pr/3279/docs/iroh_relay/node_info/index.html
+++ b/pr/3279/docs/iroh_relay/node_info/index.html
@@ -1,5 +1,5 @@
-iroh_relay::node_info - Rust 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 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].
+
<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:
- Structs§
- Error returned when an input value is too long for
UserData. - Data about a node that may be published to and resolved from discovery services.
- Information about a node that may be published to and resolved from discovery services.
- Under the hood this is a UTF-8 String is no longer than
UserData::MAX_LENGTH bytes.
Constants§
- The DNS name for the iroh TXT record.
Traits§
- Extension methods for [
NodeId] to encode to and decode from [z32],
+Structs§
- Error returned when an input value is too long for
UserData. - Data about a node that may be published to and resolved from discovery services.
- Information about a node that may be published to and resolved from discovery services.
- Under the hood this is a UTF-8 String is no longer than
UserData::MAX_LENGTH bytes.
Constants§
- The DNS name for the iroh TXT record.
Traits§
- 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/3279/docs/iroh_relay/node_info/struct.NodeData.html b/pr/3279/docs/iroh_relay/node_info/struct.NodeData.html
index f4a1f6e4b0..4a3e6db1c8 100644
--- a/pr/3279/docs/iroh_relay/node_info/struct.NodeData.html
+++ b/pr/3279/docs/iroh_relay/node_info/struct.NodeData.html
@@ -1,20 +1,20 @@
NodeData in iroh_relay::node_info - Rust 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
Sourcepub 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.
-Sourcepub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self
Sets the relay URL and returns the updated node data.
+Sourcepub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self
Sets the relay URL and returns the updated node data.
Sourcepub fn with_direct_addresses(
self,
direct_addresses: BTreeSet<SocketAddr>,
) -> Self
Sets the direct addresses and returns the updated node data.
Sourcepub fn with_user_data(self, user_data: Option<UserData>) -> Self
Sets the user-defined data and returns the updated node data.
-Sourcepub fn user_data(&self) -> Option<&UserData>
Returns the optional user-defined data of the node.
Sourcepub fn direct_addresses(&self) -> &BTreeSet<SocketAddr>
Returns the direct addresses of the node.
Sourcepub 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.
-Sourcepub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)
Sets the relay URL of the node data.
+Sourcepub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)
Sets the relay URL of the node data.
Sourcepub fn set_user_data(&mut self, user_data: Option<UserData>)
Sets the user-defined data of the node data.
-Trait Implementations§
Trait Implementations§
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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
diff --git a/pr/3279/docs/iroh_relay/node_info/struct.NodeInfo.html b/pr/3279/docs/iroh_relay/node_info/struct.NodeInfo.html
index cd66ba54e3..dde190c92b 100644
--- a/pr/3279/docs/iroh_relay/node_info/struct.NodeInfo.html
+++ b/pr/3279/docs/iroh_relay/node_info/struct.NodeInfo.html
@@ -1,30 +1,30 @@
NodeInfo in iroh_relay::node_info - Rust 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: NodeIdThe [NodeId] of the node this is about.
+
+Fields§
§node_id: NodeIdThe NodeId of the node this is about.
§data: NodeDataThe information published about the node.
-Implementations§
Source§impl NodeInfo
Sourcepub fn from_parts(node_id: NodeId, data: NodeData) -> Self
Creates a new NodeInfo from its parts.
-Sourcepub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self
Sets the relay URL and returns the updated node info.
+Implementations§
Source§impl NodeInfo
Sourcepub fn from_parts(node_id: NodeId, data: NodeData) -> Self
Creates a new NodeInfo from its parts.
+Sourcepub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self
Sets the relay URL and returns the updated node info.
Sourcepub fn with_direct_addresses(
self,
direct_addresses: BTreeSet<SocketAddr>,
) -> Self
Sets the direct addresses and returns the updated node info.
Sourcepub fn with_user_data(self, user_data: Option<UserData>) -> Self
Sets the user-defined data and returns the updated node info.
-Sourcepub fn to_node_addr(&self) -> NodeAddr
Converts into a [NodeAddr] by cloning the needed fields.
-Sourcepub fn into_node_addr(self) -> NodeAddr
Converts into a [NodeAddr] without cloning.
+Sourcepub fn to_node_addr(&self) -> NodeAddr
Converts into a NodeAddr by cloning the needed fields.
+Sourcepub fn into_node_addr(self) -> NodeAddr
Converts into a NodeAddr without cloning.
Sourcepub fn from_txt_lookup(lookup: TxtLookup) -> Result<Self>
Available on non-wasm_browser only.
Parses a NodeInfo from a TXT records lookup.
Sourcepub fn from_pkarr_signed_packet(packet: &SignedPacket) -> Result<Self>
Parses a NodeInfo from a [pkarr::SignedPacket].
Sourcepub fn to_pkarr_signed_packet(
&self,
- secret_key: &SecretKey,
+ secret_key: &SecretKey,
ttl: u32,
) -> Result<SignedPacket>
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.
Sourcepub fn to_txt_strings(&self) -> Vec<String>
Converts into a list of {key}={value} strings.
-Methods from Deref<Target = NodeData>§
Sourcepub fn user_data(&self) -> Option<&UserData>
Returns the optional user-defined data of the node.
Sourcepub fn direct_addresses(&self) -> &BTreeSet<SocketAddr>
Returns the direct addresses of the node.
Sourcepub fn clear_direct_addresses(&mut self)
Removes all direct addresses from the node data.
@@ -32,9 +32,9 @@
&mut self,
addrs: impl IntoIterator<Item = SocketAddr>,
)Adds direct addresses to the node data.
-Sourcepub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)
Sets the relay URL of the node data.
+Sourcepub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)
Sets the relay URL of the node data.
Sourcepub fn set_user_data(&mut self, user_data: Option<UserData>)
Sets the user-defined data of the node data.
-Trait Implementations§
Trait Implementations§
Source§impl Eq for NodeInfo
Source§impl StructuralPartialEq for NodeInfo
Auto Trait Implementations§
§impl Freeze for NodeInfo
§impl RefUnwindSafe for NodeInfo
§impl Send for NodeInfo
§impl Sync for NodeInfo
§impl Unpin for NodeInfo
§impl UnwindSafe for NodeInfo
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
diff --git a/pr/3279/docs/iroh_relay/node_info/trait.NodeIdExt.html b/pr/3279/docs/iroh_relay/node_info/trait.NodeIdExt.html
index 34aab0c4d8..566dc7dfdc 100644
--- a/pr/3279/docs/iroh_relay/node_info/trait.NodeIdExt.html
+++ b/pr/3279/docs/iroh_relay/node_info/trait.NodeIdExt.html
@@ -1,9 +1,9 @@
NodeIdExt in iroh_relay::node_info - Rust pub trait NodeIdExt {
// Required methods
fn to_z32(&self) -> String;
- fn from_z32(s: &str) -> Result<NodeId>;
-}
Expand description
Extension methods for [NodeId] to encode to and decode from [z32],
+ fn from_z32(s: &str) -> Result<NodeId>;
+}Expand description
Extension methods for NodeId to encode to and decode from [z32],
which is the encoding used in [pkarr] domain names.
-
Required Methods§
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§
Implementors§
\ No newline at end of file
+Required Methods§
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§
Implementors§
\ No newline at end of file
diff --git a/pr/3279/docs/iroh_relay/server/enum.AccessConfig.html b/pr/3279/docs/iroh_relay/server/enum.AccessConfig.html
index e563e92169..1d6fd8c443 100644
--- a/pr/3279/docs/iroh_relay/server/enum.AccessConfig.html
+++ b/pr/3279/docs/iroh_relay/server/enum.AccessConfig.html
@@ -1,10 +1,10 @@
AccessConfig in iroh_relay::server - Rust 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
Implementations§
Source§impl AccessConfig
Sourcepub async fn is_allowed(&self, node: NodeId) -> bool
Is this node allowed?
Trait Implementations§
Auto Trait Implementations§
§impl Freeze for AccessConfig
§impl !RefUnwindSafe for AccessConfig
§impl Send for AccessConfig
§impl Sync for AccessConfig
§impl Unpin for AccessConfig
§impl !UnwindSafe for AccessConfig
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
diff --git a/pr/3279/docs/iroh_relay/server/struct.Server.html b/pr/3279/docs/iroh_relay/server/struct.Server.html
index ef4cf17208..540113411b 100644
--- a/pr/3279/docs/iroh_relay/server/struct.Server.html
+++ b/pr/3279/docs/iroh_relay/server/struct.Server.html
@@ -14,9 +14,9 @@ case there is an error in the server before it is shut down.
Sourcepub fn quic_addr(&self) -> Option<SocketAddr>
The socket address the QUIC server is listening on.
Sourcepub fn stun_addr(&self) -> Option<SocketAddr>
The socket address the STUN server is listening on.
Sourcepub fn certificates(&self) -> Option<Vec<CertificateDer<'static>>>
The certificates chain if configured with manual TLS certificates.
-Sourcepub fn https_url(&self) -> Option<RelayUrl>
Available on crate feature test-utils only.
Get the server’s https [RelayUrl].
+Sourcepub 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.
-Sourcepub fn http_url(&self) -> Option<RelayUrl>
Available on crate feature test-utils only.
Get the server’s http [RelayUrl].
+Sourcepub 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.
Sourcepub fn metrics(&self) -> &RelayMetrics
Returns the metrics collected in the relay server.
Trait Implementations§
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 Twhere
diff --git a/pr/3279/docs/iroh_relay/struct.RelayMap.html b/pr/3279/docs/iroh_relay/struct.RelayMap.html
index f7785d0b26..a92036b6c0 100644
--- a/pr/3279/docs/iroh_relay/struct.RelayMap.html
+++ b/pr/3279/docs/iroh_relay/struct.RelayMap.html
@@ -1,15 +1,15 @@
RelayMap in iroh_relay - Rust pub struct RelayMap { /* private fields */ }
Expand description
Configuration of all the relay servers that can be used.
-Implementations§
Source§impl RelayMap
Implementations§
Trait Implementations§
Trait Implementations§
Source§impl FromIterator<RelayNode> for RelayMap
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§impl FromIterator<RelayUrl> for RelayMap
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/3279/docs/iroh_relay/struct.RelayNode.html b/pr/3279/docs/iroh_relay/struct.RelayNode.html
index 631f66dad8..a1e0bcc76b 100644
--- a/pr/3279/docs/iroh_relay/struct.RelayNode.html
+++ b/pr/3279/docs/iroh_relay/struct.RelayNode.html
@@ -1,11 +1,11 @@
RelayNode in iroh_relay - Rust pub struct RelayNode {
- pub url: RelayUrl,
+ pub url: RelayUrl,
pub stun_only: bool,
pub stun_port: u16,
pub quic: Option<RelayQuicConfig>,
}
Expand description
Information on a specific relay server.
Includes the Url where it can be dialed.
-Fields§
§url: RelayUrlThe [RelayUrl] where this relay server can be dialed.
+Fields§
§url: RelayUrlThe RelayUrl where this relay server can be dialed.
§stun_only: boolWhether this relay server should only be used for STUN requests.
This essentially allows you to use a normal STUN server as a relay node, no relay
functionality is used.
@@ -15,7 +15,7 @@ functionality is used.
When None, we will not attempt to do QUIC address discovery
with this relay server.
Trait Implementations§
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 moreSource§impl FromIterator<RelayNode> for RelayMap
Source§impl FromIterator<RelayNode> for RelayMap
Source§impl Ord for RelayNode
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/3279/docs/src/iroh/discovery/pkarr.rs.html b/pr/3279/docs/src/iroh/discovery/pkarr.rs.html
index ffd78e96aa..76ac2af514 100644
--- a/pr/3279/docs/src/iroh/discovery/pkarr.rs.html
+++ b/pr/3279/docs/src/iroh/discovery/pkarr.rs.html
@@ -402,7 +402,12 @@
401
402
403
-404//! A discovery service which publishes and resolves node information using a [pkarr] relay.
+404
+405
+406
+407
+408
+409
//! A discovery service which publishes and resolves node information using a [pkarr] relay.
//!
//! Public-Key Addressable Resource Records, [pkarr], is a system which allows publishing
//! [DNS Resource Records] owned by a particular [`SecretKey`] under a name derived from its
@@ -796,10 +801,15 @@
.send()
.await?;
- if !response.status().is_success() {
+ let status = response.status();
+ if !status.is_success() {
+ let text = if let Ok(text) = response.text().await {
+ text
+ } else {
+ "(no details provided)".to_string()
+ };
bail!(format!(
- "Publish request failed with status {}",
- response.status()
+ "Publish request failed with status {status}: {text}",
))
}
diff --git a/pr/3279/docs/src/iroh/magicsock.rs.html b/pr/3279/docs/src/iroh/magicsock.rs.html
index f15efd9d87..f21d2e4777 100644
--- a/pr/3279/docs/src/iroh/magicsock.rs.html
+++ b/pr/3279/docs/src/iroh/magicsock.rs.html
@@ -3613,13 +3613,7 @@
3612
3613
3614
-3615
-3616
-3617
-3618
-3619
-3620
-3621
//! Implements a socket that can change its communication path while in use, actively searching for the best way to communicate.
+3615
//! Implements a socket that can change its communication path while in use, actively searching for the best way to communicate.
//!
//! Based on tailscale/wgengine/magicsock
//!
@@ -4229,12 +4223,14 @@
return Poll::Pending;
}
- let mut transport_metas = vec![transports::RecvMeta::default(); metas.len()];
-
- match self.transports.poll_recv(cx, bufs, &mut transport_metas)? {
+ let mut source_addrs = vec![transports::Addr::default(); metas.len()];
+ match self
+ .transports
+ .poll_recv(cx, bufs, metas, &mut source_addrs)?
+ {
Poll::Pending | Poll::Ready(0) => Poll::Pending,
Poll::Ready(n) => {
- self.process_datagrams(&mut bufs[..n], &transport_metas[..n], &mut metas[..n]);
+ self.process_datagrams(&mut bufs[..n], &mut metas[..n], &source_addrs[..n]);
Poll::Ready(Ok(n))
}
}
@@ -4249,14 +4245,9 @@
fn process_datagrams(
&self,
bufs: &mut [io::IoSliceMut<'_>],
- transport_metas: &[transports::RecvMeta],
metas: &mut [quinn_udp::RecvMeta],
+ source_addrs: &[transports::Addr],
) {
- debug_assert_eq!(
- bufs.len(),
- transport_metas.len(),
- "non matching bufs & metas"
- );
debug_assert_eq!(bufs.len(), metas.len(), "non matching bufs & metas");
// Adding the IP address we received something on results in Quinn using this
@@ -4279,25 +4270,25 @@
let mut quic_packets_total = 0;
- for ((transport_meta, quinn_meta), buf) in transport_metas
- .iter()
- .zip(metas.iter_mut())
+ for ((quinn_meta, buf), source_addr) in metas
+ .iter_mut()
.zip(bufs.iter_mut())
+ .zip(source_addrs.iter())
{
let mut buf_contains_quic_datagrams = false;
let mut quic_datagram_count = 0;
- if transport_meta.len > transport_meta.stride {
- trace!(%transport_meta.len, %transport_meta.stride, "GRO datagram received");
+ if quinn_meta.len > quinn_meta.stride {
+ trace!(%quinn_meta.len, %quinn_meta.stride, "GRO datagram received");
self.metrics.magicsock.recv_gro_datagrams.inc();
}
// Chunk through the datagrams in this GRO payload to find disco and stun
// packets and forward them to the actor
- for datagram in buf[..transport_meta.len].chunks_mut(transport_meta.stride) {
- if datagram.len() < transport_meta.stride {
+ for datagram in buf[..quinn_meta.len].chunks_mut(quinn_meta.stride) {
+ if datagram.len() < quinn_meta.stride {
trace!(
len = %datagram.len(),
- %transport_meta.stride,
+ %quinn_meta.stride,
"Last GRO datagram smaller than stride",
);
}
@@ -4306,21 +4297,21 @@
// byte of those packets with zero to make Quinn ignore the packet. This
// relies on quinn::EndpointConfig::grease_quic_bit being set to `false`,
// which we do in Endpoint::bind.
- if transport_meta.addr.is_ip() && stun::is(datagram) {
- trace!(src = ?transport_meta.addr, len = %transport_meta.stride, "UDP recv: stun packet");
+ if source_addr.is_ip() && stun::is(datagram) {
+ trace!(src = ?source_addr, len = %quinn_meta.stride, "UDP recv: stun packet");
let packet2 = Bytes::copy_from_slice(datagram);
self.net_reporter.receive_stun_packet(
packet2,
- transport_meta.addr.clone().try_into().expect("checked"),
+ source_addr.clone().try_into().expect("checked"),
);
datagram[0] = 0u8;
} else if let Some((sender, sealed_box)) = disco::source_and_box(datagram) {
- trace!(src = ?transport_meta.addr, len = %transport_meta.stride, "UDP recv: disco packet");
- self.handle_disco_message(sender, sealed_box, &transport_meta.addr);
+ trace!(src = ?source_addr, len = %quinn_meta.stride, "UDP recv: disco packet");
+ self.handle_disco_message(sender, sealed_box, source_addr);
datagram[0] = 0u8;
} else {
- trace!(src = ?transport_meta.addr, len = %transport_meta.stride, "UDP recv: quic packet");
- match transport_meta.addr {
+ trace!(src = ?source_addr, len = %quinn_meta.stride, "UDP recv: quic packet");
+ match source_addr {
transports::Addr::Ipv4(..) => {
self.metrics
.magicsock
@@ -4351,14 +4342,14 @@
Addr(SocketAddr),
Url(RelayUrl, NodeId),
}
- let addr = match transport_meta.addr {
+ let addr = match source_addr {
transports::Addr::Ipv4(ipv4, port) => AddrOrUrl::Addr(SocketAddr::V4(
- SocketAddrV4::new(ipv4, port.unwrap_or_default()),
+ SocketAddrV4::new(*ipv4, port.unwrap_or_default()),
)),
transports::Addr::Ipv6(ipv6, port) => AddrOrUrl::Addr(SocketAddr::V6(
- SocketAddrV6::new(ipv6, port.unwrap_or_default(), 0, 0),
+ SocketAddrV6::new(*ipv6, port.unwrap_or_default(), 0, 0),
)),
- transports::Addr::RelayUrl(ref url, id) => AddrOrUrl::Url(url.clone(), id),
+ transports::Addr::RelayUrl(ref url, id) => AddrOrUrl::Url(url.clone(), *id),
};
match addr {
@@ -4380,7 +4371,7 @@
trace!(
src = %addr,
count = %quic_datagram_count,
- len = transport_meta.len,
+ len = quinn_meta.len,
"UDP recv QUIC address discovery packets",
);
quic_packets_total += quic_datagram_count;
@@ -4389,7 +4380,7 @@
warn!(
src = %addr,
count = %quic_datagram_count,
- len = transport_meta.len,
+ len = quinn_meta.len,
"UDP recv quic packets: no node state found, skipping",
);
// If we have no node state for the from addr, set len to 0 to make
@@ -4402,7 +4393,7 @@
src = %addr,
node = %node_id.fmt_short(),
count = %quic_datagram_count,
- len = transport_meta.len,
+ len = quinn_meta.len,
"UDP recv quic packets",
);
quic_packets_total += quic_datagram_count;
@@ -4416,9 +4407,6 @@
quinn_meta.addr = quic_mapped_addr.private_socket_addr();
}
}
- quinn_meta.len = transport_meta.len;
- quinn_meta.stride = transport_meta.stride;
- quinn_meta.ecn = transport_meta.ecn;
} else {
// If all datagrams in this buf are DISCO or STUN, set len to zero to make
// Quinn skip the buf completely.
diff --git a/pr/3279/docs/src/iroh/magicsock/transports.rs.html b/pr/3279/docs/src/iroh/magicsock/transports.rs.html
index 6a222cd359..a83429350a 100644
--- a/pr/3279/docs/src/iroh/magicsock/transports.rs.html
+++ b/pr/3279/docs/src/iroh/magicsock/transports.rs.html
@@ -394,21 +394,7 @@
393
394
395
-396
-397
-398
-399
-400
-401
-402
-403
-404
-405
-406
-407
-408
-409
-410
use std::{
+396
use std::{
io::{self, IoSliceMut},
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6},
pin::Pin,
@@ -500,14 +486,15 @@
&self,
cx: &mut Context,
bufs: &mut [IoSliceMut<'_>],
- metas: &mut [RecvMeta],
+ metas: &mut [quinn_udp::RecvMeta],
+ source_addrs: &mut [Addr],
) -> Poll<io::Result<usize>> {
debug_assert_eq!(bufs.len(), metas.len(), "non matching bufs & metas");
// TODO: randomization
macro_rules! poll_transport {
($socket:expr) => {
- match $socket.poll_recv(cx, bufs, metas)? {
+ match $socket.poll_recv(cx, bufs, metas, source_addrs)? {
Poll::Pending | Poll::Ready(0) => {}
Poll::Ready(n) => {
return Poll::Ready(Ok(n));
@@ -703,27 +690,6 @@
pub src_ip: Option<Addr>,
}
-#[derive(Debug, Clone)]
-pub struct RecvMeta {
- pub addr: Addr,
- pub len: usize,
- pub stride: usize,
- pub ecn: Option<quinn_udp::EcnCodepoint>,
- pub dst_ip: Option<Addr>,
-}
-
-impl Default for RecvMeta {
- fn default() -> Self {
- Self {
- addr: SocketAddr::new(Ipv6Addr::UNSPECIFIED.into(), 0).into(),
- len: 0,
- stride: 0,
- ecn: None,
- dst_ip: None,
- }
- }
-}
-
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Addr {
Ipv4(Ipv4Addr, Option<u16>),
@@ -731,6 +697,12 @@
RelayUrl(RelayUrl, NodeId),
}
+impl Default for Addr {
+ fn default() -> Self {
+ Self::Ipv6(Ipv6Addr::UNSPECIFIED, None)
+ }
+}
+
impl From<IpAddr> for Addr {
fn from(value: IpAddr) -> Self {
match value {
diff --git a/pr/3279/docs/src/iroh/magicsock/transports/ip.rs.html b/pr/3279/docs/src/iroh/magicsock/transports/ip.rs.html
index 0814eeba2f..06b24dfd73 100644
--- a/pr/3279/docs/src/iroh/magicsock/transports/ip.rs.html
+++ b/pr/3279/docs/src/iroh/magicsock/transports/ip.rs.html
@@ -142,11 +142,7 @@
141
142
143
-144
-145
-146
-147
-148
use std::{
+144
use std::{
io,
net::SocketAddr,
pin::Pin,
@@ -158,7 +154,7 @@
use quinn::AsyncUdpSocket;
use tracing::trace;
-use super::{RecvMeta, Transmit};
+use super::{Addr, Transmit};
use crate::{
magicsock::UdpConn,
watchable::{Watchable, Watcher},
@@ -222,22 +218,18 @@
&self,
cx: &mut Context,
bufs: &mut [io::IoSliceMut<'_>],
- metas: &mut [RecvMeta],
+ metas: &mut [quinn_udp::RecvMeta],
+ source_addrs: &mut [Addr],
) -> Poll<io::Result<usize>> {
- // TODO: figure out how to optimize this
- let mut quinn_metas = vec![quinn_udp::RecvMeta::default(); metas.len()];
- match self.socket.poll_recv(cx, bufs, &mut quinn_metas) {
+ match self.socket.poll_recv(cx, bufs, metas) {
Poll::Pending => Poll::Pending,
- Poll::Ready(res) => {
- for (quinn_meta, meta) in quinn_metas.into_iter().zip(metas.iter_mut()) {
- meta.addr = quinn_meta.addr.into();
- meta.len = quinn_meta.len;
- meta.stride = quinn_meta.stride;
- meta.ecn = quinn_meta.ecn;
- meta.dst_ip = quinn_meta.dst_ip.map(Into::into);
+ Poll::Ready(Ok(n)) => {
+ for (addr, el) in source_addrs.iter_mut().zip(metas.iter()).take(n) {
+ *addr = el.addr.into();
}
- Poll::Ready(res)
+ Poll::Ready(Ok(n))
}
+ Poll::Ready(Err(err)) => Poll::Ready(Err(err)),
}
}
diff --git a/pr/3279/docs/src/iroh/magicsock/transports/relay.rs.html b/pr/3279/docs/src/iroh/magicsock/transports/relay.rs.html
index 2d2c68791d..87dc665e19 100644
--- a/pr/3279/docs/src/iroh/magicsock/transports/relay.rs.html
+++ b/pr/3279/docs/src/iroh/magicsock/transports/relay.rs.html
@@ -475,7 +475,11 @@
474
475
476
-477
use std::{
+477
+478
+479
+480
+481
use std::{
io,
pin::Pin,
sync::Arc,
@@ -492,7 +496,7 @@
use tokio::sync::mpsc;
use tracing::{error, info_span, trace, warn, Instrument};
-use super::{RecvMeta, Transmit};
+use super::{Addr, Transmit};
use crate::{
magicsock::RelayContents,
watchable::{Watchable, Watcher as _},
@@ -607,10 +611,15 @@
&self,
cx: &mut Context,
bufs: &mut [io::IoSliceMut<'_>],
- metas: &mut [RecvMeta],
+ metas: &mut [quinn_udp::RecvMeta],
+ source_addrs: &mut [Addr],
) -> Poll<io::Result<usize>> {
let mut num_msgs = 0;
- 'outer: for (buf_out, meta_out) in bufs.iter_mut().zip(metas.iter_mut()) {
+ 'outer: for ((buf_out, meta_out), addr) in bufs
+ .iter_mut()
+ .zip(metas.iter_mut())
+ .zip(source_addrs.iter_mut())
+ {
let dm = match self.relay_datagram_recv_queue.poll_recv(cx) {
Poll::Ready(Ok(recv)) => recv,
Poll::Ready(Err(err)) => {
@@ -626,13 +635,12 @@
};
buf_out[..dm.buf.len()].copy_from_slice(&dm.buf);
- *meta_out = RecvMeta {
- len: dm.buf.len(),
- stride: dm.buf.len(),
- addr: (dm.url, dm.src).into(),
- ecn: None,
- dst_ip: None, // TODO: insert the relay url for this relay
- };
+ meta_out.len = dm.buf.len();
+ meta_out.stride = dm.buf.len();
+ meta_out.ecn = None;
+ meta_out.dst_ip = None; // TODO: insert the relay url for this relay
+
+ *addr = (dm.url, dm.src).into();
num_msgs += 1;
}
diff --git a/pr/3279/docs/src/iroh_dns_server/store.rs.html b/pr/3279/docs/src/iroh_dns_server/store.rs.html
index 43a200b9f9..3e06704859 100644
--- a/pr/3279/docs/src/iroh_dns_server/store.rs.html
+++ b/pr/3279/docs/src/iroh_dns_server/store.rs.html
@@ -267,7 +267,30 @@
266
267
268
-269
//! Pkarr packet store used to resolve DNS queries.
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
//! Pkarr packet store used to resolve DNS queries.
use std::{collections::BTreeMap, num::NonZeroUsize, path::Path, sync::Arc, time::Duration};
@@ -276,7 +299,7 @@
use lru::LruCache;
use pkarr::{Client as PkarrClient, SignedPacket};
use tokio::sync::Mutex;
-use tracing::{debug, trace};
+use tracing::{debug, trace, warn};
use ttl_cache::TtlCache;
use self::signed_packets::SignedPacketStore;
@@ -361,24 +384,46 @@
}
/// Resolve a DNS query.
- #[allow(clippy::unused_async)]
+ #[tracing::instrument("resolve", skip_all, fields(pubkey=%pubkey,name=%name,typ=%record_type))]
pub async fn resolve(
&self,
pubkey: &PublicKeyBytes,
name: &Name,
record_type: RecordType,
) -> Result<Option<Arc<RecordSet>>> {
- tracing::info!("{} {}", name, record_type);
+ trace!("store resolve");
if let Some(rset) = self.cache.lock().await.resolve(pubkey, name, record_type) {
+ debug!(
+ len = rset.records_without_rrsigs().count(),
+ "resolved from cache"
+ );
return Ok(Some(rset));
}
if let Some(packet) = self.store.get(pubkey).await? {
- return self
+ trace!(packet_timestamp = ?packet.timestamp(), "store hit");
+ return match self
.cache
.lock()
.await
- .insert_and_resolve(&packet, name, record_type);
+ .insert_and_resolve(&packet, name, record_type)
+ {
+ Ok(Some(rset)) => {
+ debug!(
+ len = rset.records_without_rrsigs().count(),
+ "resolved from store"
+ );
+ Ok(Some(rset))
+ }
+ Ok(None) => {
+ debug!("resolved to zone, but no matching records in zone");
+ Ok(None)
+ }
+ Err(err) => {
+ warn!("failed to retrieve zone after inserting in cache: {err:#?}");
+ Err(err)
+ }
+ };
};
if let Some(pkarr) = self.pkarr.as_ref() {
@@ -495,11 +540,14 @@
.map(|old| old.is_newer_than(signed_packet))
.unwrap_or(false)
{
- return Ok(());
+ trace!("insert skip: cached is newer");
+ Ok(())
+ } else {
+ self.cache
+ .put(pubkey, CachedZone::from_signed_packet(signed_packet)?);
+ trace!("inserted into cache");
+ Ok(())
}
- self.cache
- .put(pubkey, CachedZone::from_signed_packet(signed_packet)?);
- Ok(())
}
fn remove(&mut self, pubkey: &PublicKeyBytes) {
@@ -529,10 +577,8 @@
}
fn resolve(&self, name: &Name, record_type: RecordType) -> Option<Arc<RecordSet>> {
+ trace!(name=%name, typ=%record_type, "resolve in zone");
let key = RrKey::new(name.into(), record_type);
- for record in self.records.keys() {
- tracing::info!("record {:?}", record);
- }
self.records.get(&key).cloned()
}
}
diff --git a/pr/3279/docs/src/iroh_dns_server/store/signed_packets.rs.html b/pr/3279/docs/src/iroh_dns_server/store/signed_packets.rs.html
index bf63d737fa..e72a6e8016 100644
--- a/pr/3279/docs/src/iroh_dns_server/store/signed_packets.rs.html
+++ b/pr/3279/docs/src/iroh_dns_server/store/signed_packets.rs.html
@@ -459,7 +459,48 @@
458
459
460
-461
use std::{future::Future, path::Path, result, sync::Arc, time::Duration};
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
use std::{
+ future::Future,
+ path::Path,
+ result,
+ sync::Arc,
+ time::{Duration, SystemTime},
+};
use anyhow::{Context, Result};
use pkarr::{SignedPacket, Timestamp};
@@ -468,7 +509,7 @@
};
use tokio::sync::{mpsc, oneshot};
use tokio_util::sync::CancellationToken;
-use tracing::{debug, error, info, trace};
+use tracing::{debug, error, info, trace, warn};
use crate::{metrics::Metrics, util::PublicKeyBytes};
@@ -513,7 +554,7 @@
res: oneshot::Sender<Snapshot>,
},
CheckExpired {
- time: [u8; 8],
+ time: Timestamp,
key: PublicKeyBytes,
},
}
@@ -580,7 +621,6 @@
let transaction = self.db.begin_write()?;
let mut tables = Tables::new(&transaction)?;
let timeout = tokio::time::sleep(self.options.max_batch_time);
- let expired = Timestamp::now() - expiry_us;
tokio::pin!(timeout);
for _ in 0..self.options.max_batch_size {
tokio::select! {
@@ -593,9 +633,16 @@
Some(msg) = self.recv.recv() => {
match msg {
Message::Get { key, res } => {
- trace!("get {}", key);
- let packet = get_packet(&tables.signed_packets, &key).context("get packet failed")?;
- res.send(packet).ok();
+ match get_packet(&tables.signed_packets, &key) {
+ Ok(packet) => {
+ trace!("get {key}: {}", packet.is_some());
+ res.send(packet).ok();
+ },
+ Err(err) => {
+ warn!("get {key} failed: {err:#}");
+ return Err(err).with_context(|| format!("get packet for {key} failed"))
+ }
+ }
}
Message::Upsert { packet, res } => {
let key = PublicKeyBytes::from_signed_packet(&packet);
@@ -605,8 +652,8 @@
res.send(false).ok();
continue;
} else {
- // remove the packet from the update time index
- tables.update_time.remove(&packet.timestamp().to_bytes(), key.as_bytes())?;
+ // remove the old packet from the update time index
+ tables.update_time.remove(&existing.timestamp().to_bytes(), key.as_bytes())?;
true
}
} else {
@@ -639,13 +686,21 @@
res.send(Snapshot::new(&self.db)?).ok();
}
Message::CheckExpired { key, time } => {
- trace!("check expired {} at {}", key, u64::from_be_bytes(time));
+ trace!("check expired {} at {}", key, fmt_time(time));
if let Some(packet) = get_packet(&tables.signed_packets, &key)? {
+ let expired = Timestamp::now() - expiry_us;
if packet.timestamp() < expired {
- tables.update_time.remove(&time, key.as_bytes())?;
+ tables.update_time.remove(&time.to_bytes(), key.as_bytes())?;
let _ = tables.signed_packets.remove(key.as_bytes())?;
self.metrics.store_packets_expired.inc();
+ debug!("removed expired packet {key}");
+ } else {
+ debug!("packet {key} is no longer expired, removing obsolete expiry entry");
+ tables.update_time.remove(&time.to_bytes(), key.as_bytes())?;
}
+ } else {
+ debug!("expired packet {key} not found, remove from expiry table");
+ tables.update_time.remove(&time.to_bytes(), key.as_bytes())?;
}
}
}
@@ -659,6 +714,10 @@
}
}
+fn fmt_time(t: Timestamp) -> String {
+ humantime::format_rfc3339_micros(SystemTime::from(t)).to_string()
+}
+
/// A struct similar to [`redb::Table`] but for all tables that make up the
/// signed packet store.
pub(super) struct Tables<'a> {
@@ -778,8 +837,23 @@
let Some(row) = table.get(key.as_ref()).context("database fetch failed")? else {
return Ok(None);
};
- let packet = SignedPacket::deserialize(row.value()).context("parsing signed packet failed")?;
- Ok(Some(packet))
+ match SignedPacket::deserialize(row.value()) {
+ Ok(packet) => Ok(Some(packet)),
+ Err(err) => {
+ // Prior to iroh-dns-server v0.35, we stored packets in the default `SignedPacket::as_bytes` serialization from pkarr v2,
+ // which did not include the `last_seen` timestamp added as a prefix in `SignedPacket::serialize` from pkarr v3.
+ // If decoding the packet as a serialized pkarr v3 packet fails, we assume it was stored with iroh-dns-server before v0.35,
+ // and prepend an empty timestamp.
+ let data = row.value();
+ let mut buf = Vec::with_capacity(data.len() + 8);
+ buf.extend(&[0u8; 8]);
+ buf.extend(data);
+ match SignedPacket::deserialize(&buf) {
+ Ok(packet) => Ok(Some(packet)),
+ Err(err2) => Err(anyhow::anyhow!("Failed to decode as pkarr v3: {err:#}. Also failed to decode as pkarr v2: {err2:#}"))
+ }
+ }
+ }
}
async fn evict_task(send: mpsc::Sender<Message>, options: Options, cancel: CancellationToken) {
@@ -807,7 +881,7 @@
anyhow::bail!("failed to get snapshot");
};
let expired = Timestamp::now() - expiry_us;
- trace!("evicting packets older than {}", expired);
+ trace!("evicting packets older than {}", fmt_time(expired));
// if getting the range fails we exit the loop and shut down
// if individual reads fail we log the error and limp on
for item in snapshot.update_time.range(..expired.to_bytes())? {
@@ -818,26 +892,22 @@
continue;
}
};
- let time = time.value();
- trace!("evicting expired packets at {}", u64::from_be_bytes(time));
+ let time = Timestamp::from(time.value());
+ trace!("evicting expired packets at {}", fmt_time(time));
for item in keys {
let key = match item {
Ok(v) => v,
Err(e) => {
error!(
"failed to read update_time item at {}: {:?}",
- u64::from_be_bytes(time),
+ fmt_time(time),
e
);
continue;
}
};
let key = PublicKeyBytes::new(key.value());
- debug!(
- "evicting expired packet {} {}",
- u64::from_be_bytes(time),
- key
- );
+ debug!("evicting expired packet {} {}", fmt_time(time), key);
send.send(Message::CheckExpired { time, key }).await?;
}
}
diff --git a/pr/3279/docs/trait.impl/core/convert/trait.From.js b/pr/3279/docs/trait.impl/core/convert/trait.From.js
index 3c3eda16f7..f782f797c3 100644
--- a/pr/3279/docs/trait.impl/core/convert/trait.From.js
+++ b/pr/3279/docs/trait.impl/core/convert/trait.From.js
@@ -1,9 +1,9 @@
(function() {
- var implementors = Object.fromEntries([["iroh",[["impl From<DiscoveryItem> for NodeInfo"],["impl From<RemoteInfo> for NodeAddr"],["impl<T> From<T> for ConcurrentDiscovery"]]],["iroh_base",[["impl From<(PublicKey, Option<RelayUrl>, &[SocketAddr])> for NodeAddr"],["impl From<ParseError> for RelayUrlParseError"],["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 Error"],["impl From<Error> for KeyParsingError"],["impl From<Error> for Error"],["impl From<SigningKey> for SecretKey"],["impl From<VerifyingKey> for PublicKey"],["impl From<[u8; 32]> for SecretKey"]]],["iroh_relay",[["impl From<Error> for ConnSendError"],["impl From<NodeInfo> for NodeAddr"],["impl From<RelayNode> for RelayMap"],["impl From<Error> for ConnSendError"],["impl From<NodeAddr> for NodeData"],["impl From<NodeAddr> for NodeInfo"],["impl From<RelayUrl> for RelayMap"],["impl From<RelayUrl> for RelayNode"],["impl From<Resolver<GenericConnector<TokioRuntimeProvider>>> for DnsResolver"],["impl From<TxtLookup> for TxtLookup"]]]]);
+ var implementors = Object.fromEntries([["iroh",[["impl From<DiscoveryItem> for NodeInfo"],["impl From<RemoteInfo> for NodeAddr"],["impl<T> From<T> for ConcurrentDiscovery"]]],["iroh_base",[["impl From<(PublicKey, Option<RelayUrl>, &[SocketAddr])> for NodeAddr"],["impl From<ParseError> for RelayUrlParseError"],["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 Error"],["impl From<Error> for KeyParsingError"],["impl From<Error> for Error"],["impl From<SigningKey> for SecretKey"],["impl From<VerifyingKey> for PublicKey"],["impl From<[u8; 32]> for SecretKey"]]],["iroh_relay",[["impl From<Error> for ConnSendError"],["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<Error> for ConnSendError"],["impl From<Resolver<GenericConnector<TokioRuntimeProvider>>> for DnsResolver"],["impl From<TxtLookup> for TxtLookup"]]]]);
if (window.register_implementors) {
window.register_implementors(implementors);
} else {
window.pending_implementors = implementors;
}
})()
-//{"start":57,"fragment_lengths":[1632,5343,3221]}
\ No newline at end of file
+//{"start":57,"fragment_lengths":[1632,5343,3831]}
\ No newline at end of file
diff --git a/pr/3279/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js b/pr/3279/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js
index d104c409e3..8cd585bc9e 100644
--- a/pr/3279/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js
+++ b/pr/3279/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js
@@ -1,9 +1,9 @@
(function() {
- var implementors = Object.fromEntries([["iroh_relay",[["impl FromIterator<RelayNode> for RelayMap"],["impl FromIterator<RelayUrl> for RelayMap"]]]]);
+ var implementors = Object.fromEntries([["iroh_relay",[["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":[776]}
\ No newline at end of file
+//{"start":57,"fragment_lengths":[898]}
\ No newline at end of file
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
diff --git a/pr/3279/docs/iroh/endpoint/enum.DirectAddrType.html b/pr/3279/docs/iroh/endpoint/enum.DirectAddrType.html
index 250f32b184..cd03fde0cc 100644
--- a/pr/3279/docs/iroh/endpoint/enum.DirectAddrType.html
+++ b/pr/3279/docs/iroh/endpoint/enum.DirectAddrType.html
@@ -1,4 +1,4 @@
-DirectAddrType in iroh::endpoint - Rust pub enum DirectAddrType {
+DirectAddrType in iroh::endpoint - Rust pub enum DirectAddrType {
Unknown,
Local,
Stun,
@@ -20,16 +20,16 @@ get a publicly routable direct address.
It is possible to configure iroh to bound to a specific port and independently
configure the router to forward this port to the iroh node. This indicates a
situation like this, which still uses STUN to discover the public address.
-
Trait Implementations§
Source§impl Clone for DirectAddrType
Source§fn clone(&self) -> DirectAddrType
Returns a copy of the value. Read more1.0.0 · Source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read moreSource§impl Debug for DirectAddrType
Source§impl Display for DirectAddrType
Source§impl Hash for DirectAddrType
1.3.0 · Source§fn hash_slice<H>(data: &[Self], state: &mut H)where
+
Trait Implementations§
Source§impl Clone for DirectAddrType
Source§fn clone(&self) -> DirectAddrType
Returns a copy of the value. Read more1.0.0 · Source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read moreSource§impl Debug for DirectAddrType
Source§impl Display for DirectAddrType
Source§impl Hash for DirectAddrType
Source§impl Ord for DirectAddrType
Source§impl Ord for DirectAddrType
Source§fn cmp(&self, other: &DirectAddrType) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read moreSource§impl PartialEq for DirectAddrType
Source§impl PartialOrd for DirectAddrType
Source§impl PartialEq for DirectAddrType
Source§impl PartialOrd for DirectAddrType
Source§impl Copy for DirectAddrType
Source§impl Eq for DirectAddrType
Source§impl StructuralPartialEq for DirectAddrType
Auto Trait Implementations§
§impl Freeze for DirectAddrType
§impl RefUnwindSafe for DirectAddrType
§impl Send for DirectAddrType
§impl Sync for DirectAddrType
§impl Unpin for DirectAddrType
§impl UnwindSafe for DirectAddrType
Blanket Implementations§
Source§impl Copy for DirectAddrType
Source§impl Eq for DirectAddrType
Source§impl StructuralPartialEq for DirectAddrType
Auto Trait Implementations§
§impl Freeze for DirectAddrType
§impl RefUnwindSafe for DirectAddrType
§impl Send for DirectAddrType
§impl Sync for DirectAddrType
§impl Unpin for DirectAddrType
§impl UnwindSafe for DirectAddrType
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§fn implicit(
diff --git a/pr/3279/docs/iroh/endpoint/struct.DirectAddr.html b/pr/3279/docs/iroh/endpoint/struct.DirectAddr.html
index 60737b50aa..79ccfcbde2 100644
--- a/pr/3279/docs/iroh/endpoint/struct.DirectAddr.html
+++ b/pr/3279/docs/iroh/endpoint/struct.DirectAddr.html
@@ -1,4 +1,4 @@
-DirectAddr in iroh::endpoint - Rust pub struct DirectAddr {
+DirectAddr in iroh::endpoint - Rust pub struct DirectAddr {
pub addr: SocketAddr,
pub typ: DirectAddrType,
}
Expand description
A direct address on which an iroh-node might be contactable.
@@ -7,16 +7,16 @@ contacted. These can come from various sources depending on the network topolog
iroh node, see DirectAddrType for the several kinds of sources.
Fields§
§addr: SocketAddrThe address.
§typ: DirectAddrTypeThe origin of this direct address.
-Trait Implementations§
Source§impl Clone for DirectAddr
Source§fn clone(&self) -> DirectAddr
Returns a copy of the value. Read more1.0.0 · Source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read moreSource§impl Debug for DirectAddr
Source§impl Hash for DirectAddr
1.3.0 · Source§fn hash_slice<H>(data: &[Self], state: &mut H)where
+Trait Implementations§
Source§impl Clone for DirectAddr
Source§fn clone(&self) -> DirectAddr
Returns a copy of the value. Read more1.0.0 · Source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read moreSource§impl Debug for DirectAddr
Source§impl Hash for DirectAddr
Source§impl Ord for DirectAddr
Source§impl Ord for DirectAddr
Source§fn cmp(&self, other: &DirectAddr) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read moreSource§impl PartialEq for DirectAddr
Source§impl PartialOrd for DirectAddr
Source§impl PartialEq for DirectAddr
Source§impl PartialOrd for DirectAddr
Source§impl Eq for DirectAddr
Source§impl StructuralPartialEq for DirectAddr
Auto Trait Implementations§
§impl Freeze for DirectAddr
§impl RefUnwindSafe for DirectAddr
§impl Send for DirectAddr
§impl Sync for DirectAddr
§impl Unpin for DirectAddr
§impl UnwindSafe for DirectAddr
Blanket Implementations§
Source§impl Eq for DirectAddr
Source§impl StructuralPartialEq for DirectAddr
Auto Trait Implementations§
§impl Freeze for DirectAddr
§impl RefUnwindSafe for DirectAddr
§impl Send for DirectAddr
§impl Sync for DirectAddr
§impl Unpin for DirectAddr
§impl UnwindSafe for DirectAddr
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§fn implicit(
diff --git a/pr/3279/docs/iroh_dns_server/struct.ZoneStore.html b/pr/3279/docs/iroh_dns_server/struct.ZoneStore.html
index f4933c29e4..4eedd7f167 100644
--- a/pr/3279/docs/iroh_dns_server/struct.ZoneStore.html
+++ b/pr/3279/docs/iroh_dns_server/struct.ZoneStore.html
@@ -1,7 +1,7 @@
ZoneStore in iroh_dns_server - Rust pub struct ZoneStore { /* private fields */ }
Expand description
A store for pkarr signed packets.
Packets are stored in the persistent SignedPacketStore, and cached on-demand in an in-memory LRU
cache used for resolving DNS queries.
-Implementations§
Source§impl ZoneStore
Sourcepub fn persistent(
+
Implementations§
Sourcepub async fn resolve(
&self,
pubkey: &PublicKeyBytes,
name: &Name,
record_type: RecordType,
) -> Result<Option<Arc<RecordSet>>>
Resolve a DNS query.
-Sourcepub async fn get_signed_packet(
+
Sourcepub async fn get_signed_packet(
&self,
pubkey: &PublicKeyBytes,
) -> Result<Option<SignedPacket>>
Get the latest signed packet for a pubkey.
-Sourcepub async fn insert(
&self,
signed_packet: SignedPacket,
_source: PacketSource,
diff --git a/pr/3279/docs/iroh_relay/client/enum.ReceivedMessage.html b/pr/3279/docs/iroh_relay/client/enum.ReceivedMessage.html
index 535193a6c8..d612779969 100644
--- a/pr/3279/docs/iroh_relay/client/enum.ReceivedMessage.html
+++ b/pr/3279/docs/iroh_relay/client/enum.ReceivedMessage.html
@@ -1,9 +1,9 @@
ReceivedMessage in iroh_relay::client - Rust pub enum ReceivedMessage {
ReceivedPacket {
- remote_node_id: NodeId,
+ remote_node_id: NodeId,
data: Bytes,
},
- NodeGone(NodeId),
+ NodeGone(NodeId),
Ping([u8; 8]),
Pong([u8; 8]),
KeepAlive,
@@ -17,9 +17,9 @@
}
Expand description
The messages received from a framed relay stream.
This is a type-validated version of the Frames on the RelayCodec.
Variants§
§ReceivedPacket
Represents an incoming packet.
-Fields
§NodeGone(NodeId)
Indicates that the client identified by the underlying public key had previously sent you a
packet but has now disconnected from the server.
§Ping([u8; 8])
Request from a client or server to reply to the
other side with a ReceivedMessage::Pong with the given payload.
diff --git a/pr/3279/docs/iroh_relay/client/enum.SendMessage.html b/pr/3279/docs/iroh_relay/client/enum.SendMessage.html
index 55d5cca41d..cf87651734 100644
--- a/pr/3279/docs/iroh_relay/client/enum.SendMessage.html
+++ b/pr/3279/docs/iroh_relay/client/enum.SendMessage.html
@@ -1,9 +1,9 @@
SendMessage in iroh_relay::client - Rust pub enum SendMessage {
- SendPacket(NodeId, Bytes),
+ SendPacket(NodeId, Bytes),
Ping([u8; 8]),
Pong([u8; 8]),
}
Expand description
Messages we can send to a relay server.
-Variants§
§SendPacket(NodeId, Bytes)
Send a packet of data to the [NodeId].
+Variants§
§SendPacket(NodeId, Bytes)
Send a packet of data to the NodeId.
§Ping([u8; 8])
Sends a ping message to the connected relay server.
§Pong([u8; 8])
Sends a pong message to the connected relay server.
Trait Implementations§
Source§impl Debug for SendMessage
Source§impl Sink<SendMessage> for Client
Source§type Error = ConnSendError
The type of value produced by the sink when an error occurs.Source§fn poll_ready(
diff --git a/pr/3279/docs/iroh_relay/client/struct.ClientBuilder.html b/pr/3279/docs/iroh_relay/client/struct.ClientBuilder.html
index 22ed2c5e40..4f94efe715 100644
--- a/pr/3279/docs/iroh_relay/client/struct.ClientBuilder.html
+++ b/pr/3279/docs/iroh_relay/client/struct.ClientBuilder.html
@@ -1,7 +1,7 @@
ClientBuilder in iroh_relay::client - Rust pub struct ClientBuilder { /* private fields */ }
Expand description
Build a Client.
Implementations§
Source§impl ClientBuilder
Sourcepub fn new(
- url: impl Into<RelayUrl>,
- secret_key: SecretKey,
+ url: impl Into<RelayUrl>,
+ secret_key: SecretKey,
dns_resolver: DnsResolver,
) -> Self
Create a new ClientBuilder
Sourcepub fn protocol(self, protocol: Protocol) -> Self
Sets whether to connect to the relay via websockets or not.
diff --git a/pr/3279/docs/iroh_relay/dns/struct.DnsResolver.html b/pr/3279/docs/iroh_relay/dns/struct.DnsResolver.html
index ea537effea..7c5a185de6 100644
--- a/pr/3279/docs/iroh_relay/dns/struct.DnsResolver.html
+++ b/pr/3279/docs/iroh_relay/dns/struct.DnsResolver.html
@@ -67,9 +67,9 @@ at T+0ms, T+200ms and T+300ms. The timeout is applied as stated in
summary of all errors otherwise.
Sourcepub async fn lookup_node_by_id(
&self,
- node_id: &NodeId,
+ node_id: &NodeId,
origin: &str,
-) -> Result<NodeInfo>
Looks up node info by [NodeId] and origin domain name.
+) -> Result<NodeInfo>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.
Sourcepub async fn lookup_node_by_domain_name(&self, name: &str) -> Result<NodeInfo>
Looks up node info by DNS name.
@@ -84,10 +84,10 @@ at T+0ms, T+200ms and T+300ms. The result of the first successful call is return
summary of all errors otherwise.
Sourcepub async fn lookup_node_by_id_staggered(
&self,
- node_id: &NodeId,
+ node_id: &NodeId,
origin: &str,
delays_ms: &[u64],
-) -> Result<NodeInfo>
Looks up node info by [NodeId] and origin domain name.
+) -> Result<NodeInfo>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/3279/docs/iroh_relay/index.html b/pr/3279/docs/iroh_relay/index.html
index aa17a382d4..b45ccff8c4 100644
--- a/pr/3279/docs/iroh_relay/index.html
+++ b/pr/3279/docs/iroh_relay/index.html
@@ -25,6 +25,6 @@ Tailscale.
STUN support and expose metrics.
-Re-exports§
pub use protos::relay::MAX_PACKET_SIZE;
Modules§
- Exposes
Client, which allows to establish connections to a relay server. - Default values used in the relay.
- dns
Non-wasm_browser DNS resolver - HTTP-specific constants for the relay server and client.
- Support for handling DNS resource records for dialing by [
NodeId]. - Protocols used by the iroh-relay
- Create a QUIC server that accepts connections
+
Re-exports§
pub use protos::relay::MAX_PACKET_SIZE;
Modules§
- Exposes
Client, which allows to establish connections to a relay server. - Default values used in the relay.
- dns
Non-wasm_browser DNS resolver - HTTP-specific constants for the relay server and client.
- Support for handling DNS resource records for dialing by
NodeId. - Protocols used by the iroh-relay
- Create a QUIC server that accepts connections
for QUIC address discovery.
- server
server A fully-fledged iroh-relay server over HTTP or HTTPS.
Structs§
- Tracks pings on a single relay connection.
- Configuration of all the relay servers that can be used.
- Information on a specific relay server.
- 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/3279/docs/iroh_relay/node_info/index.html b/pr/3279/docs/iroh_relay/node_info/index.html
index daa1aa3c65..e55baaed6c 100644
--- a/pr/3279/docs/iroh_relay/node_info/index.html
+++ b/pr/3279/docs/iroh_relay/node_info/index.html
@@ -1,5 +1,5 @@
-iroh_relay::node_info - Rust 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 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].
+
<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:
- Structs§
- Error returned when an input value is too long for
UserData. - Data about a node that may be published to and resolved from discovery services.
- Information about a node that may be published to and resolved from discovery services.
- Under the hood this is a UTF-8 String is no longer than
UserData::MAX_LENGTH bytes.
Constants§
- The DNS name for the iroh TXT record.
Traits§
- Extension methods for [
NodeId] to encode to and decode from [z32],
+Structs§
- Error returned when an input value is too long for
UserData. - Data about a node that may be published to and resolved from discovery services.
- Information about a node that may be published to and resolved from discovery services.
- Under the hood this is a UTF-8 String is no longer than
UserData::MAX_LENGTH bytes.
Constants§
- The DNS name for the iroh TXT record.
Traits§
- 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/3279/docs/iroh_relay/node_info/struct.NodeData.html b/pr/3279/docs/iroh_relay/node_info/struct.NodeData.html
index f4a1f6e4b0..4a3e6db1c8 100644
--- a/pr/3279/docs/iroh_relay/node_info/struct.NodeData.html
+++ b/pr/3279/docs/iroh_relay/node_info/struct.NodeData.html
@@ -1,20 +1,20 @@
NodeData in iroh_relay::node_info - Rust 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
Sourcepub 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.
-Sourcepub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self
Sets the relay URL and returns the updated node data.
+Sourcepub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self
Sets the relay URL and returns the updated node data.
Sourcepub fn with_direct_addresses(
self,
direct_addresses: BTreeSet<SocketAddr>,
) -> Self
Sets the direct addresses and returns the updated node data.
Sourcepub fn with_user_data(self, user_data: Option<UserData>) -> Self
Sets the user-defined data and returns the updated node data.
-Sourcepub fn user_data(&self) -> Option<&UserData>
Returns the optional user-defined data of the node.
Sourcepub fn direct_addresses(&self) -> &BTreeSet<SocketAddr>
Returns the direct addresses of the node.
Sourcepub 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.
-Sourcepub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)
Sets the relay URL of the node data.
+Sourcepub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)
Sets the relay URL of the node data.
Sourcepub fn set_user_data(&mut self, user_data: Option<UserData>)
Sets the user-defined data of the node data.
-Trait Implementations§
Trait Implementations§
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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
diff --git a/pr/3279/docs/iroh_relay/node_info/struct.NodeInfo.html b/pr/3279/docs/iroh_relay/node_info/struct.NodeInfo.html
index cd66ba54e3..dde190c92b 100644
--- a/pr/3279/docs/iroh_relay/node_info/struct.NodeInfo.html
+++ b/pr/3279/docs/iroh_relay/node_info/struct.NodeInfo.html
@@ -1,30 +1,30 @@
NodeInfo in iroh_relay::node_info - Rust 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: NodeIdThe [NodeId] of the node this is about.
+
+Fields§
§node_id: NodeIdThe NodeId of the node this is about.
§data: NodeDataThe information published about the node.
-Implementations§
Source§impl NodeInfo
Sourcepub fn from_parts(node_id: NodeId, data: NodeData) -> Self
Creates a new NodeInfo from its parts.
-Sourcepub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self
Sets the relay URL and returns the updated node info.
+Implementations§
Source§impl NodeInfo
Sourcepub fn from_parts(node_id: NodeId, data: NodeData) -> Self
Creates a new NodeInfo from its parts.
+Sourcepub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self
Sets the relay URL and returns the updated node info.
Sourcepub fn with_direct_addresses(
self,
direct_addresses: BTreeSet<SocketAddr>,
) -> Self
Sets the direct addresses and returns the updated node info.
Sourcepub fn with_user_data(self, user_data: Option<UserData>) -> Self
Sets the user-defined data and returns the updated node info.
-Sourcepub fn to_node_addr(&self) -> NodeAddr
Converts into a [NodeAddr] by cloning the needed fields.
-Sourcepub fn into_node_addr(self) -> NodeAddr
Converts into a [NodeAddr] without cloning.
+Sourcepub fn to_node_addr(&self) -> NodeAddr
Converts into a NodeAddr by cloning the needed fields.
+Sourcepub fn into_node_addr(self) -> NodeAddr
Converts into a NodeAddr without cloning.
Sourcepub fn from_txt_lookup(lookup: TxtLookup) -> Result<Self>
Available on non-wasm_browser only.
Parses a NodeInfo from a TXT records lookup.
Sourcepub fn from_pkarr_signed_packet(packet: &SignedPacket) -> Result<Self>
Parses a NodeInfo from a [pkarr::SignedPacket].
Sourcepub fn to_pkarr_signed_packet(
&self,
- secret_key: &SecretKey,
+ secret_key: &SecretKey,
ttl: u32,
) -> Result<SignedPacket>
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.
Sourcepub fn to_txt_strings(&self) -> Vec<String>
Converts into a list of {key}={value} strings.
-Methods from Deref<Target = NodeData>§
Sourcepub fn user_data(&self) -> Option<&UserData>
Returns the optional user-defined data of the node.
Sourcepub fn direct_addresses(&self) -> &BTreeSet<SocketAddr>
Returns the direct addresses of the node.
Sourcepub fn clear_direct_addresses(&mut self)
Removes all direct addresses from the node data.
@@ -32,9 +32,9 @@
&mut self,
addrs: impl IntoIterator<Item = SocketAddr>,
)Adds direct addresses to the node data.
-Sourcepub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)
Sets the relay URL of the node data.
+Sourcepub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)
Sets the relay URL of the node data.
Sourcepub fn set_user_data(&mut self, user_data: Option<UserData>)
Sets the user-defined data of the node data.
-Trait Implementations§
Trait Implementations§
Source§impl Eq for NodeInfo
Source§impl StructuralPartialEq for NodeInfo
Auto Trait Implementations§
§impl Freeze for NodeInfo
§impl RefUnwindSafe for NodeInfo
§impl Send for NodeInfo
§impl Sync for NodeInfo
§impl Unpin for NodeInfo
§impl UnwindSafe for NodeInfo
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
diff --git a/pr/3279/docs/iroh_relay/node_info/trait.NodeIdExt.html b/pr/3279/docs/iroh_relay/node_info/trait.NodeIdExt.html
index 34aab0c4d8..566dc7dfdc 100644
--- a/pr/3279/docs/iroh_relay/node_info/trait.NodeIdExt.html
+++ b/pr/3279/docs/iroh_relay/node_info/trait.NodeIdExt.html
@@ -1,9 +1,9 @@
NodeIdExt in iroh_relay::node_info - Rust pub trait NodeIdExt {
// Required methods
fn to_z32(&self) -> String;
- fn from_z32(s: &str) -> Result<NodeId>;
-}
Expand description
Extension methods for [NodeId] to encode to and decode from [z32],
+ fn from_z32(s: &str) -> Result<NodeId>;
+}Expand description
Extension methods for NodeId to encode to and decode from [z32],
which is the encoding used in [pkarr] domain names.
-
Required Methods§
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§
Implementors§
\ No newline at end of file
+Required Methods§
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§
Implementors§
\ No newline at end of file
diff --git a/pr/3279/docs/iroh_relay/server/enum.AccessConfig.html b/pr/3279/docs/iroh_relay/server/enum.AccessConfig.html
index e563e92169..1d6fd8c443 100644
--- a/pr/3279/docs/iroh_relay/server/enum.AccessConfig.html
+++ b/pr/3279/docs/iroh_relay/server/enum.AccessConfig.html
@@ -1,10 +1,10 @@
AccessConfig in iroh_relay::server - Rust 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
Implementations§
Source§impl AccessConfig
Sourcepub async fn is_allowed(&self, node: NodeId) -> bool
Is this node allowed?
Trait Implementations§
Auto Trait Implementations§
§impl Freeze for AccessConfig
§impl !RefUnwindSafe for AccessConfig
§impl Send for AccessConfig
§impl Sync for AccessConfig
§impl Unpin for AccessConfig
§impl !UnwindSafe for AccessConfig
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
diff --git a/pr/3279/docs/iroh_relay/server/struct.Server.html b/pr/3279/docs/iroh_relay/server/struct.Server.html
index ef4cf17208..540113411b 100644
--- a/pr/3279/docs/iroh_relay/server/struct.Server.html
+++ b/pr/3279/docs/iroh_relay/server/struct.Server.html
@@ -14,9 +14,9 @@ case there is an error in the server before it is shut down.
Sourcepub fn quic_addr(&self) -> Option<SocketAddr>
The socket address the QUIC server is listening on.
Sourcepub fn stun_addr(&self) -> Option<SocketAddr>
The socket address the STUN server is listening on.
Sourcepub fn certificates(&self) -> Option<Vec<CertificateDer<'static>>>
The certificates chain if configured with manual TLS certificates.
-Sourcepub fn https_url(&self) -> Option<RelayUrl>
Available on crate feature test-utils only.
Get the server’s https [RelayUrl].
+Sourcepub 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.
-Sourcepub fn http_url(&self) -> Option<RelayUrl>
Available on crate feature test-utils only.
Get the server’s http [RelayUrl].
+Sourcepub 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.
Sourcepub fn metrics(&self) -> &RelayMetrics
Returns the metrics collected in the relay server.
Trait Implementations§
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 Twhere
diff --git a/pr/3279/docs/iroh_relay/struct.RelayMap.html b/pr/3279/docs/iroh_relay/struct.RelayMap.html
index f7785d0b26..a92036b6c0 100644
--- a/pr/3279/docs/iroh_relay/struct.RelayMap.html
+++ b/pr/3279/docs/iroh_relay/struct.RelayMap.html
@@ -1,15 +1,15 @@
RelayMap in iroh_relay - Rust pub struct RelayMap { /* private fields */ }
Expand description
Configuration of all the relay servers that can be used.
-Implementations§
Source§impl RelayMap
Implementations§
Trait Implementations§
Trait Implementations§
Source§impl FromIterator<RelayNode> for RelayMap
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§impl FromIterator<RelayUrl> for RelayMap
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/3279/docs/iroh_relay/struct.RelayNode.html b/pr/3279/docs/iroh_relay/struct.RelayNode.html
index 631f66dad8..a1e0bcc76b 100644
--- a/pr/3279/docs/iroh_relay/struct.RelayNode.html
+++ b/pr/3279/docs/iroh_relay/struct.RelayNode.html
@@ -1,11 +1,11 @@
RelayNode in iroh_relay - Rust pub struct RelayNode {
- pub url: RelayUrl,
+ pub url: RelayUrl,
pub stun_only: bool,
pub stun_port: u16,
pub quic: Option<RelayQuicConfig>,
}
Expand description
Information on a specific relay server.
Includes the Url where it can be dialed.
-Fields§
§url: RelayUrlThe [RelayUrl] where this relay server can be dialed.
+Fields§
§url: RelayUrlThe RelayUrl where this relay server can be dialed.
§stun_only: boolWhether this relay server should only be used for STUN requests.
This essentially allows you to use a normal STUN server as a relay node, no relay
functionality is used.
@@ -15,7 +15,7 @@ functionality is used.
When None, we will not attempt to do QUIC address discovery
with this relay server.
Trait Implementations§
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 moreSource§impl FromIterator<RelayNode> for RelayMap
Source§impl FromIterator<RelayNode> for RelayMap
Source§impl Ord for RelayNode
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/3279/docs/src/iroh/discovery/pkarr.rs.html b/pr/3279/docs/src/iroh/discovery/pkarr.rs.html
index ffd78e96aa..76ac2af514 100644
--- a/pr/3279/docs/src/iroh/discovery/pkarr.rs.html
+++ b/pr/3279/docs/src/iroh/discovery/pkarr.rs.html
@@ -402,7 +402,12 @@
401
402
403
-404//! A discovery service which publishes and resolves node information using a [pkarr] relay.
+404
+405
+406
+407
+408
+409
//! A discovery service which publishes and resolves node information using a [pkarr] relay.
//!
//! Public-Key Addressable Resource Records, [pkarr], is a system which allows publishing
//! [DNS Resource Records] owned by a particular [`SecretKey`] under a name derived from its
@@ -796,10 +801,15 @@
.send()
.await?;
- if !response.status().is_success() {
+ let status = response.status();
+ if !status.is_success() {
+ let text = if let Ok(text) = response.text().await {
+ text
+ } else {
+ "(no details provided)".to_string()
+ };
bail!(format!(
- "Publish request failed with status {}",
- response.status()
+ "Publish request failed with status {status}: {text}",
))
}
diff --git a/pr/3279/docs/src/iroh/magicsock.rs.html b/pr/3279/docs/src/iroh/magicsock.rs.html
index f15efd9d87..f21d2e4777 100644
--- a/pr/3279/docs/src/iroh/magicsock.rs.html
+++ b/pr/3279/docs/src/iroh/magicsock.rs.html
@@ -3613,13 +3613,7 @@
3612
3613
3614
-3615
-3616
-3617
-3618
-3619
-3620
-3621
//! Implements a socket that can change its communication path while in use, actively searching for the best way to communicate.
+3615
//! Implements a socket that can change its communication path while in use, actively searching for the best way to communicate.
//!
//! Based on tailscale/wgengine/magicsock
//!
@@ -4229,12 +4223,14 @@
return Poll::Pending;
}
- let mut transport_metas = vec![transports::RecvMeta::default(); metas.len()];
-
- match self.transports.poll_recv(cx, bufs, &mut transport_metas)? {
+ let mut source_addrs = vec![transports::Addr::default(); metas.len()];
+ match self
+ .transports
+ .poll_recv(cx, bufs, metas, &mut source_addrs)?
+ {
Poll::Pending | Poll::Ready(0) => Poll::Pending,
Poll::Ready(n) => {
- self.process_datagrams(&mut bufs[..n], &transport_metas[..n], &mut metas[..n]);
+ self.process_datagrams(&mut bufs[..n], &mut metas[..n], &source_addrs[..n]);
Poll::Ready(Ok(n))
}
}
@@ -4249,14 +4245,9 @@
fn process_datagrams(
&self,
bufs: &mut [io::IoSliceMut<'_>],
- transport_metas: &[transports::RecvMeta],
metas: &mut [quinn_udp::RecvMeta],
+ source_addrs: &[transports::Addr],
) {
- debug_assert_eq!(
- bufs.len(),
- transport_metas.len(),
- "non matching bufs & metas"
- );
debug_assert_eq!(bufs.len(), metas.len(), "non matching bufs & metas");
// Adding the IP address we received something on results in Quinn using this
@@ -4279,25 +4270,25 @@
let mut quic_packets_total = 0;
- for ((transport_meta, quinn_meta), buf) in transport_metas
- .iter()
- .zip(metas.iter_mut())
+ for ((quinn_meta, buf), source_addr) in metas
+ .iter_mut()
.zip(bufs.iter_mut())
+ .zip(source_addrs.iter())
{
let mut buf_contains_quic_datagrams = false;
let mut quic_datagram_count = 0;
- if transport_meta.len > transport_meta.stride {
- trace!(%transport_meta.len, %transport_meta.stride, "GRO datagram received");
+ if quinn_meta.len > quinn_meta.stride {
+ trace!(%quinn_meta.len, %quinn_meta.stride, "GRO datagram received");
self.metrics.magicsock.recv_gro_datagrams.inc();
}
// Chunk through the datagrams in this GRO payload to find disco and stun
// packets and forward them to the actor
- for datagram in buf[..transport_meta.len].chunks_mut(transport_meta.stride) {
- if datagram.len() < transport_meta.stride {
+ for datagram in buf[..quinn_meta.len].chunks_mut(quinn_meta.stride) {
+ if datagram.len() < quinn_meta.stride {
trace!(
len = %datagram.len(),
- %transport_meta.stride,
+ %quinn_meta.stride,
"Last GRO datagram smaller than stride",
);
}
@@ -4306,21 +4297,21 @@
// byte of those packets with zero to make Quinn ignore the packet. This
// relies on quinn::EndpointConfig::grease_quic_bit being set to `false`,
// which we do in Endpoint::bind.
- if transport_meta.addr.is_ip() && stun::is(datagram) {
- trace!(src = ?transport_meta.addr, len = %transport_meta.stride, "UDP recv: stun packet");
+ if source_addr.is_ip() && stun::is(datagram) {
+ trace!(src = ?source_addr, len = %quinn_meta.stride, "UDP recv: stun packet");
let packet2 = Bytes::copy_from_slice(datagram);
self.net_reporter.receive_stun_packet(
packet2,
- transport_meta.addr.clone().try_into().expect("checked"),
+ source_addr.clone().try_into().expect("checked"),
);
datagram[0] = 0u8;
} else if let Some((sender, sealed_box)) = disco::source_and_box(datagram) {
- trace!(src = ?transport_meta.addr, len = %transport_meta.stride, "UDP recv: disco packet");
- self.handle_disco_message(sender, sealed_box, &transport_meta.addr);
+ trace!(src = ?source_addr, len = %quinn_meta.stride, "UDP recv: disco packet");
+ self.handle_disco_message(sender, sealed_box, source_addr);
datagram[0] = 0u8;
} else {
- trace!(src = ?transport_meta.addr, len = %transport_meta.stride, "UDP recv: quic packet");
- match transport_meta.addr {
+ trace!(src = ?source_addr, len = %quinn_meta.stride, "UDP recv: quic packet");
+ match source_addr {
transports::Addr::Ipv4(..) => {
self.metrics
.magicsock
@@ -4351,14 +4342,14 @@
Addr(SocketAddr),
Url(RelayUrl, NodeId),
}
- let addr = match transport_meta.addr {
+ let addr = match source_addr {
transports::Addr::Ipv4(ipv4, port) => AddrOrUrl::Addr(SocketAddr::V4(
- SocketAddrV4::new(ipv4, port.unwrap_or_default()),
+ SocketAddrV4::new(*ipv4, port.unwrap_or_default()),
)),
transports::Addr::Ipv6(ipv6, port) => AddrOrUrl::Addr(SocketAddr::V6(
- SocketAddrV6::new(ipv6, port.unwrap_or_default(), 0, 0),
+ SocketAddrV6::new(*ipv6, port.unwrap_or_default(), 0, 0),
)),
- transports::Addr::RelayUrl(ref url, id) => AddrOrUrl::Url(url.clone(), id),
+ transports::Addr::RelayUrl(ref url, id) => AddrOrUrl::Url(url.clone(), *id),
};
match addr {
@@ -4380,7 +4371,7 @@
trace!(
src = %addr,
count = %quic_datagram_count,
- len = transport_meta.len,
+ len = quinn_meta.len,
"UDP recv QUIC address discovery packets",
);
quic_packets_total += quic_datagram_count;
@@ -4389,7 +4380,7 @@
warn!(
src = %addr,
count = %quic_datagram_count,
- len = transport_meta.len,
+ len = quinn_meta.len,
"UDP recv quic packets: no node state found, skipping",
);
// If we have no node state for the from addr, set len to 0 to make
@@ -4402,7 +4393,7 @@
src = %addr,
node = %node_id.fmt_short(),
count = %quic_datagram_count,
- len = transport_meta.len,
+ len = quinn_meta.len,
"UDP recv quic packets",
);
quic_packets_total += quic_datagram_count;
@@ -4416,9 +4407,6 @@
quinn_meta.addr = quic_mapped_addr.private_socket_addr();
}
}
- quinn_meta.len = transport_meta.len;
- quinn_meta.stride = transport_meta.stride;
- quinn_meta.ecn = transport_meta.ecn;
} else {
// If all datagrams in this buf are DISCO or STUN, set len to zero to make
// Quinn skip the buf completely.
diff --git a/pr/3279/docs/src/iroh/magicsock/transports.rs.html b/pr/3279/docs/src/iroh/magicsock/transports.rs.html
index 6a222cd359..a83429350a 100644
--- a/pr/3279/docs/src/iroh/magicsock/transports.rs.html
+++ b/pr/3279/docs/src/iroh/magicsock/transports.rs.html
@@ -394,21 +394,7 @@
393
394
395
-396
-397
-398
-399
-400
-401
-402
-403
-404
-405
-406
-407
-408
-409
-410
use std::{
+396
use std::{
io::{self, IoSliceMut},
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6},
pin::Pin,
@@ -500,14 +486,15 @@
&self,
cx: &mut Context,
bufs: &mut [IoSliceMut<'_>],
- metas: &mut [RecvMeta],
+ metas: &mut [quinn_udp::RecvMeta],
+ source_addrs: &mut [Addr],
) -> Poll<io::Result<usize>> {
debug_assert_eq!(bufs.len(), metas.len(), "non matching bufs & metas");
// TODO: randomization
macro_rules! poll_transport {
($socket:expr) => {
- match $socket.poll_recv(cx, bufs, metas)? {
+ match $socket.poll_recv(cx, bufs, metas, source_addrs)? {
Poll::Pending | Poll::Ready(0) => {}
Poll::Ready(n) => {
return Poll::Ready(Ok(n));
@@ -703,27 +690,6 @@
pub src_ip: Option<Addr>,
}
-#[derive(Debug, Clone)]
-pub struct RecvMeta {
- pub addr: Addr,
- pub len: usize,
- pub stride: usize,
- pub ecn: Option<quinn_udp::EcnCodepoint>,
- pub dst_ip: Option<Addr>,
-}
-
-impl Default for RecvMeta {
- fn default() -> Self {
- Self {
- addr: SocketAddr::new(Ipv6Addr::UNSPECIFIED.into(), 0).into(),
- len: 0,
- stride: 0,
- ecn: None,
- dst_ip: None,
- }
- }
-}
-
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Addr {
Ipv4(Ipv4Addr, Option<u16>),
@@ -731,6 +697,12 @@
RelayUrl(RelayUrl, NodeId),
}
+impl Default for Addr {
+ fn default() -> Self {
+ Self::Ipv6(Ipv6Addr::UNSPECIFIED, None)
+ }
+}
+
impl From<IpAddr> for Addr {
fn from(value: IpAddr) -> Self {
match value {
diff --git a/pr/3279/docs/src/iroh/magicsock/transports/ip.rs.html b/pr/3279/docs/src/iroh/magicsock/transports/ip.rs.html
index 0814eeba2f..06b24dfd73 100644
--- a/pr/3279/docs/src/iroh/magicsock/transports/ip.rs.html
+++ b/pr/3279/docs/src/iroh/magicsock/transports/ip.rs.html
@@ -142,11 +142,7 @@
141
142
143
-144
-145
-146
-147
-148
use std::{
+144
use std::{
io,
net::SocketAddr,
pin::Pin,
@@ -158,7 +154,7 @@
use quinn::AsyncUdpSocket;
use tracing::trace;
-use super::{RecvMeta, Transmit};
+use super::{Addr, Transmit};
use crate::{
magicsock::UdpConn,
watchable::{Watchable, Watcher},
@@ -222,22 +218,18 @@
&self,
cx: &mut Context,
bufs: &mut [io::IoSliceMut<'_>],
- metas: &mut [RecvMeta],
+ metas: &mut [quinn_udp::RecvMeta],
+ source_addrs: &mut [Addr],
) -> Poll<io::Result<usize>> {
- // TODO: figure out how to optimize this
- let mut quinn_metas = vec![quinn_udp::RecvMeta::default(); metas.len()];
- match self.socket.poll_recv(cx, bufs, &mut quinn_metas) {
+ match self.socket.poll_recv(cx, bufs, metas) {
Poll::Pending => Poll::Pending,
- Poll::Ready(res) => {
- for (quinn_meta, meta) in quinn_metas.into_iter().zip(metas.iter_mut()) {
- meta.addr = quinn_meta.addr.into();
- meta.len = quinn_meta.len;
- meta.stride = quinn_meta.stride;
- meta.ecn = quinn_meta.ecn;
- meta.dst_ip = quinn_meta.dst_ip.map(Into::into);
+ Poll::Ready(Ok(n)) => {
+ for (addr, el) in source_addrs.iter_mut().zip(metas.iter()).take(n) {
+ *addr = el.addr.into();
}
- Poll::Ready(res)
+ Poll::Ready(Ok(n))
}
+ Poll::Ready(Err(err)) => Poll::Ready(Err(err)),
}
}
diff --git a/pr/3279/docs/src/iroh/magicsock/transports/relay.rs.html b/pr/3279/docs/src/iroh/magicsock/transports/relay.rs.html
index 2d2c68791d..87dc665e19 100644
--- a/pr/3279/docs/src/iroh/magicsock/transports/relay.rs.html
+++ b/pr/3279/docs/src/iroh/magicsock/transports/relay.rs.html
@@ -475,7 +475,11 @@
474
475
476
-477
use std::{
+477
+478
+479
+480
+481
use std::{
io,
pin::Pin,
sync::Arc,
@@ -492,7 +496,7 @@
use tokio::sync::mpsc;
use tracing::{error, info_span, trace, warn, Instrument};
-use super::{RecvMeta, Transmit};
+use super::{Addr, Transmit};
use crate::{
magicsock::RelayContents,
watchable::{Watchable, Watcher as _},
@@ -607,10 +611,15 @@
&self,
cx: &mut Context,
bufs: &mut [io::IoSliceMut<'_>],
- metas: &mut [RecvMeta],
+ metas: &mut [quinn_udp::RecvMeta],
+ source_addrs: &mut [Addr],
) -> Poll<io::Result<usize>> {
let mut num_msgs = 0;
- 'outer: for (buf_out, meta_out) in bufs.iter_mut().zip(metas.iter_mut()) {
+ 'outer: for ((buf_out, meta_out), addr) in bufs
+ .iter_mut()
+ .zip(metas.iter_mut())
+ .zip(source_addrs.iter_mut())
+ {
let dm = match self.relay_datagram_recv_queue.poll_recv(cx) {
Poll::Ready(Ok(recv)) => recv,
Poll::Ready(Err(err)) => {
@@ -626,13 +635,12 @@
};
buf_out[..dm.buf.len()].copy_from_slice(&dm.buf);
- *meta_out = RecvMeta {
- len: dm.buf.len(),
- stride: dm.buf.len(),
- addr: (dm.url, dm.src).into(),
- ecn: None,
- dst_ip: None, // TODO: insert the relay url for this relay
- };
+ meta_out.len = dm.buf.len();
+ meta_out.stride = dm.buf.len();
+ meta_out.ecn = None;
+ meta_out.dst_ip = None; // TODO: insert the relay url for this relay
+
+ *addr = (dm.url, dm.src).into();
num_msgs += 1;
}
diff --git a/pr/3279/docs/src/iroh_dns_server/store.rs.html b/pr/3279/docs/src/iroh_dns_server/store.rs.html
index 43a200b9f9..3e06704859 100644
--- a/pr/3279/docs/src/iroh_dns_server/store.rs.html
+++ b/pr/3279/docs/src/iroh_dns_server/store.rs.html
@@ -267,7 +267,30 @@
266
267
268
-269
//! Pkarr packet store used to resolve DNS queries.
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
//! Pkarr packet store used to resolve DNS queries.
use std::{collections::BTreeMap, num::NonZeroUsize, path::Path, sync::Arc, time::Duration};
@@ -276,7 +299,7 @@
use lru::LruCache;
use pkarr::{Client as PkarrClient, SignedPacket};
use tokio::sync::Mutex;
-use tracing::{debug, trace};
+use tracing::{debug, trace, warn};
use ttl_cache::TtlCache;
use self::signed_packets::SignedPacketStore;
@@ -361,24 +384,46 @@
}
/// Resolve a DNS query.
- #[allow(clippy::unused_async)]
+ #[tracing::instrument("resolve", skip_all, fields(pubkey=%pubkey,name=%name,typ=%record_type))]
pub async fn resolve(
&self,
pubkey: &PublicKeyBytes,
name: &Name,
record_type: RecordType,
) -> Result<Option<Arc<RecordSet>>> {
- tracing::info!("{} {}", name, record_type);
+ trace!("store resolve");
if let Some(rset) = self.cache.lock().await.resolve(pubkey, name, record_type) {
+ debug!(
+ len = rset.records_without_rrsigs().count(),
+ "resolved from cache"
+ );
return Ok(Some(rset));
}
if let Some(packet) = self.store.get(pubkey).await? {
- return self
+ trace!(packet_timestamp = ?packet.timestamp(), "store hit");
+ return match self
.cache
.lock()
.await
- .insert_and_resolve(&packet, name, record_type);
+ .insert_and_resolve(&packet, name, record_type)
+ {
+ Ok(Some(rset)) => {
+ debug!(
+ len = rset.records_without_rrsigs().count(),
+ "resolved from store"
+ );
+ Ok(Some(rset))
+ }
+ Ok(None) => {
+ debug!("resolved to zone, but no matching records in zone");
+ Ok(None)
+ }
+ Err(err) => {
+ warn!("failed to retrieve zone after inserting in cache: {err:#?}");
+ Err(err)
+ }
+ };
};
if let Some(pkarr) = self.pkarr.as_ref() {
@@ -495,11 +540,14 @@
.map(|old| old.is_newer_than(signed_packet))
.unwrap_or(false)
{
- return Ok(());
+ trace!("insert skip: cached is newer");
+ Ok(())
+ } else {
+ self.cache
+ .put(pubkey, CachedZone::from_signed_packet(signed_packet)?);
+ trace!("inserted into cache");
+ Ok(())
}
- self.cache
- .put(pubkey, CachedZone::from_signed_packet(signed_packet)?);
- Ok(())
}
fn remove(&mut self, pubkey: &PublicKeyBytes) {
@@ -529,10 +577,8 @@
}
fn resolve(&self, name: &Name, record_type: RecordType) -> Option<Arc<RecordSet>> {
+ trace!(name=%name, typ=%record_type, "resolve in zone");
let key = RrKey::new(name.into(), record_type);
- for record in self.records.keys() {
- tracing::info!("record {:?}", record);
- }
self.records.get(&key).cloned()
}
}
diff --git a/pr/3279/docs/src/iroh_dns_server/store/signed_packets.rs.html b/pr/3279/docs/src/iroh_dns_server/store/signed_packets.rs.html
index bf63d737fa..e72a6e8016 100644
--- a/pr/3279/docs/src/iroh_dns_server/store/signed_packets.rs.html
+++ b/pr/3279/docs/src/iroh_dns_server/store/signed_packets.rs.html
@@ -459,7 +459,48 @@
458
459
460
-461
use std::{future::Future, path::Path, result, sync::Arc, time::Duration};
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
use std::{
+ future::Future,
+ path::Path,
+ result,
+ sync::Arc,
+ time::{Duration, SystemTime},
+};
use anyhow::{Context, Result};
use pkarr::{SignedPacket, Timestamp};
@@ -468,7 +509,7 @@
};
use tokio::sync::{mpsc, oneshot};
use tokio_util::sync::CancellationToken;
-use tracing::{debug, error, info, trace};
+use tracing::{debug, error, info, trace, warn};
use crate::{metrics::Metrics, util::PublicKeyBytes};
@@ -513,7 +554,7 @@
res: oneshot::Sender<Snapshot>,
},
CheckExpired {
- time: [u8; 8],
+ time: Timestamp,
key: PublicKeyBytes,
},
}
@@ -580,7 +621,6 @@
let transaction = self.db.begin_write()?;
let mut tables = Tables::new(&transaction)?;
let timeout = tokio::time::sleep(self.options.max_batch_time);
- let expired = Timestamp::now() - expiry_us;
tokio::pin!(timeout);
for _ in 0..self.options.max_batch_size {
tokio::select! {
@@ -593,9 +633,16 @@
Some(msg) = self.recv.recv() => {
match msg {
Message::Get { key, res } => {
- trace!("get {}", key);
- let packet = get_packet(&tables.signed_packets, &key).context("get packet failed")?;
- res.send(packet).ok();
+ match get_packet(&tables.signed_packets, &key) {
+ Ok(packet) => {
+ trace!("get {key}: {}", packet.is_some());
+ res.send(packet).ok();
+ },
+ Err(err) => {
+ warn!("get {key} failed: {err:#}");
+ return Err(err).with_context(|| format!("get packet for {key} failed"))
+ }
+ }
}
Message::Upsert { packet, res } => {
let key = PublicKeyBytes::from_signed_packet(&packet);
@@ -605,8 +652,8 @@
res.send(false).ok();
continue;
} else {
- // remove the packet from the update time index
- tables.update_time.remove(&packet.timestamp().to_bytes(), key.as_bytes())?;
+ // remove the old packet from the update time index
+ tables.update_time.remove(&existing.timestamp().to_bytes(), key.as_bytes())?;
true
}
} else {
@@ -639,13 +686,21 @@
res.send(Snapshot::new(&self.db)?).ok();
}
Message::CheckExpired { key, time } => {
- trace!("check expired {} at {}", key, u64::from_be_bytes(time));
+ trace!("check expired {} at {}", key, fmt_time(time));
if let Some(packet) = get_packet(&tables.signed_packets, &key)? {
+ let expired = Timestamp::now() - expiry_us;
if packet.timestamp() < expired {
- tables.update_time.remove(&time, key.as_bytes())?;
+ tables.update_time.remove(&time.to_bytes(), key.as_bytes())?;
let _ = tables.signed_packets.remove(key.as_bytes())?;
self.metrics.store_packets_expired.inc();
+ debug!("removed expired packet {key}");
+ } else {
+ debug!("packet {key} is no longer expired, removing obsolete expiry entry");
+ tables.update_time.remove(&time.to_bytes(), key.as_bytes())?;
}
+ } else {
+ debug!("expired packet {key} not found, remove from expiry table");
+ tables.update_time.remove(&time.to_bytes(), key.as_bytes())?;
}
}
}
@@ -659,6 +714,10 @@
}
}
+fn fmt_time(t: Timestamp) -> String {
+ humantime::format_rfc3339_micros(SystemTime::from(t)).to_string()
+}
+
/// A struct similar to [`redb::Table`] but for all tables that make up the
/// signed packet store.
pub(super) struct Tables<'a> {
@@ -778,8 +837,23 @@
let Some(row) = table.get(key.as_ref()).context("database fetch failed")? else {
return Ok(None);
};
- let packet = SignedPacket::deserialize(row.value()).context("parsing signed packet failed")?;
- Ok(Some(packet))
+ match SignedPacket::deserialize(row.value()) {
+ Ok(packet) => Ok(Some(packet)),
+ Err(err) => {
+ // Prior to iroh-dns-server v0.35, we stored packets in the default `SignedPacket::as_bytes` serialization from pkarr v2,
+ // which did not include the `last_seen` timestamp added as a prefix in `SignedPacket::serialize` from pkarr v3.
+ // If decoding the packet as a serialized pkarr v3 packet fails, we assume it was stored with iroh-dns-server before v0.35,
+ // and prepend an empty timestamp.
+ let data = row.value();
+ let mut buf = Vec::with_capacity(data.len() + 8);
+ buf.extend(&[0u8; 8]);
+ buf.extend(data);
+ match SignedPacket::deserialize(&buf) {
+ Ok(packet) => Ok(Some(packet)),
+ Err(err2) => Err(anyhow::anyhow!("Failed to decode as pkarr v3: {err:#}. Also failed to decode as pkarr v2: {err2:#}"))
+ }
+ }
+ }
}
async fn evict_task(send: mpsc::Sender<Message>, options: Options, cancel: CancellationToken) {
@@ -807,7 +881,7 @@
anyhow::bail!("failed to get snapshot");
};
let expired = Timestamp::now() - expiry_us;
- trace!("evicting packets older than {}", expired);
+ trace!("evicting packets older than {}", fmt_time(expired));
// if getting the range fails we exit the loop and shut down
// if individual reads fail we log the error and limp on
for item in snapshot.update_time.range(..expired.to_bytes())? {
@@ -818,26 +892,22 @@
continue;
}
};
- let time = time.value();
- trace!("evicting expired packets at {}", u64::from_be_bytes(time));
+ let time = Timestamp::from(time.value());
+ trace!("evicting expired packets at {}", fmt_time(time));
for item in keys {
let key = match item {
Ok(v) => v,
Err(e) => {
error!(
"failed to read update_time item at {}: {:?}",
- u64::from_be_bytes(time),
+ fmt_time(time),
e
);
continue;
}
};
let key = PublicKeyBytes::new(key.value());
- debug!(
- "evicting expired packet {} {}",
- u64::from_be_bytes(time),
- key
- );
+ debug!("evicting expired packet {} {}", fmt_time(time), key);
send.send(Message::CheckExpired { time, key }).await?;
}
}
diff --git a/pr/3279/docs/trait.impl/core/convert/trait.From.js b/pr/3279/docs/trait.impl/core/convert/trait.From.js
index 3c3eda16f7..f782f797c3 100644
--- a/pr/3279/docs/trait.impl/core/convert/trait.From.js
+++ b/pr/3279/docs/trait.impl/core/convert/trait.From.js
@@ -1,9 +1,9 @@
(function() {
- var implementors = Object.fromEntries([["iroh",[["impl From<DiscoveryItem> for NodeInfo"],["impl From<RemoteInfo> for NodeAddr"],["impl<T> From<T> for ConcurrentDiscovery"]]],["iroh_base",[["impl From<(PublicKey, Option<RelayUrl>, &[SocketAddr])> for NodeAddr"],["impl From<ParseError> for RelayUrlParseError"],["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 Error"],["impl From<Error> for KeyParsingError"],["impl From<Error> for Error"],["impl From<SigningKey> for SecretKey"],["impl From<VerifyingKey> for PublicKey"],["impl From<[u8; 32]> for SecretKey"]]],["iroh_relay",[["impl From<Error> for ConnSendError"],["impl From<NodeInfo> for NodeAddr"],["impl From<RelayNode> for RelayMap"],["impl From<Error> for ConnSendError"],["impl From<NodeAddr> for NodeData"],["impl From<NodeAddr> for NodeInfo"],["impl From<RelayUrl> for RelayMap"],["impl From<RelayUrl> for RelayNode"],["impl From<Resolver<GenericConnector<TokioRuntimeProvider>>> for DnsResolver"],["impl From<TxtLookup> for TxtLookup"]]]]);
+ var implementors = Object.fromEntries([["iroh",[["impl From<DiscoveryItem> for NodeInfo"],["impl From<RemoteInfo> for NodeAddr"],["impl<T> From<T> for ConcurrentDiscovery"]]],["iroh_base",[["impl From<(PublicKey, Option<RelayUrl>, &[SocketAddr])> for NodeAddr"],["impl From<ParseError> for RelayUrlParseError"],["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 Error"],["impl From<Error> for KeyParsingError"],["impl From<Error> for Error"],["impl From<SigningKey> for SecretKey"],["impl From<VerifyingKey> for PublicKey"],["impl From<[u8; 32]> for SecretKey"]]],["iroh_relay",[["impl From<Error> for ConnSendError"],["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<Error> for ConnSendError"],["impl From<Resolver<GenericConnector<TokioRuntimeProvider>>> for DnsResolver"],["impl From<TxtLookup> for TxtLookup"]]]]);
if (window.register_implementors) {
window.register_implementors(implementors);
} else {
window.pending_implementors = implementors;
}
})()
-//{"start":57,"fragment_lengths":[1632,5343,3221]}
\ No newline at end of file
+//{"start":57,"fragment_lengths":[1632,5343,3831]}
\ No newline at end of file
diff --git a/pr/3279/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js b/pr/3279/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js
index d104c409e3..8cd585bc9e 100644
--- a/pr/3279/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js
+++ b/pr/3279/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js
@@ -1,9 +1,9 @@
(function() {
- var implementors = Object.fromEntries([["iroh_relay",[["impl FromIterator<RelayNode> for RelayMap"],["impl FromIterator<RelayUrl> for RelayMap"]]]]);
+ var implementors = Object.fromEntries([["iroh_relay",[["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":[776]}
\ No newline at end of file
+//{"start":57,"fragment_lengths":[898]}
\ No newline at end of file
pub enum DirectAddrType {
+DirectAddrType in iroh::endpoint - Rust pub enum DirectAddrType {
Unknown,
Local,
Stun,
@@ -20,16 +20,16 @@ get a publicly routable direct address.
It is possible to configure iroh to bound to a specific port and independently
configure the router to forward this port to the iroh node. This indicates a
situation like this, which still uses STUN to discover the public address.
-
Trait Implementations§
Source§impl Clone for DirectAddrType
impl Clone for DirectAddrType
Source§fn clone(&self) -> DirectAddrType
fn clone(&self) -> DirectAddrType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DirectAddrType
impl Debug for DirectAddrType
Source§impl Display for DirectAddrType
impl Display for DirectAddrType
Source§impl Hash for DirectAddrType
impl Hash for DirectAddrType
1.3.0 · Source§fn hash_slice<H>(data: &[Self], state: &mut H)where
+
fn hash_slice<H>(data: &[Self], state: &mut H)where
+
Trait Implementations§
Source§impl Clone for DirectAddrType
impl Clone for DirectAddrType
Source§fn clone(&self) -> DirectAddrType
fn clone(&self) -> DirectAddrType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DirectAddrType
impl Debug for DirectAddrType
Source§impl Display for DirectAddrType
impl Display for DirectAddrType
Source§impl Hash for DirectAddrType
impl Hash for DirectAddrType
Source§impl Ord for DirectAddrType
impl Ord for DirectAddrType
Source§impl Ord for DirectAddrType
impl Ord for DirectAddrType
Source§fn cmp(&self, other: &DirectAddrType) -> Ordering
fn cmp(&self, other: &DirectAddrType) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for DirectAddrType
impl PartialEq for DirectAddrType
Source§impl PartialOrd for DirectAddrType
impl PartialOrd for DirectAddrType
Source§impl PartialEq for DirectAddrType
impl PartialEq for DirectAddrType
Source§impl PartialOrd for DirectAddrType
impl PartialOrd for DirectAddrType
impl Copy for DirectAddrType
impl Eq for DirectAddrType
impl StructuralPartialEq for DirectAddrType
Auto Trait Implementations§
impl Freeze for DirectAddrType
impl RefUnwindSafe for DirectAddrType
impl Send for DirectAddrType
impl Sync for DirectAddrType
impl Unpin for DirectAddrType
impl UnwindSafe for DirectAddrType
Blanket Implementations§
impl Copy for DirectAddrType
impl Eq for DirectAddrType
impl StructuralPartialEq for DirectAddrType
Auto Trait Implementations§
impl Freeze for DirectAddrType
impl RefUnwindSafe for DirectAddrType
impl Send for DirectAddrType
impl Sync for DirectAddrType
impl Unpin for DirectAddrType
impl UnwindSafe for DirectAddrType
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
fn implicit(
diff --git a/pr/3279/docs/iroh/endpoint/struct.DirectAddr.html b/pr/3279/docs/iroh/endpoint/struct.DirectAddr.html
index 60737b50aa..79ccfcbde2 100644
--- a/pr/3279/docs/iroh/endpoint/struct.DirectAddr.html
+++ b/pr/3279/docs/iroh/endpoint/struct.DirectAddr.html
@@ -1,4 +1,4 @@
-DirectAddr in iroh::endpoint - Rust pub struct DirectAddr {
+DirectAddr in iroh::endpoint - Rust pub struct DirectAddr {
pub addr: SocketAddr,
pub typ: DirectAddrType,
}
Expand description
A direct address on which an iroh-node might be contactable.
@@ -7,16 +7,16 @@ contacted. These can come from various sources depending on the network topolog
iroh node, see DirectAddrType for the several kinds of sources.
Fields§
§addr: SocketAddrThe address.
§typ: DirectAddrTypeThe origin of this direct address.
-Trait Implementations§
Source§impl Clone for DirectAddr
Source§fn clone(&self) -> DirectAddr
Returns a copy of the value. Read more1.0.0 · Source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read moreSource§impl Debug for DirectAddr
Source§impl Hash for DirectAddr
1.3.0 · Source§fn hash_slice<H>(data: &[Self], state: &mut H)where
+Trait Implementations§
Source§impl Clone for DirectAddr
Source§fn clone(&self) -> DirectAddr
Returns a copy of the value. Read more1.0.0 · Source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read moreSource§impl Debug for DirectAddr
Source§impl Hash for DirectAddr
Source§impl Ord for DirectAddr
Source§impl Ord for DirectAddr
Source§fn cmp(&self, other: &DirectAddr) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read moreSource§impl PartialEq for DirectAddr
Source§impl PartialOrd for DirectAddr
Source§impl PartialEq for DirectAddr
Source§impl PartialOrd for DirectAddr
Source§impl Eq for DirectAddr
Source§impl StructuralPartialEq for DirectAddr
Auto Trait Implementations§
§impl Freeze for DirectAddr
§impl RefUnwindSafe for DirectAddr
§impl Send for DirectAddr
§impl Sync for DirectAddr
§impl Unpin for DirectAddr
§impl UnwindSafe for DirectAddr
Blanket Implementations§
Source§impl Eq for DirectAddr
Source§impl StructuralPartialEq for DirectAddr
Auto Trait Implementations§
§impl Freeze for DirectAddr
§impl RefUnwindSafe for DirectAddr
§impl Send for DirectAddr
§impl Sync for DirectAddr
§impl Unpin for DirectAddr
§impl UnwindSafe for DirectAddr
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§fn implicit(
diff --git a/pr/3279/docs/iroh_dns_server/struct.ZoneStore.html b/pr/3279/docs/iroh_dns_server/struct.ZoneStore.html
index f4933c29e4..4eedd7f167 100644
--- a/pr/3279/docs/iroh_dns_server/struct.ZoneStore.html
+++ b/pr/3279/docs/iroh_dns_server/struct.ZoneStore.html
@@ -1,7 +1,7 @@
ZoneStore in iroh_dns_server - Rust pub struct ZoneStore { /* private fields */ }
Expand description
A store for pkarr signed packets.
Packets are stored in the persistent SignedPacketStore, and cached on-demand in an in-memory LRU
cache used for resolving DNS queries.
-Implementations§
Source§impl ZoneStore
Sourcepub fn persistent(
+
Implementations§
Sourcepub async fn resolve(
&self,
pubkey: &PublicKeyBytes,
name: &Name,
record_type: RecordType,
) -> Result<Option<Arc<RecordSet>>>
Resolve a DNS query.
-Sourcepub async fn get_signed_packet(
+
Sourcepub async fn get_signed_packet(
&self,
pubkey: &PublicKeyBytes,
) -> Result<Option<SignedPacket>>
Get the latest signed packet for a pubkey.
-Sourcepub async fn insert(
&self,
signed_packet: SignedPacket,
_source: PacketSource,
diff --git a/pr/3279/docs/iroh_relay/client/enum.ReceivedMessage.html b/pr/3279/docs/iroh_relay/client/enum.ReceivedMessage.html
index 535193a6c8..d612779969 100644
--- a/pr/3279/docs/iroh_relay/client/enum.ReceivedMessage.html
+++ b/pr/3279/docs/iroh_relay/client/enum.ReceivedMessage.html
@@ -1,9 +1,9 @@
ReceivedMessage in iroh_relay::client - Rust pub enum ReceivedMessage {
ReceivedPacket {
- remote_node_id: NodeId,
+ remote_node_id: NodeId,
data: Bytes,
},
- NodeGone(NodeId),
+ NodeGone(NodeId),
Ping([u8; 8]),
Pong([u8; 8]),
KeepAlive,
@@ -17,9 +17,9 @@
}
Expand description
The messages received from a framed relay stream.
This is a type-validated version of the Frames on the RelayCodec.
Variants§
§ReceivedPacket
Represents an incoming packet.
-Fields
§NodeGone(NodeId)
Indicates that the client identified by the underlying public key had previously sent you a
packet but has now disconnected from the server.
§Ping([u8; 8])
Request from a client or server to reply to the
other side with a ReceivedMessage::Pong with the given payload.
diff --git a/pr/3279/docs/iroh_relay/client/enum.SendMessage.html b/pr/3279/docs/iroh_relay/client/enum.SendMessage.html
index 55d5cca41d..cf87651734 100644
--- a/pr/3279/docs/iroh_relay/client/enum.SendMessage.html
+++ b/pr/3279/docs/iroh_relay/client/enum.SendMessage.html
@@ -1,9 +1,9 @@
SendMessage in iroh_relay::client - Rust pub enum SendMessage {
- SendPacket(NodeId, Bytes),
+ SendPacket(NodeId, Bytes),
Ping([u8; 8]),
Pong([u8; 8]),
}
Expand description
Messages we can send to a relay server.
-Variants§
§SendPacket(NodeId, Bytes)
Send a packet of data to the [NodeId].
+Variants§
§SendPacket(NodeId, Bytes)
Send a packet of data to the NodeId.
§Ping([u8; 8])
Sends a ping message to the connected relay server.
§Pong([u8; 8])
Sends a pong message to the connected relay server.
Trait Implementations§
Source§impl Debug for SendMessage
Source§impl Sink<SendMessage> for Client
Source§type Error = ConnSendError
The type of value produced by the sink when an error occurs.Source§fn poll_ready(
diff --git a/pr/3279/docs/iroh_relay/client/struct.ClientBuilder.html b/pr/3279/docs/iroh_relay/client/struct.ClientBuilder.html
index 22ed2c5e40..4f94efe715 100644
--- a/pr/3279/docs/iroh_relay/client/struct.ClientBuilder.html
+++ b/pr/3279/docs/iroh_relay/client/struct.ClientBuilder.html
@@ -1,7 +1,7 @@
ClientBuilder in iroh_relay::client - Rust pub struct ClientBuilder { /* private fields */ }
Expand description
Build a Client.
Implementations§
Source§impl ClientBuilder
Sourcepub fn new(
- url: impl Into<RelayUrl>,
- secret_key: SecretKey,
+ url: impl Into<RelayUrl>,
+ secret_key: SecretKey,
dns_resolver: DnsResolver,
) -> Self
Create a new ClientBuilder
Sourcepub fn protocol(self, protocol: Protocol) -> Self
Sets whether to connect to the relay via websockets or not.
diff --git a/pr/3279/docs/iroh_relay/dns/struct.DnsResolver.html b/pr/3279/docs/iroh_relay/dns/struct.DnsResolver.html
index ea537effea..7c5a185de6 100644
--- a/pr/3279/docs/iroh_relay/dns/struct.DnsResolver.html
+++ b/pr/3279/docs/iroh_relay/dns/struct.DnsResolver.html
@@ -67,9 +67,9 @@ at T+0ms, T+200ms and T+300ms. The timeout is applied as stated in
summary of all errors otherwise.
Sourcepub async fn lookup_node_by_id(
&self,
- node_id: &NodeId,
+ node_id: &NodeId,
origin: &str,
-) -> Result<NodeInfo>
Looks up node info by [NodeId] and origin domain name.
+) -> Result<NodeInfo>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.
Sourcepub async fn lookup_node_by_domain_name(&self, name: &str) -> Result<NodeInfo>
Looks up node info by DNS name.
@@ -84,10 +84,10 @@ at T+0ms, T+200ms and T+300ms. The result of the first successful call is return
summary of all errors otherwise.
Sourcepub async fn lookup_node_by_id_staggered(
&self,
- node_id: &NodeId,
+ node_id: &NodeId,
origin: &str,
delays_ms: &[u64],
-) -> Result<NodeInfo>
Looks up node info by [NodeId] and origin domain name.
+) -> Result<NodeInfo>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/3279/docs/iroh_relay/index.html b/pr/3279/docs/iroh_relay/index.html
index aa17a382d4..b45ccff8c4 100644
--- a/pr/3279/docs/iroh_relay/index.html
+++ b/pr/3279/docs/iroh_relay/index.html
@@ -25,6 +25,6 @@ Tailscale.
STUN support and expose metrics.
-Re-exports§
pub use protos::relay::MAX_PACKET_SIZE;
Modules§
- Exposes
Client, which allows to establish connections to a relay server. - Default values used in the relay.
- dns
Non-wasm_browser DNS resolver - HTTP-specific constants for the relay server and client.
- Support for handling DNS resource records for dialing by [
NodeId]. - Protocols used by the iroh-relay
- Create a QUIC server that accepts connections
+
Re-exports§
pub use protos::relay::MAX_PACKET_SIZE;
Modules§
- Exposes
Client, which allows to establish connections to a relay server. - Default values used in the relay.
- dns
Non-wasm_browser DNS resolver - HTTP-specific constants for the relay server and client.
- Support for handling DNS resource records for dialing by
NodeId. - Protocols used by the iroh-relay
- Create a QUIC server that accepts connections
for QUIC address discovery.
- server
server A fully-fledged iroh-relay server over HTTP or HTTPS.
Structs§
- Tracks pings on a single relay connection.
- Configuration of all the relay servers that can be used.
- Information on a specific relay server.
- 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/3279/docs/iroh_relay/node_info/index.html b/pr/3279/docs/iroh_relay/node_info/index.html
index daa1aa3c65..e55baaed6c 100644
--- a/pr/3279/docs/iroh_relay/node_info/index.html
+++ b/pr/3279/docs/iroh_relay/node_info/index.html
@@ -1,5 +1,5 @@
-iroh_relay::node_info - Rust 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 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].
+
<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:
- Structs§
- Error returned when an input value is too long for
UserData. - Data about a node that may be published to and resolved from discovery services.
- Information about a node that may be published to and resolved from discovery services.
- Under the hood this is a UTF-8 String is no longer than
UserData::MAX_LENGTH bytes.
Constants§
- The DNS name for the iroh TXT record.
Traits§
- Extension methods for [
NodeId] to encode to and decode from [z32],
+Structs§
- Error returned when an input value is too long for
UserData. - Data about a node that may be published to and resolved from discovery services.
- Information about a node that may be published to and resolved from discovery services.
- Under the hood this is a UTF-8 String is no longer than
UserData::MAX_LENGTH bytes.
Constants§
- The DNS name for the iroh TXT record.
Traits§
- 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/3279/docs/iroh_relay/node_info/struct.NodeData.html b/pr/3279/docs/iroh_relay/node_info/struct.NodeData.html
index f4a1f6e4b0..4a3e6db1c8 100644
--- a/pr/3279/docs/iroh_relay/node_info/struct.NodeData.html
+++ b/pr/3279/docs/iroh_relay/node_info/struct.NodeData.html
@@ -1,20 +1,20 @@
NodeData in iroh_relay::node_info - Rust 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
Sourcepub 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.
-Sourcepub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self
Sets the relay URL and returns the updated node data.
+Sourcepub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self
Sets the relay URL and returns the updated node data.
Sourcepub fn with_direct_addresses(
self,
direct_addresses: BTreeSet<SocketAddr>,
) -> Self
Sets the direct addresses and returns the updated node data.
Sourcepub fn with_user_data(self, user_data: Option<UserData>) -> Self
Sets the user-defined data and returns the updated node data.
-Sourcepub fn user_data(&self) -> Option<&UserData>
Returns the optional user-defined data of the node.
Sourcepub fn direct_addresses(&self) -> &BTreeSet<SocketAddr>
Returns the direct addresses of the node.
Sourcepub 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.
-Sourcepub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)
Sets the relay URL of the node data.
+Sourcepub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)
Sets the relay URL of the node data.
Sourcepub fn set_user_data(&mut self, user_data: Option<UserData>)
Sets the user-defined data of the node data.
-Trait Implementations§
Trait Implementations§
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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
diff --git a/pr/3279/docs/iroh_relay/node_info/struct.NodeInfo.html b/pr/3279/docs/iroh_relay/node_info/struct.NodeInfo.html
index cd66ba54e3..dde190c92b 100644
--- a/pr/3279/docs/iroh_relay/node_info/struct.NodeInfo.html
+++ b/pr/3279/docs/iroh_relay/node_info/struct.NodeInfo.html
@@ -1,30 +1,30 @@
NodeInfo in iroh_relay::node_info - Rust 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: NodeIdThe [NodeId] of the node this is about.
+
+Fields§
§node_id: NodeIdThe NodeId of the node this is about.
§data: NodeDataThe information published about the node.
-Implementations§
Source§impl NodeInfo
Sourcepub fn from_parts(node_id: NodeId, data: NodeData) -> Self
Creates a new NodeInfo from its parts.
-Sourcepub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self
Sets the relay URL and returns the updated node info.
+Implementations§
Source§impl NodeInfo
Sourcepub fn from_parts(node_id: NodeId, data: NodeData) -> Self
Creates a new NodeInfo from its parts.
+Sourcepub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self
Sets the relay URL and returns the updated node info.
Sourcepub fn with_direct_addresses(
self,
direct_addresses: BTreeSet<SocketAddr>,
) -> Self
Sets the direct addresses and returns the updated node info.
Sourcepub fn with_user_data(self, user_data: Option<UserData>) -> Self
Sets the user-defined data and returns the updated node info.
-Sourcepub fn to_node_addr(&self) -> NodeAddr
Converts into a [NodeAddr] by cloning the needed fields.
-Sourcepub fn into_node_addr(self) -> NodeAddr
Converts into a [NodeAddr] without cloning.
+Sourcepub fn to_node_addr(&self) -> NodeAddr
Converts into a NodeAddr by cloning the needed fields.
+Sourcepub fn into_node_addr(self) -> NodeAddr
Converts into a NodeAddr without cloning.
Sourcepub fn from_txt_lookup(lookup: TxtLookup) -> Result<Self>
Available on non-wasm_browser only.
Parses a NodeInfo from a TXT records lookup.
Sourcepub fn from_pkarr_signed_packet(packet: &SignedPacket) -> Result<Self>
Parses a NodeInfo from a [pkarr::SignedPacket].
Sourcepub fn to_pkarr_signed_packet(
&self,
- secret_key: &SecretKey,
+ secret_key: &SecretKey,
ttl: u32,
) -> Result<SignedPacket>
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.
Sourcepub fn to_txt_strings(&self) -> Vec<String>
Converts into a list of {key}={value} strings.
-Methods from Deref<Target = NodeData>§
Sourcepub fn user_data(&self) -> Option<&UserData>
Returns the optional user-defined data of the node.
Sourcepub fn direct_addresses(&self) -> &BTreeSet<SocketAddr>
Returns the direct addresses of the node.
Sourcepub fn clear_direct_addresses(&mut self)
Removes all direct addresses from the node data.
@@ -32,9 +32,9 @@
&mut self,
addrs: impl IntoIterator<Item = SocketAddr>,
)Adds direct addresses to the node data.
-Sourcepub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)
Sets the relay URL of the node data.
+Sourcepub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)
Sets the relay URL of the node data.
Sourcepub fn set_user_data(&mut self, user_data: Option<UserData>)
Sets the user-defined data of the node data.
-Trait Implementations§
Trait Implementations§
Source§impl Eq for NodeInfo
Source§impl StructuralPartialEq for NodeInfo
Auto Trait Implementations§
§impl Freeze for NodeInfo
§impl RefUnwindSafe for NodeInfo
§impl Send for NodeInfo
§impl Sync for NodeInfo
§impl Unpin for NodeInfo
§impl UnwindSafe for NodeInfo
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
diff --git a/pr/3279/docs/iroh_relay/node_info/trait.NodeIdExt.html b/pr/3279/docs/iroh_relay/node_info/trait.NodeIdExt.html
index 34aab0c4d8..566dc7dfdc 100644
--- a/pr/3279/docs/iroh_relay/node_info/trait.NodeIdExt.html
+++ b/pr/3279/docs/iroh_relay/node_info/trait.NodeIdExt.html
@@ -1,9 +1,9 @@
NodeIdExt in iroh_relay::node_info - Rust pub trait NodeIdExt {
// Required methods
fn to_z32(&self) -> String;
- fn from_z32(s: &str) -> Result<NodeId>;
-}
Expand description
Extension methods for [NodeId] to encode to and decode from [z32],
+ fn from_z32(s: &str) -> Result<NodeId>;
+}Expand description
Extension methods for NodeId to encode to and decode from [z32],
which is the encoding used in [pkarr] domain names.
-
Required Methods§
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§
Implementors§
\ No newline at end of file
+Required Methods§
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§
Implementors§
\ No newline at end of file
diff --git a/pr/3279/docs/iroh_relay/server/enum.AccessConfig.html b/pr/3279/docs/iroh_relay/server/enum.AccessConfig.html
index e563e92169..1d6fd8c443 100644
--- a/pr/3279/docs/iroh_relay/server/enum.AccessConfig.html
+++ b/pr/3279/docs/iroh_relay/server/enum.AccessConfig.html
@@ -1,10 +1,10 @@
AccessConfig in iroh_relay::server - Rust 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
Implementations§
Source§impl AccessConfig
Sourcepub async fn is_allowed(&self, node: NodeId) -> bool
Is this node allowed?
Trait Implementations§
Auto Trait Implementations§
§impl Freeze for AccessConfig
§impl !RefUnwindSafe for AccessConfig
§impl Send for AccessConfig
§impl Sync for AccessConfig
§impl Unpin for AccessConfig
§impl !UnwindSafe for AccessConfig
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
diff --git a/pr/3279/docs/iroh_relay/server/struct.Server.html b/pr/3279/docs/iroh_relay/server/struct.Server.html
index ef4cf17208..540113411b 100644
--- a/pr/3279/docs/iroh_relay/server/struct.Server.html
+++ b/pr/3279/docs/iroh_relay/server/struct.Server.html
@@ -14,9 +14,9 @@ case there is an error in the server before it is shut down.
Sourcepub fn quic_addr(&self) -> Option<SocketAddr>
The socket address the QUIC server is listening on.
Sourcepub fn stun_addr(&self) -> Option<SocketAddr>
The socket address the STUN server is listening on.
Sourcepub fn certificates(&self) -> Option<Vec<CertificateDer<'static>>>
The certificates chain if configured with manual TLS certificates.
-Sourcepub fn https_url(&self) -> Option<RelayUrl>
Available on crate feature test-utils only.
Get the server’s https [RelayUrl].
+Sourcepub 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.
-Sourcepub fn http_url(&self) -> Option<RelayUrl>
Available on crate feature test-utils only.
Get the server’s http [RelayUrl].
+Sourcepub 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.
Sourcepub fn metrics(&self) -> &RelayMetrics
Returns the metrics collected in the relay server.
Trait Implementations§
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 Twhere
diff --git a/pr/3279/docs/iroh_relay/struct.RelayMap.html b/pr/3279/docs/iroh_relay/struct.RelayMap.html
index f7785d0b26..a92036b6c0 100644
--- a/pr/3279/docs/iroh_relay/struct.RelayMap.html
+++ b/pr/3279/docs/iroh_relay/struct.RelayMap.html
@@ -1,15 +1,15 @@
RelayMap in iroh_relay - Rust pub struct RelayMap { /* private fields */ }
Expand description
Configuration of all the relay servers that can be used.
-Implementations§
Source§impl RelayMap
Implementations§
Trait Implementations§
Trait Implementations§
Source§impl FromIterator<RelayNode> for RelayMap
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§impl FromIterator<RelayUrl> for RelayMap
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/3279/docs/iroh_relay/struct.RelayNode.html b/pr/3279/docs/iroh_relay/struct.RelayNode.html
index 631f66dad8..a1e0bcc76b 100644
--- a/pr/3279/docs/iroh_relay/struct.RelayNode.html
+++ b/pr/3279/docs/iroh_relay/struct.RelayNode.html
@@ -1,11 +1,11 @@
RelayNode in iroh_relay - Rust pub struct RelayNode {
- pub url: RelayUrl,
+ pub url: RelayUrl,
pub stun_only: bool,
pub stun_port: u16,
pub quic: Option<RelayQuicConfig>,
}
Expand description
Information on a specific relay server.
Includes the Url where it can be dialed.
-Fields§
§url: RelayUrlThe [RelayUrl] where this relay server can be dialed.
+Fields§
§url: RelayUrlThe RelayUrl where this relay server can be dialed.
§stun_only: boolWhether this relay server should only be used for STUN requests.
This essentially allows you to use a normal STUN server as a relay node, no relay
functionality is used.
@@ -15,7 +15,7 @@ functionality is used.
When None, we will not attempt to do QUIC address discovery
with this relay server.
Trait Implementations§
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 moreSource§impl FromIterator<RelayNode> for RelayMap
Source§impl FromIterator<RelayNode> for RelayMap
Source§impl Ord for RelayNode
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/3279/docs/src/iroh/discovery/pkarr.rs.html b/pr/3279/docs/src/iroh/discovery/pkarr.rs.html
index ffd78e96aa..76ac2af514 100644
--- a/pr/3279/docs/src/iroh/discovery/pkarr.rs.html
+++ b/pr/3279/docs/src/iroh/discovery/pkarr.rs.html
@@ -402,7 +402,12 @@
401
402
403
-404//! A discovery service which publishes and resolves node information using a [pkarr] relay.
+404
+405
+406
+407
+408
+409
//! A discovery service which publishes and resolves node information using a [pkarr] relay.
//!
//! Public-Key Addressable Resource Records, [pkarr], is a system which allows publishing
//! [DNS Resource Records] owned by a particular [`SecretKey`] under a name derived from its
@@ -796,10 +801,15 @@
.send()
.await?;
- if !response.status().is_success() {
+ let status = response.status();
+ if !status.is_success() {
+ let text = if let Ok(text) = response.text().await {
+ text
+ } else {
+ "(no details provided)".to_string()
+ };
bail!(format!(
- "Publish request failed with status {}",
- response.status()
+ "Publish request failed with status {status}: {text}",
))
}
diff --git a/pr/3279/docs/src/iroh/magicsock.rs.html b/pr/3279/docs/src/iroh/magicsock.rs.html
index f15efd9d87..f21d2e4777 100644
--- a/pr/3279/docs/src/iroh/magicsock.rs.html
+++ b/pr/3279/docs/src/iroh/magicsock.rs.html
@@ -3613,13 +3613,7 @@
3612
3613
3614
-3615
-3616
-3617
-3618
-3619
-3620
-3621
//! Implements a socket that can change its communication path while in use, actively searching for the best way to communicate.
+3615
//! Implements a socket that can change its communication path while in use, actively searching for the best way to communicate.
//!
//! Based on tailscale/wgengine/magicsock
//!
@@ -4229,12 +4223,14 @@
return Poll::Pending;
}
- let mut transport_metas = vec![transports::RecvMeta::default(); metas.len()];
-
- match self.transports.poll_recv(cx, bufs, &mut transport_metas)? {
+ let mut source_addrs = vec![transports::Addr::default(); metas.len()];
+ match self
+ .transports
+ .poll_recv(cx, bufs, metas, &mut source_addrs)?
+ {
Poll::Pending | Poll::Ready(0) => Poll::Pending,
Poll::Ready(n) => {
- self.process_datagrams(&mut bufs[..n], &transport_metas[..n], &mut metas[..n]);
+ self.process_datagrams(&mut bufs[..n], &mut metas[..n], &source_addrs[..n]);
Poll::Ready(Ok(n))
}
}
@@ -4249,14 +4245,9 @@
fn process_datagrams(
&self,
bufs: &mut [io::IoSliceMut<'_>],
- transport_metas: &[transports::RecvMeta],
metas: &mut [quinn_udp::RecvMeta],
+ source_addrs: &[transports::Addr],
) {
- debug_assert_eq!(
- bufs.len(),
- transport_metas.len(),
- "non matching bufs & metas"
- );
debug_assert_eq!(bufs.len(), metas.len(), "non matching bufs & metas");
// Adding the IP address we received something on results in Quinn using this
@@ -4279,25 +4270,25 @@
let mut quic_packets_total = 0;
- for ((transport_meta, quinn_meta), buf) in transport_metas
- .iter()
- .zip(metas.iter_mut())
+ for ((quinn_meta, buf), source_addr) in metas
+ .iter_mut()
.zip(bufs.iter_mut())
+ .zip(source_addrs.iter())
{
let mut buf_contains_quic_datagrams = false;
let mut quic_datagram_count = 0;
- if transport_meta.len > transport_meta.stride {
- trace!(%transport_meta.len, %transport_meta.stride, "GRO datagram received");
+ if quinn_meta.len > quinn_meta.stride {
+ trace!(%quinn_meta.len, %quinn_meta.stride, "GRO datagram received");
self.metrics.magicsock.recv_gro_datagrams.inc();
}
// Chunk through the datagrams in this GRO payload to find disco and stun
// packets and forward them to the actor
- for datagram in buf[..transport_meta.len].chunks_mut(transport_meta.stride) {
- if datagram.len() < transport_meta.stride {
+ for datagram in buf[..quinn_meta.len].chunks_mut(quinn_meta.stride) {
+ if datagram.len() < quinn_meta.stride {
trace!(
len = %datagram.len(),
- %transport_meta.stride,
+ %quinn_meta.stride,
"Last GRO datagram smaller than stride",
);
}
@@ -4306,21 +4297,21 @@
// byte of those packets with zero to make Quinn ignore the packet. This
// relies on quinn::EndpointConfig::grease_quic_bit being set to `false`,
// which we do in Endpoint::bind.
- if transport_meta.addr.is_ip() && stun::is(datagram) {
- trace!(src = ?transport_meta.addr, len = %transport_meta.stride, "UDP recv: stun packet");
+ if source_addr.is_ip() && stun::is(datagram) {
+ trace!(src = ?source_addr, len = %quinn_meta.stride, "UDP recv: stun packet");
let packet2 = Bytes::copy_from_slice(datagram);
self.net_reporter.receive_stun_packet(
packet2,
- transport_meta.addr.clone().try_into().expect("checked"),
+ source_addr.clone().try_into().expect("checked"),
);
datagram[0] = 0u8;
} else if let Some((sender, sealed_box)) = disco::source_and_box(datagram) {
- trace!(src = ?transport_meta.addr, len = %transport_meta.stride, "UDP recv: disco packet");
- self.handle_disco_message(sender, sealed_box, &transport_meta.addr);
+ trace!(src = ?source_addr, len = %quinn_meta.stride, "UDP recv: disco packet");
+ self.handle_disco_message(sender, sealed_box, source_addr);
datagram[0] = 0u8;
} else {
- trace!(src = ?transport_meta.addr, len = %transport_meta.stride, "UDP recv: quic packet");
- match transport_meta.addr {
+ trace!(src = ?source_addr, len = %quinn_meta.stride, "UDP recv: quic packet");
+ match source_addr {
transports::Addr::Ipv4(..) => {
self.metrics
.magicsock
@@ -4351,14 +4342,14 @@
Addr(SocketAddr),
Url(RelayUrl, NodeId),
}
- let addr = match transport_meta.addr {
+ let addr = match source_addr {
transports::Addr::Ipv4(ipv4, port) => AddrOrUrl::Addr(SocketAddr::V4(
- SocketAddrV4::new(ipv4, port.unwrap_or_default()),
+ SocketAddrV4::new(*ipv4, port.unwrap_or_default()),
)),
transports::Addr::Ipv6(ipv6, port) => AddrOrUrl::Addr(SocketAddr::V6(
- SocketAddrV6::new(ipv6, port.unwrap_or_default(), 0, 0),
+ SocketAddrV6::new(*ipv6, port.unwrap_or_default(), 0, 0),
)),
- transports::Addr::RelayUrl(ref url, id) => AddrOrUrl::Url(url.clone(), id),
+ transports::Addr::RelayUrl(ref url, id) => AddrOrUrl::Url(url.clone(), *id),
};
match addr {
@@ -4380,7 +4371,7 @@
trace!(
src = %addr,
count = %quic_datagram_count,
- len = transport_meta.len,
+ len = quinn_meta.len,
"UDP recv QUIC address discovery packets",
);
quic_packets_total += quic_datagram_count;
@@ -4389,7 +4380,7 @@
warn!(
src = %addr,
count = %quic_datagram_count,
- len = transport_meta.len,
+ len = quinn_meta.len,
"UDP recv quic packets: no node state found, skipping",
);
// If we have no node state for the from addr, set len to 0 to make
@@ -4402,7 +4393,7 @@
src = %addr,
node = %node_id.fmt_short(),
count = %quic_datagram_count,
- len = transport_meta.len,
+ len = quinn_meta.len,
"UDP recv quic packets",
);
quic_packets_total += quic_datagram_count;
@@ -4416,9 +4407,6 @@
quinn_meta.addr = quic_mapped_addr.private_socket_addr();
}
}
- quinn_meta.len = transport_meta.len;
- quinn_meta.stride = transport_meta.stride;
- quinn_meta.ecn = transport_meta.ecn;
} else {
// If all datagrams in this buf are DISCO or STUN, set len to zero to make
// Quinn skip the buf completely.
diff --git a/pr/3279/docs/src/iroh/magicsock/transports.rs.html b/pr/3279/docs/src/iroh/magicsock/transports.rs.html
index 6a222cd359..a83429350a 100644
--- a/pr/3279/docs/src/iroh/magicsock/transports.rs.html
+++ b/pr/3279/docs/src/iroh/magicsock/transports.rs.html
@@ -394,21 +394,7 @@
393
394
395
-396
-397
-398
-399
-400
-401
-402
-403
-404
-405
-406
-407
-408
-409
-410
use std::{
+396
use std::{
io::{self, IoSliceMut},
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6},
pin::Pin,
@@ -500,14 +486,15 @@
&self,
cx: &mut Context,
bufs: &mut [IoSliceMut<'_>],
- metas: &mut [RecvMeta],
+ metas: &mut [quinn_udp::RecvMeta],
+ source_addrs: &mut [Addr],
) -> Poll<io::Result<usize>> {
debug_assert_eq!(bufs.len(), metas.len(), "non matching bufs & metas");
// TODO: randomization
macro_rules! poll_transport {
($socket:expr) => {
- match $socket.poll_recv(cx, bufs, metas)? {
+ match $socket.poll_recv(cx, bufs, metas, source_addrs)? {
Poll::Pending | Poll::Ready(0) => {}
Poll::Ready(n) => {
return Poll::Ready(Ok(n));
@@ -703,27 +690,6 @@
pub src_ip: Option<Addr>,
}
-#[derive(Debug, Clone)]
-pub struct RecvMeta {
- pub addr: Addr,
- pub len: usize,
- pub stride: usize,
- pub ecn: Option<quinn_udp::EcnCodepoint>,
- pub dst_ip: Option<Addr>,
-}
-
-impl Default for RecvMeta {
- fn default() -> Self {
- Self {
- addr: SocketAddr::new(Ipv6Addr::UNSPECIFIED.into(), 0).into(),
- len: 0,
- stride: 0,
- ecn: None,
- dst_ip: None,
- }
- }
-}
-
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Addr {
Ipv4(Ipv4Addr, Option<u16>),
@@ -731,6 +697,12 @@
RelayUrl(RelayUrl, NodeId),
}
+impl Default for Addr {
+ fn default() -> Self {
+ Self::Ipv6(Ipv6Addr::UNSPECIFIED, None)
+ }
+}
+
impl From<IpAddr> for Addr {
fn from(value: IpAddr) -> Self {
match value {
diff --git a/pr/3279/docs/src/iroh/magicsock/transports/ip.rs.html b/pr/3279/docs/src/iroh/magicsock/transports/ip.rs.html
index 0814eeba2f..06b24dfd73 100644
--- a/pr/3279/docs/src/iroh/magicsock/transports/ip.rs.html
+++ b/pr/3279/docs/src/iroh/magicsock/transports/ip.rs.html
@@ -142,11 +142,7 @@
141
142
143
-144
-145
-146
-147
-148
use std::{
+144
use std::{
io,
net::SocketAddr,
pin::Pin,
@@ -158,7 +154,7 @@
use quinn::AsyncUdpSocket;
use tracing::trace;
-use super::{RecvMeta, Transmit};
+use super::{Addr, Transmit};
use crate::{
magicsock::UdpConn,
watchable::{Watchable, Watcher},
@@ -222,22 +218,18 @@
&self,
cx: &mut Context,
bufs: &mut [io::IoSliceMut<'_>],
- metas: &mut [RecvMeta],
+ metas: &mut [quinn_udp::RecvMeta],
+ source_addrs: &mut [Addr],
) -> Poll<io::Result<usize>> {
- // TODO: figure out how to optimize this
- let mut quinn_metas = vec![quinn_udp::RecvMeta::default(); metas.len()];
- match self.socket.poll_recv(cx, bufs, &mut quinn_metas) {
+ match self.socket.poll_recv(cx, bufs, metas) {
Poll::Pending => Poll::Pending,
- Poll::Ready(res) => {
- for (quinn_meta, meta) in quinn_metas.into_iter().zip(metas.iter_mut()) {
- meta.addr = quinn_meta.addr.into();
- meta.len = quinn_meta.len;
- meta.stride = quinn_meta.stride;
- meta.ecn = quinn_meta.ecn;
- meta.dst_ip = quinn_meta.dst_ip.map(Into::into);
+ Poll::Ready(Ok(n)) => {
+ for (addr, el) in source_addrs.iter_mut().zip(metas.iter()).take(n) {
+ *addr = el.addr.into();
}
- Poll::Ready(res)
+ Poll::Ready(Ok(n))
}
+ Poll::Ready(Err(err)) => Poll::Ready(Err(err)),
}
}
diff --git a/pr/3279/docs/src/iroh/magicsock/transports/relay.rs.html b/pr/3279/docs/src/iroh/magicsock/transports/relay.rs.html
index 2d2c68791d..87dc665e19 100644
--- a/pr/3279/docs/src/iroh/magicsock/transports/relay.rs.html
+++ b/pr/3279/docs/src/iroh/magicsock/transports/relay.rs.html
@@ -475,7 +475,11 @@
474
475
476
-477
use std::{
+477
+478
+479
+480
+481
use std::{
io,
pin::Pin,
sync::Arc,
@@ -492,7 +496,7 @@
use tokio::sync::mpsc;
use tracing::{error, info_span, trace, warn, Instrument};
-use super::{RecvMeta, Transmit};
+use super::{Addr, Transmit};
use crate::{
magicsock::RelayContents,
watchable::{Watchable, Watcher as _},
@@ -607,10 +611,15 @@
&self,
cx: &mut Context,
bufs: &mut [io::IoSliceMut<'_>],
- metas: &mut [RecvMeta],
+ metas: &mut [quinn_udp::RecvMeta],
+ source_addrs: &mut [Addr],
) -> Poll<io::Result<usize>> {
let mut num_msgs = 0;
- 'outer: for (buf_out, meta_out) in bufs.iter_mut().zip(metas.iter_mut()) {
+ 'outer: for ((buf_out, meta_out), addr) in bufs
+ .iter_mut()
+ .zip(metas.iter_mut())
+ .zip(source_addrs.iter_mut())
+ {
let dm = match self.relay_datagram_recv_queue.poll_recv(cx) {
Poll::Ready(Ok(recv)) => recv,
Poll::Ready(Err(err)) => {
@@ -626,13 +635,12 @@
};
buf_out[..dm.buf.len()].copy_from_slice(&dm.buf);
- *meta_out = RecvMeta {
- len: dm.buf.len(),
- stride: dm.buf.len(),
- addr: (dm.url, dm.src).into(),
- ecn: None,
- dst_ip: None, // TODO: insert the relay url for this relay
- };
+ meta_out.len = dm.buf.len();
+ meta_out.stride = dm.buf.len();
+ meta_out.ecn = None;
+ meta_out.dst_ip = None; // TODO: insert the relay url for this relay
+
+ *addr = (dm.url, dm.src).into();
num_msgs += 1;
}
diff --git a/pr/3279/docs/src/iroh_dns_server/store.rs.html b/pr/3279/docs/src/iroh_dns_server/store.rs.html
index 43a200b9f9..3e06704859 100644
--- a/pr/3279/docs/src/iroh_dns_server/store.rs.html
+++ b/pr/3279/docs/src/iroh_dns_server/store.rs.html
@@ -267,7 +267,30 @@
266
267
268
-269
//! Pkarr packet store used to resolve DNS queries.
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
//! Pkarr packet store used to resolve DNS queries.
use std::{collections::BTreeMap, num::NonZeroUsize, path::Path, sync::Arc, time::Duration};
@@ -276,7 +299,7 @@
use lru::LruCache;
use pkarr::{Client as PkarrClient, SignedPacket};
use tokio::sync::Mutex;
-use tracing::{debug, trace};
+use tracing::{debug, trace, warn};
use ttl_cache::TtlCache;
use self::signed_packets::SignedPacketStore;
@@ -361,24 +384,46 @@
}
/// Resolve a DNS query.
- #[allow(clippy::unused_async)]
+ #[tracing::instrument("resolve", skip_all, fields(pubkey=%pubkey,name=%name,typ=%record_type))]
pub async fn resolve(
&self,
pubkey: &PublicKeyBytes,
name: &Name,
record_type: RecordType,
) -> Result<Option<Arc<RecordSet>>> {
- tracing::info!("{} {}", name, record_type);
+ trace!("store resolve");
if let Some(rset) = self.cache.lock().await.resolve(pubkey, name, record_type) {
+ debug!(
+ len = rset.records_without_rrsigs().count(),
+ "resolved from cache"
+ );
return Ok(Some(rset));
}
if let Some(packet) = self.store.get(pubkey).await? {
- return self
+ trace!(packet_timestamp = ?packet.timestamp(), "store hit");
+ return match self
.cache
.lock()
.await
- .insert_and_resolve(&packet, name, record_type);
+ .insert_and_resolve(&packet, name, record_type)
+ {
+ Ok(Some(rset)) => {
+ debug!(
+ len = rset.records_without_rrsigs().count(),
+ "resolved from store"
+ );
+ Ok(Some(rset))
+ }
+ Ok(None) => {
+ debug!("resolved to zone, but no matching records in zone");
+ Ok(None)
+ }
+ Err(err) => {
+ warn!("failed to retrieve zone after inserting in cache: {err:#?}");
+ Err(err)
+ }
+ };
};
if let Some(pkarr) = self.pkarr.as_ref() {
@@ -495,11 +540,14 @@
.map(|old| old.is_newer_than(signed_packet))
.unwrap_or(false)
{
- return Ok(());
+ trace!("insert skip: cached is newer");
+ Ok(())
+ } else {
+ self.cache
+ .put(pubkey, CachedZone::from_signed_packet(signed_packet)?);
+ trace!("inserted into cache");
+ Ok(())
}
- self.cache
- .put(pubkey, CachedZone::from_signed_packet(signed_packet)?);
- Ok(())
}
fn remove(&mut self, pubkey: &PublicKeyBytes) {
@@ -529,10 +577,8 @@
}
fn resolve(&self, name: &Name, record_type: RecordType) -> Option<Arc<RecordSet>> {
+ trace!(name=%name, typ=%record_type, "resolve in zone");
let key = RrKey::new(name.into(), record_type);
- for record in self.records.keys() {
- tracing::info!("record {:?}", record);
- }
self.records.get(&key).cloned()
}
}
diff --git a/pr/3279/docs/src/iroh_dns_server/store/signed_packets.rs.html b/pr/3279/docs/src/iroh_dns_server/store/signed_packets.rs.html
index bf63d737fa..e72a6e8016 100644
--- a/pr/3279/docs/src/iroh_dns_server/store/signed_packets.rs.html
+++ b/pr/3279/docs/src/iroh_dns_server/store/signed_packets.rs.html
@@ -459,7 +459,48 @@
458
459
460
-461
use std::{future::Future, path::Path, result, sync::Arc, time::Duration};
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
use std::{
+ future::Future,
+ path::Path,
+ result,
+ sync::Arc,
+ time::{Duration, SystemTime},
+};
use anyhow::{Context, Result};
use pkarr::{SignedPacket, Timestamp};
@@ -468,7 +509,7 @@
};
use tokio::sync::{mpsc, oneshot};
use tokio_util::sync::CancellationToken;
-use tracing::{debug, error, info, trace};
+use tracing::{debug, error, info, trace, warn};
use crate::{metrics::Metrics, util::PublicKeyBytes};
@@ -513,7 +554,7 @@
res: oneshot::Sender<Snapshot>,
},
CheckExpired {
- time: [u8; 8],
+ time: Timestamp,
key: PublicKeyBytes,
},
}
@@ -580,7 +621,6 @@
let transaction = self.db.begin_write()?;
let mut tables = Tables::new(&transaction)?;
let timeout = tokio::time::sleep(self.options.max_batch_time);
- let expired = Timestamp::now() - expiry_us;
tokio::pin!(timeout);
for _ in 0..self.options.max_batch_size {
tokio::select! {
@@ -593,9 +633,16 @@
Some(msg) = self.recv.recv() => {
match msg {
Message::Get { key, res } => {
- trace!("get {}", key);
- let packet = get_packet(&tables.signed_packets, &key).context("get packet failed")?;
- res.send(packet).ok();
+ match get_packet(&tables.signed_packets, &key) {
+ Ok(packet) => {
+ trace!("get {key}: {}", packet.is_some());
+ res.send(packet).ok();
+ },
+ Err(err) => {
+ warn!("get {key} failed: {err:#}");
+ return Err(err).with_context(|| format!("get packet for {key} failed"))
+ }
+ }
}
Message::Upsert { packet, res } => {
let key = PublicKeyBytes::from_signed_packet(&packet);
@@ -605,8 +652,8 @@
res.send(false).ok();
continue;
} else {
- // remove the packet from the update time index
- tables.update_time.remove(&packet.timestamp().to_bytes(), key.as_bytes())?;
+ // remove the old packet from the update time index
+ tables.update_time.remove(&existing.timestamp().to_bytes(), key.as_bytes())?;
true
}
} else {
@@ -639,13 +686,21 @@
res.send(Snapshot::new(&self.db)?).ok();
}
Message::CheckExpired { key, time } => {
- trace!("check expired {} at {}", key, u64::from_be_bytes(time));
+ trace!("check expired {} at {}", key, fmt_time(time));
if let Some(packet) = get_packet(&tables.signed_packets, &key)? {
+ let expired = Timestamp::now() - expiry_us;
if packet.timestamp() < expired {
- tables.update_time.remove(&time, key.as_bytes())?;
+ tables.update_time.remove(&time.to_bytes(), key.as_bytes())?;
let _ = tables.signed_packets.remove(key.as_bytes())?;
self.metrics.store_packets_expired.inc();
+ debug!("removed expired packet {key}");
+ } else {
+ debug!("packet {key} is no longer expired, removing obsolete expiry entry");
+ tables.update_time.remove(&time.to_bytes(), key.as_bytes())?;
}
+ } else {
+ debug!("expired packet {key} not found, remove from expiry table");
+ tables.update_time.remove(&time.to_bytes(), key.as_bytes())?;
}
}
}
@@ -659,6 +714,10 @@
}
}
+fn fmt_time(t: Timestamp) -> String {
+ humantime::format_rfc3339_micros(SystemTime::from(t)).to_string()
+}
+
/// A struct similar to [`redb::Table`] but for all tables that make up the
/// signed packet store.
pub(super) struct Tables<'a> {
@@ -778,8 +837,23 @@
let Some(row) = table.get(key.as_ref()).context("database fetch failed")? else {
return Ok(None);
};
- let packet = SignedPacket::deserialize(row.value()).context("parsing signed packet failed")?;
- Ok(Some(packet))
+ match SignedPacket::deserialize(row.value()) {
+ Ok(packet) => Ok(Some(packet)),
+ Err(err) => {
+ // Prior to iroh-dns-server v0.35, we stored packets in the default `SignedPacket::as_bytes` serialization from pkarr v2,
+ // which did not include the `last_seen` timestamp added as a prefix in `SignedPacket::serialize` from pkarr v3.
+ // If decoding the packet as a serialized pkarr v3 packet fails, we assume it was stored with iroh-dns-server before v0.35,
+ // and prepend an empty timestamp.
+ let data = row.value();
+ let mut buf = Vec::with_capacity(data.len() + 8);
+ buf.extend(&[0u8; 8]);
+ buf.extend(data);
+ match SignedPacket::deserialize(&buf) {
+ Ok(packet) => Ok(Some(packet)),
+ Err(err2) => Err(anyhow::anyhow!("Failed to decode as pkarr v3: {err:#}. Also failed to decode as pkarr v2: {err2:#}"))
+ }
+ }
+ }
}
async fn evict_task(send: mpsc::Sender<Message>, options: Options, cancel: CancellationToken) {
@@ -807,7 +881,7 @@
anyhow::bail!("failed to get snapshot");
};
let expired = Timestamp::now() - expiry_us;
- trace!("evicting packets older than {}", expired);
+ trace!("evicting packets older than {}", fmt_time(expired));
// if getting the range fails we exit the loop and shut down
// if individual reads fail we log the error and limp on
for item in snapshot.update_time.range(..expired.to_bytes())? {
@@ -818,26 +892,22 @@
continue;
}
};
- let time = time.value();
- trace!("evicting expired packets at {}", u64::from_be_bytes(time));
+ let time = Timestamp::from(time.value());
+ trace!("evicting expired packets at {}", fmt_time(time));
for item in keys {
let key = match item {
Ok(v) => v,
Err(e) => {
error!(
"failed to read update_time item at {}: {:?}",
- u64::from_be_bytes(time),
+ fmt_time(time),
e
);
continue;
}
};
let key = PublicKeyBytes::new(key.value());
- debug!(
- "evicting expired packet {} {}",
- u64::from_be_bytes(time),
- key
- );
+ debug!("evicting expired packet {} {}", fmt_time(time), key);
send.send(Message::CheckExpired { time, key }).await?;
}
}
diff --git a/pr/3279/docs/trait.impl/core/convert/trait.From.js b/pr/3279/docs/trait.impl/core/convert/trait.From.js
index 3c3eda16f7..f782f797c3 100644
--- a/pr/3279/docs/trait.impl/core/convert/trait.From.js
+++ b/pr/3279/docs/trait.impl/core/convert/trait.From.js
@@ -1,9 +1,9 @@
(function() {
- var implementors = Object.fromEntries([["iroh",[["impl From<DiscoveryItem> for NodeInfo"],["impl From<RemoteInfo> for NodeAddr"],["impl<T> From<T> for ConcurrentDiscovery"]]],["iroh_base",[["impl From<(PublicKey, Option<RelayUrl>, &[SocketAddr])> for NodeAddr"],["impl From<ParseError> for RelayUrlParseError"],["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 Error"],["impl From<Error> for KeyParsingError"],["impl From<Error> for Error"],["impl From<SigningKey> for SecretKey"],["impl From<VerifyingKey> for PublicKey"],["impl From<[u8; 32]> for SecretKey"]]],["iroh_relay",[["impl From<Error> for ConnSendError"],["impl From<NodeInfo> for NodeAddr"],["impl From<RelayNode> for RelayMap"],["impl From<Error> for ConnSendError"],["impl From<NodeAddr> for NodeData"],["impl From<NodeAddr> for NodeInfo"],["impl From<RelayUrl> for RelayMap"],["impl From<RelayUrl> for RelayNode"],["impl From<Resolver<GenericConnector<TokioRuntimeProvider>>> for DnsResolver"],["impl From<TxtLookup> for TxtLookup"]]]]);
+ var implementors = Object.fromEntries([["iroh",[["impl From<DiscoveryItem> for NodeInfo"],["impl From<RemoteInfo> for NodeAddr"],["impl<T> From<T> for ConcurrentDiscovery"]]],["iroh_base",[["impl From<(PublicKey, Option<RelayUrl>, &[SocketAddr])> for NodeAddr"],["impl From<ParseError> for RelayUrlParseError"],["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 Error"],["impl From<Error> for KeyParsingError"],["impl From<Error> for Error"],["impl From<SigningKey> for SecretKey"],["impl From<VerifyingKey> for PublicKey"],["impl From<[u8; 32]> for SecretKey"]]],["iroh_relay",[["impl From<Error> for ConnSendError"],["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<Error> for ConnSendError"],["impl From<Resolver<GenericConnector<TokioRuntimeProvider>>> for DnsResolver"],["impl From<TxtLookup> for TxtLookup"]]]]);
if (window.register_implementors) {
window.register_implementors(implementors);
} else {
window.pending_implementors = implementors;
}
})()
-//{"start":57,"fragment_lengths":[1632,5343,3221]}
\ No newline at end of file
+//{"start":57,"fragment_lengths":[1632,5343,3831]}
\ No newline at end of file
diff --git a/pr/3279/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js b/pr/3279/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js
index d104c409e3..8cd585bc9e 100644
--- a/pr/3279/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js
+++ b/pr/3279/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js
@@ -1,9 +1,9 @@
(function() {
- var implementors = Object.fromEntries([["iroh_relay",[["impl FromIterator<RelayNode> for RelayMap"],["impl FromIterator<RelayUrl> for RelayMap"]]]]);
+ var implementors = Object.fromEntries([["iroh_relay",[["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":[776]}
\ No newline at end of file
+//{"start":57,"fragment_lengths":[898]}
\ No newline at end of file
pub struct DirectAddr {
+DirectAddr in iroh::endpoint - Rust pub struct DirectAddr {
pub addr: SocketAddr,
pub typ: DirectAddrType,
}
Expand description
A direct address on which an iroh-node might be contactable.
@@ -7,16 +7,16 @@ contacted. These can come from various sources depending on the network topolog
iroh node, see DirectAddrType for the several kinds of sources.
Fields§
§addr: SocketAddrThe address.
§typ: DirectAddrTypeThe origin of this direct address.
-Trait Implementations§
Source§impl Clone for DirectAddr
Source§fn clone(&self) -> DirectAddr
Returns a copy of the value. Read more1.0.0 · Source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read moreSource§impl Debug for DirectAddr
Source§impl Hash for DirectAddr
1.3.0 · Source§fn hash_slice<H>(data: &[Self], state: &mut H)where
+Trait Implementations§
Source§impl Clone for DirectAddr
Source§fn clone(&self) -> DirectAddr
Returns a copy of the value. Read more1.0.0 · Source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read moreSource§impl Debug for DirectAddr
Source§impl Hash for DirectAddr
Source§impl Ord for DirectAddr
Source§impl Ord for DirectAddr
Source§fn cmp(&self, other: &DirectAddr) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read moreSource§impl PartialEq for DirectAddr
Source§impl PartialOrd for DirectAddr
Source§impl PartialEq for DirectAddr
Source§impl PartialOrd for DirectAddr
Source§impl Eq for DirectAddr
Source§impl StructuralPartialEq for DirectAddr
Auto Trait Implementations§
§impl Freeze for DirectAddr
§impl RefUnwindSafe for DirectAddr
§impl Send for DirectAddr
§impl Sync for DirectAddr
§impl Unpin for DirectAddr
§impl UnwindSafe for DirectAddr
Blanket Implementations§
Source§impl Eq for DirectAddr
Source§impl StructuralPartialEq for DirectAddr
Auto Trait Implementations§
§impl Freeze for DirectAddr
§impl RefUnwindSafe for DirectAddr
§impl Send for DirectAddr
§impl Sync for DirectAddr
§impl Unpin for DirectAddr
§impl UnwindSafe for DirectAddr
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§fn implicit(
diff --git a/pr/3279/docs/iroh_dns_server/struct.ZoneStore.html b/pr/3279/docs/iroh_dns_server/struct.ZoneStore.html
index f4933c29e4..4eedd7f167 100644
--- a/pr/3279/docs/iroh_dns_server/struct.ZoneStore.html
+++ b/pr/3279/docs/iroh_dns_server/struct.ZoneStore.html
@@ -1,7 +1,7 @@
ZoneStore in iroh_dns_server - Rust pub struct ZoneStore { /* private fields */ }
Expand description
A store for pkarr signed packets.
Packets are stored in the persistent SignedPacketStore, and cached on-demand in an in-memory LRU
cache used for resolving DNS queries.
-Implementations§
Source§impl ZoneStore
Sourcepub fn persistent(
+
Implementations§
Sourcepub async fn resolve(
&self,
pubkey: &PublicKeyBytes,
name: &Name,
record_type: RecordType,
) -> Result<Option<Arc<RecordSet>>>
Resolve a DNS query.
-Sourcepub async fn get_signed_packet(
+
Sourcepub async fn get_signed_packet(
&self,
pubkey: &PublicKeyBytes,
) -> Result<Option<SignedPacket>>
Get the latest signed packet for a pubkey.
-Sourcepub async fn insert(
&self,
signed_packet: SignedPacket,
_source: PacketSource,
diff --git a/pr/3279/docs/iroh_relay/client/enum.ReceivedMessage.html b/pr/3279/docs/iroh_relay/client/enum.ReceivedMessage.html
index 535193a6c8..d612779969 100644
--- a/pr/3279/docs/iroh_relay/client/enum.ReceivedMessage.html
+++ b/pr/3279/docs/iroh_relay/client/enum.ReceivedMessage.html
@@ -1,9 +1,9 @@
ReceivedMessage in iroh_relay::client - Rust pub enum ReceivedMessage {
ReceivedPacket {
- remote_node_id: NodeId,
+ remote_node_id: NodeId,
data: Bytes,
},
- NodeGone(NodeId),
+ NodeGone(NodeId),
Ping([u8; 8]),
Pong([u8; 8]),
KeepAlive,
@@ -17,9 +17,9 @@
}
Expand description
The messages received from a framed relay stream.
This is a type-validated version of the Frames on the RelayCodec.
Variants§
§ReceivedPacket
Represents an incoming packet.
-Fields
§NodeGone(NodeId)
Indicates that the client identified by the underlying public key had previously sent you a
packet but has now disconnected from the server.
§Ping([u8; 8])
Request from a client or server to reply to the
other side with a ReceivedMessage::Pong with the given payload.
diff --git a/pr/3279/docs/iroh_relay/client/enum.SendMessage.html b/pr/3279/docs/iroh_relay/client/enum.SendMessage.html
index 55d5cca41d..cf87651734 100644
--- a/pr/3279/docs/iroh_relay/client/enum.SendMessage.html
+++ b/pr/3279/docs/iroh_relay/client/enum.SendMessage.html
@@ -1,9 +1,9 @@
SendMessage in iroh_relay::client - Rust pub enum SendMessage {
- SendPacket(NodeId, Bytes),
+ SendPacket(NodeId, Bytes),
Ping([u8; 8]),
Pong([u8; 8]),
}
Expand description
Messages we can send to a relay server.
-Variants§
§SendPacket(NodeId, Bytes)
Send a packet of data to the [NodeId].
+Variants§
§SendPacket(NodeId, Bytes)
Send a packet of data to the NodeId.
§Ping([u8; 8])
Sends a ping message to the connected relay server.
§Pong([u8; 8])
Sends a pong message to the connected relay server.
Trait Implementations§
Source§impl Debug for SendMessage
Source§impl Sink<SendMessage> for Client
Source§type Error = ConnSendError
The type of value produced by the sink when an error occurs.Source§fn poll_ready(
diff --git a/pr/3279/docs/iroh_relay/client/struct.ClientBuilder.html b/pr/3279/docs/iroh_relay/client/struct.ClientBuilder.html
index 22ed2c5e40..4f94efe715 100644
--- a/pr/3279/docs/iroh_relay/client/struct.ClientBuilder.html
+++ b/pr/3279/docs/iroh_relay/client/struct.ClientBuilder.html
@@ -1,7 +1,7 @@
ClientBuilder in iroh_relay::client - Rust pub struct ClientBuilder { /* private fields */ }
Expand description
Build a Client.
Implementations§
Source§impl ClientBuilder
Sourcepub fn new(
- url: impl Into<RelayUrl>,
- secret_key: SecretKey,
+ url: impl Into<RelayUrl>,
+ secret_key: SecretKey,
dns_resolver: DnsResolver,
) -> Self
Create a new ClientBuilder
Sourcepub fn protocol(self, protocol: Protocol) -> Self
Sets whether to connect to the relay via websockets or not.
diff --git a/pr/3279/docs/iroh_relay/dns/struct.DnsResolver.html b/pr/3279/docs/iroh_relay/dns/struct.DnsResolver.html
index ea537effea..7c5a185de6 100644
--- a/pr/3279/docs/iroh_relay/dns/struct.DnsResolver.html
+++ b/pr/3279/docs/iroh_relay/dns/struct.DnsResolver.html
@@ -67,9 +67,9 @@ at T+0ms, T+200ms and T+300ms. The timeout is applied as stated in
summary of all errors otherwise.
Sourcepub async fn lookup_node_by_id(
&self,
- node_id: &NodeId,
+ node_id: &NodeId,
origin: &str,
-) -> Result<NodeInfo>
Looks up node info by [NodeId] and origin domain name.
+) -> Result<NodeInfo>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.
Sourcepub async fn lookup_node_by_domain_name(&self, name: &str) -> Result<NodeInfo>
Looks up node info by DNS name.
@@ -84,10 +84,10 @@ at T+0ms, T+200ms and T+300ms. The result of the first successful call is return
summary of all errors otherwise.
Sourcepub async fn lookup_node_by_id_staggered(
&self,
- node_id: &NodeId,
+ node_id: &NodeId,
origin: &str,
delays_ms: &[u64],
-) -> Result<NodeInfo>
Looks up node info by [NodeId] and origin domain name.
+) -> Result<NodeInfo>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/3279/docs/iroh_relay/index.html b/pr/3279/docs/iroh_relay/index.html
index aa17a382d4..b45ccff8c4 100644
--- a/pr/3279/docs/iroh_relay/index.html
+++ b/pr/3279/docs/iroh_relay/index.html
@@ -25,6 +25,6 @@ Tailscale.
STUN support and expose metrics.
-Re-exports§
pub use protos::relay::MAX_PACKET_SIZE;
Modules§
- Exposes
Client, which allows to establish connections to a relay server. - Default values used in the relay.
- dns
Non-wasm_browser DNS resolver - HTTP-specific constants for the relay server and client.
- Support for handling DNS resource records for dialing by [
NodeId]. - Protocols used by the iroh-relay
- Create a QUIC server that accepts connections
+
Re-exports§
pub use protos::relay::MAX_PACKET_SIZE;
Modules§
- Exposes
Client, which allows to establish connections to a relay server. - Default values used in the relay.
- dns
Non-wasm_browser DNS resolver - HTTP-specific constants for the relay server and client.
- Support for handling DNS resource records for dialing by
NodeId. - Protocols used by the iroh-relay
- Create a QUIC server that accepts connections
for QUIC address discovery.
- server
server A fully-fledged iroh-relay server over HTTP or HTTPS.
Structs§
- Tracks pings on a single relay connection.
- Configuration of all the relay servers that can be used.
- Information on a specific relay server.
- 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/3279/docs/iroh_relay/node_info/index.html b/pr/3279/docs/iroh_relay/node_info/index.html
index daa1aa3c65..e55baaed6c 100644
--- a/pr/3279/docs/iroh_relay/node_info/index.html
+++ b/pr/3279/docs/iroh_relay/node_info/index.html
@@ -1,5 +1,5 @@
-iroh_relay::node_info - Rust 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 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].
+
<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:
- Structs§
- Error returned when an input value is too long for
UserData. - Data about a node that may be published to and resolved from discovery services.
- Information about a node that may be published to and resolved from discovery services.
- Under the hood this is a UTF-8 String is no longer than
UserData::MAX_LENGTH bytes.
Constants§
- The DNS name for the iroh TXT record.
Traits§
- Extension methods for [
NodeId] to encode to and decode from [z32],
+Structs§
- Error returned when an input value is too long for
UserData. - Data about a node that may be published to and resolved from discovery services.
- Information about a node that may be published to and resolved from discovery services.
- Under the hood this is a UTF-8 String is no longer than
UserData::MAX_LENGTH bytes.
Constants§
- The DNS name for the iroh TXT record.
Traits§
- 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/3279/docs/iroh_relay/node_info/struct.NodeData.html b/pr/3279/docs/iroh_relay/node_info/struct.NodeData.html
index f4a1f6e4b0..4a3e6db1c8 100644
--- a/pr/3279/docs/iroh_relay/node_info/struct.NodeData.html
+++ b/pr/3279/docs/iroh_relay/node_info/struct.NodeData.html
@@ -1,20 +1,20 @@
NodeData in iroh_relay::node_info - Rust 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
Sourcepub 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.
-Sourcepub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self
Sets the relay URL and returns the updated node data.
+Sourcepub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self
Sets the relay URL and returns the updated node data.
Sourcepub fn with_direct_addresses(
self,
direct_addresses: BTreeSet<SocketAddr>,
) -> Self
Sets the direct addresses and returns the updated node data.
Sourcepub fn with_user_data(self, user_data: Option<UserData>) -> Self
Sets the user-defined data and returns the updated node data.
-Sourcepub fn user_data(&self) -> Option<&UserData>
Returns the optional user-defined data of the node.
Sourcepub fn direct_addresses(&self) -> &BTreeSet<SocketAddr>
Returns the direct addresses of the node.
Sourcepub 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.
-Sourcepub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)
Sets the relay URL of the node data.
+Sourcepub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)
Sets the relay URL of the node data.
Sourcepub fn set_user_data(&mut self, user_data: Option<UserData>)
Sets the user-defined data of the node data.
-Trait Implementations§
Trait Implementations§
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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
diff --git a/pr/3279/docs/iroh_relay/node_info/struct.NodeInfo.html b/pr/3279/docs/iroh_relay/node_info/struct.NodeInfo.html
index cd66ba54e3..dde190c92b 100644
--- a/pr/3279/docs/iroh_relay/node_info/struct.NodeInfo.html
+++ b/pr/3279/docs/iroh_relay/node_info/struct.NodeInfo.html
@@ -1,30 +1,30 @@
NodeInfo in iroh_relay::node_info - Rust 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: NodeIdThe [NodeId] of the node this is about.
+
+Fields§
§node_id: NodeIdThe NodeId of the node this is about.
§data: NodeDataThe information published about the node.
-Implementations§
Source§impl NodeInfo
Sourcepub fn from_parts(node_id: NodeId, data: NodeData) -> Self
Creates a new NodeInfo from its parts.
-Sourcepub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self
Sets the relay URL and returns the updated node info.
+Implementations§
Source§impl NodeInfo
Sourcepub fn from_parts(node_id: NodeId, data: NodeData) -> Self
Creates a new NodeInfo from its parts.
+Sourcepub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self
Sets the relay URL and returns the updated node info.
Sourcepub fn with_direct_addresses(
self,
direct_addresses: BTreeSet<SocketAddr>,
) -> Self
Sets the direct addresses and returns the updated node info.
Sourcepub fn with_user_data(self, user_data: Option<UserData>) -> Self
Sets the user-defined data and returns the updated node info.
-Sourcepub fn to_node_addr(&self) -> NodeAddr
Converts into a [NodeAddr] by cloning the needed fields.
-Sourcepub fn into_node_addr(self) -> NodeAddr
Converts into a [NodeAddr] without cloning.
+Sourcepub fn to_node_addr(&self) -> NodeAddr
Converts into a NodeAddr by cloning the needed fields.
+Sourcepub fn into_node_addr(self) -> NodeAddr
Converts into a NodeAddr without cloning.
Sourcepub fn from_txt_lookup(lookup: TxtLookup) -> Result<Self>
Available on non-wasm_browser only.
Parses a NodeInfo from a TXT records lookup.
Sourcepub fn from_pkarr_signed_packet(packet: &SignedPacket) -> Result<Self>
Parses a NodeInfo from a [pkarr::SignedPacket].
Sourcepub fn to_pkarr_signed_packet(
&self,
- secret_key: &SecretKey,
+ secret_key: &SecretKey,
ttl: u32,
) -> Result<SignedPacket>
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.
Sourcepub fn to_txt_strings(&self) -> Vec<String>
Converts into a list of {key}={value} strings.
-Methods from Deref<Target = NodeData>§
Sourcepub fn user_data(&self) -> Option<&UserData>
Returns the optional user-defined data of the node.
Sourcepub fn direct_addresses(&self) -> &BTreeSet<SocketAddr>
Returns the direct addresses of the node.
Sourcepub fn clear_direct_addresses(&mut self)
Removes all direct addresses from the node data.
@@ -32,9 +32,9 @@
&mut self,
addrs: impl IntoIterator<Item = SocketAddr>,
)Adds direct addresses to the node data.
-Sourcepub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)
Sets the relay URL of the node data.
+Sourcepub fn set_relay_url(&mut self, relay_url: Option<RelayUrl>)
Sets the relay URL of the node data.
Sourcepub fn set_user_data(&mut self, user_data: Option<UserData>)
Sets the user-defined data of the node data.
-Trait Implementations§
Trait Implementations§
Source§impl Eq for NodeInfo
Source§impl StructuralPartialEq for NodeInfo
Auto Trait Implementations§
§impl Freeze for NodeInfo
§impl RefUnwindSafe for NodeInfo
§impl Send for NodeInfo
§impl Sync for NodeInfo
§impl Unpin for NodeInfo
§impl UnwindSafe for NodeInfo
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
diff --git a/pr/3279/docs/iroh_relay/node_info/trait.NodeIdExt.html b/pr/3279/docs/iroh_relay/node_info/trait.NodeIdExt.html
index 34aab0c4d8..566dc7dfdc 100644
--- a/pr/3279/docs/iroh_relay/node_info/trait.NodeIdExt.html
+++ b/pr/3279/docs/iroh_relay/node_info/trait.NodeIdExt.html
@@ -1,9 +1,9 @@
NodeIdExt in iroh_relay::node_info - Rust pub trait NodeIdExt {
// Required methods
fn to_z32(&self) -> String;
- fn from_z32(s: &str) -> Result<NodeId>;
-}
Expand description
Extension methods for [NodeId] to encode to and decode from [z32],
+ fn from_z32(s: &str) -> Result<NodeId>;
+}Expand description
Extension methods for NodeId to encode to and decode from [z32],
which is the encoding used in [pkarr] domain names.
-
Required Methods§
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§
Implementors§
\ No newline at end of file
+Required Methods§
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§
Implementors§
\ No newline at end of file
diff --git a/pr/3279/docs/iroh_relay/server/enum.AccessConfig.html b/pr/3279/docs/iroh_relay/server/enum.AccessConfig.html
index e563e92169..1d6fd8c443 100644
--- a/pr/3279/docs/iroh_relay/server/enum.AccessConfig.html
+++ b/pr/3279/docs/iroh_relay/server/enum.AccessConfig.html
@@ -1,10 +1,10 @@
AccessConfig in iroh_relay::server - Rust 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
Implementations§
Source§impl AccessConfig
Sourcepub async fn is_allowed(&self, node: NodeId) -> bool
Is this node allowed?
Trait Implementations§
Auto Trait Implementations§
§impl Freeze for AccessConfig
§impl !RefUnwindSafe for AccessConfig
§impl Send for AccessConfig
§impl Sync for AccessConfig
§impl Unpin for AccessConfig
§impl !UnwindSafe for AccessConfig
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
diff --git a/pr/3279/docs/iroh_relay/server/struct.Server.html b/pr/3279/docs/iroh_relay/server/struct.Server.html
index ef4cf17208..540113411b 100644
--- a/pr/3279/docs/iroh_relay/server/struct.Server.html
+++ b/pr/3279/docs/iroh_relay/server/struct.Server.html
@@ -14,9 +14,9 @@ case there is an error in the server before it is shut down.
Sourcepub fn quic_addr(&self) -> Option<SocketAddr>
The socket address the QUIC server is listening on.
Sourcepub fn stun_addr(&self) -> Option<SocketAddr>
The socket address the STUN server is listening on.
Sourcepub fn certificates(&self) -> Option<Vec<CertificateDer<'static>>>
The certificates chain if configured with manual TLS certificates.
-Sourcepub fn https_url(&self) -> Option<RelayUrl>
Available on crate feature test-utils only.
Get the server’s https [RelayUrl].
+Sourcepub 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.
-Sourcepub fn http_url(&self) -> Option<RelayUrl>
Available on crate feature test-utils only.
Get the server’s http [RelayUrl].
+Sourcepub 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.
Sourcepub fn metrics(&self) -> &RelayMetrics
Returns the metrics collected in the relay server.
Trait Implementations§
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 Twhere
diff --git a/pr/3279/docs/iroh_relay/struct.RelayMap.html b/pr/3279/docs/iroh_relay/struct.RelayMap.html
index f7785d0b26..a92036b6c0 100644
--- a/pr/3279/docs/iroh_relay/struct.RelayMap.html
+++ b/pr/3279/docs/iroh_relay/struct.RelayMap.html
@@ -1,15 +1,15 @@
RelayMap in iroh_relay - Rust pub struct RelayMap { /* private fields */ }
Expand description
Configuration of all the relay servers that can be used.
-Implementations§
Source§impl RelayMap
Implementations§
Trait Implementations§
Trait Implementations§
Source§impl FromIterator<RelayNode> for RelayMap
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§impl FromIterator<RelayUrl> for RelayMap
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/3279/docs/iroh_relay/struct.RelayNode.html b/pr/3279/docs/iroh_relay/struct.RelayNode.html
index 631f66dad8..a1e0bcc76b 100644
--- a/pr/3279/docs/iroh_relay/struct.RelayNode.html
+++ b/pr/3279/docs/iroh_relay/struct.RelayNode.html
@@ -1,11 +1,11 @@
RelayNode in iroh_relay - Rust pub struct RelayNode {
- pub url: RelayUrl,
+ pub url: RelayUrl,
pub stun_only: bool,
pub stun_port: u16,
pub quic: Option<RelayQuicConfig>,
}
Expand description
Information on a specific relay server.
Includes the Url where it can be dialed.
-Fields§
§url: RelayUrlThe [RelayUrl] where this relay server can be dialed.
+Fields§
§url: RelayUrlThe RelayUrl where this relay server can be dialed.
§stun_only: boolWhether this relay server should only be used for STUN requests.
This essentially allows you to use a normal STUN server as a relay node, no relay
functionality is used.
@@ -15,7 +15,7 @@ functionality is used.
When None, we will not attempt to do QUIC address discovery
with this relay server.
Trait Implementations§
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 moreSource§impl FromIterator<RelayNode> for RelayMap
Source§impl FromIterator<RelayNode> for RelayMap
Source§impl Ord for RelayNode
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/3279/docs/src/iroh/discovery/pkarr.rs.html b/pr/3279/docs/src/iroh/discovery/pkarr.rs.html
index ffd78e96aa..76ac2af514 100644
--- a/pr/3279/docs/src/iroh/discovery/pkarr.rs.html
+++ b/pr/3279/docs/src/iroh/discovery/pkarr.rs.html
@@ -402,7 +402,12 @@
401
402
403
-404//! A discovery service which publishes and resolves node information using a [pkarr] relay.
+404
+405
+406
+407
+408
+409
//! A discovery service which publishes and resolves node information using a [pkarr] relay.
//!
//! Public-Key Addressable Resource Records, [pkarr], is a system which allows publishing
//! [DNS Resource Records] owned by a particular [`SecretKey`] under a name derived from its
@@ -796,10 +801,15 @@
.send()
.await?;
- if !response.status().is_success() {
+ let status = response.status();
+ if !status.is_success() {
+ let text = if let Ok(text) = response.text().await {
+ text
+ } else {
+ "(no details provided)".to_string()
+ };
bail!(format!(
- "Publish request failed with status {}",
- response.status()
+ "Publish request failed with status {status}: {text}",
))
}
diff --git a/pr/3279/docs/src/iroh/magicsock.rs.html b/pr/3279/docs/src/iroh/magicsock.rs.html
index f15efd9d87..f21d2e4777 100644
--- a/pr/3279/docs/src/iroh/magicsock.rs.html
+++ b/pr/3279/docs/src/iroh/magicsock.rs.html
@@ -3613,13 +3613,7 @@
3612
3613
3614
-3615
-3616
-3617
-3618
-3619
-3620
-3621
//! Implements a socket that can change its communication path while in use, actively searching for the best way to communicate.
+3615
//! Implements a socket that can change its communication path while in use, actively searching for the best way to communicate.
//!
//! Based on tailscale/wgengine/magicsock
//!
@@ -4229,12 +4223,14 @@
return Poll::Pending;
}
- let mut transport_metas = vec![transports::RecvMeta::default(); metas.len()];
-
- match self.transports.poll_recv(cx, bufs, &mut transport_metas)? {
+ let mut source_addrs = vec![transports::Addr::default(); metas.len()];
+ match self
+ .transports
+ .poll_recv(cx, bufs, metas, &mut source_addrs)?
+ {
Poll::Pending | Poll::Ready(0) => Poll::Pending,
Poll::Ready(n) => {
- self.process_datagrams(&mut bufs[..n], &transport_metas[..n], &mut metas[..n]);
+ self.process_datagrams(&mut bufs[..n], &mut metas[..n], &source_addrs[..n]);
Poll::Ready(Ok(n))
}
}
@@ -4249,14 +4245,9 @@
fn process_datagrams(
&self,
bufs: &mut [io::IoSliceMut<'_>],
- transport_metas: &[transports::RecvMeta],
metas: &mut [quinn_udp::RecvMeta],
+ source_addrs: &[transports::Addr],
) {
- debug_assert_eq!(
- bufs.len(),
- transport_metas.len(),
- "non matching bufs & metas"
- );
debug_assert_eq!(bufs.len(), metas.len(), "non matching bufs & metas");
// Adding the IP address we received something on results in Quinn using this
@@ -4279,25 +4270,25 @@
let mut quic_packets_total = 0;
- for ((transport_meta, quinn_meta), buf) in transport_metas
- .iter()
- .zip(metas.iter_mut())
+ for ((quinn_meta, buf), source_addr) in metas
+ .iter_mut()
.zip(bufs.iter_mut())
+ .zip(source_addrs.iter())
{
let mut buf_contains_quic_datagrams = false;
let mut quic_datagram_count = 0;
- if transport_meta.len > transport_meta.stride {
- trace!(%transport_meta.len, %transport_meta.stride, "GRO datagram received");
+ if quinn_meta.len > quinn_meta.stride {
+ trace!(%quinn_meta.len, %quinn_meta.stride, "GRO datagram received");
self.metrics.magicsock.recv_gro_datagrams.inc();
}
// Chunk through the datagrams in this GRO payload to find disco and stun
// packets and forward them to the actor
- for datagram in buf[..transport_meta.len].chunks_mut(transport_meta.stride) {
- if datagram.len() < transport_meta.stride {
+ for datagram in buf[..quinn_meta.len].chunks_mut(quinn_meta.stride) {
+ if datagram.len() < quinn_meta.stride {
trace!(
len = %datagram.len(),
- %transport_meta.stride,
+ %quinn_meta.stride,
"Last GRO datagram smaller than stride",
);
}
@@ -4306,21 +4297,21 @@
// byte of those packets with zero to make Quinn ignore the packet. This
// relies on quinn::EndpointConfig::grease_quic_bit being set to `false`,
// which we do in Endpoint::bind.
- if transport_meta.addr.is_ip() && stun::is(datagram) {
- trace!(src = ?transport_meta.addr, len = %transport_meta.stride, "UDP recv: stun packet");
+ if source_addr.is_ip() && stun::is(datagram) {
+ trace!(src = ?source_addr, len = %quinn_meta.stride, "UDP recv: stun packet");
let packet2 = Bytes::copy_from_slice(datagram);
self.net_reporter.receive_stun_packet(
packet2,
- transport_meta.addr.clone().try_into().expect("checked"),
+ source_addr.clone().try_into().expect("checked"),
);
datagram[0] = 0u8;
} else if let Some((sender, sealed_box)) = disco::source_and_box(datagram) {
- trace!(src = ?transport_meta.addr, len = %transport_meta.stride, "UDP recv: disco packet");
- self.handle_disco_message(sender, sealed_box, &transport_meta.addr);
+ trace!(src = ?source_addr, len = %quinn_meta.stride, "UDP recv: disco packet");
+ self.handle_disco_message(sender, sealed_box, source_addr);
datagram[0] = 0u8;
} else {
- trace!(src = ?transport_meta.addr, len = %transport_meta.stride, "UDP recv: quic packet");
- match transport_meta.addr {
+ trace!(src = ?source_addr, len = %quinn_meta.stride, "UDP recv: quic packet");
+ match source_addr {
transports::Addr::Ipv4(..) => {
self.metrics
.magicsock
@@ -4351,14 +4342,14 @@
Addr(SocketAddr),
Url(RelayUrl, NodeId),
}
- let addr = match transport_meta.addr {
+ let addr = match source_addr {
transports::Addr::Ipv4(ipv4, port) => AddrOrUrl::Addr(SocketAddr::V4(
- SocketAddrV4::new(ipv4, port.unwrap_or_default()),
+ SocketAddrV4::new(*ipv4, port.unwrap_or_default()),
)),
transports::Addr::Ipv6(ipv6, port) => AddrOrUrl::Addr(SocketAddr::V6(
- SocketAddrV6::new(ipv6, port.unwrap_or_default(), 0, 0),
+ SocketAddrV6::new(*ipv6, port.unwrap_or_default(), 0, 0),
)),
- transports::Addr::RelayUrl(ref url, id) => AddrOrUrl::Url(url.clone(), id),
+ transports::Addr::RelayUrl(ref url, id) => AddrOrUrl::Url(url.clone(), *id),
};
match addr {
@@ -4380,7 +4371,7 @@
trace!(
src = %addr,
count = %quic_datagram_count,
- len = transport_meta.len,
+ len = quinn_meta.len,
"UDP recv QUIC address discovery packets",
);
quic_packets_total += quic_datagram_count;
@@ -4389,7 +4380,7 @@
warn!(
src = %addr,
count = %quic_datagram_count,
- len = transport_meta.len,
+ len = quinn_meta.len,
"UDP recv quic packets: no node state found, skipping",
);
// If we have no node state for the from addr, set len to 0 to make
@@ -4402,7 +4393,7 @@
src = %addr,
node = %node_id.fmt_short(),
count = %quic_datagram_count,
- len = transport_meta.len,
+ len = quinn_meta.len,
"UDP recv quic packets",
);
quic_packets_total += quic_datagram_count;
@@ -4416,9 +4407,6 @@
quinn_meta.addr = quic_mapped_addr.private_socket_addr();
}
}
- quinn_meta.len = transport_meta.len;
- quinn_meta.stride = transport_meta.stride;
- quinn_meta.ecn = transport_meta.ecn;
} else {
// If all datagrams in this buf are DISCO or STUN, set len to zero to make
// Quinn skip the buf completely.
diff --git a/pr/3279/docs/src/iroh/magicsock/transports.rs.html b/pr/3279/docs/src/iroh/magicsock/transports.rs.html
index 6a222cd359..a83429350a 100644
--- a/pr/3279/docs/src/iroh/magicsock/transports.rs.html
+++ b/pr/3279/docs/src/iroh/magicsock/transports.rs.html
@@ -394,21 +394,7 @@
393
394
395
-396
-397
-398
-399
-400
-401
-402
-403
-404
-405
-406
-407
-408
-409
-410
use std::{
+396
use std::{
io::{self, IoSliceMut},
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6},
pin::Pin,
@@ -500,14 +486,15 @@
&self,
cx: &mut Context,
bufs: &mut [IoSliceMut<'_>],
- metas: &mut [RecvMeta],
+ metas: &mut [quinn_udp::RecvMeta],
+ source_addrs: &mut [Addr],
) -> Poll<io::Result<usize>> {
debug_assert_eq!(bufs.len(), metas.len(), "non matching bufs & metas");
// TODO: randomization
macro_rules! poll_transport {
($socket:expr) => {
- match $socket.poll_recv(cx, bufs, metas)? {
+ match $socket.poll_recv(cx, bufs, metas, source_addrs)? {
Poll::Pending | Poll::Ready(0) => {}
Poll::Ready(n) => {
return Poll::Ready(Ok(n));
@@ -703,27 +690,6 @@
pub src_ip: Option<Addr>,
}
-#[derive(Debug, Clone)]
-pub struct RecvMeta {
- pub addr: Addr,
- pub len: usize,
- pub stride: usize,
- pub ecn: Option<quinn_udp::EcnCodepoint>,
- pub dst_ip: Option<Addr>,
-}
-
-impl Default for RecvMeta {
- fn default() -> Self {
- Self {
- addr: SocketAddr::new(Ipv6Addr::UNSPECIFIED.into(), 0).into(),
- len: 0,
- stride: 0,
- ecn: None,
- dst_ip: None,
- }
- }
-}
-
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Addr {
Ipv4(Ipv4Addr, Option<u16>),
@@ -731,6 +697,12 @@
RelayUrl(RelayUrl, NodeId),
}
+impl Default for Addr {
+ fn default() -> Self {
+ Self::Ipv6(Ipv6Addr::UNSPECIFIED, None)
+ }
+}
+
impl From<IpAddr> for Addr {
fn from(value: IpAddr) -> Self {
match value {
diff --git a/pr/3279/docs/src/iroh/magicsock/transports/ip.rs.html b/pr/3279/docs/src/iroh/magicsock/transports/ip.rs.html
index 0814eeba2f..06b24dfd73 100644
--- a/pr/3279/docs/src/iroh/magicsock/transports/ip.rs.html
+++ b/pr/3279/docs/src/iroh/magicsock/transports/ip.rs.html
@@ -142,11 +142,7 @@
141
142
143
-144
-145
-146
-147
-148
use std::{
+144
use std::{
io,
net::SocketAddr,
pin::Pin,
@@ -158,7 +154,7 @@
use quinn::AsyncUdpSocket;
use tracing::trace;
-use super::{RecvMeta, Transmit};
+use super::{Addr, Transmit};
use crate::{
magicsock::UdpConn,
watchable::{Watchable, Watcher},
@@ -222,22 +218,18 @@
&self,
cx: &mut Context,
bufs: &mut [io::IoSliceMut<'_>],
- metas: &mut [RecvMeta],
+ metas: &mut [quinn_udp::RecvMeta],
+ source_addrs: &mut [Addr],
) -> Poll<io::Result<usize>> {
- // TODO: figure out how to optimize this
- let mut quinn_metas = vec![quinn_udp::RecvMeta::default(); metas.len()];
- match self.socket.poll_recv(cx, bufs, &mut quinn_metas) {
+ match self.socket.poll_recv(cx, bufs, metas) {
Poll::Pending => Poll::Pending,
- Poll::Ready(res) => {
- for (quinn_meta, meta) in quinn_metas.into_iter().zip(metas.iter_mut()) {
- meta.addr = quinn_meta.addr.into();
- meta.len = quinn_meta.len;
- meta.stride = quinn_meta.stride;
- meta.ecn = quinn_meta.ecn;
- meta.dst_ip = quinn_meta.dst_ip.map(Into::into);
+ Poll::Ready(Ok(n)) => {
+ for (addr, el) in source_addrs.iter_mut().zip(metas.iter()).take(n) {
+ *addr = el.addr.into();
}
- Poll::Ready(res)
+ Poll::Ready(Ok(n))
}
+ Poll::Ready(Err(err)) => Poll::Ready(Err(err)),
}
}
diff --git a/pr/3279/docs/src/iroh/magicsock/transports/relay.rs.html b/pr/3279/docs/src/iroh/magicsock/transports/relay.rs.html
index 2d2c68791d..87dc665e19 100644
--- a/pr/3279/docs/src/iroh/magicsock/transports/relay.rs.html
+++ b/pr/3279/docs/src/iroh/magicsock/transports/relay.rs.html
@@ -475,7 +475,11 @@
474
475
476
-477
use std::{
+477
+478
+479
+480
+481
use std::{
io,
pin::Pin,
sync::Arc,
@@ -492,7 +496,7 @@
use tokio::sync::mpsc;
use tracing::{error, info_span, trace, warn, Instrument};
-use super::{RecvMeta, Transmit};
+use super::{Addr, Transmit};
use crate::{
magicsock::RelayContents,
watchable::{Watchable, Watcher as _},
@@ -607,10 +611,15 @@
&self,
cx: &mut Context,
bufs: &mut [io::IoSliceMut<'_>],
- metas: &mut [RecvMeta],
+ metas: &mut [quinn_udp::RecvMeta],
+ source_addrs: &mut [Addr],
) -> Poll<io::Result<usize>> {
let mut num_msgs = 0;
- 'outer: for (buf_out, meta_out) in bufs.iter_mut().zip(metas.iter_mut()) {
+ 'outer: for ((buf_out, meta_out), addr) in bufs
+ .iter_mut()
+ .zip(metas.iter_mut())
+ .zip(source_addrs.iter_mut())
+ {
let dm = match self.relay_datagram_recv_queue.poll_recv(cx) {
Poll::Ready(Ok(recv)) => recv,
Poll::Ready(Err(err)) => {
@@ -626,13 +635,12 @@
};
buf_out[..dm.buf.len()].copy_from_slice(&dm.buf);
- *meta_out = RecvMeta {
- len: dm.buf.len(),
- stride: dm.buf.len(),
- addr: (dm.url, dm.src).into(),
- ecn: None,
- dst_ip: None, // TODO: insert the relay url for this relay
- };
+ meta_out.len = dm.buf.len();
+ meta_out.stride = dm.buf.len();
+ meta_out.ecn = None;
+ meta_out.dst_ip = None; // TODO: insert the relay url for this relay
+
+ *addr = (dm.url, dm.src).into();
num_msgs += 1;
}
diff --git a/pr/3279/docs/src/iroh_dns_server/store.rs.html b/pr/3279/docs/src/iroh_dns_server/store.rs.html
index 43a200b9f9..3e06704859 100644
--- a/pr/3279/docs/src/iroh_dns_server/store.rs.html
+++ b/pr/3279/docs/src/iroh_dns_server/store.rs.html
@@ -267,7 +267,30 @@
266
267
268
-269
//! Pkarr packet store used to resolve DNS queries.
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
//! Pkarr packet store used to resolve DNS queries.
use std::{collections::BTreeMap, num::NonZeroUsize, path::Path, sync::Arc, time::Duration};
@@ -276,7 +299,7 @@
use lru::LruCache;
use pkarr::{Client as PkarrClient, SignedPacket};
use tokio::sync::Mutex;
-use tracing::{debug, trace};
+use tracing::{debug, trace, warn};
use ttl_cache::TtlCache;
use self::signed_packets::SignedPacketStore;
@@ -361,24 +384,46 @@
}
/// Resolve a DNS query.
- #[allow(clippy::unused_async)]
+ #[tracing::instrument("resolve", skip_all, fields(pubkey=%pubkey,name=%name,typ=%record_type))]
pub async fn resolve(
&self,
pubkey: &PublicKeyBytes,
name: &Name,
record_type: RecordType,
) -> Result<Option<Arc<RecordSet>>> {
- tracing::info!("{} {}", name, record_type);
+ trace!("store resolve");
if let Some(rset) = self.cache.lock().await.resolve(pubkey, name, record_type) {
+ debug!(
+ len = rset.records_without_rrsigs().count(),
+ "resolved from cache"
+ );
return Ok(Some(rset));
}
if let Some(packet) = self.store.get(pubkey).await? {
- return self
+ trace!(packet_timestamp = ?packet.timestamp(), "store hit");
+ return match self
.cache
.lock()
.await
- .insert_and_resolve(&packet, name, record_type);
+ .insert_and_resolve(&packet, name, record_type)
+ {
+ Ok(Some(rset)) => {
+ debug!(
+ len = rset.records_without_rrsigs().count(),
+ "resolved from store"
+ );
+ Ok(Some(rset))
+ }
+ Ok(None) => {
+ debug!("resolved to zone, but no matching records in zone");
+ Ok(None)
+ }
+ Err(err) => {
+ warn!("failed to retrieve zone after inserting in cache: {err:#?}");
+ Err(err)
+ }
+ };
};
if let Some(pkarr) = self.pkarr.as_ref() {
@@ -495,11 +540,14 @@
.map(|old| old.is_newer_than(signed_packet))
.unwrap_or(false)
{
- return Ok(());
+ trace!("insert skip: cached is newer");
+ Ok(())
+ } else {
+ self.cache
+ .put(pubkey, CachedZone::from_signed_packet(signed_packet)?);
+ trace!("inserted into cache");
+ Ok(())
}
- self.cache
- .put(pubkey, CachedZone::from_signed_packet(signed_packet)?);
- Ok(())
}
fn remove(&mut self, pubkey: &PublicKeyBytes) {
@@ -529,10 +577,8 @@
}
fn resolve(&self, name: &Name, record_type: RecordType) -> Option<Arc<RecordSet>> {
+ trace!(name=%name, typ=%record_type, "resolve in zone");
let key = RrKey::new(name.into(), record_type);
- for record in self.records.keys() {
- tracing::info!("record {:?}", record);
- }
self.records.get(&key).cloned()
}
}
diff --git a/pr/3279/docs/src/iroh_dns_server/store/signed_packets.rs.html b/pr/3279/docs/src/iroh_dns_server/store/signed_packets.rs.html
index bf63d737fa..e72a6e8016 100644
--- a/pr/3279/docs/src/iroh_dns_server/store/signed_packets.rs.html
+++ b/pr/3279/docs/src/iroh_dns_server/store/signed_packets.rs.html
@@ -459,7 +459,48 @@
458
459
460
-461
use std::{future::Future, path::Path, result, sync::Arc, time::Duration};
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
use std::{
+ future::Future,
+ path::Path,
+ result,
+ sync::Arc,
+ time::{Duration, SystemTime},
+};
use anyhow::{Context, Result};
use pkarr::{SignedPacket, Timestamp};
@@ -468,7 +509,7 @@
};
use tokio::sync::{mpsc, oneshot};
use tokio_util::sync::CancellationToken;
-use tracing::{debug, error, info, trace};
+use tracing::{debug, error, info, trace, warn};
use crate::{metrics::Metrics, util::PublicKeyBytes};
@@ -513,7 +554,7 @@
res: oneshot::Sender<Snapshot>,
},
CheckExpired {
- time: [u8; 8],
+ time: Timestamp,
key: PublicKeyBytes,
},
}
@@ -580,7 +621,6 @@
let transaction = self.db.begin_write()?;
let mut tables = Tables::new(&transaction)?;
let timeout = tokio::time::sleep(self.options.max_batch_time);
- let expired = Timestamp::now() - expiry_us;
tokio::pin!(timeout);
for _ in 0..self.options.max_batch_size {
tokio::select! {
@@ -593,9 +633,16 @@
Some(msg) = self.recv.recv() => {
match msg {
Message::Get { key, res } => {
- trace!("get {}", key);
- let packet = get_packet(&tables.signed_packets, &key).context("get packet failed")?;
- res.send(packet).ok();
+ match get_packet(&tables.signed_packets, &key) {
+ Ok(packet) => {
+ trace!("get {key}: {}", packet.is_some());
+ res.send(packet).ok();
+ },
+ Err(err) => {
+ warn!("get {key} failed: {err:#}");
+ return Err(err).with_context(|| format!("get packet for {key} failed"))
+ }
+ }
}
Message::Upsert { packet, res } => {
let key = PublicKeyBytes::from_signed_packet(&packet);
@@ -605,8 +652,8 @@
res.send(false).ok();
continue;
} else {
- // remove the packet from the update time index
- tables.update_time.remove(&packet.timestamp().to_bytes(), key.as_bytes())?;
+ // remove the old packet from the update time index
+ tables.update_time.remove(&existing.timestamp().to_bytes(), key.as_bytes())?;
true
}
} else {
@@ -639,13 +686,21 @@
res.send(Snapshot::new(&self.db)?).ok();
}
Message::CheckExpired { key, time } => {
- trace!("check expired {} at {}", key, u64::from_be_bytes(time));
+ trace!("check expired {} at {}", key, fmt_time(time));
if let Some(packet) = get_packet(&tables.signed_packets, &key)? {
+ let expired = Timestamp::now() - expiry_us;
if packet.timestamp() < expired {
- tables.update_time.remove(&time, key.as_bytes())?;
+ tables.update_time.remove(&time.to_bytes(), key.as_bytes())?;
let _ = tables.signed_packets.remove(key.as_bytes())?;
self.metrics.store_packets_expired.inc();
+ debug!("removed expired packet {key}");
+ } else {
+ debug!("packet {key} is no longer expired, removing obsolete expiry entry");
+ tables.update_time.remove(&time.to_bytes(), key.as_bytes())?;
}
+ } else {
+ debug!("expired packet {key} not found, remove from expiry table");
+ tables.update_time.remove(&time.to_bytes(), key.as_bytes())?;
}
}
}
@@ -659,6 +714,10 @@
}
}
+fn fmt_time(t: Timestamp) -> String {
+ humantime::format_rfc3339_micros(SystemTime::from(t)).to_string()
+}
+
/// A struct similar to [`redb::Table`] but for all tables that make up the
/// signed packet store.
pub(super) struct Tables<'a> {
@@ -778,8 +837,23 @@
let Some(row) = table.get(key.as_ref()).context("database fetch failed")? else {
return Ok(None);
};
- let packet = SignedPacket::deserialize(row.value()).context("parsing signed packet failed")?;
- Ok(Some(packet))
+ match SignedPacket::deserialize(row.value()) {
+ Ok(packet) => Ok(Some(packet)),
+ Err(err) => {
+ // Prior to iroh-dns-server v0.35, we stored packets in the default `SignedPacket::as_bytes` serialization from pkarr v2,
+ // which did not include the `last_seen` timestamp added as a prefix in `SignedPacket::serialize` from pkarr v3.
+ // If decoding the packet as a serialized pkarr v3 packet fails, we assume it was stored with iroh-dns-server before v0.35,
+ // and prepend an empty timestamp.
+ let data = row.value();
+ let mut buf = Vec::with_capacity(data.len() + 8);
+ buf.extend(&[0u8; 8]);
+ buf.extend(data);
+ match SignedPacket::deserialize(&buf) {
+ Ok(packet) => Ok(Some(packet)),
+ Err(err2) => Err(anyhow::anyhow!("Failed to decode as pkarr v3: {err:#}. Also failed to decode as pkarr v2: {err2:#}"))
+ }
+ }
+ }
}
async fn evict_task(send: mpsc::Sender<Message>, options: Options, cancel: CancellationToken) {
@@ -807,7 +881,7 @@
anyhow::bail!("failed to get snapshot");
};
let expired = Timestamp::now() - expiry_us;
- trace!("evicting packets older than {}", expired);
+ trace!("evicting packets older than {}", fmt_time(expired));
// if getting the range fails we exit the loop and shut down
// if individual reads fail we log the error and limp on
for item in snapshot.update_time.range(..expired.to_bytes())? {
@@ -818,26 +892,22 @@
continue;
}
};
- let time = time.value();
- trace!("evicting expired packets at {}", u64::from_be_bytes(time));
+ let time = Timestamp::from(time.value());
+ trace!("evicting expired packets at {}", fmt_time(time));
for item in keys {
let key = match item {
Ok(v) => v,
Err(e) => {
error!(
"failed to read update_time item at {}: {:?}",
- u64::from_be_bytes(time),
+ fmt_time(time),
e
);
continue;
}
};
let key = PublicKeyBytes::new(key.value());
- debug!(
- "evicting expired packet {} {}",
- u64::from_be_bytes(time),
- key
- );
+ debug!("evicting expired packet {} {}", fmt_time(time), key);
send.send(Message::CheckExpired { time, key }).await?;
}
}
diff --git a/pr/3279/docs/trait.impl/core/convert/trait.From.js b/pr/3279/docs/trait.impl/core/convert/trait.From.js
index 3c3eda16f7..f782f797c3 100644
--- a/pr/3279/docs/trait.impl/core/convert/trait.From.js
+++ b/pr/3279/docs/trait.impl/core/convert/trait.From.js
@@ -1,9 +1,9 @@
(function() {
- var implementors = Object.fromEntries([["iroh",[["impl From<DiscoveryItem> for NodeInfo"],["impl From<RemoteInfo> for NodeAddr"],["impl<T> From<T> for ConcurrentDiscovery"]]],["iroh_base",[["impl From<(PublicKey, Option<RelayUrl>, &[SocketAddr])> for NodeAddr"],["impl From<ParseError> for RelayUrlParseError"],["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 Error"],["impl From<Error> for KeyParsingError"],["impl From<Error> for Error"],["impl From<SigningKey> for SecretKey"],["impl From<VerifyingKey> for PublicKey"],["impl From<[u8; 32]> for SecretKey"]]],["iroh_relay",[["impl From<Error> for ConnSendError"],["impl From<NodeInfo> for NodeAddr"],["impl From<RelayNode> for RelayMap"],["impl From<Error> for ConnSendError"],["impl From<NodeAddr> for NodeData"],["impl From<NodeAddr> for NodeInfo"],["impl From<RelayUrl> for RelayMap"],["impl From<RelayUrl> for RelayNode"],["impl From<Resolver<GenericConnector<TokioRuntimeProvider>>> for DnsResolver"],["impl From<TxtLookup> for TxtLookup"]]]]);
+ var implementors = Object.fromEntries([["iroh",[["impl From<DiscoveryItem> for NodeInfo"],["impl From<RemoteInfo> for NodeAddr"],["impl<T> From<T> for ConcurrentDiscovery"]]],["iroh_base",[["impl From<(PublicKey, Option<RelayUrl>, &[SocketAddr])> for NodeAddr"],["impl From<ParseError> for RelayUrlParseError"],["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 Error"],["impl From<Error> for KeyParsingError"],["impl From<Error> for Error"],["impl From<SigningKey> for SecretKey"],["impl From<VerifyingKey> for PublicKey"],["impl From<[u8; 32]> for SecretKey"]]],["iroh_relay",[["impl From<Error> for ConnSendError"],["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<Error> for ConnSendError"],["impl From<Resolver<GenericConnector<TokioRuntimeProvider>>> for DnsResolver"],["impl From<TxtLookup> for TxtLookup"]]]]);
if (window.register_implementors) {
window.register_implementors(implementors);
} else {
window.pending_implementors = implementors;
}
})()
-//{"start":57,"fragment_lengths":[1632,5343,3221]}
\ No newline at end of file
+//{"start":57,"fragment_lengths":[1632,5343,3831]}
\ No newline at end of file
diff --git a/pr/3279/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js b/pr/3279/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js
index d104c409e3..8cd585bc9e 100644
--- a/pr/3279/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js
+++ b/pr/3279/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js
@@ -1,9 +1,9 @@
(function() {
- var implementors = Object.fromEntries([["iroh_relay",[["impl FromIterator<RelayNode> for RelayMap"],["impl FromIterator<RelayUrl> for RelayMap"]]]]);
+ var implementors = Object.fromEntries([["iroh_relay",[["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":[776]}
\ No newline at end of file
+//{"start":57,"fragment_lengths":[898]}
\ No newline at end of file