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