pub struct DeviceConfig {
pub private_key: [u8; 32],
pub listen_addrs: (Ipv4Addr, Ipv6Addr),
pub listen_port: u16,
pub fwmark: u32,
pub peers: HashMap<[u8; 32], PeerConfig>,
}Expand description
Configuration for a device.
§Examples
use wiretun::{DeviceConfig, PeerConfig, Cidr};
let cfg = DeviceConfig::default()
.listen_port(40001)
.private_key([0; 32])
.peer(PeerConfig::default().public_key([0; 32]).allowed_ip("10.0.0.0/24".parse::<Cidr>().unwrap()));Fields§
§private_key: [u8; 32]§listen_addrs: (Ipv4Addr, Ipv6Addr)§listen_port: u16§fwmark: u32§peers: HashMap<[u8; 32], PeerConfig>Implementations§
Source§impl DeviceConfig
impl DeviceConfig
pub fn private_key(self, key: [u8; 32]) -> Self
pub fn listen_addr_v4(self, addr: Ipv4Addr) -> Self
pub fn listen_addr_v6(self, addr: Ipv6Addr) -> Self
pub fn listen_port(self, port: u16) -> Self
pub fn peer(self, peer: PeerConfig) -> Self
pub fn local_secret(&self) -> LocalStaticSecret
Trait Implementations§
Source§impl Clone for DeviceConfig
impl Clone for DeviceConfig
Source§fn clone(&self) -> DeviceConfig
fn clone(&self) -> DeviceConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DeviceConfig
impl RefUnwindSafe for DeviceConfig
impl Send for DeviceConfig
impl Sync for DeviceConfig
impl Unpin for DeviceConfig
impl UnwindSafe for DeviceConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more