diff options
author | Paul Duncan <pabs@pablotron.org> | 2022-01-31 14:29:13 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2022-01-31 14:29:13 -0500 |
commit | 2edd887a7fdb493c047c0900123af063ddf23b1d (patch) | |
tree | 48ae9400f913d1066adfdd87dea5aba8ec19c390 /internal/cvss/cvss.go | |
parent | 5533e686418f38d646f9a009586d3d748327769f (diff) | |
download | cvez-2edd887a7fdb493c047c0900123af063ddf23b1d.tar.bz2 cvez-2edd887a7fdb493c047c0900123af063ddf23b1d.zip |
add internal/cvss/v2vector.go
Diffstat (limited to 'internal/cvss/cvss.go')
-rw-r--r-- | internal/cvss/cvss.go | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/internal/cvss/cvss.go b/internal/cvss/cvss.go index c56046b..4a1a789 100644 --- a/internal/cvss/cvss.go +++ b/internal/cvss/cvss.go @@ -8,61 +8,6 @@ import ( //go:generate stringer -linecomment -type=v3Key //go:generate stringer -linecomment -type=v3Metric -// CVSS 2.0 vector. -type v2Vector []v2Metric - -// Convert vector to string -func (v v2Vector) String() string { - // convert to slice of metrics - metrics := []v2Metric(v) - - // build vector - r := make([]string, len(metrics)) - for i, m := range(metrics) { - r[i] = m.String() - } - - // build and return string - return strings.Join(r, "/") -} - -// Return CVSS version. -func (v2Vector) Version() Version { - return V20 -} -// Return metrics in this vector. -func (v v2Vector) Metrics() []Metric { - // build result - r := make([]Metric, len(v)) - for i, m := range(v) { - r[i] = m - } - - // return result - return r -} - -// create CVSS 2.0 vector from string -func newV2Vector(s string) (Vector, error) { - strs := strings.Split(s, "/") - r := make([]v2Metric, len(strs)) - - // walk metric strings - for i, ms := range(strs) { - // convert string to vector - m, err := getV2MetricFromString(ms) - if err != nil { - return nil, err - } - - // add to results - r[i] = m - } - - // build and return vector - return v2Vector(r), nil -} - // CVSS v3 metric key type v3Key byte |