Update the documentation
This commit is contained in:
parent
71b860e0d3
commit
77348913dd
|
@ -55,7 +55,7 @@ Flags:
|
|||
}
|
||||
// If it starts with TYPExxx it is unknown rr
|
||||
if strings.HasPrefix(flag.Arg(i), "TYPE") {
|
||||
i, e := strconv.Atoi(string( []byte(flag.Arg(i))[4:]))
|
||||
i, e := strconv.Atoi(string([]byte(flag.Arg(i))[4:]))
|
||||
if e == nil {
|
||||
qtype = uint16(i)
|
||||
continue Flags
|
||||
|
@ -94,9 +94,7 @@ Flags:
|
|||
opt.SetDo()
|
||||
opt.SetUDPSize(dns.DefaultMsgSize)
|
||||
if *nsid {
|
||||
opt.Option = make([]dns.Option, 1)
|
||||
opt.Option[0].Code = dns.OptionCodeNSID
|
||||
opt.Option[0].Data = ""
|
||||
opt.SetNsid("")
|
||||
}
|
||||
m.Extra = make([]dns.RR, 1)
|
||||
m.Extra[0] = opt
|
||||
|
|
2
dns.go
2
dns.go
|
@ -113,7 +113,7 @@ func (h *RR_Header) String() string {
|
|||
return s
|
||||
}
|
||||
|
||||
// Return the number of labels in a domain name
|
||||
// Return the number of labels in a domain name.
|
||||
func LabelCount(a string) (c uint8) {
|
||||
// walk the string and count the dots
|
||||
// except when it is escaped
|
||||
|
|
11
edns.go
11
edns.go
|
@ -31,6 +31,14 @@ type Option struct {
|
|||
* Rdlength uint16 // length of data after the header
|
||||
*/
|
||||
|
||||
// Adding an EDNS0 record to a message is done as follows:
|
||||
// opt := new(RR_OPT)
|
||||
// opt.Hdr = dns.RR_Header{Name: "", Rrtype: TypeOPT}
|
||||
// opt.SetVersion(0) // set version to zero
|
||||
// opt.SetDo() // set the DO bit
|
||||
// opt.SetUDPSize(4096) // set the message size
|
||||
// m.Extra = make([]RR, 1)
|
||||
// m.Extra[0] = opt // add OPT RR to the message
|
||||
type RR_OPT struct {
|
||||
Hdr RR_Header
|
||||
Option []Option "OPT" // tag is used in Pack and Unpack
|
||||
|
@ -101,7 +109,7 @@ func (rr *RR_OPT) Do() bool {
|
|||
return byte(rr.Hdr.Ttl >> 8) &_DO == _DO
|
||||
}
|
||||
|
||||
// Set the do bit
|
||||
// Set the DO bit
|
||||
func (rr *RR_OPT) SetDo() {
|
||||
b1 := byte(rr.Hdr.Ttl >> 24)
|
||||
b2 := byte(rr.Hdr.Ttl >> 16)
|
||||
|
@ -118,6 +126,7 @@ func (rr *RR_OPT) Nsid() string {
|
|||
|
||||
// Set the NSID from a string which is represented as hex characters.
|
||||
func (rr *RR_OPT) SetNsid(hexnsid string) {
|
||||
rr.Option = make([]Option, 1) // TODO(mg) check length first?
|
||||
rr.Option[0].Code = OptionCodeNSID
|
||||
rr.Option[0].Data = hexnsid
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue