防止udp转发时被裸奔;修缮socks udp associate

修订代码,文档,示例

添加 NumErr 结构; 从 handshakeInserver_and_passToOutClient 函数 分离出一个 dialClient 函数。

在socks5包中添加 client.go 文件,以及三个udp相关的客户端请求udp函数

之前的udp associate代码被证明是有很多bug的,现在被我一一修复,并通过了 udp_test.go的测试。
This commit is contained in:
hahahrfool
2022-03-29 19:00:14 +08:00
parent 9e3265817a
commit f2adcdcd45
21 changed files with 505 additions and 137 deletions

View File

@@ -3,8 +3,21 @@ package utils
import (
"bytes"
"fmt"
"strconv"
)
//没啥特殊的
type NumErr struct {
N int
Prefix string
}
func (ne *NumErr) Error() string {
return ne.Prefix + strconv.Itoa(ne.N)
}
//就是带个buffer的普通ErrInErr没啥特殊的
type ErrFirstBuffer struct {
Err error
First *bytes.Buffer