aboutsummaryrefslogtreecommitdiff
path: root/plugin/normalize_test.go (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-06-04Fix IPv6 case for CIDR format reverse zones (#4652)Gravatar Chris O'Haver 1-1/+45
* fix ipv6 case for cidr.Class Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * add check and test case for invalid ipv6 cidr Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * net package is bad at detecting ipv6/ipv4 Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * rename Class -> Split Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-05-27deprecate Normalize and MustNormalize (#4648)Gravatar Chris O'Haver 1-2/+2
* deprecate normalize and mustnormalize Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * add runtime warning Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * elaborate runtime warning Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * include caller info Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-05-17reverse zone: fix Normalize (#4621)Gravatar Miek Gieben 1-48/+22
Make normalize return multiple "hosts" (= reverse zones) when a non-octet boundary cidr is given. Added pkg/cidr package that holds the cidr calculation routines; felt they didn't really fit dnsutil. This change means the IPNet return parameter isn't needed, the hosts are all correct. The tests that tests this is also removed: TestSplitHostPortReverse The fallout was that zoneAddr _also_ doesn't need the IPNet member, that in turn make it visible that zoneAddr in address.go duplicated a bunch of stuff from register.go; removed/refactored that too. Created a plugin.OriginsFromArgsOrServerBlock to help plugins do the right things, by consuming ZONE arguments; this now expands reverse zones correctly. This is mostly mechanical. Remove the reverse test in plugin/kubernetes which is a copy-paste from a core test (which has since been fixed). Remove MustNormalize as it has no plugin users. This change is not backwards compatible to plugins that have a ZONE argument that they parse in the setup util. All in-tree plugins have been updated. Signed-off-by: Miek Gieben <miek@miek.nl>
2019-10-19add MustNormalize (#3385)Gravatar Chris O'Haver 1-0/+11
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2019-01-19Stop importing testing in the main binary (#2479)Gravatar Miek Gieben 1-3/+3
* Stop importing testing in the main binary Stop importing "testing" into the main binary: * test/helpers.go imported it; remote that and change function signature * update all tests that use this Signed-off-by: Miek Gieben <miek@miek.nl> * Drop import testing from metrics plugin Signed-off-by: Miek Gieben <miek@miek.nl> * more fiddling Signed-off-by: Miek Gieben <miek@miek.nl>
2017-10-24CIDR query routing (#1159)Gravatar Miek Gieben 1-1/+29
* core: allow all CIDR ranges in zone specifications Allow (e.g.) a v4 reverse on a /17. If a zone is specified in such a way a FilterFunc is set in the config. This filter is checked against incoming queries. For all other queries this adds a 'x != nil' check which will not impact performace too much. Benchmark function is added as well to check for this as wel. Add multiple tests in tests/server_reverse_test.go. Benchmark shows in the non-reverse case this hardly impact the speed: ~~~ classless: pkg: github.com/coredns/coredns/core/dnsserver BenchmarkCoreServeDNS-4 1000000 1431 ns/op 16 B/op 1 allocs/op pkg: github.com/coredns/coredns/core/dnsserver BenchmarkCoreServeDNS-4 1000000 1429 ns/op 16 B/op 1 allocs/op master: pkg: github.com/coredns/coredns/core/dnsserver BenchmarkCoreServeDNS-4 1000000 1412 ns/op 16 B/op 1 allocs/op pkg: github.com/coredns/coredns/core/dnsserver BenchmarkCoreServeDNS-4 1000000 1429 ns/op 16 B/op 1 allocs/op ~~~ * README.md updates
2017-09-14Remove the word middleware (#1067)Gravatar Miek Gieben 1-0/+84
* Rename middleware to plugin first pass; mostly used 'sed', few spots where I manually changed text. This still builds a coredns binary. * fmt error * Rename AddMiddleware to AddPlugin * Readd AddMiddleware to remain backwards compat