Skip to content

Commit

Permalink
feat: add show opt flag
Browse files Browse the repository at this point in the history
  • Loading branch information
natesales committed Jul 16, 2024
1 parent 0090971 commit cf7c2e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type Flags struct {
ShortTTLs bool `long:"short-ttls" description:"Remove zero components of pretty TTLs. (24h0m0s->24h) (default: true)"`
Color bool `long:"color" description:"Enable color output"`
ShowQuestion bool `long:"question" description:"Show question section"`
ShowOpt bool `long:"opt" description:"Show OPT records"`
ShowAnswer bool `long:"answer" description:"Show answer section (default: true)"`
ShowAuthority bool `long:"authority" description:"Show authority section"`
ShowAdditional bool `long:"additional" description:"Show additional section"`
Expand Down
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,14 @@ All long form (--) flags can be toggled with the dig-standard +[no]flag notation
errChan <- fmt.Errorf("no reply from server")
}

if opts.ShowOpt {
for _, o := range reply.Extra {
if o.Header().Rrtype == dns.TypeOPT {
fmt.Printf("OPT: %v\n", o)
}
}
}

if transportType != transport.TypeQUIC && opts.IDCheck && reply.Id != msg.Id {
errChan <- fmt.Errorf("ID mismatch: expected %d, got %d", msg.Id, reply.Id)
}
Expand Down

0 comments on commit cf7c2e5

Please sign in to comment.