start of server side (sending) AXFR

This commit is contained in:
Miek Gieben 2011-03-18 14:13:42 +01:00
parent d728de7088
commit b722229700
3 changed files with 46 additions and 0 deletions

11
TODO
View File

@ -1,9 +1,20 @@
Guidelines for the API:
o symmetrical, client side stuff should be mirrored in the server stuff
o clean, small API
o fast data structures (rb-tree, when they come available)
o api-use should lead to self documenting code
o compression (only ownernames?)
Todo:
* Parsing from strings, going with goyacc and .cz lexer?
* encoding NSEC3/NSEC bitmaps, DEcoding works
* HIP RR (needs list of domain names, need slice stuff for that)
* Resolver can see if you want ixfr or axfr from the msg no
need for seperate functions
* Is subdomain, is glue helper functions
Issues:
* Check the network order, it works now, but this is on Intel??

View File

@ -11,6 +11,7 @@ import (
"net"
)
// Do I want this
type Server struct {
ServeUDP func(*net.UDPConn, net.Addr, *Msg) os.Error
ServeTCP func(*net.TCPConn, net.Addr, *Msg) os.Error

34
xfr.go
View File

@ -1,3 +1,37 @@
package dns
import (
"net"
)
// Outgoing AXFR and IXFR implementations
// Read from m until it is closed. Group the RRs until
// no space is left and send the messages.
// How do I know the message still fits in 64 K???
func AxfrTCP(c *net.TCPConn, a net.Addr, m chan Xfr) {
msg := new(Msg)
msg.Answer = make([]RR, 1000)
i := 0
var soa *RR_SOA
for r := range m {
msg.Answer[i] = r.RR
if soa == nil {
if r.RR.Header().Rrtype != TypeSOA {
// helegaar geen SOA
} else {
soa = r.RR.(*RR_SOA)
}
}
i++
if i > 1000 {
// send it
msg.Answer = msg.Answer[:0]
i = 0
}
}
// Last one, what if was 1000 send lonely soa?? No matter
// what, add the SOA and send the msg
msg.Answer[i] = soa
// send it
}