refactor + bugs

This commit is contained in:
0xdcarns
2022-04-25 19:33:31 -04:00
parent a6ee8101e6
commit cfb0904bd6
2 changed files with 8 additions and 0 deletions

View File

@@ -144,6 +144,9 @@ func JoinNetwork(cfg *config.ClientConfig, privateKey string) error {
return fmt.Errorf("error decoding node from server %w %s", err, string(bodybytes))
}
node := nodeGET.Node
if nodeGET.Peers == nil {
nodeGET.Peers = []wgtypes.PeerConfig{}
}
// safety check. If returned node from server is local, but not currently configured as local, set to local addr
if cfg.Node.IsLocal != "yes" && node.IsLocal == "yes" && node.LocalRange != "" {
node.LocalAddress, err = ncutils.GetLocalIP(node.LocalRange)