pub mod config;
mod connection;
mod types;
pub mod watch;
pub use config::{
DeclaredWgDevice, DeclaredWgDeviceBuilder, DeclaredWgPeer, DeclaredWgPeerBuilder,
DeviceChanges, PeerChanges, PublicKey, WireguardApplyResult, WireguardConfig,
WireguardConfigDiff,
};
pub use types::{
AllowedIp, WG_KEY_LEN, WgDevice, WgDeviceBuilder, WgPeer, WgPeerBuilder, WgPeerFlags,
};
pub use watch::{
WireguardEvent, WireguardWatchOptions, WireguardWatcher, diff_device_states,
};
pub const WG_GENL_NAME: &str = "wireguard";
pub const WG_GENL_VERSION: u8 = 1;
#[repr(u8)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum WgCmd {
GetDevice = 0,
SetDevice = 1,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum WgDeviceAttr {
Unspec = 0,
Ifindex = 1,
Ifname = 2,
PrivateKey = 3,
PublicKey = 4,
Flags = 5,
ListenPort = 6,
Fwmark = 7,
Peers = 8,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum WgPeerAttr {
Unspec = 0,
PublicKey = 1,
PresharedKey = 2,
Flags = 3,
Endpoint = 4,
PersistentKeepalive = 5,
LastHandshake = 6,
RxBytes = 7,
TxBytes = 8,
AllowedIps = 9,
ProtocolVersion = 10,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum WgAllowedIpAttr {
Unspec = 0,
Family = 1,
IpAddr = 2,
CidrMask = 3,
}
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum WgDeviceFlag {
ReplacePeers = 1 << 0,
}