httpclient

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

func NewCache

func NewCache(
	cachePath string,
	quotaLow, quotaHigh units.Bytes,
	logger *zerolog.Logger,
) (*Cache, error)

func (*Cache) CleanupOldEntries

func (c *Cache) CleanupOldEntries(logId string)

func (*Cache) Close

func (c *Cache) Close() error

func (*Cache) Get added in v0.0.11

func (c *Cache) Get(key []byte, entry *database.Entry[CachedResponses]) error

func (*Cache) GetStatistics

func (c *Cache) GetStatistics(ctx context.Context, logId string) (CacheStatistics, error)

func (*Cache) List added in v0.0.11

func (c *Cache) List(ctx context.Context, hostname, logId string) (CacheList, error)

func (*Cache) ManageCache

func (c *Cache) ManageCache()

func (*Cache) New added in v0.0.11

func (c *Cache) New(key []byte, value CachedResponses) error

func (*Cache) Open added in v0.0.11

func (c *Cache) Open(hash string, logger *zerolog.Logger) (io.ReadCloser, error)

func (*Cache) Remove added in v0.0.11

func (c *Cache) Remove(key []byte, logger *zerolog.Logger) error

func (*Cache) Save added in v0.0.11

func (c *Cache) Save(key []byte, entry *database.Entry[CachedResponses]) error

func (*Cache) SetupIngestion added in v0.0.11

func (c *Cache) SetupIngestion(
	src io.ReadCloser,
	onIngest func(hash string),
	onCleanup func(),
	logger *zerolog.Logger,
) io.ReadCloser

type CacheList added in v0.0.11

type CacheList map[string]map[string]CachedResponses

type CacheStatistics

type CacheStatistics struct {
	DatabaseSize     units.Bytes
	DatabaseEntries  int64
	FileCacheSize    units.Bytes
	FileCacheEntries int64
	UsagePerHostName map[string]struct {
		Entries int64
		Size    units.Bytes
	}
}

type CachedResponse

type CachedResponse struct {
	ContentHash            string
	StatusCode             int
	Headers                http.Header
	VaryHeaders            http.Header
	TimeAtResponseCreation time.Time
}

type CachedResponses

type CachedResponses []CachedResponse

type Client

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

func New

func New(
	client *http.Client,
	cache *Cache,
	logger *zerolog.Logger,
	isPrivate bool,
	notify func(r *http.Request, status string),
	now func() time.Time,
	since func(time.Time) time.Duration,
) *Client

func (*Client) Do

func (c *Client) Do(req *http.Request, upstreamCache UpstreamCache) (*http.Response, error)

type UpstreamCache

type UpstreamCache struct {
	Uris  []*url.URL
	Proxy bool
}

Directories

Path Synopsis
internal
httpcaching
Implements the parsing for RFC 9111 section 5.2.2 'Response directives' in addition to RFC 8246 and 5861
Implements the parsing for RFC 9111 section 5.2.2 'Response directives' in addition to RFC 8246 and 5861

Jump to

Keyboard shortcuts

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