matchers

package
v1.18.0-beta29 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_github_com_solo_io_gloo_projects_gloo_api_v1_core_matchers_matchers_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type HeaderMatcher

type HeaderMatcher struct {

	// Specifies the name of the header in the request.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Specifies the value of the header. If the value is absent a request that
	// has the name header will match, regardless of the header’s value.
	Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// Specifies whether the header value should be treated as regex or not.
	Regex bool `protobuf:"varint,3,opt,name=regex,proto3" json:"regex,omitempty"`
	// If set to true, the result of the match will be inverted. Defaults to false.
	//
	// Examples:
	// * name=foo, invert_match=true: matches if no header named `foo` is present
	// * name=foo, value=bar, invert_match=true: matches if no header named `foo` with value `bar` is present
	// * name=foo, value=“\d{3}“, regex=true, invert_match=true: matches if no header named `foo` with a value consisting of three integers is present
	InvertMatch bool `protobuf:"varint,4,opt,name=invert_match,json=invertMatch,proto3" json:"invert_match,omitempty"`
	// contains filtered or unexported fields
}

Internally, Gloo always uses the HTTP/2 *:authority* header to represent the HTTP/1 *Host* header. Thus, if attempting to match on *Host*, match on *:authority* instead.

func (*HeaderMatcher) Clone added in v1.8.24

func (m *HeaderMatcher) Clone() proto.Message

Clone function

func (*HeaderMatcher) Descriptor deprecated

func (*HeaderMatcher) Descriptor() ([]byte, []int)

Deprecated: Use HeaderMatcher.ProtoReflect.Descriptor instead.

func (*HeaderMatcher) Equal

func (m *HeaderMatcher) Equal(that interface{}) bool

Equal function

func (*HeaderMatcher) GetInvertMatch

func (x *HeaderMatcher) GetInvertMatch() bool

func (*HeaderMatcher) GetName

func (x *HeaderMatcher) GetName() string

func (*HeaderMatcher) GetRegex

func (x *HeaderMatcher) GetRegex() bool

func (*HeaderMatcher) GetValue

func (x *HeaderMatcher) GetValue() string

func (*HeaderMatcher) Hash deprecated added in v1.2.13

func (m *HeaderMatcher) Hash(hasher hash.Hash64) (uint64, error)

Hash function

Deprecated: due to hashing implemention only using field values. The omission of the field name in the hash calculation can lead to hash collisions. Prefer the HashUnique function instead.

func (*HeaderMatcher) HashUnique added in v1.18.0

func (m *HeaderMatcher) HashUnique(hasher hash.Hash64) (uint64, error)

HashUnique function generates a hash of the object that is unique to the object by hashing field name and value pairs. Replaces Hash due to original hashing implemention only using field values. The omission of the field name in the hash calculation can lead to hash collisions.

func (*HeaderMatcher) ProtoMessage

func (*HeaderMatcher) ProtoMessage()

func (*HeaderMatcher) ProtoReflect added in v1.6.0

func (x *HeaderMatcher) ProtoReflect() protoreflect.Message

func (*HeaderMatcher) Reset

func (x *HeaderMatcher) Reset()

func (*HeaderMatcher) String

func (x *HeaderMatcher) String() string

type Matcher

type Matcher struct {

	// Types that are assignable to PathSpecifier:
	//
	//	*Matcher_Prefix
	//	*Matcher_Exact
	//	*Matcher_Regex
	//	*Matcher_ConnectMatcher_
	PathSpecifier isMatcher_PathSpecifier `protobuf_oneof:"path_specifier"`
	// Indicates that prefix/path matching should be case sensitive. The default is true.
	CaseSensitive *wrapperspb.BoolValue `protobuf:"bytes,4,opt,name=case_sensitive,json=caseSensitive,proto3" json:"case_sensitive,omitempty"`
	// Specifies a set of headers that the route should match on. The router will
	// check the request’s headers against all the specified headers in the route
	// config. A match will happen if all the headers in the route are present in
	// the request with the same values (or based on presence if the value field
	// is not in the config).
	Headers []*HeaderMatcher `protobuf:"bytes,6,rep,name=headers,proto3" json:"headers,omitempty"`
	// Specifies a set of URL query parameters on which the route should
	// match. The router will check the query string from the *path* header
	// against all the specified query parameters. If the number of specified
	// query parameters is nonzero, they all must match the *path* header's
	// query string for a match to occur.
	QueryParameters []*QueryParameterMatcher `protobuf:"bytes,7,rep,name=query_parameters,json=queryParameters,proto3" json:"query_parameters,omitempty"`
	// HTTP Method/Verb(s) to match on. If none specified, the matcher will ignore the HTTP Method
	Methods []string `protobuf:"bytes,8,rep,name=methods,proto3" json:"methods,omitempty"`
	// contains filtered or unexported fields
}

