grpc_router

package
v0.19.4 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 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 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

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, service string, method string, append []router.AppendRule) error

func (*Hosts) Build

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

type IBuilder

type IBuilder interface {
	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, service string, method string, append []router.AppendRule) error

func (*Ports) Build

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

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, service string, method string, append []router.AppendRule) error

func (*Root) Build

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

type RuleType

type RuleType = string
const (
	HttpHeader RuleType = "header"
)

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