mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 08:44:17 -04:00
plugin/test: Fix documentation (#1948)
Fix documentation and touch up plugin/forward/README.md Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
@@ -62,7 +62,8 @@ forward FROM TO... {
|
|||||||
Requests that match none of these names will be passed through.
|
Requests that match none of these names will be passed through.
|
||||||
* `force_tcp`, use TCP even when the request comes in over UDP.
|
* `force_tcp`, use TCP even when the request comes in over UDP.
|
||||||
* `prefer_udp`, try first using UDP even when the request comes in over TCP. If response is truncated
|
* `prefer_udp`, try first using UDP even when the request comes in over TCP. If response is truncated
|
||||||
(TC flag set in response) then do another attempt over TCP. In case if both `force_tcp` and `prefer_udp`
|
(TC flag set in response) then do another attempt over TCP. In case if both `force_tcp` and
|
||||||
|
`prefer_udp`.
|
||||||
options specified the `force_tcp` takes precedence.
|
options specified the `force_tcp` takes precedence.
|
||||||
* `max_fails` is the number of subsequent failed health checks that are needed before considering
|
* `max_fails` is the number of subsequent failed health checks that are needed before considering
|
||||||
an upstream to be down. If 0, the upstream will never be marked as down (nor health checked).
|
an upstream to be down. If 0, the upstream will never be marked as down (nor health checked).
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ import (
|
|||||||
// remote will always be 10.240.0.1 and port 40212. The local address is always 127.0.0.1 and
|
// remote will always be 10.240.0.1 and port 40212. The local address is always 127.0.0.1 and
|
||||||
// port 53.
|
// port 53.
|
||||||
type ResponseWriter struct {
|
type ResponseWriter struct {
|
||||||
TCP bool
|
TCP bool // if TCP is true we return an TCP connection instead of an UDP one.
|
||||||
}
|
}
|
||||||
|
|
||||||
// LocalAddr returns the local address, always 127.0.0.1:53 (UDP).
|
// LocalAddr returns the local address, 127.0.0.1:53 (UDP, TCP if t.TCP is true).
|
||||||
func (t *ResponseWriter) LocalAddr() net.Addr {
|
func (t *ResponseWriter) LocalAddr() net.Addr {
|
||||||
ip := net.ParseIP("127.0.0.1")
|
ip := net.ParseIP("127.0.0.1")
|
||||||
port := 53
|
port := 53
|
||||||
@@ -23,7 +23,7 @@ func (t *ResponseWriter) LocalAddr() net.Addr {
|
|||||||
return &net.UDPAddr{IP: ip, Port: port, Zone: ""}
|
return &net.UDPAddr{IP: ip, Port: port, Zone: ""}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoteAddr returns the remote address, always 10.240.0.1:40212 (UDP).
|
// RemoteAddr returns the remote address, always 10.240.0.1:40212 (UDP, TCP is t.TCP is true).
|
||||||
func (t *ResponseWriter) RemoteAddr() net.Addr {
|
func (t *ResponseWriter) RemoteAddr() net.Addr {
|
||||||
ip := net.ParseIP("10.240.0.1")
|
ip := net.ParseIP("10.240.0.1")
|
||||||
port := 40212
|
port := 40212
|
||||||
@@ -52,13 +52,12 @@ func (t *ResponseWriter) TsigTimersOnly(bool) { return }
|
|||||||
func (t *ResponseWriter) Hijack() { return }
|
func (t *ResponseWriter) Hijack() { return }
|
||||||
|
|
||||||
// ResponseWriter6 returns fixed client and remote address in IPv6. The remote
|
// ResponseWriter6 returns fixed client and remote address in IPv6. The remote
|
||||||
// address is always fe80::42:ff:feca:4c65 and port 40212. The local address
|
// address is always fe80::42:ff:feca:4c65 and port 40212. The local address is always ::1 and port 53.
|
||||||
// is always ::1 and port 53.
|
|
||||||
type ResponseWriter6 struct {
|
type ResponseWriter6 struct {
|
||||||
ResponseWriter
|
ResponseWriter
|
||||||
}
|
}
|
||||||
|
|
||||||
// LocalAddr returns the local address, always ::1, port 53 (UDP).
|
// LocalAddr returns the local address, always ::1, port 53 (UDP, TCP is t.TCP is true).
|
||||||
func (t *ResponseWriter6) LocalAddr() net.Addr {
|
func (t *ResponseWriter6) LocalAddr() net.Addr {
|
||||||
if t.TCP {
|
if t.TCP {
|
||||||
return &net.TCPAddr{IP: net.ParseIP("::1"), Port: 53, Zone: ""}
|
return &net.TCPAddr{IP: net.ParseIP("::1"), Port: 53, Zone: ""}
|
||||||
@@ -66,7 +65,7 @@ func (t *ResponseWriter6) LocalAddr() net.Addr {
|
|||||||
return &net.UDPAddr{IP: net.ParseIP("::1"), Port: 53, Zone: ""}
|
return &net.UDPAddr{IP: net.ParseIP("::1"), Port: 53, Zone: ""}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoteAddr returns the remote address, always fe80::42:ff:feca:4c65 port 40212 (UDP).
|
// RemoteAddr returns the remote address, always fe80::42:ff:feca:4c65 port 40212 (UDP, TCP is t.TCP is true).
|
||||||
func (t *ResponseWriter6) RemoteAddr() net.Addr {
|
func (t *ResponseWriter6) RemoteAddr() net.Addr {
|
||||||
if t.TCP {
|
if t.TCP {
|
||||||
return &net.TCPAddr{IP: net.ParseIP("fe80::42:ff:feca:4c65"), Port: 40212, Zone: ""}
|
return &net.TCPAddr{IP: net.ParseIP("fe80::42:ff:feca:4c65"), Port: 40212, Zone: ""}
|
||||||
|
|||||||
Reference in New Issue
Block a user