Documentation
¶
Overview ¶
Package config defines the config structs and some config parser interfaces and implementations
Index ¶
- Constants
- Variables
- func CheckErr(err error, configFile string) error
- type Backend
- type EndpointConfig
- type EndpointMatchError
- type EndpointPathError
- type ExtraConfig
- type FileReaderFunc
- type NoBackendsError
- type ParseError
- type Parser
- type ParserFunc
- type Plugin
- type ServiceConfig
- type TLS
- type URI
- type URIParser
- type UndefinedOutputParamError
- type UnsupportedVersionError
- type WrongNumberOfParamsError
Constants ¶
View Source
const ( BracketsRouterPatternBuilder = iota ColonRouterPatternBuilder DefaultMaxIdleConnectionsPerHost = 250 DefaultTimeout = 2 * time.Second TurboConfigVersion = 1 )
Variables ¶
View Source
var ExtraConfigAlias = map[string]string{}
View Source
var RoutingPattern = ColonRouterPatternBuilder
Functions ¶
Types ¶
type Backend ¶
type Backend struct { Group string `mapstructure:"group"` Method string `mapstructure:"method"` Host []string `mapstructure:"host"` HostSanitizationDisabled bool `mapstructure:"disable_host_sanitize"` URLPattern string `mapstructure:"url_pattern"` AllowList []string `mapstructure:"allow"` DenyList []string `mapstructure:"deny"` Mapping map[string]string `mapstructure:"mapping"` Encoding string `mapstructure:"encoding"` IsCollection bool `mapstructure:"is_collection"` Target string `mapstructure:"target"` SD string `mapstructure:"sd"` URLKeys []string ConcurrentCalls int Timeout time.Duration Decoder encoding.Decoder `json:"-"` ExtraConfig ExtraConfig `mapstructure:"extra_config"` }
type EndpointConfig ¶
type EndpointConfig struct { Endpoint string `mapstructure:"endpoint"` Method string `mapstructure:"method"` Backend []*Backend `mapstructure:"backend"` ConcurrentCalls int `mapstructure:"concurrent_calls"` Timeout time.Duration `mapstructure:"timeout"` CacheTTL time.Duration `mapstructure:"cache_ttl"` QueryString []string `mapstructure:"querystring_params"` ExtraConfig ExtraConfig `mapstructure:"extra_config"` HeadersToPass []string `mapstructure:"headers_to_pass"` OutputEncoding string `mapstructure:"output_encoding"` }
type EndpointMatchError ¶
func (*EndpointMatchError) Error ¶
func (e *EndpointMatchError) Error() string
type EndpointPathError ¶
func (*EndpointPathError) Error ¶
func (e *EndpointPathError) Error() string
type ExtraConfig ¶
type ExtraConfig map[string]interface{}
type FileReaderFunc ¶
type NoBackendsError ¶
func (*NoBackendsError) Error ¶
func (n *NoBackendsError) Error() string
type ParseError ¶
func NewParseError ¶
func NewParseError(err error, configFile string, offset int) *ParseError
func (*ParseError) Error ¶
func (p *ParseError) Error() string
type Parser ¶
type Parser interface {
Parse(configFile string) (ServiceConfig, error)
}
func NewParserWithFileReader ¶
func NewParserWithFileReader(f FileReaderFunc) Parser
type ParserFunc ¶
type ParserFunc func(string) (ServiceConfig, error)
func (ParserFunc) Parse ¶
func (f ParserFunc) Parse(configFile string) (ServiceConfig, error)
type ServiceConfig ¶
type ServiceConfig struct { Name string `mapstructure:"name"` Endpoints []*EndpointConfig `mapstructure:"endpoints"` Timeout time.Duration `mapstructure:"timeout"` CacheTTL time.Duration `mapstructure:"cache_ttl"` Host []string `mapstructure:"host"` Port int `mapstructure:"port"` Version int `mapstructure:"version"` OutputEncoding string `mapstructure:"output_encoding"` ExtraConfig ExtraConfig `mapstructure:"extra_config"` ReadTimeout time.Duration `mapstructure:"read_timeout"` WriteTimeout time.Duration `mapstructure:"write_timeout"` IdleTimeout time.Duration `mapstructure:"idle_timeout"` ReadHeaderTimeout time.Duration `mapstructure:"read_header_timeout"` DisableKeepAlives bool `mapstructure:"disable_keep_alives"` DisableCompression bool `mapstructure:"disable_compression"` MaxIdleConnections int `mapstructure:"max_idle_connections"` MaxIdleConnectionsPerHost int `mapstructure:"max_idle_connections_per_host"` IdleConnectionTimeout time.Duration `mapstructure:"idle_connection_timeout"` ResponseHeaderTimeout time.Duration `mapstructure:"response_header_timeout"` ExpectContinueTimeout time.Duration `mapstructure:"expect_continue_timeout"` DialerTimeout time.Duration `mapstructure:"dialer_timeout"` DialerFallbackDelay time.Duration `mapstructure:"dialer_fallback_delay"` DialerKeepAlive time.Duration `mapstructure:"dialer_keep_alive"` DisableStrictREST bool `mapstructure:"disable_rest"` Plugin *Plugin `mapstructure:"plugin"` TLS *TLS `mapstructure:"tls"` Debug bool // contains filtered or unexported fields }
func (*ServiceConfig) Hash ¶
func (s *ServiceConfig) Hash() (string, error)
func (*ServiceConfig) Init ¶
func (s *ServiceConfig) Init() error
type TLS ¶
type TLS struct { IsDisabled bool `mapstructure:"disabled"` PublicKey string `mapstructure:"public_key"` PrivateKey string `mapstructure:"private_key"` MinVersion string `mapstructure:"min_version"` MaxVersion string `mapstructure:"max_version"` CurvePreferences []uint16 `mapstructure:"curve_preferences"` PreferServerCipherSuites bool `mapstructure:"prefer_server_cipher_suites"` CipherSuites []uint16 `mapstructure:"cipher_suites"` EnableMTLS bool `mapstructure:"enable_mtls"` }
type URIParser ¶
type URIParser interface { CleanHosts([]string) []string CleanHost(string) string CleanPath(string) string GetEndpointPath(string, []string) string }
func NewURIParser ¶
func NewURIParser() URIParser
type UndefinedOutputParamError ¶
type UndefinedOutputParamError struct { Endpoint string Method string Backend int InputParams []string OutputParams []string Param string }
func (*UndefinedOutputParamError) Error ¶
func (u *UndefinedOutputParamError) Error() string
type UnsupportedVersionError ¶
func (*UnsupportedVersionError) Error ¶
func (u *UnsupportedVersionError) Error() string
Click to show internal directories.
Click to hide internal directories.