more server stuff

This commit is contained in:
Miek Gieben 2011-09-11 22:10:04 +02:00
parent 0ffb28d3d9
commit 21e2f63b4c
2 changed files with 38 additions and 42 deletions

View File

@ -12,6 +12,8 @@ import (
"net"
)
// how to do Tsig here?? TODO(mg)
type Handler interface {
ServeDNS(w ResponseWriter, r *Msg)
// IP based ACL mapping. The contains the string representation
@ -27,6 +29,7 @@ type ResponseWriter interface {
Write([]byte) (int, os.Error)
}
// port?
type conn struct {
remoteAddr net.Addr // address of remote side (sans port)
handler Handler // request handler

17
xfr.go
View File

@ -4,12 +4,8 @@ import (
"os"
)
// Fix the sending function to work on messages, keep the size
// of the callers contral
// XfrReceives requests an incoming Ixfr or Axfr. If the message q's question
// section contains an AXFR type an Axfr is performed, if it is IXFR it does
// an Ixfr.
// section contains an AXFR type an Axfr is performed, if it is IXFR it does an Ixfr.
// Each message will be send along the Client's reply channel as it is received.
// The last message send has Exchange.Error set to ErrXfrLast
// to signal there is nothing more to come.
@ -119,15 +115,12 @@ func (w *reply) ixfrReceive() {
return
}
// XfrSend performs an outgoing Ixfr or Axfr. If the message q's question
// section contains an AXFR type an Axfr is performed. If it is IXFR
// it does an Ixfr.
// XfrSend performs an outgoing Ixfr or Axfr. The function is xfr agnostic, it is
// up to the caller to correctly send the sequence of messages.
func XfrSend(w ResponseWriter, q *Msg, a string) os.Error {
switch q.Question[0].Qtype {
case TypeAXFR:
// go d.axfrWrite(q, m, e)
case TypeIXFR:
// go d.ixfrWrite(q, m)
case TypeAXFR, TypeIXFR:
// go d.xfrWrite(q, m, e)
default:
return ErrXfrType
}