ip_restriction

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: Apache-2.0 Imports: 10 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 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 Driver

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

func (*Driver) Check

func (d *Driver) Check(v interface{}, workers map[eosc.RequireId]eosc.IWorker) error

func (*Driver) ConfigType

func (d *Driver) ConfigType() reflect.Type

func (*Driver) Create

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

type Factory

type Factory struct {
}

func NewFactory

func NewFactory() *Factory

func (*Factory) Create

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

func (*Factory) Render added in v0.6.0

func (f *Factory) Render() interface{}

type IPFilter

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

type IPHandler

type IPHandler struct {
	*Driver
	// 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) Id

func (I *IPHandler) Id() string

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