docs

package
v4.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuthFieldSpec added in v4.4.0

func BasicAuthFieldSpec() docs.FieldSpec

BasicAuthFieldSpec returns the spec for an HTTP BasicAuth component

func ClientFieldSpec

func ClientFieldSpec(forOutput bool, extraChildren ...docs.FieldSpec) docs.FieldSpec

ClientFieldSpec returns a field spec for an http client component.

func ServerCORSFieldSpec

func ServerCORSFieldSpec() docs.FieldSpec

ServerCORSFieldSpec returns a field spec for an http server CORS component.

Types

type BasicAuth added in v4.4.0

type BasicAuth struct {
	Enabled      bool   `json:"enabled" yaml:"enabled"`
	Username     string `json:"username" yaml:"username"`
	PasswordHash string `json:"password_hash" yaml:"password_hash"`
	Realm        string `json:"realm" yaml:"realm"`
	Algorithm    string `json:"algorithm" yaml:"algorithm"`
	Salt         string `json:"salt" yaml:"salt"`
}

BasicAuth contains the configuration fields for the HTTP BasicAuth

func NewBasicAuth added in v4.4.0

func NewBasicAuth() BasicAuth

NewBasicAuth returns a BasicAuth with default values

func (BasicAuth) Validate added in v4.4.0

func (b BasicAuth) Validate() error

Validate confirms that the BasicAuth is properly configured

func (BasicAuth) WrapHandler added in v4.4.0

func (b BasicAuth) WrapHandler(next http.HandlerFunc) http.HandlerFunc

WrapHandler wraps the provided HTTP handler with middleware that enforces BasicAuth if it's enabled.

type Config

type Config struct {
	URL             string                       `json:"url" yaml:"url"`
	Verb            string                       `json:"verb" yaml:"verb"`
	Headers         map[string]string            `json:"headers" yaml:"headers"`
	Metadata        metadata.IncludeFilterConfig `json:"metadata" yaml:"metadata"`
	ExtractMetadata metadata.IncludeFilterConfig `json:"extract_headers" yaml:"extract_headers"`
	RateLimit       string                       `json:"rate_limit" yaml:"rate_limit"`
	Timeout         string                       `json:"timeout" yaml:"timeout"`
	Retry           string                       `json:"retry_period" yaml:"retry_period"`
	MaxBackoff      string                       `json:"max_retry_backoff" yaml:"max_retry_backoff"`
	NumRetries      int                          `json:"retries" yaml:"retries"`
	BackoffOn       []int                        `json:"backoff_on" yaml:"backoff_on"`
	DropOn          []int                        `json:"drop_on" yaml:"drop_on"`
	SuccessfulOn    []int                        `json:"successful_on" yaml:"successful_on"`
	TLS             tls.Config                   `json:"tls" yaml:"tls"`
	ProxyURL        string                       `json:"proxy_url" yaml:"proxy_url"`
	auth.Config     `json:",inline" yaml:",inline"`
	OAuth2          auth.OAuth2Config `json:"oauth2" yaml:"oauth2"`
}

Config is a configuration struct for an HTTP client.

func NewConfig

func NewConfig() Config

NewConfig creates a new Config with default values.

type ServerCORS

type ServerCORS struct {
	Enabled        bool     `json:"enabled" yaml:"enabled"`
	AllowedOrigins []string `json:"allowed_origins" yaml:"allowed_origins"`
}

ServerCORS contains configuration for allowing CORS headers.

func NewServerCORS

func NewServerCORS() ServerCORS

NewServerCORS returns a new server CORS config with default fields.

func (ServerCORS) WrapHandler

func (conf ServerCORS) WrapHandler(handler http.Handler) (http.Handler, error)

WrapHandler wraps a provided HTTP handler with middleware that enables CORS requests (when configured).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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