mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-05 08:47:35 +08:00
Move public IP services handling to a map-based approach to work for daemon (multiple network configs) and CLI-based setting of the IP services.
This commit is contained in:
@@ -97,6 +97,9 @@ func startGoRoutines(wg *sync.WaitGroup) context.CancelFunc {
|
||||
logger.Log(0, "failed to start ", cfg.Node.Interface, "wg interface", err.Error())
|
||||
}
|
||||
server := cfg.Server.Server
|
||||
if cfg.PublicIPService != "" {
|
||||
config.PublicIPServices[server] = cfg.PublicIPService
|
||||
}
|
||||
if !serverSet[server] {
|
||||
// == subscribe to all nodes for each on machine ==
|
||||
serverSet[server] = true
|
||||
|
@@ -85,7 +85,7 @@ func JoinNetwork(cfg *config.ClientConfig, privateKey string) error {
|
||||
if cfg.Node.IsLocal == "yes" && cfg.Node.LocalAddress != "" {
|
||||
cfg.Node.Endpoint = cfg.Node.LocalAddress
|
||||
} else {
|
||||
cfg.Node.Endpoint, err = ncutils.GetPublicIP(cfg.PublicIPService)
|
||||
cfg.Node.Endpoint, err = ncutils.GetPublicIP()
|
||||
}
|
||||
if err != nil || cfg.Node.Endpoint == "" {
|
||||
logger.Log(0, "network:", cfg.Network, "error setting cfg.Node.Endpoint.")
|
||||
|
@@ -44,7 +44,7 @@ func checkin() {
|
||||
nodeCfg.Network = network
|
||||
nodeCfg.ReadConfig()
|
||||
if nodeCfg.Node.IsStatic != "yes" {
|
||||
extIP, err := ncutils.GetPublicIP(nodeCfg.PublicIPService)
|
||||
extIP, err := ncutils.GetPublicIP()
|
||||
if err != nil {
|
||||
logger.Log(1, "error encountered checking public ip addresses: ", err.Error())
|
||||
}
|
||||
|
Reference in New Issue
Block a user