Documentation ¶
Index ¶
- func Add(port int, id string, config *Config) error
- func Del(port int, id string) error
- type Cert
- type Certs
- type Config
- type EndPoint
- type HTTPRouterHelper
- type HTTPSources
- type HeaderItem
- type IMatcher
- type IRouter
- type IRouters
- type Manager
- type Matcher
- type NotFond
- type QueryItem
- type Router
- type Routers
- type Rule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { ID string Name string //Cert []Cert Hosts []string Methods []string Target http_service.IChain Rules []Rule }
Config http路由实例配置结构体
type EndPoint ¶
type EndPoint struct {
// contains filtered or unexported fields
}
EndPoint 路由端点结构体
type HTTPRouterHelper ¶
type HTTPRouterHelper struct {
// contains filtered or unexported fields
}
HTTPRouterHelper http路由指标类型排序helper
func NewHTTPRouterHelper ¶
func NewHTTPRouterHelper() *HTTPRouterHelper
NewHTTPRouterHelper 新建一个http路由指标类型排序helper
type HTTPSources ¶
type HTTPSources struct {
// contains filtered or unexported fields
}
HTTPSources 封装http请求的结构体
type IMatcher ¶
type IMatcher interface {
Match(req http_service.IRequestReader) (service.IService, router.IEndPoint, bool)
}
IMatcher IMatcher接口实现了Match方法:根据http请求返回服务接口
type IRouter ¶
type IRouter interface { SetRouter(id string, config *Config) error Count() int Del(id string) int Handler(ctx *fasthttp.RequestCtx) }
IRouter 路由树的接口
type IRouters ¶
type IRouters interface { Set(port int, id string, conf *Config) (IRouter, bool, error) Del(port int, id string) (IRouter, bool) }
IRouters 路由树管理器实现的接口
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager 路由管理器结构体
func NewManager ¶
func NewManager(tf traffic.ITraffic, listenCfg *config.ListensMsg, pluginManager plugin.IPluginManager) *Manager
NewManager 创建路由管理器
type Matcher ¶
type Matcher struct {
// contains filtered or unexported fields
}
Matcher Matcher结构体,实现了根据请求返回服务接口的方法
func (*Matcher) Match ¶
func (m *Matcher) Match(req http_service.IRequestReader) (service.IService, router.IEndPoint, bool)
Match 对http请求进行路由匹配,并返回服务
type NotFond ¶
type NotFond struct { }
func (*NotFond) DoFilter ¶
func (n *NotFond) DoFilter(ctx http_service.IHttpContext, chain http_service.IChain) (err error)
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router 实现了路由树接口
func (*Router) Handler ¶
func (r *Router) Handler(requestCtx *fasthttp.RequestCtx)
Handler 路由树的handler方法
Click to show internal directories.
Click to hide internal directories.