reverseproxy

package
v0.0.3-beta.9 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCacheReverseProxy

func CreateCacheReverseProxy(cache Cache, opts ...Option) (*httputil.ReverseProxy, error)

func ServeCacheReverseProxy

func ServeCacheReverseProxy(cache Cache, proxy *httputil.ReverseProxy, opts ...ServeOption) func(http.ResponseWriter, *http.Request)

Types

type Cache

type Cache interface {
	Exists(ctx context.Context, key string) (bool, error)
	Delete(ctx context.Context, key string) error
	Save(ctx context.Context, key string, header http.Header, reader io.Reader) error
	Load(ctx context.Context, key string) (http.Header, io.ReadCloser, error)
	Header(ctx context.Context, key string) (http.Header, error)
}

type CommonCache

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

func NewByteCache

func NewByteCache(cache cache.ByteCache, storage storage.Storage, setCacheOptions ...cache.Option) *CommonCache

func (*CommonCache) Delete

func (c *CommonCache) Delete(ctx context.Context, key string) error

func (*CommonCache) Exists

func (c *CommonCache) Exists(ctx context.Context, key string) (bool, error)

func (*CommonCache) Header

func (c *CommonCache) Header(ctx context.Context, key string) (http.Header, error)

func (*CommonCache) Load

func (c *CommonCache) Load(ctx context.Context, key string) (http.Header, io.ReadCloser, error)

func (*CommonCache) Save

func (c *CommonCache) Save(ctx context.Context, key string, header http.Header, reader io.Reader) error

type Option

type Option = func(*Options)

func WithCacheKeyFunc

func WithCacheKeyFunc(cacheKeyFunc RequestCacheKeyFunc) Option

func WithDirector

func WithDirector(director func(*http.Request)) Option

func WithErrorHandler

func WithErrorHandler(handler func(error)) Option

func WithResponseCacheCheck

func WithResponseCacheCheck(checker ResponseCacheCheckFunc) Option

func WithTargetURL

func WithTargetURL(target *url.URL) Option

type Options

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

type RequestCacheKeyFunc

type RequestCacheKeyFunc func(*http.Request) string

type ResponseCacheCheckFunc

type ResponseCacheCheckFunc func(*http.Response) bool

type ServeOption

type ServeOption = func(*ServeOptions)

func WithServeCacheKeyFunc

func WithServeCacheKeyFunc(keygen RequestCacheKeyFunc) ServeOption

func WithServeErrorHandler

func WithServeErrorHandler(handler func(http.ResponseWriter, *http.Request, error)) ServeOption

type ServeOptions

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

Jump to

Keyboard shortcuts

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