pub struct DiscoveredServer {
pub addresses: Vec<String>,
pub path: String,
pub name: Option<String>,
}Expand description
One server a browser reported.
Fields§
§addresses: Vec<String>host:port addresses the browser resolved for the service.
endpoints orders them IPv4 first; the vector itself keeps
whatever order the backend reported.
path: StringThe path TXT record the service published.
name: Option<String>The name TXT record, when the service published one.
Implementations§
Source§impl DiscoveredServer
impl DiscoveredServer
Sourcepub fn endpoint(&self) -> Option<String>
pub fn endpoint(&self) -> Option<String>
Returns the ws:// endpoint to dial, or None when the record cannot name one.
This is the first of endpoints, so it is the IPv4 address
when the record has one.
Sourcepub fn endpoints(&self) -> Vec<String>
pub fn endpoints(&self) -> Vec<String>
Returns every ws:// endpoint the record names, IPv4 addresses first.
The scheme is ws:// even though the path is advertised: connection.md requires a
connection to an advertised address to use plain ws://, with confidentiality and integrity
provided by the Noise layer inside the payloads. An address that carries a scheme already,
a missing address, a path that is not path-absolute (RFC 3986) and a loopback or
unspecified address all yield nothing: the first three would mean guessing what the
advertiser meant, and connection.md says a client SHOULD NOT dial the last. The rule has no
opt-out: a test that needs a record to resolve uses a non-loopback address, such as one from
the documentation range 192.0.2.0/24.
An mDNS record commonly resolves to several addresses for one service - a dual-stack host publishes both. The IPv4 addresses come first so a server that listens on a single IPv4 wildcard is reached before a client spends a timeout on an IPv6 address nothing accepts; the relative order within each family is kept. A record with no valid address yields an empty list.