Skip to content

Commit

Permalink
rename VisitResourceRecords to Walk
Browse files Browse the repository at this point in the history
  • Loading branch information
phuslu committed Aug 4, 2022
1 parent b036177 commit 6b02eef
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions cmd/fastdig/fastdig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion cmd/fastdoh/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
8 changes: 4 additions & 4 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
}

Expand Down

0 comments on commit 6b02eef

Please sign in to comment.