urlrule

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StringMatch

type StringMatch struct {
	Exact  string `yaml:"exact" jsonschema:"omitempty"`
	Prefix string `yaml:"prefix" jsonschema:"omitempty"`
	RegEx  string `yaml:"regex" jsonschema:"omitempty,format=regexp"`
	Empty  bool   `yaml:"empty" jsonschema:"omitempty"`
	// contains filtered or unexported fields
}

StringMatch defines the match rule of a string

func (*StringMatch) Init

func (sm *StringMatch) Init()

Init initializes an StringMatch

func (*StringMatch) Match

func (sm *StringMatch) Match(value string) bool

Match matches a string to the pattern

func (StringMatch) Validate

func (sm StringMatch) Validate() error

Validate validates the StringMatch object

type URLRule

type URLRule struct {
	Methods   []string    `yaml:"methods" jsonschema:"omitempty,uniqueItems=true,format=httpmethod-array"`
	URL       StringMatch `yaml:"url" jsonschema:"required"`
	PolicyRef string      `yaml:"policyRef" jsonschema:"omitempty"`
	// contains filtered or unexported fields
}

URLRule defines the match rule of a http request

func (*URLRule) DeepEqual

func (r *URLRule) DeepEqual(r1 *URLRule) bool

DeepEqual returns true if r deep equal with r1 and false otherwise

func (*URLRule) ID

func (r *URLRule) ID() string

ID returns the ID of the URLRule. ID is the first valid one of Exact, Prefix, RegEx.

func (*URLRule) Init

func (r *URLRule) Init()

Init initialize an URLRule

func (*URLRule) Match

func (r *URLRule) Match(req context.HTTPRequest) bool

Match matches a URL to the rule

Jump to

Keyboard shortcuts

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