crypto/tls: add Conn.NetConn method

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>
diff --git a/src/crypto/tls/conn.go b/src/crypto/tls/conn.go
index 969f357..300e9a2 100644
--- a/src/crypto/tls/conn.go
+++ b/src/crypto/tls/conn.go
@@ -151,6 +151,13 @@
 	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 {