Update readme

This commit is contained in:
Simon Beck 2021-10-05 20:10:45 +02:00
parent 9e473f98dd
commit 086949801e
1 changed files with 173 additions and 7 deletions

180
README.md
View File

@ -1,7 +1,7 @@
# coredns-redis
*coredns-redis* uses [redis](https://redis.io/) as a backend for [coredns](https://coredns.io)
this plugin should be located right next to *etcd* in *plugins.cfg*:
*coredns-redis* uses [redis](https://redis.io/) as a backend for [coredns](https://coredns.io)
this plugin should be located right next to *etcd* in *plugins.cfg*:
```
...
@ -62,19 +62,185 @@ corefile:
## reverse zones
not yet supported
reverse zones is not supported yet
## proxy
not yet supported
proxy is not supported yet
## zone format in redis db
### zones
each zone is stored in redis as a hash map with *zone* as key
~~~
redis-cli>KEYS *
1) "example.com."
2) "example.net."
redis-cli>
~~~
### dns RRs
dns RRs are stored in redis as json strings inside a hash map using address as field key.
*@* is used for zone's own RR values.
#### A
~~~json
{
"a":{
"ip" : "1.2.3.4",
"ttl" : 360
}
}
~~~
#### AAAA
~~~json
{
"aaaa":{
"ip" : "::1",
"ttl" : 360
}
}
~~~
#### CNAME
~~~json
{
"cname":{
"host" : "x.example.com.",
"ttl" : 360
}
}
~~~
#### TXT
~~~json
{
"txt":{
"text" : "this is a text",
"ttl" : 360
}
}
~~~
#### NS
~~~json
{
"ns":{
"host" : "ns1.example.com.",
"ttl" : 360
}
}
~~~
#### MX
~~~json
{
"mx":{
"host" : "mx1.example.com",
"priority" : 10,
"ttl" : 360
}
}
~~~
#### SRV
~~~json
{
"srv":{
"host" : "sip.example.com.",
"port" : 555,
"priority" : 10,
"weight" : 100,
"ttl" : 360
}
}
~~~
#### SOA
~~~json
{
"soa":{
"ttl" : 100,
"mbox" : "hostmaster.example.com.",
"ns" : "ns1.example.com.",
"refresh" : 44,
"retry" : 55,
"expire" : 66
}
}
~~~
#### CAA
~~~json
{
"caa":{
"flag" : 0,
"tag" : "issue",
"value" : "letsencrypt.org"
}
}
~~~
#### example
~~~
$ORIGIN example.net.
example.net. 300 IN SOA <SOA RDATA>
example.net. 300 NS ns1.example.net.
example.net. 300 NS ns2.example.net.
*.example.net. 300 TXT "this is a wildcard"
*.example.net. 300 MX 10 host1.example.net.
sub.*.example.net. 300 TXT "this is not a wildcard"
host1.example.net. 300 A 5.5.5.5
_ssh.tcp.host1.example.net. 300 SRV <SRV RDATA>
_ssh.tcp.host2.example.net. 300 SRV <SRV RDATA>
subdel.example.net. 300 NS ns1.subdel.example.net.
subdel.example.net. 300 NS ns2.subdel.example.net.
host2.example.net CAA 0 issue "letsencrypt.org"
~~~
above zone data should be stored at redis as follow:
~~~
redis-cli> hgetall example.net.
1) "_ssh._tcp.host1"
2) "{\"srv\":[{\"ttl\":300, \"target\":\"tcp.example.com.\",\"port\":123,\"priority\":10,\"weight\":100}]}"
3) "*"
4) "{\"txt\":[{\"ttl\":300, \"text\":\"this is a wildcard\"}],\"mx\":[{\"ttl\":300, \"host\":\"host1.example.net.\",\"preference\": 10}]}"
5) "host1"
6) "{\"a\":[{\"ttl\":300, \"ip\":\"5.5.5.5\"}]}"
7) "sub.*"
8) "{\"txt\":[{\"ttl\":300, \"text\":\"this is not a wildcard\"}]}"
9) "_ssh._tcp.host2"
10) "{\"srv\":[{\"ttl\":300, \"target\":\"tcp.example.com.\",\"port\":123,\"priority\":10,\"weight\":100}]}"
11) "subdel"
12) "{\"ns\":[{\"ttl\":300, \"host\":\"ns1.subdel.example.net.\"},{\"ttl\":300, \"host\":\"ns2.subdel.example.net.\"}]}"
13) "@"
14) "{\"soa\":{\"ttl\":300, \"minttl\":100, \"mbox\":\"hostmaster.example.net.\",\"ns\":\"ns1.example.net.\",\"refresh\":44,\"retry\":55,\"expire\":66},\"ns\":[{\"ttl\":300, \"host\":\"ns1.example.net.\"},{\"ttl\":300, \"host\":\"ns2.example.net.\"}]}"
15) "host2"
16)"{\"caa\":[{\"flag\":0, \"tag\":\"issue\", \"value\":\"letsencrypt.org\"}]}"
redis-cli>
~~~
## API
Package `redis` provides functions to manipulate (get, add, edit, delete) the data in the redis backend.
The DNS zones are saved as hashmaps with the zone-name as key in the backend.
While the data format is JSON at the moment, but I am considering switching to
*protobuf* for performance reasons later.
While the data format is JSON at the moment, but I am considering switching to
*protobuf* for performance reasons later.
## credits