Documentation
¶
Index ¶
- Constants
- Variables
- func LoadRemapRules(path string, pluginConfigLoaders map[string]plugin.LoadFunc, ...) ([]remapdata.RemapRule, map[string]interface{}, *remapdata.RemapRulesStats, ...)
- func NewRemappingTransport(reqTimeout time.Duration, reqKeepAlive time.Duration, reqMaxIdleConns int, ...) *http.Transport
- func RequestURI(r *http.Request, scheme string) string
- type HTTPRequestRemapper
- func LoadRemapper(path string, pluginConfigLoaders map[string]plugin.LoadFunc, ...) (HTTPRequestRemapper, error)
- func NewHTTPRequestRemapper(remap []remapdata.RemapRule, plugins map[string]interface{}, ...) HTTPRequestRemapper
- func RemapperToHTTP(r Remapper, statRules *remapdata.RemapRulesStats) HTTPRequestRemapper
- type HdrModder
- type RemapRuleJSON
- type RemapRuleToJSON
- type RemapRules
- type RemapRulesBase
- type RemapRulesJSON
- type RemapRulesStatsJSON
- type Remapper
- type Remapping
- type RemappingProducer
- func (p *RemappingProducer) Cache() icache.Cache
- func (p *RemappingProducer) CacheKey() string
- func (p *RemappingProducer) ConnectionClose() bool
- func (p *RemappingProducer) DSCP() int
- func (p *RemappingProducer) FirstFQDN() string
- func (p *RemappingProducer) GetNext(r *http.Request) (Remapping, bool, error)
- func (p *RemappingProducer) Name() string
- func (p *RemappingProducer) OverrideCacheKey(newKey string)
- func (p *RemappingProducer) PluginCfg() map[string]interface{}
- func (p *RemappingProducer) ProxyStr() string
Constants ¶
View Source
const DefaultReplicas = 1024
Variables ¶
View Source
var ErrIPNotAllowed = errors.New("IP not allowed")
View Source
var ErrNoMoreRetries = errors.New("retry num exceeded")
View Source
var ErrRuleNotFound = errors.New("remap rule not found")
Functions ¶
func LoadRemapRules ¶
func LoadRemapRules(path string, pluginConfigLoaders map[string]plugin.LoadFunc, caches map[string]icache.Cache, baseTransport *http.Transport) ([]remapdata.RemapRule, map[string]interface{}, *remapdata.RemapRulesStats, error)
LoadRemapRules returns the loaded rules, the global plugins, the Stats remap rules, and any error
func NewRemappingTransport ¶
Types ¶
type HTTPRequestRemapper ¶
type HTTPRequestRemapper interface {
// Remap returns the remapped request, the matched rule name, whether the requestor's IP is allowed, whether to connection close, whether a match was found, and any error.
// Remap(r *http.Request, scheme string, failures int) Remapping
Rules() []remapdata.RemapRule
RemappingProducer(r *http.Request, scheme string) (*RemappingProducer, error)
StatRules() remapdata.RemapRulesStats
PluginCfg() map[string]interface{} // global plugins, outside the individual remap rules
PluginSharedCfg() map[string]map[string]json.RawMessage
}
func LoadRemapper ¶
func NewHTTPRequestRemapper ¶
func NewHTTPRequestRemapper(remap []remapdata.RemapRule, plugins map[string]interface{}, statRules *remapdata.RemapRulesStats) HTTPRequestRemapper
func RemapperToHTTP ¶
func RemapperToHTTP(r Remapper, statRules *remapdata.RemapRulesStats) HTTPRequestRemapper
type RemapRuleJSON ¶
type RemapRuleJSON struct {
remapdata.RemapRuleBase
TimeoutMS *int `json:"timeout_ms"`
ParentSelection *string `json:"parent_selection"`
To []RemapRuleToJSON `json:"to"`
Allow []string `json:"allow"`
Deny []string `json:"deny"`
RetryCodes *[]int `json:"retry_codes"`
CacheName *string `json:"cache_name"`
Plugins map[string]json.RawMessage `json:"plugins"`
}
type RemapRuleToJSON ¶
type RemapRuleToJSON struct {
remapdata.RemapRuleToBase
ProxyURL *string `json:"proxy_url"`
TimeoutMS *int `json:"timeout_ms"`
RetryCodes *[]int `json:"retry_codes"`
}
func RemapRuleToToJSON ¶
func RemapRuleToToJSON(r remapdata.RemapRuleTo) RemapRuleToJSON
type RemapRules ¶
type RemapRules struct {
RemapRulesBase
Rules []remapdata.RemapRule
RetryCodes map[int]struct{}
Timeout *time.Duration
ParentSelection *remapdata.ParentSelectionType
Stats remapdata.RemapRulesStats
Plugins map[string]interface{}
Cache icache.Cache
}
type RemapRulesBase ¶
type RemapRulesBase struct {
RetryNum *int `json:"retry_num"`
}
type RemapRulesJSON ¶
type RemapRulesJSON struct {
RemapRulesBase
Rules []RemapRuleJSON `json:"rules"`
RetryCodes *[]int `json:"retry_codes"`
TimeoutMS *int `json:"timeout_ms"`
ParentSelection *string `json:"parent_selection"`
Stats RemapRulesStatsJSON `json:"stats"`
Plugins map[string]json.RawMessage `json:"plugins"`
}
func RemapRulesToJSON ¶
func RemapRulesToJSON(r RemapRules) (RemapRulesJSON, error)
type RemapRulesStatsJSON ¶
type Remapper ¶
type Remapper interface {
// Remap returns the given string remapped, the unique name of the rule found, and whether a remap rule was found
Remap(uri string) (remapdata.RemapRule, bool)
// Rules returns the unique names of every remap rule.
Rules() []remapdata.RemapRule
// PluginCfg returns the global plugins, outside the individual remap rules
PluginCfg() map[string]interface{}
}
Remapper provides a function which takes strings and maps them to other strings. This is designed for URL prefix remapping, for a reverse proxy.
type RemappingProducer ¶
type RemappingProducer struct {
// contains filtered or unexported fields
}
RemappingProducer takes an HTTP Request and returns a Remapping to be used for that request. TODO rename? interface?
func (*RemappingProducer) Cache ¶
func (p *RemappingProducer) Cache() icache.Cache
func (*RemappingProducer) CacheKey ¶
func (p *RemappingProducer) CacheKey() string
func (*RemappingProducer) ConnectionClose ¶
func (p *RemappingProducer) ConnectionClose() bool
func (*RemappingProducer) DSCP ¶
func (p *RemappingProducer) DSCP() int
func (*RemappingProducer) FirstFQDN ¶
func (p *RemappingProducer) FirstFQDN() string
func (*RemappingProducer) GetNext ¶
GetNext returns the remapping to use to request, whether retries are allowed (i.e. if this is the last retry), or any error
func (*RemappingProducer) Name ¶
func (p *RemappingProducer) Name() string
func (*RemappingProducer) OverrideCacheKey ¶
func (p *RemappingProducer) OverrideCacheKey(newKey string)
func (*RemappingProducer) PluginCfg ¶
func (p *RemappingProducer) PluginCfg() map[string]interface{}
func (*RemappingProducer) ProxyStr ¶
func (p *RemappingProducer) ProxyStr() string
Click to show internal directories.
Click to hide internal directories.