1// +build windows 2 3package dns 4 5import "net" 6 7// SessionUDP holds the remote address 8type SessionUDP struct { 9 raddr *net.UDPAddr 10} 11 12// RemoteAddr returns the remote network address. 13func (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. 18func 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 session := &SessionUDP{raddr.(*net.UDPAddr)} 24 return n, session, err 25} 26 27// WriteToSessionUDP acts just like net.UDPConn.WriteTo(), but uses a *SessionUDP instead of a net.Addr. 28// TODO(fastest963): Once go1.10 is released, use WriteMsgUDP. 29func WriteToSessionUDP(conn *net.UDPConn, b []byte, session *SessionUDP) (int, error) { 30 n, err := conn.WriteTo(b, session.raddr) 31 return n, err 32} 33 34// TODO(fastest963): Once go1.10 is released and we can use *MsgUDP methods 35// use the standard method in udp.go for these. 36func setUDPSocketOptions(*net.UDPConn) error { return nil } 37func parseDstFromOOB([]byte, net.IP) net.IP { return nil } 38