Minor (complete) refactor #38

Merged
sam merged 20 commits from small-things into master 2022-07-26 00:32:32 +00:00
14 changed files with 411 additions and 551 deletions
Showing only changes of commit ded9890ac3 - Show all commits

View file

@ -15,7 +15,7 @@ local testing(version, arch) = {
name: "test",
image: "golang:" + version,
commands: [
"go test -race -v ./... -cover"
"go test -race ./... -cover"
]
},
]
@ -40,7 +40,7 @@ local release() = {
name: "test",
image: "golang",
commands: [
"go test -race -v ./... -cover"
"go test -race ./... -cover"
]
},
{

3
.gitignore vendored
View file

@ -19,4 +19,5 @@ go.work
dist/
# Test coverage
coverage/
coverage/*
!coverage/.gitkeep

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "doc/wiki"]
path = doc/wiki
url = ../awl.wiki

16
.vscode/launch.json vendored
View file

@ -1,16 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}",
"args": ["+timeout=1"]
}
]
}

24
GNUmakefile Normal file
View file

@ -0,0 +1,24 @@
# SPDX-License-Identifier: BSD-3-Clause
include template.mk
ifeq ($(OS),Windows_NT)
EXE := $(PROG).exe
else
EXE := $(PROG)
endif
$(PROG):
$(GO) build -o $(EXE) $(GOFLAGS) .
## install: installs awl
install: all
ifeq ($(OS),Windows_NT)
$(GO) install $(GOFLAGS) .
else
install -m755 $(PROG) $(PREFIX)/$(BIN)
install -m644 doc/$(PROG).1 $(MAN)/man1
endif
.PHONY: install

View file

@ -1,59 +1,14 @@
# SPDX-License-Identifier: BSD-3-Clause
# BSD/POSIX makefile
HASH := $(shell git describe --always --dirty || echo "UNKNOWN")
VER := "git-$(HASH)"
include template.mk
CGO_ENABLED = 0
GO := go
GOFLAGS := -ldflags "-s -w -X 'main.version=$(VER)'"
SCDOC := scdoc
$(PROG):
$(GO) build -o $(PROG) $(GOFLAGS) .
PREFIX := /usr/local
BINPATH := $(PREFIX)/bin
MANPATH := /usr/share/man
## install: installs awl
install: all
install -m755 $(PROG) $(PREFIX)/$(BIN)
install -m644 doc/$(PROG).1 $(MAN)/man1
PROG := awl
ifeq ($(OS),Windows_NT)
EXE := $(PROG).exe
else
EXE := $(PROG)
endif
.PHONY: clean lint
# hehe
all: $(PROG)
$(PROG): lint
$(GO) build -o $(EXE) $(GOFLAGS) .
doc: doc/awl.1.md
$(SCDOC) < doc/$(PROG).1.md > doc/$(PROG).1
test: coverage/coverage.out
$(GO) test -v -cover -coverprofile=coverage/coverage.out ./...
cover: test
$(GO) tool cover -func=coverage/coverage.out
$(GO) tool cover -html=coverage/coverage.out -o coverage/cover.html
fmt: *.go
gofmt -w -s .
vet: *.go
$(GO) vet ./...
lint: fmt vet
-golangci-lint run
install:
$(GO) install $(GOFLAGS) .
install_doc: doc
install doc/$(PROG).1 $(MANPATH)/man1
@echo ""
@echo "Make sure to update your manual database"
@echo "'sudo mandb' on Debian/Ubuntu"
clean:
$(GO) clean
.PHONY: install

View file

@ -1,26 +1,66 @@
# awl
[![Build Status](https://ci.git.froth.zone/api/badges/sam/awl/status.svg)](https://ci.git.froth.zone/sam/awl)
`awl` is a command-line DNS client, much like
[`drill`](https://github.com/NLnetLabs/ldns),
[`dig`](https://bind9.readthedocs.io/en/v9_18_3/manpages.html#dig-dns-lookup-utility),
[`dog`](https://github.com/ogham/dog),
[`doggo`](https://github.com/mr-karan/doggo),
or [`q`](https://github.com/natesales/q).
`awl` is designed to be a drop-in replacement for the venerable dig, but support newer RFC query types, such as DNS-over-HTTPS and DNS-over-QUIC.
## Usage
* [Install](https://git.froth.zone/sam/awl/wiki/Install)
* [Manpage](https://git.froth.zone/sam/awl/wiki/Man)
## Contributing
Send a [pull request](https://git.froth.zone/sam/awl/pulls) our way.
Prefer emails? Send a patch to the [mailing list](https://lists.sr.ht/~sammefishe/awl-dev).
Found a bug or want a new feature?
Create an issue [here](https://git.froth.zone/sam/awl/issues).
### License
See [LICENSE](./LICENSE)
# awl
[![Build Status](https://ci.git.froth.zone/api/badges/sam/awl/status.svg)](https://ci.git.froth.zone/sam/awl)
`awl` is a command-line DNS client, much like
[`drill`](https://github.com/NLnetLabs/ldns),
[`dig`](https://bind9.readthedocs.io/en/v9_18_3/manpages.html#dig-dns-lookup-utility),
[`dog`](https://github.com/ogham/dog),
[`doggo`](https://github.com/mr-karan/doggo), or
[`q`](https://github.com/natesales/q).
`awl` is designed to be a drop-in replacement for the venerable dig, but support
newer RFC query types, such as DNS-over-HTTPS and DNS-over-QUIC.
## Usage
- [Feature wiki](https://git.froth.zone/sam/awl/wiki/Supported.md)
- [Manpage](https://git.froth.zone/sam/awl/wiki/awl.1.md)
## Building and installing
### From releases
Grab a prebuilt binary from the
[release](https://git.froth.zone/sam/awl/releases) section.
### From source
Dependencies:
- Go >= 1.18
- GNU/BSD make or Plan 9 mk
- [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (optional, for manpage)
Make sure to recursively clone the repo:
```sh
git clone --recursive https://git.froth.zone/sam/awl
```
Using the makefile:
```sh
make
sudo make install
```
Alternatively, using `go install`:
```sh
go install git.froth.zone/sam/awl@latest
```
## Contributing
Send a [pull request](https://git.froth.zone/sam/awl/pulls) our way. Prefer
emails? Send a patch to the
[mailing list](https://lists.sr.ht/~sammefishe/awl-dev).
Found a bug or want a new feature? Create an issue
[here](https://git.froth.zone/sam/awl/issues).
### License
See [LICENSE](./LICENSE)

0
coverage/.gitkeep Normal file
View file

506
doc/awl.1
View file

@ -1,264 +1,244 @@
.\" Generated by scdoc 1.11.2
.\" Complete documentation for this program is not available as a GNU info page
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.nh
.ad l
.\" Begin generated content:
.TH "awl" "1" "2022-07-24"
.P
.SH NAME
awl - DNS lookup tool
.P
.SH SYNOPSIS
\fBawl\fR [ \fIOPTIONS\fR ] \fIname\fR [ \fI@server\fR ] [ \fItype\fR ]
.br
where
.P
\fIname\fR is the query to make (\fBexample: froth.\&zone\fR)
.br
\fI@server\fR is the server to query (\fBexample: dns.\&froth.\&zone\fR)
.br
\fItype\fR is the DNS resource type (\fBexample: AAAA\fR)
.P
.SH DESCRIPTION
.P
\fBawl\fR (\fBa\fRwls \fBw\fRant \fBl\fRicorice) is a simple tool designed to make DNS queries,
much like the venerable \fIdig\fR(1).\& An awl is a tool used to make small holes,
typically used in tannery (leatherworking).\&
.P
\fBawl\fR is designed to be a more "modern" version of \fIdrill\fR(1) by including
some more recent RFCs and output options.\& \fBawl\fR is still heavily
Work-In-Progress so some features may get added or removed.\&
.P
.SH OPTIONS
.RS 4
Dig-like +[no]flags are supported, see dig(1)
.P
\fB-D\fR, \fB--dnssec\fR, \fB+dnssec\fR
.br
Enable DNSSEC.\& This needs to be manually enabled.\&
.P
\fB-v\fR \fIvalue\fR
.br
Set verbosity (currently WIP)
.P
\fB-V\fR
.br
Print the version and exit.\&
.P
\fB-h\fR
.br
Show a "short" help message.\&
.P
.RE
.SS Query Options
.RS 4
\fB-4\fR
.br
Only make query over IPv4
.P
\fB-6\fR
.br
Only make query over IPv6
.P
\fB-p\fR, \fB--port\fR \fIport\fR
.br
Sets the port to query.\&
.br
.br
\fIDefault Ports\fR:
.RS 4
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.IP \(bu 4
.\}
\fI53\fR for \fBUDP\fR and \fBTCP\fR
.RE
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.IP \(bu 4
.\}
\fI853\fR for \fBTLS\fR and \fBQUIC\fR
.RE
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.IP \(bu 4
.\}
\fI443\fR for \fBHTTPS\fR
.RE
.P
.RE
\fB-q\fR, \fB--query\fR \fIdomain\fR
.br
Domain to query (eg.\& example.\&com)
.P
\fB-c\fR, \fB--class\fR \fIclass\fR
.br
DNS class to query (eg.\& IN, CH)
.P
\fB-t\fR, \fB--qType\fR \fItype\fR
.br
DNS type to query (eg.\& A, NS)
.P
\fB--no-truncate\fR, \fB+ignore\fR
.br
Ignore UDP truncation (by default, awl \fIretries with TCP\fR)
.P
\fB--tcp\fR, \fB+tcp\fR, \fB+vc\fR
.br
Use TCP for the query (see \fIRFC 7766\fR)
.P
\fB--dnscrypt\fR, \fB+dnscrypt\fR
.br
Use DNSCrypt
.P
\fB-T\fR, \fB--tls\fR, \fB+tls\fR
.br
Use DNS-over-TLS, implies \fB--tcp\fR (see \fIRFC 7858\fR)
.P
\fB-H\fR.\& \fB--https\fR, \fB+https\fR
.br
Use DNS-over-HTTPS (see \fIRFC 8484\fR)
.P
\fB-Q\fR.\& \fB--quic\fR, \fB+quic\fR
.br
Use DNS-over-QUIC (see \fIRFC 9250\fR)
.P
\fB-x\fR, \fB--reverse\fR
.br
Do a reverse lookup.\& Sets default \fItype\fR to PTR.\&
.br
\fBawl\fR automatically makes an IP or phone number canonical.\&
.P
\fB--timeout\fR \fIseconds\fR, \fB+timeout=\fR\fIseconds\fR
.br
Set the timeout period.\& Floating point numbers are accepted.\&
.br
0.\&5 seconds is the minimum.\&
.P
\fB--retries\fR \fIint\fR, \fB+tries\fR=\fIint\fR, \fB+ retry\fR=\fIint\fR
.br
Set the number of retries.\&
.br
Retry is one more than tries, dig style
.P
.RE
.SS DNS Flags
.P
.RS 4
\fB--aa=[false]\fR, \fB+[no]aaflag\fR
.br
(Set, Unset) AA (Authoritative Answer) flag
.P
\fB--ad=[false]\fR, \fB+[no]adflag\fR
.br
(Set, Unset) AD (Authenticated Data) flag
.P
\fB--tc=[false]\fR, \fB+[no]tcflag\fR
.br
(Set, Unset) TC (TrunCated) flag
.P
\fB-z=[false]\fR, \fB+[no]zflag\fR
.br
(Set, Unset) Z (Zero) flag
.P
\fB--cd=[false]\fR, \fB+[no]cdflag\fR
.br
(Set, Unset) CD (Checking Disabled) flag
.P
\fB--qr=[false]\fR, \fB+[no]qrflag\fR
.br
(Set, Unset) QR (QueRy) flag
.P
\fB--rd=[true]\fR, \fB+[no]rdflag\fR
.br
(Set, Unset) RD (Recursion Desired) flag
.P
\fB--ra=[false]\fR, \fB+[no]raflag\fR
.br
(Set, Unset) RA (Recursion Available) flag
.P
.RE
.SS Output Display
.RS 4
\fB--no-question\fR, \fB+noquestion\fR
.br
Do not display the Question section
.P
\fB--no-answer\fR, \fB+noanswer\fR
.br
Do not display the Answer section
.P
\fB--no-answer\fR, \fB+noanswer\fR
.br
Do not display the Answer section
.P
\fB--no-authority\fR, \fB+noauthority\fR
.br
Do not display the Authority section
.P
\fB--no-additional\fR, \fB+noadditional\fR
.br
Do not display the Additional section
.P
\fB--no-statistics\fR, \fB+nostats\fR
.br
Do not display the Statistics (additional comments) section
.P
.RE
.SS Output Formats
.RS 4
\fB-j\fR, \fB--json\fR, \fB+json\fR
.br
Print the query results as JSON.\&
.P
\fB-X\fR, \fB--xml\fR, \fB+xml\fR
.br
Print the query results as XML.\&
.P
\fB-y\fR, \fB--yaml\fR, \fB+yaml\fR
.br
Print the query results as YAML.\&
.P
\fB-s\fR, \fB--short\fR, \fB+short\fR
.br
Print just the address of the answer.\&
.P
.RE
.SH EXAMPLES
.nf
.RS 4
awl grumbulon\&.xyz -j +cd
.fi
.RE
Run a query of your local resolver for the A records of grumbulon.\&xyz, print
them as JSON and disable DNSSEC verification.\&
.P
.nf
.RS 4
awl +short example\&.com AAAA @1\&.1\&.1\&.1
.fi
.RE
Query 1.\&1.\&1.\&1 for the AAAA records of example.\&com, print just the answers
.P
.nf
.RS 4
awl -xT PTR 8\&.8\&.4\&.4 @dns\&.google
.fi
.RE
Query dns.\&google over TLS for the PTR record to the IP address 8.\&8.\&4.\&4
.P
.SH SEE ALSO
.\" Generated by scdoc 1.11.2
.\" Complete documentation for this program is not available as a GNU info page
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.nh
.ad l
.\" Begin generated content:
.TH "awl" "1" "2022-07-25"
.PP
.SH NAME
awl - DNS lookup tool
.PP
.SH SYNOPSIS
\fBawl\fR [ \fIOPTIONS\fR ] \fIname\fR [ \fI@server\fR ] [ \fItype\fR ]
.br
where
.PP
\fIname\fR is the query to make (\fBexample: froth.\&zone\fR)
.br
\fI@server\fR is the server to query (\fBexample: dns.\&froth.\&zone\fR)
.br
\fItype\fR is the DNS resource type (\fBexample: AAAA\fR)
.PP
.SH DESCRIPTION
.PP
\fBawl\fR (\fBa\fRwls \fBw\fRant \fBl\fRicorice) is a simple tool designed to make DNS queries,
much like the venerable \fIdig\fR(1).\& An awl is a tool used to make small holes,
typically used in leatherworking.\&
.PP
\fBawl\fR is designed to be a more "modern" version of \fIdrill\fR(1) by including
some more recent RFCs and output options.\& \fBawl\fR is still heavily
Work-In-Progress so some features may get added or removed.\&
.PP
.SH OPTIONS
.RS 4
Dig-like +[no]flags are supported, see dig(1)
.PP
\fB-D\fR, \fB--dnssec\fR, \fB+dnssec\fR
.br
Enable DNSSEC.\& This needs to be manually enabled.\&
.PP
\fB-v\fR \fIvalue\fR
.br
Set verbosity (currently WIP)
.PP
\fB-V\fR
.br
Print the version and exit.\&
.PP
\fB-h\fR
.br
Show a "short" help message.\&
.PP
.RE
.SS Query Options
.RS 4
\fB-4\fR
.br
Only make query over IPv4
.PP
\fB-6\fR
.br
Only make query over IPv6
.PP
\fB-p\fR, \fB--port\fR \fIport\fR
.br
Sets the port to query.\&
.br
.br
\fIDefault Ports\fR:
.RS 4
.PD 0
.IP \(bu 4
\fI53\fR for \fBUDP\fR and \fBTCP\fR
.IP \(bu 4
\fI853\fR for \fBTLS\fR and \fBQUIC\fR
.IP \(bu 4
\fI443\fR for \fBHTTPS\fR
.PD
.PP
.RE
\fB-q\fR, \fB--query\fR \fIdomain\fR
.br
Domain to query (eg.\& example.\&com)
.PP
\fB-c\fR, \fB--class\fR \fIclass\fR
.br
DNS class to query (eg.\& IN, CH)
.PP
\fB-t\fR, \fB--qType\fR \fItype\fR
.br
DNS type to query (eg.\& A, NS)
.PP
\fB--no-truncate\fR, \fB+ignore\fR
.br
Ignore UDP truncation (by default, awl \fIretries with TCP\fR)
.PP
\fB--tcp\fR, \fB+tcp\fR, \fB+vc\fR
.br
Use TCP for the query (see \fIRFC 7766\fR)
.PP
\fB--dnscrypt\fR, \fB+dnscrypt\fR
.br
Use DNSCrypt
.PP
\fB-T\fR, \fB--tls\fR, \fB+tls\fR
.br
Use DNS-over-TLS, implies \fB--tcp\fR (see \fIRFC 7858\fR)
.PP
\fB-H\fR.\& \fB--https\fR, \fB+https\fR
.br
Use DNS-over-HTTPS (see \fIRFC 8484\fR)
.PP
\fB-Q\fR.\& \fB--quic\fR, \fB+quic\fR
.br
Use DNS-over-QUIC (see \fIRFC 9250\fR)
.PP
\fB-x\fR, \fB--reverse\fR
.br
Do a reverse lookup.\& Sets default \fItype\fR to PTR.\&
.br
\fBawl\fR automatically makes an IP or phone number canonical.\&
.PP
\fB--timeout\fR \fIseconds\fR, \fB+timeout=\fR\fIseconds\fR
.br
Set the timeout period.\& Floating point numbers are accepted.\&
.br
0.\&5 seconds is the minimum.\&
.PP
\fB--retries\fR \fIint\fR, \fB+tries\fR=\fIint\fR, \fB+ retry\fR=\fIint\fR
.br
Set the number of retries.\&
.br
Retry is one more than tries, dig style
.PP
.RE
.SS DNS Flags
.PP
.RS 4
\fB--aa=[false]\fR, \fB+[no]aaflag\fR
.br
(Set, Unset) AA (Authoritative Answer) flag
.PP
\fB--ad=[false]\fR, \fB+[no]adflag\fR
.br
(Set, Unset) AD (Authenticated Data) flag
.PP
\fB--tc=[false]\fR, \fB+[no]tcflag\fR
.br
(Set, Unset) TC (TrunCated) flag
.PP
\fB-z=[false]\fR, \fB+[no]zflag\fR
.br
(Set, Unset) Z (Zero) flag
.PP
\fB--cd=[false]\fR, \fB+[no]cdflag\fR
.br
(Set, Unset) CD (Checking Disabled) flag
.PP
\fB--qr=[false]\fR, \fB+[no]qrflag\fR
.br
(Set, Unset) QR (QueRy) flag
.PP
\fB--rd=[true]\fR, \fB+[no]rdflag\fR
.br
(Set, Unset) RD (Recursion Desired) flag
.PP
\fB--ra=[false]\fR, \fB+[no]raflag\fR
.br
(Set, Unset) RA (Recursion Available) flag
.PP
.RE
.SS Output Display
.RS 4
\fB--no-question\fR, \fB+noquestion\fR
.br
Do not display the Question section
.PP
\fB--no-answer\fR, \fB+noanswer\fR
.br
Do not display the Answer section
.PP
\fB--no-answer\fR, \fB+noanswer\fR
.br
Do not display the Answer section
.PP
\fB--no-authority\fR, \fB+noauthority\fR
.br
Do not display the Authority section
.PP
\fB--no-additional\fR, \fB+noadditional\fR
.br
Do not display the Additional section
.PP
\fB--no-statistics\fR, \fB+nostats\fR
.br
Do not display the Statistics (additional comments) section
.PP
.RE
.SS Output Formats
.RS 4
\fB-j\fR, \fB--json\fR, \fB+json\fR
.br
Print the query results as JSON.\&
.PP
\fB-X\fR, \fB--xml\fR, \fB+xml\fR
.br
Print the query results as XML.\&
.PP
\fB-y\fR, \fB--yaml\fR, \fB+yaml\fR
.br
Print the query results as YAML.\&
.PP
\fB-s\fR, \fB--short\fR, \fB+short\fR
.br
Print just the address of the answer.\&
.PP
.RE
.SH EXAMPLES
.nf
.RS 4
awl grumbulon\&.xyz -j +cd
.fi
.RE
Run a query of your local resolver for the A records of grumbulon.\&xyz, print
them as JSON and disable DNSSEC verification.\&
.PP
.nf
.RS 4
awl +short example\&.com AAAA @1\&.1\&.1\&.1
.fi
.RE
Query 1.\&1.\&1.\&1 for the AAAA records of example.\&com, print just the answers
.PP
.nf
.RS 4
awl -xT PTR 8\&.8\&.4\&.4 @dns\&.google
.fi
.RE
Query dns.\&google over TLS for the PTR record to the IP address 8.\&8.\&4.\&4
.PP
.SH SEE ALSO
\fIdrill\fR(1), \fIdig\fR(1), the many DNS RFCs

View file

@ -1,169 +0,0 @@
awl(1)
# NAME
awl - DNS lookup tool
# SYNOPSIS
*awl* [ _OPTIONS_ ] _name_ [ _@server_ ] [ _type_ ]++
where
_name_ is the query to make (*example: froth.zone*)++
_@server_ is the server to query (*example: dns.froth.zone*)++
_type_ is the DNS resource type (*example: AAAA*)
# DESCRIPTION
*awl* (*a*wls *w*ant *l*icorice) is a simple tool designed to make DNS queries,
much like the venerable _dig_(1). An awl is a tool used to make small holes,
typically used in tannery (leatherworking).
*awl* is designed to be a more "modern" version of _drill_(1) by including
some more recent RFCs and output options. *awl* is still heavily
Work-In-Progress so some features may get added or removed.
# OPTIONS
Dig-like +[no]flags are supported, see dig(1)
*-D*, *--dnssec*, *+dnssec*++
Enable DNSSEC. This needs to be manually enabled.
*-v* _value_++
Set verbosity (currently WIP)
*-V*++
Print the version and exit.
*-h*++
Show a "short" help message.
## Query Options
*-4*++
Only make query over IPv4
*-6*++
Only make query over IPv6
*-p*, *--port* _port_++
Sets the port to query.++
++
_Default Ports_:
- _53_ for *UDP* and *TCP*
- _853_ for *TLS* and *QUIC*
- _443_ for *HTTPS*
*-q*, *--query* _domain_++
Domain to query (eg. example.com)
*-c*, *--class* _class_++
DNS class to query (eg. IN, CH)
*-t*, *--qType* _type_++
DNS type to query (eg. A, NS)
*--no-truncate*, *+ignore*++
Ignore UDP truncation (by default, awl _retries with TCP_)
*--tcp*, *+tcp*, *+vc*++
Use TCP for the query (see _RFC 7766_)
*--dnscrypt*, *+dnscrypt*++
Use DNSCrypt
*-T*, *--tls*, *+tls*++
Use DNS-over-TLS, implies *--tcp* (see _RFC 7858_)
*-H*. *--https*, *+https*++
Use DNS-over-HTTPS (see _RFC 8484_)
*-Q*. *--quic*, *+quic*++
Use DNS-over-QUIC (see _RFC 9250_)
*-x*, *--reverse*++
Do a reverse lookup. Sets default _type_ to PTR.++
*awl* automatically makes an IP or phone number canonical.
*--timeout* _seconds_, *+timeout=*_seconds_++
Set the timeout period. Floating point numbers are accepted.++
0.5 seconds is the minimum.
*--retries* _int_, *+tries*=_int_, *+ retry*=_int_++
Set the number of retries.++
Retry is one more than tries, dig style
## DNS Flags
*--aa=[false]*, *+[no]aaflag*++
(Set, Unset) AA (Authoritative Answer) flag
*--ad=[false]*, *+[no]adflag*++
(Set, Unset) AD (Authenticated Data) flag
*--tc=[false]*, *+[no]tcflag*++
(Set, Unset) TC (TrunCated) flag
*-z=[false]*, *+[no]zflag*++
(Set, Unset) Z (Zero) flag
*--cd=[false]*, *+[no]cdflag*++
(Set, Unset) CD (Checking Disabled) flag
*--qr=[false]*, *+[no]qrflag*++
(Set, Unset) QR (QueRy) flag
*--rd=[true]*, *+[no]rdflag*++
(Set, Unset) RD (Recursion Desired) flag
*--ra=[false]*, *+[no]raflag*++
(Set, Unset) RA (Recursion Available) flag
## Output Display
*--no-question*, *+noquestion*++
Do not display the Question section
*--no-answer*, *+noanswer*++
Do not display the Answer section
*--no-answer*, *+noanswer*++
Do not display the Answer section
*--no-authority*, *+noauthority*++
Do not display the Authority section
*--no-additional*, *+noadditional*++
Do not display the Additional section
*--no-statistics*, *+nostats*++
Do not display the Statistics (additional comments) section
## Output Formats
*-j*, *--json*, *+json*++
Print the query results as JSON.
*-X*, *--xml*, *+xml*++
Print the query results as XML.
*-y*, *--yaml*, *+yaml*++
Print the query results as YAML.
*-s*, *--short*, *+short*++
Print just the address of the answer.
# EXAMPLES
```
awl grumbulon.xyz -j +cd
```
Run a query of your local resolver for the A records of grumbulon.xyz, print
them as JSON and disable DNSSEC verification.
```
awl +short example.com AAAA @1.1.1.1
```
Query 1.1.1.1 for the AAAA records of example.com, print just the answers
```
awl -xT PTR 8.8.4.4 @dns.google
```
Query dns.google over TLS for the PTR record to the IP address 8.8.4.4
# SEE ALSO
_drill_(1), _dig_(1), the many DNS RFCs

1
doc/wiki Submodule

@ -0,0 +1 @@
Subproject commit b900550a3c7eb7977feb9da5590c67fa08798a83

10
go.sum
View file

@ -7,7 +7,6 @@ dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBr
dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4=
dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU=
git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
github.com/AdguardTeam/golibs v0.4.2 h1:7M28oTZFoFwNmp8eGPb3ImmYbxGaJLyQXeIFVHjME0o=
github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
github.com/AdguardTeam/golibs v0.10.9 h1:F9oP2da0dQ9RQDM1lGR7LxUTfUWu8hEFOs4icwAkKM0=
github.com/AdguardTeam/golibs v0.10.9/go.mod h1:W+5rznZa1cSNSFt+gPS7f4Wytnr9fOrd5ZYqwadPw14=
@ -18,7 +17,6 @@ github.com/aead/poly1305 v0.0.0-20180717145839-3fee0db0b635 h1:52m0LGchQBBVqJRyY
github.com/aead/poly1305 v0.0.0-20180717145839-3fee0db0b635/go.mod h1:lmLxL+FV291OopO93Bwf9fQLQeLyt33VJRUg5VJ30us=
github.com/ameshkov/dnscrypt/v2 v2.2.3 h1:X9UP5AHtwp46Ji+sGFfF/1Is6OPI/SjxLqhKpx0P5UI=
github.com/ameshkov/dnscrypt/v2 v2.2.3/go.mod h1:xJB9cE1/GF+NB6EEQqRlkoa4bjcV2w7VYn1G+zVq7Bs=
github.com/ameshkov/dnsstamps v1.0.1 h1:LhGvgWDzhNJh+kBQd/AfUlq1vfVe109huiXw4JhnPug=
github.com/ameshkov/dnsstamps v1.0.1/go.mod h1:Ii3eUu73dx4Vw5O4wjzmT5+lkCwovjzaEZZ4gKyIH5A=
github.com/ameshkov/dnsstamps v1.0.3 h1:Srzik+J9mivH1alRACTbys2xOxs0lRH9qnTA7Y1OYVo=
github.com/ameshkov/dnsstamps v1.0.3/go.mod h1:Ii3eUu73dx4Vw5O4wjzmT5+lkCwovjzaEZZ4gKyIH5A=
@ -92,8 +90,6 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lucas-clemente/quic-go v0.28.0 h1:9eXVRgIkMQQyiyorz/dAaOYIx3TFzXsIFkNFz4cxuJM=
github.com/lucas-clemente/quic-go v0.28.0/go.mod h1:oGz5DKK41cJt5+773+BSO9BXDsREY4HLf7+0odGAPO0=
github.com/lucas-clemente/quic-go v0.28.1 h1:Uo0lvVxWg5la9gflIF9lwa39ONq85Xq2D91YNEIslzU=
github.com/lucas-clemente/quic-go v0.28.1/go.mod h1:oGz5DKK41cJt5+773+BSO9BXDsREY4HLf7+0odGAPO0=
github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI=
@ -190,8 +186,6 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa h1:zuSxTR4o9y82ebqCUJYNGJbGPo6sKVl54f/TVDObg1c=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@ -223,8 +217,6 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.0.0-20220708220712-1185a9018129 h1:vucSRfWwTsoXro7P+3Cjlr6flUMtzCwzlvkxEQtHHB0=
golang.org/x/net v0.0.0-20220708220712-1185a9018129/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@ -265,8 +257,6 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=

15
mkfile
View file

@ -1,7 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
# Plan 9 mkfile
GO = go
SCDOC = scdoc
PROG = awl
LDFLAGS = '-s -w'
GOFLAGS = -ldflags=$LDFLAGS
@ -9,19 +9,14 @@ GOFLAGS = -ldflags=$LDFLAGS
CGO_ENABLED = 0
$PROG:
$GO build $GOFLAGS -o $PROG .
$GO build $GOFLAGS -o $PROG '-buildvcs=false' .
doc: doc/$PROG.1.md
$SCDOC < doc/$PROG.1.md > doc/$PROG.1
install:
install: $PROG
$GO install $GOFLAGS .
install_doc:
cp doc/$PROG.1 /sys/man/1/$PROG
cp doc/$PROG.1 /sys/man/1/$PROG
test:
$GO test -v ./... -cover
$GO test -v -cover -coverprofile=coverage/coverage.out ./...
fmt:
gofmt -w -s .

56
template.mk Normal file
View file

@ -0,0 +1,56 @@
# SPDX-License-Identifier: BSD-3-Clause
# Template for the BSD/GNU makefiles
HASH ?= $(shell git describe --always --dirty || echo "UNKNOWN")
VER ?= "git-$(HASH)"
CGO_ENABLED ?= 0
GO ?= go
GOFLAGS ?= -ldflags "-s -w -X 'main.version=$(VER)'" -buildvcs=false
PREFIX ?= /usr/local
BIN ?= bin
SCDOC ?= scdoc
MAN ?= $(PREFIX)/share/man
PROG ?= awl
# hehe
all: $(PROG) doc/$(PROG).1
doc/$(PROG).1: doc/wiki/$(PROG).1.md
@cp doc/awl.1 doc/awl.bak
$(SCDOC) <doc/wiki/$(PROG).1.md >doc/$(PROG).1 2>/dev/null && rm doc/awl.bak || mv doc/awl.bak doc/awl.1
## test: run go test
test:
$(GO) test -cover -coverprofile=coverage/coverage.out ./...
## cover: generates test coverage, output as HTML
cover: test
$(GO) tool cover -func=coverage/coverage.out
$(GO) tool cover -html=coverage/coverage.out -o coverage/cover.html
fmt:
gofmt -w -s .
vet:
$(GO) vet ./...
## lint: lint awl, using fmt, vet and golangci-lint
lint: fmt vet
-golangci-lint run
## clean: clean the build files
clean:
$(GO) clean
## help: Prints this help message
help:
@echo "Usage: "
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
.PHONY: clean lint test fmt vet help