diff options
Diffstat (limited to 'nvdmirror/update.go')
-rw-r--r-- | nvdmirror/update.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/nvdmirror/update.go b/nvdmirror/update.go new file mode 100644 index 0000000..871cd89 --- /dev/null +++ b/nvdmirror/update.go @@ -0,0 +1,33 @@ +package nvdmirror + +import ( + "encoding/json" +) + +//go:generate stringer -linecomment -type=UpdateType + +// update type +type UpdateType byte + +// Marshal UpdateType as JSON. +func (t UpdateType) MarshalJSON() ([]byte, error) { + return json.Marshal(t.String()) +} + +const ( + UpdateCveYear UpdateType = iota // cveyear + UpdateCveMeta // cvemeta + UpdateCpeMatch // cpematch + UpdateCpeDict // cpedict + UpdateCisaKevc // kevc + UpdateCweList // cwe +) + +// Syncronization update. +type Update struct { + Type UpdateType `json:"type"` // update type + Year int `json:"year,omitempty"` // CVE year (only used for cve years) + Meta string `json:"meta,omitempty"` // CVE meta type (only used for cve metas) + Url string `json:"url,omitempty"` // source URL + Path string `json:"path,omitempty"` // backing file +} |