forked from Ivasoft/traefik
Differentiate UDP stream and TCP connection in logs
This commit is contained in:
@@ -20,14 +20,14 @@ func NewProxy(address string) (*Proxy, error) {
|
||||
|
||||
// ServeUDP implements the Handler interface.
|
||||
func (p *Proxy) ServeUDP(conn *Conn) {
|
||||
log.WithoutContext().Debugf("Handling connection from %s to %s", conn.rAddr, p.target)
|
||||
log.WithoutContext().Debugf("Handling UDP stream from %s to %s", conn.rAddr, p.target)
|
||||
|
||||
// needed because of e.g. server.trackedConnection
|
||||
defer conn.Close()
|
||||
|
||||
connBackend, err := net.Dial("udp", p.target)
|
||||
if err != nil {
|
||||
log.WithoutContext().Errorf("Error while connecting to backend: %v", err)
|
||||
log.WithoutContext().Errorf("Error while dialing backend: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ func (p *Proxy) ServeUDP(conn *Conn) {
|
||||
|
||||
err = <-errChan
|
||||
if err != nil {
|
||||
log.WithoutContext().Errorf("Error while serving UDP: %v", err)
|
||||
log.WithoutContext().Errorf("Error while handling UDP stream: %v", err)
|
||||
}
|
||||
|
||||
<-errChan
|
||||
@@ -55,6 +55,6 @@ func connCopy(dst io.WriteCloser, src io.Reader, errCh chan error) {
|
||||
errCh <- err
|
||||
|
||||
if err := dst.Close(); err != nil {
|
||||
log.WithoutContext().Debugf("Error while terminating connection: %v", err)
|
||||
log.WithoutContext().Debugf("Error while terminating UDP stream: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user