Add subnet
Signed-off-by: Sam Therapy <sam@samtherapy.net>
This commit is contained in:
parent
3a70d7f8dc
commit
5ad2cdf4ae
17 changed files with 217 additions and 96 deletions
|
@ -84,6 +84,8 @@ local release() = {
|
|||
};
|
||||
|
||||
[
|
||||
testing("1.19", "amd64"),
|
||||
testing("1.19", "arm64"),
|
||||
testing("1.18", "amd64"),
|
||||
testing("1.18", "arm64"),
|
||||
|
||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -23,3 +23,5 @@ coverage/*
|
|||
!coverage/.gitkeep
|
||||
|
||||
awl
|
||||
|
||||
.dccache
|
|
@ -12,8 +12,9 @@ endif
|
|||
$(PROG):
|
||||
$(GO) build -o $(EXE) $(GOFLAGS) .
|
||||
|
||||
## install: installs awl
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
## install: installs awl
|
||||
install:
|
||||
$(GO) install $(GOFLAGS) .
|
||||
else
|
||||
|
|
2
Makefile
2
Makefile
|
@ -6,7 +6,7 @@ include template.mk
|
|||
$(PROG):
|
||||
$(GO) build -o $(PROG) $(GOFLAGS) .
|
||||
|
||||
## install: installs awl
|
||||
## install: installs awl and the manpage, RUN AS ROOT
|
||||
install: all
|
||||
install -m755 $(PROG) $(PREFIX)/$(BIN)
|
||||
install -m644 doc/$(PROG).1 $(MAN)/man1
|
||||
|
|
47
cli/cli.go
47
cli/cli.go
|
@ -4,8 +4,10 @@ package cli
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -56,7 +58,8 @@ func ParseCLI(version string) (Options, error) {
|
|||
cookie = flag.Bool("no-cookie", false, "disable sending EDNS cookie (default: cookie sent)")
|
||||
tcpKeepAlive = flag.Bool("keep-alive", false, "send EDNS TCP keep-alive")
|
||||
udpBufSize = flag.Uint16("buffer-size", 1232, "set EDNS UDP buffer size", flag.OptShorthand('b'))
|
||||
zflag = flag.Uint16("zflag", 0, "set EDNS z-flag")
|
||||
zflag = flag.String("zflag", "0", "set EDNS z-flag")
|
||||
subnet = flag.String("subnet", "", "set EDNS subnet")
|
||||
padding = flag.Bool("pad", false, "set EDNS padding")
|
||||
|
||||
truncate = flag.Bool("no-truncate", false, "ignore truncation if a UDP request truncates (default: retry with TCP)")
|
||||
|
@ -83,6 +86,7 @@ func ParseCLI(version string) (Options, error) {
|
|||
|
||||
noC = flag.Bool("no-comments", false, "disable printing the comments")
|
||||
noQ = flag.Bool("no-question", false, "disable printing the question section")
|
||||
noOpt = flag.Bool("no-opt", false, "disable printing the OPT pseudosection")
|
||||
noAns = flag.Bool("no-answer", false, "disable printing the answer section")
|
||||
noAuth = flag.Bool("no-authority", false, "disable printing the authority section")
|
||||
noAdd = flag.Bool("no-additional", false, "disable printing the additonal section")
|
||||
|
@ -101,6 +105,12 @@ func ParseCLI(version string) (Options, error) {
|
|||
return Options{Logger: util.InitLogger(*verbosity)}, err
|
||||
}
|
||||
|
||||
// TODO: DRY, dumb dumb.
|
||||
mbz, err := strconv.ParseInt(*zflag, 0, 16)
|
||||
if err != nil {
|
||||
return Options{Logger: util.InitLogger(*verbosity)}, err
|
||||
}
|
||||
|
||||
opts := Options{
|
||||
Logger: util.InitLogger(*verbosity),
|
||||
Port: *port,
|
||||
|
@ -138,6 +148,7 @@ func ParseCLI(version string) (Options, error) {
|
|||
Display: Displays{
|
||||
Comments: !*noC,
|
||||
Question: !*noQ,
|
||||
Opt: !*noOpt,
|
||||
Answer: !*noAns,
|
||||
Authority: !*noAuth,
|
||||
Additional: !*noAdd,
|
||||
|
@ -152,11 +163,43 @@ func ParseCLI(version string) (Options, error) {
|
|||
Expire: *expire,
|
||||
KeepOpen: *tcpKeepAlive,
|
||||
Nsid: *nsid,
|
||||
ZFlag: *zflag,
|
||||
ZFlag: uint16(mbz & 0x7FFF),
|
||||
Padding: *padding,
|
||||
},
|
||||
}
|
||||
|
||||
// TODO: DRY
|
||||
if *subnet != "" {
|
||||
ip, inet, err := net.ParseCIDR(*subnet)
|
||||
if err != nil {
|
||||
// TODO: make not a default?
|
||||
if *subnet == "0" {
|
||||
opts.EDNS.Subnet = dns.EDNS0_SUBNET{
|
||||
Code: dns.EDNS0SUBNET,
|
||||
Family: 1,
|
||||
SourceNetmask: 0,
|
||||
SourceScope: 0,
|
||||
Address: net.IPv4(0, 0, 0, 0),
|
||||
}
|
||||
} else {
|
||||
return Options{Logger: util.InitLogger(*verbosity)}, err
|
||||
}
|
||||
} else {
|
||||
sub, _ := inet.Mask.Size()
|
||||
opts.EDNS.Subnet = *new(dns.EDNS0_SUBNET)
|
||||
opts.EDNS.Subnet.Address = ip
|
||||
opts.EDNS.Subnet.SourceNetmask = uint8(sub)
|
||||
switch ip.To4() {
|
||||
case nil:
|
||||
// Not a valid IPv4 so assume IPv6
|
||||
opts.EDNS.Subnet.Family = 2
|
||||
default:
|
||||
// Valid IPv4
|
||||
opts.EDNS.Subnet.Family = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
opts.Logger.Info("POSIX flags parsed")
|
||||
opts.Logger.Debug(fmt.Sprintf("%+v", opts))
|
||||
|
||||
|
|
|
@ -30,6 +30,26 @@ func TestTLSPort(t *testing.T) {
|
|||
os.Args = old
|
||||
}
|
||||
|
||||
func TestSubnet(t *testing.T) {
|
||||
old := os.Args
|
||||
os.Args = []string{"awl", "--subnet", "127.0.0.1/32"}
|
||||
opts, err := cli.ParseCLI("TEST")
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, opts.EDNS.Subnet.Family, uint16(1))
|
||||
|
||||
os.Args = []string{"awl", "--subnet", "0"}
|
||||
opts, err = cli.ParseCLI("TEST")
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, opts.EDNS.Subnet.Family, uint16(1))
|
||||
os.Args = old
|
||||
|
||||
os.Args = []string{"awl", "--subnet", "::/0"}
|
||||
opts, err = cli.ParseCLI("TEST")
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, opts.EDNS.Subnet.Family, uint16(2))
|
||||
os.Args = old
|
||||
}
|
||||
|
||||
func TestInvalidFlag(t *testing.T) {
|
||||
old := os.Args
|
||||
os.Args = []string{"awl", "--treebug"}
|
||||
|
|
126
cli/dig.go
126
cli/dig.go
|
@ -4,9 +4,12 @@ package cli
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
||||
// Parse dig-like commands and set the options as such.
|
||||
|
@ -93,6 +96,8 @@ func ParseDig(arg string, opts *Options) error {
|
|||
opts.Display.Comments = isNo
|
||||
case "question":
|
||||
opts.Display.Question = isNo
|
||||
case "opt":
|
||||
opts.Display.Opt = isNo
|
||||
case "answer":
|
||||
opts.Display.Answer = isNo
|
||||
case "authority":
|
||||
|
@ -104,6 +109,7 @@ func ParseDig(arg string, opts *Options) error {
|
|||
case "all":
|
||||
opts.Display.Comments = isNo
|
||||
opts.Display.Question = isNo
|
||||
opts.Display.Opt = isNo
|
||||
opts.Display.Answer = isNo
|
||||
opts.Display.Authority = isNo
|
||||
opts.Display.Additional = isNo
|
||||
|
@ -113,41 +119,54 @@ func ParseDig(arg string, opts *Options) error {
|
|||
|
||||
default:
|
||||
// Recursive switch statements WOO
|
||||
switch {
|
||||
case strings.HasPrefix(arg, "time"), strings.HasPrefix(arg, "timeout"):
|
||||
timeout, err := strconv.Atoi(strings.Split(arg, "=")[1])
|
||||
arg := strings.Split(arg, "=")
|
||||
switch arg[0] {
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("digflags: Invalid timeout value")
|
||||
}
|
||||
case "time", "timeout":
|
||||
if len(arg) > 1 && arg[1] != "" {
|
||||
timeout, err := strconv.Atoi(arg[1])
|
||||
|
||||
opts.Request.Timeout = time.Duration(timeout)
|
||||
|
||||
case strings.HasPrefix(arg, "retry"), strings.HasPrefix(arg, "tries"):
|
||||
tries, err := strconv.Atoi(strings.Split(arg, "=")[1])
|
||||
if err != nil {
|
||||
return fmt.Errorf("digflags: Invalid retry value")
|
||||
}
|
||||
|
||||
if strings.HasPrefix(arg, "tries") {
|
||||
tries++
|
||||
}
|
||||
|
||||
opts.Request.Retries = tries
|
||||
|
||||
case strings.HasPrefix(arg, "bufsize"):
|
||||
size, err := strconv.Atoi(strings.Split(arg, "=")[1])
|
||||
if err != nil {
|
||||
return fmt.Errorf("digflags: Invalid UDP buffer size value")
|
||||
}
|
||||
opts.EDNS.BufSize = uint16(size)
|
||||
|
||||
case strings.HasPrefix(arg, "ednsflags"):
|
||||
split := strings.Split(arg, "=")
|
||||
if len(split) > 1 {
|
||||
ver, err := strconv.ParseInt(split[1], 0, 16)
|
||||
if err != nil {
|
||||
return fmt.Errorf("digflags: Invalid EDNS flag")
|
||||
return fmt.Errorf("digflags: Invalid timeout value: %w", err)
|
||||
}
|
||||
|
||||
opts.Request.Timeout = time.Duration(timeout)
|
||||
} else {
|
||||
return fmt.Errorf("digflags: Invalid timeout value: %w", errNoArg)
|
||||
}
|
||||
|
||||
case "retry", "tries":
|
||||
if len(arg) > 1 && arg[1] != "" {
|
||||
tries, err := strconv.Atoi(arg[1])
|
||||
if err != nil {
|
||||
return fmt.Errorf("digflags: Invalid retry value: %w", err)
|
||||
}
|
||||
opts.Request.Retries = tries
|
||||
|
||||
// TODO: Is there a better way to do this?
|
||||
if arg[0] == "tries" {
|
||||
opts.Request.Retries++
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("digflags: Invalid retry value: %w", errNoArg)
|
||||
}
|
||||
|
||||
case "bufsize":
|
||||
if len(arg) > 1 && arg[1] != "" {
|
||||
size, err := strconv.Atoi(arg[1])
|
||||
if err != nil {
|
||||
return fmt.Errorf("digflags: Invalid UDP buffer size value: %w", err)
|
||||
}
|
||||
opts.EDNS.BufSize = uint16(size)
|
||||
} else {
|
||||
return fmt.Errorf("digflags: Invalid UDP buffer size value: %w", errNoArg)
|
||||
}
|
||||
|
||||
case "ednsflags":
|
||||
if len(arg) > 1 && arg[1] != "" {
|
||||
ver, err := strconv.ParseInt(arg[1], 0, 16)
|
||||
if err != nil {
|
||||
return fmt.Errorf("digflags: Invalid EDNS flag: %w", err)
|
||||
}
|
||||
// Ignore setting DO bit
|
||||
opts.EDNS.ZFlag = uint16(ver & 0x7FFF)
|
||||
|
@ -155,20 +174,51 @@ func ParseDig(arg string, opts *Options) error {
|
|||
opts.EDNS.ZFlag = 0
|
||||
}
|
||||
|
||||
case strings.HasPrefix(arg, "edns"):
|
||||
case "edns":
|
||||
opts.EDNS.EnableEDNS = isNo
|
||||
split := strings.Split(arg, "=")
|
||||
if len(split) > 1 {
|
||||
ver, err := strconv.Atoi(split[1])
|
||||
if len(arg) > 1 && arg[1] != "" {
|
||||
ver, err := strconv.Atoi(arg[1])
|
||||
if err != nil {
|
||||
return fmt.Errorf("digflags: Invalid EDNS version")
|
||||
return fmt.Errorf("digflags: Invalid EDNS version: %w", err)
|
||||
}
|
||||
opts.EDNS.Version = uint8(ver)
|
||||
} else {
|
||||
opts.EDNS.Version = 0
|
||||
}
|
||||
|
||||
case strings.HasPrefix(arg, "subnet"):
|
||||
case "subnet":
|
||||
if len(arg) > 1 && arg[1] != "" {
|
||||
ip, inet, err := net.ParseCIDR(arg[1])
|
||||
if err != nil {
|
||||
// TODO: make not a default?
|
||||
if arg[1] == "0" {
|
||||
opts.EDNS.Subnet = dns.EDNS0_SUBNET{
|
||||
Code: dns.EDNS0SUBNET,
|
||||
Family: 1,
|
||||
SourceNetmask: 0,
|
||||
SourceScope: 0,
|
||||
Address: net.IPv4(0, 0, 0, 0),
|
||||
}
|
||||
return nil
|
||||
} else {
|
||||
return fmt.Errorf("digflags: Invalid EDNS Subnet: %w", errNoArg)
|
||||
}
|
||||
}
|
||||
subnet, _ := inet.Mask.Size()
|
||||
opts.EDNS.Subnet = *new(dns.EDNS0_SUBNET)
|
||||
opts.EDNS.Subnet.Address = ip
|
||||
opts.EDNS.Subnet.SourceNetmask = uint8(subnet)
|
||||
switch ip.To4() {
|
||||
case nil:
|
||||
// Not a valid IPv4 so assume IPv6
|
||||
opts.EDNS.Subnet.Family = 2
|
||||
default:
|
||||
// Valid IPv4
|
||||
opts.EDNS.Subnet.Family = 1
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("digflags: Invalid EDNS Subnet: %w", errNoArg)
|
||||
}
|
||||
|
||||
default:
|
||||
return fmt.Errorf("digflags: unknown flag %s given", arg)
|
||||
|
|
|
@ -28,13 +28,15 @@ func FuzzDig(f *testing.F) {
|
|||
"edns", "edns=a", "edns=0", "noedns",
|
||||
"expire", "noexpire",
|
||||
"ednsflags", "ednsflags=\"", "ednsflags=1", "noednsflags",
|
||||
"subnet=0.0.0.0/0", "subnet=::0/0", "subnet=b", "subnet=0", "subnet",
|
||||
"cookie", "nocookeie",
|
||||
"keepopen", "keepalive", "nokeepopen", "nokeepalive",
|
||||
"nsid", "nonsid",
|
||||
"padding", "nopadding",
|
||||
"bufsize=512", "bufsize=a",
|
||||
"time=5", "timeout=a",
|
||||
"retry=a", "tries=3",
|
||||
"bufsize=512", "bufsize=a", "bufsize",
|
||||
"time=5", "timeout=a", "timeout",
|
||||
"retry=a", "retry=3", "retry",
|
||||
"tries=2", "tries=b", "tries",
|
||||
"tcp", "vc", "notcp", "novc",
|
||||
"ignore", "noignore",
|
||||
"tls", "notls",
|
||||
|
@ -48,6 +50,7 @@ func FuzzDig(f *testing.F) {
|
|||
"yaml", "noyaml",
|
||||
"comments", "nocomments",
|
||||
"question", "noquestion",
|
||||
"opt", "noopt",
|
||||
"answer", "noanswer",
|
||||
"authority", "noauthority",
|
||||
"additional", "noadditional",
|
||||
|
|
22
cli/misc.go
22
cli/misc.go
|
@ -46,23 +46,29 @@ func ParseMiscArgs(args []string, opts *Options) error {
|
|||
default:
|
||||
opts.Request.Server = arg
|
||||
}
|
||||
|
||||
// Dig-style +queries
|
||||
case strings.HasPrefix(arg, "+"):
|
||||
opts.Logger.Info(arg, "detected as a dig query")
|
||||
err = ParseDig(strings.ToLower(arg[1:]), opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Domain names
|
||||
case strings.Contains(arg, "."):
|
||||
opts.Logger.Info(arg, "detected as a domain name")
|
||||
opts.Request.Name, err = idna.ToASCII(arg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// DNS query type
|
||||
case ok:
|
||||
opts.Logger.Info(arg, "detected as a type")
|
||||
// If it's a DNS request, it's a DNS request (obviously)
|
||||
opts.Request.Type = r
|
||||
case strings.HasPrefix(arg, "+"):
|
||||
opts.Logger.Info(arg, "detected as a dig query")
|
||||
// Dig-style +queries
|
||||
err = ParseDig(strings.ToLower(arg[1:]), opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Domain?
|
||||
default:
|
||||
opts.Logger.Info(arg, "is unknown. Assuming domain")
|
||||
opts.Request.Name, err = idna.ToASCII(arg)
|
||||
|
|
|
@ -7,6 +7,8 @@ import (
|
|||
|
||||
"git.froth.zone/sam/awl/internal/helpers"
|
||||
"git.froth.zone/sam/awl/logawl"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
||||
// CLI options structure.
|
||||
|
@ -49,6 +51,7 @@ type Options struct {
|
|||
type Displays struct {
|
||||
Comments bool
|
||||
Question bool // QUESTION SECTION
|
||||
Opt bool // OPT PSEUDOSECTION
|
||||
Answer bool // ANSWER SECTION
|
||||
Authority bool // AUTHORITY SECTION
|
||||
Additional bool // ADDITIONAL SECTION
|
||||
|
@ -57,22 +60,19 @@ type Displays struct {
|
|||
}
|
||||
|
||||
type EDNS struct {
|
||||
EnableEDNS bool // Enable EDNS
|
||||
Cookie bool // Enable EDNS cookie
|
||||
DNSSEC bool // Enable DNSSEC
|
||||
BufSize uint16 // Set UDP buffer size
|
||||
Version uint8 // Set EDNS version
|
||||
Expire bool // Set EDNS expiration
|
||||
KeepOpen bool // TCP keep alive
|
||||
Nsid bool // Show EDNS nsid
|
||||
ZFlag uint16 // EDNS flags
|
||||
Padding bool // EDNS padding
|
||||
// Subnet EDNS_SUBNET
|
||||
EnableEDNS bool // Enable EDNS
|
||||
Cookie bool // Enable EDNS cookie
|
||||
DNSSEC bool // Enable DNSSEC
|
||||
BufSize uint16 // Set UDP buffer size
|
||||
Version uint8 // Set EDNS version
|
||||
Expire bool // Set EDNS expiration
|
||||
KeepOpen bool // TCP keep alive
|
||||
Nsid bool // Show EDNS nsid
|
||||
ZFlag uint16 // EDNS flags
|
||||
Padding bool // EDNS padding
|
||||
Subnet dns.EDNS0_SUBNET // EDNS Subnet (duh)
|
||||
}
|
||||
|
||||
// Subnets get their own structure because complicated
|
||||
// type EDNS_SUBNET struct {
|
||||
// family uint16
|
||||
// }
|
||||
|
||||
var ErrNotError = errors.New("not an error")
|
||||
|
||||
var errNoArg = errors.New("no argument given")
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
func TestNonWinConfig(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("Not running Windows, skipping")
|
||||
t.Skip("Running Windows, skipping")
|
||||
}
|
||||
conf, err := conf.GetDNSConfig()
|
||||
assert.NilError(t, err)
|
||||
|
|
10
doc/awl.1
10
doc/awl.1
|
@ -5,7 +5,7 @@
|
|||
.nh
|
||||
.ad l
|
||||
.\" Begin generated content:
|
||||
.TH "awl" "1" "2022-07-29"
|
||||
.TH "awl" "1" "2022-08-01"
|
||||
.PP
|
||||
.SH NAME
|
||||
awl - DNS lookup tool
|
||||
|
@ -23,11 +23,11 @@ where
|
|||
.PP
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\fBawl\fR (\fBa\fRwls \fBw\fRant \fBl\fRicorice) is a simple tool designed to make DNS queries
|
||||
\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
|
||||
\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
|
||||
|
@ -214,6 +214,10 @@ Setting the first bit (DO) will be ignored, use \fB-D\fR instead
|
|||
.br
|
||||
Set EDNS padding
|
||||
.PP
|
||||
\fB+subnet\fR=\fIaddr/prefix\fR
|
||||
.br
|
||||
Set EDNS client subnet
|
||||
.PP
|
||||
.RE
|
||||
.SS Output Display
|
||||
.RS 4
|
||||
|
|
4
go.mod
4
go.mod
|
@ -8,7 +8,7 @@ require (
|
|||
github.com/lucas-clemente/quic-go v0.28.1
|
||||
github.com/miekg/dns v1.1.50
|
||||
github.com/stefansundin/go-zflag v1.1.1
|
||||
golang.org/x/net v0.0.0-20220728211354-c7608f3a8462
|
||||
golang.org/x/net v0.0.0-20220802222814-0bcc04d9c69b
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
gotest.tools/v3 v3.3.0
|
||||
)
|
||||
|
@ -34,7 +34,7 @@ require (
|
|||
github.com/stretchr/testify v1.8.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
|
||||
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10
|
||||
golang.org/x/sys v0.0.0-20220731174439-a90be440212d
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
golang.org/x/tools v0.1.12 // indirect
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
|
||||
|
|
21
go.sum
21
go.sum
|
@ -219,18 +219,10 @@ 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-20220726230323-06994584191e h1:wOQNKh1uuDGRnmgF0jDxh7ctgGy/3P4rYWQRVJD4/Yg=
|
||||
golang.org/x/net v0.0.0-20220726230323-06994584191e/go.mod h1:AaygXjzTFtRAg2ttMY5RMuhpJ3cNnI0XpyFJD1iQRSM=
|
||||
golang.org/x/net v0.0.0-20220728012108-993b7b1e3a27 h1:Khs7GS6mUxEA1e5DfKm9ojYX4BiI297wdliOwp/CPmw=
|
||||
golang.org/x/net v0.0.0-20220728012108-993b7b1e3a27/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
|
||||
golang.org/x/net v0.0.0-20220728030405-41545e8bf201 h1:bvOltf3SADAfG05iRml8lAB3qjoEX5RCyN4K6G5v3N0=
|
||||
golang.org/x/net v0.0.0-20220728030405-41545e8bf201/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
|
||||
golang.org/x/net v0.0.0-20220728153142-1f511ac62c11 h1:BZ+7NKCw5UIzmPP4GFz9VcjTVpN9mswsWRDmJ2tWKAs=
|
||||
golang.org/x/net v0.0.0-20220728153142-1f511ac62c11/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
|
||||
golang.org/x/net v0.0.0-20220728181054-f92ba40d432d h1:3iMzhioG3w6/URLOo7X7eZRkWoLdz9iWE/UsnXHNTfY=
|
||||
golang.org/x/net v0.0.0-20220728181054-f92ba40d432d/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
|
||||
golang.org/x/net v0.0.0-20220728211354-c7608f3a8462 h1:UreQrH7DbFXSi9ZFox6FNT3WBooWmdANpU+IfkT1T4I=
|
||||
golang.org/x/net v0.0.0-20220728211354-c7608f3a8462/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
|
||||
golang.org/x/net v0.0.0-20220802222814-0bcc04d9c69b h1:3ogNYyK4oIQdIKzTu68hQrr4iuVxF3AxKl9Aj/eDrw0=
|
||||
golang.org/x/net v0.0.0-20220802222814-0bcc04d9c69b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
|
@ -242,7 +234,6 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ
|
|||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
@ -270,10 +261,8 @@ 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-20220727055044-e65921a090b8 h1:dyU22nBWzrmTQxtNrr4dzVOvaw35nUYE279vF9UmsI8=
|
||||
golang.org/x/sys v0.0.0-20220727055044-e65921a090b8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg=
|
||||
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220731174439-a90be440212d h1:Sv5ogFZatcgIMMtBSTTAgMYsicp25MXBubjXNDKwm80=
|
||||
golang.org/x/sys v0.0.0-20220731174439-a90be440212d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
|
@ -297,8 +286,6 @@ golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4f
|
|||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.11 h1:loJ25fNOEhSXfHrpoGj91eCUThwdNX6u24rO1xnNteY=
|
||||
golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4=
|
||||
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
|
|
@ -76,6 +76,10 @@ func CreateQuery(opts cli.Options) (helpers.Response, error) {
|
|||
opts.Logger.Info("EDNS DNSSEC OK set")
|
||||
}
|
||||
|
||||
if opts.EDNS.Subnet.Address != nil {
|
||||
o.Option = append(o.Option, &opts.EDNS.Subnet)
|
||||
}
|
||||
|
||||
req.Extra = append(req.Extra, o)
|
||||
} else {
|
||||
if opts.EDNS.DNSSEC {
|
||||
|
@ -109,7 +113,7 @@ func CreateQuery(opts cli.Options) (helpers.Response, error) {
|
|||
str += "\n;; QUERY SIZE: " + strconv.Itoa(req.Len())
|
||||
}
|
||||
fmt.Println(str, "\n------")
|
||||
opts.QR = false
|
||||
opts.ShowQuery = false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ func ToString(res helpers.Response, opts cli.Options) string {
|
|||
s += "AUTHORITY: " + strconv.Itoa(len(res.DNS.Ns)) + ", "
|
||||
s += "ADDITIONAL: " + strconv.Itoa(len(res.DNS.Extra)) + "\n"
|
||||
opt = res.DNS.IsEdns0()
|
||||
if opt != nil {
|
||||
if opt != nil && opts.Display.Opt {
|
||||
// OPT PSEUDOSECTION
|
||||
s += opt.String() + "\n"
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ VER ?= "git-$(HASH)"
|
|||
CGO_ENABLED ?= 0
|
||||
GO ?= go
|
||||
COVER ?= $(GO) tool cover
|
||||
GOFLAGS ?= -ldflags "-s -w -X=main.version=$(VER)"
|
||||
GOFLAGS ?= -ldflags "-s -w -X=main.version=$(VER)" -trimpath
|
||||
|
||||
PREFIX ?= /usr/local
|
||||
BIN ?= bin
|
||||
|
@ -24,7 +24,6 @@ doc/$(PROG).1: doc/wiki/$(PROG).1.md
|
|||
@cp doc/awl.1 doc/awl.bak
|
||||
$(SCDOC) <doc/wiki/$(PROG).1.md >doc/$(PROG).1 && rm doc/awl.bak || mv doc/awl.bak doc/awl.1
|
||||
|
||||
|
||||
## test: run go test
|
||||
test:
|
||||
$(GO) test -cover -coverprofile=coverage/coverage.out ./...
|
||||
|
|
Loading…
Reference in a new issue