ip_restriction

package
v0.12.5 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name = "ip_restriction"
)

Variables

View Source
var (
	ErrorConfigTypeError = errors.New("unknown ip list type")
	ErrorIpIllegal       = errors.New("[ip_restriction] Illegal IP!")
)

Functions

func Check added in v0.9.0

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

func Create added in v0.9.0

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

func NewFactory

func NewFactory() eosc.IExtenderDriverFactory

func Register

func Register(register eosc.IExtenderDriverRegister)

Types

type Config

type Config struct {
	IPListType  string   `json:"ip_list_type" enum:"white,black" label:"列表类型"`
	IPWhiteList []string `json:"ip_white_list" label:"ip白名单列表"`
	IPBlackList []string `json:"ip_black_list" label:"ip黑名单列表"`
}

type IPFilter

type IPFilter func(ip string) (bool, error)

type IPHandler

type IPHandler struct {
	drivers.WorkerBase
	// contains filtered or unexported fields
}

func (*IPHandler) CheckSkill

func (I *IPHandler) CheckSkill(skill string) bool

func (*IPHandler) Destroy

func (I *IPHandler) Destroy()

func (*IPHandler) DoFilter

func (I *IPHandler) DoFilter(ctx eocontext.EoContext, next eocontext.IChain) (err error)

func (*IPHandler) DoHttpFilter added in v0.8.0

func (I *IPHandler) DoHttpFilter(ctx http_service.IHttpContext, next eocontext.IChain) error

func (*IPHandler) Reset

func (I *IPHandler) Reset(conf interface{}, workers map[eosc.RequireId]eosc.IWorker) error

func (*IPHandler) Start

func (I *IPHandler) Start() error

func (*IPHandler) Stop

func (I *IPHandler) Stop() error

Jump to

Keyboard shortcuts

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