Documentation
¶
Overview ¶
Package epss provides a client for the FIRST EPSS API. It supports batch requests, exponential backoff, and caching.
Index ¶
Constants ¶
const ( // DefaultBaseURL is the EPSS API base URL. DefaultBaseURL = "https://api.first.org/data/v1/epss" // DefaultTimeout is the default HTTP request timeout. DefaultTimeout = 30 * time.Second // MaxBatchSize is the maximum number of CVEs per API request. MaxBatchSize = 100 // DefaultMaxRetries is the default number of retry attempts. DefaultMaxRetries = 3 // DefaultInitialBackoff is the initial backoff duration for retries. DefaultInitialBackoff = 1 * time.Second // DefaultMaxBackoff is the maximum backoff duration. DefaultMaxBackoff = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an EPSS API client with batching and caching support.
func (*Client) GetScores ¶
GetScores fetches EPSS scores for the given CVE IDs. It automatically batches requests if more than MaxBatchSize CVEs are provided. Results are cached according to the configured TTL.
func (*Client) PreloadCache ¶
PreloadCache loads scores into the cache from an external source. This is useful for initializing the cache from a database.
type Option ¶
type Option func(*Client)
Option is a functional option for configuring the Client.
func WithBackoff ¶
WithBackoff sets the initial and maximum backoff durations.
func WithBaseURL ¶
WithBaseURL sets a custom base URL for the API.
func WithCacheTTL ¶
WithCacheTTL sets the cache time-to-live duration. Set to 0 to disable caching.
func WithHTTPClient ¶
WithHTTPClient sets a custom HTTP client.
func WithMaxRetries ¶
WithMaxRetries sets the maximum number of retry attempts.