routine

package
v0.0.0-...-52087c1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MONITOR_IP_FREQUENT          = 0x0
	MONITOR_REQUEST              = 0x1
	MONITOR_TRAINING             = 0x2
	MONITOR_RANK                 = 0x3
	MONITOR_MEMCACHE             = 0x4
	MONITOR_DOCKER_FREQUENT      = 0x5
	MONITOR_GAMING               = 0x6
	MONITOR_TRAIN_USER_TAG       = 0x6
	MONITOR_TRADE_CHARGE         = 0x7
	MONITOR_TMPFILE              = 0x8
	MONITOR_VM                   = 0x9
	MONITOR_AWD_STATUS_REFRESHER = 0xA
	MONITOR_USER_LIVING          = 0xB // use to monitor how many users are living
	MONITOR_SCHEDULE_INTERVAL    = 30
)

Variables

This section is empty.

Functions

func AppendMonitor

func AppendMonitor(monitor *Monitor)

func StopMonitor

func StopMonitor(code int)

func TryFrequentIp

func TryFrequentIp(ip int) bool

Types

type FrequentIpListener

type FrequentIpListener struct {
	Map           map[int]*FrequentIpListenerChunk //ip监控池
	MaxTimes      int
	LaunchTimes   int //监控器被调度次数
	ClearInterval int //多少次调度后清除数据
}

func (*FrequentIpListener) CheckAvaliable

func (f *FrequentIpListener) CheckAvaliable(ip int) bool

func (*FrequentIpListener) Clear

func (f *FrequentIpListener) Clear()

func (*FrequentIpListener) Increase

func (f *FrequentIpListener) Increase(ip int)

type FrequentIpListenerChunk

type FrequentIpListenerChunk struct {
	Counter   int
	Threshold int
	Detail    map[int]*FrequentIpListenerChunkDetail
}

ip监控结构

type FrequentIpListenerChunkDetail

type FrequentIpListenerChunkDetail struct {
	CauseFault bool //触发风控
	Counter    int  //计数器
}

type Monitor

type Monitor struct {
	Type             int
	RefreshInterval  int
	RefreshRemainder int
	Name             string
	Handler          interface{}
	RefreshHandler   func(interface{})
	InitHandler      func(interface{})
}

监听器

Jump to

Keyboard shortcuts

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