Documentation ¶
Overview ¶
Package router expose API for user to get or set route rule
Index ¶
- Constants
- Variables
- func BuildRouter(name string) error
- func FitRate(tags []*model.RouteTag, dest string) *model.RouteTag
- func Init() error
- func InstallRouterService(name string, f func() (Router, error))
- func Match(match model.Match, headers map[string]string, source *registry.SourceInfo) bool
- func QuickSort(left int, right int, rules []*model.RouteRule) (s []*model.RouteRule)
- func Route(header map[string]string, si *registry.SourceInfo, inv *invocation.Invocation) error
- func SortRules(name string) []*model.RouteRule
- func SourceMatch(match *model.Match, headers map[string]string, source *registry.SourceInfo) bool
- func ValidateRule(rules map[string][]*model.RouteRule) bool
- type Options
- type Router
Constants ¶
View Source
const RouterTLS = "router"
RouterTLS defines tls prefix
Variables ¶
View Source
var ErrNoExist = errors.New("router not exists")
ErrNoExist means if there is no router implementation
View Source
var Templates = make(map[string]*model.Match)
Templates is for source match template settings
Functions ¶
func InstallRouterService ¶
InstallRouterService install router service for developer
func Route ¶
func Route(header map[string]string, si *registry.SourceInfo, inv *invocation.Invocation) error
Route route the APIs
func SourceMatch ¶
SourceMatch check the source route
Types ¶
type Options ¶ added in v0.7.1
Options defines how to init router and its fetcher
func (Options) ToPilotOptions ¶ added in v0.7.1
func (o Options) ToPilotOptions() *client.PilotOptions
ToPilotOptions translate options to client options
type Router ¶
type Router interface { Init(Options) error InitRouteRuleByKey(string) SetRouteRule(map[string][]*model.RouteRule) FetchRouteRule() map[string][]*model.RouteRule FetchRouteRuleByServiceName(string) []*model.RouteRule }
Router return route rule, you can also set custom route rule
var DefaultRouter Router
DefaultRouter is current router implementation
Click to show internal directories.
Click to hide internal directories.