mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
plugin/forward: Allow Proxy to be used outside of forward plugin. (#5951)
* plugin/forward: Move Proxy into pkg/plugin/proxy, to allow forward.Proxy to be used outside of forward plugin. Signed-off-by: Patrick Downey <patrick.downey@dioadconsulting.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/coredns/coredns/plugin/dnstap/msg"
|
||||
"github.com/coredns/coredns/plugin/pkg/proxy"
|
||||
"github.com/coredns/coredns/request"
|
||||
|
||||
tap "github.com/dnstap/golang-dnstap"
|
||||
@@ -13,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
// toDnstap will send the forward and received message to the dnstap plugin.
|
||||
func toDnstap(f *Forward, host string, state request.Request, opts options, reply *dns.Msg, start time.Time) {
|
||||
func toDnstap(f *Forward, host string, state request.Request, opts proxy.Options, reply *dns.Msg, start time.Time) {
|
||||
h, p, _ := net.SplitHostPort(host) // this is preparsed and can't err here
|
||||
port, _ := strconv.ParseUint(p, 10, 32) // same here
|
||||
ip := net.ParseIP(h)
|
||||
@@ -21,9 +22,9 @@ func toDnstap(f *Forward, host string, state request.Request, opts options, repl
|
||||
var ta net.Addr = &net.UDPAddr{IP: ip, Port: int(port)}
|
||||
t := state.Proto()
|
||||
switch {
|
||||
case opts.forceTCP:
|
||||
case opts.ForceTCP:
|
||||
t = "tcp"
|
||||
case opts.preferUDP:
|
||||
case opts.PreferUDP:
|
||||
t = "udp"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user