package models import ( "time" "github.com/google/uuid" ) // Node defines the data we gather through the parsing. It should follow the // Styx terminology // (https://docs.google.com/document/d/1dIrh1Lp3KAjEMm8o2VzAmuV0Peu-jt9aAh1IHrjAroM/pub#h.xzbicbtscatx) type Node struct { ID string `json:"id"` Type string `json:"type"` Data CertStreamStruct `json:"data"` } // Edge defines a relation between two nodes. type Edge struct { ID string `json:"id"` NodeOneID uuid.UUID `json:"NodeOneID"` // NodeTwoID uuid.UUID `json:NodeTwoID` to implement Timestamp time.Time `json:"Timestamp"` } 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"` } 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"` } type LeafCertStruct struct { Subject *LeafCertSubject `json:"subject"` Extensions *LeafCertExtensions `json:"extensions"` NotBefore string `json:"not_before"` NotAfter string `json:"not_after"` SerialNumber string `json:"serial_number"` Fingerprint string `json:"fingerprint"` AsDer string `json:"as_der"` AllDomains []string `json:"all_domains"` } type Source struct { URL string `json:"url"` Name string `json:"name"` } 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"` } type CertStreamStruct struct { MessageType string `json:"message_data"` Data *CertStreamData `json:"data"` }