diff --git a/listener/sing/sing.go b/listener/sing/sing.go index d22fa44a0..f53844dc1 100644 --- a/listener/sing/sing.go +++ b/listener/sing/sing.go @@ -29,6 +29,7 @@ type waitCloseConn struct { net.Conn wg *sync.WaitGroup close sync.Once + rAddr net.Addr } func (c *waitCloseConn) Close() error { // call from handleTCPConn(connCtx C.ConnContext) @@ -38,6 +39,10 @@ func (c *waitCloseConn) Close() error { // call from handleTCPConn(connCtx C.Con return c.Conn.Close() } +func (c *waitCloseConn) RemoteAddr() net.Addr { + return c.rAddr +} + func (h *ListenerHandler) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error { switch metadata.Destination.Fqdn { case vmess.MuxDestination.Fqdn: @@ -50,7 +55,7 @@ func (h *ListenerHandler) NewConnection(ctx context.Context, conn net.Conn, meta wg := &sync.WaitGroup{} defer wg.Wait() // this goroutine must exit after conn.Close() wg.Add(1) - h.TcpIn <- inbound.NewSocket(target, &waitCloseConn{Conn: conn, wg: wg}, h.Type) + h.TcpIn <- inbound.NewSocket(target, &waitCloseConn{Conn: conn, wg: wg, rAddr: metadata.Source.TCPAddr()}, h.Type) return nil }