service

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountDetail

func CountDetail(prefix string) (res map[string]string, err error)
func GetAllRouterAndCount() (res []model.Api, err error) {
	if res, err = mysql.GetAllRouterAndCount(); err != nil {
		return nil, err
	} else {
		return res, nil
	}

}

func GetCountBytime

func GetCountBytime() (res []string, err error)

func GetCountBytime() (timeList, countList string, err error) {

	if timeList, countList, err = redis.GetTimeAndCountList(); err != nil {
		fmt.Println(err)
		return
	} else {

		return
	}
}

func GetToTalCount

func GetToTalCount() (res string, err error)

func MD5_SALT

func MD5_SALT(str string) string

func SignIn

func SignIn(p *model.User) (err error)

func SignUp

func SignUp(p *model.User) (err error)

func SingleCount

func SingleCount(prefix string, req string) (res string, err error)

拿到单个API被哪些IP调用或单个IP调用了哪些API prefix即为需要查看的

func WatchRedis

func WatchRedis()

Types

type Response

type Response struct {
	StatusCode int32  `json:"status_code"`
	StatusMsg  string `json:"status_msg,omitempty"`
}

type Service

type Service struct {
	KfkChan  chan []byte
	BadIp    []model.BadIpRsp
	BadWords []string
	// contains filtered or unexported fields
}

func New

func New(cfg *config.Config, db *gorm.DB, rds *redis.Client, kafka sarama.Consumer) *Service

func (*Service) DeleteBadIP

func (s *Service) DeleteBadIP(str string) error

DeleteBadIP 删除BadIP

func (*Service) DeleteBadWords

func (s *Service) DeleteBadWords(str string) error

DeleteBadWords 删除BadWords

func (*Service) FlushBadIp

func (s *Service) FlushBadIp() error

FlushBadIp 初始化Bad名单InitBad

func (*Service) FlushBadWords

func (s *Service) FlushBadWords()

FlushBadWords 初始化BadWords名单

func (*Service) GetUserInfo

func (s *Service) GetUserInfo(selfId uint64, UserID uint64) *User

func (*Service) InitKafkaConsumer

func (s *Service) InitKafkaConsumer(cfg *config.Config, consumer sarama.Consumer)

InitKafkaConsumer 初始化kafkaConsumer

func (*Service) PhasePackage

func (s *Service) PhasePackage()

PhasePackage 解析kafka队列中拿出来的数据

func (*Service) SetBadIP

func (s *Service) SetBadIP(badip *model.BadIp) error

SetBadIP 设置BadIP

func (*Service) SetBadWords

func (s *Service) SetBadWords(badwords *model.BadWords) error

SetBadWords 设置BadWords

type User

type User struct {
	ID       uint64 `json:"id"`
	Username string `json:"name"`
	Password string `json:"password"`
}

Jump to

Keyboard shortcuts

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