mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
Update github.com/miekg/dns and fix tests that broke as a result. (#265)
This commit is contained in:
15
vendor/github.com/miekg/dns/udp.go
generated
vendored
15
vendor/github.com/miekg/dns/udp.go
generated
vendored
@ -27,8 +27,19 @@ func ReadFromSessionUDP(conn *net.UDPConn, b []byte) (int, *SessionUDP, error) {
|
||||
return n, &SessionUDP{raddr, oob[:oobn]}, err
|
||||
}
|
||||
|
||||
// WriteToSessionUDP acts just like net.UDPConn.WritetTo(), but uses a *SessionUDP instead of a net.Addr.
|
||||
// WriteToSessionUDP acts just like net.UDPConn.WriteTo(), but uses a *SessionUDP instead of a net.Addr.
|
||||
func WriteToSessionUDP(conn *net.UDPConn, b []byte, session *SessionUDP) (int, error) {
|
||||
n, _, err := conn.WriteMsgUDP(b, session.context, session.raddr)
|
||||
oob := correctSource(session.context)
|
||||
n, _, err := conn.WriteMsgUDP(b, oob, session.raddr)
|
||||
return n, err
|
||||
}
|
||||
|
||||
// correctSource takes oob data and returns new oob data with the Src equal to the Dst
|
||||
func correctSource(oob []byte) []byte {
|
||||
dst, err := parseUDPSocketDst(oob)
|
||||
// If the destination could not be determined, ignore.
|
||||
if err != nil || dst == nil {
|
||||
return nil
|
||||
}
|
||||
return marshalUDPSocketSrc(dst)
|
||||
}
|
||||
|
Reference in New Issue
Block a user