New does help
This commit is contained in:
parent
a3865be05e
commit
496ab892d8
3
TODO
3
TODO
|
@ -4,6 +4,9 @@ Todo:
|
|||
* encoding NSEC3/NSEC bitmaps, DEcoding works
|
||||
* AXFR/IXFR with TSIG validation
|
||||
* Failed Xfr triggers nil error?
|
||||
* Use callback in IXFR/AXFR to make tsig happen (and other cool stuff in FunkenSturm)
|
||||
* A New for all type with some defaults filled in
|
||||
* Take a good look at hash.Hash take over the digest sizes and names
|
||||
* HIP RR (needs list of domain names, need slice stuff for that)
|
||||
|
||||
Issues:
|
||||
|
|
1
dns.go
1
dns.go
|
@ -23,6 +23,7 @@ const (
|
|||
Year68 = 2 << (32 - 1) // For RFC1982 (Serial Arithmetic) calculations in 32 bits.
|
||||
DefaultMsgSize = 4096 // A standard default for larger than 512 packets.
|
||||
MaxMsgSize = 65536 // Largest possible DNS packet.
|
||||
DefaultTtl = 3600 // Default Ttl, used in New() for instance.
|
||||
)
|
||||
|
||||
// Error represents a DNS error
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package dns
|
||||
|
||||
func New(i int) RR {
|
||||
var rr RR
|
||||
mk, known := rr_mk[i]
|
||||
if !known {
|
||||
rr = new(RR_RFC3597)
|
||||
} else {
|
||||
rr = mk()
|
||||
}
|
||||
|
||||
switch t := rr.(type) {
|
||||
case *RR_RFC3597:
|
||||
t.Hdr = RR_Header{Ttl: DefaultTtl, Class: ClassINET, Rrtype: uint16(i)}
|
||||
case *RR_TSIG:
|
||||
t.Hdr = RR_Header{Ttl: 0, Class: ClassANY, Rrtype: uint16(i)}
|
||||
t.Fudge = 300
|
||||
case *RR_OPT:
|
||||
t.Hdr = RR_Header{Name: "", Ttl: 0, Class: 0, Rrtype: uint16(i)}
|
||||
t.SetVersion(0)
|
||||
t.SetUDPSize(DefaultMsgSize)
|
||||
case *RR_A:
|
||||
t.Hdr = RR_Header{Ttl: DefaultTtl, Class: ClassINET, Rrtype: uint16(i)}
|
||||
case *RR_AAAA:
|
||||
t.Hdr = RR_Header{Ttl: DefaultTtl, Class: ClassINET, Rrtype: uint16(i)}
|
||||
}
|
||||
return rr
|
||||
}
|
|
@ -219,7 +219,9 @@ Server:
|
|||
// returned over the channel, so the caller will receive
|
||||
// the zone as-is. Xfr.Add is always true.
|
||||
// The channel is closed to signal the end of the AXFR.
|
||||
func (res *Resolver) Axfr(q *Msg, m chan Xfr) {
|
||||
// f is a callback function called after every message has been
|
||||
// received.
|
||||
func (res *Resolver) Axfr(q *Msg, m chan Xfr, f func(*Msg) bool) {
|
||||
var port string
|
||||
var in *Msg
|
||||
if res.Port == "" {
|
||||
|
|
Loading…
Reference in New Issue