Documentation ¶
Index ¶
- Constants
- type Config
- type Curator
- func (c *Curator) Delete() error
- func (c *Curator) GetStore() (v5.StoreReader, error)
- func (c *Curator) ImportFrom(dbArchivePath string) error
- func (c *Curator) IsUpdateAvailable() (bool, *Metadata, *ListingEntry, error)
- func (c Curator) ListingFromURL() (Listing, error)
- func (c *Curator) Status() Status
- func (c Curator) SupportedSchema() int
- func (c *Curator) Update() (bool, error)
- func (c *Curator) UpdateTo(listing *ListingEntry, downloadProgress, importProgress *progress.Manual, ...) error
- func (c *Curator) Validate() error
- type Listing
- type ListingEntry
- type ListingEntryJSON
- type Metadata
- type MetadataJSON
- type Status
Constants ¶
const (
FileName = v5.VulnerabilityStoreFileName
)
const ListingFileName = "listing.json"
const MetadataFileName = "metadata.json"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Curator ¶
type Curator struct {
// contains filtered or unexported fields
}
func NewCurator ¶
func (*Curator) ImportFrom ¶
ImportFrom takes a DB archive file and imports it into the final DB location.
func (*Curator) IsUpdateAvailable ¶
func (c *Curator) IsUpdateAvailable() (bool, *Metadata, *ListingEntry, error)
IsUpdateAvailable indicates if there is a new update available as a boolean, and returns the latest listing information available for this schema.
func (Curator) ListingFromURL ¶
ListingFromURL loads a Listing from a URL.
func (Curator) SupportedSchema ¶
func (*Curator) UpdateTo ¶
func (c *Curator) UpdateTo(listing *ListingEntry, downloadProgress, importProgress *progress.Manual, stage *progress.AtomicStage) error
UpdateTo updates the existing DB with the specific other version provided from a listing entry.
type Listing ¶
type Listing struct {
Available map[int][]ListingEntry `json:"available"`
}
Listing represents the json file which is served up and made available for applications to download and consume one or more vulnerability db flat files.
func NewListing ¶
func NewListing(entries ...ListingEntry) Listing
NewListing creates a listing from one or more given ListingEntries.
func NewListingFromFile ¶
NewListingFromFile loads a Listing from a given filepath.
func (*Listing) BestUpdate ¶
func (l *Listing) BestUpdate(targetSchema int) *ListingEntry
BestUpdate returns the ListingEntry from a Listing that meets the given version constraints.
type ListingEntry ¶
ListingEntry represents basic metadata about a database archive such as what is in the archive (built/version) as well as how to obtain and verify the archive (URL/checksum).
func NewListingEntryFromArchive ¶
func NewListingEntryFromArchive(fs afero.Fs, metadata Metadata, dbArchivePath string, baseURL *url.URL) (ListingEntry, error)
NewListingEntryFromArchive creates a new ListingEntry based on the metadata from a database flat file.
func (*ListingEntry) MarshalJSON ¶
func (l *ListingEntry) MarshalJSON() ([]byte, error)
func (ListingEntry) String ¶
func (l ListingEntry) String() string
func (*ListingEntry) UnmarshalJSON ¶
func (l *ListingEntry) UnmarshalJSON(data []byte) error
type ListingEntryJSON ¶
type ListingEntryJSON struct { Built string `json:"built"` Version int `json:"version"` URL string `json:"url"` Checksum string `json:"checksum"` }
ListingEntryJSON is a helper struct for converting a ListingEntry into JSON (or parsing from JSON)
func (ListingEntryJSON) ToListingEntry ¶
func (l ListingEntryJSON) ToListingEntry() (ListingEntry, error)
ToListingEntry converts a ListingEntryJSON to a ListingEntry.
type Metadata ¶
Metadata represents the basic identifying information of a database flat file (built/version) and a way to verify the contents (checksum).
func NewMetadataFromDir ¶
NewMetadataFromDir generates a Metadata object from a directory containing a vulnerability.db flat file.
func (*Metadata) IsSupersededBy ¶
func (m *Metadata) IsSupersededBy(entry *ListingEntry) bool
IsSupersededBy takes a ListingEntry and determines if the entry candidate is newer than what is hinted at in the current Metadata object.
func (*Metadata) UnmarshalJSON ¶
type MetadataJSON ¶
type MetadataJSON struct { Built string `json:"built"` // RFC 3339 Version int `json:"version"` Checksum string `json:"checksum"` }
MetadataJSON is a helper struct for parsing and assembling Metadata objects to and from JSON.
func (MetadataJSON) ToMetadata ¶
func (m MetadataJSON) ToMetadata() (Metadata, error)
ToMetadata converts a MetadataJSON object to a Metadata object.