http_router

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(register eosc.IExtenderDriverRegister)

Register 注册http路由驱动工厂

Types

type Cert

type Cert struct {
	Key string `json:"key"`
	Crt string `json:"crt"`
}

Cert http路由驱动配置证书Cert结构体

type Config

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

Config http路由配置结构体

type DriverConfig

type DriverConfig struct {
	Driver   string                    `json:"driver" yaml:"driver"`
	Listen   int                       `json:"listen" yaml:"listen"`
	Method   []string                  `json:"method" yaml:"method"`
	Host     []string                  `json:"host" yaml:"host"`
	Rules    []DriverRule              `json:"rules" yaml:"rules"`
	Protocol string                    `json:"protocol" yaml:"protocol"`
	Cert     []Cert                    `json:"cert" yaml:"cert"`
	Target   eosc.RequireId            `json:"target" yaml:"target" skill:"github.com/eolinker/apinto/service.service.IService"`
	Plugins  map[string]*plugin.Config `json:"plugins" yaml:"plugins"`
}

DriverConfig http路由驱动配置

type DriverRule

type DriverRule struct {
	Location string            `json:"location" yaml:"location"`
	Header   map[string]string `json:"header" yaml:"header"`
	Query    map[string]string `json:"query" yaml:"query"`
}

DriverRule http路由驱动配置Rule结构体

type HTTPRouterDriver

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

HTTPRouterDriver 实现github.com/eolinker/eosc.eosc.IProfessionDriver接口

func NewHTTPRouter

func NewHTTPRouter() *HTTPRouterDriver

NewHTTPRouter 创建一个http路由驱动

func (*HTTPRouterDriver) ConfigType

func (h *HTTPRouterDriver) ConfigType() reflect.Type

ConfigType 返回http路由驱动配置的反射类型

func (*HTTPRouterDriver) Create

func (h *HTTPRouterDriver) Create(id, name string, v interface{}, workers map[eosc.RequireId]interface{}) (eosc.IWorker, error)

Create 创建一个http路由驱动实例

func (*HTTPRouterDriver) NewRouter

func (h *HTTPRouterDriver) NewRouter(id, name string, c *DriverConfig, target service.IServiceCreate) (*Router, error)

NewRouter 创建http路由驱动实例

type Router

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

Router http路由驱动实例结构体,实现了worker接口

func (*Router) CheckSkill

func (r *Router) CheckSkill(skill string) bool

CheckSkill 技能检查

func (*Router) Id

func (r *Router) Id() string

Id 返回workerID

func (*Router) Reset

func (r *Router) Reset(conf interface{}, workers map[eosc.RequireId]interface{}) error

func (*Router) Start

func (r *Router) Start() error

Start 启动路由worker,将路由实例加入到路由树中

func (*Router) Stop

func (r *Router) Stop() error

Stop 停止路由worker,将路由实例从路由树中删去

type RouterDriverFactory

type RouterDriverFactory struct {
}

RouterDriverFactory http路由驱动工厂结构体

func NewRouterDriverFactory

func NewRouterDriverFactory() *RouterDriverFactory

NewRouterDriverFactory 创建一个http路由驱动工厂

func (*RouterDriverFactory) Create

func (r *RouterDriverFactory) Create(profession string, name string, label string, desc string, params map[string]interface{}) (eosc.IExtenderDriver, error)

Create 创建http路由驱动

type RouterHandler

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

func NewRouterHandler

func NewRouterHandler(routerConfig *router_http.Config, routerPlugin plugin.IPlugin, handler service2.IService) *RouterHandler

func (*RouterHandler) Destroy

func (r *RouterHandler) Destroy()

func (*RouterHandler) DoFilter

func (r *RouterHandler) DoFilter(ctx service.IHttpContext, next service.IChain) (err error)

Jump to

Keyboard shortcuts

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