Browse Source

Chore(tunnel): minify log message

pull/133/head
xjasonlyu 3 years ago
parent
commit
f2cfa15945
  1. 4
      tunnel/tcp.go
  2. 4
      tunnel/udp.go

4
tunnel/tcp.go

@ -56,7 +56,7 @@ func relay(left, right net.Conn) {
go func() { go func() {
defer wg.Done() defer wg.Done()
if err := copyBuffer(right, left); err != nil { if err := copyBuffer(right, left); err != nil {
log.Warnf("[TCP] copy buffer: %v", err) log.Warnf("[TCP] %v", err)
} }
right.SetReadDeadline(time.Now().Add(tcpWaitTimeout)) right.SetReadDeadline(time.Now().Add(tcpWaitTimeout))
}() }()
@ -64,7 +64,7 @@ func relay(left, right net.Conn) {
go func() { go func() {
defer wg.Done() defer wg.Done()
if err := copyBuffer(left, right); err != nil { if err := copyBuffer(left, right); err != nil {
log.Warnf("[TCP] copy buffer: %v", err) log.Warnf("[TCP] %v", err)
} }
left.SetReadDeadline(time.Now().Add(tcpWaitTimeout)) left.SetReadDeadline(time.Now().Add(tcpWaitTimeout))
}() }()

4
tunnel/udp.go

@ -65,14 +65,14 @@ func relayPacket(left net.PacketConn, right net.PacketConn, to net.Addr) {
go func() { go func() {
defer wg.Done() defer wg.Done()
if err := copyPacketBuffer(right, left, to, _udpSessionTimeout); err != nil { if err := copyPacketBuffer(right, left, to, _udpSessionTimeout); err != nil {
log.Warnf("[UDP] copy packet buffer: %v", err) log.Warnf("[UDP] %v", err)
} }
}() }()
go func() { go func() {
defer wg.Done() defer wg.Done()
if err := copyPacketBuffer(left, right, nil, _udpSessionTimeout); err != nil { if err := copyPacketBuffer(left, right, nil, _udpSessionTimeout); err != nil {
log.Warnf("[UDP] copy packet buffer: %v", err) log.Warnf("[UDP] %v", err)
} }
}() }()

Loading…
Cancel
Save