Class (GI Struct)

NM-1.0NMWireGuardPeerSince 1.16

The settings of one WireGuard peer.

1.16

Index

Constructors

Properties

Methods

  • 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 NM.WireGuardPeer instance.

    Parameters

    • allowed_ip: string

      the allowed-ip entry to set.

    • accept_invalid: boolean

      if true, also invalid allowed_ip value will be appended. Otherwise, the function does nothing in face of invalid values and returns false.

    Returns boolean

    true if the value is a valid allowed-ips value, false otherwise. Depending on accept_invalid, also invalid values are added.

  • Parameters

    • idx: number

      the index from zero to (allowed-ips-len - 1) to retrieve.

    • Optionalout_is_valid: boolean

      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 string

    the allowed-ip setting at index idx. If idx is out of range, null will be returned.

  • Returns number

    get the persistent-keepalive setting in seconds. Set to zero to disable keep-alive.

  • Parameters

    • check_non_secrets: boolean

      if true, secret properties are validated. Otherwise, they are ignored for this purpose.

    • check_secrets: boolean

      if true, non-secret properties are validated. Otherwise, they are ignored for this purpose.

    Returns boolean

    true if the peer is valid or fails with an error reason.

  • Parameters

    • with_secrets: boolean

      if true, the preshared-key secrets are copied as well. Otherwise, they will be removed.

    Returns WireGuardPeer

    a clone of self. This instance is always unsealed.

  • 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 NM.WireGuardPeer instance.

    Parameters

    • idx: number

      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 boolean

    true if idx was valid and the allowed-ip was removed. false otherwise, and the peer will not be changed.

  • Seal the NM.WireGuardPeer 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().

    Returns void

  • Sets or clears the endpoint of self.

    It is a bug trying to modify a sealed NM.WireGuardPeer instance.

    Parameters

    • endpoint: string

      the socket address endpoint to set or null.

    • allow_invalid: boolean

      if true, also invalid values are set. If false, the function does nothing for invalid endpoint arguments.

    Returns boolean

    true if the endpoint is null or valid. For an invalid endpoint argument, false is returned. Depending on allow_invalid, the instance will be modified.

  • It is a bug trying to modify a sealed NM.WireGuardPeer instance.

    Parameters

    • persistent_keepalive: number

      the keep-alive value to set.

    Returns void

  • 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 NM.WireGuardPeer instance.

    Parameters

    • preshared_key: string

      the new preshared key or null to clear the preshared key.

    • accept_invalid: boolean

      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 boolean

    true if the preshared-key is valid, otherwise false. null is considered a valid value. If the key is invalid, it depends on accept_invalid whether the previous value was reset.

  • 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 NM.WireGuardPeer instance.

    Parameters

    • public_key: string

      the new public key or null to clear the public key.

    • accept_invalid: boolean

      if true and public_key is not null and invalid, then do not modify the instance.

    Returns boolean

    true if the key was valid or null. Returns false for invalid keys. Depending on accept_invalid will an invalid key be set or not.

  • Drop a reference to self. If the last reference is dropped, the instance is freed and all associate data released.

    Since 1.42, ref-counting of NM.WireGuardPeer is thread-safe.

    Returns void