mirror of
https://github.com/ICKelin/opennotr.git
synced 2025-09-27 12:12:07 +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)
|
||||
}()
|
||||
|
||||
go func() {
|
||||
defer remoteConn.Close()
|
||||
defer stream.Close()
|
||||
io.Copy(stream, remoteConn)
|
||||
}()
|
||||
}
|
||||
|
||||
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 stream.Close()
|
||||
buf := make([]byte, 64*1024)
|
||||
@@ -195,7 +192,6 @@ func (c *Client) udpProxy(stream *yamux.Stream, p *proto.ProxyProtocol) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func encode(raw []byte) []byte {
|
||||
|
Reference in New Issue
Block a user