summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2021-11-09 20:37:48 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2021-11-09 20:38:14 +0100
commit28579236a99534a35ed73b423f4eb157f7b3085f (patch)
tree466998de9c0c55e5ba1b16abd72017e77a424389 /pkg
parent3a63a894aa3c88c71a9d8536eef89257859c62cf (diff)
Implement OriginalDestinationAddrgonet-originaldestination
Diffstat (limited to 'pkg')
-rw-r--r--pkg/tcpip/adapters/gonet/gonet.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/tcpip/adapters/gonet/gonet.go b/pkg/tcpip/adapters/gonet/gonet.go
index 1f2bcaf65..16650024f 100644
--- a/pkg/tcpip/adapters/gonet/gonet.go
+++ b/pkg/tcpip/adapters/gonet/gonet.go
@@ -449,6 +449,15 @@ func (c *TCPConn) RemoteAddr() net.Addr {
return fullToTCPAddr(a)
}
+// Extension
+func (c *TCPConn) OriginalDestinationAddr() net.Addr {
+ var v tcpip.OriginalDestinationOption
+ if err := c.ep.GetSockOpt(&v); err != nil {
+ return nil
+ }
+ return fullToTCPAddr(tcpip.FullAddress(v))
+}
+
func (c *TCPConn) newOpError(op string, err error) *net.OpError {
return &net.OpError{
Op: op,