View Source Wireguardex.DeviceConfigBuilder (Wireguardex v0.1.2)

This module contains functions to create a DeviceConfig which itself represents a configuration that can be set on a Wireguard device (interface).

If an interface exists, the configuration is applied on top of the existing interface's settings. Missing settings are not overwritten or set to defaults.

To crate the default config use device_config/0 then you can apply each function in this module to specify the details.

examples

Examples

iex> res=
...> device_config()
...> |> listen_port(1234)
...> |> fwmark(11111)
...> |> Wireguardex.set_device("wg1234")
...> Wireguardex.delete_device("wg1234")
...> res
:ok

Link to this section Summary

Functions

Creates the default configuration to be then configured with the provided functions.

The fwmark to set on the interface.

The listening port for incoming connections to set on the interface.

A list of peers with their own configurations to set on this interface.

The private encryption key to set on the interface.

The public encryption key to set on the interface.

If true, replace existing peer configurations on the interface.

Link to this section Functions

Creates the default configuration to be then configured with the provided functions.

Link to this function

fwmark(config_builder, fwmark)

View Source

The fwmark to set on the interface.

Link to this function

listen_port(config_builder, listen_port)

View Source

The listening port for incoming connections to set on the interface.

Link to this function

peers(config_builder, peers)

View Source

A list of peers with their own configurations to set on this interface.

Link to this function

private_key(config_builder, private_key)

View Source

The private encryption key to set on the interface.

Link to this function

public_key(config_builder, public_key)

View Source

The public encryption key to set on the interface.

Link to this function

replace_peers(config_builder, replace_peers)

View Source

If true, replace existing peer configurations on the interface.