-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotice.go
45 lines (39 loc) · 1.06 KB
/
notice.go
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
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) 2023 Julian Müller (ChaoticByte)
package main
import (
// "encoding/json"
"time"
)
type WidNotice struct {
// obligatory
Uuid string `json:"uuid"`
Name string `json:"name"`
Title string `json:"title"`
Published time.Time `json:"published"`
Classification string `json:"classification"`
// optional fields (only fully supported by cert-bund)
Basescore int `json:"basescore"` // -1 = unknown
Status string `json:"status"` // "" = unknown
ProductNames []string `json:"productNames"` // empty = unknown
Cves []string `json:"cves"` // empty = unknown
NoPatch string `json:"noPatch"` // "" = unknown
// metadata
ApiEndpointId string
PortalUrl string
}
// func (n WidNotice) serialized() ([]byte, error) {
// return json.Marshal(n)
// }
// func NewWidNoticeFromJSON(data []byte) (WidNotice, error) {
// n := WidNotice{}
// err := json.Unmarshal(data, &n)
// return n, err
// }
func noticeSliceContains(notices []WidNotice, notice WidNotice) bool {
for _, x := range notices {
if x.Uuid == notice.Uuid {
return true
}
}
return false
}