runner

package
v0.0.0-...-e85a4bd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BaseURL      string
	ClientConfig client.Config
	// contains filtered or unexported fields
}

Config is used to configure the execution of the converter

type Convertible

type Convertible interface {
	// ID should return vulnerabilities ID
	ID() string
	// Convert should return a new CVE Item, or an error if it's not possible
	Convert() (*nvd.NVDCVEFeedJSON10DefCVEItem, error)
}

Convertible is any struct which knows how to convert itself to NVD CVE Item

type FetchSince

type FetchSince func(ctx context.Context, c client.Client, baseURL string, since int64) (<-chan Convertible, error)

FetchSince knows how to fetch vulnerabilities from an API it should create a new channel, fetch everything concurrently and close the channel

type Read

type Read func(io.Reader, chan Convertible) error

Read should read the vulnerabilities from the given reader and push them into the channel The contents of the reader should be a slice of structs which are convertibles channel will be created and mustn't be closed

type Runner

type Runner struct {
	Config
	FetchSince
	Read
}

Runner knows how to run everything together, based on the config values if config.Download is set, it will use the fetcher, otherwise it will use Reader to read stdin or files

func (*Runner) Run

func (r *Runner) Run() error

Run should be called in main function of the converter It will run the fetchers/runners (and convert vulnerabilities) Finally, it will output it as json to stdout

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL