View Source Wireguardex.PeerConfigBuilder (Wireguardex v0.3.0)
This module contains functions to create a PeerConfig
which represents
a peer's configuration of persistent attributes. They do not change over
time and are part of the configuration of a device.
To create the defualt config use peer_config/0
then you can apply each
function in this module to specify the config.
examples
Examples
iex> {:ok, public_key} = Wireguardex.get_public_key(Wireguardex.generate_private_key())
...> res =
...> device_config()
...> |> peers([
...> peer_config()
...> |> Wireguardex.PeerConfigBuilder.public_key(public_key)
...> |> endpoint("127.0.0.1:1234")
...> |> preshared_key(Wireguardex.generate_preshared_key())
...> |> persistent_keepalive_interval(60)
...> |> allowed_ips(["127.0.0.1/16"])
...> ])
...> |> Wireguardex.set_device("wg12345")
...> Wireguardex.delete_device("wg12345")
...> res
:ok
Link to this section Summary
Functions
The allowed ip addresses this peer is allowed to have.
The endpoint this peer listens for connections on (nil
means any).
Creates the default peer configuration that you can then specify which each of the provided functions.
The interval for sending keepalive packets (nil
means disabled).
The preshared key available to both peers (nil
means no PSK is used).
The public key of the peer.
Link to this section Functions
The allowed ip addresses this peer is allowed to have.
The endpoint this peer listens for connections on (nil
means any).
Creates the default peer configuration that you can then specify which each of the provided functions.
persistent_keepalive_interval(peer_config, persistent_keepalive_interval)
View SourceThe interval for sending keepalive packets (nil
means disabled).
The public key of the peer.