Fix check ss bad udp request #1122

This commit is contained in:
世界 2022-06-28 07:50:04 +08:00
parent 0f2a6f2088
commit 52930a16b2
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
5 changed files with 15 additions and 10 deletions

4
go.mod
View file

@ -16,8 +16,8 @@ require (
github.com/pelletier/go-toml v1.9.5 github.com/pelletier/go-toml v1.9.5
github.com/pires/go-proxyproto v0.6.2 github.com/pires/go-proxyproto v0.6.2
github.com/refraction-networking/utls v1.1.0 github.com/refraction-networking/utls v1.1.0
github.com/sagernet/sing v0.0.0-20220619130320-8793fe5e067d github.com/sagernet/sing v0.0.0-20220627234642-a817f7084d9c
github.com/sagernet/sing-shadowsocks v0.0.0-20220619134218-830a2f478eb1 github.com/sagernet/sing-shadowsocks v0.0.0-20220627234717-689e0165ef2c
github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb
github.com/stretchr/testify v1.7.5 github.com/stretchr/testify v1.7.5
github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e

8
go.sum
View file

@ -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/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/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/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-20220627234642-a817f7084d9c h1:98QC0wtaD648MFPw82KaT1O9LloQgR4ZyIDtNtsno8Y=
github.com/sagernet/sing v0.0.0-20220619130320-8793fe5e067d/go.mod h1:I67R/q5f67xDExL2kL3RLIP7kGJBOPkYXkpRAykgC+E= github.com/sagernet/sing v0.0.0-20220627234642-a817f7084d9c/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-20220627234717-689e0165ef2c h1:Jhgjyb2jXL4GtwJec6/kgeTqaQXsvMiNX2wAkGOSD3I=
github.com/sagernet/sing-shadowsocks v0.0.0-20220619134218-830a2f478eb1/go.mod h1:xk8Hh1hQiTeiY6jHCQjaxxN8M6B94JoGaNx5q61naE8= 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 h1:XfLJSPIOUX+osiMraVgIrMR27uMXnRJWGm1+GL8/63U=
github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb/go.mod h1:bR6DqgcAl1zTcOX8/pE2Qkj9XO00eCNqmKb7lXP8EAg= 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= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=

View file

@ -4,7 +4,6 @@ package shadowsocks_2022
import ( import (
"context" "context"
"github.com/sagernet/sing-shadowsocks" "github.com/sagernet/sing-shadowsocks"
"github.com/sagernet/sing-shadowsocks/shadowaead_2022" "github.com/sagernet/sing-shadowsocks/shadowaead_2022"
C "github.com/sagernet/sing/common" 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) return returnError(err)
} }
for _, buffer := range mb { 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 { if err != nil {
packet.Release()
buf.ReleaseMulti(mb) buf.ReleaseMulti(mb)
return err return err
} }

View file

@ -106,8 +106,10 @@ func (i *MultiUserInbound) Process(ctx context.Context, network net.Network, con
return returnError(err) return returnError(err)
} }
for _, buffer := range mb { 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 { if err != nil {
packet.Release()
buf.ReleaseMulti(mb) buf.ReleaseMulti(mb)
return err return err
} }

View file

@ -105,8 +105,10 @@ func (i *RelayInbound) Process(ctx context.Context, network net.Network, connect
return returnError(err) return returnError(err)
} }
for _, buffer := range mb { 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 { if err != nil {
packet.Release()
buf.ReleaseMulti(mb) buf.ReleaseMulti(mb)
return err return err
} }