重构所有udp部分的代码! 摒弃了过去非常复杂的upd转发机制;

不再使用 UDP_Putter 等机制去转发udp,而是用一个 netLayer.MsgConn 结构

proxy.Server 和 proxy.Client 接口改动,

Client在握手udp时不再使用handshake方法, 而是用新的 EstablishUDPChannel 方法

Server 在 Handshake时会选择性返回两种接口,io.ReadWriteCloser 用于tcp, netLayer.MsgConn 用于 udp

此时vless、socks5、direct 的udp转发都已经成功经过了 go test 验证, 但是 main.go 还未修改。
This commit is contained in:
hahahrfool
2022-04-08 13:49:56 +08:00
parent d3ec3fddcd
commit 447bd8749a
22 changed files with 766 additions and 741 deletions

View File

@@ -82,6 +82,7 @@ func NewServer() (proxy.Server, error) {
}
func (d *Server) Name() string { return name }
func (s *Server) Handshake(underlay net.Conn) (io.ReadWriteCloser, netLayer.Addr, error) {
return underlay, s.targetAddr, nil
//因为dokodemo的单目标性质, 不会建立任何udp通道.
func (s *Server) Handshake(underlay net.Conn) (io.ReadWriteCloser, netLayer.MsgConn, netLayer.Addr, error) {
return underlay, nil, s.targetAddr, nil
}