mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-25 01:51:29 +00:00
Fix vless tests
This commit is contained in:
parent
6e22c004f6
commit
e8802357e1
|
@ -10,7 +10,7 @@ require (
|
||||||
github.com/docker/docker v20.10.18+incompatible
|
github.com/docker/docker v20.10.18+incompatible
|
||||||
github.com/docker/go-connections v0.4.0
|
github.com/docker/go-connections v0.4.0
|
||||||
github.com/gofrs/uuid v4.4.0+incompatible
|
github.com/gofrs/uuid v4.4.0+incompatible
|
||||||
github.com/sagernet/sing v0.1.8-0.20230228034829-bb617490652c
|
github.com/sagernet/sing v0.1.8-0.20230301160041-9fab0a9f4304
|
||||||
github.com/sagernet/sing-shadowsocks v0.1.2-0.20230221080503-769c01d6bba9
|
github.com/sagernet/sing-shadowsocks v0.1.2-0.20230221080503-769c01d6bba9
|
||||||
github.com/spyzhov/ajson v0.7.1
|
github.com/spyzhov/ajson v0.7.1
|
||||||
github.com/stretchr/testify v1.8.1
|
github.com/stretchr/testify v1.8.1
|
||||||
|
|
|
@ -146,8 +146,8 @@ github.com/sagernet/reality v0.0.0-20230228045158-d3e085a8e5d1 h1:8mSzchN6DkM26J
|
||||||
github.com/sagernet/reality v0.0.0-20230228045158-d3e085a8e5d1/go.mod h1:B8lp4WkQ1PwNnrVMM6KyuFR20pU8jYBD+A4EhJovEXU=
|
github.com/sagernet/reality v0.0.0-20230228045158-d3e085a8e5d1/go.mod h1:B8lp4WkQ1PwNnrVMM6KyuFR20pU8jYBD+A4EhJovEXU=
|
||||||
github.com/sagernet/sing v0.0.0-20220812082120-05f9836bff8f/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY=
|
github.com/sagernet/sing v0.0.0-20220812082120-05f9836bff8f/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY=
|
||||||
github.com/sagernet/sing v0.0.0-20220817130738-ce854cda8522/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY=
|
github.com/sagernet/sing v0.0.0-20220817130738-ce854cda8522/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY=
|
||||||
github.com/sagernet/sing v0.1.8-0.20230228034829-bb617490652c h1:+YUwfoIkKlMi3Y1QrOy+OlIELC9KWV0+/5F3NX72q8U=
|
github.com/sagernet/sing v0.1.8-0.20230301160041-9fab0a9f4304 h1:Yi7wqvHv+ZFLHPQn1DiSAdnMZkb5Cra7Y4s8vzBLrFE=
|
||||||
github.com/sagernet/sing v0.1.8-0.20230228034829-bb617490652c/go.mod h1:jt1w2u7lJQFFSGLiRrRIs5YWmx4kAPfWuOejuDW9qMk=
|
github.com/sagernet/sing v0.1.8-0.20230301160041-9fab0a9f4304/go.mod h1:jt1w2u7lJQFFSGLiRrRIs5YWmx4kAPfWuOejuDW9qMk=
|
||||||
github.com/sagernet/sing-dns v0.1.4 h1:7VxgeoSCiiazDSaXXQVcvrTBxFpOePPq/4XdgnUDN+0=
|
github.com/sagernet/sing-dns v0.1.4 h1:7VxgeoSCiiazDSaXXQVcvrTBxFpOePPq/4XdgnUDN+0=
|
||||||
github.com/sagernet/sing-dns v0.1.4/go.mod h1:1+6pCa48B1AI78lD+/i/dLgpw4MwfnsSpZo0Ds8wzzk=
|
github.com/sagernet/sing-dns v0.1.4/go.mod h1:1+6pCa48B1AI78lD+/i/dLgpw4MwfnsSpZo0Ds8wzzk=
|
||||||
github.com/sagernet/sing-shadowsocks v0.1.2-0.20230221080503-769c01d6bba9 h1:qS39eA4C7x+zhEkySbASrtmb6ebdy5v0y2M6mgkmSO0=
|
github.com/sagernet/sing-shadowsocks v0.1.2-0.20230221080503-769c01d6bba9 h1:qS39eA4C7x+zhEkySbASrtmb6ebdy5v0y2M6mgkmSO0=
|
||||||
|
|
|
@ -36,6 +36,7 @@ func TestVLESSVisionReality(t *testing.T) {
|
||||||
{
|
{
|
||||||
Name: "sekai",
|
Name: "sekai",
|
||||||
UUID: userUUID.String(),
|
UUID: userUUID.String(),
|
||||||
|
Flow: vless.FlowVision,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
TLS: &option.InboundTLSOptions{
|
TLS: &option.InboundTLSOptions{
|
||||||
|
|
|
@ -234,6 +234,7 @@ func testVLESSSelf(t *testing.T, flow string) {
|
||||||
{
|
{
|
||||||
Name: "sekai",
|
Name: "sekai",
|
||||||
UUID: userUUID.String(),
|
UUID: userUUID.String(),
|
||||||
|
Flow: flow,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
TLS: &option.InboundTLSOptions{
|
TLS: &option.InboundTLSOptions{
|
||||||
|
@ -308,6 +309,7 @@ func testVLESSSelfTLS(t *testing.T, flow string) {
|
||||||
{
|
{
|
||||||
Name: "sekai",
|
Name: "sekai",
|
||||||
UUID: userUUID.String(),
|
UUID: userUUID.String(),
|
||||||
|
Flow: flow,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
TLS: &option.InboundTLSOptions{
|
TLS: &option.InboundTLSOptions{
|
||||||
|
|
|
@ -69,7 +69,7 @@ func (s *Service[T]) NewConnection(ctx context.Context, conn net.Conn, metadata
|
||||||
|
|
||||||
userFlow := s.userFlow[user]
|
userFlow := s.userFlow[user]
|
||||||
if request.Flow != userFlow {
|
if request.Flow != userFlow {
|
||||||
return E.New("flow mismatch: expected ", userFlow, ", but got ", request.Flow)
|
return E.New("flow mismatch: expected ", flowName(userFlow), ", but got ", flowName(request.Flow))
|
||||||
}
|
}
|
||||||
|
|
||||||
protocolConn := conn
|
protocolConn := conn
|
||||||
|
@ -94,6 +94,13 @@ func (s *Service[T]) NewConnection(ctx context.Context, conn net.Conn, metadata
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func flowName(value string) string {
|
||||||
|
if value == "" {
|
||||||
|
return "none"
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
type serverConn struct {
|
type serverConn struct {
|
||||||
net.Conn
|
net.Conn
|
||||||
responseWriter io.Writer
|
responseWriter io.Writer
|
||||||
|
|
Loading…
Reference in a new issue