实现峰值带宽和平均带宽两种带宽算法

This commit is contained in:
GoEdgeLab
2023-02-27 10:47:31 +08:00
parent e84fc649f8
commit a46f13ccf4
14 changed files with 619 additions and 540 deletions

View File

@@ -1,23 +1,20 @@
package systemconfigs
import "github.com/TeaOSLab/EdgeCommon/pkg/userconfigs"
// AdminUIConfig 管理员界面相关配置
type AdminUIConfig struct {
ProductName string `json:"productName"` // 产品名
AdminSystemName string `json:"adminSystemName"` // 管理员系统名称
ShowOpenSourceInfo bool `json:"showOpenSourceInfo"` // 是否显示开源信息
ShowVersion bool `json:"showVersion"` // 是否显示版本号
Version string `json:"version"` // 显示的版本号
ShowFinance bool `json:"showFinance"` // 是否显示财务相关信息
FaviconFileId int64 `json:"faviconFileId"` // Favicon文件ID
LogoFileId int64 `json:"logoFileId"` // Logo文件ID
DefaultPageSize int `json:"defaultPageSize"` // 默认每页显示数
TimeZone string `json:"timeZone"` // 时区
Modules []userconfigs.UserModule `json:"modules"` // 开通模块
ProductName string `json:"productName"` // 产品名
AdminSystemName string `json:"adminSystemName"` // 管理员系统名称
ShowOpenSourceInfo bool `json:"showOpenSourceInfo"` // 是否显示开源信息
ShowVersion bool `json:"showVersion"` // 是否显示版本号
Version string `json:"version"` // 显示的版本号
ShowFinance bool `json:"showFinance"` // 是否显示财务相关信息
FaviconFileId int64 `json:"faviconFileId"` // Favicon文件ID
LogoFileId int64 `json:"logoFileId"` // Logo文件ID
DefaultPageSize int `json:"defaultPageSize"` // 默认每页显示数
TimeZone string `json:"timeZone"` // 时区
Modules []string `json:"modules"` // 开通模块
}
func (this *AdminUIConfig) ContainsModule(module string) bool {
if len(this.Modules) == 0 {
return true
@@ -28,4 +25,4 @@ func (this *AdminUIConfig) ContainsModule(module string) bool {
}
}
return false
}
}

View File

@@ -8,3 +8,10 @@ const (
BandwidthUnitByte BandwidthUnit = "byte"
BandwidthUnitBit BandwidthUnit = "bit"
)
type BandwidthAlgo = string // 带宽算法
const (
BandwidthAlgoSecondly BandwidthAlgo = "secondly" // 按秒算
BandwidthAlgoAvg BandwidthAlgo = "avg" // N分钟平均
)

View File

@@ -25,8 +25,9 @@ type UserUIConfig struct {
ShowBandwidthCharts bool `json:"showBandwidthCharts"` // 是否显示带宽相关图表和数据
TrafficStats struct {
BandwidthPercentile int32 `json:"bandwidthPercentile"` // 带宽百分位
DefaultBandwidthDateRange string `json:"defaultBandwidthDateRange"` // 默认带宽周期
BandwidthPercentile int32 `json:"bandwidthPercentile"` // 带宽百分位
DefaultBandwidthDateRange string `json:"defaultBandwidthDateRange"` // 默认带宽周期
BandwidthAlgo BandwidthAlgo `json:"bandwidthAlgo"` // 带宽算法
} `json:"trafficStats"` // 流量统计相关设置
}