diff options
author | Ilya Mashchenko <ilya@netdata.cloud> | 2024-06-17 12:19:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-17 12:19:18 +0300 |
commit | c09373fe617540d09ae58a15f580e4903f720f34 (patch) | |
tree | 0e3809e5c653c0a4fd31d2c5a8be6d081635adc3 | |
parent | 9c4aae6869c54c79a65160fa32e88240fd24cb88 (diff) |
go.d whoisquery: use Domain.ExpirationDateInTime if provided (#17926)
-rw-r--r-- | src/go/collectors/go.d.plugin/modules/whoisquery/provider.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/go/collectors/go.d.plugin/modules/whoisquery/provider.go b/src/go/collectors/go.d.plugin/modules/whoisquery/provider.go index 6e6917bc8c..f6164da7ca 100644 --- a/src/go/collectors/go.d.plugin/modules/whoisquery/provider.go +++ b/src/go/collectors/go.d.plugin/modules/whoisquery/provider.go @@ -66,10 +66,14 @@ func (c *whoisClient) queryWhoisInfo() (*whoisparser.WhoisInfo, error) { } func parseWhoisInfoExpirationDate(info *whoisparser.WhoisInfo) (float64, error) { - if info == nil { + if info == nil || info.Domain == nil { return 0, errors.New("nil Whois Info") } + if info.Domain.ExpirationDateInTime != nil { + return time.Until(*info.Domain.ExpirationDateInTime).Seconds(), nil + } + date := info.Domain.ExpirationDate if date == "" { return 0, errors.New("no expiration date") |