from_bytes_v4

Function from_bytes_v4 

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

ยงTest

use std::net::IpAddr;
use turn_server::stun::attribute::*;

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

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

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