mirror of
https://github.com/miekg/dns.git
synced 2025-12-16 09:11:34 +01:00
remove some debugging code
This commit is contained in:
parent
04a18e9937
commit
d1e5b182a7
9
README
9
README
@ -5,10 +5,15 @@ to send it.
|
|||||||
|
|
||||||
The library is asynchronise (thanks to Go) from the get go.
|
The library is asynchronise (thanks to Go) from the get go.
|
||||||
|
|
||||||
Implemented RFCS
|
Implemented RFCS:
|
||||||
|
|
||||||
* RFC2671, EDNS
|
* RFC2671, EDNS
|
||||||
|
* RFC1034/1035
|
||||||
|
* RFC4033/4034/4035 (todo: validation)
|
||||||
|
* RFC5155 (NSEC)
|
||||||
|
|
||||||
|
|
||||||
|
Loosly based upon:
|
||||||
* ldns
|
* ldns
|
||||||
* NSD
|
* NSD
|
||||||
* Net::DNS
|
* Net::DNS
|
||||||
|
|||||||
4
TODO
4
TODO
@ -1,6 +1,10 @@
|
|||||||
EDNS -- finish EDNS0 support
|
EDNS -- finish EDNS0 support
|
||||||
DNSSEC - validation and the remaining records, DS (encoding), NSEC and NSEC3
|
DNSSEC - validation and the remaining records, DS (encoding), NSEC and NSEC3
|
||||||
unknown RRs - if I ever get around to make it
|
unknown RRs - if I ever get around to make it
|
||||||
|
convience functions
|
||||||
|
parsing from strings
|
||||||
|
"miek.nl IN A 192.168.1.2" -> <correct Go type>
|
||||||
|
in msg.go, clean out the code and put it in helper functions
|
||||||
|
|
||||||
quotes in quotes in txt records
|
quotes in quotes in txt records
|
||||||
fix os.Erros usage (extend or whatever)
|
fix os.Erros usage (extend or whatever)
|
||||||
|
|||||||
21
msg.go
21
msg.go
@ -98,10 +98,10 @@ func packDomainName(s string, msg []byte, off int) (off1 int, ok bool) {
|
|||||||
begin = i + 1
|
begin = i + 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Root label is special
|
// Root label is special
|
||||||
if s == "." {
|
if s == "." {
|
||||||
return off,true
|
return off, true
|
||||||
}
|
}
|
||||||
msg[off] = 0
|
msg[off] = 0
|
||||||
off++
|
off++
|
||||||
return off, true
|
return off, true
|
||||||
@ -204,9 +204,7 @@ func packStructValue(val *reflect.StructValue, msg []byte, off int) (off1 int, o
|
|||||||
msg[off+3] = byte(len(data))
|
msg[off+3] = byte(len(data))
|
||||||
off += 4
|
off += 4
|
||||||
copy(msg[off:off+len(data)], []byte(data))
|
copy(msg[off:off+len(data)], []byte(data))
|
||||||
off += len(data) // +1??
|
off += len(data) // +1?? MG TODO
|
||||||
println("data", data)
|
|
||||||
println("off", off)
|
|
||||||
}
|
}
|
||||||
case "A":
|
case "A":
|
||||||
if fv.Len() > net.IPv4len || off+fv.Len() > len(msg) {
|
if fv.Len() > net.IPv4len || off+fv.Len() > len(msg) {
|
||||||
@ -225,9 +223,9 @@ func packStructValue(val *reflect.StructValue, msg []byte, off int) (off1 int, o
|
|||||||
msg[off] = byte(fv.Elem(j).(*reflect.UintValue).Get())
|
msg[off] = byte(fv.Elem(j).(*reflect.UintValue).Get())
|
||||||
off++
|
off++
|
||||||
}
|
}
|
||||||
case "NSEC3":
|
case "NSEC3":
|
||||||
case "NSEC":
|
case "NSEC":
|
||||||
// handle type bit maps
|
// handle type bit maps
|
||||||
}
|
}
|
||||||
case *reflect.StructValue:
|
case *reflect.StructValue:
|
||||||
off, ok = packStructValue(fv, msg, off)
|
off, ok = packStructValue(fv, msg, off)
|
||||||
@ -552,8 +550,7 @@ type Msg struct {
|
|||||||
Question []Question
|
Question []Question
|
||||||
Answer []RR
|
Answer []RR
|
||||||
Ns []RR
|
Ns []RR
|
||||||
// EDNS0 has to be put in this section
|
Extra []RR
|
||||||
Extra []RR
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ func TestResolverEdns(t *testing.T) {
|
|||||||
m := new(Msg)
|
m := new(Msg)
|
||||||
m.MsgHdr.Recursion_desired = true //only set this bit
|
m.MsgHdr.Recursion_desired = true //only set this bit
|
||||||
m.Question = make([]Question, 1)
|
m.Question = make([]Question, 1)
|
||||||
m.Extra = make([]RR, 1)
|
m.Ns = make([]RR, 1)
|
||||||
|
|
||||||
// Add EDNS rr
|
// Add EDNS rr
|
||||||
edns := new(RR_OPT)
|
edns := new(RR_OPT)
|
||||||
@ -32,7 +32,7 @@ func TestResolverEdns(t *testing.T) {
|
|||||||
|
|
||||||
// ask something
|
// ask something
|
||||||
m.Question[0] = Question{"miek.nl", TypeSOA, ClassINET}
|
m.Question[0] = Question{"miek.nl", TypeSOA, ClassINET}
|
||||||
m.Extra[0] = edns
|
m.Ns[0] = edns
|
||||||
|
|
||||||
fmt.Printf("Sending: %v\n", m)
|
fmt.Printf("Sending: %v\n", m)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user