diff options
author | 2023-03-24 12:55:51 +0000 | |
---|---|---|
committer | 2023-03-24 08:55:51 -0400 | |
commit | f823825f8a34edb85d5d18cd5d2f6f850adf408e (patch) | |
tree | 79d241ab9b4c7c343d806f4041c8efccbe3f9ca0 /plugin/forward/proxy_test.go | |
parent | 47dceabfc6465ba6c5d41472d6602d4ad5c9fb1b (diff) | |
download | coredns-f823825f8a34edb85d5d18cd5d2f6f850adf408e.tar.gz coredns-f823825f8a34edb85d5d18cd5d2f6f850adf408e.tar.zst coredns-f823825f8a34edb85d5d18cd5d2f6f850adf408e.zip |
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>
Diffstat (limited to 'plugin/forward/proxy_test.go')
-rw-r--r-- | plugin/forward/proxy_test.go | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/plugin/forward/proxy_test.go b/plugin/forward/proxy_test.go index 74a0b5c4b..daf5f964c 100644 --- a/plugin/forward/proxy_test.go +++ b/plugin/forward/proxy_test.go @@ -6,9 +6,7 @@ import ( "github.com/coredns/caddy" "github.com/coredns/coredns/plugin/pkg/dnstest" - "github.com/coredns/coredns/plugin/pkg/transport" "github.com/coredns/coredns/plugin/test" - "github.com/coredns/coredns/request" "github.com/miekg/dns" ) @@ -70,30 +68,3 @@ func TestProxyTLSFail(t *testing.T) { t.Fatal("Expected *not* to receive reply, but got one") } } - -func TestProtocolSelection(t *testing.T) { - p := NewProxy("bad_address", transport.DNS) - - stateUDP := request.Request{W: &test.ResponseWriter{}, Req: new(dns.Msg)} - stateTCP := request.Request{W: &test.ResponseWriter{TCP: true}, Req: new(dns.Msg)} - ctx := context.TODO() - - go func() { - p.Connect(ctx, stateUDP, options{}) - p.Connect(ctx, stateUDP, options{forceTCP: true}) - p.Connect(ctx, stateUDP, options{preferUDP: true}) - p.Connect(ctx, stateUDP, options{preferUDP: true, forceTCP: true}) - p.Connect(ctx, stateTCP, options{}) - p.Connect(ctx, stateTCP, options{forceTCP: true}) - p.Connect(ctx, stateTCP, options{preferUDP: true}) - p.Connect(ctx, stateTCP, options{preferUDP: true, forceTCP: true}) - }() - - for i, exp := range []string{"udp", "tcp", "udp", "tcp", "tcp", "tcp", "udp", "tcp"} { - proto := <-p.transport.dial - p.transport.ret <- nil - if proto != exp { - t.Errorf("Unexpected protocol in case %d, expected %q, actual %q", i, exp, proto) - } - } -} |