7 // SessionUDP holds the remote address
8 type SessionUDP struct {
12 // RemoteAddr returns the remote network address.
13 func (s *SessionUDP) RemoteAddr() net.Addr { return s.raddr }
15 // ReadFromSessionUDP acts just like net.UDPConn.ReadFrom(), but returns a session object instead of a
17 // TODO(fastest963): Once go1.10 is released, use ReadMsgUDP.
18 func ReadFromSessionUDP(conn *net.UDPConn, b []byte) (int, *SessionUDP, error) {
19 n, raddr, err := conn.ReadFrom(b)
23 return n, &SessionUDP{raddr.(*net.UDPAddr)}, err
26 // WriteToSessionUDP acts just like net.UDPConn.WriteTo(), but uses a *SessionUDP instead of a net.Addr.
27 // TODO(fastest963): Once go1.10 is released, use WriteMsgUDP.
28 func WriteToSessionUDP(conn *net.UDPConn, b []byte, session *SessionUDP) (int, error) {
29 return conn.WriteTo(b, session.raddr)
32 // TODO(fastest963): Once go1.10 is released and we can use *MsgUDP methods
33 // use the standard method in udp.go for these.
34 func setUDPSocketOptions(*net.UDPConn) error { return nil }
35 func parseDstFromOOB([]byte, net.IP) net.IP { return nil }