Documentation
¶
Overview ¶
Package crl provides Fetcher interface with its implementation, and the Cache interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCacheMiss = errors.New("cache miss")
ErrCacheMiss is returned when a cache miss occurs.
Functions ¶
This section is empty.
Types ¶
type Bundle ¶
type Bundle struct {
// BaseCRL is the parsed base CRL
BaseCRL *x509.RevocationList
// DeltaCRL is the parsed delta CRL
//
// TODO: support delta CRL https://github.com/notaryproject/notation-core-go/issues/228
// It will always be nil until we support delta CRL
DeltaCRL *x509.RevocationList
}
Bundle is a collection of CRLs, including base and delta CRLs
type Cache ¶
type Cache interface {
// Get retrieves the CRL bundle with the given url
//
// url is the key to retrieve the CRL bundle
//
// if the key does not exist or the content is expired, return ErrCacheMiss.
Get(ctx context.Context, url string) (*Bundle, error)
// Set stores the CRL bundle with the given url
//
// url is the key to store the CRL bundle
// bundle is the CRL collections to store
Set(ctx context.Context, url string, bundle *Bundle) error
}
Cache is an interface that specifies methods used for caching
type Fetcher ¶
type Fetcher interface {
// Fetch retrieves the CRL from the given URL.
Fetch(ctx context.Context, url string) (*Bundle, error)
}
Fetcher is an interface that specifies methods used for fetching CRL from the given URL
type HTTPFetcher ¶
type HTTPFetcher struct {
// Cache stores fetched CRLs and reuses them until the CRL reaches the
// NextUpdate time.
// If Cache is nil, no cache is used.
Cache Cache
// DiscardCacheError specifies whether to discard any error on cache.
//
// ErrCacheMiss is not considered as an failure and will not be returned as
// an error if DiscardCacheError is false.
DiscardCacheError bool
// contains filtered or unexported fields
}
HTTPFetcher is a Fetcher implementation that fetches CRL from the given URL
func NewHTTPFetcher ¶
func NewHTTPFetcher(httpClient *http.Client) (*HTTPFetcher, error)
NewHTTPFetcher creates a new HTTPFetcher with the given HTTP client
Click to show internal directories.
Click to hide internal directories.