tokio-udt 0.1.0-alpha.8

An implementation of UDP-based Data Transfer Protocol (UDT) based on Tokio primitives
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use std::net::IpAddr;

pub fn ip_to_bytes(ip: IpAddr) -> [u8; 16] {
    match ip {
        IpAddr::V4(addr) => {
            let mut bytes = [0; 16];
            bytes[0..4].copy_from_slice(&addr.octets());
            bytes
        }
        IpAddr::V6(addr) => addr.octets(),
    }
}