From bdf7b8daef4c4eb7fe6db72bb215f7040193e676 Mon Sep 17 00:00:00 2001 From: Mmx233 Date: Fri, 9 Dec 2022 18:58:07 +0800 Subject: [PATCH] =?UTF-8?q?improve:=20=E6=94=AF=E6=8C=81=E7=89=B9=E6=AE=8A?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E7=8A=B6=E6=80=81=E8=B7=B3=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- v1/login.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/v1/login.go b/v1/login.go index 25fc361..d667617 100644 --- a/v1/login.go +++ b/v1/login.go @@ -4,6 +4,7 @@ import ( "encoding/json" "errors" log "github.com/sirupsen/logrus" + "strings" ) func LoginStatus(c *Conf) (online bool, ip string, e error) { @@ -27,7 +28,9 @@ func LoginStatus(c *Conf) (online bool, ip string, e error) { } } - return err.(string) == "ok", ipInterface.(string), nil + // 如果深澜分配的 ip 不是内网 ip,说明已经在线且拥有固定 ip + inet := strings.HasPrefix(ip, "192.168.") || strings.HasPrefix(ip, "10.") || strings.HasPrefix(ip, "172.") + return err.(string) == "ok" || !inet, ipInterface.(string), nil } func DoLogin(clientIP string, c *Conf) error {