pub struct Url {
pub scheme: SchemeType,
pub host: String,
pub port: u16,
pub username: String,
pub password: String,
pub proto: ProtoType,
pub explicit_port: bool,
}Expand description
Represents a STUN (rfc7064) or TURN (rfc7065) URL.
Fields§
§scheme: SchemeTypeThe URL scheme: stun, stuns, turn or turns.
host: StringThe server host name or address.
port: u16The server port; defaults to 3478, or 5349 for the secure schemes.
username: StringThe TURN username, for turn:/turns: URLs.
password: StringThe TURN credential.
proto: ProtoTypeThe transport to reach the server over, from the URL’s ?transport= parameter.
explicit_port: boolWhether the URL names the port. Without one, a server’s name is looked up with S-NAPTR and SRV before its addresses (RFC 5928 section 3, RFC 8489 section 8); with one, only its addresses are (RFC 5928 section 3, RFC 7064 section 3.2).
Implementations§
Source§impl Url
impl Url
Sourcepub fn parse_url(raw: &str) -> Result<Self>
pub fn parse_url(raw: &str) -> Result<Self>
Parses a STUN or TURN urls following the ABNF syntax described in
IETF rfc-7064 and
IETF rfc-7065 respectively, with RFC 8489
section 8.1: “A ‘stuns’ URI containing an IP address MUST be rejected” (ErrHost).
Sourcepub fn parse_url_lenient(raw: &str) -> Result<Self>
pub fn parse_url_lenient(raw: &str) -> Result<Self>
parse_url without the RFC 8489 section 8.1 rule: a stuns URI
whose host is an IP address is accepted, as browsers do.