stats

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: BSD-3-Clause Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SharedBandwidthStatManager = NewBandwidthStatManager()
View Source
var SharedHTTPRequestStatManager = NewHTTPRequestStatManager()
View Source
var SharedTrafficStatManager = NewTrafficStatManager()
View Source
var SharedUserAgentParser = NewUserAgentParser()

Functions

This section is empty.

Types

type BandwidthStat added in v0.4.9

type BandwidthStat struct {
	Day      string `json:"day"`
	TimeAt   string `json:"timeAt"`
	UserId   int64  `json:"userId"`
	ServerId int64  `json:"serverId"`

	CurrentBytes     int64 `json:"currentBytes"`
	CurrentTimestamp int64 `json:"currentTimestamp"`
	MaxBytes         int64 `json:"maxBytes"`
	TotalBytes       int64 `json:"totalBytes"`

	CachedBytes         int64 `json:"cachedBytes"`
	AttackBytes         int64 `json:"attackBytes"`
	CountRequests       int64 `json:"countRequests"`
	CountCachedRequests int64 `json:"countCachedRequests"`
	CountAttackRequests int64 `json:"countAttackRequests"`
}

type BandwidthStatManager added in v0.4.9

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

BandwidthStatManager 服务带宽统计

func NewBandwidthStatManager added in v0.4.9

func NewBandwidthStatManager() *BandwidthStatManager

func (*BandwidthStatManager) AddBandwidth added in v1.0.0

func (this *BandwidthStatManager) AddBandwidth(userId int64, serverId int64, peekBytes int64, totalBytes int64)

AddBandwidth 添加带宽数据

func (*BandwidthStatManager) AddTraffic added in v1.0.0

func (this *BandwidthStatManager) AddTraffic(serverId int64, cachedBytes int64, countRequests int64, countCachedRequests int64, countAttacks int64, attackBytes int64)

AddTraffic 添加请求数据

func (*BandwidthStatManager) Cancel added in v1.0.0

func (this *BandwidthStatManager) Cancel()

Cancel 取消上传

func (*BandwidthStatManager) Inspect added in v0.4.9

func (this *BandwidthStatManager) Inspect()

func (*BandwidthStatManager) Loop added in v0.4.9

func (this *BandwidthStatManager) Loop() error

func (*BandwidthStatManager) Map added in v0.5.2

func (this *BandwidthStatManager) Map() map[int64]int64

func (*BandwidthStatManager) Save added in v1.0.0

func (this *BandwidthStatManager) Save() error

Save 保存到本地磁盘

func (*BandwidthStatManager) Start added in v0.4.9

func (this *BandwidthStatManager) Start()

type HTTPRequestStatManager

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

HTTPRequestStatManager HTTP请求相关的统计 这里的统计是一个辅助统计,注意不要因为统计而影响服务工作性能

func NewHTTPRequestStatManager

func NewHTTPRequestStatManager() *HTTPRequestStatManager

NewHTTPRequestStatManager 获取新对象

func (*HTTPRequestStatManager) AddFirewallRuleGroupId

func (this *HTTPRequestStatManager) AddFirewallRuleGroupId(serverId int64, firewallRuleGroupId int64, actions []*waf.ActionConfig)

AddFirewallRuleGroupId 添加防火墙拦截动作

func (*HTTPRequestStatManager) AddRemoteAddr

func (this *HTTPRequestStatManager) AddRemoteAddr(serverId int64, remoteAddr string, bytes int64, isAttack bool)

AddRemoteAddr 添加客户端地址

func (*HTTPRequestStatManager) AddUserAgent

func (this *HTTPRequestStatManager) AddUserAgent(serverId int64, userAgent string, ip string)

AddUserAgent 添加UserAgent

func (*HTTPRequestStatManager) Loop

func (this *HTTPRequestStatManager) Loop() error

Loop 单个循环

func (*HTTPRequestStatManager) Start

func (this *HTTPRequestStatManager) Start()

Start 启动

func (*HTTPRequestStatManager) Upload

func (this *HTTPRequestStatManager) Upload() error

Upload 上传数据

type StatItem

type StatItem struct {
	Bytes               int64
	CountRequests       int64
	CountAttackRequests int64
	AttackBytes         int64
}

type TrafficItem

type TrafficItem struct {
	UserId               int64
	Bytes                int64
	CachedBytes          int64
	CountRequests        int64
	CountCachedRequests  int64
	CountAttackRequests  int64
	AttackBytes          int64
	PlanId               int64
	CheckingTrafficLimit bool
}

func (*TrafficItem) Add added in v0.5.6

func (this *TrafficItem) Add(anotherItem *TrafficItem)

type TrafficStatManager

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

TrafficStatManager 区域流量统计

func NewTrafficStatManager

func NewTrafficStatManager() *TrafficStatManager

NewTrafficStatManager 获取新对象

func (*TrafficStatManager) Add

func (this *TrafficStatManager) Add(userId int64, serverId int64, domain string, bytes int64, cachedBytes int64, countRequests int64, countCachedRequests int64, countAttacks int64, attackBytes int64, checkingTrafficLimit bool, planId int64)

Add 添加流量

func (*TrafficStatManager) Start

func (this *TrafficStatManager) Start()

Start 启动自动任务

func (*TrafficStatManager) Upload

func (this *TrafficStatManager) Upload() error

Upload 上传流量

type UserAgentParser

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

UserAgentParser UserAgent解析器

func NewUserAgentParser

func NewUserAgentParser() *UserAgentParser

func (*UserAgentParser) Parse

func (this *UserAgentParser) Parse(userAgent string) (result UserAgentParserResult)

type UserAgentParserResult

type UserAgentParserResult struct {
	OS             useragent.OSInfo
	BrowserName    string
	BrowserVersion string
	IsMobile       bool
}

Jump to

Keyboard shortcuts

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