mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 02:33:14 -04:00
Cleanup ParseHostOrFile (#2100)
Create plugin/pkg/transport that holds the transport related functions. This needed to be a new pkg to prevent cyclic import errors. This cleans up a bunch of duplicated code in core/dnsserver that also tried to parse a transport (now all done in transport.Parse). Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
@@ -192,21 +192,3 @@ func TestOverlapAddressChecker(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestTransport(t *testing.T) {
|
||||
for i, test := range []struct {
|
||||
input string
|
||||
expected string
|
||||
}{
|
||||
{"dns://.:53", TransportDNS},
|
||||
{"2003::1/64.:53", TransportDNS},
|
||||
{"grpc://example.org:1443 ", TransportGRPC},
|
||||
{"tls://example.org ", TransportTLS},
|
||||
{"https://example.org ", TransportHTTPS},
|
||||
} {
|
||||
actual := Transport(test.input)
|
||||
if actual != test.expected {
|
||||
t.Errorf("Test %d: Expected %s but got %s", i, test.expected, actual)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user