mirror of
https://github.com/ICKelin/opennotr.git
synced 2025-10-01 06:02:13 +08:00
refactor: simplify client goroutine
This commit is contained in:
@@ -133,11 +133,9 @@ func (c *Client) tcpProxy(stream *yamux.Stream, p *proto.ProxyProtocol) {
|
|||||||
io.Copy(remoteConn, stream)
|
io.Copy(remoteConn, stream)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
go func() {
|
|
||||||
defer remoteConn.Close()
|
defer remoteConn.Close()
|
||||||
defer stream.Close()
|
defer stream.Close()
|
||||||
io.Copy(stream, remoteConn)
|
io.Copy(stream, remoteConn)
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) udpProxy(stream *yamux.Stream, p *proto.ProxyProtocol) {
|
func (c *Client) udpProxy(stream *yamux.Stream, p *proto.ProxyProtocol) {
|
||||||
@@ -177,7 +175,6 @@ func (c *Client) udpProxy(stream *yamux.Stream, p *proto.ProxyProtocol) {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
go func() {
|
|
||||||
defer remoteConn.Close()
|
defer remoteConn.Close()
|
||||||
defer stream.Close()
|
defer stream.Close()
|
||||||
buf := make([]byte, 64*1024)
|
buf := make([]byte, 64*1024)
|
||||||
@@ -195,7 +192,6 @@ func (c *Client) udpProxy(stream *yamux.Stream, p *proto.ProxyProtocol) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func encode(raw []byte) []byte {
|
func encode(raw []byte) []byte {
|
||||||
|
Reference in New Issue
Block a user