mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-05-12 21:18:03 +08:00
chore: speed up inbound test
This commit is contained in:
parent
b59f11f7ac
commit
69ce4d0f8c
@ -11,6 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func testInboundAnyTLS(t *testing.T, inboundOptions inbound.AnyTLSOption, outboundOptions outbound.AnyTLSOption) {
|
func testInboundAnyTLS(t *testing.T, inboundOptions inbound.AnyTLSOption, outboundOptions outbound.AnyTLSOption) {
|
||||||
|
t.Parallel()
|
||||||
inboundOptions.BaseOption = inbound.BaseOption{
|
inboundOptions.BaseOption = inbound.BaseOption{
|
||||||
NameStr: "anytls_inbound",
|
NameStr: "anytls_inbound",
|
||||||
Listen: "127.0.0.1",
|
Listen: "127.0.0.1",
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func testInboundHysteria2(t *testing.T, inboundOptions inbound.Hysteria2Option, outboundOptions outbound.Hysteria2Option) {
|
func testInboundHysteria2(t *testing.T, inboundOptions inbound.Hysteria2Option, outboundOptions outbound.Hysteria2Option) {
|
||||||
|
t.Parallel()
|
||||||
inboundOptions.BaseOption = inbound.BaseOption{
|
inboundOptions.BaseOption = inbound.BaseOption{
|
||||||
NameStr: "hysteria2_inbound",
|
NameStr: "hysteria2_inbound",
|
||||||
Listen: "127.0.0.1",
|
Listen: "127.0.0.1",
|
||||||
|
@ -24,6 +24,7 @@ func (n *notCloseProxyAdapter) Close() error {
|
|||||||
func testSingMux(t *testing.T, tunnel *TestTunnel, out outbound.ProxyAdapter) {
|
func testSingMux(t *testing.T, tunnel *TestTunnel, out outbound.ProxyAdapter) {
|
||||||
t.Run("singmux", func(t *testing.T) {
|
t.Run("singmux", func(t *testing.T) {
|
||||||
for _, protocol := range singMuxProtocolList {
|
for _, protocol := range singMuxProtocolList {
|
||||||
|
protocol := protocol
|
||||||
t.Run(protocol, func(t *testing.T) {
|
t.Run(protocol, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
singMuxOption := outbound.SingMuxOption{
|
singMuxOption := outbound.SingMuxOption{
|
||||||
|
@ -32,9 +32,10 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func testInboundShadowSocks(t *testing.T, inboundOptions inbound.ShadowSocksOption, outboundOptions outbound.ShadowSocksOption) {
|
func testInboundShadowSocks(t *testing.T, inboundOptions inbound.ShadowSocksOption, outboundOptions outbound.ShadowSocksOption) {
|
||||||
|
t.Parallel()
|
||||||
for _, cipher := range shadowsocksCipherList {
|
for _, cipher := range shadowsocksCipherList {
|
||||||
|
cipher := cipher
|
||||||
t.Run(cipher, func(t *testing.T) {
|
t.Run(cipher, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
inboundOptions, outboundOptions := inboundOptions, outboundOptions // don't modify outside options value
|
inboundOptions, outboundOptions := inboundOptions, outboundOptions // don't modify outside options value
|
||||||
inboundOptions.Cipher = cipher
|
inboundOptions.Cipher = cipher
|
||||||
outboundOptions.Cipher = cipher
|
outboundOptions.Cipher = cipher
|
||||||
@ -44,6 +45,7 @@ func testInboundShadowSocks(t *testing.T, inboundOptions inbound.ShadowSocksOpti
|
|||||||
}
|
}
|
||||||
|
|
||||||
func testInboundShadowSocks0(t *testing.T, inboundOptions inbound.ShadowSocksOption, outboundOptions outbound.ShadowSocksOption) {
|
func testInboundShadowSocks0(t *testing.T, inboundOptions inbound.ShadowSocksOption, outboundOptions outbound.ShadowSocksOption) {
|
||||||
|
t.Parallel()
|
||||||
password := shadowsocksPassword32
|
password := shadowsocksPassword32
|
||||||
if strings.Contains(inboundOptions.Cipher, "-128-") {
|
if strings.Contains(inboundOptions.Cipher, "-128-") {
|
||||||
password = shadowsocksPassword16
|
password = shadowsocksPassword16
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func testInboundTrojan(t *testing.T, inboundOptions inbound.TrojanOption, outboundOptions outbound.TrojanOption) {
|
func testInboundTrojan(t *testing.T, inboundOptions inbound.TrojanOption, outboundOptions outbound.TrojanOption) {
|
||||||
|
t.Parallel()
|
||||||
inboundOptions.BaseOption = inbound.BaseOption{
|
inboundOptions.BaseOption = inbound.BaseOption{
|
||||||
NameStr: "trojan_inbound",
|
NameStr: "trojan_inbound",
|
||||||
Listen: "127.0.0.1",
|
Listen: "127.0.0.1",
|
||||||
|
@ -13,31 +13,35 @@ import (
|
|||||||
var tuicCCs = []string{"cubic", "new_reno", "bbr"}
|
var tuicCCs = []string{"cubic", "new_reno", "bbr"}
|
||||||
|
|
||||||
func testInboundTuic(t *testing.T, inboundOptions inbound.TuicOption, outboundOptions outbound.TuicOption) {
|
func testInboundTuic(t *testing.T, inboundOptions inbound.TuicOption, outboundOptions outbound.TuicOption) {
|
||||||
|
t.Parallel()
|
||||||
inboundOptions.Users = map[string]string{userUUID: userUUID}
|
inboundOptions.Users = map[string]string{userUUID: userUUID}
|
||||||
inboundOptions.Token = []string{userUUID}
|
inboundOptions.Token = []string{userUUID}
|
||||||
|
|
||||||
for _, tuicCC := range tuicCCs {
|
for _, tuicCC := range tuicCCs {
|
||||||
t.Run("v4", func(t *testing.T) {
|
tuicCC := tuicCC
|
||||||
|
t.Run(tuicCC, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
inboundOptions, outboundOptions := inboundOptions, outboundOptions // don't modify outside options value
|
t.Run("v4", func(t *testing.T) {
|
||||||
outboundOptions.Token = userUUID
|
inboundOptions, outboundOptions := inboundOptions, outboundOptions // don't modify outside options value
|
||||||
outboundOptions.CongestionController = tuicCC
|
outboundOptions.Token = userUUID
|
||||||
inboundOptions.CongestionController = tuicCC
|
outboundOptions.CongestionController = tuicCC
|
||||||
testInboundTuic0(t, inboundOptions, outboundOptions)
|
inboundOptions.CongestionController = tuicCC
|
||||||
})
|
testInboundTuic0(t, inboundOptions, outboundOptions)
|
||||||
t.Run("v5", func(t *testing.T) {
|
})
|
||||||
t.Parallel()
|
t.Run("v5", func(t *testing.T) {
|
||||||
inboundOptions, outboundOptions := inboundOptions, outboundOptions // don't modify outside options value
|
inboundOptions, outboundOptions := inboundOptions, outboundOptions // don't modify outside options value
|
||||||
outboundOptions.UUID = userUUID
|
outboundOptions.UUID = userUUID
|
||||||
outboundOptions.Password = userUUID
|
outboundOptions.Password = userUUID
|
||||||
outboundOptions.CongestionController = tuicCC
|
outboundOptions.CongestionController = tuicCC
|
||||||
inboundOptions.CongestionController = tuicCC
|
inboundOptions.CongestionController = tuicCC
|
||||||
testInboundTuic0(t, inboundOptions, outboundOptions)
|
testInboundTuic0(t, inboundOptions, outboundOptions)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testInboundTuic0(t *testing.T, inboundOptions inbound.TuicOption, outboundOptions outbound.TuicOption) {
|
func testInboundTuic0(t *testing.T, inboundOptions inbound.TuicOption, outboundOptions outbound.TuicOption) {
|
||||||
|
t.Parallel()
|
||||||
inboundOptions.BaseOption = inbound.BaseOption{
|
inboundOptions.BaseOption = inbound.BaseOption{
|
||||||
NameStr: "tuic_inbound",
|
NameStr: "tuic_inbound",
|
||||||
Listen: "127.0.0.1",
|
Listen: "127.0.0.1",
|
||||||
@ -69,8 +73,9 @@ func testInboundTuic0(t *testing.T, inboundOptions inbound.TuicOption, outboundO
|
|||||||
|
|
||||||
func TestInboundTuic_TLS(t *testing.T) {
|
func TestInboundTuic_TLS(t *testing.T) {
|
||||||
inboundOptions := inbound.TuicOption{
|
inboundOptions := inbound.TuicOption{
|
||||||
Certificate: tlsCertificate,
|
Certificate: tlsCertificate,
|
||||||
PrivateKey: tlsPrivateKey,
|
PrivateKey: tlsPrivateKey,
|
||||||
|
AuthenticationTimeout: 5000,
|
||||||
}
|
}
|
||||||
outboundOptions := outbound.TuicOption{
|
outboundOptions := outbound.TuicOption{
|
||||||
Fingerprint: tlsFingerprint,
|
Fingerprint: tlsFingerprint,
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func testInboundVless(t *testing.T, inboundOptions inbound.VlessOption, outboundOptions outbound.VlessOption) {
|
func testInboundVless(t *testing.T, inboundOptions inbound.VlessOption, outboundOptions outbound.VlessOption) {
|
||||||
|
t.Parallel()
|
||||||
inboundOptions.BaseOption = inbound.BaseOption{
|
inboundOptions.BaseOption = inbound.BaseOption{
|
||||||
NameStr: "vless_inbound",
|
NameStr: "vless_inbound",
|
||||||
Listen: "127.0.0.1",
|
Listen: "127.0.0.1",
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func testInboundVMess(t *testing.T, inboundOptions inbound.VmessOption, outboundOptions outbound.VmessOption) {
|
func testInboundVMess(t *testing.T, inboundOptions inbound.VmessOption, outboundOptions outbound.VmessOption) {
|
||||||
|
t.Parallel()
|
||||||
inboundOptions.BaseOption = inbound.BaseOption{
|
inboundOptions.BaseOption = inbound.BaseOption{
|
||||||
NameStr: "vmess_inbound",
|
NameStr: "vmess_inbound",
|
||||||
Listen: "127.0.0.1",
|
Listen: "127.0.0.1",
|
||||||
|
Loading…
Reference in New Issue
Block a user