service

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: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RemoveDuplicatesAndEmpty

func RemoveDuplicatesAndEmpty(a []string) (ret []string)

RemoveDuplicatesAndEmpty string去重 去空

Types

type HeadIndex

type HeadIndex struct {
	Index    int
	Country  int
	Province int
	City     int
	ISP      int
	District int
}

HeadIndex index pos.

type Service

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

Service define resource service

func New

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

New new a Service and return.

func (*Service) Anonym

func (s *Service) Anonym(ipStr string) (res *model.AnonymousIP, err error)

Anonym .

func (*Service) Archive2

func (s *Service) Archive2(c context.Context, aid, mid int64, ipaddr, cdnip string) (res *model.Auth, err error)

Archive2 get auth by aid and ipaddr & check mid.

func (*Service) Auth

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

Auth get auth by aid and ipaddr & check mid.

func (*Service) Auth2

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

Auth2 get auth by aid and ipaddr.

func (*Service) AuthGID

func (s *Service) AuthGID(c context.Context, gid, mid int64, ipaddr, cdnip string) (res *model.Auth)

AuthGID auth by group_id and ipaddr(or cdnip) & check mid.

func (*Service) AuthGID2

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

AuthGID2 auth by group_id and ipaddr(or cdnip).

func (*Service) AuthGIDs

func (s *Service) AuthGIDs(c context.Context, gids []int64, mid int64, ipaddr, cdnip string) (res map[int64]*model.Auth)

AuthGIDs auth by group_id and ipaddr(or cdnip) & check mid.

func (*Service) AuthPIDs

func (s *Service) AuthPIDs(c context.Context, pidStr, ipaddr, cdnip string) (res map[int64]*model.Auth, err error)

AuthPIDs check by policy_ids and ipaddr

func (*Service) Close

func (s *Service) Close()

Close dao.

func (*Service) Info

func (s *Service) Info(c context.Context, addr string) (res *model.Info, err error)

Info get ip info.

func (*Service) InfoComplete

func (s *Service) InfoComplete(c context.Context, addr string) (res *model.InfoComplete, err error)

InfoComplete find get whole ip info.

func (*Service) Infos

func (s *Service) Infos(c context.Context, addrs []string) (res map[string]*model.Info, err error)

Infos get ip infos.

func (*Service) InfosComplete

func (s *Service) InfosComplete(c context.Context, ipsStr []string) (res map[string]*model.InfoComplete, err error)

InfosComplete finds get whole ips infos.

func (*Service) LoadPolicy

func (s *Service) LoadPolicy() (err error)

LoadPolicy locad policy from db

func (*Service) NewAnonym

func (s *Service) NewAnonym(path string) (reader *maxminddb.Reader, err error)

NewAnonym load bin file.

func (*Service) PgcZone

func (s *Service) PgcZone(c context.Context, zoneIDs []int64) (res map[string][]int64, err error)

PgcZone get group_id by zoneid .

func (*Service) Ping

func (s *Service) Ping(c context.Context) (err error)

Ping check server ok.

func (*Service) TmpInfo

func (s *Service) TmpInfo(addr string) (ti *model.TmpInfo, err error)

TmpInfo get ip info.

func (*Service) TmpInfo2

func (s *Service) TmpInfo2(c context.Context, addr string) (zone *xip.Zone, err error)

TmpInfo2 get ip zone from ip

func (*Service) TmpInfos

func (s *Service) TmpInfos(c context.Context, addrs ...string) (zone []*xip.Zone, err error)

TmpInfos get ip infos.

type ZoneInfo

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

ZoneInfo all kinds of zone info.

Jump to

Keyboard shortcuts

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