package models import ( "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"` Created string `json:"created"` Modified string `json:"modified"` } // 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 string `json:"Timestamp"` } // 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"` } // PasteMeta is a set of descriptive information on a paste. type PasteMeta struct { ScrapeURL string `json:"scrape_url"` FullURL string `json:"full_url"` Date string `json:"date"` Key string `json:"key"` Size string `json:"size"` Expire string `json:"expire"` Title string `json:"title"` Syntax string `json:"syntax"` User string `json:"user"` } // PasteFull extends PasteMeta by the actual content. type PasteFull struct { ScrapeURL string `json:"scrape_url"` FullURL string `json:"full_url"` Date string `json:"date"` Key string `json:"key"` Size string `json:"size"` Expire string `json:"expire"` Title string `json:"title"` Syntax string `json:"syntax"` User string `json:"user"` Data string `json:"data"` RFC3339 string `json:"time"` }