Function get_local_ip

Source
pub fn get_local_ip() -> Option<IpAddr>
Expand description

Get the IP address of the machine

Priority is given to trying to get the IPv4 address, and if it fails, try to get the IPv6 address. If both fail to retrieve, None is returned.

ยงReturns

  • Some(IpAddr) - Native IP address (IPv4 or IPv6)
  • None - Unable to obtain any native IP address