准备测试环境代码

This commit is contained in:
2025-02-25 18:08:57 +08:00
parent 884faae5ba
commit b50dc3d91c
6 changed files with 568 additions and 223 deletions

View File

@@ -0,0 +1,40 @@
package fwd
import (
"net"
"proxy-server/server/pkg/socks5"
"testing"
)
func BenchmarkNoAuth(b *testing.B) {
for i := 0; i < b.N; i++ {
}
}
func BenchmarkUserPassAuth(b *testing.B) {
for i := 0; i < b.N; i++ {
}
}
func fakeRequest() {
conn, err := net.Dial("tcp", "localhost:20001")
if err != nil {
panic(err)
}
// 发送认证请求
_, err = conn.Write([]byte{socks5.SocksVersion, byte(1), byte(socks5.NoAuth)})
if err != nil {
panic(err)
}
// 忽略返回
_, err = conn.Read(make([]byte, 2))
if err != nil {
panic(err)
}
}