pub struct Peer {
pub public_key: [u8; 32],
pub remove: Option<bool>,
pub update_only: Option<bool>,
pub preshared_key: Option<[u8; 32]>,
pub endpoint: Option<SocketAddr>,
pub persistent_keepalive_interval: Option<u16>,
pub replace_allowed_ips: Option<bool>,
pub allowed_ips: Vec<AllowedIp>,
}Expand description
Documentation of each field comes from: https://www.wireguard.com/xplatform/#configuration-protocol
Fields
public_key: [u8; 32]The value for this key should be a lowercase hex-encoded public key of a new peer entry, which this command adds. The same public key value may not repeat during a single message.
remove: Option<bool>This key/value combo is only valid in a set operation, in which case it indicates that the previously added peer entry should be removed from the interface.
update_only: Option<bool>This key/value combo is only valid in a set operation, in which case it causes the operation only occurs if the peer already exists as part of the interface.
The value for this key should be a lowercase hex-encoded preshared-key of the previously added peer entry. The value may be an all zero string in the case of a set operation, in which case it indicates that the preshared-key should be removed.
endpoint: Option<SocketAddr>The value for this key is either IP:port for IPv4 or [IP]:port for IPv6, indicating the endpoint of the previously added peer entry.
persistent_keepalive_interval: Option<u16>The value for this is a decimal-string integer corresponding to the persistent keepalive interval of the previously added peer entry. The value 0 disables it.
replace_allowed_ips: Option<bool>This key/value combo is only valid in a set operation, in which case it indicates that the subsequent allowed IPs (perhaps an empty list) should replace any existing ones of the previously added peer entry, rather than append to the existing allowed IPs list.
allowed_ips: Vec<AllowedIp>The value for this is IP/cidr, indicating a new added allowed IP entry for the previously added peer entry. If an identical value already exists as part of a prior peer, the allowed IP entry will be removed from that peer and added to this peer.
Implementations
sourceimpl Peer
impl Peer
pub fn from_public_key(public_key: [u8; 32]) -> Self
pub fn remove(self, remove: bool) -> Self
pub fn update_only(self, update_only: bool) -> Self
pub fn endpoint(self, endpoint: SocketAddr) -> Self
pub fn persistent_keepalive_interval(
self,
persistent_keepalive_interval: u16
) -> Self
pub fn replace_allowed_ips(self, replace_allowed_ips: bool) -> Self
pub fn allowed_ips(self, allowed_ips: Vec<AllowedIp>) -> Self
Trait Implementations
impl StructuralPartialEq for Peer
Auto Trait Implementations
impl RefUnwindSafe for Peer
impl Send for Peer
impl Sync for Peer
impl Unpin for Peer
impl UnwindSafe for Peer
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more