pub struct Peer {
pub endpoint: Option<String>,
pub allowed_ips: Vec<Ipv4Net>,
pub key: Either<PrivateKey, PublicKey>,
pub amnezia_settings: Option<AmneziaSettings>,
}Fields§
§endpoint: Option<String>Peer’s endpoint.
allowed_ips: Vec<Ipv4Net>Peer’s allowed IPs.
key: Either<PrivateKey, PublicKey>Peer’s key.
If PrivateKey is provided, then peer can be exported to interface & full config.
Otherwise only to peer section of config.
amnezia_settings: Option<AmneziaSettings>Available on crate feature
amneziawg only.Implementations§
Source§impl Peer
impl Peer
Sourcepub fn to_interface(&self, interface: &Interface) -> WireguardResult<Interface>
pub fn to_interface(&self, interface: &Interface) -> WireguardResult<Interface>
Get Peer’s Interface.
Pass server’s interface to interface argument.
§Errors
WireguardError::NoPrivateKeyProvided– peer don’t have private key. You need to providePrivateKeyfor creating interfaces from peers.WireguardError::NoAssignedIP– no assigned ip found. This means that your peer doesn’t have allowed ip, that is in interface’s addresses network.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Peer
impl RefUnwindSafe for Peer
impl Send for Peer
impl Sync for Peer
impl Unpin for Peer
impl UnwindSafe for Peer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more