From 49a26023299e0a11b4ab41b63d5552927708c86a Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Mon, 16 Jan 2023 13:26:30 +0800 Subject: [PATCH] fix: add Upstream to refconn --- common/net/refconn.go | 4 ++++ listener/sing/sing.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/common/net/refconn.go b/common/net/refconn.go index 6d28a2bf..324e6474 100644 --- a/common/net/refconn.go +++ b/common/net/refconn.go @@ -51,6 +51,10 @@ func (c *refConn) SetWriteDeadline(t time.Time) error { return c.conn.SetWriteDeadline(t) } +func (c *refConn) Upstream() any { + return c.conn +} + func NewRefConn(conn net.Conn, ref any) net.Conn { return &refConn{conn: conn, ref: ref} } diff --git a/listener/sing/sing.go b/listener/sing/sing.go index 2780e275..27a9d6ac 100644 --- a/listener/sing/sing.go +++ b/listener/sing/sing.go @@ -48,6 +48,10 @@ func (c *waitCloseConn) RemoteAddr() net.Addr { return c.rAddr } +func (c *waitCloseConn) Upstream() any { + return c.Conn +} + func (h *ListenerHandler) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error { additions := h.Additions if ctxAdditions := getAdditions(ctx); len(ctxAdditions) > 0 {