feat(wrapper): add UnwrapConn to remaining TCP conn wrappers
Add UnwrapConn() to the admission, proxyproto, conn limiter, metrics, and observer/stats TCP connection wrappers, complementing the traffic limiter's limitConn added in the previous commit. This makes the unwrapConn() helper in handler/sshd able to peel through any combination of these wrappers uniformly, keeping the pattern complete and future-proof for handlers that assert on concrete connection types.
This commit is contained in:
@@ -45,6 +45,12 @@ func WrapConn(c net.Conn, pStats stats.Stats) net.Conn {
|
||||
}
|
||||
}
|
||||
|
||||
// UnwrapConn returns the underlying connection, allowing type assertions
|
||||
// through wrapper layers.
|
||||
func (c *conn) UnwrapConn() net.Conn {
|
||||
return c.Conn
|
||||
}
|
||||
|
||||
func (c *conn) Read(b []byte) (n int, err error) {
|
||||
n, err = c.Conn.Read(b)
|
||||
c.stats.Add(stats.KindInputBytes, int64(n))
|
||||
|
||||
Reference in New Issue
Block a user