73 lines
2.1 KiB
Go
73 lines
2.1 KiB
Go
|
package models
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
|
||
|
"github.com/google/uuid"
|
||
|
)
|
||
|
|
||
|
// Node defines the data we gather through the parsing.
|
||
|
type Node struct {
|
||
|
ID uuid.UUID
|
||
|
Flag string `json:"flag"`
|
||
|
Data CertStreamStruct `json:"data"`
|
||
|
}
|
||
|
|
||
|
// Edge defines a relation between two nodes.
|
||
|
type Edge struct {
|
||
|
ID uuid.UUID
|
||
|
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:"aggregated"`
|
||
|
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 time.Time `json:"seen"`
|
||
|
Source *Source `json:"source"`
|
||
|
}
|
||
|
|
||
|
type CertStreamStruct struct {
|
||
|
MessageType string `json:"message_data"`
|
||
|
Data CertStreamData `json:"data"`
|
||
|
}
|