pub struct NatInfo {
pub nat_type: NatType,
pub public_ips: Vec<Ipv4Addr>,
pub public_udp_ports: Vec<u16>,
pub mapping_tcp_addr: Vec<SocketAddr>,
pub mapping_udp_addr: Vec<SocketAddr>,
pub public_port_range: u16,
pub local_ipv4: Ipv4Addr,
pub local_ipv4s: Vec<Ipv4Addr>,
pub ipv6: Option<Ipv6Addr>,
pub local_udp_ports: Vec<u16>,
pub local_tcp_port: u16,
pub public_tcp_port: u16,
}Expand description
Comprehensive NAT information about the local network.
Contains details about NAT type, public/private addresses, and port mappings discovered through STUN and other NAT traversal techniques.
§Fields
nat_type- The detected NAT type (Cone or Symmetric)public_ips- List of public IPv4 addressespublic_udp_ports- Public ports mapped for UDPlocal_ipv4- Primary local IPv4 addressipv6- Public IPv6 address if available
Fields§
§nat_type: NatTypenat type of the network
public_ips: Vec<Ipv4Addr>the set of public Ipv4
public_udp_ports: Vec<u16>the set of public ports mapped from the nat
mapping_tcp_addr: Vec<SocketAddr>the set of mapped addresses where TCP serves on
mapping_udp_addr: Vec<SocketAddr>the set of mapped addresses where UDP serves on
public_port_range: u16The predicted range of public ports, it is used when the nat_type is symmetric
local_ipv4: Ipv4Addrlocal IP address
local_ipv4s: Vec<Ipv4Addr>§ipv6: Option<Ipv6Addr>The public IPv6 address
local_udp_ports: Vec<u16>The local ports where the UDP services bind
local_tcp_port: u16The local ports where the TCP services bind
public_tcp_port: u16The public port of TCP service, which works when there is either nat1 or no nat exists
Implementations§
Source§impl NatInfo
impl NatInfo
pub fn ipv6_udp_addr(&self) -> Vec<SocketAddr>
pub fn ipv6_tcp_addr(&self) -> Option<SocketAddr>
pub fn public_ipv4_addr(&self) -> Vec<SocketAddr>
pub fn local_ipv4_addrs(&self) -> Vec<SocketAddr>
pub fn local_ipv4_tcp(&self) -> Option<SocketAddr>
pub fn public_ipv4_tcp(&self) -> Vec<SocketAddr>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for NatInfo
impl<'de> Deserialize<'de> for NatInfo
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<NatInfo, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<NatInfo, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for NatInfo
impl Serialize for NatInfo
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for NatInfo
impl RefUnwindSafe for NatInfo
impl Send for NatInfo
impl Sync for NatInfo
impl Unpin for NatInfo
impl UnwindSafe for NatInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more