OSDN Git Service

Hulk did something
[bytom/vapor.git] / vendor / github.com / miekg / dns / udp_windows.go
1 // +build windows
2
3 package dns
4
5 import "net"
6
7 // SessionUDP holds the remote address
8 type SessionUDP struct {
9         raddr *net.UDPAddr
10 }
11
12 // RemoteAddr returns the remote network address.
13 func (s *SessionUDP) RemoteAddr() net.Addr { return s.raddr }
14
15 // ReadFromSessionUDP acts just like net.UDPConn.ReadFrom(), but returns a session object instead of a
16 // net.UDPAddr.
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)
20         if err != nil {
21                 return n, nil, err
22         }
23         return n, &SessionUDP{raddr.(*net.UDPAddr)}, err
24 }
25
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)
30 }
31
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 }