Parameters for matching routes to requests received by a Gloo-managed proxy

func (*Matcher) Clone added in v1.8.24

func (m *Matcher) Clone() proto.Message

Clone function

func (*Matcher) Descriptor deprecated

func (*Matcher) Descriptor() ([]byte, []int)

Deprecated: Use Matcher.ProtoReflect.Descriptor instead.

func (*Matcher) Equal

func (m *Matcher) Equal(that interface{}) bool

Equal function

func (*Matcher) GetCaseSensitive added in v1.6.0

func (x *Matcher) GetCaseSensitive() *wrapperspb.BoolValue

func (*Matcher) GetConnectMatcher added in v1.14.0

func (x *Matcher) GetConnectMatcher() *Matcher_ConnectMatcher

func (*Matcher) GetExact

func (x *Matcher) GetExact() string

func (*Matcher) GetHeaders

func (x *Matcher) GetHeaders() []*HeaderMatcher

func (*Matcher) GetMethods

func (x *Matcher) GetMethods() []string

func (*Matcher) GetPathSpecifier

func (m *Matcher) GetPathSpecifier() isMatcher_PathSpecifier

func (*Matcher) GetPrefix

func (x *Matcher) GetPrefix() string

func (*Matcher) GetQueryParameters

func (x *Matcher) GetQueryParameters() []*QueryParameterMatcher

func (*Matcher) GetRegex

func (x *Matcher) GetRegex() string

func (*Matcher) Hash deprecated added in v1.2.13

func (m *Matcher) Hash(hasher hash.Hash64) (uint64, error)

Hash function

Deprecated: due to hashing implemention only using field values. The omission of the field name in the hash calculation can lead to hash collisions. Prefer the HashUnique function instead.

func (*Matcher) HashUnique added in v1.18.0

func (m *Matcher) HashUnique(hasher hash.Hash64) (uint64, error)

HashUnique function generates a hash of the object that is unique to the object by hashing field name and value pairs. Replaces Hash due to original hashing implemention only using field values. The omission of the field name in the hash calculation can lead to hash collisions.

func (*Matcher) ProtoMessage

func (*Matcher) ProtoMessage()

func (*Matcher) ProtoReflect added in v1.6.0

func (x *Matcher) ProtoReflect() protoreflect.Message

func (*Matcher) Reset

func (x *Matcher) Reset()

func (*Matcher) String

func (x *Matcher) String() string

type Matcher_ConnectMatcher added in v1.14.0

type Matcher_ConnectMatcher struct {
	// contains filtered or unexported fields
}

func (*Matcher_ConnectMatcher) Clone added in v1.14.0

Clone function

func (*Matcher_ConnectMatcher) Descriptor deprecated added in v1.14.0

func (*Matcher_ConnectMatcher) Descriptor() ([]byte, []int)

Deprecated: Use Matcher_ConnectMatcher.ProtoReflect.Descriptor instead.

func (*Matcher_ConnectMatcher) Equal added in v1.14.0

func (m *Matcher_ConnectMatcher) Equal(that interface{}) bool

Equal function

func (*Matcher_ConnectMatcher) Hash deprecated added in v1.14.0

func (m *Matcher_ConnectMatcher) Hash(hasher hash.Hash64) (uint64, error)

Hash function

Deprecated: due to hashing implemention only using field values. The omission of the field name in the hash calculation can lead to hash collisions. Prefer the HashUnique function instead.

func (*Matcher_ConnectMatcher) HashUnique added in v1.18.0

func (m *Matcher_ConnectMatcher) HashUnique(hasher hash.Hash64) (uint64, error)

HashUnique function generates a hash of the object that is unique to the object by hashing field name and value pairs. Replaces Hash due to original hashing implemention only using field values. The omission of the field name in the hash calculation can lead to hash collisions.

func (*Matcher_ConnectMatcher) ProtoMessage added in v1.14.0

func (*Matcher_ConnectMatcher) ProtoMessage()

func (*Matcher_ConnectMatcher) ProtoReflect added in v1.14.0

func (x *Matcher_ConnectMatcher) ProtoReflect() protoreflect.Message

func (*Matcher_ConnectMatcher) Reset added in v1.14.0

func (x *Matcher_ConnectMatcher) Reset()

func (*Matcher_ConnectMatcher) String added in v1.14.0

func (x *Matcher_ConnectMatcher) String() string

type Matcher_ConnectMatcher_ added in v1.14.0

