From 52930a16b26be61f61098d1b27881759b1e104c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Tue, 28 Jun 2022 07:50:04 +0800 Subject: [PATCH] Fix check ss bad udp request #1122 --- go.mod | 4 ++-- go.sum | 8 ++++---- proxy/shadowsocks_2022/inbound.go | 5 +++-- proxy/shadowsocks_2022/inbound_multi.go | 4 +++- proxy/shadowsocks_2022/inbound_relay.go | 4 +++- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index ff9af5a3..3d478710 100644 --- a/go.mod +++ b/go.mod @@ -16,8 +16,8 @@ require ( github.com/pelletier/go-toml v1.9.5 github.com/pires/go-proxyproto v0.6.2 github.com/refraction-networking/utls v1.1.0 - github.com/sagernet/sing v0.0.0-20220619130320-8793fe5e067d - github.com/sagernet/sing-shadowsocks v0.0.0-20220619134218-830a2f478eb1 + github.com/sagernet/sing v0.0.0-20220627234642-a817f7084d9c + github.com/sagernet/sing-shadowsocks v0.0.0-20220627234717-689e0165ef2c github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb github.com/stretchr/testify v1.7.5 github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e diff --git a/go.sum b/go.sum index 8fba7ed2..77697bff 100644 --- a/go.sum +++ b/go.sum @@ -172,10 +172,10 @@ github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 h1:f/FNXud6gA3MNr github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3/go.mod h1:HgjTstvQsPGkxUsCd2KWxErBblirPizecHcpD3ffK+s= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/sagernet/sing v0.0.0-20220619130320-8793fe5e067d h1:zr8y4wmNIxv6Kkvgqysx8Piy82ATAThEj1jaEf23YQs= -github.com/sagernet/sing v0.0.0-20220619130320-8793fe5e067d/go.mod h1:I67R/q5f67xDExL2kL3RLIP7kGJBOPkYXkpRAykgC+E= -github.com/sagernet/sing-shadowsocks v0.0.0-20220619134218-830a2f478eb1 h1:3GEdnWbuSX4XwSKnxLUB/1rMXUxSVKeyRhEeT7k7N1Q= -github.com/sagernet/sing-shadowsocks v0.0.0-20220619134218-830a2f478eb1/go.mod h1:xk8Hh1hQiTeiY6jHCQjaxxN8M6B94JoGaNx5q61naE8= +github.com/sagernet/sing v0.0.0-20220627234642-a817f7084d9c h1:98QC0wtaD648MFPw82KaT1O9LloQgR4ZyIDtNtsno8Y= +github.com/sagernet/sing v0.0.0-20220627234642-a817f7084d9c/go.mod h1:I67R/q5f67xDExL2kL3RLIP7kGJBOPkYXkpRAykgC+E= +github.com/sagernet/sing-shadowsocks v0.0.0-20220627234717-689e0165ef2c h1:Jhgjyb2jXL4GtwJec6/kgeTqaQXsvMiNX2wAkGOSD3I= +github.com/sagernet/sing-shadowsocks v0.0.0-20220627234717-689e0165ef2c/go.mod h1:ng5pxdNnKZWlxzZTXRqWeY0ftzhScPZmjgJGJeRuPYY= github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb h1:XfLJSPIOUX+osiMraVgIrMR27uMXnRJWGm1+GL8/63U= github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb/go.mod h1:bR6DqgcAl1zTcOX8/pE2Qkj9XO00eCNqmKb7lXP8EAg= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= diff --git a/proxy/shadowsocks_2022/inbound.go b/proxy/shadowsocks_2022/inbound.go index 6ff7fc67..5856871f 100644 --- a/proxy/shadowsocks_2022/inbound.go +++ b/proxy/shadowsocks_2022/inbound.go @@ -4,7 +4,6 @@ package shadowsocks_2022 import ( "context" - "github.com/sagernet/sing-shadowsocks" "github.com/sagernet/sing-shadowsocks/shadowaead_2022" C "github.com/sagernet/sing/common" @@ -86,8 +85,10 @@ func (i *Inbound) Process(ctx context.Context, network net.Network, connection s return returnError(err) } for _, buffer := range mb { - err = i.service.NewPacket(ctx, pc, B.As(buffer.Bytes()).ToOwned(), metadata) + packet := B.As(buffer.Bytes()).ToOwned() + err = i.service.NewPacket(ctx, pc, packet, metadata) if err != nil { + packet.Release() buf.ReleaseMulti(mb) return err } diff --git a/proxy/shadowsocks_2022/inbound_multi.go b/proxy/shadowsocks_2022/inbound_multi.go index 1b1da464..a7fa29bd 100644 --- a/proxy/shadowsocks_2022/inbound_multi.go +++ b/proxy/shadowsocks_2022/inbound_multi.go @@ -106,8 +106,10 @@ func (i *MultiUserInbound) Process(ctx context.Context, network net.Network, con return returnError(err) } for _, buffer := range mb { - err = i.service.NewPacket(ctx, pc, B.As(buffer.Bytes()).ToOwned(), metadata) + packet := B.As(buffer.Bytes()).ToOwned() + err = i.service.NewPacket(ctx, pc, packet, metadata) if err != nil { + packet.Release() buf.ReleaseMulti(mb) return err } diff --git a/proxy/shadowsocks_2022/inbound_relay.go b/proxy/shadowsocks_2022/inbound_relay.go index 77a474a8..fb35b81e 100644 --- a/proxy/shadowsocks_2022/inbound_relay.go +++ b/proxy/shadowsocks_2022/inbound_relay.go @@ -105,8 +105,10 @@ func (i *RelayInbound) Process(ctx context.Context, network net.Network, connect return returnError(err) } for _, buffer := range mb { - err = i.service.NewPacket(ctx, pc, B.As(buffer.Bytes()).ToOwned(), metadata) + packet := B.As(buffer.Bytes()).ToOwned() + err = i.service.NewPacket(ctx, pc, packet, metadata) if err != nil { + packet.Release() buf.ReleaseMulti(mb) return err }