Documentation
¶
Index ¶
Constants ¶
View Source
const ( DefaultTimeout = 10 * time.Second DefaultUserAgent = "github.com/nscuro/ossindex-client" )
View Source
const MaxCoordinatesCount = 128
MaxCoordinatesCount describes the maximum allowed amount of coordinates per request.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(options ...ClientOption) (*Client, error)
NewClient creates a new client, optionally applying
func (Client) GetComponentReports ¶
func (c Client) GetComponentReports(ctx context.Context, coordinates []string) ([]ComponentReport, error)
GetComponentReports requests vulnerability reports for one or more components.
OSS Index enforces a limit of 128 coordinates per request. If the given coordinates slice exceeds this limit, Client will chunk them and perform multiple requests.
type ClientOption ¶
func WithAuthentication ¶
func WithAuthentication(username, token string) ClientOption
WithAuthentication enables authentication using the given credentials.
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
WithTimeout overrides the default timeout.
func WithUserAgent ¶
func WithUserAgent(userAgent string) ClientOption
WithUserAgent overrides the default user agent.
type ComponentReport ¶
type ComponentReport struct {
Coordinates string `json:"coordinates"`
Description string `json:"description"`
Reference string `json:"reference"`
Vulnerabilities []Vulnerability `json:"vulnerabilities"`
}
type Vulnerability ¶
type Vulnerability struct {
ID string `json:"id"`
DisplayName string `json:"displayName"`
Title string `json:"title"`
Description string `json:"description"`
CVSSScore float64 `json:"cvssScore"`
CVSSVector string `json:"cvssVector"`
CWE string `json:"cwe"`
CVE string `json:"cve"`
Reference string `json:"reference"`
VersionRanges []string `json:"versionRange"`
}
Click to show internal directories.
Click to hide internal directories.