fix(print): use any on TTL (#169)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This allows JSON to use either an int or string depending on output Reviewed-on: #169 Reviewed-by: grumbulon <grumbulon@grumbulon.xyz>
This commit is contained in:
parent
10d1c4cd2b
commit
792ddecf6c
2 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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:"-"`
|
||||
|
|
Loading…
Reference in a new issue