Home

Awesome

godnsagent

godnsagent is a simple DNS server which downloads zones over HTTP(S) in JSON format, parses them, stores them in memory and serves to clients.

How to build

git clone https://github.com/DevelopersPL/godnsagent.git
cd godnsagent
go get
go build -ldflags "-X main.buildtime '`date`' -X main.buildver '`git log --pretty=format:'%h' -n 1`'"

How to run

./godnsagent -z https://example.org/path/to/zones.json -l 127.0.0.1 -r 8.8.8.8:53 -k secretkeyhere

How it works

Schema of zones file

{
  "example.com.": [
    {"name": "example.com.", "type": "A", "tTl": 500, "data": "123.123.123.123"},
    {"name": "b.example.com.", "type": "A", "Class": "CH", "Ttl": 300, "data": "123.123.123.124"},
    {"name": "example.com", "type": "MX", "Class": "IN", "Ttl": 305, "data": "5 email.example.net."},
    {"name": "example.com", "type": "NS", "data": "marley.example.com."},
    {"name": "example.com", "type": "NS", "Class": "IN", "Ttl": 300, "data": "abc.example.com."},
    {"name": "example.com", "type": "SOA", "TTL": 300, "data": "abc.example.com. hostmaster.example.com. 1399838297 21600 3600 1814400 300"}
  ],
  "example.net.": [
    {"name": "example.net.", "type": "A", "tTl": 500, "data": "123.123.123.123"},
    {"name": "b.example.net.", "type": "A", "Class": "CH", "Ttl": 300, "data": "123.123.123.125"},
    {"name": "example.net", "type": "MX", "Class": "IN", "Ttl": 305, "data": "5 email.example.net."},
    {"name": "example.net", "type": "NS", "data": "marley.example.net."},
    {"name": "example.net", "type": "NS", "Class": "IN", "Ttl": 300, "data": "abc.example.net."},
    {"name": "abc.example.net", "type": "A", "data": "123.123.123.100"},
    {"name": "def.example.net", "type": "A", "data": "123.123.123.101"},
    {"name": "example.net", "type": "SOA", "TTL": 300, "data": "def.example.net. hostmaster.example.net. 1399838297 21600 3600 1814400 300"}
  ]
}

Acknowledgments

This software was created thanks to two amazing projects: