Skip to main content

parse_target

Function parse_target 

Source
pub fn parse_target(
    path: &str,
    query: Option<&str>,
) -> Result<(String, u16), &'static str>
Expand description

Parses the RFC 9298 §2 default URI template.

/.well-known/masque/udp/{target_host}/{target_port}/

Parsing is deliberately lenient about the things clients disagree on — the trailing slash is optional, and an IPv6 literal is accepted both in the RFC 9298 §3 form (bare, only the colons escaped) and bracketed — while staying strict about anything ambiguous. What comes out is a host, with the brackets of the second form already off: crate::net::resolve resolves names and literals, not URI components.