mirror of
https://github.com/e1732a364fed/v2ray_simple.git
synced 2025-10-12 20:20:17 +08:00
修订udp代码; dial配置 添加 fullcone 选项;默认为非fullcone
现在整个程序均通过了go test, main 也可以正常运行了。 Relay_UDP 函数添加流量计数; 发现之前 Relay函数的流量计数 在main.go里参数传反了,导致实际上计数的是上传而不是下载,已修复 对fullcone的情况做了特别考量。MsgConn的 Close函数在fullcone时不能随便被调用。 因此我添加了一个 CloseConnWithRaddr(raddr Addr) error 方法,以及 Fullcone() bool 方法 在utils包的init部分使用 rand 随机种子
This commit is contained in:
@@ -217,6 +217,14 @@ type UDPConn struct {
|
||||
clientSupposedAddr *net.UDPAddr //客户端指定的客户端自己未来将使用的公网UDP的Addr
|
||||
}
|
||||
|
||||
func (u *UDPConn) CloseConnWithRaddr(raddr netLayer.Addr) error {
|
||||
return u.Close()
|
||||
}
|
||||
|
||||
func (u *UDPConn) Fullcone() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
//将远程地址发来的响应 传给客户端
|
||||
func (u *UDPConn) WriteTo(bs []byte, raddr netLayer.Addr) error {
|
||||
|
||||
|
Reference in New Issue
Block a user