Documentation ¶
Overview ¶
Package martianurl provides utilities for modifying, filtering, and verifying URLs in martian.Proxy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewModifier ¶
NewModifier overrides the url of the request.
func NewVerifier ¶
func NewVerifier(url *url.URL) verify.RequestVerifier
NewVerifier returns a new URL verifier.
Types ¶
type Matcher ¶
type Matcher struct {
// contains filtered or unexported fields
}
Matcher is a conditional evaluator of request urls to be used in filters that take conditionals.
func (*Matcher) MatchRequest ¶
MatchRequest retuns true if all non-empty URL segments in m.url match the request URL.
type Modifier ¶
type Modifier struct {
// contains filtered or unexported fields
}
Modifier alters the request URL fields to match the fields of url and adds a X-Forwarded-Url header that contains the original value of the request URL.
type RegexMatcher ¶
type RegexMatcher struct {
// contains filtered or unexported fields
}
RegexMatcher is a conditional evaluator of request urls to be used in filters that take conditionals.
func NewRegexMatcher ¶
func NewRegexMatcher(r *regexp.Regexp) *RegexMatcher
NewRegexMatcher builds a new url matcher from a compiled Regexp.
func (*RegexMatcher) MatchRequest ¶
func (m *RegexMatcher) MatchRequest(req *http.Request) bool
MatchRequest retuns true if the request URL matches r.
func (*RegexMatcher) MatchResponse ¶
func (m *RegexMatcher) MatchResponse(res *http.Response) bool
MatchResponse retuns true if the response URL matches r.
type URLRegexFilter ¶
URLRegexFilter runs Modifier if the request URL matches the regex, and runs ElseModifier if not. This is not to be confused with url.Filter that does string matching on URL segments.
func NewRegexFilter ¶
func NewRegexFilter(r *regexp.Regexp) *URLRegexFilter
NewRegexFilter constructs a filter that matches on regular expressions.
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
Verifier verifies the structure of URLs.
func (*Verifier) ModifyRequest ¶
ModifyRequest verifies that the request URL matches all parts of url. If the value in url is non-empty it must be an exact match.
func (*Verifier) ResetRequestVerifications ¶
func (v *Verifier) ResetRequestVerifications()
ResetRequestVerifications clears all failed request verifications.
func (*Verifier) VerifyRequests ¶
VerifyRequests returns an error if verification for any request failed. If an error is returned it will be of type *martian.MultiError.