pub struct RelayAddress {
pub public_key: VerifyingKey,
pub addresses: BTreeSet<NetworkAddress>,
pub name: Option<String>,
}Expand description
Relay address information for a service
Contains the public key and network addresses needed to connect to a service. This structure is designed to be compact and suitable for QR code encoding.
Fields§
§public_key: VerifyingKeyPublic key of the service
Used to verify the service’s identity during the connection handshake. This prevents man-in-the-middle attacks and ensures the client is connecting to the correct service. Supports Ed25519 and ML-DSA keys.
addresses: BTreeSet<NetworkAddress>Network addresses where the service can be reached
Multiple addresses can be provided for redundancy and different network configurations. Clients should try addresses in order until one succeeds.
name: Option<String>Optional human-readable name for the service
Can be used for display purposes or debugging. Examples: “Primary Relay”, “EU West”, “Backup Server”, etc.
Implementations§
Source§impl RelayAddress
impl RelayAddress
Sourcepub fn new(public_key: VerifyingKey) -> Self
pub fn new(public_key: VerifyingKey) -> Self
Create a new connection info with minimal required fields
Sourcepub fn with_address(self, address: NetworkAddress) -> Self
pub fn with_address(self, address: NetworkAddress) -> Self
Add a network address
pub fn with_address_str(self, address: String) -> Self
Sourcepub fn with_addresses(
self,
addresses: impl IntoIterator<Item = NetworkAddress>,
) -> Self
pub fn with_addresses( self, addresses: impl IntoIterator<Item = NetworkAddress>, ) -> Self
Add multiple network addresses
Sourcepub fn with_name(self, name: impl Into<String>) -> Self
pub fn with_name(self, name: impl Into<String>) -> Self
Set a human-readable name for this service
Sourcepub fn display_name(&self) -> String
pub fn display_name(&self) -> String
Get the service’s display name (name if set, otherwise first address)
Sourcepub fn addresses_with_port(&self, port: u16) -> Vec<NetworkAddress>
pub fn addresses_with_port(&self, port: u16) -> Vec<NetworkAddress>
Get all addresses that use the specified port (or default port)
Sourcepub fn primary_address(&self) -> Option<&NetworkAddress>
pub fn primary_address(&self) -> Option<&NetworkAddress>
Get the first address, if any
Sourcepub fn all_addresses(&self) -> &BTreeSet<NetworkAddress>
pub fn all_addresses(&self) -> &BTreeSet<NetworkAddress>
Get all addresses for connection attempts
Trait Implementations§
Source§impl Clone for RelayAddress
impl Clone for RelayAddress
Source§fn clone(&self) -> RelayAddress
fn clone(&self) -> RelayAddress
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RelayAddress
impl Debug for RelayAddress
Source§impl<'de> Deserialize<'de> for RelayAddress
impl<'de> Deserialize<'de> for RelayAddress
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for RelayAddress
impl PartialEq for RelayAddress
Source§impl Serialize for RelayAddress
impl Serialize for RelayAddress
impl Eq for RelayAddress
impl StructuralPartialEq for RelayAddress
Auto Trait Implementations§
impl Freeze for RelayAddress
impl RefUnwindSafe for RelayAddress
impl Send for RelayAddress
impl Sync for RelayAddress
impl Unpin for RelayAddress
impl UnwindSafe for RelayAddress
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,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.