Documentation
¶
Index ¶
- Variables
- func ASAPToken(_ context.Context, _ string, _ string, _ string) (interface{}, error)
- func ASAPValidate(_ context.Context, _ string, _ string, _ string) (interface{}, error)
- func AccessLog(_ context.Context, _ string, _ string, _ string) (interface{}, error)
- func BasicAuth(_ context.Context, _ string, _ string, _ string) (interface{}, error)
- func Hedging(_ context.Context, _ string, _ string, _ string) (interface{}, error)
- func Metrics(_ context.Context, backend string, path string, _ string) (interface{}, error)
- func RequestHeader(_ context.Context, _ string, _ string, _ string) (interface{}, error)
- func RequestValidation(_ context.Context, _ string, _ string, _ string) (interface{}, error)
- func ResponseHeader(_ context.Context, a string, b string, c string) (interface{}, error)
- func ResponseValidation(_ context.Context, _ string, _ string, _ string) (interface{}, error)
- func Retry(_ context.Context, _ string, _ string, _ string) (interface{}, error)
- func RetryAfter(_ context.Context, _ string, _ string, _ string) (interface{}, error)
- func Strip(_ context.Context, _ string, _ string, _ string) (interface{}, error)
- func Timeout(_ context.Context, _ string, _ string, _ string) (interface{}, error)
- func ValidateHeaders(_ context.Context, _ string, _ string, _ string) (interface{}, error)
- type ASAPTokenComponent
- type ASAPTokenConfig
- type ASAPValidateComponent
- type ASAPValidateConfig
- type AccessLogComponent
- type AccessLogConfig
- type BasicAuthComponent
- type BasicAuthConfig
- type HedgingComponent
- type HedgingConfig
- type MetricsComponent
- type MetricsConfig
- type RequestHeaderComponent
- type RequestHeaderConfig
- type RequestValidationComponent
- type RequestValidationConfig
- type ResponseHeaderComponent
- type ResponseHeaderConfig
- type ResponseValidationComponent
- type ResponseValidationConfig
- type RetryAfterComponent
- type RetryAfterConfig
- type RetryComponent
- type RetryConfig
- type StripComponent
- type StripConfig
- type TimeoutComponent
- type TimeoutConfig
- type ValidateHeaderConfig
- type ValidateHeaderConfigComponent
Constants ¶
This section is empty.
Variables ¶
var ( // Defaults is the same set of components that is installed in // the project main.go and can be used by custom builds to stay in sync // with the latest additions. Defaults = []transportd.NewComponent{ Metrics, AccessLog, ASAPValidate, Timeout, Hedging, Retry, RetryAfter, ASAPToken, RequestValidation, ResponseValidation, Strip, RequestHeader, ResponseHeader, BasicAuth, ValidateHeaders, } )
Functions ¶
func ASAPValidate ¶
ASAPValidate satisfies the NewComponent signature.
func RequestHeader ¶ added in v0.6.0
RequestHeader satisfies the NewComponent signature.
func RequestValidation ¶
RequestValidation satisfies the NewComponent signature.
func ResponseHeader ¶ added in v0.6.0
ResponseHeader satisfies the NewComponent signature.
func ResponseValidation ¶
ResponseValidation satisfies the NewComponent signature.
func RetryAfter ¶ added in v1.2.0
RetryAfter satisfies the NewComponent signature.
Types ¶
type ASAPTokenComponent ¶
type ASAPTokenComponent struct{}
ASAPTokenComponent is an ASAP decorator plugin.
func NewComponent ¶ added in v1.8.0
func NewComponent() *ASAPTokenComponent
NewComponent populates an ASAPToken with defaults.
func (*ASAPTokenComponent) New ¶
func (*ASAPTokenComponent) New(ctx context.Context, conf *ASAPTokenConfig) (func(http.RoundTripper) http.RoundTripper, error)
New generates the middleware.
func (*ASAPTokenComponent) Settings ¶
func (m *ASAPTokenComponent) Settings() *ASAPTokenConfig
Settings generates a config populated with defaults.
type ASAPTokenConfig ¶
type ASAPTokenConfig struct { PrivateKey string `description:"RSA private key to use when signing tokens."` KID string `description:"JWT kid value to include in tokens."` TTL time.Duration `description:"Lifetime of a token."` Issuer string `description:"JWT issuer value to include in tokens."` Audiences []string `description:"JWT audience values to include in tokens."` }
ASAPTokenConfig is used to configure ASAP token generation.
type ASAPValidateComponent ¶
type ASAPValidateComponent struct{}
ASAPValidateComponent is an ASAP validation plugin.
func (*ASAPValidateComponent) New ¶
func (m *ASAPValidateComponent) New(ctx context.Context, conf *ASAPValidateConfig) (func(http.RoundTripper) http.RoundTripper, error)
New generates the middleware.
func (*ASAPValidateComponent) Settings ¶
func (m *ASAPValidateComponent) Settings() *ASAPValidateConfig
Settings generates a config populated with defaults.
type ASAPValidateConfig ¶
type ASAPValidateConfig struct { AllowedIssuers []string `description:"Acceptable issuer strings."` AllowedAudience string `description:"Acceptable audience string."` KeyURLs []string `description:"Public key download URLs."` }
ASAPValidateConfig is used to configure ASAP validation.
func (*ASAPValidateConfig) Name ¶
func (m *ASAPValidateConfig) Name() string
Name of the config root.
type AccessLogComponent ¶
type AccessLogComponent struct{}
AccessLogComponent is a logging plugin.
func (*AccessLogComponent) New ¶
func (*AccessLogComponent) New(ctx context.Context, conf *AccessLogConfig) (func(http.RoundTripper) http.RoundTripper, error)
New generates the middleware.
func (*AccessLogComponent) Settings ¶
func (m *AccessLogComponent) Settings() *AccessLogConfig
Settings generates a config populated with defaults.
type AccessLogConfig ¶
type AccessLogConfig struct {
PrincipalHeader string `` /* 141-byte string literal not displayed */
}
AccessLogConfig modifies the behavior of the access logs.
type BasicAuthComponent ¶ added in v0.2.0
type BasicAuthComponent struct{}
BasicAuthComponent is an HTTP basic auth decorator plugin.
func (*BasicAuthComponent) New ¶ added in v0.2.0
func (*BasicAuthComponent) New(ctx context.Context, conf *BasicAuthConfig) (func(http.RoundTripper) http.RoundTripper, error)
New generates the middleware.
func (*BasicAuthComponent) Settings ¶ added in v0.2.0
func (m *BasicAuthComponent) Settings() *BasicAuthConfig
Settings generates a config populated with defaults.
type BasicAuthConfig ¶ added in v0.2.0
type BasicAuthConfig struct { Username string `description:"Username to use in HTTP basic authentication."` Password string `description:"Password to use in HTTP basic authentication."` }
BasicAuthConfig is used to configure HTTP basic authentication.
func (*BasicAuthConfig) Name ¶ added in v0.2.0
func (c *BasicAuthConfig) Name() string
Name of the config root.
type HedgingComponent ¶
type HedgingComponent struct{}
HedgingComponent implements the settings.Component interface.
func (*HedgingComponent) New ¶
func (*HedgingComponent) New(_ context.Context, conf *HedgingConfig) (func(http.RoundTripper) http.RoundTripper, error)
New generates the middleware.
func (*HedgingComponent) Settings ¶
func (*HedgingComponent) Settings() *HedgingConfig
Settings generates a config populated with defaults.
type HedgingConfig ¶
type HedgingConfig struct {
Interval time.Duration `description:"Duration after which to open a new request."`
}
HedgingConfig adds automated retries during times of excess latency.
type MetricsComponent ¶
MetricsComponent implements the settings.Component interface.
func (*MetricsComponent) New ¶
func (c *MetricsComponent) New(_ context.Context, conf *MetricsConfig) (func(http.RoundTripper) http.RoundTripper, error)
New generates the middleware.
func (*MetricsComponent) Settings ¶
func (*MetricsComponent) Settings() *MetricsConfig
Settings generates a config populated with defaults.
type MetricsConfig ¶
type MetricsConfig struct { Timing string `description:"Name of overall timing metric."` DNS string `description:"Name of DNS timing metric."` TCP string `description:"Name of TCP timing metric."` ConnectionIdle string `description:"Name of idle timing metric."` TLS string `description:"Name of TLS timing metric."` WroteHeaders string `description:"Name of time to write headers metric."` FirstResponseByte string `description:"Name of time to first resposne byte metrics."` BytesReceived string `description:"Name of bytes received metric."` BytesSent string `description:"Name of bytes sent metric."` BytesTotal string `description:"Name of bytes sent and received metric."` PutIdle string `description:"Name of idle connection return count metric."` BackendTag string `description:"Name of the tag containing the backend reference."` PathTag string `description:"Name of the tag containing the path referecne."` }
MetricsConfig contains settings for request metrics emissions.
type RequestHeaderComponent ¶ added in v0.6.0
type RequestHeaderComponent struct{}
RequestHeaderComponent implements the settings.Component interface.
func (*RequestHeaderComponent) New ¶ added in v0.6.0
func (*RequestHeaderComponent) New(_ context.Context, conf *RequestHeaderConfig) (func(http.RoundTripper) http.RoundTripper, error)
New generates the middleware.
func (*RequestHeaderComponent) Settings ¶ added in v0.6.0
func (*RequestHeaderComponent) Settings() *RequestHeaderConfig
Settings generates a config populated with defaults.
type RequestHeaderConfig ¶ added in v0.6.0
type RequestHeaderConfig struct {
Headers map[string][]string `description:"Map of headers to inject into requests."`
}
RequestHeaderConfig configures automated header injection.
func (*RequestHeaderConfig) Name ¶ added in v0.6.0
func (*RequestHeaderConfig) Name() string
Name of the config root.
type RequestValidationComponent ¶
type RequestValidationComponent struct{}
RequestValidationComponent enables validation of requests against the OpenAPI specification.
func (*RequestValidationComponent) New ¶
func (*RequestValidationComponent) New(_ context.Context, _ *RequestValidationConfig) (func(http.RoundTripper) http.RoundTripper, error)
New generates the middleware.
func (*RequestValidationComponent) Settings ¶
func (*RequestValidationComponent) Settings() *RequestValidationConfig
Settings generates a config with all defaults set.
type RequestValidationConfig ¶
type RequestValidationConfig struct{}
RequestValidationConfig is a placeholder for future validation options.
func (*RequestValidationConfig) Name ¶
func (*RequestValidationConfig) Name() string
Name of the config root.
type ResponseHeaderComponent ¶ added in v0.6.0
type ResponseHeaderComponent struct{}
ResponseHeaderComponent implements the settings.Component interface.
func (*ResponseHeaderComponent) New ¶ added in v0.6.0
func (*ResponseHeaderComponent) New(_ context.Context, conf *ResponseHeaderConfig) (func(http.RoundTripper) http.RoundTripper, error)
New generates the middleware.
func (*ResponseHeaderComponent) Settings ¶ added in v0.6.0
func (*ResponseHeaderComponent) Settings() *ResponseHeaderConfig
Settings generates a config populated with defaults.
type ResponseHeaderConfig ¶ added in v0.6.0
type ResponseHeaderConfig struct {
Headers map[string][]string `description:"Map of headers to inject into responses."`
}
ResponseHeaderConfig configures automated header injection.
func (*ResponseHeaderConfig) Name ¶ added in v0.6.0
func (*ResponseHeaderConfig) Name() string
Name of the config root.
type ResponseValidationComponent ¶
type ResponseValidationComponent struct{}
ResponseValidationComponent enables validation of requests against the OpenAPI specification.
func (*ResponseValidationComponent) New ¶
func (*ResponseValidationComponent) New(_ context.Context, _ *ResponseValidationConfig) (func(http.RoundTripper) http.RoundTripper, error)
New generates the middleware.
func (*ResponseValidationComponent) Settings ¶
func (*ResponseValidationComponent) Settings() *ResponseValidationConfig
Settings generates a config with all defaults set.
type ResponseValidationConfig ¶
type ResponseValidationConfig struct{}
ResponseValidationConfig is a placeholder for future validation options.
func (*ResponseValidationConfig) Name ¶
func (*ResponseValidationConfig) Name() string
Name of the config root.
type RetryAfterComponent ¶ added in v1.2.0
type RetryAfterComponent struct{}
RetryAfterComponent implements the settings.Component interface.
func (*RetryAfterComponent) New ¶ added in v1.2.0
func (*RetryAfterComponent) New(_ context.Context, conf *RetryAfterConfig) (func(http.RoundTripper) http.RoundTripper, error)
New generates the middleware.
func (*RetryAfterComponent) Settings ¶ added in v1.2.0
func (*RetryAfterComponent) Settings() *RetryAfterConfig
Settings generates a config populated with defaults.
type RetryAfterConfig ¶ added in v1.2.0
type RetryAfterConfig struct { }
RetryAfterConfig enables automated retries for status code 429 with Retry-After header honoring.
func (*RetryAfterConfig) Name ¶ added in v1.2.0
func (*RetryAfterConfig) Name() string
Name of the configuration root.
type RetryComponent ¶
type RetryComponent struct{}
RetryComponent implements the settings.Component interface.
func (*RetryComponent) New ¶
func (*RetryComponent) New(_ context.Context, conf *RetryConfig) (func(http.RoundTripper) http.RoundTripper, error)
New generates the middleware.
func (*RetryComponent) Settings ¶
func (*RetryComponent) Settings() *RetryConfig
Settings generates a config populated with defaults.
type RetryConfig ¶
type RetryConfig struct { Codes []int `description:"HTTP status codes that trigger a retry."` Limit int `description:"Maximum retry attempts."` Backoff time.Duration `description:"Time to wait between requests."` Exponential bool `description:"Double the time to wait between requests."` }
RetryConfig enables automated retries for status codes.
type StripComponent ¶
type StripComponent struct{}
StripComponent enabled modification of the URL before redirect.
func (*StripComponent) New ¶
func (*StripComponent) New(_ context.Context, conf *StripConfig) (func(http.RoundTripper) http.RoundTripper, error)
New generates the middleware.
func (*StripComponent) Settings ¶
func (*StripComponent) Settings() *StripConfig
Settings generates a config with all default values set.
type StripConfig ¶
type StripConfig struct {
Count int `description:"Number of URL segments to remove from the beginning of the path before redirect."`
}
StripConfig contains settings for modifying the URL.
type TimeoutComponent ¶
type TimeoutComponent struct{}
TimeoutComponent implements the settings.Component interface.
func (*TimeoutComponent) New ¶
func (*TimeoutComponent) New(_ context.Context, conf *TimeoutConfig) (func(http.RoundTripper) http.RoundTripper, error)
New generates the middleware.
func (*TimeoutComponent) Settings ¶
func (*TimeoutComponent) Settings() *TimeoutConfig
Settings generates a config populated with defaults.
type TimeoutConfig ¶
type TimeoutConfig struct {
After time.Duration `description:"Duration after which the request is canceled."`
}
TimeoutConfig adjusts the timeout value for requests.
type ValidateHeaderConfig ¶ added in v0.4.3
type ValidateHeaderConfig struct { Allowed map[string][]string `description:"Map of headers to validate and the allowed values for those headers."` Split map[string]string `description:"Map of delimiters to split on given headers to validate"` }
ValidateHeaderConfig is used to validate a map of headers and their allowed values against an incoming requests headers
func (*ValidateHeaderConfig) Name ¶ added in v0.4.3
func (*ValidateHeaderConfig) Name() string
Name of the config root
type ValidateHeaderConfigComponent ¶ added in v0.4.3
type ValidateHeaderConfigComponent struct{}
ValidateHeaderConfigComponent is a plugin
func (*ValidateHeaderConfigComponent) New ¶ added in v0.4.3
func (*ValidateHeaderConfigComponent) New(_ context.Context, conf *ValidateHeaderConfig) (func(tripper http.RoundTripper) http.RoundTripper, error)
New generates the middleware.
func (*ValidateHeaderConfigComponent) Settings ¶ added in v0.4.3
func (*ValidateHeaderConfigComponent) Settings() *ValidateHeaderConfig
Settings generates a config populated with defaults.