Files
sam3/SAMConn.go

71 lines
1.2 KiB
Go
Raw Normal View History

2015-10-15 17:21:11 -04:00
package sam3
import (
"net"
2016-02-10 17:54:17 -05:00
"time"
2021-10-04 21:00:03 -04:00
2022-05-03 00:21:09 -04:00
"github.com/eyedeekay/i2pkeys"
2015-10-15 17:21:11 -04:00
)
2019-06-12 23:41:17 -04:00
/*
import (
2022-03-10 01:01:31 -05:00
. "github.com/eyedeekay/i2pkeys"
)
2019-06-12 23:41:17 -04:00
*/
2015-10-15 17:21:11 -04:00
// Implements net.Conn
type SAMConn struct {
laddr i2pkeys.I2PAddr
raddr i2pkeys.I2PAddr
2016-02-10 17:54:17 -05:00
conn net.Conn
2015-10-15 17:21:11 -04:00
}
// Implements net.Conn
2019-02-09 17:01:29 -05:00
func (sc *SAMConn) Read(buf []byte) (int, error) {
2015-10-15 17:21:11 -04:00
n, err := sc.conn.Read(buf)
return n, err
}
// Implements net.Conn
2019-02-09 17:01:29 -05:00
func (sc *SAMConn) Write(buf []byte) (int, error) {
2015-10-15 17:21:11 -04:00
n, err := sc.conn.Write(buf)
return n, err
}
// Implements net.Conn
2019-02-09 17:01:29 -05:00
func (sc *SAMConn) Close() error {
2015-10-15 17:21:11 -04:00
return sc.conn.Close()
}
2019-02-09 17:01:29 -05:00
func (sc *SAMConn) LocalAddr() net.Addr {
2016-02-10 17:54:17 -05:00
return sc.localAddr()
}
2015-10-15 17:21:11 -04:00
// Implements net.Conn
func (sc *SAMConn) localAddr() i2pkeys.I2PAddr {
2015-10-15 17:21:11 -04:00
return sc.laddr
}
2019-02-09 17:01:29 -05:00
func (sc *SAMConn) RemoteAddr() net.Addr {
2016-02-10 17:54:17 -05:00
return sc.remoteAddr()
}
2015-10-15 17:21:11 -04:00
// Implements net.Conn
func (sc *SAMConn) remoteAddr() i2pkeys.I2PAddr {
2015-10-15 17:21:11 -04:00
return sc.raddr
}
// Implements net.Conn
2019-02-09 17:01:29 -05:00
func (sc *SAMConn) SetDeadline(t time.Time) error {
2015-10-15 17:21:11 -04:00
return sc.conn.SetDeadline(t)
}
// Implements net.Conn
2019-02-09 17:01:29 -05:00
func (sc *SAMConn) SetReadDeadline(t time.Time) error {
2015-10-15 17:21:11 -04:00
return sc.conn.SetReadDeadline(t)
}
// Implements net.Conn
2019-02-09 17:01:29 -05:00
func (sc *SAMConn) SetWriteDeadline(t time.Time) error {
2015-10-15 17:21:11 -04:00
return sc.conn.SetWriteDeadline(t)
}