http_router

package
v0.15.5 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorDuplicate = errors.New("duplicate")

Functions

func Parse

func Parse(rules []router.AppendRule) router.MatcherChecker

Types

type AppendMatcher

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

func (*AppendMatcher) Match

func (a *AppendMatcher) Match(port int, req interface{}) (router.IRouterHandler, bool)

type AppendMatchers

type AppendMatchers []*AppendMatcher

func (AppendMatchers) Len

func (as AppendMatchers) Len() int

func (AppendMatchers) Less

func (as AppendMatchers) Less(i, j int) bool

func (AppendMatchers) Match

func (as AppendMatchers) Match(port int, request interface{}) (router.IRouterHandler, bool)

func (AppendMatchers) Swap

func (as AppendMatchers) Swap(i, j int)

type CheckMatcher

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

func NewPathMatcher

func NewPathMatcher(equals map[string]router.IMatcher, checkers []*CheckerHandler, all router.IMatcher) *CheckMatcher

func (*CheckMatcher) Match

func (c *CheckMatcher) Match(port int, req interface{}) (router.IRouterHandler, bool)

type CheckerHandler

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

type CheckerSort

type CheckerSort []*CheckerHandler

func (CheckerSort) Len

func (cs CheckerSort) Len() int

func (CheckerSort) Less

func (cs CheckerSort) Less(i, j int) bool

func (CheckerSort) Swap

func (cs CheckerSort) Swap(i, j int)

type CookieChecker

type CookieChecker struct {
	checker.Checker
	// contains filtered or unexported fields
}

func (*CookieChecker) MatchCheck

func (c *CookieChecker) MatchCheck(req interface{}) bool

func (*CookieChecker) Weight added in v0.10.0

func (c *CookieChecker) Weight() int

type EmptyMatcher

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

func (*EmptyMatcher) Match

func (e *EmptyMatcher) Match(port int, request interface{}) (router.IRouterHandler, bool)

type Handler

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

func NewHandler

func NewHandler(id string, handler router.IRouterHandler, appends []router.AppendRule) *Handler

func (*Handler) Build

func (h *Handler) Build() router.IMatcher

type HeaderChecker

type HeaderChecker struct {
	checker.Checker
	// contains filtered or unexported fields
}

func (*HeaderChecker) MatchCheck

func (h *HeaderChecker) MatchCheck(req interface{}) bool

func (*HeaderChecker) Weight added in v0.10.0

func (h *HeaderChecker) Weight() int

type Hosts

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

func NewHosts

func NewHosts() *Hosts

func (*Hosts) Add

func (h *Hosts) Add(id string, handler router.IRouterHandler, methods []string, path string, append []router.AppendRule) error

func (*Hosts) Build

func (h *Hosts) Build() router.IMatcher

type IBuilder

type IBuilder interface {
	Build() router.IMatcher
}

type Methods

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

func NewMethods

func NewMethods() *Methods

func (*Methods) Add

func (m *Methods) Add(id string, handler router.IRouterHandler, path string, append []router.AppendRule) error

func (*Methods) Build

func (m *Methods) Build() router.IMatcher

type Paths

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

func NewPaths

func NewPaths(checker checker.Checker) *Paths

func (*Paths) Add

func (p *Paths) Add(id string, handler router.IRouterHandler, append []router.AppendRule) error

func (*Paths) Build

func (p *Paths) Build() router.IMatcher

type Ports

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

func NewPorts

func NewPorts() *Ports

func (*Ports) Add

func (p *Ports) Add(id string, handler router.IRouterHandler, hosts []string, methods []string, path string, append []router.AppendRule) error

func (*Ports) Build

func (p *Ports) Build() router.IMatcher

type QueryChecker

type QueryChecker struct {
	checker.Checker
	// contains filtered or unexported fields
}

func (*QueryChecker) MatchCheck

func (q *QueryChecker) MatchCheck(req interface{}) bool

func (*QueryChecker) Weight added in v0.10.0

func (q *QueryChecker) Weight() int

type Root

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

func NewRoot

func NewRoot() *Root

func (*Root) Add

func (r *Root) Add(id string, handler router.IRouterHandler, port int, hosts []string, methods []string, path string, append []router.AppendRule) error

func (*Root) Build

func (r *Root) Build() router.IMatcher

type RuleType

type RuleType = string
const (
	HttpHeader RuleType = "header"
	HttpQuery  RuleType = "query"
	HttpCookie RuleType = "cookie"
)

type SimpleMatcher

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

func (*SimpleMatcher) Match

func (s *SimpleMatcher) Match(port int, req interface{}) (router.IRouterHandler, bool)

Jump to

Keyboard shortcuts

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