2018-04-19 17:30:40 +03:00
|
|
|
package yggdrasil
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2018-04-25 17:06:13 +03:00
|
|
|
// wrappedConn implements net.Conn
|
2018-04-19 17:30:40 +03:00
|
|
|
type wrappedConn struct {
|
|
|
|
c net.Conn
|
|
|
|
raddr net.Addr
|
|
|
|
}
|
|
|
|
|
2018-04-25 17:06:13 +03:00
|
|
|
// wrappedAddr implements net.Addr
|
2018-04-19 17:30:40 +03:00
|
|
|
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
|
|
|
|
}
|