aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2022-02-03 08:27:03 -0500
committerPaul Duncan <pabs@pablotron.org>2022-02-03 08:27:03 -0500
commit06a4cc5f6d5d66061c8f4f254528aec70a016994 (patch)
tree2302a2897f99d0953eddbd7f56321ee3167002db
parentb7b25ee44fba441835db308c16749c28ceed4e89 (diff)
downloadcvez-06a4cc5f6d5d66061c8f4f254528aec70a016994.tar.bz2
cvez-06a4cc5f6d5d66061c8f4f254528aec70a016994.zip
internal/cpe/binding.go: fix comments
-rw-r--r--internal/cpe/binding.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/internal/cpe/binding.go b/internal/cpe/binding.go
index 8c51d7d..f58752e 100644
--- a/internal/cpe/binding.go
+++ b/internal/cpe/binding.go
@@ -7,7 +7,7 @@ import (
"strings"
)
-// Common Platform Enumeration binding.
+// CPE 2.3 binding.
type Binding struct {
Part Part // Part attribute (NISTIR7695 5.3.3.1).
Vendor AvString // Vendor attribute (NISTIR7695 5.3.3.2).
@@ -22,13 +22,13 @@ type Binding struct {
Other AvString // Other attribute (NISTIR7695 5.3.3.11).
}
-// cpe 2.3 formatted string prefix
+// formatted string prefix
var cpe23Prefix = "cpe:2.3:"
// missing prefix error
var missingPrefix = errors.New("missing CPE 2.3 prefix")
-// Create CPE 2.3 binding from formatted string.
+// Create binding from CPE 2.3 formatted string.
func NewBinding(s string) (Binding, error) {
// check prefix
if s[0:len(cpe23Prefix)] != cpe23Prefix {
@@ -77,6 +77,7 @@ func NewBinding(s string) (Binding, error) {
}, nil
}
+// Serialize binding as CPE 2.3 formatted string.
func (v Binding) String() string {
return cpe23Prefix + strings.Join([]string {
v.Part.String(),
@@ -93,7 +94,7 @@ func (v Binding) String() string {
}, ":")
}
-// Unmarshal CPE formatted string from JSON string.
+// Unmarshal CPE binding from JSON string.
func (me *Binding) UnmarshalJSON(b []byte) error {
// decode json string
var s string
@@ -112,7 +113,7 @@ func (me *Binding) UnmarshalJSON(b []byte) error {
return nil
}
-// Marshal CPE formatted string as JSON string.
+// Marshal CPE binding as JSON string.
func (v Binding) MarshalJSON() ([]byte, error) {
return json.Marshal(v.String())
}