pub fn parse(
addr: &str,
default_port: u16,
) -> Result<(&str, u16, bool), McError>Expand description
Parse an address string into (host, port, explicit_port).
explicit_port is true when a port was present in the string, false
when default_port was used as a fallback. This flag is used by
McClient to decide whether to attempt an SRV lookup —
SRV is skipped when the caller already specified an explicit port.
§Supported formats
"hostname"— usesdefault_port"hostname:port"— uses the given port"[::1]"— IPv6 without port, usesdefault_port"[::1]:port"— IPv6 with port"::1"— bare IPv6 (detected by multiple colons), usesdefault_port
§Errors
McError::Config(InvalidAddress)— IPv6 address is missing the closing].McError::Config(InvalidPort)— port string cannot be parsed asu16.