wgctrl 0.1.0

wgctrl is a crate that enables control over wireguard interfaces
Documentation
// WireGuard Generic Netlink Family Name
pub const WG_GENL_NAME: &str = "wireguard";
pub const WG_GENL_VERSION: u8 = 1;

#[repr(u8)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum WgCmd {
    GetDevice = 0,
    SetDevice = 1,
}

#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum WgDeviceAttr {
    Unspec = 0,
    IfIndex = 1,
    IfName = 2,
    PrivateKey = 3,
    PublicKey = 4,
    Flags = 5,
    ListenPort = 6,
    Fwmark = 7,
    Peers = 8, // Nested (Array of Peers)
}

#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum WgPeerAttr {
    Unspec = 0,
    PublicKey = 1,
    PresharedKey = 2,
    Flags = 3,
    Endpoint = 4,
    PersistentKeepalive = 5,
    LastHandshakeTime = 6,
    RxBytes = 7,
    TxBytes = 8,
    AllowedIps = 9, // Nested (Array of AllowedIPs)
    ProtocolVersion = 10,
}

#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum WgAllowedIpAttr {
    Unspec = 0,
    Family = 1,
    IpAddr = 2,
    CidrMask = 3,
}

pub const WGDEVICE_F_REPLACE_PEERS: u32 = 1;

pub const WGPEER_F_REMOVE_ME: u32 = 1;
pub const WGPEER_F_REPLACE_ALLOWEDIPS: u32 = 2;
pub const WGPEER_F_UPDATE_ONLY: u32 = 4;

pub const NLA_F_NESTED: u16 = 0x8000;