fix(print): use any on TTL #169

Merged
sam merged 1 commit from ttl-any into master 2022-12-15 19:30:02 +00:00
2 changed files with 3 additions and 3 deletions

View file

@ -302,7 +302,7 @@ func MakePrintable(res util.Response, opts *util.Options) (*Message, error) {
temp := strings.Split(answer.String(), "\t")
var (
ttl string
ttl any
name string
)
@ -310,7 +310,7 @@ func MakePrintable(res util.Response, opts *util.Options) (*Message, error) {
if opts.Display.HumanTTL {
ttl = (time.Duration(answer.Header().Ttl) * time.Second).String()
} else {
ttl = strconv.Itoa(int(answer.Header().Ttl))
ttl = answer.Header().Ttl
}
}

View file

@ -51,7 +51,7 @@ type Question struct {
// RRHeader is for DNS Resource Headers.
type RRHeader struct {
Name string `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty" example:"127.0.0.1"`
TTL string `json:"ttl,omitempty" xml:"ttl,omitempty" yaml:"ttl,omitempty" example:"0ms"`
TTL any `json:"ttl,omitempty" xml:"ttl,omitempty" yaml:"ttl,omitempty" example:"0ms"`
Class string `json:"class,omitempty" xml:"class,omitempty" yaml:"class,omitempty" example:"A"`
Type string `json:"type,omitempty" xml:"type,omitempty" yaml:"type,omitempty" example:"IN"`
Rdlength uint16 `json:"-" xml:"-" yaml:"-"`