优化 socks 解析流程

This commit is contained in:
2025-02-26 13:56:56 +08:00
parent b50dc3d91c
commit 7ee4ded08c
12 changed files with 301 additions and 104 deletions

View File

@@ -6,7 +6,7 @@ import (
"io"
"net"
"proxy-server/pkg/utils"
"proxy-server/server/pkg/socks5"
socks6 "proxy-server/server/fwd/socks"
"reflect"
"testing"
)
@@ -49,7 +49,7 @@ func TestNoAuthAuthenticator_Authenticate(t *testing.T) {
name string
args args
wantWriter string
want *socks5.AuthContext
want *socks6.AuthContext
wantErr bool
}{
// TODO: Add test cases.
@@ -76,7 +76,7 @@ func TestNoAuthAuthenticator_Authenticate(t *testing.T) {
func TestNoAuthAuthenticator_Method(t *testing.T) {
tests := []struct {
name string
want socks5.AuthMethod
want socks6.AuthMethod
}{
// TODO: Add test cases.
}
@@ -93,7 +93,7 @@ func TestNoAuthAuthenticator_Method(t *testing.T) {
func TestService_Run(t *testing.T) {
type fields struct {
Config *Config
connMap map[string]socks5.ProxyData
connMap map[string]socks6.ProxyData
ctrlConnWg utils.CountWaitGroup
dataConnWg utils.CountWaitGroup
}
@@ -124,7 +124,7 @@ func TestService_Run(t *testing.T) {
func TestService_processCtrlConn(t *testing.T) {
type fields struct {
Config *Config
connMap map[string]socks5.ProxyData
connMap map[string]socks6.ProxyData
ctrlConnWg utils.CountWaitGroup
dataConnWg utils.CountWaitGroup
}
@@ -154,7 +154,7 @@ func TestService_processCtrlConn(t *testing.T) {
func TestService_processDataConn(t *testing.T) {
type fields struct {
Config *Config
connMap map[string]socks5.ProxyData
connMap map[string]socks6.ProxyData
ctrlConnWg utils.CountWaitGroup
dataConnWg utils.CountWaitGroup
}
@@ -184,7 +184,7 @@ func TestService_processDataConn(t *testing.T) {
func TestService_startCtrlTun(t *testing.T) {
type fields struct {
Config *Config
connMap map[string]socks5.ProxyData
connMap map[string]socks6.ProxyData
ctrlConnWg utils.CountWaitGroup
dataConnWg utils.CountWaitGroup
}
@@ -215,7 +215,7 @@ func TestService_startCtrlTun(t *testing.T) {
func TestService_startDataTun(t *testing.T) {
type fields struct {
Config *Config
connMap map[string]socks5.ProxyData
connMap map[string]socks6.ProxyData
ctrlConnWg utils.CountWaitGroup
dataConnWg utils.CountWaitGroup
}
@@ -252,7 +252,7 @@ func TestUserPassAuthenticator_Authenticate(t *testing.T) {
name string
args args
wantWriter string
want *socks5.AuthContext
want *socks6.AuthContext
wantErr bool
}{
// TODO: Add test cases.
@@ -279,7 +279,7 @@ func TestUserPassAuthenticator_Authenticate(t *testing.T) {
func TestUserPassAuthenticator_Method(t *testing.T) {
tests := []struct {
name string
want socks5.AuthMethod
want socks6.AuthMethod
}{
// TODO: Add test cases.
}