Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ProxyServer ¶
type ProxyServer struct { ID int64 Name string Address url.URL IsDefault bool IsReadOnly bool Transport http.RoundTripper }
ProxyServer is proxy server where request can be proxied
type ProxyServers ¶
type ProxyServers []ProxyServer
ProxyServers is collections type for ProxyServer instances
func ConvertProxyServers ¶
func ConvertProxyServers(conf config.ProxyServerConfigs) (ProxyServers, error)
ConvertProxyServers converts configuration to domain object
func (ProxyServers) Default ¶
func (p ProxyServers) Default() (ProxyServer, bool)
Default finds default server
func (ProxyServers) Find ¶
func (p ProxyServers) Find(name string) (ProxyServer, bool)
Find returns first proxy server matching given name
func (ProxyServers) FindByHost ¶
func (p ProxyServers) FindByHost(host string) (ProxyServer, bool)
FindByHost returns first proxy server matching given host
type Replacement ¶
Replacement describes rules for replacing things in request/response
type Replacements ¶
type Replacements []Replacement
Replacements is collection type for Replacement structures
type Request ¶
type Request struct { ID string RuleID int64 Service string Request []byte RequestTime time.Time RequestSize int64 Response []byte ResponseTime time.Time ResponseSize int64 }
Request is cached bodies of proxied request/response
type Rule ¶
type Rule struct { ID int64 Server string Service string Priority int64 MatcherRemoteAddr []string MatcherRegex []*regexp.Regexp RequestReplacements Replacements ResponseReplacements Replacements IsReadOnly bool }
Rule describes rules where and when to proxy requests
func (Rule) ApplyRequestReplacements ¶
ApplyRequestReplacements applies rule request replacements on body
func (Rule) ApplyResponseReplacements ¶
ApplyResponseReplacements applies rule response replacements on body
type Rules ¶
type Rules []Rule
Rules is collection type for Rule structures
func ConvertRules ¶
func ConvertRules(conf config.RuleConfigs) (Rules, error)
ConvertRules convert configuration to domain object
func (Rules) MatchRegex ¶
MatchRegex returns first rule matching its regex
func (Rules) MatchRemoteAddr ¶
MatchRemoteAddr returns slice of Rules matching given remote addr
func (Rules) MatchService ¶
MatchService returns slice of Rules matching given service name