mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 11:42:43 +08:00
Test: add direct benchmark
This commit is contained in:
parent
c24c375095
commit
f01d4cbb4c
|
@ -15,6 +15,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/Dreamacro/clash/adapter/outbound"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/Dreamacro/clash/constant"
|
||||||
"github.com/Dreamacro/clash/hub/executor"
|
"github.com/Dreamacro/clash/hub/executor"
|
||||||
"github.com/Dreamacro/clash/transport/socks5"
|
"github.com/Dreamacro/clash/transport/socks5"
|
||||||
|
@ -70,7 +71,7 @@ func init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c, err := client.NewClientWithOpts(client.FromEnv)
|
c, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -668,3 +669,8 @@ log-level: silent
|
||||||
time.Sleep(waitTime)
|
time.Sleep(waitTime)
|
||||||
testPingPongWithSocksPort(t, 10000)
|
testPingPongWithSocksPort(t, 10000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Benchmark_Direct(b *testing.B) {
|
||||||
|
proxy := outbound.NewDirect()
|
||||||
|
benchmarkProxy(b, proxy)
|
||||||
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
var isDarwin = false
|
var isDarwin = false
|
||||||
|
|
||||||
func startContainer(cfg *container.Config, hostCfg *container.HostConfig, name string) (string, error) {
|
func startContainer(cfg *container.Config, hostCfg *container.HostConfig, name string) (string, error) {
|
||||||
c, err := client.NewClientWithOpts(client.FromEnv)
|
c, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ func startContainer(cfg *container.Config, hostCfg *container.HostConfig, name s
|
||||||
}
|
}
|
||||||
|
|
||||||
func cleanContainer(id string) error {
|
func cleanContainer(id string) error {
|
||||||
c, err := client.NewClientWithOpts(client.FromEnv)
|
c, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user