dnsz

command module
v0.0.0-...-e3289a9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

README

dnsz

A simple DNS router with a rest service built into it to allow updating custom hostnames. Currently only allows for ip4 for custom addr but I plan on expanding to ip6.

The server listens on port 53 and tries to resolve the hostname for ARecord requests (plans for AAAARecords in the future) that it has custom listings for. Say you have registered www.awesome.local. (pay attention to the last dot it is needed in hostname spec) to your server on ip 192.168.0.65 then the dns server will resolve your dns request with an answer of that ip address. If the request the fails to resolve then the server forwards your request to currently the google dns server at 8.8.8.8 and it will repeat the response back to the requestor.

Another main feature of this dns handler is that custom hosts have a ttl (that you can set, default is 60s) that will expire your custom hosts if you don't update them before the ttl. The rest call is idempotent in that if you page the same host with the same backend(s) then it will not add new backends it will just update their time stamps to keep them alive. I recommend that you update at 2x the expiration frequencey so if you have a ttl of 60s then you update every 30s, however this is really up to you.

Here is a sample payload for setting/updating a host

{
    "Hostname": "www.zas.com.",
    "TTL": "30s",
    "Backends": [
        {
            "Address": "127.0.0.1"
        }
    ]
}

This is a host record with one backend in it. A host may have multiple backends. All fields here are required. Hostname is the hostname that you want to be resolved by the server DO NOT FORGET THE LAST '.' TTL is the duration (see go time.Duration doc for formats I was lazy) before this becomes invalid. If a single backend becomes invalid then only that one will be removed. If all are invalidated then all are removed. If a host has no backends then it is removed. Backends is a list of well Backends which are really containers for addresses that you want the hostname to resolve to.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
app

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL