Struct defguard_wireguard_rs::WGApi
source · pub struct WGApi(/* private fields */);
Expand description
Shared multi-platform WireGuard management API
This struct adds an additional level of abstraction and can be used to detect the correct API implementation for most common platforms.
Implementations§
Trait Implementations§
source§impl WireguardInterfaceApi for WGApi
impl WireguardInterfaceApi for WGApi
source§fn create_interface(&self) -> Result<(), WireguardInterfaceError>
fn create_interface(&self) -> Result<(), WireguardInterfaceError>
Creates a new WireGuard interface.
source§fn assign_address(
&self,
address: &IpAddrMask
) -> Result<(), WireguardInterfaceError>
fn assign_address( &self, address: &IpAddrMask ) -> Result<(), WireguardInterfaceError>
Assigns IP address to an existing interface.
source§fn configure_peer_routing(
&self,
peers: &[Peer]
) -> Result<(), WireguardInterfaceError>
fn configure_peer_routing( &self, peers: &[Peer] ) -> Result<(), WireguardInterfaceError>
Add peer routing, basically a copy of
wg-quick up <if_name>
routing.
Extracts all uniques allowed ips from Peer slice and add routing for every
address.source§fn configure_interface(
&self,
config: &InterfaceConfiguration
) -> Result<(), WireguardInterfaceError>
fn configure_interface( &self, config: &InterfaceConfiguration ) -> Result<(), WireguardInterfaceError>
Updates configuration of an existing WireGuard interface.
source§fn remove_interface(&self) -> Result<(), WireguardInterfaceError>
fn remove_interface(&self) -> Result<(), WireguardInterfaceError>
Removes the WireGuard interface being managed. Read more
source§fn configure_peer(&self, peer: &Peer) -> Result<(), WireguardInterfaceError>
fn configure_peer(&self, peer: &Peer) -> Result<(), WireguardInterfaceError>
Adds a peer or updates peer configuration.
source§fn configure_dns(&self, dns: &[IpAddr]) -> Result<(), WireguardInterfaceError>
fn configure_dns(&self, dns: &[IpAddr]) -> Result<(), WireguardInterfaceError>
Sets the DNS configuration for the WireGuard interface. Read more
source§fn remove_peer(&self, peer_pubkey: &Key) -> Result<(), WireguardInterfaceError>
fn remove_peer(&self, peer_pubkey: &Key) -> Result<(), WireguardInterfaceError>
Removes a configured peer with a given pubkey.
source§fn read_interface_data(&self) -> Result<Host, WireguardInterfaceError>
fn read_interface_data(&self) -> Result<Host, WireguardInterfaceError>
Reads current WireGuard interface configuration and stats. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for WGApi
impl Send for WGApi
impl Sync for WGApi
impl Unpin for WGApi
impl !UnwindSafe for WGApi
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