crl

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Overview

Package crl provides functionalities for crl revocation check.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileCache

type FileCache struct {
	// contains filtered or unexported fields
}

FileCache implements corecrl.Cache.

Key: url of the CRL.

Value: corecrl.Bundle.

This cache builds on top of the UNIX file system to leverage the file system's atomic operations. The `rename` and `remove` operations will unlink the old file but keep the inode and file descriptor for existing processes to access the file. The old inode will be dereferenced when all processes close the old file descriptor. Additionally, the operations are proven to be atomic on UNIX-like platforms, so there is no need to handle file locking.

NOTE: For Windows, the `open`, `rename` and `remove` operations need file locking to ensure atomicity. The current implementation does not handle file locking, so the concurrent write from multiple processes may be failed. Please do not use this cache in a multi-process environment on Windows.

func NewFileCache

func NewFileCache(root string) (*FileCache, error)

NewFileCache creates a FileCache with root as the root directory

An example for root is `dir.CacheFS().SysPath(dir.PathCRLCache)`

func (*FileCache) Get

func (c *FileCache) Get(ctx context.Context, url string) (*corecrl.Bundle, error)

Get retrieves CRL bundle from c given url as key. If the key does not exist or the content has expired, corecrl.ErrCacheMiss is returned.

func (*FileCache) Set

func (c *FileCache) Set(ctx context.Context, url string, bundle *corecrl.Bundle) error

Set stores the CRL bundle in c with url as key.

Jump to

Keyboard shortcuts

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