bytes_to_ip

Function bytes_to_ip 

Source
pub fn bytes_to_ip(bytes: [u8; 16]) -> IpAddr
Expand description

Converts a 16-byte representation back to an IP address.

This function detects whether the input represents an IPv4-mapped address or a native IPv6 address:

  • If bytes 0-9 are 0x00 and bytes 10-11 are 0xFF, it’s treated as an IPv4 address
  • Otherwise, it’s treated as an IPv6 address

§Arguments

  • bytes - The 16-byte array to convert

§Returns

The corresponding IP address