mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 02:33:14 -04:00
* Fixing #5376 by adding a check to parse out Zone information Signed-off-by: Tintin <samrath.sodi@gmail.com> * using IndexByte instead of strings.Split() Signed-off-by: Tintin <samrath.sodi@gmail.com> * using plugin logger for logging parsing failure Signed-off-by: Tintin <samrath.sodi@gmail.com> * using var keywork instead of short declaration operator Signed-off-by: Tintin <samrath.sodi@gmail.com> * reordering imports Signed-off-by: Tintin <samrath.sodi@gmail.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
type ResponseWriter struct {
|
||||
TCP bool // if TCP is true we return an TCP connection instead of an UDP one.
|
||||
RemoteIP string
|
||||
Zone string
|
||||
}
|
||||
|
||||
// LocalAddr returns the local address, 127.0.0.1:53 (UDP, TCP if t.TCP is true).
|
||||
@@ -33,9 +34,9 @@ func (t *ResponseWriter) RemoteAddr() net.Addr {
|
||||
ip := net.ParseIP(remoteIP)
|
||||
port := 40212
|
||||
if t.TCP {
|
||||
return &net.TCPAddr{IP: ip, Port: port, Zone: ""}
|
||||
return &net.TCPAddr{IP: ip, Port: port, Zone: t.Zone}
|
||||
}
|
||||
return &net.UDPAddr{IP: ip, Port: port, Zone: ""}
|
||||
return &net.UDPAddr{IP: ip, Port: port, Zone: t.Zone}
|
||||
}
|
||||
|
||||
// WriteMsg implements dns.ResponseWriter interface.
|
||||
|
||||
Reference in New Issue
Block a user