From 24446f5149379499a89a9f10caec85e331d3b1fc Mon Sep 17 00:00:00 2001 From: Nathan Johnson Date: Sat, 17 Oct 2020 21:04:49 -0500 Subject: [PATCH] Add RealLocalAddr and UnderlyingConn methods This should allow users to simulate the functionality with LocalAddr() that changed with #7 . --- protocol.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/protocol.go b/protocol.go index 917ee62..dc07a79 100644 --- a/protocol.go +++ b/protocol.go @@ -154,6 +154,16 @@ func (p *Conn) LocalAddr() net.Addr { return p.conn.LocalAddr() } +// RealLocalAddr - this method always returns the LocalAddr() from the underlying conn +func (p *Conn) RealLocalAddr() net.Addr { + return p.conn.LocalAddr() +} + +// UnderlyingConn - this method returns the underlying net.Conn +func (p *Conn) UnderlyingConn() net.Conn { + return p.conn +} + // RemoteAddr returns the address of the client if the proxy // protocol is being used, otherwise just returns the address of // the socket peer. If there is an error parsing the header, the