Function xor_v6

Source
pub fn xor_v6(addr: Ipv6Addr, token: &[u8]) -> IpAddr
Expand description

ยงUnit Test

use faster_stun::attribute::address::*;
use std::net::{IpAddr, Ipv6Addr};

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

let xor: IpAddr =
    "2112:a442:6c46:6254:754b:bbae:8642:637e".parse().unwrap();

let token: [u8; 12] = [
    0x6c, 0x46, 0x62, 0x54, 0x75, 0x4b, 0x44, 0x51, 0x46, 0x48, 0x4c, 0x71,
];

let addr = xor_v6(source, &token);
assert_eq!(addr, xor);