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

@ -26,7 +26,7 @@ const (
)
func init() {
registry.RegisterHandler("dns", NewHandler)
registry.HandlerRegistry().Register("dns", NewHandler)
}
type dnsHandler struct {
@ -101,14 +101,14 @@ func (h *dnsHandler) Handle(ctx context.Context, conn net.Conn) {
defer conn.Close()
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())
}()