From 0a139067b8da62805d7e534b85a6652713f7587d Mon Sep 17 00:00:00 2001 From: yusing Date: Sun, 15 Feb 2026 17:22:53 +0800 Subject: [PATCH] fix(acl): add logging for unexpected remote address types in TCP and UDP listeners --- internal/acl/tcp_listener.go | 3 +++ internal/acl/udp_listener.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/internal/acl/tcp_listener.go b/internal/acl/tcp_listener.go index 0597211c..d64461a1 100644 --- a/internal/acl/tcp_listener.go +++ b/internal/acl/tcp_listener.go @@ -5,6 +5,8 @@ import ( "io" "net" "time" + + "github.com/rs/zerolog/log" ) type TCPListener struct { @@ -44,6 +46,7 @@ func (s *TCPListener) Accept() (net.Conn, error) { } addr, ok := c.RemoteAddr().(*net.TCPAddr) if !ok { + log.Error().Msgf("unexpected remote address type: %T, addr: %s", c.RemoteAddr(), c.RemoteAddr().String()) // Not a TCPAddr, drop c.Close() return noConn{}, nil diff --git a/internal/acl/udp_listener.go b/internal/acl/udp_listener.go index 7818bd41..a635318d 100644 --- a/internal/acl/udp_listener.go +++ b/internal/acl/udp_listener.go @@ -4,6 +4,8 @@ import ( "errors" "net" "time" + + "github.com/rs/zerolog/log" ) type UDPListener struct { @@ -33,6 +35,7 @@ func (s *UDPListener) ReadFrom(p []byte) (int, net.Addr, error) { } udpAddr, ok := addr.(*net.UDPAddr) if !ok { + log.Error().Msgf("unexpected remote address type: %T, addr: %s", addr, addr.String()) // Not a UDPAddr, drop continue }