small fixes to peerlist -> endpoint generation

This commit is contained in:
Lyn 2024-11-14 01:32:43 +01:00
parent ad3d196a1e
commit 232faef5c0
2 changed files with 12 additions and 4 deletions

View file

@ -90,8 +90,8 @@ in {
type = lib.types.submodule { type = lib.types.submodule {
options = { options = {
public = lib.mkOption { public = lib.mkOption {
type = lib.types.nullOr lib.types.str; type = lib.types.str;
default = null; default = "";
description = "Public IPv4 address"; description = "Public IPv4 address";
}; };
internal = lib.mkOption { internal = lib.mkOption {
@ -107,7 +107,8 @@ in {
type = lib.types.submodule { type = lib.types.submodule {
options = { options = {
public = lib.mkOption { public = lib.mkOption {
type = lib.types.nullOr lib.types.str; type = lib.types.str;
default = "";
description = "Public IPv6 address"; description = "Public IPv6 address";
}; };
internal = lib.mkOption { internal = lib.mkOption {

View file

@ -21,7 +21,10 @@
lib.mapAttrsToList (name: host: { lib.mapAttrsToList (name: host: {
pubkey = host.wg.pubkey; pubkey = host.wg.pubkey;
#if there is no public IP, make endpoint null so wgautomesh knows it unknown #if there is no public IP, make endpoint null so wgautomesh knows it unknown
endpoint = host.${version}.public; endpoint =
if host.${version}.public == ""
then null
else "${host.${version}.public}:${toString host.wg.port}";
address = host.${version}.internal; address = host.${version}.internal;
}) })
filteredHosts; filteredHosts;
@ -46,6 +49,7 @@ in {
privateKeyFile = "/var/lib/wireguard-keys/private"; privateKeyFile = "/var/lib/wireguard-keys/private";
mtu = 1420; mtu = 1420;
}; };
services.wgautomesh = { services.wgautomesh = {
enable = true; enable = true;
settings = { settings = {
@ -57,6 +61,9 @@ in {
upnp_forward_external_port = wireguardPort; upnp_forward_external_port = wireguardPort;
}; };
gossipSecretFile = gossip_secret_path; gossipSecretFile = gossip_secret_path;
#DEBUG
logLevel = "trace";
}; };
}; };
} }