providers

package
v1.4.23 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ContextKey keyValue = 1

ContextKey is the key for the provider.Provider value in the context.

Variables

This section is empty.

Functions

func GetProxyBackendProvider added in v1.3.7

func GetProxyBackendProvider(ctx context.Context, originCache string) (provider.Provider, error)

GetProxyBackendProvider will create a new proxy provider.

func GetRemoteBackendProvider

func GetRemoteBackendProvider(ctx context.Context, origin, originCache string) (provider.Provider, error)

GetRemoteBackendProvider will get the backend provider based on the scheme of the url.

func GetRemoteProviderClient

func GetRemoteProviderClient(ctx context.Context, originURL *url.URL, transport http.RoundTripper) (provider.Provider, error)

GetRemoteProviderClient gets the remote provider client or errors.

func GetUnderlyingTransport

func GetUnderlyingTransport(ctx context.Context, originURL *url.URL) (http.RoundTripper, error)

GetUnderlyingTransport checks the url as some clients have specific requirements of the underlying transport.

func Middleware

func Middleware(providers *Providers, next http.HandlerFunc) http.HandlerFunc

Middleware attaches the correct provider.Provider to the request so that the next handler can use it.

func ParseBackend

func ParseBackend(defaultHost, backend string) (string, string, error)

ParseBackend parses the backend using the following formats:

<host>,<origin> OR <origin>

Where if the host is not specified, it falls back to the defaultHost.

func WrapCacheRoundTripper

func WrapCacheRoundTripper(ctx context.Context, underlyingTransport http.RoundTripper, originCache string) (http.RoundTripper, error)

WrapCacheRoundTripper gets the roundtripper if the provider is a remote backend type.

Types

type Providers added in v1.3.7

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

Providers provide other Provider's based on the host name of the request.

func New

func New(ctx context.Context, defaultHost string, backends []string, originCache, signingSecret string, signingWithPath bool) (*Providers, error)

New loops over the origins provided, parsing with the specified providers, and returns the providers keyed by host and optionally wrapped with an origin cache. This will error if the same backend host is extracted more than once.

func NewProviders added in v1.3.7

func NewProviders(providers map[string]provider.Provider) *Providers

NewProviders will return the Providers wrapped.

func (*Providers) Get added in v1.3.7

func (p *Providers) Get(host string) provider.Provider

Get will return a provider.

Jump to

Keyboard shortcuts

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