visit_strategy

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "strategy-visit"

Variables

This section is empty.

Functions

func Check

func Check(cfg *Config, workers map[eosc.RequireId]eosc.IWorker) error

func Create

func Create(id, name string, v *Config, workers map[eosc.RequireId]eosc.IWorker) (eosc.IWorker, error)

func DoStrategy

func DoStrategy(ctx eocontext.EoContext, next eocontext.IChain) error

func Register

func Register(register eosc.IExtenderDriverRegister)

Register 注册http路由驱动工厂

Types

type ActuatorSet

type ActuatorSet interface {
	strategy.IStrategyHandler
	Set(string, *visitHandler)
	Del(id string)
}

type Config

type Config struct {
	Name        string                `json:"name" skip:"skip"`
	Description string                `json:"description" skip:"skip"`
	Stop        bool                  `json:"stop"`
	Priority    int                   `json:"priority" label:"优先级" description:"1-999"`
	Filters     strategy.FilterConfig `json:"filters" label:"过滤规则"`
	Rule        Rule                  `json:"visit" label:"规则"`
}

type Controller

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

func NewController

func NewController() *Controller

func (*Controller) AllWorkers

func (c *Controller) AllWorkers() []string

func (*Controller) Check

func (c *Controller) Check(cfg interface{}) (profession, name, driver, desc string, err error)

func (*Controller) ConfigType

func (c *Controller) ConfigType() reflect.Type

func (*Controller) Del

func (c *Controller) Del(id string)

func (*Controller) Get

func (c *Controller) Get() interface{}

func (*Controller) Mode

func (c *Controller) Mode() eosc.SettingMode

func (*Controller) Set

func (c *Controller) Set(conf interface{}) (err error)

func (*Controller) Store

func (c *Controller) Store(id string)

type Rule

type Rule struct {
	VisitRule       VisitRule             `json:"visit_rule" label:"访问规则"`
	InfluenceSphere strategy.FilterConfig `json:"influence_sphere" label:"生效范围"`
	Continue        bool                  `json:"continue" label:"继续匹配其他访问策略"`
}

type Visit

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

func (*Visit) CheckSkill

func (l *Visit) CheckSkill(skill string) bool

func (*Visit) Destroy

func (l *Visit) Destroy() error

func (*Visit) Id

func (l *Visit) Id() string

func (*Visit) Reset

func (l *Visit) Reset(v interface{}, workers map[eosc.RequireId]eosc.IWorker) error

func (*Visit) Start

func (l *Visit) Start() error

func (*Visit) Stop

func (l *Visit) Stop() error

type VisitRule

type VisitRule string
const (
	// VisitRuleAllow 访问策略访问规则
	VisitRuleAllow  VisitRule = "allow"  //允许访问
	VisitRuleRefuse VisitRule = "refuse" //拒绝访问
)

Jump to

Keyboard shortcuts

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