diff --git a/client_test.go b/client_test.go index 5f76504..bca7141 100644 --- a/client_test.go +++ b/client_test.go @@ -29,7 +29,7 @@ func TestClientExchange(t *testing.T) { t.Errorf("client=%+v exchange(%v) error: %+v\n", client, c.Domain, err) } t.Logf("%s: CLASS %s TYPE %s\n", resp.Domain, resp.Question.Class, resp.Question.Type) - _ = resp.VisitResourceRecords(func(name []byte, typ Type, class Class, ttl uint32, data []byte) bool { + _ = resp.Walk(func(name []byte, typ Type, class Class, ttl uint32, data []byte) bool { switch typ { case TypeCNAME: t.Logf("%s.\t%d\t%s\t%s\t%s.\n", resp.DecodeName(nil, name), ttl, class, typ, resp.DecodeName(nil, data)) diff --git a/cmd/fastdig/fastdig.go b/cmd/fastdig/fastdig.go index 3094daa..b9cce27 100644 --- a/cmd/fastdig/fastdig.go +++ b/cmd/fastdig/fastdig.go @@ -93,7 +93,7 @@ func opt(option string, options []string) bool { } func short(resp *fastdns.Message) { - _ = resp.VisitResourceRecords(func(name []byte, typ fastdns.Type, class fastdns.Class, ttl uint32, data []byte) bool { + _ = resp.Walk(func(name []byte, typ fastdns.Type, class fastdns.Class, ttl uint32, data []byte) bool { var v interface{} switch typ { case fastdns.TypeA, fastdns.TypeAAAA: @@ -177,7 +177,7 @@ func cmd(req, resp *fastdns.Message, server string, start, end time.Time) { } else { fmt.Printf(";; AUTHORITY SECTION:\n") } - _ = resp.VisitResourceRecords(func(name []byte, typ fastdns.Type, class fastdns.Class, ttl uint32, data []byte) bool { + _ = resp.Walk(func(name []byte, typ fastdns.Type, class fastdns.Class, ttl uint32, data []byte) bool { var v interface{} switch typ { case fastdns.TypeA, fastdns.TypeAAAA: diff --git a/cmd/fastdoh/main.go b/cmd/fastdoh/main.go index dd3e477..7bc8b76 100644 --- a/cmd/fastdoh/main.go +++ b/cmd/fastdoh/main.go @@ -34,7 +34,7 @@ func (h *DNSHandler) ServeDNS(rw fastdns.ResponseWriter, req *fastdns.Message) { } if h.Debug { - _ = resp.VisitResourceRecords(func(name []byte, typ fastdns.Type, class fastdns.Class, ttl uint32, data []byte) bool { + _ = resp.Walk(func(name []byte, typ fastdns.Type, class fastdns.Class, ttl uint32, data []byte) bool { switch typ { case fastdns.TypeCNAME: log.Printf("%s.\t%d\t%s\t%s\t%s.\n", resp.DecodeName(nil, name), ttl, class, typ, resp.DecodeName(nil, data)) diff --git a/message.go b/message.go index 02d6def..dbc117b 100644 --- a/message.go +++ b/message.go @@ -213,8 +213,8 @@ func (msg *Message) DecodeName(dst []byte, name []byte) []byte { return dst } -// VisitResourceRecords calls f for each item in the msg in the original order of the parsed RR. -func (msg *Message) VisitResourceRecords(f func(name []byte, typ Type, class Class, ttl uint32, data []byte) bool) error { +// Walk calls f for each item in the msg in the original order of the parsed RR. +func (msg *Message) Walk(f func(name []byte, typ Type, class Class, ttl uint32, data []byte) bool) error { n := msg.Header.ANCount + msg.Header.NSCount if n == 0 { return ErrInvalidAnswer @@ -254,8 +254,8 @@ func (msg *Message) VisitResourceRecords(f func(name []byte, typ Type, class Cla return nil } -// VisitAdditionalRecords calls f for each item in the msg in the original order of the parsed AR. -func (msg *Message) VisitAdditionalRecords(f func(name []byte, typ Type, class Class, ttl uint32, data []byte) bool) error { +// WalkAdditionalRecords calls f for each item in the msg in the original order of the parsed AR. +func (msg *Message) WalkAdditionalRecords(f func(name []byte, typ Type, class Class, ttl uint32, data []byte) bool) error { panic("not implemented") }