From 42721f3b758b411ca22dec4e1e022374813c5b88 Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Wed, 12 Apr 2023 18:19:59 +0800 Subject: [PATCH] fix: proxyDialer has a non-nil interface containing nil pointer judgment --- component/proxydialer/proxydialer.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/component/proxydialer/proxydialer.go b/component/proxydialer/proxydialer.go index 8a3ab263..e215ff0f 100644 --- a/component/proxydialer/proxydialer.go +++ b/component/proxydialer/proxydialer.go @@ -42,8 +42,10 @@ func (p proxyDialer) DialContext(ctx context.Context, network, address string) ( if err != nil { return nil, err } - var rAddr net.Addr = currentMeta.UDPAddr() - if rAddr == nil { // the domain name was not resolved, will appear in not stream-oriented udp like Shadowsocks/Tuic + var rAddr net.Addr + if udpAddr := currentMeta.UDPAddr(); udpAddr != nil { + rAddr = udpAddr + } else { // the domain name was not resolved, will appear in not stream-oriented udp like Shadowsocks/Tuic rAddr = N.NewCustomAddr("udp", currentMeta.RemoteAddress(), nil) } return N.NewBindPacketConn(pc, rAddr), nil