🌱 Allow to disable DHT

Signed-off-by: Ettore Di Giacinto <mudler@mocaccino.org>
This commit is contained in:
Ettore Di Giacinto
2022-12-08 14:51:11 +01:00
parent 6b13d26a33
commit 8df00fcffe
2 changed files with 10 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ type Kairos struct {
HybridVPN bool `yaml:"hybrid_vpn,omitempty"`
MinimumNodes int `yaml:"minimum_nodes,omitempty"`
SkipAuto bool `yaml:"skip_auto"`
DisableDHT bool `yaml:"disable_dht,omitempty"`
}
type Config struct {

View File

@@ -53,6 +53,10 @@ func SetupAPI(apiAddress, rootDir string, start bool, c *providerConfig.Config)
vpnOpts[k] = v
}
if c.Kairos.DisableDHT {
vpnOpts["EDGEVPNDHT"] = "false"
}
os.MkdirAll("/etc/systemd/system.conf.d/", 0600) //nolint:errcheck
// Setup edgevpn instance
err = utils.WriteEnv(filepath.Join(rootDir, "/etc/systemd/system.conf.d/edgevpn-kairos.env"), vpnOpts)
@@ -99,6 +103,11 @@ func SetupVPN(instance, apiAddress, rootDir string, start bool, c *providerConfi
if token != "" {
vpnOpts["EDGEVPNTOKEN"] = c.Kairos.NetworkToken
}
if c.Kairos.DisableDHT {
vpnOpts["EDGEVPNDHT"] = "false"
}
// Override opts with user-supplied
for k, v := range c.VPN {
vpnOpts[k] = v