From 2517c00a0bd25620b65006d82d3d20ffb1208d00 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Wed, 24 Feb 2021 16:20:22 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=86=E7=BE=A4=E5=81=A5=E5=BA=B7=E6=A3=80?= =?UTF-8?q?=E6=9F=A5URL=E4=B8=AD=E5=8F=AF=E4=BB=A5=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E4=B8=BB=E6=9C=BA=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/tasks/health_check_executor.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/tasks/health_check_executor.go b/internal/tasks/health_check_executor.go index 97f3b702..89c5a8be 100644 --- a/internal/tasks/health_check_executor.go +++ b/internal/tasks/health_check_executor.go @@ -1,6 +1,7 @@ package tasks import ( + "context" "crypto/tls" "encoding/json" "github.com/TeaOSLab/EdgeAPI/internal/db/models" @@ -10,6 +11,7 @@ import ( "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/logs" "github.com/iwind/TeaGo/types" + "net" "net/http" "strconv" "strings" @@ -176,6 +178,13 @@ func (this *HealthCheckExecutor) checkNode(healthCheckConfig *serverconfigs.Heal client := &http.Client{ Timeout: timeout, Transport: &http.Transport{ + DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { + _, port, err := net.SplitHostPort(addr) + if err != nil { + return nil, err + } + return net.Dial(network, result.NodeAddr+":"+port) + }, MaxIdleConns: 1, MaxIdleConnsPerHost: 1, MaxConnsPerHost: 1,