pub struct WireGuardPeer { /* private fields */ }v1_16 only.Expand description
The settings of one WireGuard peer.
GLib type: Shared boxed type with reference counted clone semantics.
Implementations§
Source§impl WireGuardPeer
impl WireGuardPeer
Sourcepub fn as_ptr(&self) -> *mut NMWireGuardPeer
pub fn as_ptr(&self) -> *mut NMWireGuardPeer
Return the inner pointer to the underlying C value.
Sourcepub unsafe fn from_glib_ptr_borrow(ptr: &*mut NMWireGuardPeer) -> &Self
pub unsafe fn from_glib_ptr_borrow(ptr: &*mut NMWireGuardPeer) -> &Self
Borrows the underlying C value.
Source§impl WireGuardPeer
impl WireGuardPeer
Sourcepub fn new() -> WireGuardPeer
pub fn new() -> WireGuardPeer
§Returns
a new, default, unsealed #NMWireGuardPeer instance.
Sourcepub fn append_allowed_ip(&self, allowed_ip: &str, accept_invalid: bool) -> bool
pub fn append_allowed_ip(&self, allowed_ip: &str, accept_invalid: bool) -> bool
Appends @allowed_ip setting to the list. This does not check for duplicates and always appends @allowed_ip to the end of the list. If @allowed_ip is valid, it will be normalized and a modified for might be appended. If @allowed_ip is invalid, it will still be appended, but later verification will fail.
It is a bug trying to modify a sealed #NMWireGuardPeer instance.
§allowed_ip
the allowed-ip entry to set.
§accept_invalid
if true, also invalid @allowed_ip value
will be appended. Otherwise, the function does nothing
in face of invalid values and returns false.
§Returns
true if the value is a valid allowed-ips value, false otherwise.
Depending on @accept_invalid, also invalid values are added.
Sourcepub fn clear_allowed_ips(&self)
pub fn clear_allowed_ips(&self)
Removes all allowed-ip entries.
It is a bug trying to modify a sealed #NMWireGuardPeer instance.
Sourcepub fn cmp(
&self,
b: Option<&WireGuardPeer>,
compare_flags: SettingCompareFlags,
) -> i32
pub fn cmp( &self, b: Option<&WireGuardPeer>, compare_flags: SettingCompareFlags, ) -> i32
Sourcepub fn allowed_ip(&self, idx: u32, out_is_valid: bool) -> Option<GString>
pub fn allowed_ip(&self, idx: u32, out_is_valid: bool) -> Option<GString>
§idx
the index from zero to (allowed-ips-len - 1) to retrieve.
§out_is_valid
true if the returned value is a valid allowed-ip
setting.
This parameter is wrongly not marked as (out) argument, it is
thus not accessible via introspection. This cannot be fixed without
breaking API for introspection users.
§Returns
the allowed-ip setting at index @idx.
If @idx is out of range, None will be returned.
Sourcepub fn allowed_ips_len(&self) -> u32
pub fn allowed_ips_len(&self) -> u32
§Returns
the number of allowed-ips entries.
Sourcepub fn persistent_keepalive(&self) -> u16
pub fn persistent_keepalive(&self) -> u16
§Returns
get the persistent-keepalive setting in seconds. Set to zero to disable keep-alive.
§Returns
get the secret flags for the preshared-key.
Sourcepub fn public_key(&self) -> GString
pub fn public_key(&self) -> GString
Sourcepub fn new_clone(&self, with_secrets: bool) -> WireGuardPeer
pub fn new_clone(&self, with_secrets: bool) -> WireGuardPeer
Sourcepub fn remove_allowed_ip(&self, idx: u32) -> bool
pub fn remove_allowed_ip(&self, idx: u32) -> bool
Removes the allowed-ip at the given @idx. This shifts all following entries one index down.
It is a bug trying to modify a sealed #NMWireGuardPeer instance.
§idx
the index from zero to (allowed-ips-len - 1) to
retrieve. If the index is out of range, false is returned
and nothing is done.
§Returns
true if @idx was valid and the allowed-ip was removed.
false otherwise, and the peer will not be changed.
Sourcepub fn seal(&self)
pub fn seal(&self)
Seal the #NMWireGuardPeer instance. Afterwards, it is a bug to call all functions that modify the instance (except ref/unref). A sealed instance cannot be unsealed again, but you can create an unsealed copy with nm_wireguard_peer_new_clone().
Sourcepub fn set_endpoint(&self, endpoint: &str, allow_invalid: bool) -> bool
pub fn set_endpoint(&self, endpoint: &str, allow_invalid: bool) -> bool
Sets or clears the endpoint of @self.
It is a bug trying to modify a sealed #NMWireGuardPeer instance.
§endpoint
the socket address endpoint to set or None.
§allow_invalid
if true, also invalid values are set.
If false, the function does nothing for invalid @endpoint
arguments.
§Returns
true if the endpoint is None or valid. For an
invalid @endpoint argument, false is returned. Depending
on @allow_invalid, the instance will be modified.
Sourcepub fn set_persistent_keepalive(&self, persistent_keepalive: u16)
pub fn set_persistent_keepalive(&self, persistent_keepalive: u16)
It is a bug trying to modify a sealed #NMWireGuardPeer instance.
§persistent_keepalive
the keep-alive value to set.
Reset the preshared key. Note that if the preshared key is valid, it will be normalized (which may or may not modify the set value).
Note that the preshared-key is a secret and consequently has corresponding preshared-key-flags property. This is so that secrets can be optional and requested on demand from a secret-agent. Also, an invalid preshared-key may optionally cause nm_wireguard_peer_is_valid() to fail or it may be accepted.
It is a bug trying to modify a sealed #NMWireGuardPeer instance.
§preshared_key
the new preshared
key or None to clear the preshared key.
§accept_invalid
whether to allow setting the key to an invalid
value. If false, @self is unchanged if the key is invalid
and if false is returned.
§Returns
true if the preshared-key is valid, otherwise false.
None is considered a valid value.
If the key is invalid, it depends on @accept_invalid whether the
previous value was reset.
It is a bug trying to modify a sealed #NMWireGuardPeer instance.
§preshared_key_flags
the secret flags to set.
Sourcepub fn set_public_key(
&self,
public_key: Option<&str>,
accept_invalid: bool,
) -> bool
pub fn set_public_key( &self, public_key: Option<&str>, accept_invalid: bool, ) -> bool
Reset the public key. Note that if the public key is valid, it will be normalized (which may or may not modify the set value).
It is a bug trying to modify a sealed #NMWireGuardPeer instance.
§public_key
the new public
key or None to clear the public key.
§accept_invalid
if true and @public_key is not None and
invalid, then do not modify the instance.
§Returns
true if the key was valid or None. Returns
false for invalid keys. Depending on @accept_invalid
will an invalid key be set or not.
Trait Implementations§
Source§impl Clone for WireGuardPeer
impl Clone for WireGuardPeer
Source§impl Debug for WireGuardPeer
impl Debug for WireGuardPeer
Source§impl Default for WireGuardPeer
impl Default for WireGuardPeer
Source§impl From<WireGuardPeer> for Value
impl From<WireGuardPeer> for Value
Source§fn from(s: WireGuardPeer) -> Self
fn from(s: WireGuardPeer) -> Self
Source§impl HasParamSpec for WireGuardPeer
impl HasParamSpec for WireGuardPeer
type ParamSpec = ParamSpecBoxed
Source§type SetValue = WireGuardPeer
type SetValue = WireGuardPeer
type BuilderFn = fn(&str) -> ParamSpecBoxedBuilder<'_, WireGuardPeer>
fn param_spec_builder() -> Self::BuilderFn
Source§impl Hash for WireGuardPeer
impl Hash for WireGuardPeer
Source§impl Ord for WireGuardPeer
impl Ord for WireGuardPeer
Source§fn cmp(&self, other: &WireGuardPeer) -> Ordering
fn cmp(&self, other: &WireGuardPeer) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for WireGuardPeer
impl PartialEq for WireGuardPeer
Source§impl PartialOrd for WireGuardPeer
impl PartialOrd for WireGuardPeer
Source§impl StaticType for WireGuardPeer
impl StaticType for WireGuardPeer
Source§fn static_type() -> Type
fn static_type() -> Type
Self.