Documentation
¶
Index ¶
- Variables
- func IsComparable(v any) bool
- type PathMatcher
- type Route
- func (r *Route) Clone() *Route
- func (r *Route) Director(ctx context.Context) func(req *http.Request)
- func (r *Route) HandlerWith(ctx context.Context, kvs ...any) http.HandlerFunc
- func (r *Route) IsNotFoundRoute() bool
- func (r *Route) Match(path, method string) bool
- func (r *Route) OverridePathRegex()
- func (r *Route) PathRegexExpr() string
- func (r *Route) Validate() error
- type Router
- type Routes
- type To
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NotFoundRoute = &Route{ Path: "/", Router: &Router{To: ToNotFound}, } )
Functions ¶
func IsComparable ¶
Types ¶
type PathMatcher ¶
func NewPathMatcher ¶
func NewPathMatcher(expr string) (*PathMatcher, error)
func (*PathMatcher) Match ¶
func (p *PathMatcher) Match(path string) bool
func (*PathMatcher) SetValue ¶
func (p *PathMatcher) SetValue(key, value string)
type Route ¶
type Route struct {
Path string `json:"path" yaml:"path"`
PathRegex string `json:"pathRegex" yaml:"pathRegex"`
Method string `json:"method" yaml:"method"`
Router *Router `json:"router" yaml:"router"`
Filters []*reverseproxy.FilterConfig `json:"filters" yaml:"filters"`
PathMatcher *PathMatcher `json:"-" yaml:"-"`
MethodMatcher func(method string) bool `json:"-" yaml:"-"`
}
func (*Route) HandlerWith ¶
func (*Route) IsNotFoundRoute ¶
func (*Route) OverridePathRegex ¶
func (r *Route) OverridePathRegex()
OverridePathRegex generates the PathRegex and overwrite it
func (*Route) PathRegexExpr ¶
type Router ¶
type Router struct {
To To `json:"to" yaml:"to"`
InstanceId string `json:"instanceId" yaml:"instanceId"`
Scheme string `json:"scheme" yaml:"scheme"`
Host string `json:"host" yaml:"host"`
Rewrite string `json:"rewrite" yaml:"rewrite"`
}
Click to show internal directories.
Click to hide internal directories.