styx/models/types.go

77 lines
2.3 KiB
Go
Raw Normal View History

package models
import (
"time"
"github.com/google/uuid"
)
2020-01-16 12:06:03 +01:00
// 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 time.Time `json:"created"`
Modified time.Time `json:"modified"`
}
// Edge defines a relation between two nodes.
type Edge struct {
2020-01-16 12:06:03 +01:00
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 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"`
}
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"`
}