feat: RFC-8427 #171

Merged
sam merged 16 commits from RFC-8427 into master 2022-12-27 20:07:09 +00:00
2 changed files with 19 additions and 17 deletions
Showing only changes of commit 9226d0cdf0 - Show all commits

View file

@ -28,7 +28,7 @@ type Message struct {
Name string `json:"QNAME,omitempty" xml:"QNAME,omitempty" yaml:"QNAME,omitempty" example:"localhost"`
Type uint16 `json:"QTYPE,omitempty" xml:"QTYPE,omitempty" yaml:"QTYPE,omitempty" example:"IN"`
TypeName string `json:"QTYPEname,omitempty" xml:"QTYPEname,omitempty" yaml:"QTYPEname,omitempty" example:"IN"`
Class string `json:"QCLASS,omitempty" xml:"QCLASS,omitempty" yaml:"QCLASS,omitempty" example:"A"`
Class uint16 `json:"QCLASS,omitempty" xml:"QCLASS,omitempty" yaml:"QCLASS,omitempty" example:"A"`
ClassName string `json:"QCLASSname,omitempty" xml:"QCLASSname,omitempty" yaml:"QCLASSname,omitempty" example:"1"`
RTT string `json:"queryTime,omitempty" xml:"queryTime,omitempty" yaml:"queryTime,omitempty"`
Server string `json:"server,omitempty" xml:"server,omitempty" yaml:"server,omitempty"`
@ -49,9 +49,9 @@ type Message struct {
//nolint:govet,tagliatelle
type Question struct {
Name string `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty" example:"localhost"`
Type uint16 `json:"type,omitempty" xml:"type,omitempty" yaml:"type,omitempty" example:"IN"`
Type uint16 `json:"TYPE,omitempty" xml:"type,omitempty" yaml:"type,omitempty" example:"IN"`
TypeName string `json:"TYPEname,omitempty" xml:"TYPEname,omitempty" yaml:"TYPEname,omitempty" example:"IN"`
Class string `json:"class,omitempty" xml:"class,omitempty" yaml:"class,omitempty" example:"A"`
Class uint16 `json:"CLASS,omitempty" xml:"class,omitempty" yaml:"class,omitempty" example:"A"`
ClassName string `json:"CLASSname,omitempty" xml:"CLASSname,omitempty" yaml:"CLASSname,omitempty" example:"1"`
}
@ -59,12 +59,12 @@ type Question struct {
//
//nolint:govet,tagliatelle
type Answer struct {
Name string `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty" example:"127.0.0.1"`
Type uint16 `json:"type,omitempty" xml:"type,omitempty" yaml:"type,omitempty" example:"IN"`
Name string `json:"NAME,omitempty" xml:"name,omitempty" yaml:"name,omitempty" example:"127.0.0.1"`
Type uint16 `json:"TYPE,omitempty" xml:"type,omitempty" yaml:"type,omitempty" example:"IN"`
TypeName string `json:"TYPEname,omitempty" xml:"TYPEname,omitempty" yaml:"TYPEname,omitempty" example:"IN"`
Class uint16 `json:"class,omitempty" xml:"class,omitempty" yaml:"class,omitempty" example:"A"`
Class uint16 `json:"CLASS,omitempty" xml:"class,omitempty" yaml:"class,omitempty" example:"A"`
ClassName string `json:"CLASSname,omitempty" xml:"CLASSname,omitempty" yaml:"CLASSname,omitempty" example:"A"`
TTL string `json:"ttl,omitempty" xml:"ttl,omitempty" yaml:"ttl,omitempty" example:"0ms"`
TTL string `json:"TTL,omitempty" xml:"ttl,omitempty" yaml:"ttl,omitempty" example:"0ms"`
Value string `json:"response,omitempty" xml:"response,omitempty" yaml:"response,omitempty"`
Rdlength uint16 `json:"RDLENGTH,omitempty" xml:"RDLENGTH,omitempty" yaml:"RDLENGTH,omitempty"`
Rdhex string `json:"RDATAHEX,omitempty" xml:"RDATAHEX,omitempty" yaml:"RDATAHEX,omitempty"`

View file

@ -29,10 +29,10 @@ func (message *Message) displayQuestion(msg *dns.Msg, opts *util.Options, opt *d
}
message.Name = name
message.Type = opt.Header().Rrtype
message.Type = question.Qtype
message.TypeName = dns.TypeToString[question.Qtype]
message.Class = dns.ClassToString[question.Qclass]
message.ClassName = dns.TypeToString[question.Qtype]
message.Class = question.Qclass
message.ClassName = dns.ClassToString[question.Qclass]
}
return nil
@ -66,11 +66,13 @@ func (message *Message) displayAnswers(msg *dns.Msg, opts *util.Options, opt *dn
}
message.AnswerRRs = append(message.AnswerRRs, Answer{
Name: name,
TypeName: dns.TypeToString[answer.Header().Rrtype],
Type: answer.Header().Rrtype,
Rdlength: answer.Header().Rdlength,
TTL: ttl,
Name: name,
ClassName: dns.ClassToString[answer.Header().Class],
Class: answer.Header().Class,
TypeName: dns.TypeToString[answer.Header().Rrtype],
Type: answer.Header().Rrtype,
Rdlength: answer.Header().Rdlength,
TTL: ttl,
Value: temp[len(temp)-1],
})
@ -110,7 +112,7 @@ func (message *Message) displayAuthority(msg *dns.Msg, opts *util.Options, opt *
Name: name,
TypeName: dns.TypeToString[ns.Header().Rrtype],
Type: ns.Header().Rrtype,
Class: ns.Header().Rrtype,
Class: ns.Header().Class,
ClassName: dns.ClassToString[ns.Header().Class],
Rdlength: ns.Header().Rdlength,
TTL: ttl,
@ -156,7 +158,7 @@ func (message *Message) displayAdditional(msg *dns.Msg, opts *util.Options, opt
Name: name,
TypeName: dns.TypeToString[additional.Header().Rrtype],
Type: additional.Header().Rrtype,
Class: additional.Header().Rrtype,
Class: additional.Header().Class,
ClassName: dns.ClassToString[additional.Header().Class],
Rdlength: additional.Header().Rdlength,
TTL: ttl,