Skip to content

Make OPT.String() more dig-like, Fix MBZ display - #1684

Closed
brianshea2 wants to merge 1 commit into
miekg:masterfrom
brianshea2:master
Closed

Make OPT.String() more dig-like, Fix MBZ display#1684
brianshea2 wants to merge 1 commit into
miekg:masterfrom
brianshea2:master

Conversation

@brianshea2

Copy link
Copy Markdown
Contributor
  • Minor changes to how the OPT String() function generates its output to better match dig
    • colon after "version"
    • comma vs. semicolon
    • flags are space separated (no comma)
  • The CO flag could be set without the DO flag
  • Fix getting of the Z value

@brianshea2

Copy link
Copy Markdown
Contributor Author
e := new(dns.OPT)
e.Hdr.Name = "."
e.Hdr.Rrtype = dns.TypeOPT
e.SetUDPSize(1400)
e.SetDo()
e.SetCo()
fmt.Println(e.String())

Before:

;; OPT PSEUDOSECTION:
; EDNS: version 0; flags: do, co; MBZ: 0x4000, udp: 1400

After:

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags: do co; udp: 1400

@miekg

miekg commented Nov 27, 2025

Copy link
Copy Markdown
Owner

i think moving further away from the dig-format would be better, https://codeberg.org/miekg/dns does that.

no need to do it here.

@miekg miekg closed this Nov 27, 2025
@brianshea2

Copy link
Copy Markdown
Contributor Author

@miekg this also fixes the currently broken display of the MBZ value. Are you no longer accepting fixes for this project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants