Skip to content

Commit

Permalink
Fix: SignServer TCP ping for custom port (#2353)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiwangly2 committed Aug 23, 2023
1 parent da9f03f commit d85d697
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmd/gocq/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"image"
"image/png"
"net"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -541,7 +542,18 @@ func signWaitServer() bool {
log.Warnf("连接到签名服务器出现错误: %v", err)
continue
}
r := utils.RunTCPPingLoop(u.Host, 4)
host := u.Hostname()
port := u.Port()
if port == "" {
switch u.Scheme {
case "https":
port = "443"
case "http":
port = "80"
}
}
hostPort := net.JoinHostPort(host, port)
r := utils.RunTCPPingLoop(hostPort, 4)
if r.PacketsLoss > 0 {
log.Warnf("连接到签名服务器出现错误: 丢包%d/%d 时延%dms", r.PacketsLoss, r.PacketsSent, r.AvgTimeMill)
continue
Expand Down

0 comments on commit d85d697

Please sign in to comment.