mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-06 17:29:15 +08:00
another adjustment
This commit is contained in:
@@ -41,6 +41,7 @@ func ServerJoin(networkSettings *models.Network, serverID string) error {
|
|||||||
MacAddress: serverID,
|
MacAddress: serverID,
|
||||||
UDPHolePunch: "no",
|
UDPHolePunch: "no",
|
||||||
IsLocal: networkSettings.IsLocal,
|
IsLocal: networkSettings.IsLocal,
|
||||||
|
LocalRange: networkSettings.LocalRange,
|
||||||
}
|
}
|
||||||
SetNodeDefaults(node)
|
SetNodeDefaults(node)
|
||||||
|
|
||||||
@@ -55,15 +56,15 @@ func ServerJoin(networkSettings *models.Network, serverID string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if node.Endpoint == "" {
|
if node.Endpoint == "" {
|
||||||
if node.IsLocal == "yes" {
|
// if node.IsLocal == "yes" {
|
||||||
var localAddr, localErr = getServerLocalIP(networkSettings)
|
// var localAddr, localErr = getServerLocalIP(networkSettings)
|
||||||
if localErr != nil {
|
// if localErr != nil {
|
||||||
logger.Log(1, "could not acquire local address", localErr.Error())
|
// logger.Log(1, "could not acquire local address", localErr.Error())
|
||||||
} else {
|
// } else {
|
||||||
node.LocalAddress = localAddr
|
// node.LocalAddress = localAddr
|
||||||
node.LocalRange = networkSettings.LocalRange
|
// node.LocalRange = networkSettings.LocalRange
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if node.IsLocal == "yes" && node.LocalAddress != "" {
|
if node.IsLocal == "yes" && node.LocalAddress != "" {
|
||||||
node.Endpoint = node.LocalAddress
|
node.Endpoint = node.LocalAddress
|
||||||
} else {
|
} else {
|
||||||
@@ -446,6 +447,7 @@ func getServerLocalIP(networkSettings *models.Network) (string, error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
for _, address := range currentAddresses {
|
for _, address := range currentAddresses {
|
||||||
|
logger.Log(3, "looking at local address:", address.String())
|
||||||
if currentCIDR.Contains(net.IP(address.Network())) {
|
if currentCIDR.Contains(net.IP(address.Network())) {
|
||||||
logger.Log(1, "setting local ip", address.String())
|
logger.Log(1, "setting local ip", address.String())
|
||||||
return address.String(), nil
|
return address.String(), nil
|
||||||
|
Reference in New Issue
Block a user