]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/tls: add Conn.NetConn method
authorAgniva De Sarker <agnivade@yahoo.co.in>
Sat, 5 Jun 2021 05:34:37 +0000 (11:04 +0530)
committerAgniva De Sarker <agniva.quicksilver@gmail.com>
Mon, 25 Oct 2021 18:46:45 +0000 (18:46 +0000)
NetConn method gives us access to the underlying net.Conn
value.

Fixes #29257

Change-Id: I68b2a92ed9dab4be9900807c94184f8c0aeb4f72
Reviewed-on: https://go-review.googlesource.com/c/go/+/325250
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Trust: Agniva De Sarker <agniva.quicksilver@gmail.com>
Trust: Katie Hockman <katie@golang.org>

src/crypto/tls/conn.go

index 969f357834c0a5c1733b7b939248ebf07d514510..300e9a233c6c0ae9acca734142e82341ed609f55 100644 (file)
@@ -151,6 +151,13 @@ func (c *Conn) SetWriteDeadline(t time.Time) error {
        return c.conn.SetWriteDeadline(t)
 }
 
+// NetConn returns the underlying connection that is wrapped by c.
+// Note that writing to or reading from this connection directly will corrupt the
+// TLS session.
+func (c *Conn) NetConn() net.Conn {
+       return c.conn
+}
+
 // A halfConn represents one direction of the record layer
 // connection, either sending or receiving.
 type halfConn struct {