gi-nm-1.0.1: NM bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.NM.Objects.SettingWireGuard

Description

WireGuard Settings

Since: 1.16

Synopsis

Exported types

class (GObject o, IsDescendantOf SettingWireGuard o) => IsSettingWireGuard o Source #

Type class for types which can be safely cast to SettingWireGuard, for instance with toSettingWireGuard.

Instances

Instances details
(GObject o, IsDescendantOf SettingWireGuard o) => IsSettingWireGuard o Source # 
Instance details

Defined in GI.NM.Objects.SettingWireGuard

toSettingWireGuard :: (MonadIO m, IsSettingWireGuard o) => o -> m SettingWireGuard Source #

Cast to SettingWireGuard, for types for which this is known to be safe. For general casts, use castTo.

Methods

appendPeer

settingWireGuardAppendPeer Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingWireGuard a) 
=> a

self: the SettingWireGuard instance

-> WireGuardPeer

peer: the WireGuardPeer instance to append. This seals peer and keeps a reference on the instance.

-> m () 

If a peer with the same public-key already exists, that one is replaced by peer. The new peer is always appended (or moved to) the end, so in case a peer is replaced, the indexes are shifted and the number of peers stays unchanged.

Since: 1.16

clearPeers

settingWireGuardClearPeers Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingWireGuard a) 
=> a

self: the SettingWireGuard instance

-> m Word32

Returns: the number of cleared peers.

No description available in the introspection data.

Since: 1.16

getFwmark

settingWireGuardGetFwmark Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingWireGuard a) 
=> a

self: the SettingWireGuard instance

-> m Word32

Returns: the set firewall mark.

No description available in the introspection data.

Since: 1.16

getIp4AutoDefaultRoute

settingWireGuardGetIp4AutoDefaultRoute Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingWireGuard a) 
=> a

self: the SettingWireGuard setting.

-> m Ternary

Returns: the "ip4-auto-default-route" property of the setting.

No description available in the introspection data.

Since: 1.20

getIp6AutoDefaultRoute

settingWireGuardGetIp6AutoDefaultRoute Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingWireGuard a) 
=> a

self: the SettingWireGuard setting.

-> m Ternary

Returns: the "ip6-auto-default-route" property of the setting.

No description available in the introspection data.

Since: 1.20

getListenPort

settingWireGuardGetListenPort Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingWireGuard a) 
=> a

self: the SettingWireGuard instance

-> m Word16

Returns: the set UDP listen port.

No description available in the introspection data.

Since: 1.16

getMtu

settingWireGuardGetMtu Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingWireGuard a) 
=> a

self: the SettingWireGuard instance

-> m Word32

Returns: the MTU of the setting.

No description available in the introspection data.

Since: 1.16

getPeer

settingWireGuardGetPeer Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingWireGuard a) 
=> a

self: the SettingWireGuard instance

-> Word32

idx: the index to lookup.

-> m WireGuardPeer

Returns: the WireGuardPeer entry at index idx. If the index is out of range, Nothing is returned.

No description available in the introspection data.

Since: 1.16

getPeerByPublicKey

settingWireGuardGetPeerByPublicKey Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingWireGuard a) 
=> a

self: the SettingWireGuard instance

-> Text

publicKey: the public key for looking up the peer.

-> m (Maybe WireGuardPeer, Word32)

Returns: the WireGuardPeer instance with a matching public key. If no such peer exists, Nothing is returned.

No description available in the introspection data.

Since: 1.16

getPeerRoutes

settingWireGuardGetPeerRoutes Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingWireGuard a) 
=> a

self: the SettingWireGuard instance

-> m Bool

Returns: whether automatically add peer routes.

No description available in the introspection data.

Since: 1.16

getPeersLen

settingWireGuardGetPeersLen Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingWireGuard a) 
=> a

self: the SettingWireGuard instance

-> m Word32

Returns: the number of registered peers.

No description available in the introspection data.

Since: 1.16

getPrivateKey

settingWireGuardGetPrivateKey Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingWireGuard a) 
=> a

self: the SettingWireGuard instance

-> m Text

Returns: the set private-key or Nothing.

No description available in the introspection data.

Since: 1.16

getPrivateKeyFlags

settingWireGuardGetPrivateKeyFlags Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingWireGuard a) 
=> a

self: the SettingWireGuard instance

-> m [SettingSecretFlags]

Returns: the secret-flags for SettingWireGuard:privateKey.

No description available in the introspection data.

Since: 1.16

new

settingWireGuardNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m SettingWireGuard

Returns: the new empty SettingWireGuard object

Creates a new SettingWireGuard object with default values.

Since: 1.16

removePeer

