Skip to content

Commit

Permalink
Make code more succinct, regarding returning serialnumber
Browse files Browse the repository at this point in the history
Signed-off-by: Rhys Evans <rhys.rr@googlemail.com>
  • Loading branch information
rhysxevans committed Jan 2, 2025
1 parent b8c230f commit 32b26aa
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions prober/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ func getSerialNumber(state *tls.ConnectionState) string {
// serialNumber := cert.SerialNumber.Text(16) // drops leading zeros outputs = BFFBC11F1907D02AF719AFCD64FB253 in lower case, telgraf follows this https://github.com/influxdata/telegraf/blob/a9c91f162ddbe453364f68a89799535c43328a3c/plugins/inputs/x509_cert/x509_cert.go#L218
// https://github.com/atc0005/check-cert retains the leading zero with some aditional formatting

serialNumber := strings.ToLower(fmt.Sprintf("%X", cert.SerialNumber.Bytes()))

return serialNumber
return fmt.Sprintf("%x", cert.SerialNumber.Bytes())
}

func getTLSVersion(state *tls.ConnectionState) string {
Expand Down

0 comments on commit 32b26aa

Please sign in to comment.