From a1c458b76471a6b502b530adccee25e9387c0624 Mon Sep 17 00:00:00 2001 From: Ulric Qin Date: Wed, 17 Aug 2022 10:28:57 +0800 Subject: [PATCH] use hostname:port as identity --- src/server/config/config.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/server/config/config.go b/src/server/config/config.go index fd88504a..9bca30f4 100644 --- a/src/server/config/config.go +++ b/src/server/config/config.go @@ -81,7 +81,11 @@ func MustLoad(fpaths ...string) { os.Exit(1) } - C.Heartbeat.IP = hostname + "+" + fmt.Sprint(os.Getpid()) + if strings.Contains(hostname, "localhost") { + fmt.Println("Warning! hostname contains substring localhost, setting a more unique hostname is recommended") + } + + C.Heartbeat.IP = hostname // if C.Heartbeat.IP == "" { // fmt.Println("heartbeat ip auto got is blank") @@ -315,7 +319,7 @@ func (c *Config) IsDebugMode() bool { // Get preferred outbound ip of this machine func GetOutboundIP() net.IP { - conn, err := net.Dial("udp", "8.8.8.8:80") + conn, err := net.Dial("udp", "223.5.5.5:80") if err != nil { fmt.Println("auto get outbound ip fail:", err) os.Exit(1)