slight updates to the TODO
This commit is contained in:
parent
19bf874769
commit
bec4153541
|
@ -21,7 +21,6 @@ things that need to be fixed.
|
||||||
a major memory saver;
|
a major memory saver;
|
||||||
* Check base64/base32/hex validity when parsing RRs;
|
* Check base64/base32/hex validity when parsing RRs;
|
||||||
* Include os.Error in ParseError too? (more info).
|
* Include os.Error in ParseError too? (more info).
|
||||||
* zone.Nxt needs to be differently sorted than the default
|
|
||||||
* Split up the package? An idea might be:
|
* Split up the package? An idea might be:
|
||||||
dns/zone -- contains all zone parsing
|
dns/zone -- contains all zone parsing
|
||||||
dns/server -- server side stuff
|
dns/server -- server side stuff
|
||||||
|
|
|
@ -186,6 +186,7 @@ func ListenAndQuery(c chan *Request, handler QueryHandler) {
|
||||||
// Write returns the original question and the answer on the reply channel of the
|
// Write returns the original question and the answer on the reply channel of the
|
||||||
// client.
|
// client.
|
||||||
func (w *reply) Write(m *Msg) {
|
func (w *reply) Write(m *Msg) {
|
||||||
|
// Check if nil??
|
||||||
w.Client().ChannelReply <- &Exchange{Request: w.req, Reply: m}
|
w.Client().ChannelReply <- &Exchange{Request: w.req, Reply: m}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
6
dns.go
6
dns.go
|
@ -46,6 +46,7 @@ package dns
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -146,8 +147,9 @@ func (s RRset) Ok() bool {
|
||||||
|
|
||||||
// Exchange is used in communicating with the resolver.
|
// Exchange is used in communicating with the resolver.
|
||||||
type Exchange struct {
|
type Exchange struct {
|
||||||
Request *Msg // The question sent.
|
Request *Msg // The question sent.
|
||||||
Reply *Msg // The answer to the question that was sent.
|
Reply *Msg // The answer to the question that was sent.
|
||||||
|
Error os.Error // If something when wrong, this contains the error.
|
||||||
}
|
}
|
||||||
|
|
||||||
// DNS resource records.
|
// DNS resource records.
|
||||||
|
|
35
xfr.go
35
xfr.go
|
@ -7,55 +7,54 @@ import (
|
||||||
// Perform an incoming Ixfr or Axfr. If the message q's question
|
// Perform an incoming Ixfr or Axfr. If the message q's question
|
||||||
// section contains an AXFR type an Axfr is performed. If q's question
|
// section contains an AXFR type an Axfr is performed. If q's question
|
||||||
// section contains an IXFR type an Ixfr is performed.
|
// section contains an IXFR type an Ixfr is performed.
|
||||||
func (c *Client) XfrReceive(q *Msg, a string) ([]*Msg, os.Error) {
|
// Each message will be send along the Client's reply channel as it
|
||||||
|
// is received.
|
||||||
|
func (c *Client) XfrReceive(q *Msg, a string) os.Error {
|
||||||
w := new(reply)
|
w := new(reply)
|
||||||
w.client = c
|
w.client = c
|
||||||
w.addr = a
|
w.addr = a
|
||||||
w.req = q // is this needed TODO(mg)
|
w.req = q
|
||||||
|
|
||||||
if err := w.Send(q); err != nil {
|
if err := w.Send(q); err != nil {
|
||||||
return nil, err
|
return err
|
||||||
}
|
}
|
||||||
// conn should be set now
|
// conn should be set now
|
||||||
switch q.Question[0].Qtype {
|
switch q.Question[0].Qtype {
|
||||||
case TypeAXFR:
|
case TypeAXFR:
|
||||||
return w.axfrReceive()
|
go w.axfrReceive()
|
||||||
case TypeIXFR:
|
case TypeIXFR:
|
||||||
// return w.ixfrReceive()
|
// go w.ixfrReceive()
|
||||||
}
|
}
|
||||||
panic("not reached")
|
return nil
|
||||||
return nil, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *reply) axfrReceive() ([]*Msg, os.Error) {
|
func (w *reply) axfrReceive() {
|
||||||
axfr := make([]*Msg, 0) // use append ALL the time?
|
|
||||||
first := true
|
first := true
|
||||||
for {
|
for {
|
||||||
in, err := w.Receive()
|
in, err := w.Receive()
|
||||||
axfr = append(axfr, in)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return axfr, err
|
w.Client().ChannelReply <- &Exchange{Request: w.req, Reply: in, Error: err}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if first {
|
if first {
|
||||||
if !checkXfrSOA(in, true) {
|
if !checkXfrSOA(in, true) {
|
||||||
return axfr, ErrXfrSoa
|
w.Client().ChannelReply <- &Exchange{Request: w.req, Reply: in, Error: ErrXfrSoa}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
first = !first
|
first = !first
|
||||||
}
|
}
|
||||||
|
|
||||||
if !first {
|
if !first {
|
||||||
w.tsigTimersOnly = true // Subsequent envelopes use this.
|
w.tsigTimersOnly = true // Subsequent envelopes use this.
|
||||||
if !checkXfrSOA(in, false) {
|
w.Client().ChannelReply <- &Exchange{Request: w.req, Reply: in}
|
||||||
// Soa record not the last one
|
if checkXfrSOA(in, false) {
|
||||||
continue
|
return
|
||||||
} else {
|
|
||||||
return axfr, nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
panic("not reached")
|
panic("not reached")
|
||||||
return nil, nil
|
return
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue