Skip to main content

ipv4_from_bytes

Function ipv4_from_bytes 

Source
pub fn ipv4_from_bytes(bytes: &[u8]) -> Result<IpAddr, Error>
Expand description

ยงTest

use std::net::IpAddr;
use turn_server::codec::message::attributes::address::ipv4_from_bytes;

let bytes: [u8; 4] = [0xc0, 0xa8, 0x00, 0x6b];

let source: IpAddr = "192.168.0.107".parse().unwrap();

let addr = ipv4_from_bytes(&bytes).unwrap();
assert_eq!(addr, source);