Struct wireguard_uapi::WgSocket
source · [−]pub struct WgSocket { /* private fields */ }Implementations
sourceimpl 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 wgtest0Auto Trait Implementations
impl RefUnwindSafe for WgSocket
impl Send for WgSocket
impl Sync for WgSocket
impl Unpin for WgSocket
impl UnwindSafe for WgSocket
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more