From 1faad7338164fee305ea8446c10007198add3597 Mon Sep 17 00:00:00 2001 From: Dreamacro <8615343+dreamacro@users.noreply.github.com> Date: Mon, 16 Oct 2023 09:27:55 +0800 Subject: [PATCH] fix: socks5 udp associate --- adapter/outbound/socks5.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/adapter/outbound/socks5.go b/adapter/outbound/socks5.go index 864500c5..43dfe8ef 100644 --- a/adapter/outbound/socks5.go +++ b/adapter/outbound/socks5.go @@ -7,6 +7,7 @@ import ( "fmt" "io" "net" + "net/netip" "strconv" N "github.com/Dreamacro/clash/common/net" @@ -136,7 +137,8 @@ func (ss *Socks5) ListenPacketContext(ctx context.Context, metadata *C.Metadata, } } - bindAddr, err := socks5.ClientHandshake(c, serializesSocksAddr(metadata), socks5.CmdUDPAssociate, user) + udpAssocateAddr := socks5.AddrFromStdAddrPort(netip.AddrPortFrom(netip.IPv4Unspecified(), 0)) + bindAddr, err := socks5.ClientHandshake(c, udpAssocateAddr, socks5.CmdUDPAssociate, user) if err != nil { err = fmt.Errorf("client hanshake error: %w", err) return