|
@@ -2,6 +2,7 @@ package mq
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
+ "os"
|
|
|
|
|
|
mqtt "github.com/eclipse/paho.mqtt.golang"
|
|
|
"github.com/google/uuid"
|
|
@@ -280,7 +281,13 @@ 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 != nil {
|
|
|
+ h.Location = logic.GetHostLocInfo(h.EndpointIP.String(), os.Getenv("IP_INFO_TOKEN"))
|
|
|
+ } else if h.EndpointIPv6 != nil {
|
|
|
+ h.Location = logic.GetHostLocInfo(h.EndpointIPv6.String(), os.Getenv("IP_INFO_TOKEN"))
|
|
|
+ }
|
|
|
+ }
|
|
|
currentHost.EndpointIP = h.EndpointIP
|
|
|
currentHost.EndpointIPv6 = h.EndpointIPv6
|
|
|
currentHost.Interfaces = h.Interfaces
|