Skip to content

Commit 3b9c22b

Browse files
authored
Support for expired certificates
1 parent 968ae39 commit 3b9c22b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/dstp/dstp.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ func testTLS(ctx context.Context, address common.Address) (common.Output, error)
103103
notAfter := conn.ConnectionState().PeerCertificates[0].NotAfter
104104
expiresAfter := time.Until(notAfter)
105105
expiry := math.Round(expiresAfter.Hours() / 24)
106-
output += fmt.Sprintf("certificate is valid for %v more days", expiry)
106+
if expiry > 0 {
107+
output += fmt.Sprintf("certificate is valid for %v more days", expiry)
108+
} else {
109+
output += fmt.Sprintf("the certificate expired %v days ago", expiry)
110+
}
107111

108112
return common.Output(output), nil
109113
}

0 commit comments

Comments
 (0)