Fix opt pseudo section stuff
This commit is contained in:
parent
1914a36ab7
commit
b2a6356596
|
@ -104,7 +104,7 @@ Flags:
|
|||
m.MsgHdr.RecursionDesired = *rd
|
||||
m.Question = make([]dns.Question, 1)
|
||||
if *dnssec || *nsid {
|
||||
opt := new(dns.RR_OPT)
|
||||
opt := dns.NewRR(dns.TypeOPT).(*dns.RR_OPT)
|
||||
opt.SetDo()
|
||||
opt.SetVersion(0)
|
||||
opt.SetUDPSize(dns.DefaultMsgSize)
|
||||
|
|
2
dns.go
2
dns.go
|
@ -15,7 +15,7 @@
|
|||
//
|
||||
// Or directly from a string:
|
||||
//
|
||||
// mx := NewRR("miek.nl IN MX 10 mx.miek.nl.")
|
||||
// mx := NewRRString("miek.nl IN MX 10 mx.miek.nl.")
|
||||
//
|
||||
// The package dns supports (async) querying/replying, incoming/outgoing Axfr/Ixfr,
|
||||
// TSIG, EDNS0, dynamic updates, notifies and DNSSEC validation/signing.
|
||||
|
|
|
@ -142,7 +142,7 @@ func TestParseFailure(t *testing.T) {
|
|||
// "miek.nl. PA MX 10 miek.nl.",
|
||||
|
||||
for _, t1 := range tests {
|
||||
_, err := NewRR(t1)
|
||||
_, err := NewRRString(t1)
|
||||
if err == nil {
|
||||
t.Log("Should have triggered an error")
|
||||
t.Fail()
|
||||
|
|
12
types.go
12
types.go
|
@ -147,12 +147,20 @@ func (q *Question) String() string {
|
|||
return s
|
||||
}
|
||||
|
||||
// NewRR returns the last RR contained in s.
|
||||
func NewRR(s string) (RR, os.Error) {
|
||||
// NewRRString returns the last RR contained in s.
|
||||
func NewRRString(s string) (RR, os.Error) {
|
||||
p := NewParser(strings.NewReader(s))
|
||||
return p.RR()
|
||||
}
|
||||
|
||||
// NewRR returns a new RR with the hdr.Rrtype also set.
|
||||
// If the type i is not known, nil is returned.
|
||||
func NewRR(i int) RR {
|
||||
r := rr_mk[i]()
|
||||
r.Header().Rrtype = uint16(i)
|
||||
return r
|
||||
}
|
||||
|
||||
type RR_CNAME struct {
|
||||
Hdr RR_Header
|
||||
Cname string "domain-name"
|
||||
|
|
Loading…
Reference in New Issue