fixing dns and various logs

This commit is contained in:
afeiszli
2022-02-05 14:26:19 -05:00
parent 2ae4b1990a
commit 7bf864a387
11 changed files with 106 additions and 40 deletions

View File

@@ -68,13 +68,12 @@ func JoinNetwork(cfg config.ClientConfig, privateKey string) error {
cfg.Node.TrafficKeys.Server = nil
// == end handle keys ==
if cfg.Node.LocalRange != "" && cfg.Node.LocalAddress == "" {
log.Println("local vpn, getting local address from range: " + cfg.Node.LocalRange)
cfg.Node.LocalAddress = getLocalIP(cfg.Node)
} else if cfg.Node.LocalAddress == "" {
if cfg.Node.LocalAddress == "" {
intIP, err := getPrivateAddr()
if err == nil {
cfg.Node.LocalAddress = intIP
} else {
ncutils.PrintLog("error retrieving private address: "+err.Error(), 1)
}
}
@@ -237,6 +236,14 @@ func JoinNetwork(cfg config.ClientConfig, privateKey string) error {
if err != nil {
return err
}
if node.DNSOn == "yes" {
for _, server := range node.NetworkSettings.DefaultServerAddrs {
if server.IsLeader {
go local.SetDNSWithRetry(node.Interface, node.Network, server.Address)
break
}
}
}
if cfg.Daemon != "off" {
err = daemon.InstallDaemon(cfg)
}