Update the examples

This commit is contained in:
Miek Gieben 2012-12-02 09:34:40 +01:00
parent 2d1d1303c1
commit 862e4c7419
3 changed files with 10 additions and 10 deletions

View File

@ -77,7 +77,7 @@ func main() {
os.Exit(1)
}
if ra.Rcode != dns.RcodeSuccess {
fmt.Printf("Error getting the IPv4 address of %s: %s\n", nameserver, dns.Rcode_str[ra.Rcode])
fmt.Printf("Error getting the IPv4 address of %s: %s\n", nameserver, dns.RcodeToString[ra.Rcode])
os.Exit(1)
}
for _, ansa := range ra.Answer {
@ -92,7 +92,7 @@ func main() {
os.Exit(1)
}
if raaaa.Rcode != dns.RcodeSuccess {
fmt.Printf("Error getting the IPv6 address of %s: %s\n", nameserver, dns.Rcode_str[raaaa.Rcode])
fmt.Printf("Error getting the IPv6 address of %s: %s\n", nameserver, dns.RcodeToString[raaaa.Rcode])
os.Exit(1)
}
for _, ansaaaa := range raaaa.Answer {
@ -123,7 +123,7 @@ func main() {
}
if soa.Rcode != dns.RcodeSuccess {
success = false
fmt.Printf("%s (%s) ", ips, dns.Rcode_str[soa.Rcode])
fmt.Printf("%s (%s) ", ips, dns.RcodeToString[soa.Rcode])
goto Next
}
if len(soa.Answer) == 0 { // May happen if the server is a recursor, not authoritative, since we query with RD=0

View File

@ -78,12 +78,12 @@ Flags:
}
// First class, then type, to make ANY queries possible
// And if it looks like type, it is a type
if k, ok := dns.Str_rr[strings.ToUpper(flag.Arg(i))]; ok {
if k, ok := dns.StringToType[strings.ToUpper(flag.Arg(i))]; ok {
qtype = k
continue Flags
}
// If it looks like a class, it is a class
if k, ok := dns.Str_class[strings.ToUpper(flag.Arg(i))]; ok {
if k, ok := dns.StringToClass[strings.ToUpper(flag.Arg(i))]; ok {
qclass = k
continue Flags
}
@ -344,7 +344,7 @@ func getKey(name string, keytag uint16, server string, tcp bool) *dns.RR_DNSKEY
// shorten RRSIG to "miek.nl RRSIG(NS)"
func shortSig(sig *dns.RR_RRSIG) string {
return sig.Header().Name + " RRSIG(" + dns.Rr_str[sig.TypeCovered] + ")"
return sig.Header().Name + " RRSIG(" + dns.TypeToString[sig.TypeCovered] + ")"
}
// Walk trough message and short Key data and Sig data
@ -379,7 +379,7 @@ func shortRR(r dns.RR) dns.RR {
}
func doXfr(c *dns.Client, m *dns.Msg, nameserver string) {
if t, e := c.XfrReceive(m, nameserver); e == nil {
if t, e := c.TransferIn(m, nameserver); e == nil {
for r := range t {
if r.Error == nil {
for _, rr := range r.RR {

View File

@ -88,9 +88,9 @@ func handleReflect(w dns.ResponseWriter, r *dns.Msg) {
switch r.Question[0].Qtype {
case dns.TypeAXFR:
c := make(chan *dns.XfrToken)
c := make(chan *dns.Envelope)
var e *error
if err := dns.XfrSend(w, r, c, e); err != nil {
if err := dns.TransferOut(w, r, c, e); err != nil {
close(c)
return
}
@ -100,7 +100,7 @@ func handleReflect(w dns.ResponseWriter, r *dns.Msg) {
7200
604800
3600)`)
c <- &dns.XfrToken{RR: []dns.RR{soa, t, rr, soa}}
c <- &dns.Envelope{RR: []dns.RR{soa, t, rr, soa}}
close(c)
w.Hijack()
// w.Close() // Client closes