Documentation ¶
Overview ¶
Package matcher contains types that need to be shared between code under google.golang.org/grpc/xds/... and the rest of gRPC.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HeaderContainsMatcher ¶
type HeaderContainsMatcher struct {
// contains filtered or unexported fields
}
HeaderContainsMatcher matches on whether the header value contains the value passed into this struct.
func NewHeaderContainsMatcher ¶
func NewHeaderContainsMatcher(key string, contains string, invert bool) *HeaderContainsMatcher
NewHeaderContainsMatcher returns a new HeaderContainsMatcher. key is the HTTP Header key to match on, and contains is the value that the header should should contain for a successful match. An empty contains string does not work, use HeaderPresentMatcher in that case.
func (*HeaderContainsMatcher) Match ¶
func (hcm *HeaderContainsMatcher) Match(md metadata.MD) bool
Match returns whether the passed in HTTP Headers match according to the HeaderContainsMatcher.
func (*HeaderContainsMatcher) String ¶
func (hcm *HeaderContainsMatcher) String() string
type HeaderExactMatcher ¶
type HeaderExactMatcher struct {
// contains filtered or unexported fields
}
HeaderExactMatcher matches on an exact match of the value of the header.
func NewHeaderExactMatcher ¶
func NewHeaderExactMatcher(key, exact string, invert bool) *HeaderExactMatcher
NewHeaderExactMatcher returns a new HeaderExactMatcher.
func (*HeaderExactMatcher) Match ¶
func (hem *HeaderExactMatcher) Match(md metadata.MD) bool
Match returns whether the passed in HTTP Headers match according to the HeaderExactMatcher.
func (*HeaderExactMatcher) String ¶
func (hem *HeaderExactMatcher) String() string
type HeaderMatcher ¶
HeaderMatcher is an interface for header matchers. These are documented in (EnvoyProxy link here?). These matchers will match on different aspects of HTTP header name/value pairs.
type HeaderPrefixMatcher ¶
type HeaderPrefixMatcher struct {
// contains filtered or unexported fields
}
HeaderPrefixMatcher matches on whether the prefix of the header value matches the prefix passed into this struct.
func NewHeaderPrefixMatcher ¶
func NewHeaderPrefixMatcher(key string, prefix string, invert bool) *HeaderPrefixMatcher
NewHeaderPrefixMatcher returns a new HeaderPrefixMatcher.
func (*HeaderPrefixMatcher) Match ¶
func (hpm *HeaderPrefixMatcher) Match(md metadata.MD) bool
Match returns whether the passed in HTTP Headers match according to the HeaderPrefixMatcher.
func (*HeaderPrefixMatcher) String ¶
func (hpm *HeaderPrefixMatcher) String() string
type HeaderPresentMatcher ¶
type HeaderPresentMatcher struct {
// contains filtered or unexported fields
}
HeaderPresentMatcher will match based on whether the header is present in the whole request.
func NewHeaderPresentMatcher ¶
func NewHeaderPresentMatcher(key string, present bool, invert bool) *HeaderPresentMatcher
NewHeaderPresentMatcher returns a new HeaderPresentMatcher.
func (*HeaderPresentMatcher) Match ¶
func (hpm *HeaderPresentMatcher) Match(md metadata.MD) bool
Match returns whether the passed in HTTP Headers match according to the HeaderPresentMatcher.
func (*HeaderPresentMatcher) String ¶
func (hpm *HeaderPresentMatcher) String() string
type HeaderRangeMatcher ¶
type HeaderRangeMatcher struct {
// contains filtered or unexported fields
}
HeaderRangeMatcher matches on whether the request header value is within the range. The header value must be an integer in base 10 notation.
func NewHeaderRangeMatcher ¶
func NewHeaderRangeMatcher(key string, start, end int64, invert bool) *HeaderRangeMatcher
NewHeaderRangeMatcher returns a new HeaderRangeMatcher.
func (*HeaderRangeMatcher) Match ¶
func (hrm *HeaderRangeMatcher) Match(md metadata.MD) bool
Match returns whether the passed in HTTP Headers match according to the HeaderRangeMatcher.
func (*HeaderRangeMatcher) String ¶
func (hrm *HeaderRangeMatcher) String() string
type HeaderRegexMatcher ¶
type HeaderRegexMatcher struct {
// contains filtered or unexported fields
}
HeaderRegexMatcher matches on whether the entire request header value matches the regex.
func NewHeaderRegexMatcher ¶
func NewHeaderRegexMatcher(key string, re *regexp.Regexp, invert bool) *HeaderRegexMatcher
NewHeaderRegexMatcher returns a new HeaderRegexMatcher.
func (*HeaderRegexMatcher) Match ¶
func (hrm *HeaderRegexMatcher) Match(md metadata.MD) bool
Match returns whether the passed in HTTP Headers match according to the HeaderRegexMatcher.
func (*HeaderRegexMatcher) String ¶
func (hrm *HeaderRegexMatcher) String() string
type HeaderSuffixMatcher ¶
type HeaderSuffixMatcher struct {
// contains filtered or unexported fields
}
HeaderSuffixMatcher matches on whether the suffix of the header value matches the suffix passed into this struct.
func NewHeaderSuffixMatcher ¶
func NewHeaderSuffixMatcher(key string, suffix string, invert bool) *HeaderSuffixMatcher
NewHeaderSuffixMatcher returns a new HeaderSuffixMatcher.
func (*HeaderSuffixMatcher) Match ¶
func (hsm *HeaderSuffixMatcher) Match(md metadata.MD) bool
Match returns whether the passed in HTTP Headers match according to the HeaderSuffixMatcher.
func (*HeaderSuffixMatcher) String ¶
func (hsm *HeaderSuffixMatcher) String() string
type StringMatcher ¶
type StringMatcher struct {
// contains filtered or unexported fields
}
StringMatcher contains match criteria for matching a string, and is an internal representation of the `StringMatcher` proto defined at https://github.com/envoyproxy/envoy/blob/main/api/envoy/type/matcher/v3/string.proto.
func StringMatcherForTesting ¶
func StringMatcherForTesting(exact, prefix, suffix, contains *string, regex *regexp.Regexp, ignoreCase bool) StringMatcher
StringMatcherForTesting is a helper function to create a StringMatcher based on the given arguments. Intended only for testing purposes.
func StringMatcherFromProto ¶
func StringMatcherFromProto(matcherProto *v3matcherpb.StringMatcher) (StringMatcher, error)
StringMatcherFromProto is a helper function to create a StringMatcher from the corresponding StringMatcher proto.
Returns a non-nil error if matcherProto is invalid.
func (StringMatcher) Equal ¶
func (sm StringMatcher) Equal(other StringMatcher) bool
Equal returns true if other and sm are equivalent to each other.
func (StringMatcher) ExactMatch ¶
func (sm StringMatcher) ExactMatch() string
ExactMatch returns the value of the configured exact match or an empty string if exact match criteria was not specified.
func (StringMatcher) Match ¶
func (sm StringMatcher) Match(input string) bool
Match returns true if input matches the criteria in the given StringMatcher.