准备测试环境代码
This commit is contained in:
40
test/server/fwd/auth_test.go
Normal file
40
test/server/fwd/auth_test.go
Normal 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)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user