pub struct ServiceAdvertisement {
pub service_type: String,
pub port: u16,
pub path: String,
pub name: Option<String>,
}Expand description
One service to publish over mDNS.
The record is what a peer needs to reach the endpoint: the service type, the port, and the
path TXT record the WebSocket lives on. name is the optional friendly-name hint; it is not
an identity and a peer that has the connection takes the name from client/hello
(server/hello in the other direction) instead.
Fields§
§service_type: StringService type the record is published under, for example CLIENT_SERVICE_TYPE.
port: u16Port the endpoint listens on.
path: StringThe path TXT record: the WebSocket endpoint, an absolute path such as /sendspin.
name: Option<String>The name TXT record, when the advertiser sets one.
Implementations§
Source§impl ServiceAdvertisement
impl ServiceAdvertisement
Sourcepub fn client(
port: u16,
path: impl Into<String>,
name: impl Into<String>,
) -> ServiceAdvertisement
pub fn client( port: u16, path: impl Into<String>, name: impl Into<String>, ) -> ServiceAdvertisement
Returns the record a client publishes: _sendspin._tcp, its port, path and name.
The name is the player’s, which is the value client/hello repeats; the spec only asks it to
match, and calls the client/hello value authoritative when the two differ.