pub struct Device {
pub name: InterfaceName,
pub public_key: Option<Key>,
pub private_key: Option<Key>,
pub fwmark: Option<u32>,
pub listen_port: Option<u16>,
pub peers: Vec<PeerInfo>,
pub linked_name: Option<String>,
pub backend: Backend,
/* private fields */
}
Expand description
Represents all available information about a WireGuard device (interface).
This struct contains the current configuration of the device
and the current configuration and state of all of its peers.
The peer statistics are retrieved once at construction time,
and need to be updated manually by calling get_by_name
.
Fields§
§name: InterfaceName
The interface name of this device
public_key: Option<Key>
The public encryption key of this interface (if present)
private_key: Option<Key>
The private encryption key of this interface (if present)
fwmark: Option<u32>
The fwmark of this interface
listen_port: Option<u16>
The port to listen for incoming connections on
peers: Vec<PeerInfo>
The list of all registered peers and their information
linked_name: Option<String>
The associated “real name” of the interface (ex. “utun8” on macOS).
backend: Backend
The backend the device exists on (userspace or kernel).
Implementations§
Source§impl Device
impl Device
Sourcepub fn list(backend: Backend) -> Result<Vec<InterfaceName>, Error>
pub fn list(backend: Backend) -> Result<Vec<InterfaceName>, Error>
Enumerates all WireGuard interfaces currently present in the system, both with kernel and userspace backends.
You can use get_by_name
to retrieve more
detailed information on each interface.