Function from_bytes_v4

Source
pub fn from_bytes_v4(packet: &[u8]) -> Result<IpAddr, StunError>
Expand description

ยงUnit Test

use faster_stun::attribute::address::*;
use std::net::IpAddr;

let buf: [u8; 8] = [0x00, 0x01, 0xdd, 0xac, 0xc0, 0xa8, 0x00, 0x6b];

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

let addr = from_bytes_v4(&buf).unwrap();
assert_eq!(addr, source);