view: Add IPv6 example match (#7355)

Add an IPv6 source address matching example to the view plugin.

Fixes: https://github.com/coredns/coredns/issues/7354

Signed-off-by: SuperQ <superq@gmail.com>
This commit is contained in:
Ben Kochie
2025-06-05 18:20:24 +02:00
committed by GitHub
parent 67f3ece737
commit 83afff1fec
2 changed files with 30 additions and 6 deletions

View File

@@ -31,6 +31,7 @@ Implement CIDR based split DNS routing. This will return a different
answer for `test.` depending on client's IP address. It returns ...
* `test. 3600 IN A 1.1.1.1`, for queries with a source address in 127.0.0.0/24
* `test. 3600 IN A 2.2.2.2`, for queries with a source address in 192.168.0.0/16
* `test. 3600 IN AAAA 2001:0DB8::1`, for queries with a source address in 2001:0DB8::/32
* `test. 3600 IN A 3.3.3.3`, for all others
```
@@ -52,6 +53,17 @@ answer for `test.` depending on client's IP address. It returns ...
}
}
. {
view v6_example1 {
expr incidr(client_ip(), '2001:0DB8::/32')
}
hosts {
2001:0DB8::1 test
}
}
}
. {
hosts {
3.3.3.3 test