update registry

This commit is contained in:
ginuerzh
2022-02-27 22:32:15 +08:00
parent 0aee4f0ebd
commit 07132d8de7
115 changed files with 651 additions and 680 deletions

View File

@ -14,8 +14,8 @@ import (
)
func init() {
registry.RegisterHandler("socks5", NewHandler)
registry.RegisterHandler("socks", NewHandler)
registry.HandlerRegistry().Register("socks5", NewHandler)
registry.HandlerRegistry().Register("socks", NewHandler)
}
type socks5Handler struct {
@ -64,14 +64,14 @@ func (h *socks5Handler) Handle(ctx context.Context, conn net.Conn) {
start := time.Now()
log := h.options.Logger.WithFields(map[string]interface{}{
log := h.options.Logger.WithFields(map[string]any{
"remote": conn.RemoteAddr().String(),
"local": conn.LocalAddr().String(),
})
log.Infof("%s <> %s", conn.RemoteAddr(), conn.LocalAddr())
defer func() {
log.WithFields(map[string]interface{}{
log.WithFields(map[string]any{
"duration": time.Since(start),
}).Infof("%s >< %s", conn.RemoteAddr(), conn.LocalAddr())
}()