styx/models/cerstream.go
Christopher Talib 7785372e3a Refactoring from utils to models
This work refactors saving and extracting function from the utils
package to the models package as it is a main component of the tool.
`utils` will take care of not related to models functions (such as
finding the files for example).

Also creating unique files for each type of source we are parsing.
2020-01-28 16:02:17 +01:00

58 lines
2 KiB
Go

package models
// LeafCertExtensions extends the LeafCert object.
type LeafCertExtensions struct {
KeyUsage string `json:"keyUsage"`
ExtendedKeyUsage string `json:"extendedKeyUsage"`
BasicConstrains string `json:"basicConstrains"`
SubjectKeyIdentifier string `json:"subjectKeyIdentifier"`
AuthorityInfoAccess string `json:"authorityInfoAccess"`
SubjectAltName string `json:"subjectAltName"`
CertificatePolicies string `json:"certificatePolicies"`
}
// LeafCertSubject is the subject of the LeafCert object.
type LeafCertSubject struct {
Aggregated string `json:"aggregated"`
C string `json:"C"`
ST string `json:"ST"`
L string `json:"L"`
O string `json:"O"`
OU string `json:"OU"`
CN string `json:"CN"`
}
// LeafCertStruct represents the LeafCert object.
type LeafCertStruct struct {
Subject LeafCertSubject `json:"subject"`
Extensions LeafCertExtensions `json:"extensions"`
NotBefore int `json:"not_before"`
NotAfter int `json:"not_after"`
SerialNumber string `json:"serial_number"`
Fingerprint string `json:"fingerprint"`
AsDer string `json:"as_der"`
AllDomains []string `json:"all_domains"`
}
// Source is the object ofr the URL and its name.
type Source struct {
URL string `json:"url"`
Name string `json:"name"`
}
// CertStreamData is the data contained in a CertStream payload.
type CertStreamData struct {
UpdateType string `json:"update_type"`
LeafCert LeafCertStruct `json:"leaf_cert"`
Chain []LeafCertStruct `json:"chain"`
CertIndex int `json:"cert_index"`
Seen int `json:"seen"`
Source Source `json:"source"`
}
// CertStreamStruct reprensts a payload received from CertStream. It has a type
// and the content is stored in Data.
type CertStreamStruct struct {
MessageType string `json:"message_data"`
Data CertStreamData `json:"data"`
}