Skip to main content

strip_ipv6_brackets

Function strip_ipv6_brackets 

Source
pub(crate) fn strip_ipv6_brackets(host: &str) -> &str
Expand description

Strips the surrounding brackets from an IPv6 host literal, e.g. [::1] becomes ::1. Leaves other hosts unchanged. This lets a bracketed IPv6 literal in an address template parse as an IpAddr and resolve, matching what tokio::net::lookup_host accepts.