pub struct WgSocket { /* private fields */ }
Implementations§
Source§impl WgSocket
impl WgSocket
pub fn connect() -> Result<Self, ConnectError>
pub fn get_device( &mut self, interface: DeviceInterface<'_>, ) -> Result<Device, GetDeviceError>
Sourcepub fn set_device(&mut self, device: Device<'_>) -> Result<(), SetDeviceError>
pub fn set_device(&mut self, device: Device<'_>) -> Result<(), SetDeviceError>
This assumes that the device interface has already been created. Otherwise an error will
be returned. You can create a new device interface with
RouteSocket::add_device
.
The peers in this device won’t be reachable at their allowed IPs until they’re added to the
newly created device interface through a Netlink Route message. This library doesn’t have
built-in way to do that right now. Here’s how it would be done with the ip
command:
sudo ip -4 route add 127.3.1.1/32 dev wgtest0
Auto Trait Implementations§
impl Freeze for WgSocket
impl RefUnwindSafe for WgSocket
impl Send for WgSocket
impl Sync for WgSocket
impl Unpin for WgSocket
impl UnwindSafe for WgSocket
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