Fix examples

This commit is contained in:
Miek Gieben 2012-05-21 14:56:14 +02:00
parent 7e1741205e
commit 4ec99b2dec
4 changed files with 7 additions and 5 deletions

View File

@ -76,6 +76,8 @@ var (
DefaultReplyChan = newQueryChanSlice()
// DefaultQueryChan is the channel were you can send the questions to.
DefaultQueryChan = newQueryChan()
// Incoming is an alias for DefaultQueryChan
Incoming = DefaultReplyChan
)
// The HandlerQueryFunc type is an adapter to allow the use of

View File

@ -169,7 +169,7 @@ Flags:
// Add tsig
if *tsig != "" {
if algo, name, secret, ok := tsigKeyParse(*tsig); ok {
m.SetTsig(name, algo, 300, m.MsgHdr.Id, time.Now().Unix())
m.SetTsig(name, algo, 300, time.Now().Unix())
c.TsigSecret = map[string]string{name: secret}
} else {
fmt.Fprintf(os.Stderr, "tsig key data error\n")
@ -183,7 +183,7 @@ Flags:
forever:
for {
select {
case r := <-dns.DefaultReplyChan:
case r := <-dns.Incoming:
if r.Reply != nil {
if r.Reply.Rcode == dns.RcodeSuccess {
if r.Request.Id != r.Reply.Id {

View File

@ -88,7 +88,7 @@ func handleReflect(w dns.ResponseWriter, r *dns.Msg) {
if r.IsTsig() {
if w.TsigStatus() == nil {
m.SetTsig(r.Extra[len(r.Extra)-1].(*dns.RR_TSIG).Hdr.Name, dns.HmacMD5, 300, r.MsgHdr.Id, time.Now().Unix())
m.SetTsig(r.Extra[len(r.Extra)-1].(*dns.RR_TSIG).Hdr.Name, dns.HmacMD5, 300, time.Now().Unix())
} else {
println("Status", w.TsigStatus().Error())
}

4
xfr.go
View File

@ -3,8 +3,8 @@ package dns
// XfrReceives requests an incoming Ixfr or Axfr. If the message q's question
// section has type TypeAXFR an Axfr is performed, if it is TypeIXFR it does an Ixfr.
// The [AI]xfr's records are returned on the channel. Note that with an IXFR the client
// needs to determine if records are to be removed are added.
// The channel is closed when the transfer is terminated.
// needs to determine if records are to be removed or added.
// The returned channel is closed when the transfer is terminated.
//
// Basic use pattern for setting up a transfer:
//