zlimit

package
v0.0.0-...-83adff0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DB        *sql.Config
	Redis     *Redis
	IPFile    string
	FlushTime xtime.Duration
}

Config default struct

type Redis

type Redis struct {
	*redis.Config
	Expire xtime.Duration
}

Redis redis struct

type Service

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

Service zlimit service struct

func New

func New(c *Config) (s *Service)

New new zlimit service

func (*Service) Find

func (s *Service) Find(c context.Context, aid int64, ipaddr, cdnip string) (ret, retdown int64, err error)

Find redio rule by aid and ipaddr

func (*Service) FindByGid

func (s *Service) FindByGid(c context.Context, gid int64, ipaddr, cdnip string) (ret, retdown int64)

FindByGid redio rule by group_id and ipaddr(or cdnip)

func (*Service) FindByPid

func (s *Service) FindByPid(c context.Context, pids []int64, ipaddr string) (ret, retdown int64)

FindByPid redio rule by policy_id and ipaddr

func (*Service) Forbid

func (s *Service) Forbid(c context.Context, pstr string, ipaddr string) (err error)

Forbid check ip is forbid or not.

Jump to

Keyboard shortcuts

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