aboutsummaryrefslogtreecommitdiff
path: root/nvdmirror/update.go
blob: 871cd897f4bdc0714a2277ed22ba723392063b47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
}