From bde4e8507f95531a487de1de7a5e513efafea64f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Fri, 2 Jun 2023 14:23:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/client_conn_base.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/nodes/client_conn_base.go b/internal/nodes/client_conn_base.go index 35d770d..11201c2 100644 --- a/internal/nodes/client_conn_base.go +++ b/internal/nodes/client_conn_base.go @@ -54,12 +54,13 @@ func (this *BaseClientConn) SetServerId(serverId int64) (goNext bool) { goNext = true // 检查服务相关IP黑名单 - if serverId > 0 && len(this.rawIP) > 0 { + var rawIP = this.RawIP() + if serverId > 0 && len(rawIP) > 0 { // 是否在白名单中 - ok, _, expiresAt := iplibrary.AllowIP(this.rawIP, serverId) + ok, _, expiresAt := iplibrary.AllowIP(rawIP, serverId) if !ok { _ = this.rawConn.Close() - firewalls.DropTemporaryTo(this.rawIP, expiresAt) + firewalls.DropTemporaryTo(rawIP, expiresAt) return false } } @@ -123,8 +124,8 @@ func (this *BaseClientConn) TCPConn() (tcpConn *net.TCPConn, ok bool) { switch conn := this.rawConn.(type) { case *tls.Conn: var internalConn = conn.NetConn() - clientConn, ok := internalConn.(*ClientConn) - if ok { + clientConn, isClientConn := internalConn.(*ClientConn) + if isClientConn { return clientConn.TCPConn() } tcpConn, ok = internalConn.(*net.TCPConn)