mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-08 22:24:17 +08:00
Merge pull request #3537 from gravitl/v1.0.0_fixes
set location if empty on checkin
This commit is contained in:
commit
30869eaf91
1 changed files with 4 additions and 1 deletions
|
@ -281,7 +281,7 @@ func HandleHostCheckin(h, currentHost *models.Host) bool {
|
|||
(h.ListenPort != 0 && h.ListenPort != currentHost.ListenPort) ||
|
||||
(h.WgPublicListenPort != 0 && h.WgPublicListenPort != currentHost.WgPublicListenPort) || (!h.EndpointIPv6.Equal(currentHost.EndpointIPv6))
|
||||
if ifaceDelta { // only save if something changes
|
||||
if !h.EndpointIP.Equal(currentHost.EndpointIP) || !h.EndpointIPv6.Equal(currentHost.EndpointIPv6) {
|
||||
if !h.EndpointIP.Equal(currentHost.EndpointIP) || !h.EndpointIPv6.Equal(currentHost.EndpointIPv6) || currentHost.Location == "" {
|
||||
if h.EndpointIP != nil {
|
||||
h.Location = logic.GetHostLocInfo(h.EndpointIP.String(), os.Getenv("IP_INFO_TOKEN"))
|
||||
} else if h.EndpointIPv6 != nil {
|
||||
|
@ -293,6 +293,9 @@ func HandleHostCheckin(h, currentHost *models.Host) bool {
|
|||
currentHost.Interfaces = h.Interfaces
|
||||
currentHost.DefaultInterface = h.DefaultInterface
|
||||
currentHost.NatType = h.NatType
|
||||
if h.Location != "" {
|
||||
currentHost.Location = h.Location
|
||||
}
|
||||
if h.ListenPort != 0 {
|
||||
currentHost.ListenPort = h.ListenPort
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue