Struct Peer

Source
pub struct Peer<'a> {
    pub public_key: &'a [u8; 32],
    pub flags: Vec<WgPeerF>,
    pub preshared_key: Option<&'a [u8; 32]>,
    pub endpoint: Option<&'a SocketAddr>,
    pub persistent_keepalive_interval: Option<u16>,
    pub allowed_ips: Vec<AllowedIp<'a>>,
    pub protocol_version: Option<u32>,
}

Fields§

§public_key: &'a [u8; 32]§flags: Vec<WgPeerF>§preshared_key: Option<&'a [u8; 32]>

all zeros to remove

§endpoint: Option<&'a SocketAddr>§persistent_keepalive_interval: Option<u16>

0 to disable

§allowed_ips: Vec<AllowedIp<'a>>§protocol_version: Option<u32>

should not be set or used at all by most users of this API, as the most recent protocol will be used when this is unset. Otherwise, must be set to 1.

Implementations§

Source§

impl<'a> Peer<'a>

Source

pub fn from_public_key(public_key: &'a [u8; 32]) -> Self

Source

pub fn flags(self, flags: Vec<WgPeerF>) -> Self

Source

pub fn preshared_key(self, preshared_key: &'a [u8; 32]) -> Self

Source

pub fn endpoint(self, endpoint: &'a SocketAddr) -> Self

Source

pub fn persistent_keepalive_interval( self, persistent_keepalive_interval: u16, ) -> Self

Source

pub fn allowed_ips(self, allowed_ips: Vec<AllowedIp<'a>>) -> Self

Source

pub fn protocol_version(self, protocol_version: u32) -> Self

Trait Implementations§

Source§

impl<'a> Debug for Peer<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Peer<'a>

§

impl<'a> RefUnwindSafe for Peer<'a>

§

impl<'a> Send for Peer<'a>

§

impl<'a> Sync for Peer<'a>

§

impl<'a> Unpin for Peer<'a>

§

impl<'a> UnwindSafe for Peer<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.