Skip to content

Commit

Permalink
rename AnswerRecord to MessageRecord
Browse files Browse the repository at this point in the history
  • Loading branch information
phuslu committed Oct 23, 2024
1 parent 2e9745f commit dc20dcf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func (msg *Message) DecodeName(dst []byte, name []byte) []byte {
return dst
}

type AnswerRecord struct {
type MessageRecord struct {
Name []byte
Type Type
Class Class
Expand All @@ -224,7 +224,7 @@ type AnswerRecord struct {
}

// Walk calls f for each item in the msg in the original order of the parsed RR.
func (msg *Message) Records(f func(AnswerRecord) bool) {
func (msg *Message) Records(f func(MessageRecord) bool) {
n := msg.Header.ANCount + msg.Header.NSCount
if n == 0 {
return
Expand Down Expand Up @@ -255,15 +255,15 @@ func (msg *Message) Records(f func(AnswerRecord) bool) {
length := uint16(payload[8])<<8 | uint16(payload[9])
data := payload[10 : 10+length]
payload = payload[10+length:]
ok := f(AnswerRecord{Name: name, Type: typ, Class: class, TTL: ttl, Data: data})
ok := f(MessageRecord{Name: name, Type: typ, Class: class, TTL: ttl, Data: data})
if !ok {
break
}
}
}

// WalkAdditionalRecords calls f for each item in the msg in the original order of the parsed AR.
func (msg *Message) AdditionalRecords(f func(AnswerRecord) bool) {
func (msg *Message) AdditionalRecords(f func(MessageRecord) bool) {
panic("not implemented")
}

Expand Down

0 comments on commit dc20dcf

Please sign in to comment.