Documentation ¶
Index ¶
- Constants
- func GetProxyBackendProvider(ctx context.Context, originCache string) (provider.Provider, error)
- func GetRemoteBackendProvider(ctx context.Context, origin, originCache string) (provider.Provider, error)
- func GetRemoteProviderClient(ctx context.Context, originURL *url.URL, transport http.RoundTripper) (provider.Provider, error)
- func GetUnderlyingTransport(ctx context.Context, originURL *url.URL) (http.RoundTripper, error)
- func Middleware(providers *Providers, next http.HandlerFunc) http.HandlerFunc
- func ParseBackend(defaultHost, backend string) (string, string, error)
- func WrapCacheRoundTripper(ctx context.Context, underlyingTransport http.RoundTripper, originCache string) (http.RoundTripper, error)
- type Providers
Constants ¶
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
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 ¶
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 ¶
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
NewProviders will return the Providers wrapped.