// CVSS vector parser. package cvss // Metric key. type Key interface { // Get full name. Name() string // Get category. Category() Category // Return string representation. String() string } // CVSS metric. type Metric interface { // Get metric key. Key() Key // Return string representation of metric. String() string } // CVSS metric vector. type Vector interface { // Get CVSS version. Version() Version // Get CVSS vector string. String() string // Return metrics in this vector. Metrics() []Metric } // Create new CVSS vector from vector string. func NewVector(s string) (Vector, error) { if isV31VectorString(s) { // create CVSS v3.1 vector. return newV31Vector(s) } else if isV30VectorString(s) { // create CVSS v3.0 vector. return newV30Vector(s) } else { // create CVSS V2 vector return newV2Vector(s) } }