https://github.com/senseunit/oneaddr
CoreDNS plugin which returns only first address
https://github.com/senseunit/oneaddr
coredns coredns-plugin
Last synced: about 1 month ago
JSON representation
CoreDNS plugin which returns only first address
- Host: GitHub
- URL: https://github.com/senseunit/oneaddr
- Owner: SenseUnit
- License: mit
- Created: 2024-01-30T10:14:04.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2025-06-09T21:42:40.000Z (10 months ago)
- Last Synced: 2025-06-09T22:29:56.552Z (10 months ago)
- Topics: coredns, coredns-plugin
- Language: Go
- Size: 70.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# oneaddr
## Name
*oneaddr* - filters response and retains only one (first) address
## Description
*oneaddr* will remove all addresses from response except first one.
It is intended to be used with loadbalance plugin.
## Syntax
~~~
oneaddr
~~~
## Examples
Let's consider following configuration for example.org zone. We aim to enable
round-robin loadbalancing, but ensure fair distribution and reveal just one
worker server in the DNS response.
Zone file `db.example.org`:
~~~
$ORIGIN example.org.
@ 3600 IN SOA sns.dns.icann.org. noc.dns.icann.org. 2017042745 7200 3600 1209600 3600
3600 IN NS a.iana-servers.net.
3600 IN NS b.iana-servers.net.
www IN A 127.0.0.1
www IN A 127.0.0.2
www IN A 127.0.0.3
www IN A 127.0.0.4
www IN A 127.0.0.5
www IN A 127.0.0.6
www IN A 127.0.0.7
www IN A 127.0.0.8
www IN A 127.0.0.9
www IN A 127.0.0.10
~~~
CoreDNS configuration:
~~~ corefile
example.org {
file db.example.org
loadbalance
oneaddr
}
~~~
With such configuration only one A-record will be present in the DNS response.
Since *loadbalance* module randomizes order and *oneaddr* picks first address,
IP address in the responses will vary and distribute load across worker servers.