add socks5 udp relay

This commit is contained in:
ginuerzh
2021-11-07 23:39:35 +08:00
parent e8f040cbdf
commit 16f34d3e94
39 changed files with 728 additions and 131 deletions

View File

@ -3,6 +3,7 @@ package v5
import (
"context"
"net"
"time"
"github.com/go-gost/gosocks5"
"github.com/go-gost/gost/pkg/handler"
@ -51,7 +52,12 @@ func (h *socks5Handler) handleConnect(ctx context.Context, conn net.Conn, addr s
h.logger.Debug(resp)
}
t := time.Now()
h.logger.Infof("%s <-> %s", conn.RemoteAddr(), addr)
handler.Transport(conn, cc)
h.logger.Infof("%s >-< %s", conn.RemoteAddr(), addr)
h.logger.
WithFields(map[string]interface{}{
"duration": time.Since(t),
}).
Infof("%s >-< %s", conn.RemoteAddr(), addr)
}