Function from_bytes_v6

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

ยงUnit Test

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

let buf: [u8; 20] = [
    0x00, 0x01, 0xdd, 0xac, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0xFF, 0xFF, 0xC0, 0x0A, 0x2F, 0x0F,
];

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

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