type Matcher_ConnectMatcher_ struct {
	// If this is used as the matcher, the matcher will only match CONNECT requests.
	// Note that this will not match HTTP/2 upgrade-style CONNECT requests
	// (WebSocket and the like) as they are normalized in Envoy as HTTP/1.1 style
	// upgrades.
	// This is the only way to match CONNECT requests for HTTP/1.1. For HTTP/2,
	// where CONNECT requests may have a path, the path matchers will work if
	// there is a path present.
	// Note that CONNECT support is currently considered alpha in Envoy.
	ConnectMatcher *Matcher_ConnectMatcher `protobuf:"bytes,9,opt,name=connect_matcher,json=connectMatcher,proto3,oneof"`
}

type Matcher_Exact

type Matcher_Exact struct {
	// If specified, the route is an exact path rule meaning that the path must
	// exactly match the *:path* header once the query string is removed.
	Exact string `protobuf:"bytes,2,opt,name=exact,proto3,oneof"`
}

type Matcher_Prefix

type Matcher_Prefix struct {
	// If specified, the route is a prefix rule meaning that the prefix must
	// match the beginning of the *:path* header.
	Prefix string `protobuf:"bytes,1,opt,name=prefix,proto3,oneof"`
}

type Matcher_Regex

type Matcher_Regex struct {
	// If specified, the route is a regular expression rule meaning that the
	// regex must match the *:path* header once the query string is removed. The entire path
	// (without the query string) must match the regex. The rule will not match if only a
	// sub-sequence of the *:path* header matches the regex. The regex grammar is defined `here
	// <http://en.cppreference.com/w/cpp/regex/ecmascript>`_.
	//
	// Examples:<br/>
	//
	// * The regex */b[io]t* matches the path */bit*<br/>
	// * The regex */b[io]t* matches the path */bot*<br/>
	// * The regex */b[io]t* does not match the path */bite*<br/>
	// * The regex */b[io]t* does not match the path */bit/bot*<br/><br/>
	//
	// Note that the complexity of the regex is constrained by the regex engine's "program size" setting.
	// If your regex is too complex, you may need to adjust the `regexMaxProgramSize` field
	// in the `GlooOptions` section of your `Settings` resource (The gloo default is 1024)
	Regex string `protobuf:"bytes,3,opt,name=regex,proto3,oneof"`
}

type QueryParameterMatcher

type QueryParameterMatcher struct {

	// Specifies the name of a key that must be present in the requested
	// *path*'s query string.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Specifies the value of the key. If the value is absent, a request
	// that contains the key in its query string will match, whether the
	// key appears with a value (e.g., "?debug=true") or not (e.g., "?debug")
	Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// Specifies whether the query parameter value is a regular expression.
	// Defaults to false. The entire query parameter value (i.e., the part to
	// the right of the equals sign in "key=value") must match the regex.
	// E.g., the regex "\d+$" will match "123" but not "a123" or "123a".
	Regex bool `protobuf:"varint,3,opt,name=regex,proto3" json:"regex,omitempty"`
	// contains filtered or unexported fields
}

Query parameter matching treats the query string of a request's :path header as an ampersand-separated list of keys and/or key=value elements.

func (*QueryParameterMatcher) Clone added in v1.8.24

func (m *QueryParameterMatcher) Clone() proto.Message

Clone function

func (*QueryParameterMatcher) Descriptor deprecated

func (*QueryParameterMatcher) Descriptor() ([]byte, []int)

Deprecated: Use QueryParameterMatcher.ProtoReflect.Descriptor instead.

func (*QueryParameterMatcher) Equal

func (m *QueryParameterMatcher) Equal(that interface{}) bool

Equal function

func (*QueryParameterMatcher) GetName

func (x *QueryParameterMatcher) GetName() string

func (*QueryParameterMatcher) GetRegex

func (x *QueryParameterMatcher) GetRegex() bool

func (*QueryParameterMatcher) GetValue

func (x *QueryParameterMatcher) GetValue() string

func (*QueryParameterMatcher) Hash deprecated added in v1.2.13

func (m *QueryParameterMatcher) Hash(hasher hash.Hash64) (uint64, error)

Hash function

Deprecated: due to hashing implemention only using field values. The omission of the field name in the hash calculation can lead to hash collisions. Prefer the HashUnique function instead.

func (*QueryParameterMatcher) HashUnique added in v1.18.0

func (m *QueryParameterMatcher) HashUnique(hasher hash.Hash64) (uint64, error)

HashUnique function generates a hash of the object that is unique to the object by hashing field name and value pairs. Replaces Hash due to original hashing implemention only using field values. The omission of the field name in the hash calculation can lead to hash collisions.

func (*QueryParameterMatcher) ProtoMessage

func (*QueryParameterMatcher) ProtoMessage()

func (*QueryParameterMatcher) ProtoReflect added in v1.6.0

func (x *QueryParameterMatcher) ProtoReflect() protoreflect.Message

func (*QueryParameterMatcher) Reset

func (x *QueryParameterMatcher) Reset()

func (*QueryParameterMatcher) String

func (x *QueryParameterMatcher) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL