pub enum IpFamilyPreference {
Ipv4,
Ipv6,
System,
}Expand description
Which address family a target name is tried on first, selected by
[limits].ip_family_preference.
The default is IPv4, which is deliberately not what the C library hands
back. getaddrinfo — glibc and musl alike — orders its answers by RFC 6724,
and that ordering puts a global IPv6 address ahead of every IPv4 one whenever
the host has a usable IPv6 route. On a host that is only a client of the
internet that is the right answer. On a proxy it is an operator policy
wearing a resolver’s clothes: a host whose IPv6 egress is tunnelled, or
otherwise weaker than its native IPv4 — a common shape on a VPS — would send
every dual-stack target down the weaker path first. A TCP tunnel pays for
that with the whole IPv6 attempt before IPv4 is even tried, because
crate::tunnel::tcp walks the address list in order; a CONNECT-UDP session
pays for it outright, because its socket is connected to the first address
that has a route and there is no failover behind that choice.
System is the escape hatch back to RFC 6724 ordering, which
on glibc an operator can shape further through gai.conf. The knob and its
default have precedent: shadowsocks-rust carries the same choice as
ipv6_first, likewise off by default.
Variants§
Ipv4
Try IPv4 addresses before IPv6 ones. The default.
Ipv6
Try IPv6 addresses before IPv4 ones.
System
Keep the resolver’s own order, which on libc means RFC 6724.
Trait Implementations§
Source§impl Clone for IpFamilyPreference
impl Clone for IpFamilyPreference
Source§fn clone(&self) -> IpFamilyPreference
fn clone(&self) -> IpFamilyPreference
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for IpFamilyPreference
Source§impl Debug for IpFamilyPreference
impl Debug for IpFamilyPreference
Source§impl<'de> Deserialize<'de> for IpFamilyPreference
impl<'de> Deserialize<'de> for IpFamilyPreference
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for IpFamilyPreference
Source§impl PartialEq for IpFamilyPreference
impl PartialEq for IpFamilyPreference
Source§fn eq(&self, other: &IpFamilyPreference) -> bool
fn eq(&self, other: &IpFamilyPreference) -> bool
self and other values to be equal, and is used by ==.