settingWireGuardRemovePeer Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingWireGuard a) 
=> a

self: the SettingWireGuard instance

-> Word32

idx: the index to remove.

-> m Bool

Returns: True if idx was in range and a peer was removed. Otherwise, self is unchanged.

No description available in the introspection data.

Since: 1.16

setPeer

settingWireGuardSetPeer Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingWireGuard a) 
=> a

self: the SettingWireGuard instance

-> WireGuardPeer

peer: the WireGuardPeer instance to set. This seals peer and keeps a reference on the instance.

-> Word32

idx: the index, in the range of 0 to the number of peers (including). That means, if idx is one past the end of the number of peers, this is the same as settingWireGuardAppendPeer. Otherwise, the peer at this index is replaced.

-> m () 

If idx is one past the last peer, the behavior is the same as settingWireGuardAppendPeer. Otherwise, the peer will be at idx and replace the peer instance at that index. Note that if a peer with the same public-key exists on another index, then that peer will also be replaced. In that case, the number of peers will shrink by one (because the one at idx got replace and then one with the same public-key got removed). This also means, that the resulting index afterwards may be one less than idx (if another peer with a lower index was dropped).

Since: 1.16

Properties

fwmark

The use of fwmark is optional and is by default off. Setting it to 0 disables it. Otherwise, it is a 32-bit fwmark for outgoing packets.

Note that "ip4-auto-default-route" or "ip6-auto-default-route" enabled, implies to automatically choose a fwmark.

Since: 1.16

