mirror of
https://github.com/SagerNet/sing-box.git
synced 2026-04-13 20:28:32 +10:00
Add v2ray QUIC transport
This commit is contained in:
@@ -59,7 +59,7 @@ func testTCP(t *testing.T, clientPort uint16, testPort uint16) {
|
||||
require.NoError(t, testPingPongWithConn(t, testPort, dialTCP))
|
||||
}
|
||||
|
||||
func testSuitHy(t *testing.T, clientPort uint16, testPort uint16) {
|
||||
func testSuitQUIC(t *testing.T, clientPort uint16, testPort uint16) {
|
||||
dialer := socks.NewClient(N.SystemDialer, M.ParseSocksaddrHostPort("127.0.0.1", clientPort), socks.Version5, "", "")
|
||||
dialTCP := func() (net.Conn, error) {
|
||||
return dialer.DialContext(context.Background(), "tcp", M.ParseSocksaddrHostPort("127.0.0.1", testPort))
|
||||
|
||||
@@ -83,7 +83,7 @@ func TestHysteriaSelf(t *testing.T) {
|
||||
},
|
||||
},
|
||||
})
|
||||
testSuitHy(t, clientPort, testPort)
|
||||
testSuitQUIC(t, clientPort, testPort)
|
||||
}
|
||||
|
||||
func TestHysteriaInbound(t *testing.T) {
|
||||
@@ -180,5 +180,5 @@ func TestHysteriaOutbound(t *testing.T) {
|
||||
},
|
||||
},
|
||||
})
|
||||
testSuitHy(t, clientPort, testPort)
|
||||
testSuitQUIC(t, clientPort, testPort)
|
||||
}
|
||||
|
||||
@@ -59,8 +59,7 @@ func TestTrojanSelf(t *testing.T) {
|
||||
_, certPem, keyPem := createSelfSignedCertificate(t, "example.org")
|
||||
startInstance(t, option.Options{
|
||||
Log: &option.LogOptions{
|
||||
Level: "error",
|
||||
Output: "stderr",
|
||||
Level: "error",
|
||||
},
|
||||
Inbounds: []option.Inbound{
|
||||
{
|
||||
|
||||
@@ -229,8 +229,7 @@ func testVMessOutboundWithV2Ray(t *testing.T, security string, uuid uuid.UUID, g
|
||||
func testVMessSelf(t *testing.T, security string, uuid uuid.UUID, alterId int, globalPadding bool, authenticatedLength bool) {
|
||||
startInstance(t, option.Options{
|
||||
Log: &option.LogOptions{
|
||||
Level: "error",
|
||||
Output: "stderr",
|
||||
Level: "error",
|
||||
},
|
||||
Inbounds: []option.Inbound{
|
||||
{
|
||||
|
||||
@@ -45,14 +45,19 @@ func TestVMessWebscoketSelf(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestVMessQUICSelf(t *testing.T) {
|
||||
testVMessWebscoketSelf(t, &option.V2RayTransportOptions{
|
||||
Type: C.V2RayTransportTypeQUIC,
|
||||
})
|
||||
}
|
||||
|
||||
func testVMessWebscoketSelf(t *testing.T, transport *option.V2RayTransportOptions) {
|
||||
user, err := uuid.DefaultGenerator.NewV4()
|
||||
require.NoError(t, err)
|
||||
_, certPem, keyPem := createSelfSignedCertificate(t, "example.org")
|
||||
startInstance(t, option.Options{
|
||||
Log: &option.LogOptions{
|
||||
Level: "error",
|
||||
Output: "stderr",
|
||||
Level: "error",
|
||||
},
|
||||
Inbounds: []option.Inbound{
|
||||
{
|
||||
@@ -122,5 +127,5 @@ func testVMessWebscoketSelf(t *testing.T, transport *option.V2RayTransportOption
|
||||
},
|
||||
},
|
||||
})
|
||||
testSuit(t, clientPort, testPort)
|
||||
testSuitQUIC(t, clientPort, testPort)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user