Add EDNS0_SUBNET rewrite (#1022)
* Add EDNS0_SUBNET rewrite * Fix review comments * Update comment * Fix according to review comments * Add ResponseWriter6 instead of parameterized the existing ResponseWriter
This commit is contained in:
parent
bcdc99ab11
commit
8e5d0a23fa
4 changed files with 276 additions and 1 deletions
|
@ -42,3 +42,20 @@ func (t *ResponseWriter) TsigTimersOnly(bool) { return }
|
|||
|
||||
// Hijack implement dns.ResponseWriter interface.
|
||||
func (t *ResponseWriter) Hijack() { return }
|
||||
|
||||
// RepsponseWrite6 returns fixed client and remote address in IPv6. The remote
|
||||
// address is always fe80::42:ff:feca:4c65 and port 40212. The local address
|
||||
// is always ::1 and port 53.
|
||||
type ResponseWriter6 struct {
|
||||
ResponseWriter
|
||||
}
|
||||
|
||||
// LocalAddr returns the local address, always ::1, port 53 (UDP).
|
||||
func (t *ResponseWriter6) LocalAddr() net.Addr {
|
||||
return &net.UDPAddr{IP: net.ParseIP("::1"), Port: 53, Zone: ""}
|
||||
}
|
||||
|
||||
// RemoteAddr returns the remote address, always fe80::42:ff:feca:4c65 port 40212 (UDP).
|
||||
func (t *ResponseWriter6) RemoteAddr() net.Addr {
|
||||
return &net.UDPAddr{IP: net.ParseIP("fe80::42:ff:feca:4c65"), Port: 40212, Zone: ""}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue