rrda

REST API allowing to perform DNS queries over HTTP
Log | Files | Refs | README | LICENSE

commit e0efe19700910841a4bc0471ba1566863f8aaac3
parent cbcf10aa882cd5e6854105135e3059e020dca55b
Author: Frederic Cambus <fred@statdns.com>
Date:   Tue, 10 Jan 2023 12:39:26 +0100

Add an 'id' handler to identify a Name Server instance (RFC 4892).

Diffstat:
Mrrda.go | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/rrda.go b/rrda.go @@ -171,6 +171,13 @@ func ptr(w http.ResponseWriter, r *http.Request) { } } +// Handler for identifying a Name Server instance +func id(w http.ResponseWriter, r *http.Request) { + server := chi.URLParam(r, "server") + + resolve(w, r, server, "id.server.", dns.TypeTXT, dns.ClassCHAOS) +} + func main() { host := flag.String("host", "127.0.0.1", "Set the server host") port := flag.String("port", "8080", "Set the server port") @@ -191,6 +198,7 @@ func main() { address := *host + ":" + *port r := chi.NewRouter() + r.Get("/{server}/id", id) r.Get("/{server}/x/{ip}", ptr) r.Get("/{server}/{domain}/{querytype}", query)