aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/tls
diff options
context:
space:
mode:
authorAgniva De Sarker <agnivade@yahoo.co.in>2021-06-05 11:04:37 +0530
committerAgniva De Sarker <agniva.quicksilver@gmail.com>2021-10-25 18:46:45 +0000
commitf47335e653ac37f68ada2b265ce4a2c869a27cae (patch)
treeadcc93889a2f67b13472af967a491dcd8811ccc4 /src/crypto/tls
parent9012996a9a127fd566c72baac5e7d8ba45b4865e (diff)
downloadgo-f47335e653ac37f68ada2b265ce4a2c869a27cae.tar.xz
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>
Diffstat (limited to 'src/crypto/tls')
-rw-r--r--src/crypto/tls/conn.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/crypto/tls/conn.go b/src/crypto/tls/conn.go
index 969f357834..300e9a233c 100644
--- a/src/crypto/tls/conn.go
+++ b/src/crypto/tls/conn.go
@@ -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 {