Skip to content

Commit

Permalink
Merge pull request #12 from genkiroid/add-certificate-field
Browse files Browse the repository at this point in the history
Add Certificate field to Cert type
  • Loading branch information
genkiroid authored Feb 3, 2018
2 parents ddc52b2 + c02fe6d commit 59eee59
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ const defaultPort = "443"
type Certs []*Cert

type Cert struct {
DomainName string `json:"domainName"`
IP string `json:"ip"`
Issuer string `json:"issuer"`
CommonName string `json:"commonName"`
SANs []string `json:"sans"`
NotBefore string `json:"notBefore"`
NotAfter string `json:"notAfter"`
Error string `json:"error"`
DomainName string `json:"domainName"`
IP string `json:"ip"`
Issuer string `json:"issuer"`
CommonName string `json:"commonName"`
SANs []string `json:"sans"`
NotBefore string `json:"notBefore"`
NotAfter string `json:"notAfter"`
Error string `json:"error"`
Certificate *x509.Certificate `json:"-"`
}

var tokens = make(chan struct{}, 128)
Expand Down Expand Up @@ -126,14 +127,15 @@ func NewCert(hostport string) *Cert {
return &Cert{DomainName: host, Error: err.Error()}
}
return &Cert{
DomainName: host,
IP: ip,
Issuer: cert.Issuer.CommonName,
CommonName: cert.Subject.CommonName,
SANs: cert.DNSNames,
NotBefore: cert.NotBefore.In(time.Local).String(),
NotAfter: cert.NotAfter.In(time.Local).String(),
Error: "",
DomainName: host,
IP: ip,
Issuer: cert.Issuer.CommonName,
CommonName: cert.Subject.CommonName,
SANs: cert.DNSNames,
NotBefore: cert.NotBefore.In(time.Local).String(),
NotAfter: cert.NotAfter.In(time.Local).String(),
Error: "",
Certificate: cert,
}
}

Expand Down

0 comments on commit 59eee59

Please sign in to comment.