constructSettingWireGuardFwmark :: (IsSettingWireGuard o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “fwmark” property. This is rarely needed directly, but it is used by new.

getSettingWireGuardFwmark :: (MonadIO m, IsSettingWireGuard o) => o -> m Word32 Source #

Get the value of the “fwmark” property. When overloading is enabled, this is equivalent to

get settingWireGuard #fwmark

setSettingWireGuardFwmark :: (MonadIO m, IsSettingWireGuard o) => o -> Word32 -> m () Source #

Set the value of the “fwmark” property. When overloading is enabled, this is equivalent to

set settingWireGuard [ #fwmark := value ]

ip4AutoDefaultRoute

Whether to enable special handling of the IPv4 default route. If enabled, the IPv4 default route from wireguard.peer-routes will be placed to a dedicated routing-table and two policy routing rules will be added. The fwmark number is also used as routing-table for the default-route, and if fwmark is zero, an unused fwmark/table is chosen automatically. This corresponds to what wg-quick does with Table=auto and what WireGuard calls "Improved Rule-based Routing".

Note that for this automatism to work, you usually don't want to set ipv4.gateway, because that will result in a conflicting default route.

Leaving this at the default will enable this option automatically if ipv4.never-default is not set and there are any peers that use a default-route as allowed-ips. Since this automatism only makes sense if you also have a peer with an /0 allowed-ips, it is usually not necessary to enable this explicitly. However, you can disable it if you want to configure your own routing and rules.

Since: 1.20

constructSettingWireGuardIp4AutoDefaultRoute :: (IsSettingWireGuard o, MonadIO m) => Ternary -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “ip4-auto-default-route” property. This is rarely needed directly, but it is used by new.

getSettingWireGuardIp4AutoDefaultRoute :: (MonadIO m, IsSettingWireGuard o) => o -> m Ternary Source #

Get the value of the “ip4-auto-default-route” property. When overloading is enabled, this is equivalent to

get settingWireGuard #ip4AutoDefaultRoute

setSettingWireGuardIp4AutoDefaultRoute :: (MonadIO m, IsSettingWireGuard o) => o -> Ternary -> m () Source #

Set the value of the “ip4-auto-default-route” property. When overloading is enabled, this is equivalent to

set settingWireGuard [ #ip4AutoDefaultRoute := value ]

ip6AutoDefaultRoute

Like ip4-auto-default-route, but for the IPv6 default route.

Since: 1.20

constructSettingWireGuardIp6AutoDefaultRoute :: (IsSettingWireGuard o, MonadIO m) => Ternary -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “ip6-auto-default-route” property. This is rarely needed directly, but it is used by new.

getSettingWireGuardIp6AutoDefaultRoute :: (MonadIO m, IsSettingWireGuard o) => o -> m Ternary Source #

Get the value of the “ip6-auto-default-route” property. When overloading is enabled, this is equivalent to

get settingWireGuard #ip6AutoDefaultRoute

setSettingWireGuardIp6AutoDefaultRoute :: (MonadIO m, IsSettingWireGuard o) => o -> Ternary -> m () Source #

Set the value of the “ip6-auto-default-route” property. When overloading is enabled, this is equivalent to

set settingWireGuard [ #ip6AutoDefaultRoute := value ]

listenPort

The listen-port. If listen-port is not specified, the port will be chosen randomly when the interface comes up.

Since: 1.16

constructSettingWireGuardListenPort :: (IsSettingWireGuard o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “listen-port” property. This is rarely needed directly, but it is used by new.

getSettingWireGuardListenPort :: (MonadIO m, IsSettingWireGuard o) => o -> m Word32 Source #

Get the value of the “listen-port” property. When overloading is enabled, this is equivalent to

get settingWireGuard #listenPort

setSettingWireGuardListenPort :: (MonadIO m, IsSettingWireGuard o) => o -> Word32 -> m () Source #

Set the value of the “listen-port” property. When overloading is enabled, this is equivalent to

set settingWireGuard [ #listenPort := value ]

mtu

If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple fragments.

If zero a default MTU is used. Note that contrary to wg-quick's MTU setting, this does not take into account the current routes at the time of activation.

Since: 1.16

constructSettingWireGuardMtu :: (IsSettingWireGuard o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “mtu” property. This is rarely needed directly, but it is used by new.

getSettingWireGuardMtu :: (MonadIO m, IsSettingWireGuard o) => o -> m Word32 Source #

Get the value of the “mtu” property. When overloading is enabled, this is equivalent to

get settingWireGuard #mtu

setSettingWireGuardMtu :: (MonadIO m, IsSettingWireGuard o) => o -> Word32 -> m () Source #

Set the value of the “mtu” property. When overloading is enabled, this is equivalent to

set settingWireGuard [ #mtu := value ]

peerRoutes

Whether to automatically add routes for the AllowedIPs ranges of the peers. If True (the default), NetworkManager will automatically add routes in the routing tables according to ipv4.route-table and ipv6.route-table. Usually you want this automatism enabled. If False, no such routes are added automatically. In this case, the user may want to configure static routes in ipv4.routes and ipv6.routes, respectively.

Note that if the peer's AllowedIPs is "0.0.0.0/0" or "::/0" and the profile's ipv4.never-default or ipv6.never-default setting is enabled, the peer route for this peer won't be added automatically.

Since: 1.16

constructSettingWireGuardPeerRoutes :: (IsSettingWireGuard o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “peer-routes” property. This is rarely needed directly, but it is used by new.

getSettingWireGuardPeerRoutes :: (MonadIO m, IsSettingWireGuard o) => o -> m Bool Source #

Get the value of the “peer-routes” property. When overloading is enabled, this is equivalent to

get settingWireGuard #peerRoutes

setSettingWireGuardPeerRoutes :: (MonadIO m, IsSettingWireGuard o) => o -> Bool -> m () Source #

Set the value of the “peer-routes” property. When overloading is enabled, this is equivalent to

set settingWireGuard [ #peerRoutes := value ]

privateKey

The 256 bit private-key in base64 encoding.

Since: 1.16

clearSettingWireGuardPrivateKey :: (MonadIO m, IsSettingWireGuard o) => o -> m () Source #

Set the value of the “private-key” property to Nothing. When overloading is enabled, this is equivalent to

clear #privateKey

constructSettingWireGuardPrivateKey :: (IsSettingWireGuard o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “private-key” property. This is rarely needed directly, but it is used by new.

getSettingWireGuardPrivateKey :: (MonadIO m, IsSettingWireGuard o) => o -> m Text Source #

Get the value of the “private-key” property. When overloading is enabled, this is equivalent to

get settingWireGuard #privateKey

setSettingWireGuardPrivateKey :: (MonadIO m, IsSettingWireGuard o) => o -> Text -> m () Source #

Set the value of the “private-key” property. When overloading is enabled, this is equivalent to

set settingWireGuard [ #privateKey := value ]

privateKeyFlags

Flags indicating how to handle the SettingWirelessSecurity:private-key property.

Since: 1.16

constructSettingWireGuardPrivateKeyFlags :: (IsSettingWireGuard o, MonadIO m) => [SettingSecretFlags] -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “private-key-flags” property. This is rarely needed directly, but it is used by new.

getSettingWireGuardPrivateKeyFlags :: (MonadIO m, IsSettingWireGuard o) => o -> m [SettingSecretFlags] Source #

Get the value of the “private-key-flags” property. When overloading is enabled, this is equivalent to

get settingWireGuard #privateKeyFlags

setSettingWireGuardPrivateKeyFlags :: (MonadIO m, IsSettingWireGuard o) => o -> [SettingSecretFlags] -> m () Source #

Set the value of the “private-key-flags” property. When overloading is enabled, this is equivalent to

set settingWireGuard [ #privateKeyFlags := value ]