wgautomesh persist state to file
This commit is contained in:
parent
6664affaa0
commit
bb2660792f
2 changed files with 8 additions and 1 deletions
|
@ -250,6 +250,7 @@ in
|
||||||
interface = "wg0";
|
interface = "wg0";
|
||||||
gossipPort = 1666;
|
gossipPort = 1666;
|
||||||
gossipSecretFile = "/var/lib/wgautomesh/gossip_secret";
|
gossipSecretFile = "/var/lib/wgautomesh/gossip_secret";
|
||||||
|
persistFile = "/var/lib/wgautomesh/state";
|
||||||
upnpForwardPublicPort =
|
upnpForwardPublicPort =
|
||||||
let
|
let
|
||||||
us = filter ({ hostname, ...}: hostname == config.networking.hostName) cfg.cluster_nodes;
|
us = filter ({ hostname, ...}: hostname == config.networking.hostName) cfg.cluster_nodes;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
let
|
let
|
||||||
src = builtins.fetchGit {
|
src = builtins.fetchGit {
|
||||||
url = "https://git.deuxfleurs.fr/lx/wgautomesh";
|
url = "https://git.deuxfleurs.fr/lx/wgautomesh";
|
||||||
rev = "43eced6e9aa5935b4553251604207f72bf0214c1";
|
rev = "65e979de801daa5f6ef77ed875e6505aa902fd9c";
|
||||||
};
|
};
|
||||||
wgautomesh = (import src).packages.x86_64-linux.default;
|
wgautomesh = (import src).packages.x86_64-linux.default;
|
||||||
in
|
in
|
||||||
|
@ -27,6 +27,10 @@ in
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
description = "File containing the gossip secret encryption key";
|
description = "File containing the gossip secret encryption key";
|
||||||
};
|
};
|
||||||
|
persistFile = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
description = "Path where to persist known peer addresses";
|
||||||
|
};
|
||||||
lanDiscovery = mkOption {
|
lanDiscovery = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
|
@ -78,6 +82,8 @@ in
|
||||||
extraDefs = (if cfg.lanDiscovery then ["lan_discovery = true"] else [])
|
extraDefs = (if cfg.lanDiscovery then ["lan_discovery = true"] else [])
|
||||||
++ (if (cfg.gossipSecretFile != null)
|
++ (if (cfg.gossipSecretFile != null)
|
||||||
then [''gossip_secret_file = "${cfg.gossipSecretFile}"''] else [])
|
then [''gossip_secret_file = "${cfg.gossipSecretFile}"''] else [])
|
||||||
|
++ (if (cfg.persistFile != null)
|
||||||
|
then [''persist_file = "${cfg.persistFile}"''] else [])
|
||||||
++ (if (cfg.upnpForwardPublicPort != null)
|
++ (if (cfg.upnpForwardPublicPort != null)
|
||||||
then [''upnp_forward_external_port = ${toString cfg.upnpForwardPublicPort}''] else []);
|
then [''upnp_forward_external_port = ${toString cfg.upnpForwardPublicPort}''] else []);
|
||||||
configfile = pkgs.writeText "wgautomesh.toml" ''
|
configfile = pkgs.writeText "wgautomesh.toml" ''
|
||||||
|
|
Loading…
Reference in a new issue