diff options
author | Paul Duncan <pabs@pablotron.org> | 2022-01-31 14:06:19 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2022-01-31 14:06:19 -0500 |
commit | 2a29b254b40bad71fc00a312280c3373b1bb733b (patch) | |
tree | 726dbc638868bea1b86958753d10d87b719ad5ac /internal/cvss | |
parent | 843c6168690f01a9a4a96f1c6e1aa6e3cde90096 (diff) | |
download | cvez-2a29b254b40bad71fc00a312280c3373b1bb733b.tar.bz2 cvez-2a29b254b40bad71fc00a312280c3373b1bb733b.zip |
internal/cvss: move category and version to separate files
Diffstat (limited to 'internal/cvss')
-rw-r--r-- | internal/cvss/category.go | 13 | ||||
-rw-r--r-- | internal/cvss/cvss.go | 20 | ||||
-rw-r--r-- | internal/cvss/v3metrickey_string.go | 5 | ||||
-rw-r--r-- | internal/cvss/version.go | 13 |
4 files changed, 29 insertions, 22 deletions
diff --git a/internal/cvss/category.go b/internal/cvss/category.go new file mode 100644 index 0000000..45b8947 --- /dev/null +++ b/internal/cvss/category.go @@ -0,0 +1,13 @@ +// CVSS vector parser. +package cvss + +//go:generate stringer -linecomment -type=Category + +// CVSS metric category. +type Category byte + +const ( + Base Category = iota // Base + Temporal // Temporal + Environmental // Environmental +) diff --git a/internal/cvss/cvss.go b/internal/cvss/cvss.go index f260ce2..b92d819 100644 --- a/internal/cvss/cvss.go +++ b/internal/cvss/cvss.go @@ -6,31 +6,11 @@ import ( "strings" ) -//go:generate stringer -linecomment -type=Version -//go:generate stringer -linecomment -type=Category //go:generate stringer -linecomment -type=v2MetricKey //go:generate stringer -linecomment -type=v2Metric //go:generate stringer -linecomment -type=v3MetricKey //go:generate stringer -linecomment -type=v3Metric -// CVSS version -type Version byte - -const ( - V20 Version = iota // 2.0 - V30 // 3.0 - V31 // 3.1 -) - -// CVSS metric category. -type Category byte - -const ( - Base Category = iota // Base - Temporal // Temporal - Environmental // Environmental -) - // CVSS metric key. type v2MetricKey byte diff --git a/internal/cvss/v3metrickey_string.go b/internal/cvss/v3metrickey_string.go index ff9b74f..e30c9cc 100644 --- a/internal/cvss/v3metrickey_string.go +++ b/internal/cvss/v3metrickey_string.go @@ -30,11 +30,12 @@ func _() { _ = x[v3ModifiedConfidentiality-19] _ = x[v3ModifiedIntegrity-20] _ = x[v3ModifiedAvailability-21] + _ = x[v3InvalidMetricKey-22] } -const _v3MetricKey_name = "AVACPRUISCIAERLRCCRIRARMAVMACMPRMUIMSMCMIMA" +const _v3MetricKey_name = "AVACPRUISCIAERLRCCRIRARMAVMACMPRMUIMSMCMIMAinvalid" -var _v3MetricKey_index = [...]uint8{0, 2, 4, 6, 8, 9, 10, 11, 12, 13, 15, 17, 19, 21, 23, 26, 29, 32, 35, 37, 39, 41, 43} +var _v3MetricKey_index = [...]uint8{0, 2, 4, 6, 8, 9, 10, 11, 12, 13, 15, 17, 19, 21, 23, 26, 29, 32, 35, 37, 39, 41, 43, 50} func (i v3MetricKey) String() string { if i >= v3MetricKey(len(_v3MetricKey_index)-1) { diff --git a/internal/cvss/version.go b/internal/cvss/version.go new file mode 100644 index 0000000..ab9d61f --- /dev/null +++ b/internal/cvss/version.go @@ -0,0 +1,13 @@ +// CVSS vector string parser. +package cvss + +//go:generate stringer -linecomment -type=Version + +// CVSS version +type Version byte + +const ( + V20 Version = iota // 2.0 + V30 // 3.0 + V31 // 3.1 +) |