Struct wiretun::DeviceConfig
source · 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 copy 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 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