-
Notifications
You must be signed in to change notification settings - Fork 1
/
SAMConn.go
55 lines (45 loc) · 969 Bytes
/
SAMConn.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package sam3
import (
"net"
"time"
)
// Implements net.Conn
type SAMConn struct {
laddr I2PAddr
raddr I2PAddr
conn net.Conn
}
// Implements net.Conn
func (sc SAMConn) Read(buf []byte) (int, error) {
n, err := sc.conn.Read(buf)
return n, err
}
// Implements net.Conn
func (sc SAMConn) Write(buf []byte) (int, error) {
n, err := sc.conn.Write(buf)
return n, err
}
// Implements net.Conn
func (sc SAMConn) Close() error {
return sc.conn.Close()
}
// Implements net.Conn
func (sc SAMConn) LocalAddr() I2PAddr {
return sc.laddr
}
// Implements net.Conn
func (sc SAMConn) RemoteAddr() I2PAddr {
return sc.raddr
}
// Implements net.Conn
func (sc SAMConn) SetDeadline(t time.Time) error {
return sc.conn.SetDeadline(t)
}
// Implements net.Conn
func (sc SAMConn) SetReadDeadline(t time.Time) error {
return sc.conn.SetReadDeadline(t)
}
// Implements net.Conn
func (sc SAMConn) SetWriteDeadline(t time.Time) error {
return sc.conn.SetWriteDeadline(t)
}