From ce606099064b33c150ff07458d63b53df4ec172e Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sat, 18 May 2019 16:16:32 +0100 Subject: [PATCH] Remove wrappedConn as unnecessary --- src/yggdrasil/dial.go | 58 ------------------------------------------- src/yggdrasil/tcp.go | 7 ------ 2 files changed, 65 deletions(-) delete mode 100644 src/yggdrasil/dial.go diff --git a/src/yggdrasil/dial.go b/src/yggdrasil/dial.go deleted file mode 100644 index 7aec419..0000000 --- a/src/yggdrasil/dial.go +++ /dev/null @@ -1,58 +0,0 @@ -package yggdrasil - -import ( - "net" - "time" -) - -// wrappedConn implements net.Conn -type wrappedConn struct { - c net.Conn - raddr net.Addr -} - -// wrappedAddr implements net.Addr -type wrappedAddr struct { - network string - addr string -} - -func (a *wrappedAddr) Network() string { - return a.network -} - -func (a *wrappedAddr) String() string { - return a.addr -} - -func (c *wrappedConn) Write(data []byte) (int, error) { - return c.c.Write(data) -} - -func (c *wrappedConn) Read(data []byte) (int, error) { - return c.c.Read(data) -} - -func (c *wrappedConn) SetDeadline(t time.Time) error { - return c.c.SetDeadline(t) -} - -func (c *wrappedConn) SetReadDeadline(t time.Time) error { - return c.c.SetReadDeadline(t) -} - -func (c *wrappedConn) SetWriteDeadline(t time.Time) error { - return c.c.SetWriteDeadline(t) -} - -func (c *wrappedConn) Close() error { - return c.c.Close() -} - -func (c *wrappedConn) LocalAddr() net.Addr { - return c.c.LocalAddr() -} - -func (c *wrappedConn) RemoteAddr() net.Addr { - return c.raddr -} diff --git a/src/yggdrasil/tcp.go b/src/yggdrasil/tcp.go index 4361ec8..dfb4151 100644 --- a/src/yggdrasil/tcp.go +++ b/src/yggdrasil/tcp.go @@ -255,13 +255,6 @@ func (t *tcp) call(saddr string, options interface{}, sintf string) { if err != nil { return } - conn = &wrappedConn{ - c: conn, - raddr: &wrappedAddr{ - network: "tcp", - addr: saddr, - }, - } t.handler(conn, false, dialerdst.String()) } else { dst, err := net.ResolveTCPAddr("tcp", saddr)