Gonemaster is a Go implementation of the DNS test framework Zonemaster engine and CLI.
Installation
go install codeberg.org/pawal/gonemaster/cmd/gonemaster@latest
Or build from source:
git clone https://codeberg.org/pawal/gonemaster.git
cd gonemaster
go test ./...
go build -o gonemaster ./cmd/gonemaster
sudo install -m 0755 gonemaster /usr/local/bin/gonemaster
CLI
The CLI will output human readable log messages, JSON, or a raw untranskated log
stream. Use --raw to stream raw log entries as they are produced.
Example usage
The default output is human readable translated log messages:
gonemaster --domain example.com
With JSON output:
gonemaster --json --domain example.com | jq
Options
--domainZone name to test (required)--moduleRun a single module (optional)--testcaseRun a single testcase (optional)--profileProfile JSON/YAML path (optional)--min-levelMinimum log level (optional, default NOTICE)--outputWrite output to file (optional)--rawStream raw log entries as they are produced (optional)--jsonPrint JSON output instead of translated output (optional)--dump-profilePrint effective profile in JSON and exit (optional)--localeLocale for translated output (optional; defaults to env oren)--no-ipv4Disable IPv4 queries (optional)--no-ipv6Disable IPv6 queries (optional)--no-progressDisable progress indicator (optional)--list-testsList all available test cases (optional)--versionPrint version and exit (optional)
Locale defaults to the first available in LANGUAGE, then LC_ALL, LC_MESSAGES,
LANG, and finally en.
Exit codes
0Success2Usage or runtime error (invalid args, output file errors, engine errors)130Interrupted (SIGINT/SIGTERM)
Engine usage from Go
package main
import (
"encoding/json"
"fmt"
"log"
"codeberg.org/pawal/gonemaster/engine"
)
func main() {
req := engine.RunRequest{
Domain: "example.com",
Module: "basic",
MinLevel: "INFO",
}
entries, err := engine.Run(req)
if err != nil {
log.Fatal(err)
}
data, err := json.MarshalIndent(entries, "", " ")
if err != nil {
log.Fatal(err)
}
fmt.Println(string(data))
}
If you want translated messages, use engine/i18n:
package main
import (
"fmt"
"codeberg.org/pawal/gonemaster/engine"
"codeberg.org/pawal/gonemaster/engine/i18n"
)
func main() {
entries, _ := engine.Run(engine.RunRequest{Domain: "example.com"})
for _, entry := range entries {
msg := i18n.Translate("fr", entry.Module, entry.Tag, entry.Args)
fmt.Printf("%s %s:%s:%s %s\n", entry.Level, entry.Module, entry.Testcase, entry.Tag, msg)
}
}
Development
Run test coverage:
go test --cover ./...