models

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: BSD-3-Clause Imports: 65 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ADNetworkStateEnabled  = 1 // 已启用
	ADNetworkStateDisabled = 0 // 已禁用
)
View Source
const (
	ADPackageStateEnabled  = 1 // 已启用
	ADPackageStateDisabled = 0 // 已禁用
)
View Source
const (
	ADPackageInstanceStateEnabled  = 1 // 已启用
	ADPackageInstanceStateDisabled = 0 // 已禁用
)
View Source
const (
	ADPackagePeriodStateEnabled  = 1 // 已启用
	ADPackagePeriodStateDisabled = 0 // 已禁用
)
View Source
const (
	AdminStateEnabled  = 1 // 已启用
	AdminStateDisabled = 0 // 已禁用
)
View Source
const (
	AdminField_Id        dbs.FieldName = "id"        // ID
	AdminField_IsOn      dbs.FieldName = "isOn"      // 是否启用
	AdminField_Username  dbs.FieldName = "username"  // 用户名
	AdminField_Password  dbs.FieldName = "password"  // 密码
	AdminField_Fullname  dbs.FieldName = "fullname"  // 全名
	AdminField_IsSuper   dbs.FieldName = "isSuper"   // 是否为超级管理员
	AdminField_CreatedAt dbs.FieldName = "createdAt" // 创建时间
	AdminField_UpdatedAt dbs.FieldName = "updatedAt" // 修改时间
	AdminField_State     dbs.FieldName = "state"     // 状态
	AdminField_Modules   dbs.FieldName = "modules"   // 允许的模块
	AdminField_CanLogin  dbs.FieldName = "canLogin"  // 是否可以登录
	AdminField_Theme     dbs.FieldName = "theme"     // 模板设置
	AdminField_Lang      dbs.FieldName = "lang"      // 语言代号
)
View Source
const (
	APINodeStateEnabled  = 1 // 已启用
	APINodeStateDisabled = 0 // 已禁用
)
View Source
const (
	ApiTokenStateEnabled  = 1 // 已启用
	ApiTokenStateDisabled = 0 // 已禁用
)
View Source
const (
	DBNodeStateEnabled  = 1 // 已启用
	DBNodeStateDisabled = 0 // 已禁用
)
View Source
const (
	FileStateEnabled  = 1 // 已启用
	FileStateDisabled = 0 // 已禁用
)
View Source
const (
	FormalClientBrowserStateEnabled  = 1 // 已启用
	FormalClientBrowserStateDisabled = 0 // 已禁用
)
View Source
const (
	FormalClientSystemStateEnabled  = 1 // 已启用
	FormalClientSystemStateDisabled = 0 // 已禁用
)
View Source
const (
	HTTPAccessLogPolicyStateEnabled  = 1 // 已启用
	HTTPAccessLogPolicyStateDisabled = 0 // 已禁用
)
View Source
const (
	HTTPAccessLogPolicyField_Id               dbs.FieldName = "id"               // ID
	HTTPAccessLogPolicyField_TemplateId       dbs.FieldName = "templateId"       // 模版ID
	HTTPAccessLogPolicyField_AdminId          dbs.FieldName = "adminId"          // 管理员ID
	HTTPAccessLogPolicyField_UserId           dbs.FieldName = "userId"           // 用户ID
	HTTPAccessLogPolicyField_State            dbs.FieldName = "state"            // 状态
	HTTPAccessLogPolicyField_CreatedAt        dbs.FieldName = "createdAt"        // 创建时间
	HTTPAccessLogPolicyField_Name             dbs.FieldName = "name"             // 名称
	HTTPAccessLogPolicyField_IsOn             dbs.FieldName = "isOn"             // 是否启用
	HTTPAccessLogPolicyField_Type             dbs.FieldName = "type"             // 存储类型
	HTTPAccessLogPolicyField_Options          dbs.FieldName = "options"          // 存储选项
	HTTPAccessLogPolicyField_Conds            dbs.FieldName = "conds"            // 请求条件
	HTTPAccessLogPolicyField_IsPublic         dbs.FieldName = "isPublic"         // 是否为公用
	HTTPAccessLogPolicyField_FirewallOnly     dbs.FieldName = "firewallOnly"     // 是否只记录防火墙相关
	HTTPAccessLogPolicyField_Version          dbs.FieldName = "version"          // 版本号
	HTTPAccessLogPolicyField_DisableDefaultDB dbs.FieldName = "disableDefaultDB" // 是否停止默认数据库存储
)
View Source
const (
	HTTPAuthPolicyStateEnabled  = 1 // 已启用
	HTTPAuthPolicyStateDisabled = 0 // 已禁用
)
View Source
const (
	HTTPBrotliPolicyStateEnabled  = 1 // 已启用
	HTTPBrotliPolicyStateDisabled = 0 // 已禁用
)
View Source
const (
	HTTPCachePolicyStateEnabled  = 1 // 已启用
	HTTPCachePolicyStateDisabled = 0 // 已禁用
)
View Source
const (
	HTTPCachePolicyField_Id                   dbs.FieldName = "id"                   // ID
	HTTPCachePolicyField_AdminId              dbs.FieldName = "adminId"              // 管理员ID
	HTTPCachePolicyField_UserId               dbs.FieldName = "userId"               // 用户ID
	HTTPCachePolicyField_TemplateId           dbs.FieldName = "templateId"           // 模版ID
	HTTPCachePolicyField_IsOn                 dbs.FieldName = "isOn"                 // 是否启用
	HTTPCachePolicyField_Name                 dbs.FieldName = "name"                 // 名称
	HTTPCachePolicyField_Capacity             dbs.FieldName = "capacity"             // 容量数据
	HTTPCachePolicyField_MaxKeys              dbs.FieldName = "maxKeys"              // 最多Key值
	HTTPCachePolicyField_MaxSize              dbs.FieldName = "maxSize"              // 最大缓存内容尺寸
	HTTPCachePolicyField_Type                 dbs.FieldName = "type"                 // 存储类型
	HTTPCachePolicyField_Options              dbs.FieldName = "options"              // 存储选项
	HTTPCachePolicyField_CreatedAt            dbs.FieldName = "createdAt"            // 创建时间
	HTTPCachePolicyField_State                dbs.FieldName = "state"                // 状态
	HTTPCachePolicyField_Description          dbs.FieldName = "description"          // 描述
	HTTPCachePolicyField_Refs                 dbs.FieldName = "refs"                 // 默认的缓存设置
	HTTPCachePolicyField_SyncCompressionCache dbs.FieldName = "syncCompressionCache" // 是否同步写入压缩缓存
	HTTPCachePolicyField_FetchTimeout         dbs.FieldName = "fetchTimeout"         // 预热超时时间
)
View Source
const (
	HTTPCacheTaskStateEnabled  = 1 // 已启用
	HTTPCacheTaskStateDisabled = 0 // 已禁用
)
View Source
const (
	HTTPDeflatePolicyStateEnabled  = 1 // 已启用
	HTTPDeflatePolicyStateDisabled = 0 // 已禁用
)
View Source
const (
	HTTPFastcgiStateEnabled  = 1 // 已启用
	HTTPFastcgiStateDisabled = 0 // 已禁用
)
View Source
const (
	HTTPFirewallPolicyStateEnabled  = 1 // 已启用
	HTTPFirewallPolicyStateDisabled = 0 // 已禁用
)
View Source
const (
	HTTPFirewallPolicyField_Id                 dbs.FieldName = "id"                 // ID
	HTTPFirewallPolicyField_TemplateId         dbs.FieldName = "templateId"         // 模版ID
	HTTPFirewallPolicyField_AdminId            dbs.FieldName = "adminId"            // 管理员ID
	HTTPFirewallPolicyField_UserId             dbs.FieldName = "userId"             // 用户ID
	HTTPFirewallPolicyField_ServerId           dbs.FieldName = "serverId"           // 服务ID
	HTTPFirewallPolicyField_GroupId            dbs.FieldName = "groupId"            // 服务分组ID
	HTTPFirewallPolicyField_State              dbs.FieldName = "state"              // 状态
	HTTPFirewallPolicyField_CreatedAt          dbs.FieldName = "createdAt"          // 创建时间
	HTTPFirewallPolicyField_IsOn               dbs.FieldName = "isOn"               // 是否启用
	HTTPFirewallPolicyField_Name               dbs.FieldName = "name"               // 名称
	HTTPFirewallPolicyField_Description        dbs.FieldName = "description"        // 描述
	HTTPFirewallPolicyField_Inbound            dbs.FieldName = "inbound"            // 入站规则
	HTTPFirewallPolicyField_Outbound           dbs.FieldName = "outbound"           // 出站规则
	HTTPFirewallPolicyField_BlockOptions       dbs.FieldName = "blockOptions"       // BLOCK选项
	HTTPFirewallPolicyField_CaptchaOptions     dbs.FieldName = "captchaOptions"     // 验证码选项
	HTTPFirewallPolicyField_Mode               dbs.FieldName = "mode"               // 模式
	HTTPFirewallPolicyField_UseLocalFirewall   dbs.FieldName = "useLocalFirewall"   // 是否自动使用本地防火墙
	HTTPFirewallPolicyField_SynFlood           dbs.FieldName = "synFlood"           // SynFlood防御设置
	HTTPFirewallPolicyField_Log                dbs.FieldName = "log"                // 日志配置
	HTTPFirewallPolicyField_MaxRequestBodySize dbs.FieldName = "maxRequestBodySize" // 可以检查的最大请求内容尺寸
	HTTPFirewallPolicyField_DenyCountryHTML    dbs.FieldName = "denyCountryHTML"    // 区域封禁提示
	HTTPFirewallPolicyField_DenyProvinceHTML   dbs.FieldName = "denyProvinceHTML"   // 省份封禁提示
)
View Source
const (
	HTTPFirewallRuleStateEnabled  = 1 // 已启用
	HTTPFirewallRuleStateDisabled = 0 // 已禁用
)
View Source
const (
	HTTPFirewallRuleGroupStateEnabled  = 1 // 已启用
	HTTPFirewallRuleGroupStateDisabled = 0 // 已禁用
)
View Source
const (
	HTTPFirewallRuleSetStateEnabled  = 1 // 已启用
	HTTPFirewallRuleSetStateDisabled = 0 // 已禁用
)
View Source
const (
	HTTPGzipStateEnabled  = 1 // 已启用
	HTTPGzipStateDisabled = 0 // 已禁用
)
View Source
const (
	HTTPHeaderStateEnabled  = 1 // 已启用
	HTTPHeaderStateDisabled = 0 // 已禁用
)
View Source
const (
	HTTPHeaderPolicyStateEnabled  = 1 // 已启用
	HTTPHeaderPolicyStateDisabled = 0 // 已禁用
)
View Source
const (
	HTTPLocationStateEnabled  = 1 // 已启用
	HTTPLocationStateDisabled = 0 // 已禁用
)
View Source
const (
	HTTPPageStateEnabled  = 1 // 已启用
	HTTPPageStateDisabled = 0 // 已禁用
)
View Source
const (
	HTTPPageField_Id                dbs.FieldName = "id"                // ID
	HTTPPageField_AdminId           dbs.FieldName = "adminId"           // 管理员ID
	HTTPPageField_UserId            dbs.FieldName = "userId"            // 用户ID
	HTTPPageField_IsOn              dbs.FieldName = "isOn"              // 是否启用
	HTTPPageField_StatusList        dbs.FieldName = "statusList"        // 状态列表
	HTTPPageField_Url               dbs.FieldName = "url"               // 页面URL
	HTTPPageField_NewStatus         dbs.FieldName = "newStatus"         // 新状态码
	HTTPPageField_State             dbs.FieldName = "state"             // 状态
	HTTPPageField_CreatedAt         dbs.FieldName = "createdAt"         // 创建时间
	HTTPPageField_Body              dbs.FieldName = "body"              // 页面内容
	HTTPPageField_BodyType          dbs.FieldName = "bodyType"          // 内容类型
	HTTPPageField_ExceptURLPatterns dbs.FieldName = "exceptURLPatterns" // 例外URL
	HTTPPageField_OnlyURLPatterns   dbs.FieldName = "onlyURLPatterns"   // 限制URL
)
View Source
const (
	HTTPRewriteRuleStateEnabled  = 1 // 已启用
	HTTPRewriteRuleStateDisabled = 0 // 已禁用
)
View Source
const (
	HTTPWebStateEnabled  = 1 // 已启用
	HTTPWebStateDisabled = 0 // 已禁用
)
View Source
const (
	HTTPWebField_Id                 dbs.FieldName = "id"                 // ID
	HTTPWebField_IsOn               dbs.FieldName = "isOn"               // 是否启用
	HTTPWebField_TemplateId         dbs.FieldName = "templateId"         // 模版ID
	HTTPWebField_AdminId            dbs.FieldName = "adminId"            // 管理员ID
	HTTPWebField_UserId             dbs.FieldName = "userId"             // 用户ID
	HTTPWebField_State              dbs.FieldName = "state"              // 状态
	HTTPWebField_CreatedAt          dbs.FieldName = "createdAt"          // 创建时间
	HTTPWebField_Root               dbs.FieldName = "root"               // 根目录
	HTTPWebField_Charset            dbs.FieldName = "charset"            // 字符集
	HTTPWebField_Shutdown           dbs.FieldName = "shutdown"           // 临时关闭页面配置
	HTTPWebField_Pages              dbs.FieldName = "pages"              // 特殊页面
	HTTPWebField_RedirectToHttps    dbs.FieldName = "redirectToHttps"    // 跳转到HTTPS设置
	HTTPWebField_Indexes            dbs.FieldName = "indexes"            // 首页文件列表
	HTTPWebField_MaxRequestBodySize dbs.FieldName = "maxRequestBodySize" // 最大允许的请求内容尺寸
	HTTPWebField_RequestHeader      dbs.FieldName = "requestHeader"      // 请求Header配置
	HTTPWebField_ResponseHeader     dbs.FieldName = "responseHeader"     // 响应Header配置
	HTTPWebField_AccessLog          dbs.FieldName = "accessLog"          // 访问日志配置
	HTTPWebField_Stat               dbs.FieldName = "stat"               // 统计配置
	HTTPWebField_Gzip               dbs.FieldName = "gzip"               // Gzip配置(v0.3.2弃用)
	HTTPWebField_Compression        dbs.FieldName = "compression"        // 压缩配置
	HTTPWebField_Cache              dbs.FieldName = "cache"              // 缓存配置
	HTTPWebField_Firewall           dbs.FieldName = "firewall"           // 防火墙设置
	HTTPWebField_Locations          dbs.FieldName = "locations"          // 路由规则配置
	HTTPWebField_Websocket          dbs.FieldName = "websocket"          // Websocket设置
	HTTPWebField_RewriteRules       dbs.FieldName = "rewriteRules"       // 重写规则配置
	HTTPWebField_HostRedirects      dbs.FieldName = "hostRedirects"      // 域名跳转
	HTTPWebField_Fastcgi            dbs.FieldName = "fastcgi"            // Fastcgi配置
	HTTPWebField_Auth               dbs.FieldName = "auth"               // 认证策略配置
	HTTPWebField_Webp               dbs.FieldName = "webp"               // WebP配置
	HTTPWebField_RemoteAddr         dbs.FieldName = "remoteAddr"         // 客户端IP配置
	HTTPWebField_MergeSlashes       dbs.FieldName = "mergeSlashes"       // 是否合并路径中的斜杠
	HTTPWebField_RequestLimit       dbs.FieldName = "requestLimit"       // 请求限制
	HTTPWebField_RequestScripts     dbs.FieldName = "requestScripts"     // 请求脚本
	HTTPWebField_Uam                dbs.FieldName = "uam"                // UAM设置
	HTTPWebField_Cc                 dbs.FieldName = "cc"                 // CC设置
	HTTPWebField_Referers           dbs.FieldName = "referers"           // 防盗链设置
	HTTPWebField_UserAgent          dbs.FieldName = "userAgent"          // UserAgent设置
	HTTPWebField_Optimization       dbs.FieldName = "optimization"       // 页面优化配置
)
View Source
const (
	HTTPWebsocketStateEnabled  = 1 // 已启用
	HTTPWebsocketStateDisabled = 0 // 已禁用
)
View Source
const (
	IPItemStateEnabled  = 1 // 已启用
	IPItemStateDisabled = 0 // 已禁用
)
View Source
const (
	IPLibraryArtifactStateEnabled  = 1 // 已启用
	IPLibraryArtifactStateDisabled = 0 // 已禁用
)
View Source
const (
	IPLibraryStateEnabled  = 1 // 已启用
	IPLibraryStateDisabled = 0 // 已禁用
)
View Source
const (
	IPLibraryFileStateEnabled  = 1 // 已启用
	IPLibraryFileStateDisabled = 0 // 已禁用
)
View Source
const (
	IPListStateEnabled  = 1 // 已启用
	IPListStateDisabled = 0 // 已禁用
)
View Source
const (
	LogField_Id              dbs.FieldName = "id"              // ID
	LogField_Level           dbs.FieldName = "level"           // 级别
	LogField_Description     dbs.FieldName = "description"     // 描述
	LogField_CreatedAt       dbs.FieldName = "createdAt"       // 创建时间
	LogField_Action          dbs.FieldName = "action"          // 动作
	LogField_UserId          dbs.FieldName = "userId"          // 用户ID
	LogField_AdminId         dbs.FieldName = "adminId"         // 管理员ID
	LogField_ProviderId      dbs.FieldName = "providerId"      // 供应商ID
	LogField_Ip              dbs.FieldName = "ip"              // IP地址
	LogField_Type            dbs.FieldName = "type"            // 类型:admin, user
	LogField_Day             dbs.FieldName = "day"             // 日期
	LogField_BillId          dbs.FieldName = "billId"          // 账单ID
	LogField_LangMessageCode dbs.FieldName = "langMessageCode" // 多语言消息代号
	LogField_LangMessageArgs dbs.FieldName = "langMessageArgs" // 多语言参数
	LogField_Params          dbs.FieldName = "params"          // 关联对象参数
)
View Source
const (
	LoginStateEnabled  = 1 // 已启用
	LoginStateDisabled = 0 // 已禁用
)
View Source
const (
	MessageStateEnabled  = 1 // 已启用
	MessageStateDisabled = 0 // 已禁用

	MessageLevelInfo    = "info"
	MessageLevelWarning = "warning"
	MessageLevelError   = "error"
	MessageLevelSuccess = "success"
)
View Source
const (
	MessageMediaStateEnabled  = 1 // 已启用
	MessageMediaStateDisabled = 0 // 已禁用
)
View Source
const (
	MessageMediaInstanceStateEnabled  = 1 // 已启用
	MessageMediaInstanceStateDisabled = 0 // 已禁用
)
View Source
const (
	MessageReceiverStateEnabled  = 1 // 已启用
	MessageReceiverStateDisabled = 0 // 已禁用
)
View Source
const (
	MessageRecipientStateEnabled  = 1 // 已启用
	MessageRecipientStateDisabled = 0 // 已禁用
)
View Source
const (
	MessageRecipientGroupStateEnabled  = 1 // 已启用
	MessageRecipientGroupStateDisabled = 0 // 已禁用
)
View Source
const (
	MessageTaskStateEnabled  = 1 // 已启用
	MessageTaskStateDisabled = 0 // 已禁用
)
View Source
const (
	MetricChartStateEnabled  = 1 // 已启用
	MetricChartStateDisabled = 0 // 已禁用
)
View Source
const (
	MetricItemStateEnabled  = 1 // 已启用
	MetricItemStateDisabled = 0 // 已禁用
)
View Source
const (
	NodeActionStateEnabled  = 1 // 已启用
	NodeActionStateDisabled = 0 // 已禁用
)
View Source
const (
	NodeClusterStateEnabled  = 1 // 已启用
	NodeClusterStateDisabled = 0 // 已禁用
)
View Source
const (
	NodeClusterFirewallActionStateEnabled  = 1 // 已启用
	NodeClusterFirewallActionStateDisabled = 0 // 已禁用
)
View Source
const (
	NodeClusterMetricItemStateEnabled  = 1 // 已启用
	NodeClusterMetricItemStateDisabled = 0 // 已禁用
)
View Source
const (
	NodeClusterField_Id                   dbs.FieldName = "id"                   // ID
	NodeClusterField_AdminId              dbs.FieldName = "adminId"              // 管理员ID
	NodeClusterField_UserId               dbs.FieldName = "userId"               // 用户ID
	NodeClusterField_IsOn                 dbs.FieldName = "isOn"                 // 是否启用
	NodeClusterField_Name                 dbs.FieldName = "name"                 // 名称
	NodeClusterField_UseAllAPINodes       dbs.FieldName = "useAllAPINodes"       // 是否使用所有API节点
	NodeClusterField_ApiNodes             dbs.FieldName = "apiNodes"             // 使用的API节点
	NodeClusterField_InstallDir           dbs.FieldName = "installDir"           // 安装目录
	NodeClusterField_Order                dbs.FieldName = "order"                // 排序
	NodeClusterField_CreatedAt            dbs.FieldName = "createdAt"            // 创建时间
	NodeClusterField_GrantId              dbs.FieldName = "grantId"              // 默认认证方式
	NodeClusterField_SshParams            dbs.FieldName = "sshParams"            // SSH默认参数
	NodeClusterField_State                dbs.FieldName = "state"                // 状态
	NodeClusterField_AutoRegister         dbs.FieldName = "autoRegister"         // 是否开启自动注册
	NodeClusterField_UniqueId             dbs.FieldName = "uniqueId"             // 唯一ID
	NodeClusterField_Secret               dbs.FieldName = "secret"               // 密钥
	NodeClusterField_HealthCheck          dbs.FieldName = "healthCheck"          // 健康检查
	NodeClusterField_DnsName              dbs.FieldName = "dnsName"              // DNS名称
	NodeClusterField_DnsDomainId          dbs.FieldName = "dnsDomainId"          // 域名ID
	NodeClusterField_Dns                  dbs.FieldName = "dns"                  // DNS配置
	NodeClusterField_Toa                  dbs.FieldName = "toa"                  // TOA配置
	NodeClusterField_CachePolicyId        dbs.FieldName = "cachePolicyId"        // 缓存策略ID
	NodeClusterField_HttpFirewallPolicyId dbs.FieldName = "httpFirewallPolicyId" // WAF策略ID
	NodeClusterField_AccessLog            dbs.FieldName = "accessLog"            // 访问日志设置
	NodeClusterField_SystemServices       dbs.FieldName = "systemServices"       // 系统服务设置
	NodeClusterField_TimeZone             dbs.FieldName = "timeZone"             // 时区
	NodeClusterField_NodeMaxThreads       dbs.FieldName = "nodeMaxThreads"       // 节点最大线程数
	NodeClusterField_DdosProtection       dbs.FieldName = "ddosProtection"       // DDoS防护设置
	NodeClusterField_AutoOpenPorts        dbs.FieldName = "autoOpenPorts"        // 是否自动尝试开放端口
	NodeClusterField_IsPinned             dbs.FieldName = "isPinned"             // 是否置顶
	NodeClusterField_Webp                 dbs.FieldName = "webp"                 // WebP设置
	NodeClusterField_Uam                  dbs.FieldName = "uam"                  // UAM设置
	NodeClusterField_Clock                dbs.FieldName = "clock"                // 时钟配置
	NodeClusterField_GlobalServerConfig   dbs.FieldName = "globalServerConfig"   // 全局服务配置
	NodeClusterField_AutoRemoteStart      dbs.FieldName = "autoRemoteStart"      // 自动远程启动
	NodeClusterField_AutoInstallNftables  dbs.FieldName = "autoInstallNftables"  // 自动安装nftables
	NodeClusterField_IsAD                 dbs.FieldName = "isAD"                 // 是否为高防集群
	NodeClusterField_HttpPages            dbs.FieldName = "httpPages"            // 自定义页面设置
	NodeClusterField_Cc                   dbs.FieldName = "cc"                   // CC设置
	NodeClusterField_Http3                dbs.FieldName = "http3"                // HTTP3设置
	NodeClusterField_AutoSystemTuning     dbs.FieldName = "autoSystemTuning"     // 是否自动调整系统参数
	NodeClusterField_NetworkSecurity      dbs.FieldName = "networkSecurity"      // 网络安全策略
)
View Source
const (
	NodeStateEnabled  = 1 // 已启用
	NodeStateDisabled = 0 // 已禁用
)
View Source
const (
	NodeGrantStateEnabled  = 1 // 已启用
	NodeGrantStateDisabled = 0 // 已禁用
)
View Source
const (
	NodeGroupStateEnabled  = 1 // 已启用
	NodeGroupStateDisabled = 0 // 已禁用
)
View Source
const (
	NodeIPAddressStateEnabled  = 1 // 已启用
	NodeIPAddressStateDisabled = 0 // 已禁用
)
View Source
const (
	NodeIPAddressThresholdStateEnabled  = 1 // 已启用
	NodeIPAddressThresholdStateDisabled = 0 // 已禁用
)
View Source
const (
	NodeLoginStateEnabled  = 1 // 已启用
	NodeLoginStateDisabled = 0 // 已禁用

	NodeLoginTypeSSH = "ssh"
)
View Source
const (
	NodeRegionStateEnabled  = 1 // 已启用
	NodeRegionStateDisabled = 0 // 已禁用
)
View Source
const (
	NodeThresholdStateEnabled  = 1 // 已启用
	NodeThresholdStateDisabled = 0 // 已禁用
)
View Source
const (
	LevelDebug   = "debug"
	LevelInfo    = "info"
	LevelWarning = "warning"
	LevelError   = "error"
	LevelSuccess = "success"

	LogTypeAdmin = "admin"
	LogTypeUser  = "user"
)
View Source
const (
	NSClusterStateEnabled  = 1 // 已启用
	NSClusterStateDisabled = 0 // 已禁用
)
View Source
const (
	NSNodeStateEnabled  = 1 // 已启用
	NSNodeStateDisabled = 0 // 已禁用
)
View Source
const (
	OriginStateEnabled  = 1 // 已启用
	OriginStateDisabled = 0 // 已禁用
)
View Source
const (
	PlanStateEnabled  = 1 // 已启用
	PlanStateDisabled = 0 // 已禁用
)
View Source
const (
	PlanField_Id                        dbs.FieldName = "id"                        // ID
	PlanField_IsOn                      dbs.FieldName = "isOn"                      // 是否启用
	PlanField_Name                      dbs.FieldName = "name"                      // 套餐名
	PlanField_ClusterId                 dbs.FieldName = "clusterId"                 // 集群ID
	PlanField_TrafficLimit              dbs.FieldName = "trafficLimit"              // 流量限制
	PlanField_Features                  dbs.FieldName = "features"                  // 允许的功能
	PlanField_TrafficPrice              dbs.FieldName = "trafficPrice"              // 流量价格设定
	PlanField_BandwidthPrice            dbs.FieldName = "bandwidthPrice"            // 带宽价格
	PlanField_MonthlyPrice              dbs.FieldName = "monthlyPrice"              // 月付
	PlanField_SeasonallyPrice           dbs.FieldName = "seasonallyPrice"           // 季付
	PlanField_YearlyPrice               dbs.FieldName = "yearlyPrice"               // 年付
	PlanField_PriceType                 dbs.FieldName = "priceType"                 // 价格类型
	PlanField_Order                     dbs.FieldName = "order"                     // 排序
	PlanField_State                     dbs.FieldName = "state"                     // 状态
	PlanField_TotalServers              dbs.FieldName = "totalServers"              // 可以绑定的网站数量
	PlanField_TotalServerNamesPerServer dbs.FieldName = "totalServerNamesPerServer" // 每个网站可以绑定的域名数量
	PlanField_TotalServerNames          dbs.FieldName = "totalServerNames"          // 总域名数量
	PlanField_MonthlyRequests           dbs.FieldName = "monthlyRequests"           // 每月访问量额度
	PlanField_DailyRequests             dbs.FieldName = "dailyRequests"             // 每日访问量额度
)
View Source
const (
	ProviderStateEnabled  = 1 // 已启用
	ProviderStateDisabled = 0 // 已禁用
)
View Source
const (
	ReportNodeStateEnabled  = 1 // 已启用
	ReportNodeStateDisabled = 0 // 已禁用
)
View Source
const (
	ReportNodeGroupStateEnabled  = 1 // 已启用
	ReportNodeGroupStateDisabled = 0 // 已禁用
)
View Source
const (
	ReverseProxyStateEnabled  = 1 // 已启用
	ReverseProxyStateDisabled = 0 // 已禁用
)
View Source
const (
	ReverseProxyField_Id                       dbs.FieldName = "id"                       // ID
	ReverseProxyField_AdminId                  dbs.FieldName = "adminId"                  // 管理员ID
	ReverseProxyField_UserId                   dbs.FieldName = "userId"                   // 用户ID
	ReverseProxyField_TemplateId               dbs.FieldName = "templateId"               // 模版ID
	ReverseProxyField_IsOn                     dbs.FieldName = "isOn"                     // 是否启用
	ReverseProxyField_Scheduling               dbs.FieldName = "scheduling"               // 调度算法
	ReverseProxyField_PrimaryOrigins           dbs.FieldName = "primaryOrigins"           // 主要源站
	ReverseProxyField_BackupOrigins            dbs.FieldName = "backupOrigins"            // 备用源站
	ReverseProxyField_StripPrefix              dbs.FieldName = "stripPrefix"              // 去除URL前缀
	ReverseProxyField_RequestHostType          dbs.FieldName = "requestHostType"          // 请求Host类型
	ReverseProxyField_RequestHost              dbs.FieldName = "requestHost"              // 请求Host
	ReverseProxyField_RequestHostExcludingPort dbs.FieldName = "requestHostExcludingPort" // 移除请求Host中的域名
	ReverseProxyField_RequestURI               dbs.FieldName = "requestURI"               // 请求URI
	ReverseProxyField_AutoFlush                dbs.FieldName = "autoFlush"                // 是否自动刷新缓冲区
	ReverseProxyField_AddHeaders               dbs.FieldName = "addHeaders"               // 自动添加的Header列表
	ReverseProxyField_State                    dbs.FieldName = "state"                    // 状态
	ReverseProxyField_CreatedAt                dbs.FieldName = "createdAt"                // 创建时间
	ReverseProxyField_ConnTimeout              dbs.FieldName = "connTimeout"              // 连接超时时间
	ReverseProxyField_ReadTimeout              dbs.FieldName = "readTimeout"              // 读取超时时间
	ReverseProxyField_IdleTimeout              dbs.FieldName = "idleTimeout"              // 空闲超时时间
	ReverseProxyField_MaxConns                 dbs.FieldName = "maxConns"                 // 最大并发连接数
	ReverseProxyField_MaxIdleConns             dbs.FieldName = "maxIdleConns"             // 最大空闲连接数
	ReverseProxyField_ProxyProtocol            dbs.FieldName = "proxyProtocol"            // Proxy Protocol配置
	ReverseProxyField_FollowRedirects          dbs.FieldName = "followRedirects"          // 回源跟随
	ReverseProxyField_Retry50X                 dbs.FieldName = "retry50X"                 // 启用50X重试
	ReverseProxyField_Retry40X                 dbs.FieldName = "retry40X"                 // 启用40X重试
)
View Source
const (
	ServerBandwidthStatField_Id                  dbs.FieldName = "id"                  // ID
	ServerBandwidthStatField_UserId              dbs.FieldName = "userId"              // 用户ID
	ServerBandwidthStatField_ServerId            dbs.FieldName = "serverId"            // 服务ID
	ServerBandwidthStatField_RegionId            dbs.FieldName = "regionId"            // 区域ID
	ServerBandwidthStatField_UserPlanId          dbs.FieldName = "userPlanId"          // 用户套餐ID
	ServerBandwidthStatField_Day                 dbs.FieldName = "day"                 // 日期YYYYMMDD
	ServerBandwidthStatField_TimeAt              dbs.FieldName = "timeAt"              // 时间点HHMM
	ServerBandwidthStatField_Bytes               dbs.FieldName = "bytes"               // 带宽字节
	ServerBandwidthStatField_AvgBytes            dbs.FieldName = "avgBytes"            // 平均流量
	ServerBandwidthStatField_CachedBytes         dbs.FieldName = "cachedBytes"         // 缓存的流量
	ServerBandwidthStatField_AttackBytes         dbs.FieldName = "attackBytes"         // 攻击流量
	ServerBandwidthStatField_CountRequests       dbs.FieldName = "countRequests"       // 请求数
	ServerBandwidthStatField_CountCachedRequests dbs.FieldName = "countCachedRequests" // 缓存的请求数
	ServerBandwidthStatField_CountAttackRequests dbs.FieldName = "countAttackRequests" // 攻击请求数
	ServerBandwidthStatField_TotalBytes          dbs.FieldName = "totalBytes"          // 总流量
)
View Source
const (
	ServerStateEnabled  = 1 // 已启用
	ServerStateDisabled = 0 // 已禁用
)
View Source
const (
	ServerGroupStateEnabled  = 1 // 已启用
	ServerGroupStateDisabled = 0 // 已禁用
)
View Source
const (
	ServerField_Id                  dbs.FieldName = "id"                  // ID
	ServerField_IsOn                dbs.FieldName = "isOn"                // 是否启用
	ServerField_UserId              dbs.FieldName = "userId"              // 用户ID
	ServerField_AdminId             dbs.FieldName = "adminId"             // 管理员ID
	ServerField_Type                dbs.FieldName = "type"                // 服务类型
	ServerField_Name                dbs.FieldName = "name"                // 名称
	ServerField_Description         dbs.FieldName = "description"         // 描述
	ServerField_PlainServerNames    dbs.FieldName = "plainServerNames"    // 扁平化域名列表
	ServerField_ServerNames         dbs.FieldName = "serverNames"         // 域名列表
	ServerField_AuditingAt          dbs.FieldName = "auditingAt"          // 审核提交时间
	ServerField_AuditingServerNames dbs.FieldName = "auditingServerNames" // 审核中的域名
	ServerField_IsAuditing          dbs.FieldName = "isAuditing"          // 是否正在审核
	ServerField_AuditingResult      dbs.FieldName = "auditingResult"      // 审核结果
	ServerField_Http                dbs.FieldName = "http"                // HTTP配置
	ServerField_Https               dbs.FieldName = "https"               // HTTPS配置
	ServerField_Tcp                 dbs.FieldName = "tcp"                 // TCP配置
	ServerField_Tls                 dbs.FieldName = "tls"                 // TLS配置
	ServerField_Unix                dbs.FieldName = "unix"                // Unix配置
	ServerField_Udp                 dbs.FieldName = "udp"                 // UDP配置
	ServerField_WebId               dbs.FieldName = "webId"               // WEB配置
	ServerField_ReverseProxy        dbs.FieldName = "reverseProxy"        // 反向代理配置
	ServerField_GroupIds            dbs.FieldName = "groupIds"            // 分组ID列表
	ServerField_Config              dbs.FieldName = "config"              // 服务配置,自动生成
	ServerField_ConfigMd5           dbs.FieldName = "configMd5"           // Md5
	ServerField_ClusterId           dbs.FieldName = "clusterId"           // 集群ID
	ServerField_IncludeNodes        dbs.FieldName = "includeNodes"        // 部署条件
	ServerField_ExcludeNodes        dbs.FieldName = "excludeNodes"        // 节点排除条件
	ServerField_Version             dbs.FieldName = "version"             // 版本号
	ServerField_CreatedAt           dbs.FieldName = "createdAt"           // 创建时间
	ServerField_State               dbs.FieldName = "state"               // 状态
	ServerField_DnsName             dbs.FieldName = "dnsName"             // DNS名称
	ServerField_TcpPorts            dbs.FieldName = "tcpPorts"            // 所包含TCP端口
	ServerField_UdpPorts            dbs.FieldName = "udpPorts"            // 所包含UDP端口
	ServerField_SupportCNAME        dbs.FieldName = "supportCNAME"        // 允许CNAME不在域名名单
	ServerField_TrafficLimit        dbs.FieldName = "trafficLimit"        // 流量限制
	ServerField_TrafficDay          dbs.FieldName = "trafficDay"          // YYYYMMDD
	ServerField_TrafficMonth        dbs.FieldName = "trafficMonth"        // YYYYMM
	ServerField_TotalDailyTraffic   dbs.FieldName = "totalDailyTraffic"   // 日流量
	ServerField_TotalMonthlyTraffic dbs.FieldName = "totalMonthlyTraffic" // 月流量
	ServerField_TrafficLimitStatus  dbs.FieldName = "trafficLimitStatus"  // 流量限制状态
	ServerField_TotalTraffic        dbs.FieldName = "totalTraffic"        // 总流量
	ServerField_UserPlanId          dbs.FieldName = "userPlanId"          // 所属套餐ID
	ServerField_LastUserPlanId      dbs.FieldName = "lastUserPlanId"      // 上一次使用的套餐
	ServerField_Uam                 dbs.FieldName = "uam"                 // UAM设置
	ServerField_BandwidthTime       dbs.FieldName = "bandwidthTime"       // 带宽更新时间,YYYYMMDDHHII
	ServerField_BandwidthBytes      dbs.FieldName = "bandwidthBytes"      // 最近带宽峰值
	ServerField_CountAttackRequests dbs.FieldName = "countAttackRequests" // 最近攻击请求数
	ServerField_CountRequests       dbs.FieldName = "countRequests"       // 最近总请求数
)
View Source
const (
	ServerStatBoardChartStateEnabled  = 1 // 已启用
	ServerStatBoardChartStateDisabled = 0 // 已禁用
)
View Source
const (
	ServerStatBoardStateEnabled  = 1 // 已启用
	ServerStatBoardStateDisabled = 0 // 已禁用
)
View Source
const (
	SSLCertStateEnabled  = 1 // 已启用
	SSLCertStateDisabled = 0 // 已禁用
)
View Source
const (
	SSLCertGroupStateEnabled  = 1 // 已启用
	SSLCertGroupStateDisabled = 0 // 已禁用
)
View Source
const (
	SSLPolicyStateEnabled  = 1 // 已启用
	SSLPolicyStateDisabled = 0 // 已禁用
)
View Source
const (
	SubUserStateEnabled  = 1 // 已启用
	SubUserStateDisabled = 0 // 已禁用
)
View Source
const (
	TrafficPackageStateEnabled  = 1 // 已启用
	TrafficPackageStateDisabled = 0 // 已禁用
)
View Source
const (
	TrafficPackagePeriodStateEnabled  = 1 // 已启用
	TrafficPackagePeriodStateDisabled = 0 // 已禁用
)
View Source
const (
	UserAccessKeyStateEnabled  = 1 // 已启用
	UserAccessKeyStateDisabled = 0 // 已禁用
)
View Source
const (
	UserADInstanceStateEnabled  = 1 // 已启用
	UserADInstanceStateDisabled = 0 // 已禁用
)
View Source
const (
	UserStateEnabled  = 1 // 已启用
	UserStateDisabled = 0 // 已禁用
)
View Source
const (
	UserIdentityStateEnabled  = 1 // 已启用
	UserIdentityStateDisabled = 0 // 已禁用
)
View Source
const (
	UserMobileVerificationField_Id         dbs.FieldName = "id"         // ID
	UserMobileVerificationField_Mobile     dbs.FieldName = "mobile"     // 手机号码
	UserMobileVerificationField_UserId     dbs.FieldName = "userId"     // 用户ID
	UserMobileVerificationField_Code       dbs.FieldName = "code"       // 激活码
	UserMobileVerificationField_CreatedAt  dbs.FieldName = "createdAt"  // 创建时间
	UserMobileVerificationField_IsSent     dbs.FieldName = "isSent"     // 是否已发送
	UserMobileVerificationField_IsVerified dbs.FieldName = "isVerified" // 是否已激活
	UserMobileVerificationField_Day        dbs.FieldName = "day"        // YYYYMMDD
)
View Source
const (
	UserField_Id                dbs.FieldName = "id"                // ID
	UserField_IsOn              dbs.FieldName = "isOn"              // 是否启用
	UserField_Username          dbs.FieldName = "username"          // 用户名
	UserField_Password          dbs.FieldName = "password"          // 密码
	UserField_Fullname          dbs.FieldName = "fullname"          // 真实姓名
	UserField_Mobile            dbs.FieldName = "mobile"            // 手机号
	UserField_VerifiedMobile    dbs.FieldName = "verifiedMobile"    // 已验证手机号
	UserField_MobileIsVerified  dbs.FieldName = "mobileIsVerified"  // 手机号是否已验证
	UserField_Tel               dbs.FieldName = "tel"               // 联系电话
	UserField_Remark            dbs.FieldName = "remark"            // 备注
	UserField_Email             dbs.FieldName = "email"             // 邮箱地址
	UserField_VerifiedEmail     dbs.FieldName = "verifiedEmail"     // 激活后的邮箱
	UserField_EmailIsVerified   dbs.FieldName = "emailIsVerified"   // 邮箱是否已验证
	UserField_AvatarFileId      dbs.FieldName = "avatarFileId"      // 头像文件ID
	UserField_CreatedAt         dbs.FieldName = "createdAt"         // 创建时间
	UserField_Day               dbs.FieldName = "day"               // YYYYMMDD
	UserField_UpdatedAt         dbs.FieldName = "updatedAt"         // 修改时间
	UserField_State             dbs.FieldName = "state"             // 状态
	UserField_Source            dbs.FieldName = "source"            // 来源
	UserField_ClusterId         dbs.FieldName = "clusterId"         // 集群ID
	UserField_Features          dbs.FieldName = "features"          // 允许操作的特征
	UserField_RegisteredIP      dbs.FieldName = "registeredIP"      // 注册使用的IP
	UserField_IsRejected        dbs.FieldName = "isRejected"        // 是否已拒绝
	UserField_RejectReason      dbs.FieldName = "rejectReason"      // 拒绝理由
	UserField_IsVerified        dbs.FieldName = "isVerified"        // 是否验证通过
	UserField_RequirePlans      dbs.FieldName = "requirePlans"      // 是否需要购买套餐
	UserField_Modules           dbs.FieldName = "modules"           // 用户模块
	UserField_PriceType         dbs.FieldName = "priceType"         // 计费类型:traffic|bandwidth
	UserField_PricePeriod       dbs.FieldName = "pricePeriod"       // 结算周期
	UserField_ServersEnabled    dbs.FieldName = "serversEnabled"    // 是否禁用所有服务
	UserField_Notification      dbs.FieldName = "notification"      // 通知设置
	UserField_BandwidthAlgo     dbs.FieldName = "bandwidthAlgo"     // 带宽算法
	UserField_BandwidthModifier dbs.FieldName = "bandwidthModifier" // 带宽修正值
	UserField_Lang              dbs.FieldName = "lang"              // 语言代号
)
View Source
const (
	UserNodeStateEnabled  = 1 // 已启用
	UserNodeStateDisabled = 0 // 已禁用
)
View Source
const (
	UserPlanBandwidthStatField_Id                  dbs.FieldName = "id"                  // ID
	UserPlanBandwidthStatField_UserId              dbs.FieldName = "userId"              // 用户ID
	UserPlanBandwidthStatField_UserPlanId          dbs.FieldName = "userPlanId"          // 用户套餐ID
	UserPlanBandwidthStatField_Day                 dbs.FieldName = "day"                 // 日期YYYYMMDD
	UserPlanBandwidthStatField_TimeAt              dbs.FieldName = "timeAt"              // 时间点HHII
	UserPlanBandwidthStatField_Bytes               dbs.FieldName = "bytes"               // 带宽
	UserPlanBandwidthStatField_RegionId            dbs.FieldName = "regionId"            // 区域ID
	UserPlanBandwidthStatField_TotalBytes          dbs.FieldName = "totalBytes"          // 总流量
	UserPlanBandwidthStatField_AvgBytes            dbs.FieldName = "avgBytes"            // 平均流量
	UserPlanBandwidthStatField_CachedBytes         dbs.FieldName = "cachedBytes"         // 缓存的流量
	UserPlanBandwidthStatField_AttackBytes         dbs.FieldName = "attackBytes"         // 攻击流量
	UserPlanBandwidthStatField_CountRequests       dbs.FieldName = "countRequests"       // 请求数
	UserPlanBandwidthStatField_CountCachedRequests dbs.FieldName = "countCachedRequests" // 缓存的请求数
	UserPlanBandwidthStatField_CountAttackRequests dbs.FieldName = "countAttackRequests" // 攻击请求数
)
View Source
const (
	UserPlanStateEnabled  = 1 // 已启用
	UserPlanStateDisabled = 0 // 已禁用

	DefaultUserPlanMaxDay = "3000-01-01"
)
View Source
const (
	UserPlanStatField_Id            dbs.FieldName = "id"            // ID
	UserPlanStatField_UserPlanId    dbs.FieldName = "userPlanId"    // 用户套餐ID
	UserPlanStatField_Date          dbs.FieldName = "date"          // 日期:YYYYMMDD或YYYYMM
	UserPlanStatField_DateType      dbs.FieldName = "dateType"      // 日期类型:day|month
	UserPlanStatField_TrafficBytes  dbs.FieldName = "trafficBytes"  // 流量
	UserPlanStatField_CountRequests dbs.FieldName = "countRequests" // 总请求数
	UserPlanStatField_IsProcessed   dbs.FieldName = "isProcessed"   // 是否已处理
)
View Source
const (
	UserTrafficPackageStateEnabled  = 1 // 已启用
	UserTrafficPackageStateDisabled = 0 // 已禁用
)
View Source
const DBNodePasswordEncodedPrefix = "EDGE_ENCODED:"
View Source
const MetricStatTablePartials = 20 // 表格Partial数量
View Source
const MetricSumStatTablePartials = 20 // 表格Partial数量
View Source
const (
	ModelServerNameMaxLength = 60
)
View Source
const (
	ServerBandwidthStatTablePartitions = 20 // 分表数量
)
View Source
const (
	UserBandwidthStatTablePartials = 20
)
View Source
const (
	UserPlanBandwidthStatTablePartitions = 20 // 分表数量
)

Variables

View Source
var DefaultGlobalIPList = &IPList{
	Id:       uint32(firewallconfigs.GlobalListId),
	Name:     "全局封锁名单",
	IsPublic: true,
	IsGlobal: true,
	Type:     "black",
	State:    IPListStateEnabled,
	IsOn:     true,
}
View Source
var ErrNotFound = errors.New("resource not found")
View Source
var SharedCacheLocker = sync.RWMutex{}

SharedCacheLocker 缓存专用Locker

View Source
var SharedHTTPAccessLogManager = NewHTTPAccessLogManager()

Functions

func AccessLogQueuePercent added in v0.5.6

func AccessLogQueuePercent() int

func AllAccessLogDBs

func AllAccessLogDBs() []*dbs.DB

func CheckSQLDuplicateErr added in v0.6.0

func CheckSQLDuplicateErr(err error) bool

CheckSQLDuplicateErr 检查Duplicate错误

func CheckSQLErrCode

func CheckSQLErrCode(err error, code uint16) bool

CheckSQLErrCode 检查数据库错误代码

func IsMySQLError added in v1.2.1

func IsMySQLError(err error) bool

IsMySQLError Check error is MySQLError

func IsNotNull

func IsNotNull(data []byte) bool

IsNotNull 判断JSON是否不为空

func IsNull

func IsNull(data []byte) bool

IsNull 判断JSON是否为空

func JSONBytes

func JSONBytes(data []byte) []byte

JSONBytes 处理JSON字节Slice

func NewQuery

func NewQuery(tx *dbs.Tx, dao dbs.DAOWrapper, adminId int64, userId int64) *dbs.Query

NewQuery 构造Query

Types

type ADNetwork added in v0.6.4

type ADNetwork struct {
	Id          uint32 `field:"id"`          // ID
	IsOn        bool   `field:"isOn"`        // 是否启用
	Name        string `field:"name"`        // 名称
	Description string `field:"description"` // 描述
	Order       uint32 `field:"order"`       // 排序
	State       uint8  `field:"state"`       // 状态
}

ADNetwork 高防线路

type ADNetworkDAO added in v0.6.4

type ADNetworkDAO dbs.DAO
var SharedADNetworkDAO *ADNetworkDAO

func NewADNetworkDAO added in v0.6.4

func NewADNetworkDAO() *ADNetworkDAO

func (*ADNetworkDAO) DisableADNetwork added in v0.6.4

func (this *ADNetworkDAO) DisableADNetwork(tx *dbs.Tx, id int64) error

DisableADNetwork 禁用条目

func (*ADNetworkDAO) EnableADNetwork added in v0.6.4

func (this *ADNetworkDAO) EnableADNetwork(tx *dbs.Tx, id uint32) error

EnableADNetwork 启用条目

func (*ADNetworkDAO) FindADNetworkName added in v0.6.4

func (this *ADNetworkDAO) FindADNetworkName(tx *dbs.Tx, id uint32) (string, error)

FindADNetworkName 根据主键查找名称

func (*ADNetworkDAO) FindEnabledADNetwork added in v0.6.4

func (this *ADNetworkDAO) FindEnabledADNetwork(tx *dbs.Tx, id int64) (*ADNetwork, error)

FindEnabledADNetwork 查找启用中的条目

type ADNetworkOperator added in v0.6.4

type ADNetworkOperator struct {
	Id          any // ID
	IsOn        any // 是否启用
	Name        any // 名称
	Description any // 描述
	Order       any // 排序
	State       any // 状态
}

func NewADNetworkOperator added in v0.6.4

func NewADNetworkOperator() *ADNetworkOperator

type ADPackage added in v0.6.4

type ADPackage struct {
	Id                      uint32 `field:"id"`                      // ID
	IsOn                    bool   `field:"isOn"`                    // 是否启用
	NetworkId               uint32 `field:"networkId"`               // 线路ID
	ProtectionBandwidthSize uint32 `field:"protectionBandwidthSize"` // 防护带宽尺寸
	ProtectionBandwidthUnit string `field:"protectionBandwidthUnit"` // 防护带宽单位
	ProtectionBandwidthBits uint64 `field:"protectionBandwidthBits"` // 防护带宽比特
	ServerBandwidthSize     uint32 `field:"serverBandwidthSize"`     // 业务带宽尺寸
	ServerBandwidthUnit     string `field:"serverBandwidthUnit"`     // 业务带宽单位
	ServerBandwidthBits     uint64 `field:"serverBandwidthBits"`     // 业务带宽比特
	State                   uint8  `field:"state"`                   // 状态
}

ADPackage 高防产品规格

type ADPackageDAO added in v0.6.4

type ADPackageDAO dbs.DAO
var SharedADPackageDAO *ADPackageDAO

func NewADPackageDAO added in v0.6.4

func NewADPackageDAO() *ADPackageDAO

func (*ADPackageDAO) DisableADPackage added in v0.6.4

func (this *ADPackageDAO) DisableADPackage(tx *dbs.Tx, id int64) error

DisableADPackage 禁用条目

func (*ADPackageDAO) EnableADPackage added in v0.6.4

func (this *ADPackageDAO) EnableADPackage(tx *dbs.Tx, id uint32) error

EnableADPackage 启用条目

func (*ADPackageDAO) FindADPackageName added in v0.6.4

func (this *ADPackageDAO) FindADPackageName(tx *dbs.Tx, id uint32) (string, error)

FindADPackageName 根据主键查找名称

func (*ADPackageDAO) FindEnabledADPackage added in v0.6.4

func (this *ADPackageDAO) FindEnabledADPackage(tx *dbs.Tx, id int64) (*ADPackage, error)

FindEnabledADPackage 查找启用中的条目

type ADPackageInstance added in v0.6.4

type ADPackageInstance struct {
	Id             uint32   `field:"id"`             // ID
	IsOn           bool     `field:"isOn"`           // 是否启用
	PackageId      uint32   `field:"packageId"`      // 规格ID
	ClusterId      uint32   `field:"clusterId"`      // 集群ID
	NodeIds        dbs.JSON `field:"nodeIds"`        // 节点ID
	IpAddresses    dbs.JSON `field:"ipAddresses"`    // IP地址
	UserId         uint64   `field:"userId"`         // 用户ID
	UserDayTo      string   `field:"userDayTo"`      // 用户有效期YYYYMMDD
	UserInstanceId uint64   `field:"userInstanceId"` // 用户实例ID
	State          uint8    `field:"state"`          // 状态
	ObjectCodes    dbs.JSON `field:"objectCodes"`    // 防护对象
}

ADPackageInstance 高防实例

type ADPackageInstanceDAO added in v0.6.4

type ADPackageInstanceDAO dbs.DAO
var SharedADPackageInstanceDAO *ADPackageInstanceDAO

func NewADPackageInstanceDAO added in v0.6.4

func NewADPackageInstanceDAO() *ADPackageInstanceDAO

func (*ADPackageInstanceDAO) EnableADPackageInstance added in v0.6.4

func (this *ADPackageInstanceDAO) EnableADPackageInstance(tx *dbs.Tx, id int64) error

EnableADPackageInstance 启用条目

func (*ADPackageInstanceDAO) FindEnabledADPackageInstance added in v0.6.4

func (this *ADPackageInstanceDAO) FindEnabledADPackageInstance(tx *dbs.Tx, id int64) (*ADPackageInstance, error)

FindEnabledADPackageInstance 查找启用中的条目

type ADPackageInstanceOperator added in v0.6.4

type ADPackageInstanceOperator struct {
	Id             any // ID
	IsOn           any // 是否启用
	PackageId      any // 规格ID
	ClusterId      any // 集群ID
	NodeIds        any // 节点ID
	IpAddresses    any // IP地址
	UserId         any // 用户ID
	UserDayTo      any // 用户有效期YYYYMMDD
	UserInstanceId any // 用户实例ID
	State          any // 状态
	ObjectCodes    any // 防护对象
}

func NewADPackageInstanceOperator added in v0.6.4

func NewADPackageInstanceOperator() *ADPackageInstanceOperator

type ADPackageOperator added in v0.6.4

type ADPackageOperator struct {
	Id                      any // ID
	IsOn                    any // 是否启用
	NetworkId               any // 线路ID
	ProtectionBandwidthSize any // 防护带宽尺寸
	ProtectionBandwidthUnit any // 防护带宽单位
	ProtectionBandwidthBits any // 防护带宽比特
	ServerBandwidthSize     any // 业务带宽尺寸
	ServerBandwidthUnit     any // 业务带宽单位
	ServerBandwidthBits     any // 业务带宽比特
	State                   any // 状态
}

func NewADPackageOperator added in v0.6.4

func NewADPackageOperator() *ADPackageOperator

type ADPackagePeriod added in v0.6.4

type ADPackagePeriod struct {
	Id     uint32 `field:"id"`     // ID
	IsOn   bool   `field:"isOn"`   // 是否启用
	Count  uint32 `field:"count"`  // 数量
	Unit   string `field:"unit"`   // 单位:month, year
	Months uint32 `field:"months"` // 月数
	State  uint8  `field:"state"`  // 状态
}

ADPackagePeriod 高防产品有效期

type ADPackagePeriodDAO added in v0.6.4

type ADPackagePeriodDAO dbs.DAO
var SharedADPackagePeriodDAO *ADPackagePeriodDAO

func NewADPackagePeriodDAO added in v0.6.4

func NewADPackagePeriodDAO() *ADPackagePeriodDAO

func (*ADPackagePeriodDAO) DisableADPackagePeriod added in v0.6.4

func (this *ADPackagePeriodDAO) DisableADPackagePeriod(tx *dbs.Tx, id int64) error

DisableADPackagePeriod 禁用条目

func (*ADPackagePeriodDAO) EnableADPackagePeriod added in v0.6.4

func (this *ADPackagePeriodDAO) EnableADPackagePeriod(tx *dbs.Tx, id uint32) error

EnableADPackagePeriod 启用条目

func (*ADPackagePeriodDAO) FindEnabledADPackagePeriod added in v0.6.4

func (this *ADPackagePeriodDAO) FindEnabledADPackagePeriod(tx *dbs.Tx, id int64) (*ADPackagePeriod, error)

FindEnabledADPackagePeriod 查找启用中的条目

type ADPackagePeriodOperator added in v0.6.4

type ADPackagePeriodOperator struct {
	Id     any // ID
	IsOn   any // 是否启用
	Count  any // 数量
	Unit   any // 单位:month, year
	Months any // 月数
	State  any // 状态
}

func NewADPackagePeriodOperator added in v0.6.4

func NewADPackagePeriodOperator() *ADPackagePeriodOperator

type ADPackagePrice added in v0.6.4

type ADPackagePrice struct {
	Id            uint32  `field:"id"`            // ID
	PackageId     uint32  `field:"packageId"`     // 高防产品ID
	PeriodId      uint32  `field:"periodId"`      // 有效期ID
	Price         float64 `field:"price"`         // 价格
	DiscountPrice float64 `field:"discountPrice"` // 折后价格
}

ADPackagePrice 流量包价格

type ADPackagePriceDAO added in v0.6.4

type ADPackagePriceDAO dbs.DAO
var SharedADPackagePriceDAO *ADPackagePriceDAO

func NewADPackagePriceDAO added in v0.6.4

func NewADPackagePriceDAO() *ADPackagePriceDAO

type ADPackagePriceOperator added in v0.6.4

type ADPackagePriceOperator struct {
	Id            any // ID
	PackageId     any // 高防产品ID
	PeriodId      any // 有效期ID
	Price         any // 价格
	DiscountPrice any // 折后价格
}

func NewADPackagePriceOperator added in v0.6.4

func NewADPackagePriceOperator() *ADPackagePriceOperator

type APIAccessToken

type APIAccessToken struct {
	Id        uint64 `field:"id"`        // ID
	UserId    uint32 `field:"userId"`    // 用户ID
	AdminId   uint32 `field:"adminId"`   // 管理员ID
	Token     string `field:"token"`     // 令牌
	CreatedAt uint64 `field:"createdAt"` // 创建时间
	ExpiredAt uint64 `field:"expiredAt"` // 过期时间
}

APIAccessToken API访问令牌

type APIAccessTokenDAO

type APIAccessTokenDAO dbs.DAO
var SharedAPIAccessTokenDAO *APIAccessTokenDAO

func NewAPIAccessTokenDAO

func NewAPIAccessTokenDAO() *APIAccessTokenDAO

func (*APIAccessTokenDAO) DeleteAccessTokens added in v0.6.0

func (this *APIAccessTokenDAO) DeleteAccessTokens(tx *dbs.Tx, adminId int64, userId int64) error

DeleteAccessTokens 删除用户的令牌

func (*APIAccessTokenDAO) FindAccessToken

func (this *APIAccessTokenDAO) FindAccessToken(tx *dbs.Tx, token string) (*APIAccessToken, error)

FindAccessToken 查找AccessToken

func (*APIAccessTokenDAO) GenerateAccessToken

func (this *APIAccessTokenDAO) GenerateAccessToken(tx *dbs.Tx, adminId int64, userId int64) (token string, expiresAt int64, err error)

GenerateAccessToken 生成AccessToken

type APIAccessTokenOperator

type APIAccessTokenOperator struct {
	Id        interface{} // ID
	UserId    interface{} // 用户ID
	AdminId   interface{} // 管理员ID
	Token     interface{} // 令牌
	CreatedAt interface{} // 创建时间
	ExpiredAt interface{} // 过期时间
}

func NewAPIAccessTokenOperator

func NewAPIAccessTokenOperator() *APIAccessTokenOperator

type APIMethodStat

type APIMethodStat struct {
	Id         uint64  `field:"id"`         // ID
	ApiNodeId  uint32  `field:"apiNodeId"`  // API节点ID
	Method     string  `field:"method"`     // 方法
	Tag        string  `field:"tag"`        // 标签方法
	CostMs     float64 `field:"costMs"`     // 耗时Ms
	PeekMs     float64 `field:"peekMs"`     // 峰值耗时
	CountCalls uint64  `field:"countCalls"` // 调用次数
	Day        string  `field:"day"`        // 日期
}

APIMethodStat API方法统计

type APIMethodStatDAO

type APIMethodStatDAO dbs.DAO
var SharedAPIMethodStatDAO *APIMethodStatDAO

func NewAPIMethodStatDAO

func NewAPIMethodStatDAO() *APIMethodStatDAO

func (*APIMethodStatDAO) Clean

func (this *APIMethodStatDAO) Clean(tx *dbs.Tx) error

Clean 清理数据

func (*APIMethodStatDAO) CountAllStatsWithDay

func (this *APIMethodStatDAO) CountAllStatsWithDay(tx *dbs.Tx, day string) (int64, error)

CountAllStatsWithDay 统计当天数量

func (*APIMethodStatDAO) CreateStat

func (this *APIMethodStatDAO) CreateStat(tx *dbs.Tx, method string, tag string, costMs float64) error

CreateStat 记录统计数据

func (*APIMethodStatDAO) FindAllStatsWithDay

func (this *APIMethodStatDAO) FindAllStatsWithDay(tx *dbs.Tx, day string) (result []*APIMethodStat, err error)

FindAllStatsWithDay 查询当前统计

type APIMethodStatOperator

type APIMethodStatOperator struct {
	Id         interface{} // ID
	ApiNodeId  interface{} // API节点ID
	Method     interface{} // 方法
	Tag        interface{} // 标签方法
	CostMs     interface{} // 耗时Ms
	PeekMs     interface{} // 峰值耗时
	CountCalls interface{} // 调用次数
	Day        interface{} // 日期
}

func NewAPIMethodStatOperator

func NewAPIMethodStatOperator() *APIMethodStatOperator

type APINode

type APINode struct {
	Id          uint32   `field:"id"`          // ID
	IsOn        bool     `field:"isOn"`        // 是否启用
	ClusterId   uint32   `field:"clusterId"`   // 专用集群ID
	UniqueId    string   `field:"uniqueId"`    // 唯一ID
	Secret      string   `field:"secret"`      // 密钥
	Name        string   `field:"name"`        // 名称
	Description string   `field:"description"` // 描述
	Http        dbs.JSON `field:"http"`        // 监听的HTTP配置
	Https       dbs.JSON `field:"https"`       // 监听的HTTPS配置
	RestIsOn    uint8    `field:"restIsOn"`    // 是否开放REST
	RestHTTP    dbs.JSON `field:"restHTTP"`    // REST HTTP配置
	RestHTTPS   dbs.JSON `field:"restHTTPS"`   // REST HTTPS配置
	AccessAddrs dbs.JSON `field:"accessAddrs"` // 外部访问地址
	Order       uint32   `field:"order"`       // 排序
	State       uint8    `field:"state"`       // 状态
	CreatedAt   uint64   `field:"createdAt"`   // 创建时间
	AdminId     uint32   `field:"adminId"`     // 管理员ID
	Weight      uint32   `field:"weight"`      // 权重
	Status      dbs.JSON `field:"status"`      // 运行状态
	IsPrimary   bool     `field:"isPrimary"`   // 是否为主API节点
}

APINode API节点

func (*APINode) DecodeAccessAddrStrings

func (this *APINode) DecodeAccessAddrStrings() ([]string, error)

DecodeAccessAddrStrings 解析访问地址,并返回字符串形式

func (*APINode) DecodeAccessAddrs

func (this *APINode) DecodeAccessAddrs() ([]*serverconfigs.NetworkAddressConfig, error)

DecodeAccessAddrs 解析访问地址

func (*APINode) DecodeHTTP

func (this *APINode) DecodeHTTP() (*serverconfigs.HTTPProtocolConfig, error)

DecodeHTTP 解析HTTP配置

func (*APINode) DecodeHTTPS

func (this *APINode) DecodeHTTPS(tx *dbs.Tx, cacheMap *utils.CacheMap) (*serverconfigs.HTTPSProtocolConfig, error)

DecodeHTTPS 解析HTTPS配置

func (*APINode) DecodeRestHTTP

func (this *APINode) DecodeRestHTTP() (*serverconfigs.HTTPProtocolConfig, error)

DecodeRestHTTP 解析Rest HTTP配置

func (*APINode) DecodeRestHTTPS

func (this *APINode) DecodeRestHTTPS(tx *dbs.Tx, cacheMap *utils.CacheMap) (*serverconfigs.HTTPSProtocolConfig, error)

DecodeRestHTTPS 解析HTTPS配置

type APINodeDAO

type APINodeDAO dbs.DAO
var SharedAPINodeDAO *APINodeDAO

func NewAPINodeDAO

func NewAPINodeDAO() *APINodeDAO

func (*APINodeDAO) CheckAPINodeIsPrimary

func (this *APINodeDAO) CheckAPINodeIsPrimary(tx *dbs.Tx) (bool, error)

CheckAPINodeIsPrimary 检查当前节点是否为Primary节点

func (*APINodeDAO) CheckAPINodeIsPrimaryWithoutErr

func (this *APINodeDAO) CheckAPINodeIsPrimaryWithoutErr() bool

CheckAPINodeIsPrimaryWithoutErr 检查当前节点是否为Primary节点,并忽略错误

func (*APINodeDAO) CountAllEnabledAPINodes

func (this *APINodeDAO) CountAllEnabledAPINodes(tx *dbs.Tx) (int64, error)

CountAllEnabledAPINodes 计算API节点数量

func (*APINodeDAO) CountAllEnabledAPINodesWithSSLPolicyIds

func (this *APINodeDAO) CountAllEnabledAPINodesWithSSLPolicyIds(tx *dbs.Tx, sslPolicyIds []int64) (count int64, err error)

CountAllEnabledAPINodesWithSSLPolicyIds 计算使用SSL策略的所有API节点数量

func (*APINodeDAO) CountAllEnabledAndOnAPINodes

func (this *APINodeDAO) CountAllEnabledAndOnAPINodes(tx *dbs.Tx) (int64, error)

CountAllEnabledAndOnAPINodes 计算启用中的API节点数量

func (*APINodeDAO) CountAllEnabledAndOnOfflineAPINodes

func (this *APINodeDAO) CountAllEnabledAndOnOfflineAPINodes(tx *dbs.Tx) (int64, error)

CountAllEnabledAndOnOfflineAPINodes 计算API节点数量

func (*APINodeDAO) CountAllLowerVersionNodes

func (this *APINodeDAO) CountAllLowerVersionNodes(tx *dbs.Tx, version string) (int64, error)

CountAllLowerVersionNodes 计算所有节点中低于某个版本的节点数量

func (*APINodeDAO) CreateAPINode

func (this *APINodeDAO) CreateAPINode(tx *dbs.Tx, name string, description string, httpJSON []byte, httpsJSON []byte, restIsOn bool, restHTTPJSON []byte, restHTTPSJSON []byte, accessAddrsJSON []byte, isOn bool) (nodeId int64, err error)

CreateAPINode 创建API节点

func (*APINodeDAO) DisableAPINode

func (this *APINodeDAO) DisableAPINode(tx *dbs.Tx, nodeId int64) error

DisableAPINode 禁用条目

func (*APINodeDAO) EnableAPINode

func (this *APINodeDAO) EnableAPINode(tx *dbs.Tx, id int64) error

EnableAPINode 启用条目

func (*APINodeDAO) FindAPINodeName

func (this *APINodeDAO) FindAPINodeName(tx *dbs.Tx, id int64) (string, error)

FindAPINodeName 根据主键查找名称

func (*APINodeDAO) FindAllEnabledAPIAccessIPs

func (this *APINodeDAO) FindAllEnabledAPIAccessIPs(tx *dbs.Tx, cacheMap *utils.CacheMap) ([]string, error)

FindAllEnabledAPIAccessIPs 获取所有的API可访问IP地址

func (*APINodeDAO) FindAllEnabledAPINodes

func (this *APINodeDAO) FindAllEnabledAPINodes(tx *dbs.Tx) (result []*APINode, err error)

FindAllEnabledAPINodes 列出所有可用API节点

func (*APINodeDAO) FindAllEnabledAndOnAPINodes

func (this *APINodeDAO) FindAllEnabledAndOnAPINodes(tx *dbs.Tx) (result []*APINode, err error)

FindAllEnabledAndOnAPINodes 列出所有可用而且启用的API节点

func (*APINodeDAO) FindEnabledAPINode

func (this *APINodeDAO) FindEnabledAPINode(tx *dbs.Tx, id int64, cacheMap *utils.CacheMap) (*APINode, error)

FindEnabledAPINode 查找启用中的条目

func (*APINodeDAO) FindEnabledAPINodeIdWithAddr

func (this *APINodeDAO) FindEnabledAPINodeIdWithAddr(tx *dbs.Tx, protocol string, host string, port int) (int64, error)

FindEnabledAPINodeIdWithAddr 根据主机名和端口获取ID

func (*APINodeDAO) FindEnabledAPINodeWithUniqueIdAndSecret

func (this *APINodeDAO) FindEnabledAPINodeWithUniqueIdAndSecret(tx *dbs.Tx, uniqueId string, secret string) (*APINode, error)

FindEnabledAPINodeWithUniqueIdAndSecret 根据ID和Secret查找节点

func (*APINodeDAO) ListEnabledAPINodes

func (this *APINodeDAO) ListEnabledAPINodes(tx *dbs.Tx, offset int64, size int64) (result []*APINode, err error)

ListEnabledAPINodes 列出单页的API节点

func (*APINodeDAO) NotifyUpdate

func (this *APINodeDAO) NotifyUpdate(tx *dbs.Tx, apiNodeId int64) error

NotifyUpdate 通知变更

func (*APINodeDAO) ResetPrimaryAPINode

func (this *APINodeDAO) ResetPrimaryAPINode(tx *dbs.Tx) error

ResetPrimaryAPINode 重置Primary节点

func (*APINodeDAO) UpdateAPINode

func (this *APINodeDAO) UpdateAPINode(tx *dbs.Tx, nodeId int64, name string, description string, httpJSON []byte, httpsJSON []byte, restIsOn bool, restHTTPJSON []byte, restHTTPSJSON []byte, accessAddrsJSON []byte, isOn bool, isPrimary bool) error

UpdateAPINode 修改API节点

func (*APINodeDAO) UpdateAPINodeStatus

func (this *APINodeDAO) UpdateAPINodeStatus(tx *dbs.Tx, apiNodeId int64, statusJSON []byte) error

UpdateAPINodeStatus 设置API节点状态

type APINodeOperator

type APINodeOperator struct {
	Id          interface{} // ID
	IsOn        interface{} // 是否启用
	ClusterId   interface{} // 专用集群ID
	UniqueId    interface{} // 唯一ID
	Secret      interface{} // 密钥
	Name        interface{} // 名称
	Description interface{} // 描述
	Http        interface{} // 监听的HTTP配置
	Https       interface{} // 监听的HTTPS配置
	RestIsOn    interface{} // 是否开放REST
	RestHTTP    interface{} // REST HTTP配置
	RestHTTPS   interface{} // REST HTTPS配置
	AccessAddrs interface{} // 外部访问地址
	Order       interface{} // 排序
	State       interface{} // 状态
	CreatedAt   interface{} // 创建时间
	AdminId     interface{} // 管理员ID
	Weight      interface{} // 权重
	Status      interface{} // 运行状态
	IsPrimary   interface{} // 是否为主API节点
}

func NewAPINodeOperator

func NewAPINodeOperator() *APINodeOperator

type Admin

type Admin struct {
	Id        uint32   `field:"id"`        // ID
	IsOn      bool     `field:"isOn"`      // 是否启用
	Username  string   `field:"username"`  // 用户名
	Password  string   `field:"password"`  // 密码
	Fullname  string   `field:"fullname"`  // 全名
	IsSuper   bool     `field:"isSuper"`   // 是否为超级管理员
	CreatedAt uint64   `field:"createdAt"` // 创建时间
	UpdatedAt uint64   `field:"updatedAt"` // 修改时间
	State     uint8    `field:"state"`     // 状态
	Modules   dbs.JSON `field:"modules"`   // 允许的模块
	CanLogin  bool     `field:"canLogin"`  // 是否可以登录
	Theme     string   `field:"theme"`     // 模板设置
	Lang      string   `field:"lang"`      // 语言代号
}

Admin 管理员

func (*Admin) HasWeakPassword added in v1.0.0

func (this *Admin) HasWeakPassword() bool

type AdminDAO

type AdminDAO dbs.DAO
var SharedAdminDAO *AdminDAO

func NewAdminDAO

func NewAdminDAO() *AdminDAO

func (*AdminDAO) CheckAdminPassword

func (this *AdminDAO) CheckAdminPassword(tx *dbs.Tx, username string, encryptedPassword string) (int64, error)

CheckAdminPassword 检查用户名、密码

func (*AdminDAO) CheckAdminUsername

func (this *AdminDAO) CheckAdminUsername(tx *dbs.Tx, adminId int64, username string) (bool, error)

CheckAdminUsername 检查用户名是否存在

func (*AdminDAO) CheckSuperAdmin added in v1.0.0

func (this *AdminDAO) CheckSuperAdmin(tx *dbs.Tx, adminId int64) (bool, error)

CheckSuperAdmin 检查管理员是否为超级管理员

func (*AdminDAO) CountAllEnabledAdmins

func (this *AdminDAO) CountAllEnabledAdmins(tx *dbs.Tx, keyword string, hasWeakPasswords bool) (int64, error)

CountAllEnabledAdmins 计算所有管理员数量

func (*AdminDAO) CreateAdmin

func (this *AdminDAO) CreateAdmin(tx *dbs.Tx, username string, canLogin bool, password string, fullname string, isSuper bool, modulesJSON []byte) (int64, error)

CreateAdmin 创建管理员

func (*AdminDAO) DisableAdmin

func (this *AdminDAO) DisableAdmin(tx *dbs.Tx, adminId int64) error

DisableAdmin 禁用条目

func (*AdminDAO) EnableAdmin

func (this *AdminDAO) EnableAdmin(tx *dbs.Tx, id int64) (rowsAffected int64, err error)

EnableAdmin 启用条目

func (*AdminDAO) ExistEnabledAdmin

func (this *AdminDAO) ExistEnabledAdmin(tx *dbs.Tx, adminId int64) (bool, error)

ExistEnabledAdmin 检查管理员是否存在

func (*AdminDAO) FindAdminFullname

func (this *AdminDAO) FindAdminFullname(tx *dbs.Tx, adminId int64) (string, error)

FindAdminFullname 获取管理员名称

func (*AdminDAO) FindAdminIdWithUsername

func (this *AdminDAO) FindAdminIdWithUsername(tx *dbs.Tx, username string) (int64, error)

FindAdminIdWithUsername 根据用户名查询管理员ID

func (*AdminDAO) FindAllAdminModules

func (this *AdminDAO) FindAllAdminModules(tx *dbs.Tx) (result []*Admin, err error)

FindAllAdminModules 查询所有管理的权限

func (*AdminDAO) FindBasicAdmin added in v0.5.0

func (this *AdminDAO) FindBasicAdmin(tx *dbs.Tx, id int64) (*Admin, error)

FindBasicAdmin 查找管理员基本信息

func (*AdminDAO) FindEnabledAdmin

func (this *AdminDAO) FindEnabledAdmin(tx *dbs.Tx, id int64) (*Admin, error)

FindEnabledAdmin 查找启用中的条目

func (*AdminDAO) ListEnabledAdmins

func (this *AdminDAO) ListEnabledAdmins(tx *dbs.Tx, keyword string, hasWeakPasswords bool, offset int64, size int64) (result []*Admin, err error)

ListEnabledAdmins 列出单页的管理员

func (*AdminDAO) UpdateAdmin

func (this *AdminDAO) UpdateAdmin(tx *dbs.Tx, adminId int64, username string, canLogin bool, password string, fullname string, isSuper bool, modulesJSON []byte, isOn bool) error

UpdateAdmin 修改管理员详细信息

func (*AdminDAO) UpdateAdminInfo

func (this *AdminDAO) UpdateAdminInfo(tx *dbs.Tx, adminId int64, fullname string) error

UpdateAdminInfo 修改管理员个人资料

func (*AdminDAO) UpdateAdminLogin

func (this *AdminDAO) UpdateAdminLogin(tx *dbs.Tx, adminId int64, username string, password string) error

UpdateAdminLogin 修改管理员登录信息

func (*AdminDAO) UpdateAdminModules

func (this *AdminDAO) UpdateAdminModules(tx *dbs.Tx, adminId int64, allowModulesJSON []byte) error

UpdateAdminModules 修改管理员可以管理的模块

func (*AdminDAO) UpdateAdminPassword

func (this *AdminDAO) UpdateAdminPassword(tx *dbs.Tx, adminId int64, password string) error

UpdateAdminPassword 更改管理员密码

func (*AdminDAO) UpdateAdminTheme

func (this *AdminDAO) UpdateAdminTheme(tx *dbs.Tx, adminId int64, theme string) error

UpdateAdminTheme 设置管理员Theme

type AdminOperator

type AdminOperator struct {
	Id        any // ID
	IsOn      any // 是否启用
	Username  any // 用户名
	Password  any // 密码
	Fullname  any // 全名
	IsSuper   any // 是否为超级管理员
	CreatedAt any // 创建时间
	UpdatedAt any // 修改时间
	State     any // 状态
	Modules   any // 允许的模块
	CanLogin  any // 是否可以登录
	Theme     any // 模板设置
	Lang      any // 语言代号
}

func NewAdminOperator

func NewAdminOperator() *AdminOperator

type ApiToken

type ApiToken struct {
	Id     uint32 `field:"id"`     // ID
	NodeId string `field:"nodeId"` // 节点ID
	Secret string `field:"secret"` // 节点密钥
	Role   string `field:"role"`   // 节点角色
	State  uint8  `field:"state"`  // 状态
}

API令牌管理

type ApiTokenDAO

type ApiTokenDAO dbs.DAO
var SharedApiTokenDAO *ApiTokenDAO

func NewApiTokenDAO

func NewApiTokenDAO() *ApiTokenDAO

func (*ApiTokenDAO) CreateAPIToken

func (this *ApiTokenDAO) CreateAPIToken(tx *dbs.Tx, nodeId string, secret string, role nodeconfigs.NodeRole) error

CreateAPIToken 保存API Token

func (*ApiTokenDAO) DisableApiToken

func (this *ApiTokenDAO) DisableApiToken(tx *dbs.Tx, id uint32) (rowsAffected int64, err error)

DisableApiToken 禁用条目

func (*ApiTokenDAO) EnableApiToken

func (this *ApiTokenDAO) EnableApiToken(tx *dbs.Tx, id uint32) (rowsAffected int64, err error)

EnableApiToken 启用条目

func (*ApiTokenDAO) FindAllEnabledAPITokens

func (this *ApiTokenDAO) FindAllEnabledAPITokens(tx *dbs.Tx, role string) (result []*ApiToken, err error)

FindAllEnabledAPITokens 读取API令牌

func (*ApiTokenDAO) FindEnabledApiToken

func (this *ApiTokenDAO) FindEnabledApiToken(tx *dbs.Tx, id uint32) (*ApiToken, error)

FindEnabledApiToken 查找启用中的条目

func (*ApiTokenDAO) FindEnabledTokenWithNode

func (this *ApiTokenDAO) FindEnabledTokenWithNode(tx *dbs.Tx, nodeId string) (*ApiToken, error)

FindEnabledTokenWithNode 获取节点Token信息并可以缓存

func (*ApiTokenDAO) FindEnabledTokenWithNodeCacheable

func (this *ApiTokenDAO) FindEnabledTokenWithNodeCacheable(tx *dbs.Tx, nodeId string) (*ApiToken, error)

FindEnabledTokenWithNodeCacheable 获取可缓存的节点Token信息

func (*ApiTokenDAO) FindEnabledTokenWithRole

func (this *ApiTokenDAO) FindEnabledTokenWithRole(tx *dbs.Tx, role string) (*ApiToken, error)

FindEnabledTokenWithRole 根据角色获取节点

type ApiTokenOperator

type ApiTokenOperator struct {
	Id     interface{} // ID
	NodeId interface{} // 节点ID
	Secret interface{} // 节点密钥
	Role   interface{} // 节点角色
	State  interface{} // 状态
}

func NewApiTokenOperator

func NewApiTokenOperator() *ApiTokenOperator

type DBNode

type DBNode struct {
	Id          uint32 `field:"id"`          // ID
	IsOn        bool   `field:"isOn"`        // 是否启用
	Role        string `field:"role"`        // 数据库角色
	Name        string `field:"name"`        // 名称
	Description string `field:"description"` // 描述
	Host        string `field:"host"`        // 主机
	Port        uint32 `field:"port"`        // 端口
	Database    string `field:"database"`    // 数据库名称
	Username    string `field:"username"`    // 用户名
	Password    string `field:"password"`    // 密码
	Charset     string `field:"charset"`     // 通讯字符集
	ConnTimeout uint32 `field:"connTimeout"` // 连接超时时间(秒)
	State       uint8  `field:"state"`       // 状态
	CreatedAt   uint64 `field:"createdAt"`   // 创建时间
	Weight      uint32 `field:"weight"`      // 权重
	Order       uint32 `field:"order"`       // 排序
	AdminId     uint32 `field:"adminId"`     // 管理员ID
}

DBNode 数据库节点

func (*DBNode) DBConfig

func (this *DBNode) DBConfig() *dbs.DBConfig

获取数据库配置

type DBNodeDAO

type DBNodeDAO dbs.DAO
var SharedDBNodeDAO *DBNodeDAO

func NewDBNodeDAO

func NewDBNodeDAO() *DBNodeDAO

func (*DBNodeDAO) CheckNodeIsOn

func (this *DBNodeDAO) CheckNodeIsOn(tx *dbs.Tx, nodeId int64) (bool, error)

CheckNodeIsOn 检查节点是否已经启用

func (*DBNodeDAO) CountAllEnabledNodes

func (this *DBNodeDAO) CountAllEnabledNodes(tx *dbs.Tx) (int64, error)

CountAllEnabledNodes 计算可用的节点数量

func (*DBNodeDAO) CreateDBNode

func (this *DBNodeDAO) CreateDBNode(tx *dbs.Tx, isOn bool, name string, description string, host string, port int32, database string, username string, password string, charset string) (int64, error)

CreateDBNode 创建节点

func (*DBNodeDAO) DecodePassword

func (this *DBNodeDAO) DecodePassword(password string) string

DecodePassword 解密密码

func (*DBNodeDAO) DisableDBNode

func (this *DBNodeDAO) DisableDBNode(tx *dbs.Tx, nodeId int64) error

DisableDBNode 禁用条目

func (*DBNodeDAO) EnableDBNode

func (this *DBNodeDAO) EnableDBNode(tx *dbs.Tx, id int64) error

EnableDBNode 启用条目

func (*DBNodeDAO) EncodePassword

func (this *DBNodeDAO) EncodePassword(password string) string

EncodePassword 加密密码

func (*DBNodeDAO) FindAllEnabledAndOnDBNodes

func (this *DBNodeDAO) FindAllEnabledAndOnDBNodes(tx *dbs.Tx) (result []*DBNode, err error)

FindAllEnabledAndOnDBNodes 查找所有可用的数据库节点

func (*DBNodeDAO) FindDBNodeName

func (this *DBNodeDAO) FindDBNodeName(tx *dbs.Tx, id int64) (string, error)

FindDBNodeName 根据主键查找名称

func (*DBNodeDAO) FindEnabledDBNode

func (this *DBNodeDAO) FindEnabledDBNode(tx *dbs.Tx, id int64) (*DBNode, error)

FindEnabledDBNode 查找启用中的条目

func (*DBNodeDAO) ListEnabledNodes

func (this *DBNodeDAO) ListEnabledNodes(tx *dbs.Tx, offset int64, size int64) (result []*DBNode, err error)

ListEnabledNodes 获取单页的节点

func (*DBNodeDAO) UpdateNode

func (this *DBNodeDAO) UpdateNode(tx *dbs.Tx, nodeId int64, isOn bool, name string, description string, host string, port int32, database string, username string, password string, charset string) error

UpdateNode 修改节点

type DBNodeInitializer

type DBNodeInitializer struct {
}

DBNodeInitializer 初始化数据库连接

func NewDBNodeInitializer

func NewDBNodeInitializer() *DBNodeInitializer

func (*DBNodeInitializer) Start

func (this *DBNodeInitializer) Start()

Start 启动

type DBNodeOperator

type DBNodeOperator struct {
	Id          interface{} // ID
	IsOn        interface{} // 是否启用
	Role        interface{} // 数据库角色
	Name        interface{} // 名称
	Description interface{} // 描述
	Host        interface{} // 主机
	Port        interface{} // 端口
	Database    interface{} // 数据库名称
	Username    interface{} // 用户名
	Password    interface{} // 密码
	Charset     interface{} // 通讯字符集
	ConnTimeout interface{} // 连接超时时间(秒)
	State       interface{} // 状态
	CreatedAt   interface{} // 创建时间
	Weight      interface{} // 权重
	Order       interface{} // 排序
	AdminId     interface{} // 管理员ID
}

func NewDBNodeOperator

func NewDBNodeOperator() *DBNodeOperator

type EventInterface

type EventInterface interface {
	Type() string
	Run() error
}

接口

type File

type File struct {
	Id          uint32 `field:"id"`          // ID
	AdminId     uint32 `field:"adminId"`     // 管理员ID
	Code        string `field:"code"`        // 代号
	UserId      uint32 `field:"userId"`      // 用户ID
	Description string `field:"description"` // 文件描述
	Filename    string `field:"filename"`    // 文件名
	Size        uint32 `field:"size"`        // 文件尺寸
	MimeType    string `field:"mimeType"`    // Mime类型
	CreatedAt   uint64 `field:"createdAt"`   // 创建时间
	Order       uint32 `field:"order"`       // 排序
	Type        string `field:"type"`        // 类型
	State       uint8  `field:"state"`       // 状态
	IsFinished  bool   `field:"isFinished"`  // 是否已完成上传
	IsPublic    bool   `field:"isPublic"`    // 是否可以公开访问
}

File 文件管理

type FileChunk

type FileChunk struct {
	Id     uint32 `field:"id"`     // ID
	FileId uint32 `field:"fileId"` // 文件ID
	Data   []byte `field:"data"`   // 分块内容
}

type FileChunkDAO

type FileChunkDAO dbs.DAO
var SharedFileChunkDAO *FileChunkDAO

func NewFileChunkDAO

func NewFileChunkDAO() *FileChunkDAO

func (*FileChunkDAO) CreateFileChunk

func (this *FileChunkDAO) CreateFileChunk(tx *dbs.Tx, fileId int64, data []byte) (int64, error)

CreateFileChunk 创建文件Chunk

func (*FileChunkDAO) DeleteFileChunks

func (this *FileChunkDAO) DeleteFileChunks(tx *dbs.Tx, fileId int64) error

DeleteFileChunks 删除以前的文件

func (*FileChunkDAO) FindAllFileChunkIds

func (this *FileChunkDAO) FindAllFileChunkIds(tx *dbs.Tx, fileId int64) ([]int64, error)

FindAllFileChunkIds 读取文件的所有片段ID

func (*FileChunkDAO) FindAllFileChunks

func (this *FileChunkDAO) FindAllFileChunks(tx *dbs.Tx, fileId int64) (result []*FileChunk, err error)

FindAllFileChunks 列出所有的文件Chunk

func (*FileChunkDAO) FindFileChunk

func (this *FileChunkDAO) FindFileChunk(tx *dbs.Tx, chunkId int64) (*FileChunk, error)

FindFileChunk 根据ID查找片段

type FileChunkOperator

type FileChunkOperator struct {
	Id     interface{} // ID
	FileId interface{} // 文件ID
	Data   interface{} // 分块内容
}

func NewFileChunkOperator

func NewFileChunkOperator() *FileChunkOperator

type FileDAO

type FileDAO dbs.DAO
var SharedFileDAO *FileDAO

func NewFileDAO

func NewFileDAO() *FileDAO

func (*FileDAO) CheckUserFile added in v0.4.10

func (this *FileDAO) CheckUserFile(tx *dbs.Tx, userId int64, fileId int64) error

CheckUserFile 检查用户ID

func (*FileDAO) CreateFile

func (this *FileDAO) CreateFile(tx *dbs.Tx, adminId int64, userId int64, businessType string, description string, filename string, size int64, mimeType string, isPublic bool) (int64, error)

CreateFile 创建文件

func (*FileDAO) DisableFile

func (this *FileDAO) DisableFile(tx *dbs.Tx, id int64) error

DisableFile 禁用条目

func (*FileDAO) EnableFile

func (this *FileDAO) EnableFile(tx *dbs.Tx, id int64) error

EnableFile 启用条目

func (*FileDAO) FindEnabledFile

func (this *FileDAO) FindEnabledFile(tx *dbs.Tx, id int64) (*File, error)

FindEnabledFile 查找启用中的条目

func (*FileDAO) UpdateFileIsFinished

func (this *FileDAO) UpdateFileIsFinished(tx *dbs.Tx, fileId int64) error

UpdateFileIsFinished 将文件置为已完成

type FileOperator

type FileOperator struct {
	Id          interface{} // ID
	AdminId     interface{} // 管理员ID
	Code        interface{} // 代号
	UserId      interface{} // 用户ID
	Description interface{} // 文件描述
	Filename    interface{} // 文件名
	Size        interface{} // 文件尺寸
	MimeType    interface{} // Mime类型
	CreatedAt   interface{} // 创建时间
	Order       interface{} // 排序
	Type        interface{} // 类型
	State       interface{} // 状态
	IsFinished  interface{} // 是否已完成上传
	IsPublic    interface{} // 是否可以公开访问
}

func NewFileOperator

func NewFileOperator() *FileOperator

type FormalClientBrowser added in v0.5.8

type FormalClientBrowser struct {
	Id     uint32   `field:"id"`     // ID
	Name   string   `field:"name"`   // 浏览器名称
	Codes  dbs.JSON `field:"codes"`  // 代号
	DataId string   `field:"dataId"` // 数据ID
	State  uint8    `field:"state"`  // 状态
}

FormalClientBrowser 终端浏览器信息

func (*FormalClientBrowser) DecodeCodes added in v0.5.8

func (this *FormalClientBrowser) DecodeCodes() []string

DecodeCodes 解析代号

type FormalClientBrowserDAO added in v0.5.8

type FormalClientBrowserDAO dbs.DAO
var SharedFormalClientBrowserDAO *FormalClientBrowserDAO

func NewFormalClientBrowserDAO added in v0.5.8

func NewFormalClientBrowserDAO() *FormalClientBrowserDAO

func (*FormalClientBrowserDAO) CountBrowsers added in v0.5.8

func (this *FormalClientBrowserDAO) CountBrowsers(tx *dbs.Tx, keyword string) (int64, error)

CountBrowsers 计算浏览器数量

func (*FormalClientBrowserDAO) CreateBrowser added in v0.5.8

func (this *FormalClientBrowserDAO) CreateBrowser(tx *dbs.Tx, name string, codes []string, dataId string) (int64, error)

CreateBrowser 创建浏览器信息

func (*FormalClientBrowserDAO) DisableFormalClientBrowser added in v0.5.8

func (this *FormalClientBrowserDAO) DisableFormalClientBrowser(tx *dbs.Tx, id uint32) error

DisableFormalClientBrowser 禁用条目

func (*FormalClientBrowserDAO) EnableFormalClientBrowser added in v0.5.8

func (this *FormalClientBrowserDAO) EnableFormalClientBrowser(tx *dbs.Tx, id uint32) error

EnableFormalClientBrowser 启用条目

func (*FormalClientBrowserDAO) FindBrowserIdWithNameCacheable added in v0.5.8

func (this *FormalClientBrowserDAO) FindBrowserIdWithNameCacheable(tx *dbs.Tx, browserName string) (int64, error)

FindBrowserIdWithNameCacheable 根据浏览器名称查找系统ID

func (*FormalClientBrowserDAO) FindBrowserWithDataId added in v0.5.8

func (this *FormalClientBrowserDAO) FindBrowserWithDataId(tx *dbs.Tx, dataId string) (*FormalClientBrowser, error)

FindBrowserWithDataId 根据dataId查找浏览器信息

func (*FormalClientBrowserDAO) FindEnabledFormalClientBrowser added in v0.5.8

func (this *FormalClientBrowserDAO) FindEnabledFormalClientBrowser(tx *dbs.Tx, id int64) (*FormalClientBrowser, error)

FindEnabledFormalClientBrowser 查找启用中的条目

func (*FormalClientBrowserDAO) FindFormalClientBrowserName added in v0.5.8

func (this *FormalClientBrowserDAO) FindFormalClientBrowserName(tx *dbs.Tx, id uint32) (string, error)

FindFormalClientBrowserName 根据主键查找名称

func (*FormalClientBrowserDAO) ListBrowsers added in v0.5.8

func (this *FormalClientBrowserDAO) ListBrowsers(tx *dbs.Tx, keyword string, offset int64, size int64) (result []*FormalClientBrowser, err error)

ListBrowsers 列出单页浏览器信息

func (*FormalClientBrowserDAO) UpdateBrowser added in v0.5.8

func (this *FormalClientBrowserDAO) UpdateBrowser(tx *dbs.Tx, browserId int64, name string, codes []string, dataId string) error

UpdateBrowser 修改浏览器信息

type FormalClientBrowserOperator added in v0.5.8

type FormalClientBrowserOperator struct {
	Id     any // ID
	Name   any // 浏览器名称
	Codes  any // 代号
	DataId any // 数据ID
	State  any // 状态
}

func NewFormalClientBrowserOperator added in v0.5.8

func NewFormalClientBrowserOperator() *FormalClientBrowserOperator

type FormalClientSystem added in v0.5.8

type FormalClientSystem struct {
	Id     uint32   `field:"id"`     // ID
	Name   string   `field:"name"`   // 系统名称
	Codes  dbs.JSON `field:"codes"`  // 代号
	State  uint8    `field:"state"`  // 状态
	DataId string   `field:"dataId"` // 数据ID
}

FormalClientSystem 终端操作系统信息

func (*FormalClientSystem) DecodeCodes added in v0.5.8

func (this *FormalClientSystem) DecodeCodes() []string

DecodeCodes 解析代号

type FormalClientSystemDAO added in v0.5.8

type FormalClientSystemDAO dbs.DAO
var SharedFormalClientSystemDAO *FormalClientSystemDAO

func NewFormalClientSystemDAO added in v0.5.8

func NewFormalClientSystemDAO() *FormalClientSystemDAO

func (*FormalClientSystemDAO) CountSystems added in v0.5.8

func (this *FormalClientSystemDAO) CountSystems(tx *dbs.Tx, keyword string) (int64, error)

CountSystems 计算操作系统数量

func (*FormalClientSystemDAO) CreateSystem added in v0.5.8

func (this *FormalClientSystemDAO) CreateSystem(tx *dbs.Tx, name string, codes []string, dataId string) (int64, error)

CreateSystem 创建操作系统信息

func (*FormalClientSystemDAO) DisableFormalClientSystem added in v0.5.8

func (this *FormalClientSystemDAO) DisableFormalClientSystem(tx *dbs.Tx, id uint32) error

DisableFormalClientSystem 禁用条目

func (*FormalClientSystemDAO) EnableFormalClientSystem added in v0.5.8

func (this *FormalClientSystemDAO) EnableFormalClientSystem(tx *dbs.Tx, id uint32) error

EnableFormalClientSystem 启用条目

func (*FormalClientSystemDAO) FindEnabledFormalClientSystem added in v0.5.8

func (this *FormalClientSystemDAO) FindEnabledFormalClientSystem(tx *dbs.Tx, id int64) (*FormalClientSystem, error)

FindEnabledFormalClientSystem 查找启用中的条目

func (*FormalClientSystemDAO) FindFormalClientSystemName added in v0.5.8

func (this *FormalClientSystemDAO) FindFormalClientSystemName(tx *dbs.Tx, id uint32) (string, error)

FindFormalClientSystemName 根据主键查找名称

func (*FormalClientSystemDAO) FindSystemIdWithNameCacheable added in v0.5.8

func (this *FormalClientSystemDAO) FindSystemIdWithNameCacheable(tx *dbs.Tx, systemName string) (int64, error)

FindSystemIdWithNameCacheable 根据操作系统名称查找系统ID

func (*FormalClientSystemDAO) FindSystemWithDataId added in v0.5.8

func (this *FormalClientSystemDAO) FindSystemWithDataId(tx *dbs.Tx, dataId string) (*FormalClientSystem, error)

FindSystemWithDataId 根据dataId查找操作系统信息

func (*FormalClientSystemDAO) ListSystems added in v0.5.8

func (this *FormalClientSystemDAO) ListSystems(tx *dbs.Tx, keyword string, offset int64, size int64) (result []*FormalClientSystem, err error)

ListSystems 列出单页操作系统信息

func (*FormalClientSystemDAO) UpdateSystem added in v0.5.8

func (this *FormalClientSystemDAO) UpdateSystem(tx *dbs.Tx, systemId int64, name string, codes []string, dataId string) error

UpdateSystem 修改操作系统信息

type FormalClientSystemOperator added in v0.5.8

type FormalClientSystemOperator struct {
	Id     any // ID
	Name   any // 系统名称
	Codes  any // 代号
	State  any // 状态
	DataId any // 数据ID
}

func NewFormalClientSystemOperator added in v0.5.8

func NewFormalClientSystemOperator() *FormalClientSystemOperator

type HTTPAccessLog

type HTTPAccessLog struct {
	Id                  uint64   `field:"id"`                  // ID
	ServerId            uint32   `field:"serverId"`            // 服务ID
	NodeId              uint32   `field:"nodeId"`              // 节点ID
	Status              uint32   `field:"status"`              // 状态码
	CreatedAt           uint64   `field:"createdAt"`           // 创建时间
	Content             dbs.JSON `field:"content"`             // 日志内容
	RequestId           string   `field:"requestId"`           // 请求ID
	FirewallPolicyId    uint32   `field:"firewallPolicyId"`    // WAF策略ID
	FirewallRuleGroupId uint32   `field:"firewallRuleGroupId"` // WAF分组ID
	FirewallRuleSetId   uint32   `field:"firewallRuleSetId"`   // WAF集ID
	FirewallRuleId      uint32   `field:"firewallRuleId"`      // WAF规则ID
	RemoteAddr          string   `field:"remoteAddr"`          // IP地址
	Domain              string   `field:"domain"`              // 域名
	RequestBody         []byte   `field:"requestBody"`         // 请求内容
	ResponseBody        []byte   `field:"responseBody"`        // 响应内容
}

HTTPAccessLog 访问日志

func (*HTTPAccessLog) ToPB

func (this *HTTPAccessLog) ToPB() (*pb.HTTPAccessLog, error)

ToPB 转换成PB对象

type HTTPAccessLogDAO

type HTTPAccessLogDAO dbs.DAO
var SharedHTTPAccessLogDAO *HTTPAccessLogDAO

func NewHTTPAccessLogDAO

func NewHTTPAccessLogDAO() *HTTPAccessLogDAO

func (*HTTPAccessLogDAO) CreateHTTPAccessLog

func (this *HTTPAccessLogDAO) CreateHTTPAccessLog(tx *dbs.Tx, dao *HTTPAccessLogDAO, accessLog *pb.HTTPAccessLog) error

CreateHTTPAccessLog 写入单条访问日志

func (*HTTPAccessLogDAO) CreateHTTPAccessLogs

func (this *HTTPAccessLogDAO) CreateHTTPAccessLogs(tx *dbs.Tx, accessLogs []*pb.HTTPAccessLog) error

CreateHTTPAccessLogs 创建访问日志

func (*HTTPAccessLogDAO) DumpAccessLogsFromQueue

func (this *HTTPAccessLogDAO) DumpAccessLogsFromQueue(size int) (hasMore bool, err error)

DumpAccessLogsFromQueue 从队列导入访问日志

func (*HTTPAccessLogDAO) FindAccessLogWithRequestId

func (this *HTTPAccessLogDAO) FindAccessLogWithRequestId(tx *dbs.Tx, requestId string) (*HTTPAccessLog, error)

FindAccessLogWithRequestId 根据请求ID获取访问日志

func (*HTTPAccessLogDAO) ListAccessLogs

func (this *HTTPAccessLogDAO) ListAccessLogs(tx *dbs.Tx,
	partition int32,
	lastRequestId string,
	size int64,
	day string,
	hourFrom string,
	hourTo string,
	clusterId int64,
	nodeId int64,
	serverId int64,
	reverse bool,
	hasError bool,
	firewallPolicyId int64,
	firewallRuleGroupId int64,
	firewallRuleSetId int64,
	hasFirewallPolicy bool,
	userId int64,
	keyword string,
	ip string,
	domain string) (result []*HTTPAccessLog, nextLastRequestId string, hasMore bool, err error)

ListAccessLogs 读取往前的 单页访问日志

func (*HTTPAccessLogDAO) SetupQueue

func (this *HTTPAccessLogDAO) SetupQueue()

SetupQueue 建立队列

type HTTPAccessLogDAOWrapper

type HTTPAccessLogDAOWrapper struct {
	DAO     *HTTPAccessLogDAO
	NodeId  int64
	IsLocal bool
}

HTTPAccessLogDAOWrapper HTTP访问日志DAO

type HTTPAccessLogManager

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

func NewHTTPAccessLogManager

func NewHTTPAccessLogManager() *HTTPAccessLogManager

func (*HTTPAccessLogManager) CreateTable

func (this *HTTPAccessLogManager) CreateTable(db *dbs.DB, tableName string) error

CreateTable 创建访问日志表格

func (*HTTPAccessLogManager) FindLastTable

func (this *HTTPAccessLogManager) FindLastTable(db *dbs.DB, day string, force bool) (*httpAccessLogDefinition, error)

FindLastTable 根据日期获取上一个可以使用的表名 表名组成

  • PREFIX_DAY
  • PREFIX_DAY_0001

func (*HTTPAccessLogManager) FindLatestPartition

func (this *HTTPAccessLogManager) FindLatestPartition(day string) (int32, error)

FindLatestPartition 读取最后一个分区

func (*HTTPAccessLogManager) FindPartitionTable

func (this *HTTPAccessLogManager) FindPartitionTable(db *dbs.DB, day string, partition int32) (*httpAccessLogDefinition, error)

func (*HTTPAccessLogManager) FindTableNames

func (this *HTTPAccessLogManager) FindTableNames(db *dbs.DB, day string) ([]string, error)

FindTableNames 读取数据库中某日所有日志表名称

func (*HTTPAccessLogManager) FindTables

func (this *HTTPAccessLogManager) FindTables(db *dbs.DB, day string) ([]*httpAccessLogDefinition, error)

FindTables 读取数据库中某日所有日志表

func (*HTTPAccessLogManager) ResetTable

func (this *HTTPAccessLogManager) ResetTable(db *dbs.DB, day string)

ResetTable 清除某个数据库表名缓存

func (*HTTPAccessLogManager) TablePartition

func (this *HTTPAccessLogManager) TablePartition(tableName string) (partition int32)

TablePartition 从表名中获取分区

type HTTPAccessLogOperator

type HTTPAccessLogOperator struct {
	Id                  interface{} // ID
	ServerId            interface{} // 服务ID
	NodeId              interface{} // 节点ID
	Status              interface{} // 状态码
	CreatedAt           interface{} // 创建时间
	Content             interface{} // 日志内容
	RequestId           interface{} // 请求ID
	FirewallPolicyId    interface{} // WAF策略ID
	FirewallRuleGroupId interface{} // WAF分组ID
	FirewallRuleSetId   interface{} // WAF集ID
	FirewallRuleId      interface{} // WAF规则ID
	RemoteAddr          interface{} // IP地址
	Domain              interface{} // 域名
	RequestBody         interface{} // 请求内容
	ResponseBody        interface{} // 响应内容
}

func NewHTTPAccessLogOperator

func NewHTTPAccessLogOperator() *HTTPAccessLogOperator

type HTTPAccessLogPolicy

type HTTPAccessLogPolicy struct {
	Id               uint32   `field:"id"`               // ID
	TemplateId       uint32   `field:"templateId"`       // 模版ID
	AdminId          uint32   `field:"adminId"`          // 管理员ID
	UserId           uint32   `field:"userId"`           // 用户ID
	State            uint8    `field:"state"`            // 状态
	CreatedAt        uint64   `field:"createdAt"`        // 创建时间
	Name             string   `field:"name"`             // 名称
	IsOn             bool     `field:"isOn"`             // 是否启用
	Type             string   `field:"type"`             // 存储类型
	Options          dbs.JSON `field:"options"`          // 存储选项
	Conds            dbs.JSON `field:"conds"`            // 请求条件
	IsPublic         bool     `field:"isPublic"`         // 是否为公用
	FirewallOnly     uint8    `field:"firewallOnly"`     // 是否只记录防火墙相关
	Version          uint32   `field:"version"`          // 版本号
	DisableDefaultDB bool     `field:"disableDefaultDB"` // 是否停止默认数据库存储
}

HTTPAccessLogPolicy 访问日志策略

type HTTPAccessLogPolicyDAO

type HTTPAccessLogPolicyDAO dbs.DAO
var SharedHTTPAccessLogPolicyDAO *HTTPAccessLogPolicyDAO

func NewHTTPAccessLogPolicyDAO

func NewHTTPAccessLogPolicyDAO() *HTTPAccessLogPolicyDAO

func (*HTTPAccessLogPolicyDAO) CancelAllPublicPolicies

func (this *HTTPAccessLogPolicyDAO) CancelAllPublicPolicies(tx *dbs.Tx) error

CancelAllPublicPolicies 取消别的公用的策略

func (*HTTPAccessLogPolicyDAO) CountAllEnabledPolicies

func (this *HTTPAccessLogPolicyDAO) CountAllEnabledPolicies(tx *dbs.Tx) (int64, error)

CountAllEnabledPolicies 计算策略数量

func (*HTTPAccessLogPolicyDAO) CreatePolicy

func (this *HTTPAccessLogPolicyDAO) CreatePolicy(tx *dbs.Tx, name string, policyType string, optionsJSON []byte, condsJSON []byte, isPublic bool, firewallOnly bool, disableDefaultDB bool) (policyId int64, err error)

CreatePolicy 创建策略

func (*HTTPAccessLogPolicyDAO) DisableHTTPAccessLogPolicy

func (this *HTTPAccessLogPolicyDAO) DisableHTTPAccessLogPolicy(tx *dbs.Tx, id int64) error

DisableHTTPAccessLogPolicy 禁用条目

func (*HTTPAccessLogPolicyDAO) EnableHTTPAccessLogPolicy

func (this *HTTPAccessLogPolicyDAO) EnableHTTPAccessLogPolicy(tx *dbs.Tx, id int64) error

EnableHTTPAccessLogPolicy 启用条目

func (*HTTPAccessLogPolicyDAO) FindAllEnabledAndOnPolicies

func (this *HTTPAccessLogPolicyDAO) FindAllEnabledAndOnPolicies(tx *dbs.Tx) (result []*HTTPAccessLogPolicy, err error)

FindAllEnabledAndOnPolicies 获取所有的策略信息

func (*HTTPAccessLogPolicyDAO) FindCurrentPublicPolicyId

func (this *HTTPAccessLogPolicyDAO) FindCurrentPublicPolicyId(tx *dbs.Tx) (int64, error)

FindCurrentPublicPolicyId 取得当前的公用策略

func (*HTTPAccessLogPolicyDAO) FindEnabledHTTPAccessLogPolicy

func (this *HTTPAccessLogPolicyDAO) FindEnabledHTTPAccessLogPolicy(tx *dbs.Tx, id int64) (*HTTPAccessLogPolicy, error)

FindEnabledHTTPAccessLogPolicy 查找启用中的条目

func (*HTTPAccessLogPolicyDAO) FindHTTPAccessLogPolicyName

func (this *HTTPAccessLogPolicyDAO) FindHTTPAccessLogPolicyName(tx *dbs.Tx, id int64) (string, error)

FindHTTPAccessLogPolicyName 根据主键查找名称

func (*HTTPAccessLogPolicyDAO) Init

func (this *HTTPAccessLogPolicyDAO) Init()

Init 初始化

func (*HTTPAccessLogPolicyDAO) ListEnabledPolicies

func (this *HTTPAccessLogPolicyDAO) ListEnabledPolicies(tx *dbs.Tx, offset int64, size int64) (result []*HTTPAccessLogPolicy, err error)

ListEnabledPolicies 查找所有可用策略信息

func (*HTTPAccessLogPolicyDAO) UpdatePolicy

func (this *HTTPAccessLogPolicyDAO) UpdatePolicy(tx *dbs.Tx, policyId int64, name string, optionsJSON []byte, condsJSON []byte, isPublic bool, firewallOnly bool, disableDefaultDB bool, isOn bool) error

UpdatePolicy 修改策略

type HTTPAccessLogPolicyOperator

type HTTPAccessLogPolicyOperator struct {
	Id               any // ID
	TemplateId       any // 模版ID
	AdminId          any // 管理员ID
	UserId           any // 用户ID
	State            any // 状态
	CreatedAt        any // 创建时间
	Name             any // 名称
	IsOn             any // 是否启用
	Type             any // 存储类型
	Options          any // 存储选项
	Conds            any // 请求条件
	IsPublic         any // 是否为公用
	FirewallOnly     any // 是否只记录防火墙相关
	Version          any // 版本号
	DisableDefaultDB any // 是否停止默认数据库存储
}

func NewHTTPAccessLogPolicyOperator

func NewHTTPAccessLogPolicyOperator() *HTTPAccessLogPolicyOperator

type HTTPAuthPolicy

type HTTPAuthPolicy struct {
	Id      uint64   `field:"id"`      // ID
	AdminId uint32   `field:"adminId"` // 管理员ID
	UserId  uint32   `field:"userId"`  // 用户ID
	IsOn    bool     `field:"isOn"`    // 是否启用
	Name    string   `field:"name"`    // 名称
	Type    string   `field:"type"`    // 类型
	Params  dbs.JSON `field:"params"`  // 参数
	State   uint8    `field:"state"`   // 状态
}

HTTPAuthPolicy HTTP认证策略

type HTTPAuthPolicyDAO

type HTTPAuthPolicyDAO dbs.DAO
var SharedHTTPAuthPolicyDAO *HTTPAuthPolicyDAO

func NewHTTPAuthPolicyDAO

func NewHTTPAuthPolicyDAO() *HTTPAuthPolicyDAO

func (*HTTPAuthPolicyDAO) CheckUserPolicy added in v0.5.2

func (this *HTTPAuthPolicyDAO) CheckUserPolicy(tx *dbs.Tx, userId int64, policyId int64) error

CheckUserPolicy 检查用户权限

func (*HTTPAuthPolicyDAO) CloneAuthPolicy added in v1.0.0

func (this *HTTPAuthPolicyDAO) CloneAuthPolicy(tx *dbs.Tx, fromPolicyId int64) (int64, error)

CloneAuthPolicy 复制策略

func (*HTTPAuthPolicyDAO) ComposePolicyConfig

func (this *HTTPAuthPolicyDAO) ComposePolicyConfig(tx *dbs.Tx, policyId int64, cacheMap *utils.CacheMap) (*serverconfigs.HTTPAuthPolicy, error)

ComposePolicyConfig 组合配置

func (*HTTPAuthPolicyDAO) CreateHTTPAuthPolicy

func (this *HTTPAuthPolicyDAO) CreateHTTPAuthPolicy(tx *dbs.Tx, userId int64, name string, methodType string, paramsJSON []byte) (int64, error)

CreateHTTPAuthPolicy 创建策略

func (*HTTPAuthPolicyDAO) DisableHTTPAuthPolicy

func (this *HTTPAuthPolicyDAO) DisableHTTPAuthPolicy(tx *dbs.Tx, id int64) error

DisableHTTPAuthPolicy 禁用条目

func (*HTTPAuthPolicyDAO) EnableHTTPAuthPolicy

func (this *HTTPAuthPolicyDAO) EnableHTTPAuthPolicy(tx *dbs.Tx, id int64) error

EnableHTTPAuthPolicy 启用条目

func (*HTTPAuthPolicyDAO) FindEnabledHTTPAuthPolicy

func (this *HTTPAuthPolicyDAO) FindEnabledHTTPAuthPolicy(tx *dbs.Tx, id int64) (*HTTPAuthPolicy, error)

FindEnabledHTTPAuthPolicy 查找启用中的条目

func (*HTTPAuthPolicyDAO) NotifyUpdate

func (this *HTTPAuthPolicyDAO) NotifyUpdate(tx *dbs.Tx, policyId int64) error

NotifyUpdate 通知更改

func (*HTTPAuthPolicyDAO) UpdateHTTPAuthPolicy

func (this *HTTPAuthPolicyDAO) UpdateHTTPAuthPolicy(tx *dbs.Tx, policyId int64, name string, paramsJSON []byte, isOn bool) error

UpdateHTTPAuthPolicy 修改策略

type HTTPAuthPolicyOperator

type HTTPAuthPolicyOperator struct {
	Id      interface{} // ID
	AdminId interface{} // 管理员ID
	UserId  interface{} // 用户ID
	IsOn    interface{} // 是否启用
	Name    interface{} // 名称
	Type    interface{} // 类型
	Params  interface{} // 参数
	State   interface{} // 状态
}

func NewHTTPAuthPolicyOperator

func NewHTTPAuthPolicyOperator() *HTTPAuthPolicyOperator

type HTTPBrotliPolicy

type HTTPBrotliPolicy struct {
	Id        uint32   `field:"id"`        // ID
	AdminId   uint32   `field:"adminId"`   // 管理员ID
	UserId    uint32   `field:"userId"`    // 用户ID
	IsOn      bool     `field:"isOn"`      // 是否启用
	Level     uint32   `field:"level"`     // 压缩级别
	MinLength dbs.JSON `field:"minLength"` // 可压缩最小值
	MaxLength dbs.JSON `field:"maxLength"` // 可压缩最大值
	State     uint8    `field:"state"`     // 状态
	CreatedAt uint64   `field:"createdAt"` // 创建时间
	Conds     dbs.JSON `field:"conds"`     // 条件
}

HTTPBrotliPolicy Gzip配置

type HTTPBrotliPolicyDAO

type HTTPBrotliPolicyDAO dbs.DAO
var SharedHTTPBrotliPolicyDAO *HTTPBrotliPolicyDAO

func NewHTTPBrotliPolicyDAO

func NewHTTPBrotliPolicyDAO() *HTTPBrotliPolicyDAO

func (*HTTPBrotliPolicyDAO) ComposeBrotliConfig

func (this *HTTPBrotliPolicyDAO) ComposeBrotliConfig(tx *dbs.Tx, policyId int64) (*serverconfigs.HTTPBrotliCompressionConfig, error)

ComposeBrotliConfig 组合配置

func (*HTTPBrotliPolicyDAO) CreatePolicy

func (this *HTTPBrotliPolicyDAO) CreatePolicy(tx *dbs.Tx, level int, minLengthJSON []byte, maxLengthJSON []byte, condsJSON []byte) (int64, error)

CreatePolicy 创建策略

func (*HTTPBrotliPolicyDAO) DisableHTTPBrotliPolicy

func (this *HTTPBrotliPolicyDAO) DisableHTTPBrotliPolicy(tx *dbs.Tx, id int64) error

DisableHTTPBrotliPolicy 禁用条目

func (*HTTPBrotliPolicyDAO) EnableHTTPBrotliPolicy

func (this *HTTPBrotliPolicyDAO) EnableHTTPBrotliPolicy(tx *dbs.Tx, id int64) error

EnableHTTPBrotliPolicy 启用条目

func (*HTTPBrotliPolicyDAO) FindEnabledHTTPBrotliPolicy

func (this *HTTPBrotliPolicyDAO) FindEnabledHTTPBrotliPolicy(tx *dbs.Tx, id int64) (*HTTPBrotliPolicy, error)

FindEnabledHTTPBrotliPolicy 查找启用中的条目

func (*HTTPBrotliPolicyDAO) NotifyUpdate

func (this *HTTPBrotliPolicyDAO) NotifyUpdate(tx *dbs.Tx, policyId int64) error

NotifyUpdate 通知更新

func (*HTTPBrotliPolicyDAO) UpdatePolicy

func (this *HTTPBrotliPolicyDAO) UpdatePolicy(tx *dbs.Tx, policyId int64, level int, minLengthJSON []byte, maxLengthJSON []byte, condsJSON []byte) error

UpdatePolicy 修改Policy

type HTTPBrotliPolicyOperator

type HTTPBrotliPolicyOperator struct {
	Id        interface{} // ID
	AdminId   interface{} // 管理员ID
	UserId    interface{} // 用户ID
	IsOn      interface{} // 是否启用
	Level     interface{} // 压缩级别
	MinLength interface{} // 可压缩最小值
	MaxLength interface{} // 可压缩最大值
	State     interface{} // 状态
	CreatedAt interface{} // 创建时间
	Conds     interface{} // 条件
}

func NewHTTPBrotliPolicyOperator

func NewHTTPBrotliPolicyOperator() *HTTPBrotliPolicyOperator

type HTTPCachePolicy

type HTTPCachePolicy struct {
	Id                   uint32   `field:"id"`                   // ID
	AdminId              uint32   `field:"adminId"`              // 管理员ID
	UserId               uint32   `field:"userId"`               // 用户ID
	TemplateId           uint32   `field:"templateId"`           // 模版ID
	IsOn                 bool     `field:"isOn"`                 // 是否启用
	Name                 string   `field:"name"`                 // 名称
	Capacity             dbs.JSON `field:"capacity"`             // 容量数据
	MaxKeys              uint64   `field:"maxKeys"`              // 最多Key值
	MaxSize              dbs.JSON `field:"maxSize"`              // 最大缓存内容尺寸
	Type                 string   `field:"type"`                 // 存储类型
	Options              dbs.JSON `field:"options"`              // 存储选项
	CreatedAt            uint64   `field:"createdAt"`            // 创建时间
	State                uint8    `field:"state"`                // 状态
	Description          string   `field:"description"`          // 描述
	Refs                 dbs.JSON `field:"refs"`                 // 默认的缓存设置
	SyncCompressionCache uint8    `field:"syncCompressionCache"` // 是否同步写入压缩缓存
	FetchTimeout         dbs.JSON `field:"fetchTimeout"`         // 预热超时时间
}

HTTPCachePolicy HTTP缓存策略

type HTTPCachePolicyDAO

type HTTPCachePolicyDAO dbs.DAO
var SharedHTTPCachePolicyDAO *HTTPCachePolicyDAO

func NewHTTPCachePolicyDAO

func NewHTTPCachePolicyDAO() *HTTPCachePolicyDAO

func (*HTTPCachePolicyDAO) ComposeCachePolicy

func (this *HTTPCachePolicyDAO) ComposeCachePolicy(tx *dbs.Tx, policyId int64, cacheMap *utils.CacheMap) (*serverconfigs.HTTPCachePolicy, error)

ComposeCachePolicy 组合配置

func (*HTTPCachePolicyDAO) CountAllEnabledHTTPCachePolicies

func (this *HTTPCachePolicyDAO) CountAllEnabledHTTPCachePolicies(tx *dbs.Tx, clusterId int64, keyword string, storageType string) (int64, error)

CountAllEnabledHTTPCachePolicies 计算可用缓存策略数量

func (*HTTPCachePolicyDAO) CreateCachePolicy

func (this *HTTPCachePolicyDAO) CreateCachePolicy(tx *dbs.Tx, isOn bool, name string, description string, capacityJSON []byte, maxSizeJSON []byte, storageType string, storageOptionsJSON []byte, syncCompressionCache bool, fetchTimeoutJSON []byte) (int64, error)

CreateCachePolicy 创建缓存策略

func (*HTTPCachePolicyDAO) CreateDefaultCachePolicy

func (this *HTTPCachePolicyDAO) CreateDefaultCachePolicy(tx *dbs.Tx, name string) (int64, error)

CreateDefaultCachePolicy 创建默认的缓存策略

func (*HTTPCachePolicyDAO) DisableHTTPCachePolicy

func (this *HTTPCachePolicyDAO) DisableHTTPCachePolicy(tx *dbs.Tx, policyId int64) error

DisableHTTPCachePolicy 禁用条目

func (*HTTPCachePolicyDAO) EnableHTTPCachePolicy

func (this *HTTPCachePolicyDAO) EnableHTTPCachePolicy(tx *dbs.Tx, id int64) error

EnableHTTPCachePolicy 启用条目

func (*HTTPCachePolicyDAO) FindAllEnabledCachePolicies

func (this *HTTPCachePolicyDAO) FindAllEnabledCachePolicies(tx *dbs.Tx) (result []*HTTPCachePolicy, err error)

FindAllEnabledCachePolicies 查找所有可用的缓存策略

func (*HTTPCachePolicyDAO) FindEnabledHTTPCachePolicy

func (this *HTTPCachePolicyDAO) FindEnabledHTTPCachePolicy(tx *dbs.Tx, id int64) (*HTTPCachePolicy, error)

FindEnabledHTTPCachePolicy 查找启用中的条目

func (*HTTPCachePolicyDAO) FindHTTPCachePolicyName

func (this *HTTPCachePolicyDAO) FindHTTPCachePolicyName(tx *dbs.Tx, id int64) (string, error)

FindHTTPCachePolicyName 根据主键查找名称

func (*HTTPCachePolicyDAO) Init

func (this *HTTPCachePolicyDAO) Init()

Init 初始化

func (*HTTPCachePolicyDAO) ListEnabledHTTPCachePolicies

func (this *HTTPCachePolicyDAO) ListEnabledHTTPCachePolicies(tx *dbs.Tx, clusterId int64, keyword string, storageType string, offset int64, size int64) ([]*serverconfigs.HTTPCachePolicy, error)

ListEnabledHTTPCachePolicies 列出单页的缓存策略

func (*HTTPCachePolicyDAO) NotifyUpdate

func (this *HTTPCachePolicyDAO) NotifyUpdate(tx *dbs.Tx, policyId int64) error

NotifyUpdate 通知更新

func (*HTTPCachePolicyDAO) UpdateCachePolicy

func (this *HTTPCachePolicyDAO) UpdateCachePolicy(tx *dbs.Tx, policyId int64, isOn bool, name string, description string, capacityJSON []byte, maxSizeJSON []byte, storageType string, storageOptionsJSON []byte, syncCompressionCache bool, fetchTimeoutJSON []byte) error

UpdateCachePolicy 修改缓存策略

func (*HTTPCachePolicyDAO) UpdatePolicyRefs

func (this *HTTPCachePolicyDAO) UpdatePolicyRefs(tx *dbs.Tx, policyId int64, refsJSON []byte) error

UpdatePolicyRefs 设置默认的缓存条件

type HTTPCachePolicyOperator

type HTTPCachePolicyOperator struct {
	Id                   any // ID
	AdminId              any // 管理员ID
	UserId               any // 用户ID
	TemplateId           any // 模版ID
	IsOn                 any // 是否启用
	Name                 any // 名称
	Capacity             any // 容量数据
	MaxKeys              any // 最多Key值
	MaxSize              any // 最大缓存内容尺寸
	Type                 any // 存储类型
	Options              any // 存储选项
	CreatedAt            any // 创建时间
	State                any // 状态
	Description          any // 描述
	Refs                 any // 默认的缓存设置
	SyncCompressionCache any // 是否同步写入压缩缓存
	FetchTimeout         any // 预热超时时间
}

func NewHTTPCachePolicyOperator

func NewHTTPCachePolicyOperator() *HTTPCachePolicyOperator

type HTTPCacheTask

type HTTPCacheTask struct {
	Id          uint64 `field:"id"`          // ID
	UserId      uint32 `field:"userId"`      // 用户ID
	Type        string `field:"type"`        // 任务类型:purge|fetch
	KeyType     string `field:"keyType"`     // Key类型
	State       uint8  `field:"state"`       // 状态
	CreatedAt   uint64 `field:"createdAt"`   // 创建时间
	DoneAt      uint64 `field:"doneAt"`      // 完成时间
	Day         string `field:"day"`         // 创建日期YYYYMMDD
	IsDone      bool   `field:"isDone"`      // 是否已完成
	IsOk        bool   `field:"isOk"`        // 是否完全成功
	IsReady     bool   `field:"isReady"`     // 是否已准备好
	Description string `field:"description"` // 描述
}

HTTPCacheTask 缓存相关任务

type HTTPCacheTaskDAO

type HTTPCacheTaskDAO dbs.DAO
var SharedHTTPCacheTaskDAO *HTTPCacheTaskDAO

func NewHTTPCacheTaskDAO

func NewHTTPCacheTaskDAO() *HTTPCacheTaskDAO

func (*HTTPCacheTaskDAO) CheckUserTask

func (this *HTTPCacheTaskDAO) CheckUserTask(tx *dbs.Tx, userId int64, taskId int64) error

CheckUserTask 检查用户任务

func (*HTTPCacheTaskDAO) CleanDays added in v1.2.1

func (this *HTTPCacheTaskDAO) CleanDays(tx *dbs.Tx, days int) error

CleanDays 清理N天以前的任务

func (*HTTPCacheTaskDAO) CleanDefaultDays added in v1.2.1

func (this *HTTPCacheTaskDAO) CleanDefaultDays(tx *dbs.Tx, defaultDays int) error

CleanDefaultDays 清除任务

func (*HTTPCacheTaskDAO) CountDoingTasks

func (this *HTTPCacheTaskDAO) CountDoingTasks(tx *dbs.Tx, userId int64) (int64, error)

CountDoingTasks 查询正在执行的任务数量

func (*HTTPCacheTaskDAO) CountTasks

func (this *HTTPCacheTaskDAO) CountTasks(tx *dbs.Tx, userId int64) (int64, error)

CountTasks 查询所有任务数量

func (*HTTPCacheTaskDAO) CreateTask

func (this *HTTPCacheTaskDAO) CreateTask(tx *dbs.Tx, userId int64, taskType HTTPCacheTaskType, keyType string, description string) (int64, error)

CreateTask 创建任务

func (*HTTPCacheTaskDAO) DisableHTTPCacheTask

func (this *HTTPCacheTaskDAO) DisableHTTPCacheTask(tx *dbs.Tx, taskId int64) error

DisableHTTPCacheTask 禁用条目

func (*HTTPCacheTaskDAO) EnableHTTPCacheTask

func (this *HTTPCacheTaskDAO) EnableHTTPCacheTask(tx *dbs.Tx, taskId int64) error

EnableHTTPCacheTask 启用条目

func (*HTTPCacheTaskDAO) FindEnabledHTTPCacheTask

func (this *HTTPCacheTaskDAO) FindEnabledHTTPCacheTask(tx *dbs.Tx, taskId int64) (*HTTPCacheTask, error)

FindEnabledHTTPCacheTask 查找启用中的条目

func (*HTTPCacheTaskDAO) ListDoingTasks

func (this *HTTPCacheTaskDAO) ListDoingTasks(tx *dbs.Tx, size int64) (result []*HTTPCacheTask, err error)

ListDoingTasks 列出需要执行的任务

func (*HTTPCacheTaskDAO) ListTasks

func (this *HTTPCacheTaskDAO) ListTasks(tx *dbs.Tx, userId int64, offset int64, size int64) (result []*HTTPCacheTask, err error)

ListTasks 列出单页任务

func (*HTTPCacheTaskDAO) NotifyChange

func (this *HTTPCacheTaskDAO) NotifyChange(tx *dbs.Tx, taskId int64) error

NotifyChange 发送通知

func (*HTTPCacheTaskDAO) ResetTask

func (this *HTTPCacheTaskDAO) ResetTask(tx *dbs.Tx, taskId int64) error

ResetTask 重置服务状态

func (*HTTPCacheTaskDAO) UpdateTaskReady

func (this *HTTPCacheTaskDAO) UpdateTaskReady(tx *dbs.Tx, taskId int64) error

UpdateTaskReady 设置任务为已准备

func (*HTTPCacheTaskDAO) UpdateTaskStatus

func (this *HTTPCacheTaskDAO) UpdateTaskStatus(tx *dbs.Tx, taskId int64, isDone bool, isOk bool) error

UpdateTaskStatus 标记任务已完成

type HTTPCacheTaskKey

type HTTPCacheTaskKey struct {
	Id        uint64   `field:"id"`        // ID
	TaskId    uint64   `field:"taskId"`    // 任务ID
	Key       string   `field:"key"`       // Key
	KeyType   string   `field:"keyType"`   // Key类型:key|prefix
	Type      string   `field:"type"`      // 操作类型
	ClusterId uint32   `field:"clusterId"` // 集群ID
	Nodes     dbs.JSON `field:"nodes"`     // 节点
	Errors    dbs.JSON `field:"errors"`    // 错误信息
	IsDone    bool     `field:"isDone"`    // 是否已完成
}

HTTPCacheTaskKey 缓存任务Key

func (*HTTPCacheTaskKey) DecodeNodes

func (this *HTTPCacheTaskKey) DecodeNodes() map[string]bool

DecodeNodes 解析已完成节点信息

type HTTPCacheTaskKeyDAO

type HTTPCacheTaskKeyDAO dbs.DAO
var SharedHTTPCacheTaskKeyDAO *HTTPCacheTaskKeyDAO

func NewHTTPCacheTaskKeyDAO

func NewHTTPCacheTaskKeyDAO() *HTTPCacheTaskKeyDAO

func (*HTTPCacheTaskKeyDAO) Clean

func (this *HTTPCacheTaskKeyDAO) Clean(tx *dbs.Tx, days int) error

Clean 清理以往的任务

func (*HTTPCacheTaskKeyDAO) CountUserTasksInDay

func (this *HTTPCacheTaskKeyDAO) CountUserTasksInDay(tx *dbs.Tx, userId int64, day string, taskType HTTPCacheTaskType) (int64, error)

CountUserTasksInDay 读取某个用户当前数量 day YYYYMMDD

func (*HTTPCacheTaskKeyDAO) CreateKey

func (this *HTTPCacheTaskKeyDAO) CreateKey(tx *dbs.Tx, taskId int64, key string, taskType HTTPCacheTaskType, keyType string, clusterId int64) (int64, error)

CreateKey 创建Key 参数:

  • clusterId 集群ID
  • nodeMapJSON 集群下节点映射,格式类似于 `{ "节点1":true, ... }`

func (*HTTPCacheTaskKeyDAO) FindAllTaskKeys

func (this *HTTPCacheTaskKeyDAO) FindAllTaskKeys(tx *dbs.Tx, taskId int64) (result []*HTTPCacheTaskKey, err error)

FindAllTaskKeys 查询某个任务下的所有Key

func (*HTTPCacheTaskKeyDAO) FindDoingTaskKeys

func (this *HTTPCacheTaskKeyDAO) FindDoingTaskKeys(tx *dbs.Tx, nodeId int64, size int64) (result []*HTTPCacheTaskKey, err error)

FindDoingTaskKeys 查询要执行的任务

func (*HTTPCacheTaskKeyDAO) ResetCacheKeysWithTaskId

func (this *HTTPCacheTaskKeyDAO) ResetCacheKeysWithTaskId(tx *dbs.Tx, taskId int64) error

ResetCacheKeysWithTaskId 重置任务下的Key状态

func (*HTTPCacheTaskKeyDAO) UpdateKeyStatus

func (this *HTTPCacheTaskKeyDAO) UpdateKeyStatus(tx *dbs.Tx, keyId int64, nodeId int64, errString string, nodesJSON []byte) error

UpdateKeyStatus 修改Key状态

type HTTPCacheTaskKeyOperator

type HTTPCacheTaskKeyOperator struct {
	Id        interface{} // ID
	TaskId    interface{} // 任务ID
	Key       interface{} // Key
	KeyType   interface{} // Key类型:key|prefix
	Type      interface{} // 操作类型
	ClusterId interface{} // 集群ID
	Nodes     interface{} // 节点
	Errors    interface{} // 错误信息
	IsDone    interface{} // 是否已完成
}

func NewHTTPCacheTaskKeyOperator

func NewHTTPCacheTaskKeyOperator() *HTTPCacheTaskKeyOperator

type HTTPCacheTaskOperator

type HTTPCacheTaskOperator struct {
	Id          any // ID
	UserId      any // 用户ID
	Type        any // 任务类型:purge|fetch
	KeyType     any // Key类型
	State       any // 状态
	CreatedAt   any // 创建时间
	DoneAt      any // 完成时间
	Day         any // 创建日期YYYYMMDD
	IsDone      any // 是否已完成
	IsOk        any // 是否完全成功
	IsReady     any // 是否已准备好
	Description any // 描述
}

func NewHTTPCacheTaskOperator

func NewHTTPCacheTaskOperator() *HTTPCacheTaskOperator

type HTTPCacheTaskType

type HTTPCacheTaskType = string
const (
	HTTPCacheTaskTypePurge HTTPCacheTaskType = "purge"
	HTTPCacheTaskTypeFetch HTTPCacheTaskType = "fetch"
)

type HTTPDeflatePolicy

type HTTPDeflatePolicy struct {
	Id        uint32   `field:"id"`        // ID
	AdminId   uint32   `field:"adminId"`   // 管理员ID
	UserId    uint32   `field:"userId"`    // 用户ID
	IsOn      bool     `field:"isOn"`      // 是否启用
	Level     uint32   `field:"level"`     // 压缩级别
	MinLength dbs.JSON `field:"minLength"` // 可压缩最小值
	MaxLength dbs.JSON `field:"maxLength"` // 可压缩最大值
	State     uint8    `field:"state"`     // 状态
	CreatedAt uint64   `field:"createdAt"` // 创建时间
	Conds     dbs.JSON `field:"conds"`     // 条件
}

HTTPDeflatePolicy Gzip配置

type HTTPDeflatePolicyDAO

type HTTPDeflatePolicyDAO dbs.DAO
var SharedHTTPDeflatePolicyDAO *HTTPDeflatePolicyDAO

func NewHTTPDeflatePolicyDAO

func NewHTTPDeflatePolicyDAO() *HTTPDeflatePolicyDAO

func (*HTTPDeflatePolicyDAO) ComposeDeflateConfig

func (this *HTTPDeflatePolicyDAO) ComposeDeflateConfig(tx *dbs.Tx, policyId int64) (*serverconfigs.HTTPDeflateCompressionConfig, error)

ComposeDeflateConfig 组合配置

func (*HTTPDeflatePolicyDAO) CreatePolicy

func (this *HTTPDeflatePolicyDAO) CreatePolicy(tx *dbs.Tx, level int, minLengthJSON []byte, maxLengthJSON []byte, condsJSON []byte) (int64, error)

CreatePolicy 创建策略

func (*HTTPDeflatePolicyDAO) DisableHTTPDeflatePolicy

func (this *HTTPDeflatePolicyDAO) DisableHTTPDeflatePolicy(tx *dbs.Tx, id int64) error

DisableHTTPDeflatePolicy 禁用条目

func (*HTTPDeflatePolicyDAO) EnableHTTPDeflatePolicy

func (this *HTTPDeflatePolicyDAO) EnableHTTPDeflatePolicy(tx *dbs.Tx, id int64) error

EnableHTTPDeflatePolicy 启用条目

func (*HTTPDeflatePolicyDAO) FindEnabledHTTPDeflatePolicy

func (this *HTTPDeflatePolicyDAO) FindEnabledHTTPDeflatePolicy(tx *dbs.Tx, id int64) (*HTTPDeflatePolicy, error)

FindEnabledHTTPDeflatePolicy 查找启用中的条目

func (*HTTPDeflatePolicyDAO) NotifyUpdate

func (this *HTTPDeflatePolicyDAO) NotifyUpdate(tx *dbs.Tx, policyId int64) error

NotifyUpdate 通知更新

func (*HTTPDeflatePolicyDAO) UpdatePolicy

func (this *HTTPDeflatePolicyDAO) UpdatePolicy(tx *dbs.Tx, policyId int64, level int, minLengthJSON []byte, maxLengthJSON []byte, condsJSON []byte) error

UpdatePolicy 修改Policy

type HTTPDeflatePolicyOperator

type HTTPDeflatePolicyOperator struct {
	Id        interface{} // ID
	AdminId   interface{} // 管理员ID
	UserId    interface{} // 用户ID
	IsOn      interface{} // 是否启用
	Level     interface{} // 压缩级别
	MinLength interface{} // 可压缩最小值
	MaxLength interface{} // 可压缩最大值
	State     interface{} // 状态
	CreatedAt interface{} // 创建时间
	Conds     interface{} // 条件
}

func NewHTTPDeflatePolicyOperator

func NewHTTPDeflatePolicyOperator() *HTTPDeflatePolicyOperator

type HTTPFastcgi

type HTTPFastcgi struct {
	Id              uint64   `field:"id"`              // ID
	AdminId         uint32   `field:"adminId"`         // 管理员ID
	UserId          uint32   `field:"userId"`          // 用户ID
	IsOn            bool     `field:"isOn"`            // 是否启用
	Address         string   `field:"address"`         // 地址
	Params          dbs.JSON `field:"params"`          // 参数
	ReadTimeout     dbs.JSON `field:"readTimeout"`     // 读取超时
	ConnTimeout     dbs.JSON `field:"connTimeout"`     // 连接超时
	PoolSize        uint32   `field:"poolSize"`        // 连接池尺寸
	PathInfoPattern string   `field:"pathInfoPattern"` // PATH_INFO匹配
	State           uint8    `field:"state"`           // 状态
}

HTTPFastcgi Fastcgi设置

type HTTPFastcgiDAO

type HTTPFastcgiDAO dbs.DAO
var SharedHTTPFastcgiDAO *HTTPFastcgiDAO

func NewHTTPFastcgiDAO

func NewHTTPFastcgiDAO() *HTTPFastcgiDAO

func (*HTTPFastcgiDAO) CheckUserFastcgi

func (this *HTTPFastcgiDAO) CheckUserFastcgi(tx *dbs.Tx, userId int64, fastcgiId int64) error

CheckUserFastcgi 检查用户Fastcgi权限

func (*HTTPFastcgiDAO) ComposeFastcgiConfig

func (this *HTTPFastcgiDAO) ComposeFastcgiConfig(tx *dbs.Tx, fastcgiId int64) (*serverconfigs.HTTPFastcgiConfig, error)

ComposeFastcgiConfig 组合配置

func (*HTTPFastcgiDAO) CreateFastcgi

func (this *HTTPFastcgiDAO) CreateFastcgi(tx *dbs.Tx, adminId int64, userId int64, isOn bool, address string, paramsJSON []byte, readTimeoutJSON []byte, connTimeoutJSON []byte, poolSize int32, pathInfoPattern string) (int64, error)

CreateFastcgi 创建Fastcgi

func (*HTTPFastcgiDAO) DisableHTTPFastcgi

func (this *HTTPFastcgiDAO) DisableHTTPFastcgi(tx *dbs.Tx, id int64) error

DisableHTTPFastcgi 禁用条目

func (*HTTPFastcgiDAO) EnableHTTPFastcgi

func (this *HTTPFastcgiDAO) EnableHTTPFastcgi(tx *dbs.Tx, id int64) error

EnableHTTPFastcgi 启用条目

func (*HTTPFastcgiDAO) FindEnabledHTTPFastcgi

func (this *HTTPFastcgiDAO) FindEnabledHTTPFastcgi(tx *dbs.Tx, id int64) (*HTTPFastcgi, error)

FindEnabledHTTPFastcgi 查找启用中的条目

func (*HTTPFastcgiDAO) NotifyUpdate

func (this *HTTPFastcgiDAO) NotifyUpdate(tx *dbs.Tx, fastcgiId int64) error

NotifyUpdate 通知更新

func (*HTTPFastcgiDAO) UpdateFastcgi

func (this *HTTPFastcgiDAO) UpdateFastcgi(tx *dbs.Tx, fastcgiId int64, isOn bool, address string, paramsJSON []byte, readTimeoutJSON []byte, connTimeoutJSON []byte, poolSize int32, pathInfoPattern string) error

UpdateFastcgi 修改Fastcgi

type HTTPFastcgiOperator

type HTTPFastcgiOperator struct {
	Id              interface{} // ID
	AdminId         interface{} // 管理员ID
	UserId          interface{} // 用户ID
	IsOn            interface{} // 是否启用
	Address         interface{} // 地址
	Params          interface{} // 参数
	ReadTimeout     interface{} // 读取超时
	ConnTimeout     interface{} // 连接超时
	PoolSize        interface{} // 连接池尺寸
	PathInfoPattern interface{} // PATH_INFO匹配
	State           interface{} // 状态
}

func NewHTTPFastcgiOperator

func NewHTTPFastcgiOperator() *HTTPFastcgiOperator

type HTTPFirewallPolicy

type HTTPFirewallPolicy struct {
	Id                 uint32   `field:"id"`                 // ID
	TemplateId         uint32   `field:"templateId"`         // 模版ID
	AdminId            uint32   `field:"adminId"`            // 管理员ID
	UserId             uint32   `field:"userId"`             // 用户ID
	ServerId           uint32   `field:"serverId"`           // 服务ID
	GroupId            uint32   `field:"groupId"`            // 服务分组ID
	State              uint8    `field:"state"`              // 状态
	CreatedAt          uint64   `field:"createdAt"`          // 创建时间
	IsOn               bool     `field:"isOn"`               // 是否启用
	Name               string   `field:"name"`               // 名称
	Description        string   `field:"description"`        // 描述
	Inbound            dbs.JSON `field:"inbound"`            // 入站规则
	Outbound           dbs.JSON `field:"outbound"`           // 出站规则
	BlockOptions       dbs.JSON `field:"blockOptions"`       // BLOCK选项
	CaptchaOptions     dbs.JSON `field:"captchaOptions"`     // 验证码选项
	Mode               string   `field:"mode"`               // 模式
	UseLocalFirewall   uint8    `field:"useLocalFirewall"`   // 是否自动使用本地防火墙
	SynFlood           dbs.JSON `field:"synFlood"`           // SynFlood防御设置
	Log                dbs.JSON `field:"log"`                // 日志配置
	MaxRequestBodySize uint32   `field:"maxRequestBodySize"` // 可以检查的最大请求内容尺寸
	DenyCountryHTML    string   `field:"denyCountryHTML"`    // 区域封禁提示
	DenyProvinceHTML   string   `field:"denyProvinceHTML"`   // 省份封禁提示
}

HTTPFirewallPolicy HTTP防火墙

type HTTPFirewallPolicyDAO

type HTTPFirewallPolicyDAO dbs.DAO
var SharedHTTPFirewallPolicyDAO *HTTPFirewallPolicyDAO

func NewHTTPFirewallPolicyDAO

func NewHTTPFirewallPolicyDAO() *HTTPFirewallPolicyDAO

func (*HTTPFirewallPolicyDAO) CheckUserFirewallPolicy

func (this *HTTPFirewallPolicyDAO) CheckUserFirewallPolicy(tx *dbs.Tx, userId int64, firewallPolicyId int64) error

CheckUserFirewallPolicy 检查用户防火墙策略

func (*HTTPFirewallPolicyDAO) ComposeFirewallPolicy

func (this *HTTPFirewallPolicyDAO) ComposeFirewallPolicy(tx *dbs.Tx, policyId int64, forNode bool, cacheMap *utils.CacheMap) (*firewallconfigs.HTTPFirewallPolicy, error)

ComposeFirewallPolicy 组合策略配置

func (*HTTPFirewallPolicyDAO) CountAllEnabledFirewallPolicies

func (this *HTTPFirewallPolicyDAO) CountAllEnabledFirewallPolicies(tx *dbs.Tx, clusterId int64, keyword string) (int64, error)

CountAllEnabledFirewallPolicies 计算所有可用的策略数量

func (*HTTPFirewallPolicyDAO) CreateDefaultFirewallPolicy

func (this *HTTPFirewallPolicyDAO) CreateDefaultFirewallPolicy(tx *dbs.Tx, name string) (int64, error)

CreateDefaultFirewallPolicy 创建默认的WAF策略

func (*HTTPFirewallPolicyDAO) CreateFirewallPolicy

func (this *HTTPFirewallPolicyDAO) CreateFirewallPolicy(tx *dbs.Tx, userId int64, serverGroupId int64, serverId int64, isOn bool, name string, description string, inboundJSON []byte, outboundJSON []byte) (int64, error)

CreateFirewallPolicy 创建策略

func (*HTTPFirewallPolicyDAO) DisableHTTPFirewallPolicy

func (this *HTTPFirewallPolicyDAO) DisableHTTPFirewallPolicy(tx *dbs.Tx, policyId int64) error

DisableHTTPFirewallPolicy 禁用条目

func (*HTTPFirewallPolicyDAO) EnableHTTPFirewallPolicy

func (this *HTTPFirewallPolicyDAO) EnableHTTPFirewallPolicy(tx *dbs.Tx, id int64) error

EnableHTTPFirewallPolicy 启用条目

func (*HTTPFirewallPolicyDAO) FindAllEnabledFirewallPolicies

func (this *HTTPFirewallPolicyDAO) FindAllEnabledFirewallPolicies(tx *dbs.Tx) (result []*HTTPFirewallPolicy, err error)

FindAllEnabledFirewallPolicies 查找所有可用策略

func (*HTTPFirewallPolicyDAO) FindEnabledFirewallPolicyIdWithRuleGroupId

func (this *HTTPFirewallPolicyDAO) FindEnabledFirewallPolicyIdWithRuleGroupId(tx *dbs.Tx, ruleGroupId int64) (int64, error)

FindEnabledFirewallPolicyIdWithRuleGroupId 查找包含某个规则分组的策略ID

func (*HTTPFirewallPolicyDAO) FindEnabledFirewallPolicyIdsWithIPListId

func (this *HTTPFirewallPolicyDAO) FindEnabledFirewallPolicyIdsWithIPListId(tx *dbs.Tx, ipListId int64) ([]int64, error)

FindEnabledFirewallPolicyIdsWithIPListId 查找包含某个IPList的所有策略 TODO 改成通过 serverId 查询

func (*HTTPFirewallPolicyDAO) FindEnabledFirewallPolicyWithIPListId

func (this *HTTPFirewallPolicyDAO) FindEnabledFirewallPolicyWithIPListId(tx *dbs.Tx, ipListId int64) (*HTTPFirewallPolicy, error)

FindEnabledFirewallPolicyWithIPListId 查找使用某个IPList的策略 TODO 改成通过 serverId 查询

func (*HTTPFirewallPolicyDAO) FindEnabledHTTPFirewallPolicy

func (this *HTTPFirewallPolicyDAO) FindEnabledHTTPFirewallPolicy(tx *dbs.Tx, id int64) (*HTTPFirewallPolicy, error)

FindEnabledHTTPFirewallPolicy 查找启用中的条目

func (*HTTPFirewallPolicyDAO) FindEnabledHTTPFirewallPolicyBasic

func (this *HTTPFirewallPolicyDAO) FindEnabledHTTPFirewallPolicyBasic(tx *dbs.Tx, policyId int64) (*HTTPFirewallPolicy, error)

FindEnabledHTTPFirewallPolicyBasic 获取WAF策略基本信息

func (*HTTPFirewallPolicyDAO) FindFirewallPolicyIdsWithServerId

func (this *HTTPFirewallPolicyDAO) FindFirewallPolicyIdsWithServerId(tx *dbs.Tx, serverId int64) ([]int64, error)

FindFirewallPolicyIdsWithServerId 查找服务独立关联的策略IDs

func (*HTTPFirewallPolicyDAO) FindHTTPFirewallPolicyName

func (this *HTTPFirewallPolicyDAO) FindHTTPFirewallPolicyName(tx *dbs.Tx, id int64) (string, error)

FindHTTPFirewallPolicyName 根据主键查找名称

func (*HTTPFirewallPolicyDAO) Init

func (this *HTTPFirewallPolicyDAO) Init()

Init 初始化

func (*HTTPFirewallPolicyDAO) ListEnabledFirewallPolicies

func (this *HTTPFirewallPolicyDAO) ListEnabledFirewallPolicies(tx *dbs.Tx, clusterId int64, keyword string, offset int64, size int64) (result []*HTTPFirewallPolicy, err error)

ListEnabledFirewallPolicies 列出单页的策略

func (*HTTPFirewallPolicyDAO) NotifyDisable

func (this *HTTPFirewallPolicyDAO) NotifyDisable(tx *dbs.Tx, policyId int64) error

NotifyDisable 通知禁用

func (*HTTPFirewallPolicyDAO) NotifyUpdate

func (this *HTTPFirewallPolicyDAO) NotifyUpdate(tx *dbs.Tx, policyId int64) error

NotifyUpdate 通知更新

func (*HTTPFirewallPolicyDAO) UpdateFirewallPolicy

func (this *HTTPFirewallPolicyDAO) UpdateFirewallPolicy(tx *dbs.Tx,
	policyId int64,
	isOn bool,
	name string,
	description string,
	inboundJSON []byte,
	outboundJSON []byte,
	blockOptionsJSON []byte,
	captchaOptionsJSON []byte,
	mode firewallconfigs.FirewallMode,
	useLocalFirewall bool,
	synFloodConfig *firewallconfigs.SYNFloodConfig,
	logConfig *firewallconfigs.HTTPFirewallPolicyLogConfig,
	maxRequestBodySize int64,
	denyCountryHTML string,
	denyProvinceHTML string) error

UpdateFirewallPolicy 修改策略

func (*HTTPFirewallPolicyDAO) UpdateFirewallPolicyInbound

func (this *HTTPFirewallPolicyDAO) UpdateFirewallPolicyInbound(tx *dbs.Tx, policyId int64, inboundJSON []byte) error

UpdateFirewallPolicyInbound 修改策略的Inbound

func (*HTTPFirewallPolicyDAO) UpdateFirewallPolicyInboundAndOutbound

func (this *HTTPFirewallPolicyDAO) UpdateFirewallPolicyInboundAndOutbound(tx *dbs.Tx, policyId int64, inboundJSON []byte, outboundJSON []byte, shouldNotify bool) error

UpdateFirewallPolicyInboundAndOutbound 修改策略的Inbound和Outbound

func (*HTTPFirewallPolicyDAO) UpdateFirewallPolicyInboundRegion added in v1.2.10

func (this *HTTPFirewallPolicyDAO) UpdateFirewallPolicyInboundRegion(tx *dbs.Tx, policyId int64, regionConfig *firewallconfigs.HTTPFirewallRegionConfig) error

UpdateFirewallPolicyInboundRegion 修改入站封禁区域设置

func (*HTTPFirewallPolicyDAO) UpdateFirewallPolicyServerId

func (this *HTTPFirewallPolicyDAO) UpdateFirewallPolicyServerId(tx *dbs.Tx, policyId int64, serverId int64) error

UpdateFirewallPolicyServerId 设置某个策略所属的服务ID

type HTTPFirewallPolicyOperator

type HTTPFirewallPolicyOperator struct {
	Id                 any // ID
	TemplateId         any // 模版ID
	AdminId            any // 管理员ID
	UserId             any // 用户ID
	ServerId           any // 服务ID
	GroupId            any // 服务分组ID
	State              any // 状态
	CreatedAt          any // 创建时间
	IsOn               any // 是否启用
	Name               any // 名称
	Description        any // 描述
	Inbound            any // 入站规则
	Outbound           any // 出站规则
	BlockOptions       any // BLOCK选项
	CaptchaOptions     any // 验证码选项
	Mode               any // 模式
	UseLocalFirewall   any // 是否自动使用本地防火墙
	SynFlood           any // SynFlood防御设置
	Log                any // 日志配置
	MaxRequestBodySize any // 可以检查的最大请求内容尺寸
	DenyCountryHTML    any // 区域封禁提示
	DenyProvinceHTML   any // 省份封禁提示
}

func NewHTTPFirewallPolicyOperator

func NewHTTPFirewallPolicyOperator() *HTTPFirewallPolicyOperator

type HTTPFirewallRule

type HTTPFirewallRule struct {
	Id                uint32   `field:"id"`                // ID
	IsOn              bool     `field:"isOn"`              // 是否启用
	Description       string   `field:"description"`       // 说明
	Param             string   `field:"param"`             // 参数
	ParamFilters      dbs.JSON `field:"paramFilters"`      // 处理器
	Operator          string   `field:"operator"`          // 操作符
	Value             string   `field:"value"`             // 对比值
	IsCaseInsensitive bool     `field:"isCaseInsensitive"` // 是否大小写不敏感
	CheckpointOptions dbs.JSON `field:"checkpointOptions"` // 检查点参数
	State             uint8    `field:"state"`             // 状态
	CreatedAt         uint64   `field:"createdAt"`         // 创建时间
	AdminId           uint32   `field:"adminId"`           // 管理员ID
	UserId            uint32   `field:"userId"`            // 用户ID
}

HTTPFirewallRule 防火墙规则

type HTTPFirewallRuleDAO

type HTTPFirewallRuleDAO dbs.DAO
var SharedHTTPFirewallRuleDAO *HTTPFirewallRuleDAO

func NewHTTPFirewallRuleDAO

func NewHTTPFirewallRuleDAO() *HTTPFirewallRuleDAO

func (*HTTPFirewallRuleDAO) ComposeFirewallRule

func (this *HTTPFirewallRuleDAO) ComposeFirewallRule(tx *dbs.Tx, ruleId int64) (*firewallconfigs.HTTPFirewallRule, error)

ComposeFirewallRule 组合配置

func (*HTTPFirewallRuleDAO) CreateOrUpdateRuleFromConfig

func (this *HTTPFirewallRuleDAO) CreateOrUpdateRuleFromConfig(tx *dbs.Tx, ruleConfig *firewallconfigs.HTTPFirewallRule) (int64, error)

CreateOrUpdateRuleFromConfig 从配置中配置规则

func (*HTTPFirewallRuleDAO) DisableHTTPFirewallRule

func (this *HTTPFirewallRuleDAO) DisableHTTPFirewallRule(tx *dbs.Tx, ruleId int64) error

DisableHTTPFirewallRule 禁用条目

func (*HTTPFirewallRuleDAO) EnableHTTPFirewallRule

func (this *HTTPFirewallRuleDAO) EnableHTTPFirewallRule(tx *dbs.Tx, id int64) error

EnableHTTPFirewallRule 启用条目

func (*HTTPFirewallRuleDAO) FindEnabledHTTPFirewallRule

func (this *HTTPFirewallRuleDAO) FindEnabledHTTPFirewallRule(tx *dbs.Tx, id int64) (*HTTPFirewallRule, error)

FindEnabledHTTPFirewallRule 查找启用中的条目

func (*HTTPFirewallRuleDAO) Init

func (this *HTTPFirewallRuleDAO) Init()

Init 初始化

func (*HTTPFirewallRuleDAO) NotifyUpdate

func (this *HTTPFirewallRuleDAO) NotifyUpdate(tx *dbs.Tx, ruleId int64) error

NotifyUpdate 通知更新

type HTTPFirewallRuleGroup

type HTTPFirewallRuleGroup struct {
	Id          uint32   `field:"id"`          // ID
	IsOn        bool     `field:"isOn"`        // 是否启用
	Name        string   `field:"name"`        // 名称
	Description string   `field:"description"` // 描述
	Code        string   `field:"code"`        // 代号
	IsTemplate  bool     `field:"isTemplate"`  // 是否为预置模板
	AdminId     uint32   `field:"adminId"`     // 管理员ID
	UserId      uint32   `field:"userId"`      // 用户ID
	State       uint8    `field:"state"`       // 状态
	Sets        dbs.JSON `field:"sets"`        // 规则集列表
	CreatedAt   uint64   `field:"createdAt"`   // 创建时间
}

HTTPFirewallRuleGroup 防火墙规则分组

type HTTPFirewallRuleGroupDAO

type HTTPFirewallRuleGroupDAO dbs.DAO
var SharedHTTPFirewallRuleGroupDAO *HTTPFirewallRuleGroupDAO

func NewHTTPFirewallRuleGroupDAO

func NewHTTPFirewallRuleGroupDAO() *HTTPFirewallRuleGroupDAO

func (*HTTPFirewallRuleGroupDAO) CheckUserRuleGroup

func (this *HTTPFirewallRuleGroupDAO) CheckUserRuleGroup(tx *dbs.Tx, userId int64, groupId int64) error

CheckUserRuleGroup 检查用户所属分组

func (*HTTPFirewallRuleGroupDAO) ComposeFirewallRuleGroup

func (this *HTTPFirewallRuleGroupDAO) ComposeFirewallRuleGroup(tx *dbs.Tx, groupId int64, forNode bool) (*firewallconfigs.HTTPFirewallRuleGroup, error)

ComposeFirewallRuleGroup 组合配置

func (*HTTPFirewallRuleGroupDAO) CreateGroup

func (this *HTTPFirewallRuleGroupDAO) CreateGroup(tx *dbs.Tx, isOn bool, name string, code string, description string) (int64, error)

CreateGroup 创建分组

func (*HTTPFirewallRuleGroupDAO) CreateGroupFromConfig

func (this *HTTPFirewallRuleGroupDAO) CreateGroupFromConfig(tx *dbs.Tx, groupConfig *firewallconfigs.HTTPFirewallRuleGroup) (int64, error)

CreateGroupFromConfig 从配置中创建分组

func (*HTTPFirewallRuleGroupDAO) DisableHTTPFirewallRuleGroup

func (this *HTTPFirewallRuleGroupDAO) DisableHTTPFirewallRuleGroup(tx *dbs.Tx, id int64) error

DisableHTTPFirewallRuleGroup 禁用条目

func (*HTTPFirewallRuleGroupDAO) EnableHTTPFirewallRuleGroup

func (this *HTTPFirewallRuleGroupDAO) EnableHTTPFirewallRuleGroup(tx *dbs.Tx, id int64) error

EnableHTTPFirewallRuleGroup 启用条目

func (*HTTPFirewallRuleGroupDAO) FindEnabledHTTPFirewallRuleGroup

func (this *HTTPFirewallRuleGroupDAO) FindEnabledHTTPFirewallRuleGroup(tx *dbs.Tx, id int64) (*HTTPFirewallRuleGroup, error)

FindEnabledHTTPFirewallRuleGroup 查找启用中的条目

func (*HTTPFirewallRuleGroupDAO) FindHTTPFirewallRuleGroupName

func (this *HTTPFirewallRuleGroupDAO) FindHTTPFirewallRuleGroupName(tx *dbs.Tx, id int64) (string, error)

FindHTTPFirewallRuleGroupName 根据主键查找名称

func (*HTTPFirewallRuleGroupDAO) FindRuleGroupIdWithRuleSetId

func (this *HTTPFirewallRuleGroupDAO) FindRuleGroupIdWithRuleSetId(tx *dbs.Tx, setId int64) (int64, error)

FindRuleGroupIdWithRuleSetId 根据规则集查找规则分组

func (*HTTPFirewallRuleGroupDAO) Init

func (this *HTTPFirewallRuleGroupDAO) Init()

Init 初始化

func (*HTTPFirewallRuleGroupDAO) NotifyUpdate

func (this *HTTPFirewallRuleGroupDAO) NotifyUpdate(tx *dbs.Tx, groupId int64) error

NotifyUpdate 通知更新

func (*HTTPFirewallRuleGroupDAO) UpdateGroup

func (this *HTTPFirewallRuleGroupDAO) UpdateGroup(tx *dbs.Tx, groupId int64, isOn bool, name string, code string, description string) error

UpdateGroup 修改分组

func (*HTTPFirewallRuleGroupDAO) UpdateGroupIsOn

func (this *HTTPFirewallRuleGroupDAO) UpdateGroupIsOn(tx *dbs.Tx, groupId int64, isOn bool) error

UpdateGroupIsOn 修改开启状态

func (*HTTPFirewallRuleGroupDAO) UpdateGroupSets

func (this *HTTPFirewallRuleGroupDAO) UpdateGroupSets(tx *dbs.Tx, groupId int64, setRefsJSON []byte) error

UpdateGroupSets 修改分组中的规则集

type HTTPFirewallRuleGroupOperator

type HTTPFirewallRuleGroupOperator struct {
	Id          interface{} // ID
	IsOn        interface{} // 是否启用
	Name        interface{} // 名称
	Description interface{} // 描述
	Code        interface{} // 代号
	IsTemplate  interface{} // 是否为预置模板
	AdminId     interface{} // 管理员ID
	UserId      interface{} // 用户ID
	State       interface{} // 状态
	Sets        interface{} // 规则集列表
	CreatedAt   interface{} // 创建时间
}

func NewHTTPFirewallRuleGroupOperator

func NewHTTPFirewallRuleGroupOperator() *HTTPFirewallRuleGroupOperator

type HTTPFirewallRuleOperator

type HTTPFirewallRuleOperator struct {
	Id                interface{} // ID
	IsOn              interface{} // 是否启用
	Description       interface{} // 说明
	Param             interface{} // 参数
	ParamFilters      interface{} // 处理器
	Operator          interface{} // 操作符
	Value             interface{} // 对比值
	IsCaseInsensitive interface{} // 是否大小写不敏感
	CheckpointOptions interface{} // 检查点参数
	State             interface{} // 状态
	CreatedAt         interface{} // 创建时间
	AdminId           interface{} // 管理员ID
	UserId            interface{} // 用户ID
}

func NewHTTPFirewallRuleOperator

func NewHTTPFirewallRuleOperator() *HTTPFirewallRuleOperator

type HTTPFirewallRuleSet

type HTTPFirewallRuleSet struct {
	Id            uint32   `field:"id"`            // ID
	IsOn          bool     `field:"isOn"`          // 是否启用
	Code          string   `field:"code"`          // 代号
	Name          string   `field:"name"`          // 名称
	Description   string   `field:"description"`   // 描述
	CreatedAt     uint64   `field:"createdAt"`     // 创建时间
	Rules         dbs.JSON `field:"rules"`         // 规则列表
	Connector     string   `field:"connector"`     // 规则之间的关系
	State         uint8    `field:"state"`         // 状态
	AdminId       uint32   `field:"adminId"`       // 管理员ID
	UserId        uint32   `field:"userId"`        // 用户ID
	Action        string   `field:"action"`        // 执行的动作(过期)
	ActionOptions dbs.JSON `field:"actionOptions"` // 动作的选项(过期)
	Actions       dbs.JSON `field:"actions"`       // 一组动作
	IgnoreLocal   uint8    `field:"ignoreLocal"`   // 忽略局域网请求
}

HTTPFirewallRuleSet 防火墙规则集

type HTTPFirewallRuleSetDAO

type HTTPFirewallRuleSetDAO dbs.DAO
var SharedHTTPFirewallRuleSetDAO *HTTPFirewallRuleSetDAO

func NewHTTPFirewallRuleSetDAO

func NewHTTPFirewallRuleSetDAO() *HTTPFirewallRuleSetDAO

func (*HTTPFirewallRuleSetDAO) CheckUserRuleSet

func (this *HTTPFirewallRuleSetDAO) CheckUserRuleSet(tx *dbs.Tx, userId int64, setId int64) error

CheckUserRuleSet 检查用户

func (*HTTPFirewallRuleSetDAO) ComposeFirewallRuleSet

func (this *HTTPFirewallRuleSetDAO) ComposeFirewallRuleSet(tx *dbs.Tx, setId int64, forNode bool) (*firewallconfigs.HTTPFirewallRuleSet, error)

ComposeFirewallRuleSet 组合配置

func (*HTTPFirewallRuleSetDAO) CreateOrUpdateSetFromConfig

func (this *HTTPFirewallRuleSetDAO) CreateOrUpdateSetFromConfig(tx *dbs.Tx, setConfig *firewallconfigs.HTTPFirewallRuleSet) (int64, error)

CreateOrUpdateSetFromConfig 从配置中创建规则集

func (*HTTPFirewallRuleSetDAO) DisableHTTPFirewallRuleSet

func (this *HTTPFirewallRuleSetDAO) DisableHTTPFirewallRuleSet(tx *dbs.Tx, ruleSetId int64) error

DisableHTTPFirewallRuleSet 禁用条目

func (*HTTPFirewallRuleSetDAO) EnableHTTPFirewallRuleSet

func (this *HTTPFirewallRuleSetDAO) EnableHTTPFirewallRuleSet(tx *dbs.Tx, id int64) error

EnableHTTPFirewallRuleSet 启用条目

func (*HTTPFirewallRuleSetDAO) FindAllEnabledRuleSetIdsWithIPListId added in v1.2.9

func (this *HTTPFirewallRuleSetDAO) FindAllEnabledRuleSetIdsWithIPListId(tx *dbs.Tx, ipListId int64) (setIds []int64, err error)

FindAllEnabledRuleSetIdsWithIPListId 根据IP名单ID查找对应动作的WAF规则集

func (*HTTPFirewallRuleSetDAO) FindEnabledHTTPFirewallRuleSet

func (this *HTTPFirewallRuleSetDAO) FindEnabledHTTPFirewallRuleSet(tx *dbs.Tx, id int64) (*HTTPFirewallRuleSet, error)

FindEnabledHTTPFirewallRuleSet 查找启用中的条目

func (*HTTPFirewallRuleSetDAO) FindEnabledRuleSetIdWithRuleId

func (this *HTTPFirewallRuleSetDAO) FindEnabledRuleSetIdWithRuleId(tx *dbs.Tx, ruleId int64) (int64, error)

FindEnabledRuleSetIdWithRuleId 根据规则查找规则集

func (*HTTPFirewallRuleSetDAO) FindHTTPFirewallRuleSetName

func (this *HTTPFirewallRuleSetDAO) FindHTTPFirewallRuleSetName(tx *dbs.Tx, id int64) (string, error)

FindHTTPFirewallRuleSetName 根据主键查找名称

func (*HTTPFirewallRuleSetDAO) Init

func (this *HTTPFirewallRuleSetDAO) Init()

Init 初始化

func (*HTTPFirewallRuleSetDAO) NotifyUpdate

func (this *HTTPFirewallRuleSetDAO) NotifyUpdate(tx *dbs.Tx, setId int64) error

NotifyUpdate 通知更新

func (*HTTPFirewallRuleSetDAO) UpdateRuleSetIsOn

func (this *HTTPFirewallRuleSetDAO) UpdateRuleSetIsOn(tx *dbs.Tx, ruleSetId int64, isOn bool) error

UpdateRuleSetIsOn 设置是否启用

type HTTPFirewallRuleSetOperator

type HTTPFirewallRuleSetOperator struct {
	Id            interface{} // ID
	IsOn          interface{} // 是否启用
	Code          interface{} // 代号
	Name          interface{} // 名称
	Description   interface{} // 描述
	CreatedAt     interface{} // 创建时间
	Rules         interface{} // 规则列表
	Connector     interface{} // 规则之间的关系
	State         interface{} // 状态
	AdminId       interface{} // 管理员ID
	UserId        interface{} // 用户ID
	Action        interface{} // 执行的动作(过期)
	ActionOptions interface{} // 动作的选项(过期)
	Actions       interface{} // 一组动作
	IgnoreLocal   interface{} // 忽略局域网请求
}

func NewHTTPFirewallRuleSetOperator

func NewHTTPFirewallRuleSetOperator() *HTTPFirewallRuleSetOperator

type HTTPGzip

type HTTPGzip struct {
	Id        uint32   `field:"id"`        // ID
	AdminId   uint32   `field:"adminId"`   // 管理员ID
	UserId    uint32   `field:"userId"`    // 用户ID
	IsOn      bool     `field:"isOn"`      // 是否启用
	Level     uint32   `field:"level"`     // 压缩级别
	MinLength dbs.JSON `field:"minLength"` // 可压缩最小值
	MaxLength dbs.JSON `field:"maxLength"` // 可压缩最大值
	State     uint8    `field:"state"`     // 状态
	CreatedAt uint64   `field:"createdAt"` // 创建时间
	Conds     dbs.JSON `field:"conds"`     // 条件
}

HTTPGzip Gzip配置

func (*HTTPGzip) DecodeMaxLength

func (this *HTTPGzip) DecodeMaxLength() (*shared.SizeCapacity, error)

DecodeMaxLength 解析最大长度

func (*HTTPGzip) DecodeMinLength

func (this *HTTPGzip) DecodeMinLength() (*shared.SizeCapacity, error)

DecodeMinLength 解析最小长度

type HTTPGzipDAO

type HTTPGzipDAO dbs.DAO
var SharedHTTPGzipDAO *HTTPGzipDAO

func NewHTTPGzipDAO

func NewHTTPGzipDAO() *HTTPGzipDAO

func (*HTTPGzipDAO) ComposeGzipConfig

func (this *HTTPGzipDAO) ComposeGzipConfig(tx *dbs.Tx, gzipId int64) (*serverconfigs.HTTPGzipCompressionConfig, error)

ComposeGzipConfig 组合配置

func (*HTTPGzipDAO) CreateGzip

func (this *HTTPGzipDAO) CreateGzip(tx *dbs.Tx, level int, minLengthJSON []byte, maxLengthJSON []byte, condsJSON []byte) (int64, error)

CreateGzip 创建Gzip

func (*HTTPGzipDAO) DisableHTTPGzip

func (this *HTTPGzipDAO) DisableHTTPGzip(tx *dbs.Tx, gzipId int64) error

DisableHTTPGzip 禁用条目

func (*HTTPGzipDAO) EnableHTTPGzip

func (this *HTTPGzipDAO) EnableHTTPGzip(tx *dbs.Tx, id int64) error

EnableHTTPGzip 启用条目

func (*HTTPGzipDAO) FindEnabledHTTPGzip

func (this *HTTPGzipDAO) FindEnabledHTTPGzip(tx *dbs.Tx, id int64) (*HTTPGzip, error)

FindEnabledHTTPGzip 查找启用中的条目

func (*HTTPGzipDAO) Init

func (this *HTTPGzipDAO) Init()

Init 初始化

func (*HTTPGzipDAO) NotifyUpdate

func (this *HTTPGzipDAO) NotifyUpdate(tx *dbs.Tx, gzipId int64) error

NotifyUpdate 通知更新

func (*HTTPGzipDAO) UpdateGzip

func (this *HTTPGzipDAO) UpdateGzip(tx *dbs.Tx, gzipId int64, level int, minLengthJSON []byte, maxLengthJSON []byte, condsJSON []byte) error

UpdateGzip 修改Gzip

type HTTPGzipOperator

type HTTPGzipOperator struct {
	Id        interface{} // ID
	AdminId   interface{} // 管理员ID
	UserId    interface{} // 用户ID
	IsOn      interface{} // 是否启用
	Level     interface{} // 压缩级别
	MinLength interface{} // 可压缩最小值
	MaxLength interface{} // 可压缩最大值
	State     interface{} // 状态
	CreatedAt interface{} // 创建时间
	Conds     interface{} // 条件
}

func NewHTTPGzipOperator

func NewHTTPGzipOperator() *HTTPGzipOperator

type HTTPHeader

type HTTPHeader struct {
	Id              uint32   `field:"id"`              // ID
	AdminId         uint32   `field:"adminId"`         // 管理员ID
	UserId          uint32   `field:"userId"`          // 用户ID
	TemplateId      uint32   `field:"templateId"`      // 模版ID
	IsOn            bool     `field:"isOn"`            // 是否启用
	Name            string   `field:"name"`            // 名称
	Value           string   `field:"value"`           // 值
	Order           uint32   `field:"order"`           // 排序
	Status          dbs.JSON `field:"status"`          // 状态码设置
	DisableRedirect uint8    `field:"disableRedirect"` // 是否不支持跳转
	ShouldAppend    bool     `field:"shouldAppend"`    // 是否为附加
	ShouldReplace   bool     `field:"shouldReplace"`   // 是否替换变量
	ReplaceValues   dbs.JSON `field:"replaceValues"`   // 替换的值
	Methods         dbs.JSON `field:"methods"`         // 支持的方法
	Domains         dbs.JSON `field:"domains"`         // 支持的域名
	State           uint8    `field:"state"`           // 状态
	CreatedAt       uint64   `field:"createdAt"`       // 创建时间
}

HTTPHeader HTTP Header

type HTTPHeaderDAO

type HTTPHeaderDAO dbs.DAO
var SharedHTTPHeaderDAO *HTTPHeaderDAO

func NewHTTPHeaderDAO

func NewHTTPHeaderDAO() *HTTPHeaderDAO

func (*HTTPHeaderDAO) ComposeHeaderConfig

func (this *HTTPHeaderDAO) ComposeHeaderConfig(tx *dbs.Tx, headerId int64) (*shared.HTTPHeaderConfig, error)

ComposeHeaderConfig 组合Header配置

func (*HTTPHeaderDAO) CreateHeader

func (this *HTTPHeaderDAO) CreateHeader(tx *dbs.Tx, userId int64, name string, value string, status []int, disableRedirect bool, shouldAppend bool, shouldReplace bool, replaceValues []*shared.HTTPHeaderReplaceValue, methods []string, domains []string) (int64, error)

CreateHeader 创建Header

func (*HTTPHeaderDAO) DisableHTTPHeader

func (this *HTTPHeaderDAO) DisableHTTPHeader(tx *dbs.Tx, id uint32) error

DisableHTTPHeader 禁用条目

func (*HTTPHeaderDAO) EnableHTTPHeader

func (this *HTTPHeaderDAO) EnableHTTPHeader(tx *dbs.Tx, id int64) error

EnableHTTPHeader 启用条目

func (*HTTPHeaderDAO) FindEnabledHTTPHeader

func (this *HTTPHeaderDAO) FindEnabledHTTPHeader(tx *dbs.Tx, id int64) (*HTTPHeader, error)

FindEnabledHTTPHeader 查找启用中的条目

func (*HTTPHeaderDAO) FindHTTPHeaderName

func (this *HTTPHeaderDAO) FindHTTPHeaderName(tx *dbs.Tx, id int64) (string, error)

FindHTTPHeaderName 根据主键查找名称

func (*HTTPHeaderDAO) Init

func (this *HTTPHeaderDAO) Init()

Init 初始化

func (*HTTPHeaderDAO) NotifyUpdate

func (this *HTTPHeaderDAO) NotifyUpdate(tx *dbs.Tx, headerId int64) error

NotifyUpdate 通知更新

func (*HTTPHeaderDAO) UpdateHeader

func (this *HTTPHeaderDAO) UpdateHeader(tx *dbs.Tx, headerId int64, name string, value string, status []int, disableRedirect bool, shouldAppend bool, shouldReplace bool, replaceValues []*shared.HTTPHeaderReplaceValue, methods []string, domains []string) error

UpdateHeader 修改Header

type HTTPHeaderOperator

type HTTPHeaderOperator struct {
	Id              interface{} // ID
	AdminId         interface{} // 管理员ID
	UserId          interface{} // 用户ID
	TemplateId      interface{} // 模版ID
	IsOn            interface{} // 是否启用
	Name            interface{} // 名称
	Value           interface{} // 值
	Order           interface{} // 排序
	Status          interface{} // 状态码设置
	DisableRedirect interface{} // 是否不支持跳转
	ShouldAppend    interface{} // 是否为附加
	ShouldReplace   interface{} // 是否替换变量
	ReplaceValues   interface{} // 替换的值
	Methods         interface{} // 支持的方法
	Domains         interface{} // 支持的域名
	State           interface{} // 状态
	CreatedAt       interface{} // 创建时间
}

func NewHTTPHeaderOperator

func NewHTTPHeaderOperator() *HTTPHeaderOperator

type HTTPHeaderPolicy

type HTTPHeaderPolicy struct {
	Id                 uint32   `field:"id"`                 // ID
	IsOn               bool     `field:"isOn"`               // 是否启用
	State              uint8    `field:"state"`              // 状态
	AdminId            uint32   `field:"adminId"`            // 管理员ID
	UserId             uint32   `field:"userId"`             // 用户ID
	CreatedAt          uint64   `field:"createdAt"`          // 创建时间
	AddHeaders         dbs.JSON `field:"addHeaders"`         // 添加的Header
	AddTrailers        dbs.JSON `field:"addTrailers"`        // 添加的Trailers
	SetHeaders         dbs.JSON `field:"setHeaders"`         // 设置Header
	ReplaceHeaders     dbs.JSON `field:"replaceHeaders"`     // 替换Header内容
	Expires            dbs.JSON `field:"expires"`            // Expires单独设置
	DeleteHeaders      dbs.JSON `field:"deleteHeaders"`      // 删除的Headers
	NonStandardHeaders dbs.JSON `field:"nonStandardHeaders"` // 非标Headers
	Cors               dbs.JSON `field:"cors"`               // CORS配置
}

HTTPHeaderPolicy Header定义

type HTTPHeaderPolicyDAO

type HTTPHeaderPolicyDAO dbs.DAO
var SharedHTTPHeaderPolicyDAO *HTTPHeaderPolicyDAO

func NewHTTPHeaderPolicyDAO

func NewHTTPHeaderPolicyDAO() *HTTPHeaderPolicyDAO

func (*HTTPHeaderPolicyDAO) CheckUserHeaderPolicy added in v0.6.0

func (this *HTTPHeaderPolicyDAO) CheckUserHeaderPolicy(tx *dbs.Tx, userId int64, policyId int64) error

CheckUserHeaderPolicy 检查用户权限

func (*HTTPHeaderPolicyDAO) ComposeHeaderPolicyConfig

func (this *HTTPHeaderPolicyDAO) ComposeHeaderPolicyConfig(tx *dbs.Tx, headerPolicyId int64) (*shared.HTTPHeaderPolicy, error)

ComposeHeaderPolicyConfig 组合配置

func (*HTTPHeaderPolicyDAO) CreateHeaderPolicy

func (this *HTTPHeaderPolicyDAO) CreateHeaderPolicy(tx *dbs.Tx) (int64, error)

CreateHeaderPolicy 创建策略

func (*HTTPHeaderPolicyDAO) DisableHTTPHeaderPolicy

func (this *HTTPHeaderPolicyDAO) DisableHTTPHeaderPolicy(tx *dbs.Tx, policyId int64) error

DisableHTTPHeaderPolicy 禁用条目

func (*HTTPHeaderPolicyDAO) EnableHTTPHeaderPolicy

func (this *HTTPHeaderPolicyDAO) EnableHTTPHeaderPolicy(tx *dbs.Tx, id int64) error

EnableHTTPHeaderPolicy 启用条目

func (*HTTPHeaderPolicyDAO) FindEnabledHTTPHeaderPolicy

func (this *HTTPHeaderPolicyDAO) FindEnabledHTTPHeaderPolicy(tx *dbs.Tx, id int64) (*HTTPHeaderPolicy, error)

FindEnabledHTTPHeaderPolicy 查找启用中的条目

func (*HTTPHeaderPolicyDAO) FindHeaderPolicyIdWithHeaderId

func (this *HTTPHeaderPolicyDAO) FindHeaderPolicyIdWithHeaderId(tx *dbs.Tx, headerId int64) (int64, error)

FindHeaderPolicyIdWithHeaderId 查找Header所在Policy

func (*HTTPHeaderPolicyDAO) Init

func (this *HTTPHeaderPolicyDAO) Init()

Init 初始化

func (*HTTPHeaderPolicyDAO) NotifyUpdate

func (this *HTTPHeaderPolicyDAO) NotifyUpdate(tx *dbs.Tx, policyId int64) error

NotifyUpdate 通知更新

func (*HTTPHeaderPolicyDAO) UpdateAddingHeaders

func (this *HTTPHeaderPolicyDAO) UpdateAddingHeaders(tx *dbs.Tx, policyId int64, headersJSON []byte) error

UpdateAddingHeaders 修改AddHeaders

func (*HTTPHeaderPolicyDAO) UpdateAddingTrailers

func (this *HTTPHeaderPolicyDAO) UpdateAddingTrailers(tx *dbs.Tx, policyId int64, headersJSON []byte) error

UpdateAddingTrailers 修改AddTrailers

func (*HTTPHeaderPolicyDAO) UpdateDeletingHeaders

func (this *HTTPHeaderPolicyDAO) UpdateDeletingHeaders(tx *dbs.Tx, policyId int64, headerNames []string) error

UpdateDeletingHeaders 修改DeleteHeaders

func (*HTTPHeaderPolicyDAO) UpdateHeaderPolicyCORS added in v0.6.0

func (this *HTTPHeaderPolicyDAO) UpdateHeaderPolicyCORS(tx *dbs.Tx, headerPolicyId int64, corsConfig *shared.HTTPCORSHeaderConfig) error

UpdateHeaderPolicyCORS 修改CORS

func (*HTTPHeaderPolicyDAO) UpdateNonStandardHeaders added in v1.1.0

func (this *HTTPHeaderPolicyDAO) UpdateNonStandardHeaders(tx *dbs.Tx, policyId int64, headerNames []string) error

UpdateNonStandardHeaders 修改非标Headers

func (*HTTPHeaderPolicyDAO) UpdateReplacingHeaders

func (this *HTTPHeaderPolicyDAO) UpdateReplacingHeaders(tx *dbs.Tx, policyId int64, headersJSON []byte) error

UpdateReplacingHeaders 修改ReplaceHeaders

func (*HTTPHeaderPolicyDAO) UpdateSettingHeaders

func (this *HTTPHeaderPolicyDAO) UpdateSettingHeaders(tx *dbs.Tx, policyId int64, headersJSON []byte) error

UpdateSettingHeaders 修改SetHeaders

type HTTPHeaderPolicyOperator

type HTTPHeaderPolicyOperator struct {
	Id                 any // ID
	IsOn               any // 是否启用
	State              any // 状态
	AdminId            any // 管理员ID
	UserId             any // 用户ID
	CreatedAt          any // 创建时间
	AddHeaders         any // 添加的Header
	AddTrailers        any // 添加的Trailers
	SetHeaders         any // 设置Header
	ReplaceHeaders     any // 替换Header内容
	Expires            any // Expires单独设置
	DeleteHeaders      any // 删除的Headers
	NonStandardHeaders any // 非标Headers
	Cors               any // CORS配置
}

func NewHTTPHeaderPolicyOperator

func NewHTTPHeaderPolicyOperator() *HTTPHeaderPolicyOperator

type HTTPLocation

type HTTPLocation struct {
	Id           uint32   `field:"id"`           // ID
	TemplateId   uint32   `field:"templateId"`   // 模版ID
	AdminId      uint32   `field:"adminId"`      // 管理员ID
	UserId       uint32   `field:"userId"`       // 用户ID
	ParentId     uint32   `field:"parentId"`     // 父级ID
	State        uint8    `field:"state"`        // 状态
	CreatedAt    uint64   `field:"createdAt"`    // 创建时间
	Pattern      string   `field:"pattern"`      // 匹配规则
	IsOn         bool     `field:"isOn"`         // 是否启用
	Name         string   `field:"name"`         // 名称
	Description  string   `field:"description"`  // 描述
	WebId        uint32   `field:"webId"`        // Web配置ID
	ReverseProxy dbs.JSON `field:"reverseProxy"` // 反向代理
	UrlPrefix    string   `field:"urlPrefix"`    // URL前缀
	IsBreak      bool     `field:"isBreak"`      // 是否终止匹配
	Conds        dbs.JSON `field:"conds"`        // 匹配条件
	Domains      dbs.JSON `field:"domains"`      // 专属域名
}

HTTPLocation 路由规则配置

type HTTPLocationDAO

type HTTPLocationDAO dbs.DAO
var SharedHTTPLocationDAO *HTTPLocationDAO

func NewHTTPLocationDAO

func NewHTTPLocationDAO() *HTTPLocationDAO

func (*HTTPLocationDAO) ComposeLocationConfig

func (this *HTTPLocationDAO) ComposeLocationConfig(tx *dbs.Tx, locationId int64, forNode bool, dataMap *shared.DataMap, cacheMap *utils.CacheMap) (*serverconfigs.HTTPLocationConfig, error)

ComposeLocationConfig 组合配置

func (*HTTPLocationDAO) ConvertLocationRefs

func (this *HTTPLocationDAO) ConvertLocationRefs(tx *dbs.Tx, refs []*serverconfigs.HTTPLocationRef, forNode bool, dataMap *shared.DataMap, cacheMap *utils.CacheMap) (locations []*serverconfigs.HTTPLocationConfig, err error)

ConvertLocationRefs 转换引用为配置

func (*HTTPLocationDAO) CreateLocation

func (this *HTTPLocationDAO) CreateLocation(tx *dbs.Tx, parentId int64, name string, pattern string, description string, isBreak bool, condsJSON []byte, domains []string) (int64, error)

CreateLocation 创建路由规则

func (*HTTPLocationDAO) DisableHTTPLocation

func (this *HTTPLocationDAO) DisableHTTPLocation(tx *dbs.Tx, locationId int64) error

DisableHTTPLocation 禁用条目

func (*HTTPLocationDAO) EnableHTTPLocation

func (this *HTTPLocationDAO) EnableHTTPLocation(tx *dbs.Tx, id int64) error

EnableHTTPLocation 启用条目

func (*HTTPLocationDAO) FindEnabledHTTPLocation

func (this *HTTPLocationDAO) FindEnabledHTTPLocation(tx *dbs.Tx, id int64) (*HTTPLocation, error)

FindEnabledHTTPLocation 查找启用中的条目

func (*HTTPLocationDAO) FindEnabledLocationIdWithReverseProxyId

func (this *HTTPLocationDAO) FindEnabledLocationIdWithReverseProxyId(tx *dbs.Tx, reverseProxyId int64) (serverId int64, err error)

FindEnabledLocationIdWithReverseProxyId 查找包含某个反向代理的路由规则

func (*HTTPLocationDAO) FindEnabledLocationIdWithWebId

func (this *HTTPLocationDAO) FindEnabledLocationIdWithWebId(tx *dbs.Tx, webId int64) (locationId int64, err error)

FindEnabledLocationIdWithWebId 根据WebId查找LocationId

func (*HTTPLocationDAO) FindHTTPLocationName

func (this *HTTPLocationDAO) FindHTTPLocationName(tx *dbs.Tx, id int64) (string, error)

FindHTTPLocationName 根据主键查找名称

func (*HTTPLocationDAO) FindLocationReverseProxy

func (this *HTTPLocationDAO) FindLocationReverseProxy(tx *dbs.Tx, locationId int64) (*serverconfigs.ReverseProxyRef, error)

FindLocationReverseProxy 查找反向代理设置

func (*HTTPLocationDAO) FindLocationWebId

func (this *HTTPLocationDAO) FindLocationWebId(tx *dbs.Tx, locationId int64) (int64, error)

FindLocationWebId 查找WebId

func (*HTTPLocationDAO) Init

func (this *HTTPLocationDAO) Init()

Init 初始化

func (*HTTPLocationDAO) NotifyUpdate

func (this *HTTPLocationDAO) NotifyUpdate(tx *dbs.Tx, locationId int64) error

NotifyUpdate 通知更新

func (*HTTPLocationDAO) UpdateLocation

func (this *HTTPLocationDAO) UpdateLocation(tx *dbs.Tx, locationId int64, name string, pattern string, description string, isOn bool, isBreak bool, condsJSON []byte, domains []string) error

UpdateLocation 修改路由规则

func (*HTTPLocationDAO) UpdateLocationReverseProxy

func (this *HTTPLocationDAO) UpdateLocationReverseProxy(tx *dbs.Tx, locationId int64, reverseProxyJSON []byte) error

UpdateLocationReverseProxy 更改反向代理设置

func (*HTTPLocationDAO) UpdateLocationWeb

func (this *HTTPLocationDAO) UpdateLocationWeb(tx *dbs.Tx, locationId int64, webId int64) error

UpdateLocationWeb 更改Web设置

type HTTPLocationOperator

type HTTPLocationOperator struct {
	Id           interface{} // ID
	TemplateId   interface{} // 模版ID
	AdminId      interface{} // 管理员ID
	UserId       interface{} // 用户ID
	ParentId     interface{} // 父级ID
	State        interface{} // 状态
	CreatedAt    interface{} // 创建时间
	Pattern      interface{} // 匹配规则
	IsOn         interface{} // 是否启用
	Name         interface{} // 名称
	Description  interface{} // 描述
	WebId        interface{} // Web配置ID
	ReverseProxy interface{} // 反向代理
	UrlPrefix    interface{} // URL前缀
	IsBreak      interface{} // 是否终止匹配
	Conds        interface{} // 匹配条件
	Domains      interface{} // 专属域名
}

func NewHTTPLocationOperator

func NewHTTPLocationOperator() *HTTPLocationOperator

type HTTPPage

type HTTPPage struct {
	Id                uint32   `field:"id"`                // ID
	AdminId           uint32   `field:"adminId"`           // 管理员ID
	UserId            uint32   `field:"userId"`            // 用户ID
	IsOn              bool     `field:"isOn"`              // 是否启用
	StatusList        dbs.JSON `field:"statusList"`        // 状态列表
	Url               string   `field:"url"`               // 页面URL
	NewStatus         int32    `field:"newStatus"`         // 新状态码
	State             uint8    `field:"state"`             // 状态
	CreatedAt         uint64   `field:"createdAt"`         // 创建时间
	Body              string   `field:"body"`              // 页面内容
	BodyType          string   `field:"bodyType"`          // 内容类型
	ExceptURLPatterns dbs.JSON `field:"exceptURLPatterns"` // 例外URL
	OnlyURLPatterns   dbs.JSON `field:"onlyURLPatterns"`   // 限制URL
}

HTTPPage 特殊页面

type HTTPPageDAO

type HTTPPageDAO dbs.DAO
var SharedHTTPPageDAO *HTTPPageDAO

func NewHTTPPageDAO

func NewHTTPPageDAO() *HTTPPageDAO

func (*HTTPPageDAO) CheckUserPage

func (this *HTTPPageDAO) CheckUserPage(tx *dbs.Tx, userId int64, pageId int64) error

CheckUserPage 检查用户页面

func (*HTTPPageDAO) ClonePage added in v1.0.0

func (this *HTTPPageDAO) ClonePage(tx *dbs.Tx, fromPageId int64) (newPageId int64, err error)

ClonePage 克隆页面

func (*HTTPPageDAO) ComposePageConfig

func (this *HTTPPageDAO) ComposePageConfig(tx *dbs.Tx, pageId int64, cacheMap *utils.CacheMap) (*serverconfigs.HTTPPageConfig, error)

ComposePageConfig 组合配置

func (*HTTPPageDAO) CreatePage

func (this *HTTPPageDAO) CreatePage(tx *dbs.Tx, userId int64, statusList []string, bodyType serverconfigs.HTTPPageBodyType, url string, body string, newStatus int, exceptURLPatterns []*shared.URLPattern, onlyURLPatterns []*shared.URLPattern) (pageId int64, err error)

CreatePage 创建Page

func (*HTTPPageDAO) DisableHTTPPage

func (this *HTTPPageDAO) DisableHTTPPage(tx *dbs.Tx, id int64) error

DisableHTTPPage 禁用条目

func (*HTTPPageDAO) EnableHTTPPage

func (this *HTTPPageDAO) EnableHTTPPage(tx *dbs.Tx, pageId int64) error

EnableHTTPPage 启用条目

func (*HTTPPageDAO) FindEnabledHTTPPage

func (this *HTTPPageDAO) FindEnabledHTTPPage(tx *dbs.Tx, id int64) (*HTTPPage, error)

FindEnabledHTTPPage 查找启用中的条目

func (*HTTPPageDAO) Init

func (this *HTTPPageDAO) Init()

Init 初始化

func (*HTTPPageDAO) NotifyUpdate

func (this *HTTPPageDAO) NotifyUpdate(tx *dbs.Tx, pageId int64) error

NotifyUpdate 通知更新

func (*HTTPPageDAO) UpdatePage

func (this *HTTPPageDAO) UpdatePage(tx *dbs.Tx, pageId int64, statusList []string, bodyType serverconfigs.HTTPPageBodyType, url string, body string, newStatus int, exceptURLPatterns []*shared.URLPattern, onlyURLPatterns []*shared.URLPattern) error

UpdatePage 修改Page

type HTTPPageOperator

type HTTPPageOperator struct {
	Id                any // ID
	AdminId           any // 管理员ID
	UserId            any // 用户ID
	IsOn              any // 是否启用
	StatusList        any // 状态列表
	Url               any // 页面URL
	NewStatus         any // 新状态码
	State             any // 状态
	CreatedAt         any // 创建时间
	Body              any // 页面内容
	BodyType          any // 内容类型
	ExceptURLPatterns any // 例外URL
	OnlyURLPatterns   any // 限制URL
}

func NewHTTPPageOperator

func NewHTTPPageOperator() *HTTPPageOperator

type HTTPRewriteRule

type HTTPRewriteRule struct {
	Id             uint32   `field:"id"`             // ID
	AdminId        uint32   `field:"adminId"`        // 管理员ID
	UserId         uint32   `field:"userId"`         // 用户ID
	TemplateId     uint32   `field:"templateId"`     // 模版ID
	IsOn           bool     `field:"isOn"`           // 是否启用
	State          uint8    `field:"state"`          // 状态
	CreatedAt      uint64   `field:"createdAt"`      // 创建时间
	Pattern        string   `field:"pattern"`        // 匹配规则
	Replace        string   `field:"replace"`        // 跳转后的地址
	Mode           string   `field:"mode"`           // 替换模式
	RedirectStatus uint32   `field:"redirectStatus"` // 跳转的状态码
	ProxyHost      string   `field:"proxyHost"`      // 代理的主机名
	IsBreak        bool     `field:"isBreak"`        // 是否终止解析
	WithQuery      uint8    `field:"withQuery"`      // 是否保留URI参数
	Conds          dbs.JSON `field:"conds"`          // 匹配条件
}

重写规则

type HTTPRewriteRuleDAO

type HTTPRewriteRuleDAO dbs.DAO
var SharedHTTPRewriteRuleDAO *HTTPRewriteRuleDAO

func NewHTTPRewriteRuleDAO

func NewHTTPRewriteRuleDAO() *HTTPRewriteRuleDAO

func (*HTTPRewriteRuleDAO) CheckUserRewriteRule added in v1.2.1

func (this *HTTPRewriteRuleDAO) CheckUserRewriteRule(tx *dbs.Tx, userId int64, rewriteRuleId int64) error

func (*HTTPRewriteRuleDAO) ComposeRewriteRule

func (this *HTTPRewriteRuleDAO) ComposeRewriteRule(tx *dbs.Tx, rewriteRuleId int64, cacheMap *utils.CacheMap) (*serverconfigs.HTTPRewriteRule, error)

ComposeRewriteRule 构造配置

func (*HTTPRewriteRuleDAO) CreateRewriteRule

func (this *HTTPRewriteRuleDAO) CreateRewriteRule(tx *dbs.Tx, userId int64, pattern string, replace string, mode string, redirectStatus int, isBreak bool, proxyHost string, withQuery bool, isOn bool, condsJSON []byte) (int64, error)

CreateRewriteRule 创建规则

func (*HTTPRewriteRuleDAO) DisableHTTPRewriteRule

func (this *HTTPRewriteRuleDAO) DisableHTTPRewriteRule(tx *dbs.Tx, rewriteRuleId int64) error

DisableHTTPRewriteRule 禁用条目

func (*HTTPRewriteRuleDAO) EnableHTTPRewriteRule

func (this *HTTPRewriteRuleDAO) EnableHTTPRewriteRule(tx *dbs.Tx, id int64) error

EnableHTTPRewriteRule 启用条目

func (*HTTPRewriteRuleDAO) FindEnabledHTTPRewriteRule

func (this *HTTPRewriteRuleDAO) FindEnabledHTTPRewriteRule(tx *dbs.Tx, id int64) (*HTTPRewriteRule, error)

FindEnabledHTTPRewriteRule 查找启用中的条目

func (*HTTPRewriteRuleDAO) Init

func (this *HTTPRewriteRuleDAO) Init()

Init 初始化

func (*HTTPRewriteRuleDAO) NotifyUpdate

func (this *HTTPRewriteRuleDAO) NotifyUpdate(tx *dbs.Tx, rewriteRuleId int64) error

NotifyUpdate 通知更新

func (*HTTPRewriteRuleDAO) UpdateRewriteRule

func (this *HTTPRewriteRuleDAO) UpdateRewriteRule(tx *dbs.Tx, rewriteRuleId int64, pattern string, replace string, mode string, redirectStatus int, isBreak bool, proxyHost string, withQuery bool, isOn bool, condsJSON []byte) error

UpdateRewriteRule 修改规则

type HTTPRewriteRuleOperator

type HTTPRewriteRuleOperator struct {
	Id             interface{} // ID
	AdminId        interface{} // 管理员ID
	UserId         interface{} // 用户ID
	TemplateId     interface{} // 模版ID
	IsOn           interface{} // 是否启用
	State          interface{} // 状态
	CreatedAt      interface{} // 创建时间
	Pattern        interface{} // 匹配规则
	Replace        interface{} // 跳转后的地址
	Mode           interface{} // 替换模式
	RedirectStatus interface{} // 跳转的状态码
	ProxyHost      interface{} // 代理的主机名
	IsBreak        interface{} // 是否终止解析
	WithQuery      interface{} // 是否保留URI参数
	Conds          interface{} // 匹配条件
}

func NewHTTPRewriteRuleOperator

func NewHTTPRewriteRuleOperator() *HTTPRewriteRuleOperator

type HTTPWeb

type HTTPWeb struct {
	Id                 uint32   `field:"id"`                 // ID
	IsOn               bool     `field:"isOn"`               // 是否启用
	TemplateId         uint32   `field:"templateId"`         // 模版ID
	AdminId            uint32   `field:"adminId"`            // 管理员ID
	UserId             uint32   `field:"userId"`             // 用户ID
	State              uint8    `field:"state"`              // 状态
	CreatedAt          uint64   `field:"createdAt"`          // 创建时间
	Root               dbs.JSON `field:"root"`               // 根目录
	Charset            dbs.JSON `field:"charset"`            // 字符集
	Shutdown           dbs.JSON `field:"shutdown"`           // 临时关闭页面配置
	Pages              dbs.JSON `field:"pages"`              // 特殊页面
	RedirectToHttps    dbs.JSON `field:"redirectToHttps"`    // 跳转到HTTPS设置
	Indexes            dbs.JSON `field:"indexes"`            // 首页文件列表
	MaxRequestBodySize dbs.JSON `field:"maxRequestBodySize"` // 最大允许的请求内容尺寸
	RequestHeader      dbs.JSON `field:"requestHeader"`      // 请求Header配置
	ResponseHeader     dbs.JSON `field:"responseHeader"`     // 响应Header配置
	AccessLog          dbs.JSON `field:"accessLog"`          // 访问日志配置
	Stat               dbs.JSON `field:"stat"`               // 统计配置
	Gzip               dbs.JSON `field:"gzip"`               // Gzip配置(v0.3.2弃用)
	Compression        dbs.JSON `field:"compression"`        // 压缩配置
	Cache              dbs.JSON `field:"cache"`              // 缓存配置
	Firewall           dbs.JSON `field:"firewall"`           // 防火墙设置
	Locations          dbs.JSON `field:"locations"`          // 路由规则配置
	Websocket          dbs.JSON `field:"websocket"`          // Websocket设置
	RewriteRules       dbs.JSON `field:"rewriteRules"`       // 重写规则配置
	HostRedirects      dbs.JSON `field:"hostRedirects"`      // 域名跳转
	Fastcgi            dbs.JSON `field:"fastcgi"`            // Fastcgi配置
	Auth               dbs.JSON `field:"auth"`               // 认证策略配置
	Webp               dbs.JSON `field:"webp"`               // WebP配置
	RemoteAddr         dbs.JSON `field:"remoteAddr"`         // 客户端IP配置
	MergeSlashes       uint8    `field:"mergeSlashes"`       // 是否合并路径中的斜杠
	RequestLimit       dbs.JSON `field:"requestLimit"`       // 请求限制
	RequestScripts     dbs.JSON `field:"requestScripts"`     // 请求脚本
	Uam                dbs.JSON `field:"uam"`                // UAM设置
	Cc                 dbs.JSON `field:"cc"`                 // CC设置
	Referers           dbs.JSON `field:"referers"`           // 防盗链设置
	UserAgent          dbs.JSON `field:"userAgent"`          // UserAgent设置
	Optimization       dbs.JSON `field:"optimization"`       // 页面优化配置
}

HTTPWeb HTTP Web

type HTTPWebDAO

type HTTPWebDAO dbs.DAO
var SharedHTTPWebDAO *HTTPWebDAO

func NewHTTPWebDAO

func NewHTTPWebDAO() *HTTPWebDAO

func (*HTTPWebDAO) CheckUserWeb

func (this *HTTPWebDAO) CheckUserWeb(tx *dbs.Tx, userId int64, webId int64) error

CheckUserWeb 检查用户权限

func (*HTTPWebDAO) ComposeWebConfig

func (this *HTTPWebDAO) ComposeWebConfig(tx *dbs.Tx, webId int64, isLocationOrGroup bool, forNode bool, dataMap *shared.DataMap, cacheMap *utils.CacheMap) (*serverconfigs.HTTPWebConfig, error)

ComposeWebConfig 组合配置

func (*HTTPWebDAO) CreateWeb

func (this *HTTPWebDAO) CreateWeb(tx *dbs.Tx, adminId int64, userId int64, rootJSON []byte) (int64, error)

CreateWeb 创建Web配置

func (*HTTPWebDAO) DisableHTTPWeb

func (this *HTTPWebDAO) DisableHTTPWeb(tx *dbs.Tx, id int64) error

DisableHTTPWeb 禁用条目

func (*HTTPWebDAO) EnableHTTPWeb

func (this *HTTPWebDAO) EnableHTTPWeb(tx *dbs.Tx, id int64) error

EnableHTTPWeb 启用条目

func (*HTTPWebDAO) FindAllWebIdsWithCachePolicyId

func (this *HTTPWebDAO) FindAllWebIdsWithCachePolicyId(tx *dbs.Tx, cachePolicyId int64) ([]int64, error)

FindAllWebIdsWithCachePolicyId 根据缓存策略ID查找所有的WebId

func (*HTTPWebDAO) FindAllWebIdsWithHTTPFirewallPolicyId

func (this *HTTPWebDAO) FindAllWebIdsWithHTTPFirewallPolicyId(tx *dbs.Tx, firewallPolicyId int64) ([]int64, error)

FindAllWebIdsWithHTTPFirewallPolicyId 根据防火墙策略ID查找所有的WebId

func (*HTTPWebDAO) FindEnabledHTTPWeb

func (this *HTTPWebDAO) FindEnabledHTTPWeb(tx *dbs.Tx, id int64) (*HTTPWeb, error)

FindEnabledHTTPWeb 查找启用中的条目

func (*HTTPWebDAO) FindEnabledWebIdWithBrotliPolicyId

func (this *HTTPWebDAO) FindEnabledWebIdWithBrotliPolicyId(tx *dbs.Tx, brotliPolicyId int64) (webId int64, err error)

FindEnabledWebIdWithBrotliPolicyId 查找包含某个Brotli配置的Web

func (*HTTPWebDAO) FindEnabledWebIdWithDeflatePolicyId

func (this *HTTPWebDAO) FindEnabledWebIdWithDeflatePolicyId(tx *dbs.Tx, deflatePolicyId int64) (webId int64, err error)

FindEnabledWebIdWithDeflatePolicyId 查找包含某个Deflate配置的Web

func (*HTTPWebDAO) FindEnabledWebIdWithFastcgiId

func (this *HTTPWebDAO) FindEnabledWebIdWithFastcgiId(tx *dbs.Tx, fastcgiId int64) (webId int64, err error)

FindEnabledWebIdWithFastcgiId 查找包含某个Fastcgi配置的Web

func (*HTTPWebDAO) FindEnabledWebIdWithGzipId

func (this *HTTPWebDAO) FindEnabledWebIdWithGzipId(tx *dbs.Tx, gzipId int64) (webId int64, err error)

FindEnabledWebIdWithGzipId 查找包含某个Gzip配置的Web

func (*HTTPWebDAO) FindEnabledWebIdWithHTTPAuthPolicyId

func (this *HTTPWebDAO) FindEnabledWebIdWithHTTPAuthPolicyId(tx *dbs.Tx, httpAuthPolicyId int64) (webId int64, err error)

FindEnabledWebIdWithHTTPAuthPolicyId 查找包含某个认证策略的Web

func (*HTTPWebDAO) FindEnabledWebIdWithHeaderPolicyId

func (this *HTTPWebDAO) FindEnabledWebIdWithHeaderPolicyId(tx *dbs.Tx, headerPolicyId int64) (webId int64, err error)

FindEnabledWebIdWithHeaderPolicyId 查找包含某个Header的Web

func (*HTTPWebDAO) FindEnabledWebIdWithLocationId

func (this *HTTPWebDAO) FindEnabledWebIdWithLocationId(tx *dbs.Tx, locationId int64) (webId int64, err error)

FindEnabledWebIdWithLocationId 查找包含某个Location的Web

func (*HTTPWebDAO) FindEnabledWebIdWithPageId

func (this *HTTPWebDAO) FindEnabledWebIdWithPageId(tx *dbs.Tx, pageId int64) (webId int64, err error)

FindEnabledWebIdWithPageId 查找包含某个页面的Web

func (*HTTPWebDAO) FindEnabledWebIdWithRewriteRuleId

func (this *HTTPWebDAO) FindEnabledWebIdWithRewriteRuleId(tx *dbs.Tx, rewriteRuleId int64) (webId int64, err error)

FindEnabledWebIdWithRewriteRuleId 查找包含某个重写规则的Web

func (*HTTPWebDAO) FindEnabledWebIdWithWebsocketId

func (this *HTTPWebDAO) FindEnabledWebIdWithWebsocketId(tx *dbs.Tx, websocketId int64) (webId int64, err error)

FindEnabledWebIdWithWebsocketId 查找包含某个Websocket配置的Web

func (*HTTPWebDAO) FindWebCC added in v0.6.4

func (this *HTTPWebDAO) FindWebCC(tx *dbs.Tx, webId int64) ([]byte, error)

FindWebCC 查找服务的CC配置

func (*HTTPWebDAO) FindWebHostRedirects

func (this *HTTPWebDAO) FindWebHostRedirects(tx *dbs.Tx, webId int64) ([]byte, error)

FindWebHostRedirects 查找主机跳转

func (*HTTPWebDAO) FindWebReferers added in v0.5.3

func (this *HTTPWebDAO) FindWebReferers(tx *dbs.Tx, webId int64) ([]byte, error)

FindWebReferers 查找服务的防盗链配置

func (*HTTPWebDAO) FindWebRequestLimit

func (this *HTTPWebDAO) FindWebRequestLimit(tx *dbs.Tx, webId int64) (*serverconfigs.HTTPRequestLimitConfig, error)

FindWebRequestLimit 获取服务的请求限制

func (*HTTPWebDAO) FindWebRequestScripts

func (this *HTTPWebDAO) FindWebRequestScripts(tx *dbs.Tx, webId int64) (*serverconfigs.HTTPRequestScriptsConfig, error)

FindWebRequestScripts 查找服务的脚本设置

func (*HTTPWebDAO) FindWebServerGroupId

func (this *HTTPWebDAO) FindWebServerGroupId(tx *dbs.Tx, webId int64) (groupId int64, err error)

FindWebServerGroupId 查找使用此Web的分组ID

func (*HTTPWebDAO) FindWebServerId

func (this *HTTPWebDAO) FindWebServerId(tx *dbs.Tx, webId int64) (serverId int64, err error)

FindWebServerId 查找使用此Web的Server

func (*HTTPWebDAO) FindWebUAM

func (this *HTTPWebDAO) FindWebUAM(tx *dbs.Tx, webId int64) ([]byte, error)

FindWebUAM 查找服务的UAM配置

func (*HTTPWebDAO) FindWebUserAgent added in v0.6.0

func (this *HTTPWebDAO) FindWebUserAgent(tx *dbs.Tx, webId int64) ([]byte, error)

FindWebUserAgent 查找服务User-Agent配置

func (*HTTPWebDAO) Init

func (this *HTTPWebDAO) Init()

func (*HTTPWebDAO) NotifyUpdate

func (this *HTTPWebDAO) NotifyUpdate(tx *dbs.Tx, webId int64) error

NotifyUpdate 通知更新

func (*HTTPWebDAO) UpdateWeb

func (this *HTTPWebDAO) UpdateWeb(tx *dbs.Tx, webId int64, rootJSON []byte) error

UpdateWeb 修改Web配置

func (*HTTPWebDAO) UpdateWebAccessLogConfig

func (this *HTTPWebDAO) UpdateWebAccessLogConfig(tx *dbs.Tx, webId int64, accessLogJSON []byte) error

UpdateWebAccessLogConfig 更改访问日志策略

func (*HTTPWebDAO) UpdateWebAuth

func (this *HTTPWebDAO) UpdateWebAuth(tx *dbs.Tx, webId int64, authJSON []byte) error

UpdateWebAuth 修改认证信息

func (*HTTPWebDAO) UpdateWebCC added in v0.6.4

func (this *HTTPWebDAO) UpdateWebCC(tx *dbs.Tx, webId int64, ccConfig *serverconfigs.HTTPCCConfig) error

UpdateWebCC 开启CC

func (*HTTPWebDAO) UpdateWebCache

func (this *HTTPWebDAO) UpdateWebCache(tx *dbs.Tx, webId int64, cacheJSON []byte) error

UpdateWebCache 更改缓存配置

func (*HTTPWebDAO) UpdateWebCharset

func (this *HTTPWebDAO) UpdateWebCharset(tx *dbs.Tx, webId int64, charsetJSON []byte) error

UpdateWebCharset 修改字符编码

func (*HTTPWebDAO) UpdateWebCommon

func (this *HTTPWebDAO) UpdateWebCommon(tx *dbs.Tx, webId int64, mergeSlashes bool) error

UpdateWebCommon 修改通用设置

func (*HTTPWebDAO) UpdateWebCompression

func (this *HTTPWebDAO) UpdateWebCompression(tx *dbs.Tx, webId int64, compressionConfig *serverconfigs.HTTPCompressionConfig) error

UpdateWebCompression 修改压缩配置

func (*HTTPWebDAO) UpdateWebFastcgi

func (this *HTTPWebDAO) UpdateWebFastcgi(tx *dbs.Tx, webId int64, fastcgiJSON []byte) error

UpdateWebFastcgi 修改Fastcgi设置

func (*HTTPWebDAO) UpdateWebFirewall

func (this *HTTPWebDAO) UpdateWebFirewall(tx *dbs.Tx, webId int64, firewallJSON []byte) error

UpdateWebFirewall 更改防火墙配置

func (*HTTPWebDAO) UpdateWebHostRedirects

func (this *HTTPWebDAO) UpdateWebHostRedirects(tx *dbs.Tx, webId int64, hostRedirects []*serverconfigs.HTTPHostRedirectConfig) error

UpdateWebHostRedirects 设置主机跳转

func (*HTTPWebDAO) UpdateWebLocations

func (this *HTTPWebDAO) UpdateWebLocations(tx *dbs.Tx, webId int64, locationsJSON []byte) error

UpdateWebLocations 更改路由规则配置

func (*HTTPWebDAO) UpdateWebOptimization added in v1.2.1

func (this *HTTPWebDAO) UpdateWebOptimization(tx *dbs.Tx, webId int64, optimizationConfig *serverconfigs.HTTPPageOptimizationConfig) error

UpdateWebOptimization 修改页面优化配置

func (*HTTPWebDAO) UpdateWebPages

func (this *HTTPWebDAO) UpdateWebPages(tx *dbs.Tx, webId int64, pagesJSON []byte) error

UpdateWebPages 更改特殊页面配置

func (*HTTPWebDAO) UpdateWebRedirectToHTTPS

func (this *HTTPWebDAO) UpdateWebRedirectToHTTPS(tx *dbs.Tx, webId int64, redirectToHTTPSJSON []byte) error

UpdateWebRedirectToHTTPS 更改跳转到HTTPS设置

func (*HTTPWebDAO) UpdateWebReferers added in v0.5.3

func (this *HTTPWebDAO) UpdateWebReferers(tx *dbs.Tx, webId int64, referersConfig *serverconfigs.ReferersConfig) error

UpdateWebReferers 修改防盗链设置

func (*HTTPWebDAO) UpdateWebRemoteAddr

func (this *HTTPWebDAO) UpdateWebRemoteAddr(tx *dbs.Tx, webId int64, remoteAddrConfig []byte) error

UpdateWebRemoteAddr 修改RemoteAddr配置

func (*HTTPWebDAO) UpdateWebRequestHeaderPolicy

func (this *HTTPWebDAO) UpdateWebRequestHeaderPolicy(tx *dbs.Tx, webId int64, headerPolicyJSON []byte) error

UpdateWebRequestHeaderPolicy 更改请求Header策略

func (*HTTPWebDAO) UpdateWebRequestLimit

func (this *HTTPWebDAO) UpdateWebRequestLimit(tx *dbs.Tx, webId int64, config *serverconfigs.HTTPRequestLimitConfig) error

UpdateWebRequestLimit 修改服务的请求限制

func (*HTTPWebDAO) UpdateWebRequestScripts

func (this *HTTPWebDAO) UpdateWebRequestScripts(tx *dbs.Tx, webId int64, config *serverconfigs.HTTPRequestScriptsConfig) error

UpdateWebRequestScripts 修改服务的请求脚本设置

func (*HTTPWebDAO) UpdateWebResponseHeaderPolicy

func (this *HTTPWebDAO) UpdateWebResponseHeaderPolicy(tx *dbs.Tx, webId int64, headerPolicyJSON []byte) error

UpdateWebResponseHeaderPolicy 更改响应Header策略

func (*HTTPWebDAO) UpdateWebRewriteRules

func (this *HTTPWebDAO) UpdateWebRewriteRules(tx *dbs.Tx, webId int64, rewriteRulesJSON []byte) error

UpdateWebRewriteRules 修改重写规则设置

func (*HTTPWebDAO) UpdateWebShutdown

func (this *HTTPWebDAO) UpdateWebShutdown(tx *dbs.Tx, webId int64, shutdownJSON []byte) error

UpdateWebShutdown 更改Shutdown配置

func (*HTTPWebDAO) UpdateWebStat

func (this *HTTPWebDAO) UpdateWebStat(tx *dbs.Tx, webId int64, statJSON []byte) error

UpdateWebStat 更改统计配置

func (*HTTPWebDAO) UpdateWebUAM

func (this *HTTPWebDAO) UpdateWebUAM(tx *dbs.Tx, webId int64, uamConfig *serverconfigs.UAMConfig) error

UpdateWebUAM 开启UAM

func (*HTTPWebDAO) UpdateWebUserAgent added in v0.6.0

func (this *HTTPWebDAO) UpdateWebUserAgent(tx *dbs.Tx, webId int64, userAgentConfig *serverconfigs.UserAgentConfig) error

UpdateWebUserAgent 修改User-Agent设置

func (*HTTPWebDAO) UpdateWebWebP

func (this *HTTPWebDAO) UpdateWebWebP(tx *dbs.Tx, webId int64, webpConfig []byte) error

UpdateWebWebP 修改WebP配置

func (*HTTPWebDAO) UpdateWebsocket

func (this *HTTPWebDAO) UpdateWebsocket(tx *dbs.Tx, webId int64, websocketJSON []byte) error

UpdateWebsocket 修改Websocket设置

type HTTPWebOperator

type HTTPWebOperator struct {
	Id                 any // ID
	IsOn               any // 是否启用
	TemplateId         any // 模版ID
	AdminId            any // 管理员ID
	UserId             any // 用户ID
	State              any // 状态
	CreatedAt          any // 创建时间
	Root               any // 根目录
	Charset            any // 字符集
	Shutdown           any // 临时关闭页面配置
	Pages              any // 特殊页面
	RedirectToHttps    any // 跳转到HTTPS设置
	Indexes            any // 首页文件列表
	MaxRequestBodySize any // 最大允许的请求内容尺寸
	RequestHeader      any // 请求Header配置
	ResponseHeader     any // 响应Header配置
	AccessLog          any // 访问日志配置
	Stat               any // 统计配置
	Gzip               any // Gzip配置(v0.3.2弃用)
	Compression        any // 压缩配置
	Cache              any // 缓存配置
	Firewall           any // 防火墙设置
	Locations          any // 路由规则配置
	Websocket          any // Websocket设置
	RewriteRules       any // 重写规则配置
	HostRedirects      any // 域名跳转
	Fastcgi            any // Fastcgi配置
	Auth               any // 认证策略配置
	Webp               any // WebP配置
	RemoteAddr         any // 客户端IP配置
	MergeSlashes       any // 是否合并路径中的斜杠
	RequestLimit       any // 请求限制
	RequestScripts     any // 请求脚本
	Uam                any // UAM设置
	Cc                 any // CC设置
	Referers           any // 防盗链设置
	UserAgent          any // UserAgent设置
	Optimization       any // 页面优化配置
}

func NewHTTPWebOperator

func NewHTTPWebOperator() *HTTPWebOperator

type HTTPWebsocket

type HTTPWebsocket struct {
	Id                uint32   `field:"id"`                // ID
	AdminId           uint32   `field:"adminId"`           // 管理员ID
	UserId            uint32   `field:"userId"`            // 用户ID
	CreatedAt         uint64   `field:"createdAt"`         // 创建时间
	State             uint8    `field:"state"`             // 状态
	IsOn              bool     `field:"isOn"`              // 是否启用
	HandshakeTimeout  dbs.JSON `field:"handshakeTimeout"`  // 握手超时时间
	AllowAllOrigins   uint8    `field:"allowAllOrigins"`   // 是否支持所有源
	AllowedOrigins    dbs.JSON `field:"allowedOrigins"`    // 支持的源域名列表
	RequestSameOrigin uint8    `field:"requestSameOrigin"` // 是否请求一样的Origin
	RequestOrigin     string   `field:"requestOrigin"`     // 请求Origin
	WebId             uint64   `field:"webId"`             // Web
}

HTTPWebsocket Websocket设置

type HTTPWebsocketDAO

type HTTPWebsocketDAO dbs.DAO
var SharedHTTPWebsocketDAO *HTTPWebsocketDAO

func NewHTTPWebsocketDAO

func NewHTTPWebsocketDAO() *HTTPWebsocketDAO

func (*HTTPWebsocketDAO) CloneWebsocket added in v1.0.0

func (this *HTTPWebsocketDAO) CloneWebsocket(tx *dbs.Tx, fromWebsocketId int64) (newWebsocketId int64, err error)

CloneWebsocket 复制配置

func (*HTTPWebsocketDAO) ComposeWebsocketConfig

func (this *HTTPWebsocketDAO) ComposeWebsocketConfig(tx *dbs.Tx, websocketId int64) (*serverconfigs.HTTPWebsocketConfig, error)

ComposeWebsocketConfig 组合配置

func (*HTTPWebsocketDAO) CreateWebsocket

func (this *HTTPWebsocketDAO) CreateWebsocket(tx *dbs.Tx, handshakeTimeoutJSON []byte, allowAllOrigins bool, allowedOrigins []string, requestSameOrigin bool, requestOrigin string) (websocketId int64, err error)

CreateWebsocket 创建Websocket配置

func (*HTTPWebsocketDAO) DisableHTTPWebsocket

func (this *HTTPWebsocketDAO) DisableHTTPWebsocket(tx *dbs.Tx, websocketId int64) error

DisableHTTPWebsocket 禁用条目

func (*HTTPWebsocketDAO) EnableHTTPWebsocket

func (this *HTTPWebsocketDAO) EnableHTTPWebsocket(tx *dbs.Tx, id int64) error

EnableHTTPWebsocket 启用条目

func (*HTTPWebsocketDAO) FindEnabledHTTPWebsocket

func (this *HTTPWebsocketDAO) FindEnabledHTTPWebsocket(tx *dbs.Tx, id int64) (*HTTPWebsocket, error)

FindEnabledHTTPWebsocket 查找启用中的条目

func (*HTTPWebsocketDAO) NotifyUpdate

func (this *HTTPWebsocketDAO) NotifyUpdate(tx *dbs.Tx, websocketId int64) error

NotifyUpdate 通知更新

func (*HTTPWebsocketDAO) UpdateWebsocket

func (this *HTTPWebsocketDAO) UpdateWebsocket(tx *dbs.Tx, websocketId int64, handshakeTimeoutJSON []byte, allowAllOrigins bool, allowedOrigins []string, requestSameOrigin bool, requestOrigin string) error

UpdateWebsocket 修改Websocket配置

type HTTPWebsocketOperator

type HTTPWebsocketOperator struct {
	Id                any // ID
	AdminId           any // 管理员ID
	UserId            any // 用户ID
	CreatedAt         any // 创建时间
	State             any // 状态
	IsOn              any // 是否启用
	HandshakeTimeout  any // 握手超时时间
	AllowAllOrigins   any // 是否支持所有源
	AllowedOrigins    any // 支持的源域名列表
	RequestSameOrigin any // 是否请求一样的Origin
	RequestOrigin     any // 请求Origin
	WebId             any // Web
}

func NewHTTPWebsocketOperator

func NewHTTPWebsocketOperator() *HTTPWebsocketOperator

type IPItem

type IPItem struct {
	Id                            uint64 `field:"id"`                            // ID
	ListId                        uint32 `field:"listId"`                        // 所属名单ID
	Type                          string `field:"type"`                          // 类型
	IpFrom                        string `field:"ipFrom"`                        // 开始IP
	IpTo                          string `field:"ipTo"`                          // 结束IP
	IpFromLong                    uint64 `field:"ipFromLong"`                    // 开始IP整型
	IpToLong                      uint64 `field:"ipToLong"`                      // 结束IP整型
	Version                       uint64 `field:"version"`                       // 版本
	CreatedAt                     uint64 `field:"createdAt"`                     // 创建时间
	UpdatedAt                     uint64 `field:"updatedAt"`                     // 修改时间
	Reason                        string `field:"reason"`                        // 加入说明
	EventLevel                    string `field:"eventLevel"`                    // 事件级别
	State                         uint8  `field:"state"`                         // 状态
	ExpiredAt                     uint64 `field:"expiredAt"`                     // 过期时间
	ServerId                      uint32 `field:"serverId"`                      // 有效范围服务ID
	NodeId                        uint32 `field:"nodeId"`                        // 有效范围节点ID
	SourceNodeId                  uint32 `field:"sourceNodeId"`                  // 来源节点ID
	SourceServerId                uint32 `field:"sourceServerId"`                // 来源服务ID
	SourceHTTPFirewallPolicyId    uint32 `field:"sourceHTTPFirewallPolicyId"`    // 来源策略ID
	SourceHTTPFirewallRuleGroupId uint32 `field:"sourceHTTPFirewallRuleGroupId"` // 来源规则集分组ID
	SourceHTTPFirewallRuleSetId   uint32 `field:"sourceHTTPFirewallRuleSetId"`   // 来源规则集ID
	SourceUserId                  uint64 `field:"sourceUserId"`                  // 用户ID
	IsRead                        bool   `field:"isRead"`                        // 是否已读
}

IPItem IP

type IPItemDAO

type IPItemDAO dbs.DAO
var SharedIPItemDAO *IPItemDAO

func NewIPItemDAO

func NewIPItemDAO() *IPItemDAO

func (*IPItemDAO) CleanExpiredIPItems

func (this *IPItemDAO) CleanExpiredIPItems(tx *dbs.Tx) error

CleanExpiredIPItems 清除过期数据

func (*IPItemDAO) CountAllEnabledIPItems

func (this *IPItemDAO) CountAllEnabledIPItems(tx *dbs.Tx, sourceUserId int64, keyword string, ip string, listId int64, unread bool, eventLevel string, listType string) (int64, error)

CountAllEnabledIPItems 计算数量

func (*IPItemDAO) CountIPItemsWithListId

func (this *IPItemDAO) CountIPItemsWithListId(tx *dbs.Tx, listId int64, sourceUserId int64, keyword string, ipFrom string, ipTo string, eventLevel string) (int64, error)

CountIPItemsWithListId 计算IP数量

func (*IPItemDAO) CreateIPItem

func (this *IPItemDAO) CreateIPItem(tx *dbs.Tx,
	listId int64,
	ipFrom string,
	ipTo string,
	expiredAt int64,
	reason string,
	itemType IPItemType,
	eventLevel string,
	nodeId int64,
	serverId int64,
	sourceNodeId int64,
	sourceServerId int64,
	sourceHTTPFirewallPolicyId int64,
	sourceHTTPFirewallRuleGroupId int64,
	sourceHTTPFirewallRuleSetId int64,
	shouldNotify bool) (int64, error)

CreateIPItem 创建IP

func (*IPItemDAO) DeleteOldItem

func (this *IPItemDAO) DeleteOldItem(tx *dbs.Tx, listId int64, ipFrom string, ipTo string) error

DeleteOldItem 根据IP删除以前的旧记录

func (*IPItemDAO) DisableIPItem

func (this *IPItemDAO) DisableIPItem(tx *dbs.Tx, id int64, sourceUserId int64) error

DisableIPItem 禁用条目

func (*IPItemDAO) DisableIPItemsWithIP

func (this *IPItemDAO) DisableIPItemsWithIP(tx *dbs.Tx, ipFrom string, ipTo string, sourceUserId int64, listId int64) error

DisableIPItemsWithIP 禁用某个IP相关条目

func (*IPItemDAO) DisableIPItemsWithListId

func (this *IPItemDAO) DisableIPItemsWithListId(tx *dbs.Tx, listId int64) error

DisableIPItemsWithListId 禁用某个IP名单内的所有IP

func (*IPItemDAO) EnableIPItem

func (this *IPItemDAO) EnableIPItem(tx *dbs.Tx, id int64) error

EnableIPItem 启用条目

func (*IPItemDAO) ExistsEnabledItem

func (this *IPItemDAO) ExistsEnabledItem(tx *dbs.Tx, itemId int64) (bool, error)

ExistsEnabledItem 检查IP是否存在

func (*IPItemDAO) FindEnabledIPItem

func (this *IPItemDAO) FindEnabledIPItem(tx *dbs.Tx, id int64) (*IPItem, error)

FindEnabledIPItem 查找启用中的条目

func (*IPItemDAO) FindEnabledItemContainsIP

func (this *IPItemDAO) FindEnabledItemContainsIP(tx *dbs.Tx, listId int64, ip uint64) (*IPItem, error)

FindEnabledItemContainsIP 查找包含某个IP的Item

func (*IPItemDAO) FindEnabledItemsWithIP

func (this *IPItemDAO) FindEnabledItemsWithIP(tx *dbs.Tx, ip string) (result []*IPItem, err error)

FindEnabledItemsWithIP 根据IP查找Item

func (*IPItemDAO) FindItemListId

func (this *IPItemDAO) FindItemListId(tx *dbs.Tx, itemId int64) (int64, error)

FindItemListId 查找IPItem对应的列表ID

func (*IPItemDAO) ListAllEnabledIPItems

func (this *IPItemDAO) ListAllEnabledIPItems(tx *dbs.Tx, sourceUserId int64, keyword string, ip string, listId int64, unread bool, eventLevel string, listType string, offset int64, size int64) (result []*IPItem, err error)

ListAllEnabledIPItems 搜索所有IP

func (*IPItemDAO) ListIPItemsAfterVersion

func (this *IPItemDAO) ListIPItemsAfterVersion(tx *dbs.Tx, version int64, size int64) (result []*IPItem, err error)

ListIPItemsAfterVersion 根据版本号查找IP列表

func (*IPItemDAO) ListIPItemsWithListId

func (this *IPItemDAO) ListIPItemsWithListId(tx *dbs.Tx, listId int64, sourceUserId int64, keyword string, ipFrom string, ipTo string, eventLevel string, offset int64, size int64) (result []*IPItem, err error)

ListIPItemsWithListId 查找IP列表

func (*IPItemDAO) NotifyUpdate

func (this *IPItemDAO) NotifyUpdate(tx *dbs.Tx, itemId int64) error

NotifyUpdate 通知更新

func (*IPItemDAO) UpdateIPItem

func (this *IPItemDAO) UpdateIPItem(tx *dbs.Tx, itemId int64, ipFrom string, ipTo string, expiredAt int64, reason string, itemType IPItemType, eventLevel string) error

UpdateIPItem 修改IP

func (*IPItemDAO) UpdateItemsRead

func (this *IPItemDAO) UpdateItemsRead(tx *dbs.Tx, sourceUserId int64) error

UpdateItemsRead 设置所有未已读

type IPItemOperator

type IPItemOperator struct {
	Id                            any // ID
	ListId                        any // 所属名单ID
	Type                          any // 类型
	IpFrom                        any // 开始IP
	IpTo                          any // 结束IP
	IpFromLong                    any // 开始IP整型
	IpToLong                      any // 结束IP整型
	Version                       any // 版本
	CreatedAt                     any // 创建时间
	UpdatedAt                     any // 修改时间
	Reason                        any // 加入说明
	EventLevel                    any // 事件级别
	State                         any // 状态
	ExpiredAt                     any // 过期时间
	ServerId                      any // 有效范围服务ID
	NodeId                        any // 有效范围节点ID
	SourceNodeId                  any // 来源节点ID
	SourceServerId                any // 来源服务ID
	SourceHTTPFirewallPolicyId    any // 来源策略ID
	SourceHTTPFirewallRuleGroupId any // 来源规则集分组ID
	SourceHTTPFirewallRuleSetId   any // 来源规则集ID
	SourceUserId                  any // 用户ID
	IsRead                        any // 是否已读
}

func NewIPItemOperator

func NewIPItemOperator() *IPItemOperator

type IPItemType

type IPItemType = string
const (
	IPItemTypeIPv4 IPItemType = "ipv4" // IPv4
	IPItemTypeIPv6 IPItemType = "ipv6" // IPv6
	IPItemTypeAll  IPItemType = "all"  // 所有IP
)

type IPLibrary

type IPLibrary struct {
	Id        uint32 `field:"id"`        // ID
	AdminId   uint32 `field:"adminId"`   // 管理员ID
	FileId    uint32 `field:"fileId"`    // 文件ID
	Type      string `field:"type"`      // 类型
	Name      string `field:"name"`      // 名称
	IsPublic  bool   `field:"isPublic"`  // 是否公用
	State     uint8  `field:"state"`     // 状态
	CreatedAt uint64 `field:"createdAt"` // 创建时间
}

IPLibrary IP库

type IPLibraryArtifact added in v0.5.2

type IPLibraryArtifact struct {
	Id            uint32   `field:"id"`            // ID
	Name          string   `field:"name"`          // 名称
	FileId        uint64   `field:"fileId"`        // 文件ID
	LibraryFileId uint32   `field:"libraryFileId"` // IP库文件ID
	CreatedAt     uint64   `field:"createdAt"`     // 创建时间
	Meta          dbs.JSON `field:"meta"`          // 元数据
	IsPublic      bool     `field:"isPublic"`      // 是否为公用
	Code          string   `field:"code"`          // 代号
	State         uint8    `field:"state"`         // 状态
}

IPLibraryArtifact IP库制品

type IPLibraryArtifactDAO added in v0.5.2

type IPLibraryArtifactDAO dbs.DAO
var SharedIPLibraryArtifactDAO *IPLibraryArtifactDAO

func NewIPLibraryArtifactDAO added in v0.5.2

func NewIPLibraryArtifactDAO() *IPLibraryArtifactDAO

func (*IPLibraryArtifactDAO) CreateArtifact added in v0.5.2

func (this *IPLibraryArtifactDAO) CreateArtifact(tx *dbs.Tx, name string, fileId int64, libraryFileId int64, meta *iplibrary.Meta) (int64, error)

CreateArtifact 创建制品

func (*IPLibraryArtifactDAO) DisableIPLibraryArtifact added in v0.5.2

func (this *IPLibraryArtifactDAO) DisableIPLibraryArtifact(tx *dbs.Tx, id int64) error

DisableIPLibraryArtifact 禁用条目

func (*IPLibraryArtifactDAO) EnableIPLibraryArtifact added in v0.5.2

func (this *IPLibraryArtifactDAO) EnableIPLibraryArtifact(tx *dbs.Tx, id int64) error

EnableIPLibraryArtifact 启用条目

func (*IPLibraryArtifactDAO) FindAllArtifacts added in v0.5.2

func (this *IPLibraryArtifactDAO) FindAllArtifacts(tx *dbs.Tx) (result []*IPLibraryArtifact, err error)

FindAllArtifacts 查找制品列表

func (*IPLibraryArtifactDAO) FindEnabledIPLibraryArtifact added in v0.5.2

func (this *IPLibraryArtifactDAO) FindEnabledIPLibraryArtifact(tx *dbs.Tx, id int64) (*IPLibraryArtifact, error)

FindEnabledIPLibraryArtifact 查找启用中的条目

func (*IPLibraryArtifactDAO) FindPublicArtifact added in v0.5.2

func (this *IPLibraryArtifactDAO) FindPublicArtifact(tx *dbs.Tx) (*IPLibraryArtifact, error)

FindPublicArtifact 查找当前使用的制品

func (*IPLibraryArtifactDAO) UpdateArtifactPublic added in v0.5.2

func (this *IPLibraryArtifactDAO) UpdateArtifactPublic(tx *dbs.Tx, artifactId int64, isPublic bool) error

UpdateArtifactPublic 使用某个制品

type IPLibraryArtifactOperator added in v0.5.2

type IPLibraryArtifactOperator struct {
	Id            any // ID
	Name          any // 名称
	FileId        any // 文件ID
	LibraryFileId any // IP库文件ID
	CreatedAt     any // 创建时间
	Meta          any // 元数据
	IsPublic      any // 是否为公用
	Code          any // 代号
	State         any // 状态
}

func NewIPLibraryArtifactOperator added in v0.5.2

func NewIPLibraryArtifactOperator() *IPLibraryArtifactOperator

type IPLibraryDAO

type IPLibraryDAO dbs.DAO
var SharedIPLibraryDAO *IPLibraryDAO

func NewIPLibraryDAO

func NewIPLibraryDAO() *IPLibraryDAO

func (*IPLibraryDAO) CreateIPLibrary

func (this *IPLibraryDAO) CreateIPLibrary(tx *dbs.Tx, libraryType string, fileId int64) (int64, error)

CreateIPLibrary 创建新的IP库

func (*IPLibraryDAO) DisableIPLibrary

func (this *IPLibraryDAO) DisableIPLibrary(tx *dbs.Tx, id int64) error

DisableIPLibrary 禁用条目

func (*IPLibraryDAO) EnableIPLibrary

func (this *IPLibraryDAO) EnableIPLibrary(tx *dbs.Tx, id int64) error

EnableIPLibrary 启用条目

func (*IPLibraryDAO) FindAllEnabledIPLibrariesWithType

func (this *IPLibraryDAO) FindAllEnabledIPLibrariesWithType(tx *dbs.Tx, libraryType string) (result []*IPLibrary, err error)

FindAllEnabledIPLibrariesWithType 查找某个类型的IP库列表

func (*IPLibraryDAO) FindEnabledIPLibrary

func (this *IPLibraryDAO) FindEnabledIPLibrary(tx *dbs.Tx, id int64) (*IPLibrary, error)

FindEnabledIPLibrary 查找启用中的条目

func (*IPLibraryDAO) FindLatestIPLibraryWithType

func (this *IPLibraryDAO) FindLatestIPLibraryWithType(tx *dbs.Tx, libraryType string) (*IPLibrary, error)

FindLatestIPLibraryWithType 查找某个类型的最新的IP库

type IPLibraryFile added in v0.5.0

type IPLibraryFile struct {
	Id              uint64   `field:"id"`              // ID
	Name            string   `field:"name"`            // IP库名称
	FileId          uint64   `field:"fileId"`          // 原始文件ID
	Template        string   `field:"template"`        // 模板
	EmptyValues     dbs.JSON `field:"emptyValues"`     // 空值列表
	GeneratedFileId uint64   `field:"generatedFileId"` // 生成的文件ID
	GeneratedAt     uint64   `field:"generatedAt"`     // 生成时间
	IsFinished      bool     `field:"isFinished"`      // 是否已经完成
	Countries       dbs.JSON `field:"countries"`       // 国家/地区
	Provinces       dbs.JSON `field:"provinces"`       // 省份
	Cities          dbs.JSON `field:"cities"`          // 城市
	Towns           dbs.JSON `field:"towns"`           // 区县
	Providers       dbs.JSON `field:"providers"`       // ISP服务商
	Code            string   `field:"code"`            // 文件代号
	Password        string   `field:"password"`        // 密码
	CreatedAt       uint64   `field:"createdAt"`       // 上传时间
	State           uint8    `field:"state"`           // 状态
}

IPLibraryFile IP库上传的文件

func (*IPLibraryFile) DecodeCities added in v0.5.0

func (this *IPLibraryFile) DecodeCities() [][3]string

func (*IPLibraryFile) DecodeCountries added in v0.5.0

func (this *IPLibraryFile) DecodeCountries() []string

func (*IPLibraryFile) DecodeEmptyValues added in v0.5.0

func (this *IPLibraryFile) DecodeEmptyValues() []string

func (*IPLibraryFile) DecodeProviders added in v0.5.0

func (this *IPLibraryFile) DecodeProviders() []string

func (*IPLibraryFile) DecodeProvinces added in v0.5.0

func (this *IPLibraryFile) DecodeProvinces() [][2]string

func (*IPLibraryFile) DecodeTowns added in v0.5.0

func (this *IPLibraryFile) DecodeTowns() [][4]string

type IPLibraryFileDAO added in v0.5.0

type IPLibraryFileDAO dbs.DAO
var SharedIPLibraryFileDAO *IPLibraryFileDAO

func NewIPLibraryFileDAO added in v0.5.0

func NewIPLibraryFileDAO() *IPLibraryFileDAO

func (*IPLibraryFileDAO) CreateLibraryFile added in v0.5.0

func (this *IPLibraryFileDAO) CreateLibraryFile(tx *dbs.Tx, name string, template string, emptyValues []string, password string, fileId int64, countries []string, provinces [][2]string, cities [][3]string, towns [][4]string, providers []string) (int64, error)

CreateLibraryFile 创建文件

func (*IPLibraryFileDAO) DisableIPLibraryFile added in v0.5.0

func (this *IPLibraryFileDAO) DisableIPLibraryFile(tx *dbs.Tx, id int64) error

DisableIPLibraryFile 禁用条目

func (*IPLibraryFileDAO) EnableIPLibraryFile added in v0.5.0

func (this *IPLibraryFileDAO) EnableIPLibraryFile(tx *dbs.Tx, id uint64) error

EnableIPLibraryFile 启用条目

func (*IPLibraryFileDAO) FindAllFinishedLibraryFiles added in v0.5.2

func (this *IPLibraryFileDAO) FindAllFinishedLibraryFiles(tx *dbs.Tx) (result []*IPLibraryFile, err error)

FindAllFinishedLibraryFiles 查找所有已完成的文件

func (*IPLibraryFileDAO) FindAllUnfinishedLibraryFiles added in v0.5.0

func (this *IPLibraryFileDAO) FindAllUnfinishedLibraryFiles(tx *dbs.Tx) (result []*IPLibraryFile, err error)

FindAllUnfinishedLibraryFiles 查找所有未完成的文件

func (*IPLibraryFileDAO) FindEnabledIPLibraryFile added in v0.5.0

func (this *IPLibraryFileDAO) FindEnabledIPLibraryFile(tx *dbs.Tx, id int64) (*IPLibraryFile, error)

FindEnabledIPLibraryFile 查找启用中的条目

func (*IPLibraryFileDAO) FindLibraryFileCities added in v0.5.0

func (this *IPLibraryFileDAO) FindLibraryFileCities(tx *dbs.Tx, fileId int64) ([][3]string, error)

FindLibraryFileCities 获取IP库中的城市

func (*IPLibraryFileDAO) FindLibraryFileCountries added in v0.5.0

func (this *IPLibraryFileDAO) FindLibraryFileCountries(tx *dbs.Tx, fileId int64) ([]string, error)

FindLibraryFileCountries 获取IP库中的国家/地区

func (*IPLibraryFileDAO) FindLibraryFileProviders added in v0.5.0

func (this *IPLibraryFileDAO) FindLibraryFileProviders(tx *dbs.Tx, fileId int64) ([]string, error)

FindLibraryFileProviders 获取IP库中的ISP运营商

func (*IPLibraryFileDAO) FindLibraryFileProvinces added in v0.5.0

func (this *IPLibraryFileDAO) FindLibraryFileProvinces(tx *dbs.Tx, fileId int64) ([][2]string, error)

FindLibraryFileProvinces 获取IP库中的省份

func (*IPLibraryFileDAO) FindLibraryFileTowns added in v0.5.0

func (this *IPLibraryFileDAO) FindLibraryFileTowns(tx *dbs.Tx, fileId int64) ([][4]string, error)

FindLibraryFileTowns 获取IP库中的区县

func (*IPLibraryFileDAO) GenerateIPLibrary added in v0.5.0

func (this *IPLibraryFileDAO) GenerateIPLibrary(tx *dbs.Tx, libraryFileId int64) error

func (*IPLibraryFileDAO) UpdateLibraryFileIsFinished added in v0.5.0

func (this *IPLibraryFileDAO) UpdateLibraryFileIsFinished(tx *dbs.Tx, fileId int64) error

UpdateLibraryFileIsFinished 设置文件为已完成

type IPLibraryFileOperator added in v0.5.0

type IPLibraryFileOperator struct {
	Id              any // ID
	Name            any // IP库名称
	FileId          any // 原始文件ID
	Template        any // 模板
	EmptyValues     any // 空值列表
	GeneratedFileId any // 生成的文件ID
	GeneratedAt     any // 生成时间
	IsFinished      any // 是否已经完成
	Countries       any // 国家/地区
	Provinces       any // 省份
	Cities          any // 城市
	Towns           any // 区县
	Providers       any // ISP服务商
	Code            any // 文件代号
	Password        any // 密码
	CreatedAt       any // 上传时间
	State           any // 状态
}

func NewIPLibraryFileOperator added in v0.5.0

func NewIPLibraryFileOperator() *IPLibraryFileOperator

type IPLibraryOperator

type IPLibraryOperator struct {
	Id        any // ID
	AdminId   any // 管理员ID
	FileId    any // 文件ID
	Type      any // 类型
	Name      any // 名称
	IsPublic  any // 是否公用
	State     any // 状态
	CreatedAt any // 创建时间
}

func NewIPLibraryOperator

func NewIPLibraryOperator() *IPLibraryOperator

type IPList

type IPList struct {
	Id          uint32   `field:"id"`          // ID
	IsOn        bool     `field:"isOn"`        // 是否启用
	Type        string   `field:"type"`        // 类型
	AdminId     uint32   `field:"adminId"`     // 用户ID
	UserId      uint32   `field:"userId"`      // 用户ID
	ServerId    uint64   `field:"serverId"`    // 服务ID
	Name        string   `field:"name"`        // 列表名
	Code        string   `field:"code"`        // 代号
	State       uint8    `field:"state"`       // 状态
	CreatedAt   uint64   `field:"createdAt"`   // 创建时间
	Timeout     dbs.JSON `field:"timeout"`     // 默认超时时间
	Actions     dbs.JSON `field:"actions"`     // IP触发的动作
	Description string   `field:"description"` // 描述
	IsPublic    bool     `field:"isPublic"`    // 是否公用
	IsGlobal    bool     `field:"isGlobal"`    // 是否全局
}

IPList IP名单

type IPListDAO

type IPListDAO dbs.DAO
var SharedIPListDAO *IPListDAO

func NewIPListDAO

func NewIPListDAO() *IPListDAO

func (*IPListDAO) CheckUserIPList

func (this *IPListDAO) CheckUserIPList(tx *dbs.Tx, userId int64, listId int64) error

CheckUserIPList 检查用户权限

func (*IPListDAO) CountAllEnabledIPLists

func (this *IPListDAO) CountAllEnabledIPLists(tx *dbs.Tx, listType string, isPublic bool, keyword string) (int64, error)

CountAllEnabledIPLists 计算名单数量

func (*IPListDAO) CreateIPList

func (this *IPListDAO) CreateIPList(tx *dbs.Tx, userId int64, serverId int64, listType ipconfigs.IPListType, name string, code string, timeoutJSON []byte, description string, isPublic bool, isGlobal bool) (int64, error)

CreateIPList 创建名单

func (*IPListDAO) DisableIPList

func (this *IPListDAO) DisableIPList(tx *dbs.Tx, listId int64) error

DisableIPList 禁用条目

func (*IPListDAO) EnableIPList

func (this *IPListDAO) EnableIPList(tx *dbs.Tx, id int64) error

EnableIPList 启用条目

func (*IPListDAO) ExistsEnabledIPList

func (this *IPListDAO) ExistsEnabledIPList(tx *dbs.Tx, listId int64) (bool, error)

ExistsEnabledIPList 检查IP名单是否存在

func (*IPListDAO) FindEnabledIPList

func (this *IPListDAO) FindEnabledIPList(tx *dbs.Tx, id int64, cacheMap *utils.CacheMap) (*IPList, error)

FindEnabledIPList 查找启用中的条目

func (*IPListDAO) FindIPListCacheable

func (this *IPListDAO) FindIPListCacheable(tx *dbs.Tx, listId int64) (*IPList, error)

FindIPListCacheable 获取名单

func (*IPListDAO) FindIPListName

func (this *IPListDAO) FindIPListName(tx *dbs.Tx, id int64) (string, error)

FindIPListName 根据主键查找名称

func (*IPListDAO) IncreaseVersion

func (this *IPListDAO) IncreaseVersion(tx *dbs.Tx) (int64, error)

IncreaseVersion 增加版本

func (*IPListDAO) ListEnabledIPLists

func (this *IPListDAO) ListEnabledIPLists(tx *dbs.Tx, listType string, isPublic bool, keyword string, offset int64, size int64) (result []*IPList, err error)

ListEnabledIPLists 列出单页名单

func (*IPListDAO) NotifyUpdate

func (this *IPListDAO) NotifyUpdate(tx *dbs.Tx, listId int64, taskType NodeTaskType) error

NotifyUpdate 通知更新

func (*IPListDAO) UpdateIPList

func (this *IPListDAO) UpdateIPList(tx *dbs.Tx, listId int64, name string, code string, timeoutJSON []byte, description string) error

UpdateIPList 修改名单

type IPListOperator

type IPListOperator struct {
	Id          interface{} // ID
	IsOn        interface{} // 是否启用
	Type        interface{} // 类型
	AdminId     interface{} // 用户ID
	UserId      interface{} // 用户ID
	ServerId    interface{} // 服务ID
	Name        interface{} // 列表名
	Code        interface{} // 代号
	State       interface{} // 状态
	CreatedAt   interface{} // 创建时间
	Timeout     interface{} // 默认超时时间
	Actions     interface{} // IP触发的动作
	Description interface{} // 描述
	IsPublic    interface{} // 是否公用
	IsGlobal    interface{} // 是否全局
}

func NewIPListOperator

func NewIPListOperator() *IPListOperator

type LatestItem

type LatestItem struct {
	Id        uint64 `field:"id"`        // ID
	ItemType  string `field:"itemType"`  // Item类型
	ItemId    uint64 `field:"itemId"`    // itemID
	Count     uint64 `field:"count"`     // 数量
	UpdatedAt uint64 `field:"updatedAt"` // 更新时间
}

LatestItem 最近的条目统计

type LatestItemDAO

type LatestItemDAO dbs.DAO
var SharedLatestItemDAO *LatestItemDAO

func NewLatestItemDAO

func NewLatestItemDAO() *LatestItemDAO

func (*LatestItemDAO) IncreaseItemCount

func (this *LatestItemDAO) IncreaseItemCount(tx *dbs.Tx, itemType LatestItemType, itemId int64) error

IncreaseItemCount 增加数量

type LatestItemOperator

type LatestItemOperator struct {
	Id        interface{} // ID
	ItemType  interface{} // Item类型
	ItemId    interface{} // itemID
	Count     interface{} // 数量
	UpdatedAt interface{} // 更新时间
}

func NewLatestItemOperator

func NewLatestItemOperator() *LatestItemOperator

type LatestItemType

type LatestItemType = string
const (
	LatestItemTypeCluster LatestItemType = "cluster"
	LatestItemTypeServer  LatestItemType = "server"
)

type Log

type Log struct {
	Id              uint32   `field:"id"`              // ID
	Level           string   `field:"level"`           // 级别
	Description     string   `field:"description"`     // 描述
	CreatedAt       uint64   `field:"createdAt"`       // 创建时间
	Action          string   `field:"action"`          // 动作
	UserId          uint32   `field:"userId"`          // 用户ID
	AdminId         uint32   `field:"adminId"`         // 管理员ID
	ProviderId      uint32   `field:"providerId"`      // 供应商ID
	Ip              string   `field:"ip"`              // IP地址
	Type            string   `field:"type"`            // 类型:admin, user
	Day             string   `field:"day"`             // 日期
	BillId          uint32   `field:"billId"`          // 账单ID
	LangMessageCode string   `field:"langMessageCode"` // 多语言消息代号
	LangMessageArgs dbs.JSON `field:"langMessageArgs"` // 多语言参数
	Params          dbs.JSON `field:"params"`          // 关联对象参数
}

Log 操作日志

type LogDAO

type LogDAO dbs.DAO
var SharedLogDAO *LogDAO

func NewLogDAO

func NewLogDAO() *LogDAO

func (*LogDAO) CountLogs

func (this *LogDAO) CountLogs(tx *dbs.Tx, dayFrom string, dayTo string, keyword string, userType string, level string) (int64, error)

CountLogs 计算所有日志数量

func (*LogDAO) CreateLog

func (this *LogDAO) CreateLog(tx *dbs.Tx, adminType string, adminId int64, level string, description string, action string, ip string, langMessageCode langs.MessageCode, langMessageArgs []any) error

CreateLog 创建管理员日志

func (*LogDAO) DeleteAllLogsPermanently

func (this *LogDAO) DeleteAllLogsPermanently(tx *dbs.Tx) error

DeleteAllLogsPermanently 物理删除所有日志

func (*LogDAO) DeleteLogPermanently

func (this *LogDAO) DeleteLogPermanently(tx *dbs.Tx, logId int64) error

DeleteLogPermanently 物理删除日志

func (*LogDAO) DeleteLogsPermanentlyBeforeDays

func (this *LogDAO) DeleteLogsPermanentlyBeforeDays(tx *dbs.Tx, days int) error

DeleteLogsPermanentlyBeforeDays 物理删除某些天之前的日志

func (*LogDAO) ListLogs

func (this *LogDAO) ListLogs(tx *dbs.Tx, offset int64, size int64, dayFrom string, dayTo string, keyword string, userType string, level string) (result []*Log, err error)

ListLogs 列出单页日志

func (*LogDAO) SumLogsSize

func (this *LogDAO) SumLogsSize() (int64, error)

SumLogsSize 计算当前日志容量大小

type LogOperator

type LogOperator struct {
	Id              any // ID
	Level           any // 级别
	Description     any // 描述
	CreatedAt       any // 创建时间
	Action          any // 动作
	UserId          any // 用户ID
	AdminId         any // 管理员ID
	ProviderId      any // 供应商ID
	Ip              any // IP地址
	Type            any // 类型:admin, user
	Day             any // 日期
	BillId          any // 账单ID
	LangMessageCode any // 多语言消息代号
	LangMessageArgs any // 多语言参数
	Params          any // 关联对象参数
}

func NewLogOperator

func NewLogOperator() *LogOperator

type Login

type Login struct {
	Id      uint32   `field:"id"`      // ID
	AdminId uint32   `field:"adminId"` // 管理员ID
	UserId  uint32   `field:"userId"`  // 用户ID
	IsOn    bool     `field:"isOn"`    // 是否启用
	Type    string   `field:"type"`    // 认证方式
	Params  dbs.JSON `field:"params"`  // 参数
	State   uint8    `field:"state"`   // 状态
}

Login 第三方登录认证

type LoginDAO

type LoginDAO dbs.DAO
var SharedLoginDAO *LoginDAO

func NewLoginDAO

func NewLoginDAO() *LoginDAO

func (*LoginDAO) CheckLoginIsOn

func (this *LoginDAO) CheckLoginIsOn(tx *dbs.Tx, adminId int64, userId int64, loginType LoginType) (bool, error)

CheckLoginIsOn 检查某个认证是否启用

func (*LoginDAO) CreateLogin

func (this *LoginDAO) CreateLogin(tx *dbs.Tx, Id int64, loginType LoginType, params maps.Map) (int64, error)

CreateLogin 创建认证

func (*LoginDAO) DisableLogin

func (this *LoginDAO) DisableLogin(tx *dbs.Tx, id int64) error

DisableLogin 禁用条目

func (*LoginDAO) DisableLoginWithType added in v0.4.10

func (this *LoginDAO) DisableLoginWithType(tx *dbs.Tx, adminId int64, userId int64, loginType LoginType) error

DisableLoginWithType 禁用相关认证

func (*LoginDAO) EnableLogin

func (this *LoginDAO) EnableLogin(tx *dbs.Tx, id int64) error

EnableLogin 启用条目

func (*LoginDAO) FindEnabledLogin

func (this *LoginDAO) FindEnabledLogin(tx *dbs.Tx, id int64) (*Login, error)

FindEnabledLogin 查找启用中的条目

func (*LoginDAO) FindEnabledLoginWithType added in v0.4.10

func (this *LoginDAO) FindEnabledLoginWithType(tx *dbs.Tx, adminId int64, userId int64, loginType LoginType) (*Login, error)

FindEnabledLoginWithType 查找管理员和用户相关的认证

func (*LoginDAO) UpdateLogin

func (this *LoginDAO) UpdateLogin(tx *dbs.Tx, adminId int64, userId int64, loginType LoginType, params maps.Map, isOn bool) error

UpdateLogin 修改认证

type LoginOperator

type LoginOperator struct {
	Id      interface{} // ID
	AdminId interface{} // 管理员ID
	UserId  interface{} // 用户ID
	IsOn    interface{} // 是否启用
	Type    interface{} // 认证方式
	Params  interface{} // 参数
	State   interface{} // 状态
}

func NewLoginOperator

func NewLoginOperator() *LoginOperator

type LoginSession added in v0.6.4

type LoginSession struct {
	Id        uint64   `field:"id"`        // ID
	AdminId   uint64   `field:"adminId"`   // 管理员ID
	UserId    uint64   `field:"userId"`    // 用户ID
	Sid       string   `field:"sid"`       // 令牌
	Values    dbs.JSON `field:"values"`    // 数据
	Ip        string   `field:"ip"`        // 登录IP
	CreatedAt uint64   `field:"createdAt"` // 创建时间
	ExpiresAt uint64   `field:"expiresAt"` // 过期时间
}

LoginSession 登录Session

func (*LoginSession) IsAvailable added in v0.6.4

func (this *LoginSession) IsAvailable() bool

type LoginSessionDAO added in v0.6.4

type LoginSessionDAO dbs.DAO
var SharedLoginSessionDAO *LoginSessionDAO

func NewLoginSessionDAO added in v0.6.4

func NewLoginSessionDAO() *LoginSessionDAO

func (*LoginSessionDAO) CreateSession added in v0.6.4

func (this *LoginSessionDAO) CreateSession(tx *dbs.Tx, sid string, ip string, expiresAt int64) (int64, error)

CreateSession 创建SESSION

func (*LoginSessionDAO) DeleteSession added in v0.6.4

func (this *LoginSessionDAO) DeleteSession(tx *dbs.Tx, sid string) error

DeleteSession 删除SESSION

func (*LoginSessionDAO) FindSession added in v0.6.4

func (this *LoginSessionDAO) FindSession(tx *dbs.Tx, sid string) (*LoginSession, error)

FindSession 查询SESSION

func (*LoginSessionDAO) WriteSessionValue added in v0.6.4

func (this *LoginSessionDAO) WriteSessionValue(tx *dbs.Tx, sid string, key string, value any) error

WriteSessionValue 向SESSION中写入数据

type LoginSessionOperator added in v0.6.4

type LoginSessionOperator struct {
	Id        any // ID
	AdminId   any // 管理员ID
	UserId    any // 用户ID
	Sid       any // 令牌
	Values    any // 数据
	Ip        any // 登录IP
	CreatedAt any // 创建时间
	ExpiresAt any // 过期时间
}

func NewLoginSessionOperator added in v0.6.4

func NewLoginSessionOperator() *LoginSessionOperator

type LoginType

type LoginType = string
const (
	LoginTypeOTP LoginType = "otp"
)

type Message

type Message struct {
	Id        uint64   `field:"id"`        // ID
	AdminId   uint32   `field:"adminId"`   // 管理员ID
	UserId    uint32   `field:"userId"`    // 用户ID
	Role      string   `field:"role"`      // 角色
	ClusterId uint32   `field:"clusterId"` // 集群ID
	NodeId    uint32   `field:"nodeId"`    // 节点ID
	Level     string   `field:"level"`     // 级别
	Subject   string   `field:"subject"`   // 标题
	Body      string   `field:"body"`      // 内容
	Type      string   `field:"type"`      // 消息类型
	Params    dbs.JSON `field:"params"`    // 额外的参数
	IsRead    bool     `field:"isRead"`    // 是否已读
	State     uint8    `field:"state"`     // 状态
	CreatedAt uint64   `field:"createdAt"` // 创建时间
	Day       string   `field:"day"`       // 日期YYYYMMDD
	Hash      string   `field:"hash"`      // 消息内容的Hash
}

Message 消息通知

type MessageDAO

type MessageDAO dbs.DAO
var SharedMessageDAO *MessageDAO

func NewMessageDAO

func NewMessageDAO() *MessageDAO

func (*MessageDAO) CheckMessageUser

func (this *MessageDAO) CheckMessageUser(tx *dbs.Tx, messageId int64, adminId int64, userId int64) (bool, error)

CheckMessageUser 检查消息权限

func (*MessageDAO) CountUnreadMessages

func (this *MessageDAO) CountUnreadMessages(tx *dbs.Tx, adminId int64, userId int64) (int64, error)

CountUnreadMessages 计算未读消息数量

func (*MessageDAO) CreateClusterMessage

func (this *MessageDAO) CreateClusterMessage(tx *dbs.Tx, role string, clusterId int64, messageType MessageType, level string, subject string, shortBody string, body string, paramsJSON []byte) error

CreateClusterMessage 创建集群消息

func (*MessageDAO) CreateMessage

func (this *MessageDAO) CreateMessage(tx *dbs.Tx, adminId int64, userId int64, messageType MessageType, level string, subject string, body string, paramsJSON []byte) error

CreateMessage 创建普通消息

func (*MessageDAO) CreateNodeMessage

func (this *MessageDAO) CreateNodeMessage(tx *dbs.Tx, role string, clusterId int64, nodeId int64, messageType MessageType, level string, subject string, body string, paramsJSON []byte, force bool) error

CreateNodeMessage 创建节点消息

func (*MessageDAO) DeleteMessagesBeforeDay

func (this *MessageDAO) DeleteMessagesBeforeDay(tx *dbs.Tx, dayTime time.Time) error

DeleteMessagesBeforeDay 删除某天之前的消息

func (*MessageDAO) DisableMessage

func (this *MessageDAO) DisableMessage(tx *dbs.Tx, id int64) error

DisableMessage 禁用条目

func (*MessageDAO) EnableMessage

func (this *MessageDAO) EnableMessage(tx *dbs.Tx, id int64) error

EnableMessage 启用条目

func (*MessageDAO) FindEnabledMessage

func (this *MessageDAO) FindEnabledMessage(tx *dbs.Tx, id int64) (*Message, error)

FindEnabledMessage 查找启用中的条目

func (*MessageDAO) ListUnreadMessages

func (this *MessageDAO) ListUnreadMessages(tx *dbs.Tx, adminId int64, userId int64, offset int64, size int64) (result []*Message, err error)

ListUnreadMessages 列出单页未读消息

func (*MessageDAO) UpdateAllMessagesRead

func (this *MessageDAO) UpdateAllMessagesRead(tx *dbs.Tx, adminId int64, userId int64) error

UpdateAllMessagesRead 设置所有消息为已读

func (*MessageDAO) UpdateMessageRead

func (this *MessageDAO) UpdateMessageRead(tx *dbs.Tx, messageId int64, b bool) error

UpdateMessageRead 设置消息已读状态

func (*MessageDAO) UpdateMessagesRead

func (this *MessageDAO) UpdateMessagesRead(tx *dbs.Tx, messageIds []int64, b bool) error

UpdateMessagesRead 设置一组消息为已读状态

type MessageMedia

type MessageMedia struct {
	Id              uint32 `field:"id"`              // ID
	Name            string `field:"name"`            // 名称
	Type            string `field:"type"`            // 类型
	Description     string `field:"description"`     // 描述
	UserDescription string `field:"userDescription"` // 用户描述
	IsOn            bool   `field:"isOn"`            // 是否启用
	Order           uint32 `field:"order"`           // 排序
	State           uint8  `field:"state"`           // 状态
}

MessageMedia 消息媒介

type MessageMediaDAO

type MessageMediaDAO dbs.DAO
var SharedMessageMediaDAO *MessageMediaDAO

func NewMessageMediaDAO

func NewMessageMediaDAO() *MessageMediaDAO

func (*MessageMediaDAO) DisableMessageMedia

func (this *MessageMediaDAO) DisableMessageMedia(tx *dbs.Tx, id int64) error

DisableMessageMedia 禁用条目

func (*MessageMediaDAO) EnableMessageMedia

func (this *MessageMediaDAO) EnableMessageMedia(tx *dbs.Tx, id int64) error

EnableMessageMedia 启用条目

func (*MessageMediaDAO) FindAllEnabledMessageMedias

func (this *MessageMediaDAO) FindAllEnabledMessageMedias(tx *dbs.Tx) (result []*MessageMedia, err error)

FindAllEnabledMessageMedias 查询所有可用媒介

func (*MessageMediaDAO) FindEnabledMessageMedia

func (this *MessageMediaDAO) FindEnabledMessageMedia(tx *dbs.Tx, id int64) (*MessageMedia, error)

FindEnabledMessageMedia 查找启用中的条目

func (*MessageMediaDAO) FindMessageMediaName

func (this *MessageMediaDAO) FindMessageMediaName(tx *dbs.Tx, id int64) (string, error)

FindMessageMediaName 根据主键查找名称

type MessageMediaInstance

type MessageMediaInstance struct {
	Id          uint32   `field:"id"`          // ID
	Name        string   `field:"name"`        // 名称
	IsOn        bool     `field:"isOn"`        // 是否启用
	MediaType   string   `field:"mediaType"`   // 媒介类型
	Params      dbs.JSON `field:"params"`      // 媒介参数
	Description string   `field:"description"` // 备注
	Rate        dbs.JSON `field:"rate"`        // 发送频率
	State       uint8    `field:"state"`       // 状态
	HashLife    int32    `field:"hashLife"`    // HASH有效期(秒)
}

MessageMediaInstance 消息媒介接收人

type MessageMediaInstanceDAO

type MessageMediaInstanceDAO dbs.DAO
var SharedMessageMediaInstanceDAO *MessageMediaInstanceDAO

func NewMessageMediaInstanceDAO

func NewMessageMediaInstanceDAO() *MessageMediaInstanceDAO

func (*MessageMediaInstanceDAO) CountAllEnabledMediaInstances

func (this *MessageMediaInstanceDAO) CountAllEnabledMediaInstances(tx *dbs.Tx, mediaType string, keyword string) (int64, error)

CountAllEnabledMediaInstances 计算接收人数量

func (*MessageMediaInstanceDAO) CreateMediaInstance

func (this *MessageMediaInstanceDAO) CreateMediaInstance(tx *dbs.Tx, name string, mediaType string, params maps.Map, description string, rateJSON []byte, hashLifeSeconds int32) (int64, error)

CreateMediaInstance 创建媒介实例

func (*MessageMediaInstanceDAO) DisableMessageMediaInstance

func (this *MessageMediaInstanceDAO) DisableMessageMediaInstance(tx *dbs.Tx, id int64) error

DisableMessageMediaInstance 禁用条目

func (*MessageMediaInstanceDAO) EnableMessageMediaInstance

func (this *MessageMediaInstanceDAO) EnableMessageMediaInstance(tx *dbs.Tx, id int64) error

EnableMessageMediaInstance 启用条目

func (*MessageMediaInstanceDAO) FindEnabledMessageMediaInstance

func (this *MessageMediaInstanceDAO) FindEnabledMessageMediaInstance(tx *dbs.Tx, instanceId int64, cacheMap *utils.CacheMap) (*MessageMediaInstance, error)

FindEnabledMessageMediaInstance 查找启用中的条目

func (*MessageMediaInstanceDAO) FindInstanceHashLifeSeconds

func (this *MessageMediaInstanceDAO) FindInstanceHashLifeSeconds(tx *dbs.Tx, instanceId int64) (int32, error)

FindInstanceHashLifeSeconds 获取单个实例的HashLife

func (*MessageMediaInstanceDAO) ListAllEnabledMediaInstances

func (this *MessageMediaInstanceDAO) ListAllEnabledMediaInstances(tx *dbs.Tx, mediaType string, keyword string, offset int64, size int64) (result []*MessageMediaInstance, err error)

ListAllEnabledMediaInstances 列出单页接收人

func (*MessageMediaInstanceDAO) UpdateMediaInstance

func (this *MessageMediaInstanceDAO) UpdateMediaInstance(tx *dbs.Tx, instanceId int64, name string, mediaType string, params maps.Map, description string, rateJSON []byte, hashLifeSeconds int32, isOn bool) error

UpdateMediaInstance 修改媒介实例

type MessageMediaInstanceOperator

type MessageMediaInstanceOperator struct {
	Id          interface{} // ID
	Name        interface{} // 名称
	IsOn        interface{} // 是否启用
	MediaType   interface{} // 媒介类型
	Params      interface{} // 媒介参数
	Description interface{} // 备注
	Rate        interface{} // 发送频率
	State       interface{} // 状态
	HashLife    interface{} // HASH有效期(秒)
}

func NewMessageMediaInstanceOperator

func NewMessageMediaInstanceOperator() *MessageMediaInstanceOperator

type MessageMediaOperator

type MessageMediaOperator struct {
	Id              interface{} // ID
	Name            interface{} // 名称
	Type            interface{} // 类型
	Description     interface{} // 描述
	UserDescription interface{} // 用户描述
	IsOn            interface{} // 是否启用
	Order           interface{} // 排序
	State           interface{} // 状态
}

func NewMessageMediaOperator

func NewMessageMediaOperator() *MessageMediaOperator

type MessageOperator

type MessageOperator struct {
	Id        interface{} // ID
	AdminId   interface{} // 管理员ID
	UserId    interface{} // 用户ID
	Role      interface{} // 角色
	ClusterId interface{} // 集群ID
	NodeId    interface{} // 节点ID
	Level     interface{} // 级别
	Subject   interface{} // 标题
	Body      interface{} // 内容
	Type      interface{} // 消息类型
	Params    interface{} // 额外的参数
	IsRead    interface{} // 是否已读
	State     interface{} // 状态
	CreatedAt interface{} // 创建时间
	Day       interface{} // 日期YYYYMMDD
	Hash      interface{} // 消息内容的Hash
}

func NewMessageOperator

func NewMessageOperator() *MessageOperator

type MessageReceiver

type MessageReceiver struct {
	Id               uint32   `field:"id"`               // ID
	Role             string   `field:"role"`             // 节点角色
	ClusterId        uint32   `field:"clusterId"`        // 集群ID
	NodeId           uint32   `field:"nodeId"`           // 节点ID
	ServerId         uint32   `field:"serverId"`         // 服务ID
	Type             string   `field:"type"`             // 类型
	Params           dbs.JSON `field:"params"`           // 参数
	RecipientId      uint32   `field:"recipientId"`      // 接收人ID
	RecipientGroupId uint32   `field:"recipientGroupId"` // 接收人分组ID
	State            uint8    `field:"state"`            // 状态
}

MessageReceiver 消息通知接收人

type MessageReceiverDAO

type MessageReceiverDAO dbs.DAO
var SharedMessageReceiverDAO *MessageReceiverDAO

func NewMessageReceiverDAO

func NewMessageReceiverDAO() *MessageReceiverDAO

func (*MessageReceiverDAO) CountAllEnabledReceivers

func (this *MessageReceiverDAO) CountAllEnabledReceivers(tx *dbs.Tx, role string, clusterId int64, nodeId int64, serverId int64, messageType string) (int64, error)

CountAllEnabledReceivers 计算接收人数量

func (*MessageReceiverDAO) CreateReceiver

func (this *MessageReceiverDAO) CreateReceiver(tx *dbs.Tx, role string, clusterId int64, nodeId int64, serverId int64, messageType MessageType, params maps.Map, recipientId int64, recipientGroupId int64) (int64, error)

CreateReceiver 创建接收人

func (*MessageReceiverDAO) DisableMessageReceiver

func (this *MessageReceiverDAO) DisableMessageReceiver(tx *dbs.Tx, id int64) error

DisableMessageReceiver 禁用条目

func (*MessageReceiverDAO) DisableReceivers

func (this *MessageReceiverDAO) DisableReceivers(tx *dbs.Tx, clusterId int64, nodeId int64, serverId int64) error

DisableReceivers 禁用一组接收人

func (*MessageReceiverDAO) EnableMessageReceiver

func (this *MessageReceiverDAO) EnableMessageReceiver(tx *dbs.Tx, id int64) error

EnableMessageReceiver 启用条目

func (*MessageReceiverDAO) FindEnabledBestFitReceivers

func (this *MessageReceiverDAO) FindEnabledBestFitReceivers(tx *dbs.Tx, role string, clusterId int64, nodeId int64, serverId int64, messageType string) (result []*MessageReceiver, err error)

FindEnabledBestFitReceivers 查询最适合的接收人

func (*MessageReceiverDAO) FindEnabledMessageReceiver

func (this *MessageReceiverDAO) FindEnabledMessageReceiver(tx *dbs.Tx, id int64) (*MessageReceiver, error)

FindEnabledMessageReceiver 查找启用中的条目

type MessageReceiverOperator

type MessageReceiverOperator struct {
	Id               interface{} // ID
	Role             interface{} // 节点角色
	ClusterId        interface{} // 集群ID
	NodeId           interface{} // 节点ID
	ServerId         interface{} // 服务ID
	Type             interface{} // 类型
	Params           interface{} // 参数
	RecipientId      interface{} // 接收人ID
	RecipientGroupId interface{} // 接收人分组ID
	State            interface{} // 状态
}

func NewMessageReceiverOperator

func NewMessageReceiverOperator() *MessageReceiverOperator

type MessageRecipient

type MessageRecipient struct {
	Id          uint32   `field:"id"`          // ID
	AdminId     uint32   `field:"adminId"`     // 管理员ID
	IsOn        bool     `field:"isOn"`        // 是否启用
	InstanceId  uint32   `field:"instanceId"`  // 实例ID
	User        string   `field:"user"`        // 接收人信息
	GroupIds    dbs.JSON `field:"groupIds"`    // 分组ID
	State       uint8    `field:"state"`       // 状态
	TimeFrom    string   `field:"timeFrom"`    // 开始时间
	TimeTo      string   `field:"timeTo"`      // 结束时间
	Description string   `field:"description"` // 备注
}

MessageRecipient 消息媒介接收人

func (*MessageRecipient) DecodeGroupIds

func (this *MessageRecipient) DecodeGroupIds() []int64

DecodeGroupIds 解析分组ID

type MessageRecipientDAO

type MessageRecipientDAO dbs.DAO
var SharedMessageRecipientDAO *MessageRecipientDAO

func NewMessageRecipientDAO

func NewMessageRecipientDAO() *MessageRecipientDAO

func (*MessageRecipientDAO) CountAllEnabledRecipients

func (this *MessageRecipientDAO) CountAllEnabledRecipients(tx *dbs.Tx, adminId int64, groupId int64, mediaType string, keyword string) (int64, error)

CountAllEnabledRecipients 计算接收人数量

func (*MessageRecipientDAO) CreateRecipient

func (this *MessageRecipientDAO) CreateRecipient(tx *dbs.Tx, adminId int64, instanceId int64, user string, groupIds []int64, description string, timeFrom string, timeTo string) (int64, error)

CreateRecipient 创建接收人

func (*MessageRecipientDAO) DisableMessageRecipient

func (this *MessageRecipientDAO) DisableMessageRecipient(tx *dbs.Tx, id int64) error

DisableMessageRecipient 禁用条目

func (*MessageRecipientDAO) EnableMessageRecipient

func (this *MessageRecipientDAO) EnableMessageRecipient(tx *dbs.Tx, id int64) error

EnableMessageRecipient 启用条目

func (*MessageRecipientDAO) FindAllEnabledAndOnRecipientIdsWithGroup

func (this *MessageRecipientDAO) FindAllEnabledAndOnRecipientIdsWithGroup(tx *dbs.Tx, groupId int64) ([]int64, error)

FindAllEnabledAndOnRecipientIdsWithGroup 查找某个分组下的所有可用接收人ID

func (*MessageRecipientDAO) FindEnabledMessageRecipient

func (this *MessageRecipientDAO) FindEnabledMessageRecipient(tx *dbs.Tx, recipientId int64, cacheMap *utils.CacheMap,
) (*MessageRecipient, error)

FindEnabledMessageRecipient 查找启用中的条目

func (*MessageRecipientDAO) FindRecipientInstanceId

func (this *MessageRecipientDAO) FindRecipientInstanceId(tx *dbs.Tx, recipientId int64) (int64, error)

FindRecipientInstanceId 查找接收人的媒介

func (*MessageRecipientDAO) ListAllEnabledRecipients

func (this *MessageRecipientDAO) ListAllEnabledRecipients(tx *dbs.Tx, adminId int64, groupId int64, mediaType string, keyword string, offset int64, size int64) (result []*MessageRecipient, err error)

ListAllEnabledRecipients 列出单页接收人

func (*MessageRecipientDAO) UpdateRecipient

func (this *MessageRecipientDAO) UpdateRecipient(tx *dbs.Tx, recipientId int64, adminId int64, instanceId int64, user string, groupIds []int64, description string, timeFrom string, timeTo string, isOn bool) error

UpdateRecipient 修改接收人

type MessageRecipientGroup

type MessageRecipientGroup struct {
	Id    uint32 `field:"id"`    // ID
	Name  string `field:"name"`  // 分组名
	Order uint32 `field:"order"` // 排序
	IsOn  bool   `field:"isOn"`  // 是否启用
	State uint8  `field:"state"` // 状态
}

MessageRecipientGroup 消息接收人分组

type MessageRecipientGroupDAO

type MessageRecipientGroupDAO dbs.DAO
var SharedMessageRecipientGroupDAO *MessageRecipientGroupDAO

func NewMessageRecipientGroupDAO

func NewMessageRecipientGroupDAO() *MessageRecipientGroupDAO

func (*MessageRecipientGroupDAO) CreateGroup

func (this *MessageRecipientGroupDAO) CreateGroup(tx *dbs.Tx, name string) (int64, error)

创建分组

func (*MessageRecipientGroupDAO) DisableMessageRecipientGroup

func (this *MessageRecipientGroupDAO) DisableMessageRecipientGroup(tx *dbs.Tx, id int64) error

禁用条目

func (*MessageRecipientGroupDAO) EnableMessageRecipientGroup

func (this *MessageRecipientGroupDAO) EnableMessageRecipientGroup(tx *dbs.Tx, id int64) error

启用条目

func (*MessageRecipientGroupDAO) FindAllEnabledGroups

func (this *MessageRecipientGroupDAO) FindAllEnabledGroups(tx *dbs.Tx) (result []*MessageRecipientGroup, err error)

查找所有分组

func (*MessageRecipientGroupDAO) FindEnabledMessageRecipientGroup

func (this *MessageRecipientGroupDAO) FindEnabledMessageRecipientGroup(tx *dbs.Tx, id int64) (*MessageRecipientGroup, error)

查找启用中的条目

func (*MessageRecipientGroupDAO) FindMessageRecipientGroupName

func (this *MessageRecipientGroupDAO) FindMessageRecipientGroupName(tx *dbs.Tx, id int64) (string, error)

根据主键查找名称

func (*MessageRecipientGroupDAO) UpdateGroup

func (this *MessageRecipientGroupDAO) UpdateGroup(tx *dbs.Tx, groupId int64, name string, isOn bool) error

修改分组

type MessageRecipientGroupOperator

type MessageRecipientGroupOperator struct {
	Id    interface{} // ID
	Name  interface{} // 分组名
	Order interface{} // 排序
	IsOn  interface{} // 是否启用
	State interface{} // 状态
}

func NewMessageRecipientGroupOperator

func NewMessageRecipientGroupOperator() *MessageRecipientGroupOperator

type MessageRecipientOperator

type MessageRecipientOperator struct {
	Id          interface{} // ID
	AdminId     interface{} // 管理员ID
	IsOn        interface{} // 是否启用
	InstanceId  interface{} // 实例ID
	User        interface{} // 接收人信息
	GroupIds    interface{} // 分组ID
	State       interface{} // 状态
	TimeFrom    interface{} // 开始时间
	TimeTo      interface{} // 结束时间
	Description interface{} // 备注
}

func NewMessageRecipientOperator

func NewMessageRecipientOperator() *MessageRecipientOperator

type MessageTask

type MessageTask struct {
	Id          uint64   `field:"id"`          // ID
	RecipientId uint32   `field:"recipientId"` // 接收人ID
	Hash        string   `field:"hash"`        // SUM标识
	InstanceId  uint32   `field:"instanceId"`  // 媒介实例ID
	User        string   `field:"user"`        // 接收用户标识
	Subject     string   `field:"subject"`     // 标题
	Body        string   `field:"body"`        // 内容
	CreatedAt   uint64   `field:"createdAt"`   // 创建时间
	Status      uint8    `field:"status"`      // 发送状态
	SentAt      uint64   `field:"sentAt"`      // 最后一次发送时间
	State       uint8    `field:"state"`       // 状态
	Result      dbs.JSON `field:"result"`      // 结果
	Day         string   `field:"day"`         // YYYYMMDD
	IsPrimary   bool     `field:"isPrimary"`   // 是否优先
}

MessageTask 消息发送相关任务

type MessageTaskDAO

type MessageTaskDAO dbs.DAO
var SharedMessageTaskDAO *MessageTaskDAO

func NewMessageTaskDAO

func NewMessageTaskDAO() *MessageTaskDAO

func (*MessageTaskDAO) CleanExpiredMessageTasks

func (this *MessageTaskDAO) CleanExpiredMessageTasks(tx *dbs.Tx, days int) error

CleanExpiredMessageTasks 清理

func (*MessageTaskDAO) CreateMessageTasks

func (this *MessageTaskDAO) CreateMessageTasks(tx *dbs.Tx, role nodeconfigs.NodeRole, clusterId int64, nodeId int64, serverId int64, messageType MessageType, subject string, body string) error

CreateMessageTasks 从集群、节点或者服务中创建任务

func (*MessageTaskDAO) DisableMessageTask

func (this *MessageTaskDAO) DisableMessageTask(tx *dbs.Tx, id int64) error

DisableMessageTask 禁用条目

func (*MessageTaskDAO) EnableMessageTask

func (this *MessageTaskDAO) EnableMessageTask(tx *dbs.Tx, id int64) error

EnableMessageTask 启用条目

func (*MessageTaskDAO) FindEnabledMessageTask

func (this *MessageTaskDAO) FindEnabledMessageTask(tx *dbs.Tx, id int64) (*MessageTask, error)

FindEnabledMessageTask 查找启用中的条目

type MessageTaskLog

type MessageTaskLog struct {
	Id        uint64 `field:"id"`        // ID
	TaskId    uint64 `field:"taskId"`    // 任务ID
	CreatedAt uint64 `field:"createdAt"` // 创建时间
	IsOk      bool   `field:"isOk"`      // 是否成功
	Error     string `field:"error"`     // 错误信息
	Response  string `field:"response"`  // 响应信息
	Day       string `field:"day"`       // YYYYMMDD
}

MessageTaskLog 消息发送日志

type MessageTaskLogDAO

type MessageTaskLogDAO dbs.DAO
var SharedMessageTaskLogDAO *MessageTaskLogDAO

func NewMessageTaskLogDAO

func NewMessageTaskLogDAO() *MessageTaskLogDAO

func (*MessageTaskLogDAO) CleanExpiredLogs

func (this *MessageTaskLogDAO) CleanExpiredLogs(tx *dbs.Tx, days int) error

CleanExpiredLogs 清理

func (*MessageTaskLogDAO) CountLogs

func (this *MessageTaskLogDAO) CountLogs(tx *dbs.Tx) (int64, error)

CountLogs 计算日志数量

func (*MessageTaskLogDAO) CreateLog

func (this *MessageTaskLogDAO) CreateLog(tx *dbs.Tx, taskId int64, isOk bool, errMsg string, response string) error

CreateLog 创建日志

func (*MessageTaskLogDAO) ListLogs

func (this *MessageTaskLogDAO) ListLogs(tx *dbs.Tx, offset int64, size int64) (result []*MessageTaskLog, err error)

ListLogs 列出单页日志

type MessageTaskLogOperator

type MessageTaskLogOperator struct {
	Id        interface{} // ID
	TaskId    interface{} // 任务ID
	CreatedAt interface{} // 创建时间
	IsOk      interface{} // 是否成功
	Error     interface{} // 错误信息
	Response  interface{} // 响应信息
	Day       interface{} // YYYYMMDD
}

func NewMessageTaskLogOperator

func NewMessageTaskLogOperator() *MessageTaskLogOperator

type MessageTaskOperator

type MessageTaskOperator struct {
	Id          interface{} // ID
	RecipientId interface{} // 接收人ID
	Hash        interface{} // SUM标识
	InstanceId  interface{} // 媒介实例ID
	User        interface{} // 接收用户标识
	Subject     interface{} // 标题
	Body        interface{} // 内容
	CreatedAt   interface{} // 创建时间
	Status      interface{} // 发送状态
	SentAt      interface{} // 最后一次发送时间
	State       interface{} // 状态
	Result      interface{} // 结果
	Day         interface{} // YYYYMMDD
	IsPrimary   interface{} // 是否优先
}

func NewMessageTaskOperator

func NewMessageTaskOperator() *MessageTaskOperator

type MessageType

type MessageType = string
const (
	MessageTypeAll MessageType = "*"

	MessageTypeHealthCheckFailed          MessageType = "HealthCheckFailed"          // 节点健康检查失败
	MessageTypeHealthCheckNodeUp          MessageType = "HealthCheckNodeUp"          // 因健康检查节点上线
	MessageTypeHealthCheckNodeDown        MessageType = "HealthCheckNodeDown"        // 因健康检查节点下线
	MessageTypeNodeInactive               MessageType = "NodeInactive"               // 边缘节点不活跃
	MessageTypeNodeActive                 MessageType = "NodeActive"                 // 边缘节点活跃
	MessageTypeClusterDNSSyncFailed       MessageType = "ClusterDNSSyncFailed"       // DNS同步失败
	MessageTypeSSLCertExpiring            MessageType = "SSLCertExpiring"            // SSL证书即将过期
	MessageTypeSSLCertACMETaskFailed      MessageType = "SSLCertACMETaskFailed"      // SSL证书任务执行失败
	MessageTypeSSLCertACMETaskSuccess     MessageType = "SSLCertACMETaskSuccess"     // SSL证书任务执行成功
	MessageTypeLogCapacityOverflow        MessageType = "LogCapacityOverflow"        // 日志超出最大限制
	MessageTypeServerNamesAuditingSuccess MessageType = "ServerNamesAuditingSuccess" // 服务域名审核成功(用户)
	MessageTypeServerNamesAuditingFailed  MessageType = "ServerNamesAuditingFailed"  // 服务域名审核失败(用户)
	MessageTypeServerNamesRequireAuditing MessageType = "serverNamesRequireAuditing" // 服务域名需要审核(管理员)
	MessageTypeThresholdSatisfied         MessageType = "ThresholdSatisfied"         // 满足阈值
	MessageTypeFirewallEvent              MessageType = "FirewallEvent"              // 防火墙事件
	MessageTypeIPAddrUp                   MessageType = "IPAddrUp"                   // IP地址上线
	MessageTypeIPAddrDown                 MessageType = "IPAddrDown"                 // IP地址下线

	MessageTypeNSNodeInactive MessageType = "NSNodeInactive" // NS节点不活跃
	MessageTypeNSNodeActive   MessageType = "NSNodeActive"   // NS节点活跃

	MessageTypeReportNodeInactive MessageType = "ReportNodeInactive" // 区域监控节点节点不活跃
	MessageTypeReportNodeActive   MessageType = "ReportNodeActive"   // 区域监控节点活跃
	MessageTypeConnectivity       MessageType = "Connectivity"       // 连通性
	MessageTypeNodeSchedule       MessageType = "NodeSchedule"       // 节点调度信息
	MessageTypeNodeOfflineDay     MessageType = "NodeOfflineDay"     // 节点到下线日期
)

type MetricChart

type MetricChart struct {
	Id              uint32   `field:"id"`              // ID
	ItemId          uint32   `field:"itemId"`          // 指标ID
	Name            string   `field:"name"`            // 名称
	Code            string   `field:"code"`            // 代号
	Type            string   `field:"type"`            // 图形类型
	WidthDiv        int32    `field:"widthDiv"`        // 宽度划分
	Params          dbs.JSON `field:"params"`          // 图形参数
	Order           uint32   `field:"order"`           // 排序
	IsOn            bool     `field:"isOn"`            // 是否启用
	State           uint8    `field:"state"`           // 状态
	MaxItems        uint32   `field:"maxItems"`        // 最多条目
	IgnoreEmptyKeys uint8    `field:"ignoreEmptyKeys"` // 忽略空的键值
	IgnoredKeys     dbs.JSON `field:"ignoredKeys"`     // 忽略键值
}

MetricChart 指标图表

func (*MetricChart) DecodeIgnoredKeys

func (this *MetricChart) DecodeIgnoredKeys() []string

type MetricChartDAO

type MetricChartDAO dbs.DAO
var SharedMetricChartDAO *MetricChartDAO

func NewMetricChartDAO

func NewMetricChartDAO() *MetricChartDAO

func (*MetricChartDAO) CountEnabledCharts

func (this *MetricChartDAO) CountEnabledCharts(tx *dbs.Tx, itemId int64) (int64, error)

CountEnabledCharts 计算图表数量

func (*MetricChartDAO) CreateChart

func (this *MetricChartDAO) CreateChart(tx *dbs.Tx, itemId int64, name string, chartType string, widthDiv int32, maxItems int32, params maps.Map, ignoreEmptyKeys bool, ignoredKeys []string) (int64, error)

CreateChart 创建图表

func (*MetricChartDAO) DisableMetricChart

func (this *MetricChartDAO) DisableMetricChart(tx *dbs.Tx, chartId int64) error

DisableMetricChart 禁用条目

func (*MetricChartDAO) EnableMetricChart

func (this *MetricChartDAO) EnableMetricChart(tx *dbs.Tx, chartId int64) error

EnableMetricChart 启用条目

func (*MetricChartDAO) FindAllEnabledCharts

func (this *MetricChartDAO) FindAllEnabledCharts(tx *dbs.Tx, itemId int64) (result []*MetricChart, err error)

FindAllEnabledCharts 查找所有图表

func (*MetricChartDAO) FindEnabledMetricChart

func (this *MetricChartDAO) FindEnabledMetricChart(tx *dbs.Tx, chartId int64) (*MetricChart, error)

FindEnabledMetricChart 查找启用中的条目

func (*MetricChartDAO) FindMetricChartName

func (this *MetricChartDAO) FindMetricChartName(tx *dbs.Tx, chartId int64) (string, error)

FindMetricChartName 根据主键查找名称

func (*MetricChartDAO) ListEnabledCharts

func (this *MetricChartDAO) ListEnabledCharts(tx *dbs.Tx, itemId int64, offset int64, size int64) (result []*MetricChart, err error)

ListEnabledCharts 列出单页图表

func (*MetricChartDAO) UpdateChart

func (this *MetricChartDAO) UpdateChart(tx *dbs.Tx, chartId int64, name string, chartType string, widthDiv int32, maxItems int32, params maps.Map, ignoreEmptyKeys bool, ignoredKeys []string, isOn bool) error

UpdateChart 修改图表

type MetricChartOperator

type MetricChartOperator struct {
	Id              interface{} // ID
	ItemId          interface{} // 指标ID
	Name            interface{} // 名称
	Code            interface{} // 代号
	Type            interface{} // 图形类型
	WidthDiv        interface{} // 宽度划分
	Params          interface{} // 图形参数
	Order           interface{} // 排序
	IsOn            interface{} // 是否启用
	State           interface{} // 状态
	MaxItems        interface{} // 最多条目
	IgnoreEmptyKeys interface{} // 忽略空的键值
	IgnoredKeys     interface{} // 忽略键值
}

func NewMetricChartOperator

func NewMetricChartOperator() *MetricChartOperator

type MetricItem

type MetricItem struct {
	Id            uint64   `field:"id"`            // ID
	IsOn          bool     `field:"isOn"`          // 是否启用
	Code          string   `field:"code"`          // 代号(用来区分是否内置)
	Category      string   `field:"category"`      // 类型,比如http, tcp等
	AdminId       uint32   `field:"adminId"`       // 管理员ID
	UserId        uint32   `field:"userId"`        // 用户ID
	Name          string   `field:"name"`          // 指标名称
	Keys          dbs.JSON `field:"keys"`          // 统计的Key
	Period        uint32   `field:"period"`        // 周期
	PeriodUnit    string   `field:"periodUnit"`    // 周期单位
	ExpiresPeriod uint32   `field:"expiresPeriod"` // 过期周期
	Value         string   `field:"value"`         // 值运算
	State         uint8    `field:"state"`         // 状态
	Version       uint32   `field:"version"`       // 版本号
	IsPublic      bool     `field:"isPublic"`      // 是否为公用
	LastTime      string   `field:"lastTime"`      // 最新时间
}

MetricItem 指标定义

func (*MetricItem) DecodeKeys

func (this *MetricItem) DecodeKeys() []string

DecodeKeys 解析Key

type MetricItemDAO

type MetricItemDAO dbs.DAO
var SharedMetricItemDAO *MetricItemDAO

func NewMetricItemDAO

func NewMetricItemDAO() *MetricItemDAO

func (*MetricItemDAO) ComposeItemConfig

func (this *MetricItemDAO) ComposeItemConfig(tx *dbs.Tx, itemId int64) (*serverconfigs.MetricItemConfig, error)

ComposeItemConfig 组合指标配置

func (*MetricItemDAO) ComposeItemConfigWithItem

func (this *MetricItemDAO) ComposeItemConfigWithItem(item *MetricItem) *serverconfigs.MetricItemConfig

ComposeItemConfigWithItem 根据Item信息组合指标

func (*MetricItemDAO) CountEnabledItems

func (this *MetricItemDAO) CountEnabledItems(tx *dbs.Tx, category serverconfigs.MetricItemCategory) (int64, error)

CountEnabledItems 计算指标的数量

func (*MetricItemDAO) CreateItem

func (this *MetricItemDAO) CreateItem(tx *dbs.Tx, code string, category string, name string, keys []string, period int32, periodUnit string, expiresPeriod int32, value string, isPublic bool) (int64, error)

CreateItem 创建指标

func (*MetricItemDAO) DisableMetricItem

func (this *MetricItemDAO) DisableMetricItem(tx *dbs.Tx, itemId int64) error

DisableMetricItem 禁用条目

func (*MetricItemDAO) EnableMetricItem

func (this *MetricItemDAO) EnableMetricItem(tx *dbs.Tx, id int64) error

EnableMetricItem 启用条目

func (*MetricItemDAO) FindAllPublicItems

func (this *MetricItemDAO) FindAllPublicItems(tx *dbs.Tx, category string, cacheMap *utils.CacheMap) (result []*MetricItem, err error)

FindAllPublicItems 取得公用的指标

func (*MetricItemDAO) FindEnabledMetricItem

func (this *MetricItemDAO) FindEnabledMetricItem(tx *dbs.Tx, id int64) (*MetricItem, error)

FindEnabledMetricItem 查找启用中的条目

func (*MetricItemDAO) FindItemVersion

func (this *MetricItemDAO) FindItemVersion(tx *dbs.Tx, itemId int64) (int32, error)

FindItemVersion 获取指标的版本号

func (*MetricItemDAO) FindMetricItemName

func (this *MetricItemDAO) FindMetricItemName(tx *dbs.Tx, id int64) (string, error)

FindMetricItemName 根据主键查找名称

func (*MetricItemDAO) FindMetricLastTime

func (this *MetricItemDAO) FindMetricLastTime(tx *dbs.Tx, itemId int64) (string, error)

FindMetricLastTime 读取指标最新数据的时间

func (*MetricItemDAO) ListEnabledItems

func (this *MetricItemDAO) ListEnabledItems(tx *dbs.Tx, category serverconfigs.MetricItemCategory, offset int64, size int64) (result []*MetricItem, err error)

ListEnabledItems 列出单页指标

func (*MetricItemDAO) NotifyUpdate

func (this *MetricItemDAO) NotifyUpdate(tx *dbs.Tx, itemId int64, isPublic bool) error

NotifyUpdate 通知更新

func (*MetricItemDAO) UpdateItem

func (this *MetricItemDAO) UpdateItem(tx *dbs.Tx, itemId int64, name string, keys []string, period int32, periodUnit string, expiresPeriod int32, value string, isOn bool, isPublic bool) error

UpdateItem 修改\指标

func (*MetricItemDAO) UpdateMetricLastTime

func (this *MetricItemDAO) UpdateMetricLastTime(tx *dbs.Tx, itemId int64, lastTime string) error

UpdateMetricLastTime 更新指标最新数据的时间

type MetricItemOperator

type MetricItemOperator struct {
	Id            interface{} // ID
	IsOn          interface{} // 是否启用
	Code          interface{} // 代号(用来区分是否内置)
	Category      interface{} // 类型,比如http, tcp等
	AdminId       interface{} // 管理员ID
	UserId        interface{} // 用户ID
	Name          interface{} // 指标名称
	Keys          interface{} // 统计的Key
	Period        interface{} // 周期
	PeriodUnit    interface{} // 周期单位
	ExpiresPeriod interface{} // 过期周期
	Value         interface{} // 值运算
	State         interface{} // 状态
	Version       interface{} // 版本号
	IsPublic      interface{} // 是否为公用
	LastTime      interface{} // 最新时间
}

func NewMetricItemOperator

func NewMetricItemOperator() *MetricItemOperator

type MetricStat

type MetricStat struct {
	Id         uint64   `field:"id"`         // ID
	Hash       string   `field:"hash"`       // Hash值
	ClusterId  uint32   `field:"clusterId"`  // 集群ID
	NodeId     uint32   `field:"nodeId"`     // 节点ID
	ServerId   uint32   `field:"serverId"`   // 服务ID
	ItemId     uint64   `field:"itemId"`     // 指标
	Keys       dbs.JSON `field:"keys"`       // 键值
	Value      float64  `field:"value"`      // 数值
	Time       string   `field:"time"`       // 分钟值YYYYMMDDHHII
	Version    uint32   `field:"version"`    // 版本号
	CreatedDay string   `field:"createdDay"` // YYYYMMDD
}

MetricStat 指标统计数据

func (*MetricStat) DecodeKeys

func (this *MetricStat) DecodeKeys() []string

DecodeKeys 解析Key

type MetricStatDAO

type MetricStatDAO dbs.DAO
var SharedMetricStatDAO *MetricStatDAO

func NewMetricStatDAO

func NewMetricStatDAO() *MetricStatDAO

func (*MetricStatDAO) Clean

func (this *MetricStatDAO) Clean(tx *dbs.Tx) error

Clean 清理数据

func (*MetricStatDAO) CountItemStats

func (this *MetricStatDAO) CountItemStats(tx *dbs.Tx, itemId int64, version int32) (int64, error)

CountItemStats 计算统计数据数量

func (*MetricStatDAO) CreateStat

func (this *MetricStatDAO) CreateStat(tx *dbs.Tx, hash string, clusterId int64, nodeId int64, serverId int64, itemId int64, keys []string, value float64, time string, version int32) error

CreateStat 创建统计数据

func (*MetricStatDAO) DeleteItemStats

func (this *MetricStatDAO) DeleteItemStats(tx *dbs.Tx, itemId int64) error

DeleteItemStats 删除某个指标相关的统计数据

func (*MetricStatDAO) DeleteNodeItemStats

func (this *MetricStatDAO) DeleteNodeItemStats(tx *dbs.Tx, nodeId int64, serverId int64, itemId int64, time string) error

DeleteNodeItemStats 删除某个节点的统计数据

func (*MetricStatDAO) DeleteOldVersionItemStats

func (this *MetricStatDAO) DeleteOldVersionItemStats(tx *dbs.Tx, itemId int64, version int32) error

DeleteOldVersionItemStats 删除以前版本的统计数据

func (*MetricStatDAO) FindItemStatsAtLastTime

func (this *MetricStatDAO) FindItemStatsAtLastTime(tx *dbs.Tx, itemId int64, ignoreEmptyKeys bool, ignoreKeys []string, version int32, size int64) (result []*MetricStat, err error)

FindItemStatsAtLastTime 取得所有集群最近一次计时前 N 个数据 适合每条数据中包含不同的Key的场景

func (*MetricStatDAO) FindItemStatsWithClusterIdAndLastTime

func (this *MetricStatDAO) FindItemStatsWithClusterIdAndLastTime(tx *dbs.Tx, clusterId int64, itemId int64, ignoreEmptyKeys bool, ignoreKeys []string, version int32, size int64) (result []*MetricStat, err error)

FindItemStatsWithClusterIdAndLastTime 取得集群最近一次计时前 N 个数据 适合每条数据中包含不同的Key的场景

func (*MetricStatDAO) FindItemStatsWithNodeIdAndLastTime

func (this *MetricStatDAO) FindItemStatsWithNodeIdAndLastTime(tx *dbs.Tx, nodeId int64, itemId int64, ignoreEmptyKeys bool, ignoreKeys []string, version int32, size int64) (result []*MetricStat, err error)

FindItemStatsWithNodeIdAndLastTime 取得节点最近一次计时前 N 个数据 适合每条数据中包含不同的Key的场景

func (*MetricStatDAO) FindItemStatsWithServerIdAndLastTime

func (this *MetricStatDAO) FindItemStatsWithServerIdAndLastTime(tx *dbs.Tx, serverId int64, itemId int64, ignoreEmptyKeys bool, ignoreKeys []string, version int32, size int64) (result []*MetricStat, err error)

FindItemStatsWithServerIdAndLastTime 取得服务最近一次计时前 N 个数据 适合每条数据中包含不同的Key的场景

func (*MetricStatDAO) FindLatestItemStats

func (this *MetricStatDAO) FindLatestItemStats(tx *dbs.Tx, itemId int64, ignoreEmptyKeys bool, ignoreKeys []string, version int32, size int64) (result []*MetricStat, err error)

FindLatestItemStats 取得所有集群上最近 N 个时间的数据 适合同个Key在不同时间段的变化场景

func (*MetricStatDAO) FindLatestItemStatsWithClusterId

func (this *MetricStatDAO) FindLatestItemStatsWithClusterId(tx *dbs.Tx, clusterId int64, itemId int64, ignoreEmptyKeys bool, ignoreKeys []string, version int32, size int64) (result []*MetricStat, err error)

FindLatestItemStatsWithClusterId 取得集群最近 N 个时间的数据 适合同个Key在不同时间段的变化场景

func (*MetricStatDAO) FindLatestItemStatsWithNodeId

func (this *MetricStatDAO) FindLatestItemStatsWithNodeId(tx *dbs.Tx, nodeId int64, itemId int64, ignoreEmptyKeys bool, ignoreKeys []string, version int32, size int64) (result []*MetricStat, err error)

FindLatestItemStatsWithNodeId 取得节点最近 N 个时间的数据 适合同个Key在不同时间段的变化场景

func (*MetricStatDAO) FindLatestItemStatsWithServerId

func (this *MetricStatDAO) FindLatestItemStatsWithServerId(tx *dbs.Tx, serverId int64, itemId int64, ignoreEmptyKeys bool, ignoreKeys []string, version int32, size int64) (result []*MetricStat, err error)

FindLatestItemStatsWithServerId 取得服务最近 N 个时间的数据 适合同个Key在不同时间段的变化场景

func (*MetricStatDAO) ListItemStats

func (this *MetricStatDAO) ListItemStats(tx *dbs.Tx, itemId int64, version int32, offset int64, size int64) (result []*MetricStat, err error)

ListItemStats 列出单页统计数据

type MetricStatOperator

type MetricStatOperator struct {
	Id         interface{} // ID
	Hash       interface{} // Hash值
	ClusterId  interface{} // 集群ID
	NodeId     interface{} // 节点ID
	ServerId   interface{} // 服务ID
	ItemId     interface{} // 指标
	Keys       interface{} // 键值
	Value      interface{} // 数值
	Time       interface{} // 分钟值YYYYMMDDHHII
	Version    interface{} // 版本号
	CreatedDay interface{} // YYYYMMDD
}

func NewMetricStatOperator

func NewMetricStatOperator() *MetricStatOperator

type MetricSumStat

type MetricSumStat struct {
	Id         uint64  `field:"id"`         // ID
	ClusterId  uint32  `field:"clusterId"`  // 集群ID
	NodeId     uint32  `field:"nodeId"`     // 节点ID
	ServerId   uint32  `field:"serverId"`   // 服务ID
	ItemId     uint64  `field:"itemId"`     // 指标
	Count      uint64  `field:"count"`      // 数量
	Total      float64 `field:"total"`      // 总和
	Time       string  `field:"time"`       // 分钟值YYYYMMDDHHII
	Version    uint32  `field:"version"`    // 版本号
	CreatedDay string  `field:"createdDay"` // 创建日期YYYYMMDD
}

MetricSumStat 指标统计总和数据

type MetricSumStatDAO

type MetricSumStatDAO dbs.DAO
var SharedMetricSumStatDAO *MetricSumStatDAO

func NewMetricSumStatDAO

func NewMetricSumStatDAO() *MetricSumStatDAO

func (*MetricSumStatDAO) Clean

func (this *MetricSumStatDAO) Clean(tx *dbs.Tx) error

Clean 清理数据

func (*MetricSumStatDAO) DeleteItemStats

func (this *MetricSumStatDAO) DeleteItemStats(tx *dbs.Tx, itemId int64) error

DeleteItemStats 删除某个指标相关的统计数据

func (*MetricSumStatDAO) FindClusterSum

func (this *MetricSumStatDAO) FindClusterSum(tx *dbs.Tx, clusterId int64, time string, itemId int64, version int32) (count int64, total float32, err error)

FindClusterSum 查找集群上的统计数据

func (*MetricSumStatDAO) FindNodeServerSum

func (this *MetricSumStatDAO) FindNodeServerSum(tx *dbs.Tx, nodeId int64, serverId int64, time string, itemId int64, version int32) (count int64, total float32, err error)

FindNodeServerSum 查找某个服务在某个节点上的统计数据

func (*MetricSumStatDAO) FindNodeSum

func (this *MetricSumStatDAO) FindNodeSum(tx *dbs.Tx, nodeId int64, time string, itemId int64, version int32) (count int64, total float32, err error)

FindNodeSum 查找节点上的统计数据

func (*MetricSumStatDAO) FindServerSum

func (this *MetricSumStatDAO) FindServerSum(tx *dbs.Tx, serverId int64, time string, itemId int64, version int32) (count int64, total float32, err error)

FindServerSum 查找某个服务的统计数据

func (*MetricSumStatDAO) FindSumAtTime

func (this *MetricSumStatDAO) FindSumAtTime(tx *dbs.Tx, time string, itemId int64, version int32) (count int64, total float32, err error)

FindSumAtTime 查找某个时间的统计数据

func (*MetricSumStatDAO) UpdateSum

func (this *MetricSumStatDAO) UpdateSum(tx *dbs.Tx, clusterId int64, nodeId int64, serverId int64, time string, itemId int64, version int32, count int64, total float32) error

UpdateSum 更新统计数据

type MetricSumStatOperator

type MetricSumStatOperator struct {
	Id         interface{} // ID
	ClusterId  interface{} // 集群ID
	NodeId     interface{} // 节点ID
	ServerId   interface{} // 服务ID
	ItemId     interface{} // 指标
	Count      interface{} // 数量
	Total      interface{} // 总和
	Time       interface{} // 分钟值YYYYMMDDHHII
	Version    interface{} // 版本号
	CreatedDay interface{} // 创建日期YYYYMMDD
}

func NewMetricSumStatOperator

func NewMetricSumStatOperator() *MetricSumStatOperator

type NSAccessLog

type NSAccessLog struct {
	Id         uint64   `field:"id"`         // ID
	NodeId     uint32   `field:"nodeId"`     // 节点ID
	DomainId   uint32   `field:"domainId"`   // 域名ID
	RecordId   uint32   `field:"recordId"`   // 记录ID
	Content    dbs.JSON `field:"content"`    // 访问数据
	RequestId  string   `field:"requestId"`  // 请求ID
	CreatedAt  uint64   `field:"createdAt"`  // 创建时间
	RemoteAddr string   `field:"remoteAddr"` // IP
}

NSAccessLog 域名服务访问日志

func (*NSAccessLog) ToPB

func (this *NSAccessLog) ToPB() (*pb.NSAccessLog, error)

ToPB 转换成PB对象

type NSAccessLogOperator

type NSAccessLogOperator struct {
	Id         interface{} // ID
	NodeId     interface{} // 节点ID
	DomainId   interface{} // 域名ID
	RecordId   interface{} // 记录ID
	Content    interface{} // 访问数据
	RequestId  interface{} // 请求ID
	CreatedAt  interface{} // 创建时间
	RemoteAddr interface{} // IP
}

func NewNSAccessLogOperator

func NewNSAccessLogOperator() *NSAccessLogOperator

type NSCluster

type NSCluster struct {
	Id              uint32   `field:"id"`              // ID
	IsOn            bool     `field:"isOn"`            // 是否启用
	Name            string   `field:"name"`            // 集群名
	InstallDir      string   `field:"installDir"`      // 安装目录
	State           uint8    `field:"state"`           // 状态
	AccessLog       dbs.JSON `field:"accessLog"`       // 访问日志配置
	GrantId         uint32   `field:"grantId"`         // 授权ID
	Recursion       dbs.JSON `field:"recursion"`       // 递归DNS设置
	Tcp             dbs.JSON `field:"tcp"`             // TCP设置
	Tls             dbs.JSON `field:"tls"`             // TLS设置
	Udp             dbs.JSON `field:"udp"`             // UDP设置
	Doh             dbs.JSON `field:"doh"`             // DoH设置
	DdosProtection  dbs.JSON `field:"ddosProtection"`  // DDoS防护设置
	Hosts           dbs.JSON `field:"hosts"`           // DNS主机地址
	Soa             dbs.JSON `field:"soa"`             // SOA配置
	AutoRemoteStart bool     `field:"autoRemoteStart"` // 自动远程启动
	TimeZone        string   `field:"timeZone"`        // 时区
	Answer          dbs.JSON `field:"answer"`          // 应答设置
	SoaSerial       uint64   `field:"soaSerial"`       // SOA序列号
	Email           string   `field:"email"`           // 管理员邮箱
	DetectAgents    bool     `field:"detectAgents"`    // 是否监测Agents
	CheckingPorts   bool     `field:"checkingPorts"`   // 自动检测端口
}

NSCluster 域名服务器集群

func (*NSCluster) DecodeDDoSProtection added in v0.5.2

func (this *NSCluster) DecodeDDoSProtection() *ddosconfigs.ProtectionConfig

DecodeDDoSProtection 解析DDOS Protection设置

func (*NSCluster) HasDDoSProtection added in v0.5.2

func (this *NSCluster) HasDDoSProtection() bool

HasDDoSProtection 检查是否有DDOS设置

type NSClusterDAO

type NSClusterDAO dbs.DAO
var SharedNSClusterDAO *NSClusterDAO

func NewNSClusterDAO

func NewNSClusterDAO() *NSClusterDAO

func (*NSClusterDAO) CountAllClustersWithSSLPolicyIds added in v0.5.0

func (this *NSClusterDAO) CountAllClustersWithSSLPolicyIds(tx *dbs.Tx, sslPolicyIds []int64) (count int64, err error)

CountAllClustersWithSSLPolicyIds 计算使用SSL策略的所有NS集群数量

func (*NSClusterDAO) CountAllEnabledClusters

func (this *NSClusterDAO) CountAllEnabledClusters(tx *dbs.Tx) (int64, error)

CountAllEnabledClusters 计算可用集群数量

func (*NSClusterDAO) DisableNSCluster

func (this *NSClusterDAO) DisableNSCluster(tx *dbs.Tx, clusterId int64) error

DisableNSCluster 禁用条目

func (*NSClusterDAO) EnableNSCluster

func (this *NSClusterDAO) EnableNSCluster(tx *dbs.Tx, id int64) error

EnableNSCluster 启用条目

func (*NSClusterDAO) FindAllEnabledClusterIds

func (this *NSClusterDAO) FindAllEnabledClusterIds(tx *dbs.Tx) ([]int64, error)

FindAllEnabledClusterIds 获取所有集群IDs

func (*NSClusterDAO) FindAllEnabledClusters

func (this *NSClusterDAO) FindAllEnabledClusters(tx *dbs.Tx) (result []*NSCluster, err error)

FindAllEnabledClusters 列出所有集群

func (*NSClusterDAO) FindClusterGrantId

func (this *NSClusterDAO) FindClusterGrantId(tx *dbs.Tx, clusterId int64) (int64, error)

FindClusterGrantId 查找集群的认证ID

func (*NSClusterDAO) FindEnabledNSCluster

func (this *NSClusterDAO) FindEnabledNSCluster(tx *dbs.Tx, id int64) (*NSCluster, error)

FindEnabledNSCluster 查找启用中的条目

func (*NSClusterDAO) FindEnabledNSClusterName

func (this *NSClusterDAO) FindEnabledNSClusterName(tx *dbs.Tx, id int64) (string, error)

FindEnabledNSClusterName 查找启用中的条目名称

func (*NSClusterDAO) ListEnabledClusters

func (this *NSClusterDAO) ListEnabledClusters(tx *dbs.Tx, offset int64, size int64) (result []*NSCluster, err error)

ListEnabledClusters 列出单页集群

func (*NSClusterDAO) NotifyUpdate

func (this *NSClusterDAO) NotifyUpdate(tx *dbs.Tx, clusterId int64) error

NotifyUpdate 通知更改

type NSClusterOperator

type NSClusterOperator struct {
	Id              any // ID
	IsOn            any // 是否启用
	Name            any // 集群名
	InstallDir      any // 安装目录
	State           any // 状态
	AccessLog       any // 访问日志配置
	GrantId         any // 授权ID
	Recursion       any // 递归DNS设置
	Tcp             any // TCP设置
	Tls             any // TLS设置
	Udp             any // UDP设置
	Doh             any // DoH设置
	DdosProtection  any // DDoS防护设置
	Hosts           any // DNS主机地址
	Soa             any // SOA配置
	AutoRemoteStart any // 自动远程启动
	TimeZone        any // 时区
	Answer          any // 应答设置
	SoaSerial       any // SOA序列号
	Email           any // 管理员邮箱
	DetectAgents    any // 是否监测Agents
	CheckingPorts   any // 自动检测端口
}

func NewNSClusterOperator

func NewNSClusterOperator() *NSClusterOperator

type NSNode

type NSNode struct {
	Id                 uint32   `field:"id"`                 // ID
	AdminId            uint32   `field:"adminId"`            // 管理员ID
	ClusterId          uint32   `field:"clusterId"`          // 集群ID
	Name               string   `field:"name"`               // 节点名称
	IsOn               bool     `field:"isOn"`               // 是否启用
	Status             dbs.JSON `field:"status"`             // 运行状态
	UniqueId           string   `field:"uniqueId"`           // 节点ID
	Secret             string   `field:"secret"`             // 密钥
	IsUp               bool     `field:"isUp"`               // 是否运行
	IsInstalled        bool     `field:"isInstalled"`        // 是否已安装
	InstallStatus      dbs.JSON `field:"installStatus"`      // 安装状态
	InstallDir         string   `field:"installDir"`         // 安装目录
	State              uint8    `field:"state"`              // 状态
	IsActive           bool     `field:"isActive"`           // 是否活跃
	StatusIsNotified   uint8    `field:"statusIsNotified"`   // 活跃状态已经通知
	InactiveNotifiedAt uint64   `field:"inactiveNotifiedAt"` // 离线通知时间
	ConnectedAPINodes  dbs.JSON `field:"connectedAPINodes"`  // 当前连接的API节点
	DdosProtection     dbs.JSON `field:"ddosProtection"`     // DDoS防护设置
	ApiNodeAddrs       dbs.JSON `field:"apiNodeAddrs"`       // API节点地址
}

NSNode 域名服务器节点

type NSNodeDAO

type NSNodeDAO dbs.DAO
var SharedNSNodeDAO *NSNodeDAO

func NewNSNodeDAO

func NewNSNodeDAO() *NSNodeDAO

func (*NSNodeDAO) CountAllLowerVersionNodes

func (this *NSNodeDAO) CountAllLowerVersionNodes(tx *dbs.Tx, version string) (int64, error)

CountAllLowerVersionNodes 计算所有节点中低于某个版本的节点数量

func (*NSNodeDAO) CountAllLowerVersionNodesWithClusterId

func (this *NSNodeDAO) CountAllLowerVersionNodesWithClusterId(tx *dbs.Tx, clusterId int64, os string, arch string, version string) (int64, error)

CountAllLowerVersionNodesWithClusterId 计算单个集群中所有低于某个版本的节点数量

func (*NSNodeDAO) DisableNSNode

func (this *NSNodeDAO) DisableNSNode(tx *dbs.Tx, nodeId int64) error

DisableNSNode 禁用条目

func (*NSNodeDAO) EnableNSNode

func (this *NSNodeDAO) EnableNSNode(tx *dbs.Tx, id int64) error

EnableNSNode 启用条目

func (*NSNodeDAO) FindEnabledNSNode

func (this *NSNodeDAO) FindEnabledNSNode(tx *dbs.Tx, id int64) (*NSNode, error)

FindEnabledNSNode 查找启用中的条目

func (*NSNodeDAO) FindEnabledNSNodeName

func (this *NSNodeDAO) FindEnabledNSNodeName(tx *dbs.Tx, nodeId int64) (string, error)

FindEnabledNSNodeName 查找节点名称

func (*NSNodeDAO) FindEnabledNodeIdWithUniqueId

func (this *NSNodeDAO) FindEnabledNodeIdWithUniqueId(tx *dbs.Tx, uniqueId string) (int64, error)

FindEnabledNodeIdWithUniqueId 根据唯一ID获取节点ID

func (*NSNodeDAO) FindNodeClusterId

func (this *NSNodeDAO) FindNodeClusterId(tx *dbs.Tx, nodeId int64) (int64, error)

FindNodeClusterId 获取节点的集群ID

func (*NSNodeDAO) GenUniqueId

func (this *NSNodeDAO) GenUniqueId(tx *dbs.Tx) (string, error)

GenUniqueId 生成唯一ID

func (*NSNodeDAO) NotifyDNSUpdate

func (this *NSNodeDAO) NotifyDNSUpdate(tx *dbs.Tx, nodeId int64) error

NotifyDNSUpdate 通知DNS更新

func (*NSNodeDAO) NotifyUpdate

func (this *NSNodeDAO) NotifyUpdate(tx *dbs.Tx, nodeId int64) error

NotifyUpdate 通知更新

func (*NSNodeDAO) UpdateNodeIsInstalled

func (this *NSNodeDAO) UpdateNodeIsInstalled(tx *dbs.Tx, nodeId int64, isInstalled bool) error

UpdateNodeIsInstalled 设置节点安装状态

func (*NSNodeDAO) UpdateNodeStatus

func (this *NSNodeDAO) UpdateNodeStatus(tx *dbs.Tx, nodeId int64, nodeStatus *nodeconfigs.NodeStatus) error

UpdateNodeStatus 更改节点状态

type NSNodeOperator

type NSNodeOperator struct {
	Id                 any // ID
	AdminId            any // 管理员ID
	ClusterId          any // 集群ID
	Name               any // 节点名称
	IsOn               any // 是否启用
	Status             any // 运行状态
	UniqueId           any // 节点ID
	Secret             any // 密钥
	IsUp               any // 是否运行
	IsInstalled        any // 是否已安装
	InstallStatus      any // 安装状态
	InstallDir         any // 安装目录
	State              any // 状态
	IsActive           any // 是否活跃
	StatusIsNotified   any // 活跃状态已经通知
	InactiveNotifiedAt any // 离线通知时间
	ConnectedAPINodes  any // 当前连接的API节点
	DdosProtection     any // DDoS防护设置
	ApiNodeAddrs       any // API节点地址
}

func NewNSNodeOperator

func NewNSNodeOperator() *NSNodeOperator

type Node

type Node struct {
	Id                     uint32   `field:"id"`                     // ID
	AdminId                uint32   `field:"adminId"`                // 管理员ID
	UserId                 uint32   `field:"userId"`                 // 用户ID
	Level                  uint8    `field:"level"`                  // 级别
	LnAddrs                dbs.JSON `field:"lnAddrs"`                // Ln级别访问地址
	IsOn                   bool     `field:"isOn"`                   // 是否启用
	IsUp                   bool     `field:"isUp"`                   // 是否在线
	CountUp                uint32   `field:"countUp"`                // 连续在线次数
	CountDown              uint32   `field:"countDown"`              // 连续下线次数
	IsActive               bool     `field:"isActive"`               // 是否活跃
	InactiveNotifiedAt     uint64   `field:"inactiveNotifiedAt"`     // 离线通知时间
	UniqueId               string   `field:"uniqueId"`               // 节点ID
	Secret                 string   `field:"secret"`                 // 密钥
	Name                   string   `field:"name"`                   // 节点名
	Code                   string   `field:"code"`                   // 代号
	ClusterId              uint32   `field:"clusterId"`              // 主集群ID
	SecondaryClusterIds    dbs.JSON `field:"secondaryClusterIds"`    // 从集群ID
	RegionId               uint32   `field:"regionId"`               // 区域ID
	GroupId                uint32   `field:"groupId"`                // 分组ID
	CreatedAt              uint64   `field:"createdAt"`              // 创建时间
	Status                 dbs.JSON `field:"status"`                 // 最新的状态
	Version                uint32   `field:"version"`                // 当前版本号
	LatestVersion          uint32   `field:"latestVersion"`          // 最后版本号
	InstallDir             string   `field:"installDir"`             // 安装目录
	IsInstalled            bool     `field:"isInstalled"`            // 是否已安装
	InstallStatus          dbs.JSON `field:"installStatus"`          // 安装状态
	State                  uint8    `field:"state"`                  // 状态
	ConnectedAPINodes      dbs.JSON `field:"connectedAPINodes"`      // 当前连接的API节点
	MaxCPU                 uint32   `field:"maxCPU"`                 // 可以使用的最多CPU
	MaxThreads             uint32   `field:"maxThreads"`             // 最大线程数
	DdosProtection         dbs.JSON `field:"ddosProtection"`         // DDOS配置
	DnsRoutes              dbs.JSON `field:"dnsRoutes"`              // DNS线路设置
	MaxCacheDiskCapacity   dbs.JSON `field:"maxCacheDiskCapacity"`   // 硬盘缓存容量
	MaxCacheMemoryCapacity dbs.JSON `field:"maxCacheMemoryCapacity"` // 内存缓存容量
	CacheDiskDir           string   `field:"cacheDiskDir"`           // 主缓存目录
	CacheDiskSubDirs       dbs.JSON `field:"cacheDiskSubDirs"`       // 其他缓存目录
	DnsResolver            dbs.JSON `field:"dnsResolver"`            // DNS解析器
	EnableIPLists          bool     `field:"enableIPLists"`          // 启用IP名单
	ApiNodeAddrs           dbs.JSON `field:"apiNodeAddrs"`           // API节点地址
	OfflineDay             string   `field:"offlineDay"`             // 下线日期YYYYMMDD
	OfflineIsNotified      bool     `field:"offlineIsNotified"`      // 下线是否已通知
	IsBackupForCluster     bool     `field:"isBackupForCluster"`     // 是否为集群备用节点
	IsBackupForGroup       bool     `field:"isBackupForGroup"`       // 是否为分组备用节点
	BackupIPs              dbs.JSON `field:"backupIPs"`              // 备用IP
	ActionStatus           dbs.JSON `field:"actionStatus"`           // 当前动作配置
}

Node 节点

func (*Node) AllClusterIds

func (this *Node) AllClusterIds() []int64

AllClusterIds 获取所属集群IDs

func (*Node) CheckIsOffline added in v1.1.0

func (this *Node) CheckIsOffline() bool

CheckIsOffline 检查是否已经离线

func (*Node) DNSRouteCodes

func (this *Node) DNSRouteCodes() map[int64][]string

DNSRouteCodes 所有的DNS线路

func (*Node) DNSRouteCodesForDomainId

func (this *Node) DNSRouteCodesForDomainId(dnsDomainId int64) ([]string, error)

DNSRouteCodesForDomainId DNS线路

func (*Node) DecodeAPINodeAddrs added in v0.5.8

func (this *Node) DecodeAPINodeAddrs() []*serverconfigs.NetworkAddressConfig

DecodeAPINodeAddrs 解析API节点地址

func (*Node) DecodeCacheDiskSubDirs added in v0.5.8

func (this *Node) DecodeCacheDiskSubDirs() []*serverconfigs.CacheDir

DecodeCacheDiskSubDirs 解析缓存目录

func (*Node) DecodeConnectedAPINodeIds

func (this *Node) DecodeConnectedAPINodeIds() ([]int64, error)

DecodeConnectedAPINodeIds 连接的API

func (*Node) DecodeDDoSProtection

func (this *Node) DecodeDDoSProtection() *ddosconfigs.ProtectionConfig

DecodeDDoSProtection 解析DDoS Protection设置

func (*Node) DecodeDNSResolver

func (this *Node) DecodeDNSResolver() *nodeconfigs.DNSResolverConfig

DecodeDNSResolver 解析DNS解析主机配置

func (*Node) DecodeInstallStatus

func (this *Node) DecodeInstallStatus() (*NodeInstallStatus, error)

DecodeInstallStatus 安装状态

func (*Node) DecodeLnAddrs added in v0.5.2

func (this *Node) DecodeLnAddrs() []string

DecodeLnAddrs 解析Ln地址

func (*Node) DecodeMaxCacheDiskCapacity

func (this *Node) DecodeMaxCacheDiskCapacity() *shared.SizeCapacity

DecodeMaxCacheDiskCapacity 解析硬盘容量

func (*Node) DecodeMaxCacheMemoryCapacity

func (this *Node) DecodeMaxCacheMemoryCapacity() *shared.SizeCapacity

DecodeMaxCacheMemoryCapacity 解析内存容量

func (*Node) DecodeSecondaryClusterIds

func (this *Node) DecodeSecondaryClusterIds() []int64

DecodeSecondaryClusterIds 从集群IDs

func (*Node) DecodeStatus

func (this *Node) DecodeStatus() (*nodeconfigs.NodeStatus, error)

DecodeStatus 节点状态

func (*Node) HasDDoSProtection

func (this *Node) HasDDoSProtection() bool

HasDDoSProtection 检查是否有DDOS设置

func (*Node) HasScheduleSettings added in v1.1.0

func (this *Node) HasScheduleSettings() bool

HasScheduleSettings 检查是否设置了调度

type NodeAction added in v1.1.0

type NodeAction struct {
	Id       uint64   `field:"id"`       // ID
	NodeId   uint64   `field:"nodeId"`   // 节点ID
	Role     string   `field:"role"`     // 角色
	IsOn     bool     `field:"isOn"`     // 是否启用
	Conds    dbs.JSON `field:"conds"`    // 条件
	Action   dbs.JSON `field:"action"`   // 动作
	Duration dbs.JSON `field:"duration"` // 持续时间
	Order    uint32   `field:"order"`    // 排序
	State    uint8    `field:"state"`    // 状态
}

NodeAction 节点智能调度设置

type NodeActionDAO added in v1.1.0

type NodeActionDAO dbs.DAO
var SharedNodeActionDAO *NodeActionDAO

func NewNodeActionDAO added in v1.1.0

func NewNodeActionDAO() *NodeActionDAO

func (*NodeActionDAO) DisableNodeAction added in v1.1.0

func (this *NodeActionDAO) DisableNodeAction(tx *dbs.Tx, id int64) error

DisableNodeAction 禁用条目

func (*NodeActionDAO) EnableNodeAction added in v1.1.0

func (this *NodeActionDAO) EnableNodeAction(tx *dbs.Tx, id uint64) error

EnableNodeAction 启用条目

func (*NodeActionDAO) FindEnabledNodeAction added in v1.1.0

func (this *NodeActionDAO) FindEnabledNodeAction(tx *dbs.Tx, id int64) (*NodeAction, error)

FindEnabledNodeAction 查找启用中的条目

type NodeActionOperator added in v1.1.0

type NodeActionOperator struct {
	Id       any // ID
	NodeId   any // 节点ID
	Role     any // 角色
	IsOn     any // 是否启用
	Conds    any // 条件
	Action   any // 动作
	Duration any // 持续时间
	Order    any // 排序
	State    any // 状态
}

func NewNodeActionOperator added in v1.1.0

func NewNodeActionOperator() *NodeActionOperator

type NodeCluster

type NodeCluster struct {
	Id                   uint32   `field:"id"`                   // ID
	AdminId              uint32   `field:"adminId"`              // 管理员ID
	UserId               uint32   `field:"userId"`               // 用户ID
	IsOn                 bool     `field:"isOn"`                 // 是否启用
	Name                 string   `field:"name"`                 // 名称
	UseAllAPINodes       uint8    `field:"useAllAPINodes"`       // 是否使用所有API节点
	ApiNodes             dbs.JSON `field:"apiNodes"`             // 使用的API节点
	InstallDir           string   `field:"installDir"`           // 安装目录
	Order                uint32   `field:"order"`                // 排序
	CreatedAt            uint64   `field:"createdAt"`            // 创建时间
	GrantId              uint32   `field:"grantId"`              // 默认认证方式
	SshParams            dbs.JSON `field:"sshParams"`            // SSH默认参数
	State                uint8    `field:"state"`                // 状态
	AutoRegister         uint8    `field:"autoRegister"`         // 是否开启自动注册
	UniqueId             string   `field:"uniqueId"`             // 唯一ID
	Secret               string   `field:"secret"`               // 密钥
	HealthCheck          dbs.JSON `field:"healthCheck"`          // 健康检查
	DnsName              string   `field:"dnsName"`              // DNS名称
	DnsDomainId          uint32   `field:"dnsDomainId"`          // 域名ID
	Dns                  dbs.JSON `field:"dns"`                  // DNS配置
	Toa                  dbs.JSON `field:"toa"`                  // TOA配置
	CachePolicyId        uint32   `field:"cachePolicyId"`        // 缓存策略ID
	HttpFirewallPolicyId uint32   `field:"httpFirewallPolicyId"` // WAF策略ID
	AccessLog            dbs.JSON `field:"accessLog"`            // 访问日志设置
	SystemServices       dbs.JSON `field:"systemServices"`       // 系统服务设置
	TimeZone             string   `field:"timeZone"`             // 时区
	NodeMaxThreads       uint32   `field:"nodeMaxThreads"`       // 节点最大线程数
	DdosProtection       dbs.JSON `field:"ddosProtection"`       // DDoS防护设置
	AutoOpenPorts        uint8    `field:"autoOpenPorts"`        // 是否自动尝试开放端口
	IsPinned             bool     `field:"isPinned"`             // 是否置顶
	Webp                 dbs.JSON `field:"webp"`                 // WebP设置
	Uam                  dbs.JSON `field:"uam"`                  // UAM设置
	Clock                dbs.JSON `field:"clock"`                // 时钟配置
	GlobalServerConfig   dbs.JSON `field:"globalServerConfig"`   // 全局服务配置
	AutoRemoteStart      bool     `field:"autoRemoteStart"`      // 自动远程启动
	AutoInstallNftables  bool     `field:"autoInstallNftables"`  // 自动安装nftables
	IsAD                 bool     `field:"isAD"`                 // 是否为高防集群
	HttpPages            dbs.JSON `field:"httpPages"`            // 自定义页面设置
	Cc                   dbs.JSON `field:"cc"`                   // CC设置
	Http3                dbs.JSON `field:"http3"`                // HTTP3设置
	AutoSystemTuning     bool     `field:"autoSystemTuning"`     // 是否自动调整系统参数
	NetworkSecurity      dbs.JSON `field:"networkSecurity"`      // 网络安全策略
}

NodeCluster 节点集群

func (*NodeCluster) DecodeClock added in v0.5.3

func (this *NodeCluster) DecodeClock() *nodeconfigs.ClockConfig

DecodeClock 解析时钟配置

func (*NodeCluster) DecodeDDoSProtection

func (this *NodeCluster) DecodeDDoSProtection() *ddosconfigs.ProtectionConfig

DecodeDDoSProtection 解析DDOS Protection设置

func (*NodeCluster) DecodeDNSConfig

func (this *NodeCluster) DecodeDNSConfig() (*dnsconfigs.ClusterDNSConfig, error)

DecodeDNSConfig 解析DNS配置

func (*NodeCluster) DecodeGlobalServerConfig added in v0.5.3

func (this *NodeCluster) DecodeGlobalServerConfig() *serverconfigs.GlobalServerConfig

DecodeGlobalServerConfig 解析全局服务配置

func (*NodeCluster) DecodeNetworkSecurityPolicy added in v1.3.0

func (this *NodeCluster) DecodeNetworkSecurityPolicy() *nodeconfigs.NetworkSecurityPolicy

DecodeNetworkSecurityPolicy 解析安全策略设置

func (*NodeCluster) HasDDoSProtection

func (this *NodeCluster) HasDDoSProtection() bool

HasDDoSProtection 检查是否有DDoS设置

func (*NodeCluster) HasNetworkSecurityPolicy added in v1.3.0

func (this *NodeCluster) HasNetworkSecurityPolicy() bool

HasNetworkSecurityPolicy 检查是否有安全策略设置

type NodeClusterDAO

type NodeClusterDAO dbs.DAO
var SharedNodeClusterDAO *NodeClusterDAO

func NewNodeClusterDAO

func NewNodeClusterDAO() *NodeClusterDAO

func (*NodeClusterDAO) CheckNodeClusterIsOn

func (this *NodeClusterDAO) CheckNodeClusterIsOn(tx *dbs.Tx, clusterId int64) (bool, error)

CheckNodeClusterIsOn 获取集群是否正在启用状态

func (*NodeClusterDAO) CountAllEnabledClusters

func (this *NodeClusterDAO) CountAllEnabledClusters(tx *dbs.Tx, keyword string) (int64, error)

CountAllEnabledClusters 计算所有集群数量

func (*NodeClusterDAO) CountAllEnabledClustersWithDNSDomainId

func (this *NodeClusterDAO) CountAllEnabledClustersWithDNSDomainId(tx *dbs.Tx, dnsDomainId int64) (int64, error)

CountAllEnabledClustersWithDNSDomainId 计算使用某个DNS域名的集群数量

func (*NodeClusterDAO) CountAllEnabledClustersWithDNSProviderId

func (this *NodeClusterDAO) CountAllEnabledClustersWithDNSProviderId(tx *dbs.Tx, dnsProviderId int64) (int64, error)

CountAllEnabledClustersWithDNSProviderId 计算使用某个DNS服务商的集群数量

func (*NodeClusterDAO) CountAllEnabledClustersWithGrantId

func (this *NodeClusterDAO) CountAllEnabledClustersWithGrantId(tx *dbs.Tx, grantId int64) (int64, error)

CountAllEnabledClustersWithGrantId 计算使用某个认证的集群数量

func (*NodeClusterDAO) CountAllEnabledNodeClustersWithHTTPCachePolicyId

func (this *NodeClusterDAO) CountAllEnabledNodeClustersWithHTTPCachePolicyId(tx *dbs.Tx, httpCachePolicyId int64) (int64, error)

CountAllEnabledNodeClustersWithHTTPCachePolicyId 计算使用某个缓存策略的集群数量

func (*NodeClusterDAO) CountAllEnabledNodeClustersWithHTTPFirewallPolicyId

func (this *NodeClusterDAO) CountAllEnabledNodeClustersWithHTTPFirewallPolicyId(tx *dbs.Tx, httpFirewallPolicyId int64) (int64, error)

CountAllEnabledNodeClustersWithHTTPFirewallPolicyId 计算使用某个WAF策略的集群数量

func (*NodeClusterDAO) CreateCluster

func (this *NodeClusterDAO) CreateCluster(tx *dbs.Tx, adminId int64, name string, grantId int64, installDir string, dnsDomainId int64, dnsName string, dnsTTL int32, cachePolicyId int64, httpFirewallPolicyId int64, systemServices map[string]maps.Map, globalServerConfig *serverconfigs.GlobalServerConfig, autoInstallNftables bool, autoSystemTuning bool) (clusterId int64, err error)

CreateCluster 创建集群

func (*NodeClusterDAO) DisableNodeCluster

func (this *NodeClusterDAO) DisableNodeCluster(tx *dbs.Tx, clusterId int64) error

DisableNodeCluster 禁用条目

func (*NodeClusterDAO) EnableNodeCluster

func (this *NodeClusterDAO) EnableNodeCluster(tx *dbs.Tx, id int64) error

EnableNodeCluster 启用条目

func (*NodeClusterDAO) ExistClusterDNSName

func (this *NodeClusterDAO) ExistClusterDNSName(tx *dbs.Tx, dnsName string, excludeClusterId int64) (bool, error)

ExistClusterDNSName 检查某个子域名是否可用

func (*NodeClusterDAO) ExistsEnabledCluster

func (this *NodeClusterDAO) ExistsEnabledCluster(tx *dbs.Tx, clusterId int64) (bool, error)

ExistsEnabledCluster 检查集群是否存在

func (*NodeClusterDAO) FindAllAPINodeAddrsWithCluster

func (this *NodeClusterDAO) FindAllAPINodeAddrsWithCluster(tx *dbs.Tx, clusterId int64) (result []string, err error)

FindAllAPINodeAddrsWithCluster 查找所有API节点地址

func (*NodeClusterDAO) FindAllEnableClusterIds

func (this *NodeClusterDAO) FindAllEnableClusterIds(tx *dbs.Tx) (result []int64, err error)

FindAllEnableClusterIds 查找所有可用的集群Ids

func (*NodeClusterDAO) FindAllEnableClusters

func (this *NodeClusterDAO) FindAllEnableClusters(tx *dbs.Tx) (result []*NodeCluster, err error)

FindAllEnableClusters 查找所有可用的集群

func (*NodeClusterDAO) FindAllEnabledClusterIdsWithDNSDomainId

func (this *NodeClusterDAO) FindAllEnabledClusterIdsWithDNSDomainId(tx *dbs.Tx, dnsDomainId int64) ([]int64, error)

FindAllEnabledClusterIdsWithDNSDomainId 查询使用某个DNS域名的集群ID列表

func (*NodeClusterDAO) FindAllEnabledClustersHaveDNSDomain

func (this *NodeClusterDAO) FindAllEnabledClustersHaveDNSDomain(tx *dbs.Tx) (result []*NodeCluster, err error)

FindAllEnabledClustersHaveDNSDomain 查询已经设置了域名的集群

func (*NodeClusterDAO) FindAllEnabledClustersWithDNSDomainId

func (this *NodeClusterDAO) FindAllEnabledClustersWithDNSDomainId(tx *dbs.Tx, dnsDomainId int64) (result []*NodeCluster, err error)

FindAllEnabledClustersWithDNSDomainId 查询使用某个DNS域名的所有集群域名

func (*NodeClusterDAO) FindAllEnabledClustersWithDNSProviderId

func (this *NodeClusterDAO) FindAllEnabledClustersWithDNSProviderId(tx *dbs.Tx, dnsProviderId int64) (result []*NodeCluster, err error)

FindAllEnabledClustersWithDNSProviderId 获取所有使用某个DNS服务商的集群

func (*NodeClusterDAO) FindAllEnabledClustersWithGrantId

func (this *NodeClusterDAO) FindAllEnabledClustersWithGrantId(tx *dbs.Tx, grantId int64) (result []*NodeCluster, err error)

FindAllEnabledClustersWithGrantId 获取使用某个认证的所有集群

func (*NodeClusterDAO) FindAllEnabledNodeClusterIds

func (this *NodeClusterDAO) FindAllEnabledNodeClusterIds(tx *dbs.Tx) ([]int64, error)

FindAllEnabledNodeClusterIds 查找所有可用的集群

func (*NodeClusterDAO) FindAllEnabledNodeClusterIdsWithCachePolicyId

func (this *NodeClusterDAO) FindAllEnabledNodeClusterIdsWithCachePolicyId(tx *dbs.Tx, cachePolicyId int64) (result []int64, err error)

FindAllEnabledNodeClusterIdsWithCachePolicyId 查找使用缓存策略的所有集群Ids

func (*NodeClusterDAO) FindAllEnabledNodeClusterIdsWithHTTPFirewallPolicyId

func (this *NodeClusterDAO) FindAllEnabledNodeClusterIdsWithHTTPFirewallPolicyId(tx *dbs.Tx, httpFirewallPolicyId int64) (result []int64, err error)

FindAllEnabledNodeClusterIdsWithHTTPFirewallPolicyId 查找使用WAF策略的所有集群Ids

func (*NodeClusterDAO) FindAllEnabledNodeClustersWithHTTPCachePolicyId

func (this *NodeClusterDAO) FindAllEnabledNodeClustersWithHTTPCachePolicyId(tx *dbs.Tx, httpCachePolicyId int64) (result []*NodeCluster, err error)

FindAllEnabledNodeClustersWithHTTPCachePolicyId 查找使用缓存策略的所有集群

func (*NodeClusterDAO) FindAllEnabledNodeClustersWithHTTPFirewallPolicyId

func (this *NodeClusterDAO) FindAllEnabledNodeClustersWithHTTPFirewallPolicyId(tx *dbs.Tx, httpFirewallPolicyId int64) (result []*NodeCluster, err error)

FindAllEnabledNodeClustersWithHTTPFirewallPolicyId 查找使用WAF策略的所有集群

func (*NodeClusterDAO) FindClusterAdminId

func (this *NodeClusterDAO) FindClusterAdminId(tx *dbs.Tx, clusterId int64) (int64, error)

FindClusterAdminId 查找集群所属管理员

func (*NodeClusterDAO) FindClusterBasicInfo

func (this *NodeClusterDAO) FindClusterBasicInfo(tx *dbs.Tx, clusterId int64, cacheMap *utils.CacheMap) (*NodeCluster, error)

FindClusterBasicInfo 查找集群基础信息

func (*NodeClusterDAO) FindClusterDDoSProtection

func (this *NodeClusterDAO) FindClusterDDoSProtection(tx *dbs.Tx, clusterId int64) (*ddosconfigs.ProtectionConfig, error)

FindClusterDDoSProtection 获取集群的DDoS设置

func (*NodeClusterDAO) FindClusterDNSInfo

func (this *NodeClusterDAO) FindClusterDNSInfo(tx *dbs.Tx, clusterId int64, cacheMap *utils.CacheMap) (*NodeCluster, error)

FindClusterDNSInfo 查找DNS信息

func (*NodeClusterDAO) FindClusterGlobalServerConfig added in v0.5.3

func (this *NodeClusterDAO) FindClusterGlobalServerConfig(tx *dbs.Tx, clusterId int64) (*serverconfigs.GlobalServerConfig, error)

FindClusterGlobalServerConfig 查询全局服务配置

func (*NodeClusterDAO) FindClusterGrantId

func (this *NodeClusterDAO) FindClusterGrantId(tx *dbs.Tx, clusterId int64) (int64, error)

FindClusterGrantId 查找集群的认证ID

func (*NodeClusterDAO) FindClusterHTTP3Policy added in v1.2.0

func (this *NodeClusterDAO) FindClusterHTTP3Policy(tx *dbs.Tx, clusterId int64, cacheMap *utils.CacheMap) (*nodeconfigs.HTTP3Policy, error)

FindClusterHTTP3Policy 查询HTTP3策略设置

func (*NodeClusterDAO) FindClusterHTTPCCPolicy added in v1.1.0

func (this *NodeClusterDAO) FindClusterHTTPCCPolicy(tx *dbs.Tx, clusterId int64, cacheMap *utils.CacheMap) (*nodeconfigs.HTTPCCPolicy, error)

FindClusterHTTPCCPolicy 查询CC策略设置

func (*NodeClusterDAO) FindClusterHTTPCachePolicyId

func (this *NodeClusterDAO) FindClusterHTTPCachePolicyId(tx *dbs.Tx, clusterId int64, cacheMap *utils.CacheMap) (int64, error)

FindClusterHTTPCachePolicyId 获取集群的缓存策略ID

func (*NodeClusterDAO) FindClusterHTTPFirewallPolicyId

func (this *NodeClusterDAO) FindClusterHTTPFirewallPolicyId(tx *dbs.Tx, clusterId int64, cacheMap *utils.CacheMap) (int64, error)

FindClusterHTTPFirewallPolicyId 获取集群的WAF策略ID

func (*NodeClusterDAO) FindClusterHTTPPagesPolicy added in v1.1.0

func (this *NodeClusterDAO) FindClusterHTTPPagesPolicy(tx *dbs.Tx, clusterId int64, cacheMap *utils.CacheMap) (*nodeconfigs.HTTPPagesPolicy, error)

FindClusterHTTPPagesPolicy 查询自定义页面设置

func (*NodeClusterDAO) FindClusterHealthCheckConfig

func (this *NodeClusterDAO) FindClusterHealthCheckConfig(tx *dbs.Tx, clusterId int64) (*serverconfigs.HealthCheckConfig, error)

FindClusterHealthCheckConfig 查找健康检查设置

func (*NodeClusterDAO) FindClusterNetworkSecurityPolicy added in v1.3.0

func (this *NodeClusterDAO) FindClusterNetworkSecurityPolicy(tx *dbs.Tx, clusterId int64, cacheMap *utils.CacheMap) (*nodeconfigs.NetworkSecurityPolicy, error)

FindClusterNetworkSecurityPolicy 查询网络安全策略设置

func (*NodeClusterDAO) FindClusterSSHParams added in v0.5.6

func (this *NodeClusterDAO) FindClusterSSHParams(tx *dbs.Tx, clusterId int64) (*nodeconfigs.SSHParams, error)

FindClusterSSHParams 查找集群的SSH默认参数

func (*NodeClusterDAO) FindClusterTOAConfig

func (this *NodeClusterDAO) FindClusterTOAConfig(tx *dbs.Tx, clusterId int64, cacheMap *utils.CacheMap) (*nodeconfigs.TOAConfig, error)

FindClusterTOAConfig 查找集群的TOA设置

func (*NodeClusterDAO) FindClusterUAMPolicy added in v0.4.9

func (this *NodeClusterDAO) FindClusterUAMPolicy(tx *dbs.Tx, clusterId int64, cacheMap *utils.CacheMap) (*nodeconfigs.UAMPolicy, error)

FindClusterUAMPolicy 查询UAM设置

func (*NodeClusterDAO) FindClusterWebPPolicy

func (this *NodeClusterDAO) FindClusterWebPPolicy(tx *dbs.Tx, clusterId int64, cacheMap *utils.CacheMap) (*nodeconfigs.WebPImagePolicy, error)

FindClusterWebPPolicy 查询WebP设置

func (*NodeClusterDAO) FindEnabledClusterIdWithUniqueId

func (this *NodeClusterDAO) FindEnabledClusterIdWithUniqueId(tx *dbs.Tx, uniqueId string) (int64, error)

FindEnabledClusterIdWithUniqueId 根据UniqueId获取ID TODO 增加缓存

func (*NodeClusterDAO) FindEnabledNodeCluster

func (this *NodeClusterDAO) FindEnabledNodeCluster(tx *dbs.Tx, id int64) (*NodeCluster, error)

FindEnabledNodeCluster 查找集群

func (*NodeClusterDAO) FindEnabledNodeClustersWithIds

func (this *NodeClusterDAO) FindEnabledNodeClustersWithIds(tx *dbs.Tx, clusterIds []int64) (result []*NodeCluster, err error)

FindEnabledNodeClustersWithIds 查找一组集群

func (*NodeClusterDAO) FindLatestNodeClusters

func (this *NodeClusterDAO) FindLatestNodeClusters(tx *dbs.Tx, size int64) (result []*NodeCluster, err error)

FindLatestNodeClusters 查询最近访问的集群

func (*NodeClusterDAO) FindNodeClusterName

func (this *NodeClusterDAO) FindNodeClusterName(tx *dbs.Tx, clusterId int64) (string, error)

FindNodeClusterName 根据主键查找名称

func (*NodeClusterDAO) FindNodeClusterSystemServiceParams

func (this *NodeClusterDAO) FindNodeClusterSystemServiceParams(tx *dbs.Tx, clusterId int64, serviceType nodeconfigs.SystemServiceType) (params maps.Map, err error)

FindNodeClusterSystemServiceParams 查找集群的系统服务设置

func (*NodeClusterDAO) FindNodeClusterSystemServices

func (this *NodeClusterDAO) FindNodeClusterSystemServices(tx *dbs.Tx, clusterId int64, cacheMap *utils.CacheMap) (services map[string]maps.Map, err error)

FindNodeClusterSystemServices 查找集群的所有服务设置

func (*NodeClusterDAO) GenUniqueId

func (this *NodeClusterDAO) GenUniqueId(tx *dbs.Tx) (string, error)

GenUniqueId 生成唯一ID

func (*NodeClusterDAO) ListEnabledClusters

func (this *NodeClusterDAO) ListEnabledClusters(tx *dbs.Tx, keyword string, offset, size int64) (result []*NodeCluster, err error)

ListEnabledClusters 列出单页集群

func (*NodeClusterDAO) NotifyDNSUpdate

func (this *NodeClusterDAO) NotifyDNSUpdate(tx *dbs.Tx, clusterId int64) error

NotifyDNSUpdate 通知DNS更新 TODO 更新新的DNS解析记录的同时,需要删除老的DNS解析记录

func (*NodeClusterDAO) NotifyHTTP3Update added in v1.2.0

func (this *NodeClusterDAO) NotifyHTTP3Update(tx *dbs.Tx, clusterId int64) error

NotifyHTTP3Update 通知HTTP3更新

func (*NodeClusterDAO) NotifyHTTPCCUpdate added in v1.1.0

func (this *NodeClusterDAO) NotifyHTTPCCUpdate(tx *dbs.Tx, clusterId int64) error

NotifyHTTPCCUpdate 通知HTTP CC更新

func (*NodeClusterDAO) NotifyHTTPPagesPolicyUpdate added in v1.1.0

func (this *NodeClusterDAO) NotifyHTTPPagesPolicyUpdate(tx *dbs.Tx, clusterId int64) error

NotifyHTTPPagesPolicyUpdate 通知HTTP Pages更新

func (*NodeClusterDAO) NotifyNetworkSecurityUpdate added in v1.3.0

func (this *NodeClusterDAO) NotifyNetworkSecurityUpdate(tx *dbs.Tx, clusterId int64) error

NotifyNetworkSecurityUpdate 通知网络安全策略更新

func (*NodeClusterDAO) NotifyTOAUpdate added in v1.2.3

func (this *NodeClusterDAO) NotifyTOAUpdate(tx *dbs.Tx, clusterId int64) error

NotifyTOAUpdate 通知TOA变化

func (*NodeClusterDAO) NotifyUAMUpdate added in v1.0.0

func (this *NodeClusterDAO) NotifyUAMUpdate(tx *dbs.Tx, clusterId int64) error

NotifyUAMUpdate 通知UAM更新

func (*NodeClusterDAO) NotifyUpdate

func (this *NodeClusterDAO) NotifyUpdate(tx *dbs.Tx, clusterId int64) error

NotifyUpdate 通知更新

func (*NodeClusterDAO) UpdateCluster

func (this *NodeClusterDAO) UpdateCluster(tx *dbs.Tx, clusterId int64, name string, grantId int64, installDir string, timezone string, nodeMaxThreads int32, autoOpenPorts bool, clockConfig *nodeconfigs.ClockConfig, autoRemoteStart bool, autoInstallTables bool, sshParams *nodeconfigs.SSHParams, autoSystemTuning bool) error

UpdateCluster 修改集群

func (*NodeClusterDAO) UpdateClusterDDoSProtection

func (this *NodeClusterDAO) UpdateClusterDDoSProtection(tx *dbs.Tx, clusterId int64, ddosProtection *ddosconfigs.ProtectionConfig) error

UpdateClusterDDoSProtection 设置集群的DDoS设置

func (*NodeClusterDAO) UpdateClusterDNS

func (this *NodeClusterDAO) UpdateClusterDNS(tx *dbs.Tx, clusterId int64, dnsName string, dnsDomainId int64, nodesAutoSync bool, serversAutoSync bool, cnameRecords []string, ttl int32, cnameAsDomain bool, includingLnNodes bool) error

UpdateClusterDNS 修改集群DNS相关信息

func (*NodeClusterDAO) UpdateClusterGlobalServerConfig added in v0.5.3

func (this *NodeClusterDAO) UpdateClusterGlobalServerConfig(tx *dbs.Tx, clusterId int64, config *serverconfigs.GlobalServerConfig) error

UpdateClusterGlobalServerConfig 修改全局服务配置

func (*NodeClusterDAO) UpdateClusterHTTP3Policy added in v1.2.0

func (this *NodeClusterDAO) UpdateClusterHTTP3Policy(tx *dbs.Tx, clusterId int64, http3Policy *nodeconfigs.HTTP3Policy) error

UpdateClusterHTTP3Policy 修改HTTP3策略设置

func (*NodeClusterDAO) UpdateClusterHTTPCCPolicy added in v1.1.0

func (this *NodeClusterDAO) UpdateClusterHTTPCCPolicy(tx *dbs.Tx, clusterId int64, httpCCPolicy *nodeconfigs.HTTPCCPolicy) error

UpdateClusterHTTPCCPolicy 修改CC策略设置

func (*NodeClusterDAO) UpdateClusterHTTPPagesPolicy added in v1.1.0

func (this *NodeClusterDAO) UpdateClusterHTTPPagesPolicy(tx *dbs.Tx, clusterId int64, httpPagesPolicy *nodeconfigs.HTTPPagesPolicy) error

UpdateClusterHTTPPagesPolicy 修改自定义页面设置

func (*NodeClusterDAO) UpdateClusterHealthCheck

func (this *NodeClusterDAO) UpdateClusterHealthCheck(tx *dbs.Tx, clusterId int64, healthCheckJSON []byte) error

UpdateClusterHealthCheck 修改健康检查设置

func (*NodeClusterDAO) UpdateClusterIsPinned

func (this *NodeClusterDAO) UpdateClusterIsPinned(tx *dbs.Tx, clusterId int64, isPinned bool) error

UpdateClusterIsPinned 设置集群是否置顶

func (*NodeClusterDAO) UpdateClusterNetworkSecurityPolicy added in v1.3.0

func (this *NodeClusterDAO) UpdateClusterNetworkSecurityPolicy(tx *dbs.Tx, clusterId int64, networkSecurityPolicy *nodeconfigs.NetworkSecurityPolicy) error

UpdateClusterNetworkSecurityPolicy 修改网络安全策略设置

func (*NodeClusterDAO) UpdateClusterTOA

func (this *NodeClusterDAO) UpdateClusterTOA(tx *dbs.Tx, clusterId int64, toaJSON []byte) error

UpdateClusterTOA 修改集群的TOA设置

func (*NodeClusterDAO) UpdateClusterUAMPolicy added in v0.4.9

func (this *NodeClusterDAO) UpdateClusterUAMPolicy(tx *dbs.Tx, clusterId int64, uamPolicy *nodeconfigs.UAMPolicy) error

UpdateClusterUAMPolicy 修改UAM设置

func (*NodeClusterDAO) UpdateClusterWebPPolicy

func (this *NodeClusterDAO) UpdateClusterWebPPolicy(tx *dbs.Tx, clusterId int64, webpPolicy *nodeconfigs.WebPImagePolicy) error

UpdateClusterWebPPolicy 修改WebP设置

func (*NodeClusterDAO) UpdateNodeClusterHTTPCachePolicyId

func (this *NodeClusterDAO) UpdateNodeClusterHTTPCachePolicyId(tx *dbs.Tx, clusterId int64, httpCachePolicyId int64) error

UpdateNodeClusterHTTPCachePolicyId 设置集群的缓存策略

func (*NodeClusterDAO) UpdateNodeClusterHTTPFirewallPolicyId

func (this *NodeClusterDAO) UpdateNodeClusterHTTPFirewallPolicyId(tx *dbs.Tx, clusterId int64, httpFirewallPolicyId int64) error

UpdateNodeClusterHTTPFirewallPolicyId 设置集群的WAF策略

func (*NodeClusterDAO) UpdateNodeClusterSystemService

func (this *NodeClusterDAO) UpdateNodeClusterSystemService(tx *dbs.Tx, clusterId int64, serviceType nodeconfigs.SystemServiceType, params maps.Map) error

UpdateNodeClusterSystemService 修改集群的系统服务设置

type NodeClusterFirewallAction

type NodeClusterFirewallAction struct {
	Id         uint32   `field:"id"`         // ID
	AdminId    uint32   `field:"adminId"`    // 管理员ID
	ClusterId  uint32   `field:"clusterId"`  // 集群ID
	Name       string   `field:"name"`       // 名称
	EventLevel string   `field:"eventLevel"` // 级别
	Type       string   `field:"type"`       // 动作类型
	Params     dbs.JSON `field:"params"`     // 参数
	State      uint8    `field:"state"`      // 状态
}

防火墙动作

func (*NodeClusterFirewallAction) DecodeParams

func (this *NodeClusterFirewallAction) DecodeParams() (maps.Map, error)

DecodeParams 解析参数

type NodeClusterFirewallActionDAO

type NodeClusterFirewallActionDAO dbs.DAO
var SharedNodeClusterFirewallActionDAO *NodeClusterFirewallActionDAO

func NewNodeClusterFirewallActionDAO

func NewNodeClusterFirewallActionDAO() *NodeClusterFirewallActionDAO

func (*NodeClusterFirewallActionDAO) ComposeFirewallActionConfig

func (this *NodeClusterFirewallActionDAO) ComposeFirewallActionConfig(tx *dbs.Tx, action *NodeClusterFirewallAction) (*firewallconfigs.FirewallActionConfig, error)

ComposeFirewallActionConfig 组合配置

func (*NodeClusterFirewallActionDAO) CountAllEnabledFirewallActions

func (this *NodeClusterFirewallActionDAO) CountAllEnabledFirewallActions(tx *dbs.Tx, clusterId int64) (int64, error)

CountAllEnabledFirewallActions 计算动作数量

func (*NodeClusterFirewallActionDAO) CreateFirewallAction

func (this *NodeClusterFirewallActionDAO) CreateFirewallAction(tx *dbs.Tx, adminId int64, clusterId int64, name string, eventLevel, actionType firewallconfigs.FirewallActionType, params maps.Map) (int64, error)

CreateFirewallAction 创建动作

func (*NodeClusterFirewallActionDAO) DisableFirewallAction

func (this *NodeClusterFirewallActionDAO) DisableFirewallAction(tx *dbs.Tx, actionId int64) error

DisableFirewallAction 禁用条目

func (*NodeClusterFirewallActionDAO) EnableFirewallAction

func (this *NodeClusterFirewallActionDAO) EnableFirewallAction(tx *dbs.Tx, id uint32) error

EnableFirewallAction 启用条目

func (*NodeClusterFirewallActionDAO) FindAllEnabledFirewallActions

func (this *NodeClusterFirewallActionDAO) FindAllEnabledFirewallActions(tx *dbs.Tx, clusterId int64, cacheMap *utils.CacheMap) (result []*NodeClusterFirewallAction, err error)

FindAllEnabledFirewallActions 查找所有集群的动作

func (*NodeClusterFirewallActionDAO) FindEnabledFirewallAction

func (this *NodeClusterFirewallActionDAO) FindEnabledFirewallAction(tx *dbs.Tx, actionId int64) (*NodeClusterFirewallAction, error)

FindEnabledFirewallAction 查找启用中的条目

func (*NodeClusterFirewallActionDAO) FindFirewallActionName

func (this *NodeClusterFirewallActionDAO) FindFirewallActionName(tx *dbs.Tx, id uint32) (string, error)

FindFirewallActionName 根据主键查找名称

func (*NodeClusterFirewallActionDAO) NotifyUpdate

func (this *NodeClusterFirewallActionDAO) NotifyUpdate(tx *dbs.Tx, actionId int64) error

NotifyUpdate 通知更新

func (*NodeClusterFirewallActionDAO) UpdateFirewallAction

func (this *NodeClusterFirewallActionDAO) UpdateFirewallAction(tx *dbs.Tx, actionId int64, name string, eventLevel string, actionType firewallconfigs.FirewallActionType, params maps.Map) error

UpdateFirewallAction 修改动作

type NodeClusterFirewallActionOperator

type NodeClusterFirewallActionOperator struct {
	Id         interface{} // ID
	AdminId    interface{} // 管理员ID
	ClusterId  interface{} // 集群ID
	Name       interface{} // 名称
	EventLevel interface{} // 级别
	Type       interface{} // 动作类型
	Params     interface{} // 参数
	State      interface{} // 状态
}

func NewNodeClusterFirewallActionOperator

func NewNodeClusterFirewallActionOperator() *NodeClusterFirewallActionOperator

type NodeClusterMetricItem

type NodeClusterMetricItem struct {
	Id        uint32 `field:"id"`        // ID
	IsOn      bool   `field:"isOn"`      // 是否启用
	ClusterId uint32 `field:"clusterId"` // 集群ID
	ItemId    uint64 `field:"itemId"`    // 指标ID
	State     uint8  `field:"state"`     // 是否启用
}

NodeClusterMetricItem 集群使用的指标

type NodeClusterMetricItemDAO

type NodeClusterMetricItemDAO dbs.DAO
var SharedNodeClusterMetricItemDAO *NodeClusterMetricItemDAO

func NewNodeClusterMetricItemDAO

func NewNodeClusterMetricItemDAO() *NodeClusterMetricItemDAO

func (*NodeClusterMetricItemDAO) CountAllClusterItems

func (this *NodeClusterMetricItemDAO) CountAllClusterItems(tx *dbs.Tx, clusterId int64) (int64, error)

CountAllClusterItems 计算集群中指标数量

func (*NodeClusterMetricItemDAO) DisableClusterItem

func (this *NodeClusterMetricItemDAO) DisableClusterItem(tx *dbs.Tx, clusterId int64, itemId int64) error

DisableClusterItem 禁用某个集群的指标

func (*NodeClusterMetricItemDAO) DisableNodeClusterMetricItem

func (this *NodeClusterMetricItemDAO) DisableNodeClusterMetricItem(tx *dbs.Tx, id uint32) error

DisableNodeClusterMetricItem 禁用条目

func (*NodeClusterMetricItemDAO) EnableClusterItem

func (this *NodeClusterMetricItemDAO) EnableClusterItem(tx *dbs.Tx, clusterId int64, itemId int64) error

EnableClusterItem 启用某个集群的指标

func (*NodeClusterMetricItemDAO) EnableNodeClusterMetricItem

func (this *NodeClusterMetricItemDAO) EnableNodeClusterMetricItem(tx *dbs.Tx, id uint32) error

EnableNodeClusterMetricItem 启用条目

func (*NodeClusterMetricItemDAO) ExistsClusterItem

func (this *NodeClusterMetricItemDAO) ExistsClusterItem(tx *dbs.Tx, clusterId int64, itemId int64) (bool, error)

ExistsClusterItem 是否存在

func (*NodeClusterMetricItemDAO) FindAllClusterIdsWithItemId

func (this *NodeClusterMetricItemDAO) FindAllClusterIdsWithItemId(tx *dbs.Tx, itemId int64) (clusterIds []int64, err error)

FindAllClusterIdsWithItemId 查找使用某个指标的所有集群IDs

func (*NodeClusterMetricItemDAO) FindAllClusterItemIds

func (this *NodeClusterMetricItemDAO) FindAllClusterItemIds(tx *dbs.Tx, clusterId int64, cacheMap *utils.CacheMap) (result []int64, err error)

FindAllClusterItemIds 查找某个集群的指标Ids

func (*NodeClusterMetricItemDAO) FindAllClusterItems

func (this *NodeClusterMetricItemDAO) FindAllClusterItems(tx *dbs.Tx, clusterId int64, category string) (result []*NodeClusterMetricItem, err error)

FindAllClusterItems 查找某个集群的指标 category 不填写即表示获取所有指标

func (*NodeClusterMetricItemDAO) FindEnabledNodeClusterMetricItem

func (this *NodeClusterMetricItemDAO) FindEnabledNodeClusterMetricItem(tx *dbs.Tx, id uint32) (*NodeClusterMetricItem, error)

FindEnabledNodeClusterMetricItem 查找启用中的条目

func (*NodeClusterMetricItemDAO) NotifyUpdate

func (this *NodeClusterMetricItemDAO) NotifyUpdate(tx *dbs.Tx, clusterId int64) error

NotifyUpdate 通知更新

type NodeClusterMetricItemOperator

type NodeClusterMetricItemOperator struct {
	Id        interface{} // ID
	IsOn      interface{} // 是否启用
	ClusterId interface{} // 集群ID
	ItemId    interface{} // 指标ID
	State     interface{} // 是否启用
}

func NewNodeClusterMetricItemOperator

func NewNodeClusterMetricItemOperator() *NodeClusterMetricItemOperator

type NodeClusterOperator

type NodeClusterOperator struct {
	Id                   any // ID
	AdminId              any // 管理员ID
	UserId               any // 用户ID
	IsOn                 any // 是否启用
	Name                 any // 名称
	UseAllAPINodes       any // 是否使用所有API节点
	ApiNodes             any // 使用的API节点
	InstallDir           any // 安装目录
	Order                any // 排序
	CreatedAt            any // 创建时间
	GrantId              any // 默认认证方式
	SshParams            any // SSH默认参数
	State                any // 状态
	AutoRegister         any // 是否开启自动注册
	UniqueId             any // 唯一ID
	Secret               any // 密钥
	HealthCheck          any // 健康检查
	DnsName              any // DNS名称
	DnsDomainId          any // 域名ID
	Dns                  any // DNS配置
	Toa                  any // TOA配置
	CachePolicyId        any // 缓存策略ID
	HttpFirewallPolicyId any // WAF策略ID
	AccessLog            any // 访问日志设置
	SystemServices       any // 系统服务设置
	TimeZone             any // 时区
	NodeMaxThreads       any // 节点最大线程数
	DdosProtection       any // DDoS防护设置
	AutoOpenPorts        any // 是否自动尝试开放端口
	IsPinned             any // 是否置顶
	Webp                 any // WebP设置
	Uam                  any // UAM设置
	Clock                any // 时钟配置
	GlobalServerConfig   any // 全局服务配置
	AutoRemoteStart      any // 自动远程启动
	AutoInstallNftables  any // 自动安装nftables
	IsAD                 any // 是否为高防集群
	HttpPages            any // 自定义页面设置
	Cc                   any // CC设置
	Http3                any // HTTP3设置
	AutoSystemTuning     any // 是否自动调整系统参数
	NetworkSecurity      any // 网络安全策略
}

func NewNodeClusterOperator

func NewNodeClusterOperator() *NodeClusterOperator

type NodeDAO

type NodeDAO dbs.DAO
var SharedNodeDAO *NodeDAO

func NewNodeDAO

func NewNodeDAO() *NodeDAO

func (*NodeDAO) CheckNodeIPAddresses added in v1.1.0

func (this *NodeDAO) CheckNodeIPAddresses(tx *dbs.Tx, node *Node) (shouldSkip bool, shouldOverwrite bool, ipAddressStrings []string, err error)

CheckNodeIPAddresses 检查节点IP地址

func (*NodeDAO) CheckNodesLimit added in v0.5.3

func (this *NodeDAO) CheckNodesLimit(tx *dbs.Tx) error

func (*NodeDAO) ComposeNodeConfig

func (this *NodeDAO) ComposeNodeConfig(tx *dbs.Tx, nodeId int64, dataMap *shared.DataMap, cacheMap *utils.CacheMap) (*nodeconfigs.NodeConfig, error)

ComposeNodeConfig 组合配置 TODO 提升运行速度

func (*NodeDAO) CountAllAuthorityNodes added in v0.6.4

func (this *NodeDAO) CountAllAuthorityNodes(tx *dbs.Tx) (int64, error)

func (*NodeDAO) CountAllEnabledNodes

func (this *NodeDAO) CountAllEnabledNodes(tx *dbs.Tx) (int64, error)

CountAllEnabledNodes 计算所有节点数量

func (*NodeDAO) CountAllEnabledNodesDNSWithClusterId

func (this *NodeDAO) CountAllEnabledNodesDNSWithClusterId(tx *dbs.Tx, clusterId int64) (result int64, err error)

CountAllEnabledNodesDNSWithClusterId 计算一个集群的节点DNS数量

func (*NodeDAO) CountAllEnabledNodesMatch

func (this *NodeDAO) CountAllEnabledNodesMatch(tx *dbs.Tx,
	clusterId int64,
	installState configutils.BoolState,
	activeState configutils.BoolState,
	keyword string,
	groupId int64,
	regionId int64,
	level int32,
	includeSecondaryNodes bool) (int64, error)

CountAllEnabledNodesMatch 计算节点数量

func (*NodeDAO) CountAllEnabledNodesWithGrantId

func (this *NodeDAO) CountAllEnabledNodesWithGrantId(tx *dbs.Tx, grantId int64) (int64, error)

CountAllEnabledNodesWithGrantId 计算使用某个认证的节点数量

func (*NodeDAO) CountAllEnabledNodesWithGroupId

func (this *NodeDAO) CountAllEnabledNodesWithGroupId(tx *dbs.Tx, groupId int64) (int64, error)

CountAllEnabledNodesWithGroupId 查找某个节点分组下的所有节点数量

func (*NodeDAO) CountAllEnabledNodesWithRegionId

func (this *NodeDAO) CountAllEnabledNodesWithRegionId(tx *dbs.Tx, regionId int64) (int64, error)

CountAllEnabledNodesWithRegionId 查找某个节点区域下的所有节点数量

func (*NodeDAO) CountAllEnabledOfflineNodes

func (this *NodeDAO) CountAllEnabledOfflineNodes(tx *dbs.Tx) (int64, error)

CountAllEnabledOfflineNodes 计算所有离线节点数量

func (*NodeDAO) CountAllLowerVersionNodes

func (this *NodeDAO) CountAllLowerVersionNodes(tx *dbs.Tx, version string) (int64, error)

CountAllLowerVersionNodes 计算所有集群中低于某个版本的节点数量

func (*NodeDAO) CountAllLowerVersionNodesWithClusterId

func (this *NodeDAO) CountAllLowerVersionNodesWithClusterId(tx *dbs.Tx, clusterId int64, os string, arch string, version string) (int64, error)

CountAllLowerVersionNodesWithClusterId 计算单个集群中所有低于某个版本的节点数量

func (*NodeDAO) CountAllNodeRegionInfo added in v0.5.6

func (this *NodeDAO) CountAllNodeRegionInfo(tx *dbs.Tx, regionId int64) (int64, error)

CountAllNodeRegionInfo 查找所有节点区域信息数量

func (*NodeDAO) CountAllNotInstalledNodesWithClusterId

func (this *NodeDAO) CountAllNotInstalledNodesWithClusterId(tx *dbs.Tx, clusterId int64) (int64, error)

CountAllNotInstalledNodesWithClusterId 计算未安装的节点数量

func (*NodeDAO) CreateNode

func (this *NodeDAO) CreateNode(tx *dbs.Tx, adminId int64, name string, clusterId int64, groupId int64, regionId int64) (nodeId int64, err error)

CreateNode 创建节点

func (*NodeDAO) DeleteNodeFromCluster

func (this *NodeDAO) DeleteNodeFromCluster(tx *dbs.Tx, nodeId int64, clusterId int64) error

DeleteNodeFromCluster 从集群中删除节点

func (*NodeDAO) DisableNode

func (this *NodeDAO) DisableNode(tx *dbs.Tx, nodeId int64) (err error)

DisableNode 禁用条目

func (*NodeDAO) EnableNode

func (this *NodeDAO) EnableNode(tx *dbs.Tx, id uint32) (rowsAffected int64, err error)

EnableNode 启用条目

func (*NodeDAO) FindAllEnabledNodeIdsWithClusterId

func (this *NodeDAO) FindAllEnabledNodeIdsWithClusterId(tx *dbs.Tx, clusterId int64) (result []int64, err error)

FindAllEnabledNodeIdsWithClusterId 获取一个集群的所有节点Ids

func (*NodeDAO) FindAllEnabledNodesDNSWithClusterId

func (this *NodeDAO) FindAllEnabledNodesDNSWithClusterId(tx *dbs.Tx, clusterId int64, includeSecondaryNodes bool, includingLnNodes bool, isInstalled bool) (result []*Node, err error)

FindAllEnabledNodesDNSWithClusterId 获取一个集群的节点DNS信息

func (*NodeDAO) FindAllEnabledNodesWithClusterId

func (this *NodeDAO) FindAllEnabledNodesWithClusterId(tx *dbs.Tx, clusterId int64, includeSecondary bool) (result []*Node, err error)

FindAllEnabledNodesWithClusterId 获取一个集群的所有节点

func (*NodeDAO) FindAllEnabledNodesWithGrantId

func (this *NodeDAO) FindAllEnabledNodesWithGrantId(tx *dbs.Tx, grantId int64) (result []*Node, err error)

FindAllEnabledNodesWithGrantId 查找使用某个认证的所有节点

func (*NodeDAO) FindAllInactiveNodesWithClusterId

func (this *NodeDAO) FindAllInactiveNodesWithClusterId(tx *dbs.Tx, clusterId int64) (result []*Node, err error)

FindAllInactiveNodesWithClusterId 取得一个集群离线的节点

func (*NodeDAO) FindAllLowerVersionNodesWithClusterId

func (this *NodeDAO) FindAllLowerVersionNodesWithClusterId(tx *dbs.Tx, clusterId int64, os string, arch string, version string) (result []*Node, err error)

FindAllLowerVersionNodesWithClusterId 查找单个集群中所有低于某个版本的节点

func (*NodeDAO) FindAllNodeIdsMatch

func (this *NodeDAO) FindAllNodeIdsMatch(tx *dbs.Tx, clusterId int64, includeSecondaryNodes bool, isOn configutils.BoolState) (result []int64, err error)

FindAllNodeIdsMatch 匹配节点并返回节点ID

func (*NodeDAO) FindAllNotInstalledNodesWithClusterId

func (this *NodeDAO) FindAllNotInstalledNodesWithClusterId(tx *dbs.Tx, clusterId int64) (result []*Node, err error)

FindAllNotInstalledNodesWithClusterId 查找所有未安装的节点

func (*NodeDAO) FindEnabledAndOnNodeClusterIds

func (this *NodeDAO) FindEnabledAndOnNodeClusterIds(tx *dbs.Tx, nodeId int64) (result []int64, err error)

FindEnabledAndOnNodeClusterIds 获取节点所属所有可用而且启用的集群ID

func (*NodeDAO) FindEnabledAndOnNodeIdsWithClusterId

func (this *NodeDAO) FindEnabledAndOnNodeIdsWithClusterId(tx *dbs.Tx, clusterId int64, includeSecondary bool) ([]int64, error)

FindEnabledAndOnNodeIdsWithClusterId 查找某个集群下的所有启用的节点IDs

func (*NodeDAO) FindEnabledBasicNode

func (this *NodeDAO) FindEnabledBasicNode(tx *dbs.Tx, nodeId int64) (*Node, error)

FindEnabledBasicNode 获取节点的基本信息

func (*NodeDAO) FindEnabledNode

func (this *NodeDAO) FindEnabledNode(tx *dbs.Tx, id int64) (*Node, error)

FindEnabledNode 查找启用中的条目

func (*NodeDAO) FindEnabledNodeClusterIds

func (this *NodeDAO) FindEnabledNodeClusterIds(tx *dbs.Tx, nodeId int64) (result []int64, err error)

FindEnabledNodeClusterIds 获取节点所属所有可用的集群ID

func (*NodeDAO) FindEnabledNodeDNS

func (this *NodeDAO) FindEnabledNodeDNS(tx *dbs.Tx, nodeId int64) (*Node, error)

FindEnabledNodeDNS 获取单个节点的DNS信息

func (*NodeDAO) FindEnabledNodeIdWithUniqueId

func (this *NodeDAO) FindEnabledNodeIdWithUniqueId(tx *dbs.Tx, uniqueId string) (int64, error)

FindEnabledNodeIdWithUniqueId 根据UniqueId获取ID

func (*NodeDAO) FindEnabledNodeIdsWithClusterId

func (this *NodeDAO) FindEnabledNodeIdsWithClusterId(tx *dbs.Tx, clusterId int64) ([]int64, error)

FindEnabledNodeIdsWithClusterId 查找某个集群下的所有节点IDs

func (*NodeDAO) FindEnabledNodeWithUniqueId

func (this *NodeDAO) FindEnabledNodeWithUniqueId(tx *dbs.Tx, uniqueId string) (*Node, error)

FindEnabledNodeWithUniqueId 根据节点ID获取节点

func (*NodeDAO) FindEnabledNodeWithUniqueIdAndSecret

func (this *NodeDAO) FindEnabledNodeWithUniqueIdAndSecret(tx *dbs.Tx, uniqueId string, secret string) (*Node, error)

FindEnabledNodeWithUniqueIdAndSecret 根据节点ID和密钥查询节点

func (*NodeDAO) FindEnabledNodesWithClusterIdAndLevel

func (this *NodeDAO) FindEnabledNodesWithClusterIdAndLevel(tx *dbs.Tx, clusterId int64, level int) (result []*Node, err error)

FindEnabledNodesWithClusterIdAndLevel 查找当前集群下的某个级别的所有节点

func (*NodeDAO) FindEnabledNodesWithGroupIdAndLevel

func (this *NodeDAO) FindEnabledNodesWithGroupIdAndLevel(tx *dbs.Tx, groupId int64, level int) (result []*Node, err error)

FindEnabledNodesWithGroupIdAndLevel 查找当前分组下的某个级别的所有节点

func (*NodeDAO) FindEnabledNodesWithIds

func (this *NodeDAO) FindEnabledNodesWithIds(tx *dbs.Tx, nodeIds []int64) (result []*Node, err error)

FindEnabledNodesWithIds 根据一组ID查找一组节点

func (*NodeDAO) FindNodeAPIConfig added in v0.5.8

func (this *NodeDAO) FindNodeAPIConfig(tx *dbs.Tx, nodeId int64) (*Node, error)

FindNodeAPIConfig 查找API相关配置信息

func (*NodeDAO) FindNodeActive

func (this *NodeDAO) FindNodeActive(tx *dbs.Tx, nodeId int64) (bool, error)

FindNodeActive 检查节点活跃状态

func (*NodeDAO) FindNodeClusterId

func (this *NodeDAO) FindNodeClusterId(tx *dbs.Tx, nodeId int64) (int64, error)

FindNodeClusterId 获取节点集群ID

func (*NodeDAO) FindNodeDDoSProtection

func (this *NodeDAO) FindNodeDDoSProtection(tx *dbs.Tx, nodeId int64) (*ddosconfigs.ProtectionConfig, error)

FindNodeDDoSProtection 获取节点的DDOS设置

func (*NodeDAO) FindNodeDNSResolver

func (this *NodeDAO) FindNodeDNSResolver(tx *dbs.Tx, nodeId int64) (*nodeconfigs.DNSResolverConfig, error)

FindNodeDNSResolver 查找域名DNS Resolver

func (*NodeDAO) FindNodeInactiveNotifiedAt added in v0.5.0

func (this *NodeDAO) FindNodeInactiveNotifiedAt(tx *dbs.Tx, nodeId int64) (int64, error)

FindNodeInactiveNotifiedAt 读取上次的节点离线通知时间

func (*NodeDAO) FindNodeInstallStatus

func (this *NodeDAO) FindNodeInstallStatus(tx *dbs.Tx, nodeId int64) (*NodeInstallStatus, error)

FindNodeInstallStatus 查询节点的安装状态

func (*NodeDAO) FindNodeLevel

func (this *NodeDAO) FindNodeLevel(tx *dbs.Tx, nodeId int64) (int, error)

FindNodeLevel 获取节点级别

func (*NodeDAO) FindNodeLevelInfo

func (this *NodeDAO) FindNodeLevelInfo(tx *dbs.Tx, nodeId int64) (*Node, error)

FindNodeLevelInfo 获取节点级别相关信息

func (*NodeDAO) FindNodeName

func (this *NodeDAO) FindNodeName(tx *dbs.Tx, id int64) (string, error)

FindNodeName 根据主键查找名称

func (*NodeDAO) FindNodeStatus

func (this *NodeDAO) FindNodeStatus(tx *dbs.Tx, nodeId int64) (*nodeconfigs.NodeStatus, error)

FindNodeStatus 获取节点状态

func (*NodeDAO) FindNodeVersion

func (this *NodeDAO) FindNodeVersion(tx *dbs.Tx, nodeId int64) (int64, error)

FindNodeVersion 查找节点的版本号

func (*NodeDAO) FindParentNodeConfigs

func (this *NodeDAO) FindParentNodeConfigs(tx *dbs.Tx, nodeId int64, groupId int64, clusterIds []int64, level int) (result map[int64][]*nodeconfigs.ParentNodeConfig, err error)

FindParentNodeConfigs 查找父级节点配置

func (*NodeDAO) FindStatelessNodeDNS

func (this *NodeDAO) FindStatelessNodeDNS(tx *dbs.Tx, nodeId int64) (*Node, error)

FindStatelessNodeDNS 获取单个节点的DNS信息,无论什么状态

func (*NodeDAO) GenUniqueId

func (this *NodeDAO) GenUniqueId(tx *dbs.Tx) (string, error)

GenUniqueId 生成唯一ID

func (*NodeDAO) ListEnabledNodesMatch

func (this *NodeDAO) ListEnabledNodesMatch(tx *dbs.Tx,
	clusterId int64,
	installState configutils.BoolState,
	activeState configutils.BoolState,
	keyword string,
	groupId int64,
	regionId int64,
	level int32,
	includeSecondaryNodes bool,
	order string,
	offset int64,
	size int64) (result []*Node, err error)

ListEnabledNodesMatch 列出单页节点

func (*NodeDAO) ListNodeRegionInfo added in v0.5.6

func (this *NodeDAO) ListNodeRegionInfo(tx *dbs.Tx, regionId int64, offset int64, size int64) (result []*Node, err error)

ListNodeRegionInfo 列出节点区域信息

func (*NodeDAO) NotifyDNSUpdate

func (this *NodeDAO) NotifyDNSUpdate(tx *dbs.Tx, nodeId int64) error

NotifyDNSUpdate 通知节点相关DNS更新

func (*NodeDAO) NotifyLevelUpdate

func (this *NodeDAO) NotifyLevelUpdate(tx *dbs.Tx, nodeId int64) error

NotifyLevelUpdate 通知节点级别更新

func (*NodeDAO) NotifyUpdate

func (this *NodeDAO) NotifyUpdate(tx *dbs.Tx, nodeId int64) error

NotifyUpdate 通知节点相关更新

func (*NodeDAO) TransferPrimaryClusterNodes

func (this *NodeDAO) TransferPrimaryClusterNodes(tx *dbs.Tx, primaryClusterId int64) error

TransferPrimaryClusterNodes 自动转移集群下的节点

func (*NodeDAO) UpdateNode

func (this *NodeDAO) UpdateNode(tx *dbs.Tx, nodeId int64, name string, clusterId int64, secondaryClusterIds []int64, groupId int64, regionId int64, isOn bool, level int, lnAddrs []string, enableIPLists bool) error

UpdateNode 修改节点

func (*NodeDAO) UpdateNodeAPIConfig added in v0.5.8

func (this *NodeDAO) UpdateNodeAPIConfig(tx *dbs.Tx, nodeId int64, apiNodeAddrs []*serverconfigs.NetworkAddressConfig) error

UpdateNodeAPIConfig 修改API相关配置信息

func (*NodeDAO) UpdateNodeActive

func (this *NodeDAO) UpdateNodeActive(tx *dbs.Tx, nodeId int64, isActive bool) error

UpdateNodeActive 修改节点活跃状态

func (*NodeDAO) UpdateNodeCache

func (this *NodeDAO) UpdateNodeCache(tx *dbs.Tx, nodeId int64, maxCacheDiskCapacityJSON []byte, maxCacheMemoryCapacityJSON []byte, cacheDiskDir string, cacheDiskSubDirs []*serverconfigs.CacheDir) error

UpdateNodeCache 设置缓存相关

func (*NodeDAO) UpdateNodeConnectedAPINodes

func (this *NodeDAO) UpdateNodeConnectedAPINodes(tx *dbs.Tx, nodeId int64, apiNodeIds []int64) error

UpdateNodeConnectedAPINodes 修改当前连接的API节点

func (*NodeDAO) UpdateNodeDDoSProtection

func (this *NodeDAO) UpdateNodeDDoSProtection(tx *dbs.Tx, nodeId int64, ddosProtection *ddosconfigs.ProtectionConfig) error

UpdateNodeDDoSProtection 设置集群的DDoS设置

func (*NodeDAO) UpdateNodeDNS

func (this *NodeDAO) UpdateNodeDNS(tx *dbs.Tx, nodeId int64, routes map[int64][]string) error

UpdateNodeDNS 修改节点的DNS信息

func (*NodeDAO) UpdateNodeDNSResolver

func (this *NodeDAO) UpdateNodeDNSResolver(tx *dbs.Tx, nodeId int64, dnsResolverConfig *nodeconfigs.DNSResolverConfig) error

UpdateNodeDNSResolver 修改域名DNS Resolver

func (*NodeDAO) UpdateNodeInactiveNotifiedAt added in v0.5.0

func (this *NodeDAO) UpdateNodeInactiveNotifiedAt(tx *dbs.Tx, nodeId int64, inactiveAt int64) error

UpdateNodeInactiveNotifiedAt 修改节点的离线通知时间

func (*NodeDAO) UpdateNodeInstallStatus

func (this *NodeDAO) UpdateNodeInstallStatus(tx *dbs.Tx, nodeId int64, status *NodeInstallStatus) error

UpdateNodeInstallStatus 修改节点的安装状态

func (*NodeDAO) UpdateNodeIsActive

func (this *NodeDAO) UpdateNodeIsActive(tx *dbs.Tx, nodeId int64, isActive bool) error

UpdateNodeIsActive 更改节点在线状态

func (*NodeDAO) UpdateNodeIsInstalled

func (this *NodeDAO) UpdateNodeIsInstalled(tx *dbs.Tx, nodeId int64, isInstalled bool) error

UpdateNodeIsInstalled 设置节点安装状态

func (*NodeDAO) UpdateNodeRegionId added in v0.5.6

func (this *NodeDAO) UpdateNodeRegionId(tx *dbs.Tx, nodeId int64, regionId int64) error

UpdateNodeRegionId 修改节点所在区域

func (*NodeDAO) UpdateNodeStatus

func (this *NodeDAO) UpdateNodeStatus(tx *dbs.Tx, nodeId int64, nodeStatus *nodeconfigs.NodeStatus) error

UpdateNodeStatus 更改节点状态

func (*NodeDAO) UpdateNodeSystem

func (this *NodeDAO) UpdateNodeSystem(tx *dbs.Tx, nodeId int64, maxCPU int32) error

UpdateNodeSystem 设置系统信息

func (*NodeDAO) UpdateNodeUp

func (this *NodeDAO) UpdateNodeUp(tx *dbs.Tx, nodeId int64, isUp bool) error

UpdateNodeUp 设置节点上下线状态

func (*NodeDAO) UpdateNodeUpCount

func (this *NodeDAO) UpdateNodeUpCount(tx *dbs.Tx, nodeId int64, isUp bool, maxUp int, maxDown int) (changed bool, err error)

UpdateNodeUpCount 计算节点上线|下线状态

type NodeGrant

type NodeGrant struct {
	Id          uint32 `field:"id"`          // ID
	AdminId     uint32 `field:"adminId"`     // 管理员ID
	Name        string `field:"name"`        // 名称
	Method      string `field:"method"`      // 登录方式
	Username    string `field:"username"`    // 用户名
	Password    string `field:"password"`    // 密码
	Su          uint8  `field:"su"`          // 是否需要su
	PrivateKey  string `field:"privateKey"`  // 私钥
	Passphrase  string `field:"passphrase"`  // 私钥密码
	Description string `field:"description"` // 备注
	NodeId      uint32 `field:"nodeId"`      // 专有节点
	Role        string `field:"role"`        // 角色
	State       uint8  `field:"state"`       // 状态
	CreatedAt   uint64 `field:"createdAt"`   // 创建时间
}

NodeGrant 节点授权

type NodeGrantDAO

type NodeGrantDAO dbs.DAO
var SharedNodeGrantDAO *NodeGrantDAO

func NewNodeGrantDAO

func NewNodeGrantDAO() *NodeGrantDAO

func (*NodeGrantDAO) CountAllEnabledGrants

func (this *NodeGrantDAO) CountAllEnabledGrants(tx *dbs.Tx, keyword string) (int64, error)

CountAllEnabledGrants 计算所有认证信息数量

func (*NodeGrantDAO) CreateGrant

func (this *NodeGrantDAO) CreateGrant(tx *dbs.Tx, adminId int64, name string, method string, username string, password string, privateKey string, passphrase string, description string, nodeId int64, su bool) (grantId int64, err error)

CreateGrant 创建认证信息

func (*NodeGrantDAO) DisableNodeGrant

func (this *NodeGrantDAO) DisableNodeGrant(tx *dbs.Tx, id int64) (err error)

DisableNodeGrant 禁用条目

func (*NodeGrantDAO) EnableNodeGrant

func (this *NodeGrantDAO) EnableNodeGrant(tx *dbs.Tx, id uint32) (rowsAffected int64, err error)

EnableNodeGrant 启用条目

func (*NodeGrantDAO) FindAllEnabledGrants

func (this *NodeGrantDAO) FindAllEnabledGrants(tx *dbs.Tx) (result []*NodeGrant, err error)

FindAllEnabledGrants 列出所有的认证信息

func (*NodeGrantDAO) FindEnabledNodeGrant

func (this *NodeGrantDAO) FindEnabledNodeGrant(tx *dbs.Tx, id int64) (*NodeGrant, error)

FindEnabledNodeGrant 查找启用中的条目

func (*NodeGrantDAO) FindNodeGrantName

func (this *NodeGrantDAO) FindNodeGrantName(tx *dbs.Tx, id uint32) (string, error)

FindNodeGrantName 根据主键查找名称

func (*NodeGrantDAO) ListEnabledGrants

func (this *NodeGrantDAO) ListEnabledGrants(tx *dbs.Tx, keyword string, offset int64, size int64) (result []*NodeGrant, err error)

ListEnabledGrants 列出单页的认证信息

func (*NodeGrantDAO) UpdateGrant

func (this *NodeGrantDAO) UpdateGrant(tx *dbs.Tx, grantId int64, name string, method string, username string, password string, privateKey string, passphrase string, description string, nodeId int64, su bool) error

UpdateGrant 修改认证信息

type NodeGrantOperator

type NodeGrantOperator struct {
	Id          interface{} // ID
	AdminId     interface{} // 管理员ID
	Name        interface{} // 名称
	Method      interface{} // 登录方式
	Username    interface{} // 用户名
	Password    interface{} // 密码
	Su          interface{} // 是否需要su
	PrivateKey  interface{} // 私钥
	Passphrase  interface{} // 私钥密码
	Description interface{} // 备注
	NodeId      interface{} // 专有节点
	Role        interface{} // 角色
	State       interface{} // 状态
	CreatedAt   interface{} // 创建时间
}

func NewNodeGrantOperator

func NewNodeGrantOperator() *NodeGrantOperator

type NodeGroup

type NodeGroup struct {
	Id        uint32 `field:"id"`        // ID
	Name      string `field:"name"`      // 名称
	ClusterId uint32 `field:"clusterId"` // 集群ID
	Order     uint32 `field:"order"`     // 排序
	CreatedAt uint64 `field:"createdAt"` // 创建时间
	State     uint8  `field:"state"`     // 状态
}

节点分组

type NodeGroupDAO

type NodeGroupDAO dbs.DAO
var SharedNodeGroupDAO *NodeGroupDAO

func NewNodeGroupDAO

func NewNodeGroupDAO() *NodeGroupDAO

func (*NodeGroupDAO) CreateNodeGroup

func (this *NodeGroupDAO) CreateNodeGroup(tx *dbs.Tx, clusterId int64, name string) (int64, error)

创建分组

func (*NodeGroupDAO) DisableNodeGroup

func (this *NodeGroupDAO) DisableNodeGroup(tx *dbs.Tx, id int64) (rowsAffected int64, err error)

禁用条目

func (*NodeGroupDAO) EnableNodeGroup

func (this *NodeGroupDAO) EnableNodeGroup(tx *dbs.Tx, id int64) (rowsAffected int64, err error)

启用条目

func (*NodeGroupDAO) FindAllEnabledGroupsWithClusterId

func (this *NodeGroupDAO) FindAllEnabledGroupsWithClusterId(tx *dbs.Tx, clusterId int64) (result []*NodeGroup, err error)

查询所有分组

func (*NodeGroupDAO) FindEnabledNodeGroup

func (this *NodeGroupDAO) FindEnabledNodeGroup(tx *dbs.Tx, id int64) (*NodeGroup, error)

查找启用中的条目

func (*NodeGroupDAO) FindNodeGroupName

func (this *NodeGroupDAO) FindNodeGroupName(tx *dbs.Tx, id int64) (string, error)

根据主键查找名称

func (*NodeGroupDAO) UpdateGroupOrders

func (this *NodeGroupDAO) UpdateGroupOrders(tx *dbs.Tx, groupIds []int64) error

保存排序

func (*NodeGroupDAO) UpdateNodeGroup

func (this *NodeGroupDAO) UpdateNodeGroup(tx *dbs.Tx, groupId int64, name string) error

修改分组

type NodeGroupOperator

type NodeGroupOperator struct {
	Id        interface{} // ID
	Name      interface{} // 名称
	ClusterId interface{} // 集群ID
	Order     interface{} // 排序
	CreatedAt interface{} // 创建时间
	State     interface{} // 状态
}

func NewNodeGroupOperator

func NewNodeGroupOperator() *NodeGroupOperator

type NodeIPAddress

type NodeIPAddress struct {
	Id                uint32   `field:"id"`                // ID
	NodeId            uint32   `field:"nodeId"`            // 节点ID
	ClusterIds        dbs.JSON `field:"clusterIds"`        // 所属集群IDs
	Role              string   `field:"role"`              // 节点角色
	GroupId           uint32   `field:"groupId"`           // 所属分组ID
	Name              string   `field:"name"`              // 名称
	Ip                string   `field:"ip"`                // IP地址
	Description       string   `field:"description"`       // 描述
	State             uint8    `field:"state"`             // 状态
	Order             uint32   `field:"order"`             // 排序
	CanAccess         bool     `field:"canAccess"`         // 是否可以访问
	IsOn              bool     `field:"isOn"`              // 是否启用
	IsUp              bool     `field:"isUp"`              // 是否上线
	IsHealthy         bool     `field:"isHealthy"`         // 是否健康
	Thresholds        dbs.JSON `field:"thresholds"`        // 上线阈值
	Connectivity      dbs.JSON `field:"connectivity"`      // 连通性状态
	BackupIP          string   `field:"backupIP"`          // 备用IP
	BackupThresholdId uint32   `field:"backupThresholdId"` // 触发备用IP的阈值
	CountUp           uint32   `field:"countUp"`           // UP状态次数
	CountDown         uint32   `field:"countDown"`         // DOWN状态次数
}

NodeIPAddress 节点IP地址

func (*NodeIPAddress) DNSIP

func (this *NodeIPAddress) DNSIP() string

DNSIP 获取当前DNS可以使用的IP

func (*NodeIPAddress) DecodeBackupIP

func (this *NodeIPAddress) DecodeBackupIP() string

DecodeBackupIP 获取备用IP

func (*NodeIPAddress) DecodeClusterIds added in v0.6.4

func (this *NodeIPAddress) DecodeClusterIds() []int64

DecodeClusterIds 解析集群ID

func (*NodeIPAddress) DecodeConnectivity

func (this *NodeIPAddress) DecodeConnectivity() *nodeconfigs.Connectivity

DecodeConnectivity 解析联通数值

func (*NodeIPAddress) IsValidInCluster added in v0.6.4

func (this *NodeIPAddress) IsValidInCluster(clusterId int64) bool

IsValidInCluster 检查在某个集群中是否有效

type NodeIPAddressDAO

type NodeIPAddressDAO dbs.DAO
var SharedNodeIPAddressDAO *NodeIPAddressDAO

func NewNodeIPAddressDAO

func NewNodeIPAddressDAO() *NodeIPAddressDAO

func (*NodeIPAddressDAO) CountAllAccessibleIPAddressesWithClusterId

func (this *NodeIPAddressDAO) CountAllAccessibleIPAddressesWithClusterId(tx *dbs.Tx, role string, clusterId int64) (count int64, err error)

CountAllAccessibleIPAddressesWithClusterId 计算集群中的可用IP地址数量

func (*NodeIPAddressDAO) CountAllEnabledIPAddresses

func (this *NodeIPAddressDAO) CountAllEnabledIPAddresses(tx *dbs.Tx, role string, nodeClusterId int64, upState configutils.BoolState, keyword string) (int64, error)

CountAllEnabledIPAddresses 计算IP地址数量 TODO 目前支持边缘节点,将来支持NS节点

func (*NodeIPAddressDAO) CreateAddress

func (this *NodeIPAddressDAO) CreateAddress(tx *dbs.Tx, adminId int64, nodeId int64, role nodeconfigs.NodeRole, name string, ip string, canAccess bool, isUp bool, groupId int64, clusterIds []int64) (addressId int64, err error)

CreateAddress 创建IP地址

func (*NodeIPAddressDAO) DisableAddress

func (this *NodeIPAddressDAO) DisableAddress(tx *dbs.Tx, addressId int64) (err error)

DisableAddress 禁用IP地址

func (*NodeIPAddressDAO) DisableAllAddressesWithNodeId

func (this *NodeIPAddressDAO) DisableAllAddressesWithNodeId(tx *dbs.Tx, nodeId int64, role nodeconfigs.NodeRole) error

DisableAllAddressesWithNodeId 禁用节点的所有的IP地址

func (*NodeIPAddressDAO) EnableAddress

func (this *NodeIPAddressDAO) EnableAddress(tx *dbs.Tx, addressId int64) (err error)

EnableAddress 启用条目

func (*NodeIPAddressDAO) FindAddressIsHealthy

func (this *NodeIPAddressDAO) FindAddressIsHealthy(tx *dbs.Tx, addressId int64) (isHealthy bool, err error)

FindAddressIsHealthy 判断IP地址是否健康

func (*NodeIPAddressDAO) FindAddressName

func (this *NodeIPAddressDAO) FindAddressName(tx *dbs.Tx, id int64) (string, error)

FindAddressName 根据主键查找名称

func (*NodeIPAddressDAO) FindAllAccessibleIPAddressesWithClusterId

func (this *NodeIPAddressDAO) FindAllAccessibleIPAddressesWithClusterId(tx *dbs.Tx, role string, clusterId int64, cacheMap *utils.CacheMap) (result []*NodeIPAddress, err error)

FindAllAccessibleIPAddressesWithClusterId 列出所有的正在启用的IP地址

func (*NodeIPAddressDAO) FindAllEnabledAddressStringsWithNode added in v1.3.0

func (this *NodeIPAddressDAO) FindAllEnabledAddressStringsWithNode(tx *dbs.Tx, nodeId int64, role nodeconfigs.NodeRole) (result []string, err error)

FindAllEnabledAddressStringsWithNode 查找节点的所有的IP地址地府传

func (*NodeIPAddressDAO) FindAllEnabledAddressesWithNode

func (this *NodeIPAddressDAO) FindAllEnabledAddressesWithNode(tx *dbs.Tx, nodeId int64, role nodeconfigs.NodeRole) (result []*NodeIPAddress, err error)

FindAllEnabledAddressesWithNode 查找节点的所有的IP地址

func (*NodeIPAddressDAO) FindEnabledAddress

func (this *NodeIPAddressDAO) FindEnabledAddress(tx *dbs.Tx, id int64) (*NodeIPAddress, error)

FindEnabledAddress 查找启用中的IP地址

func (*NodeIPAddressDAO) FindFirstNodeAccessIPAddress

func (this *NodeIPAddressDAO) FindFirstNodeAccessIPAddress(tx *dbs.Tx, nodeId int64, mustUp bool, role nodeconfigs.NodeRole) (ip string, addrId int64, err error)

FindFirstNodeAccessIPAddress 查找节点的第一个可访问的IP地址

func (*NodeIPAddressDAO) FindFirstNodeAccessIPAddressId

func (this *NodeIPAddressDAO) FindFirstNodeAccessIPAddressId(tx *dbs.Tx, nodeId int64, mustUp bool, role nodeconfigs.NodeRole) (int64, error)

FindFirstNodeAccessIPAddressId 查找节点的第一个可访问的IP地址ID

func (*NodeIPAddressDAO) FindNodeAccessAndUpIPAddresses

func (this *NodeIPAddressDAO) FindNodeAccessAndUpIPAddresses(tx *dbs.Tx, nodeId int64, role nodeconfigs.NodeRole) (result []*NodeIPAddress, err error)

FindNodeAccessAndUpIPAddresses 查找节点所有的可访问且在线的IP地址

func (*NodeIPAddressDAO) FindNodeAccessIPAddresses added in v1.1.0

func (this *NodeIPAddressDAO) FindNodeAccessIPAddresses(tx *dbs.Tx, nodeId int64, role nodeconfigs.NodeRole) (result []*NodeIPAddress, err error)

FindNodeAccessIPAddresses 查找节点所有的可访问的IP地址,包括在线和离线

func (*NodeIPAddressDAO) FireThresholds

func (this *NodeIPAddressDAO) FireThresholds(tx *dbs.Tx, role nodeconfigs.NodeRole, nodeId int64) error

FireThresholds 触发阈值

func (*NodeIPAddressDAO) ListAccessibleIPAddressesWithClusterId

func (this *NodeIPAddressDAO) ListAccessibleIPAddressesWithClusterId(tx *dbs.Tx, role string, clusterId int64, offset int64, size int64) (result []*NodeIPAddress, err error)

ListAccessibleIPAddressesWithClusterId 列出单页集群中的可用IP地址

func (*NodeIPAddressDAO) ListEnabledIPAddresses

func (this *NodeIPAddressDAO) ListEnabledIPAddresses(tx *dbs.Tx, role string, nodeClusterId int64, upState configutils.BoolState, keyword string, offset int64, size int64) (result []*NodeIPAddress, err error)

ListEnabledIPAddresses 列出单页的IP地址

func (*NodeIPAddressDAO) NotifyUpdate

func (this *NodeIPAddressDAO) NotifyUpdate(tx *dbs.Tx, addressId int64) error

NotifyUpdate 通知更新

func (*NodeIPAddressDAO) UpdateAddress

func (this *NodeIPAddressDAO) UpdateAddress(tx *dbs.Tx, adminId int64, addressId int64, name string, ip string, canAccess bool, isOn bool, isUp bool, clusterIds []int64) (err error)

UpdateAddress 修改IP地址

func (*NodeIPAddressDAO) UpdateAddressBackupIP

func (this *NodeIPAddressDAO) UpdateAddressBackupIP(tx *dbs.Tx, addressId int64, thresholdId int64, ip string) error

UpdateAddressBackupIP 设置备用IP

func (*NodeIPAddressDAO) UpdateAddressConnectivity

func (this *NodeIPAddressDAO) UpdateAddressConnectivity(tx *dbs.Tx, addrId int64, connectivity *nodeconfigs.Connectivity) error

UpdateAddressConnectivity 设置连通性数据

func (*NodeIPAddressDAO) UpdateAddressHealthCount

func (this *NodeIPAddressDAO) UpdateAddressHealthCount(tx *dbs.Tx, addrId int64, newIsUp bool, maxUp int, maxDown int, autoUpDown bool) (changed bool, err error)

UpdateAddressHealthCount 计算IP健康状态

func (*NodeIPAddressDAO) UpdateAddressIP

func (this *NodeIPAddressDAO) UpdateAddressIP(tx *dbs.Tx, addressId int64, ip string) error

UpdateAddressIP 修改IP地址中的IP

func (*NodeIPAddressDAO) UpdateAddressIsUp

func (this *NodeIPAddressDAO) UpdateAddressIsUp(tx *dbs.Tx, addressId int64, isUp bool) error

UpdateAddressIsUp 设置IP地址在线状态

func (*NodeIPAddressDAO) UpdateAddressNodeId

func (this *NodeIPAddressDAO) UpdateAddressNodeId(tx *dbs.Tx, addressId int64, nodeId int64) error

UpdateAddressNodeId 修改IP地址所属节点

type NodeIPAddressGroup

type NodeIPAddressGroup struct {
	Id    uint32 `field:"id"`    // ID
	Name  string `field:"name"`  // 分组名
	Value string `field:"value"` // IP值
}

NodeIPAddressGroup IP地址分组

type NodeIPAddressGroupDAO

type NodeIPAddressGroupDAO dbs.DAO
var SharedNodeIPAddressGroupDAO *NodeIPAddressGroupDAO

func NewNodeIPAddressGroupDAO

func NewNodeIPAddressGroupDAO() *NodeIPAddressGroupDAO

func (*NodeIPAddressGroupDAO) CreateGroup

func (this *NodeIPAddressGroupDAO) CreateGroup(tx *dbs.Tx, name string, value string) (int64, error)

CreateGroup 创建分组

func (*NodeIPAddressGroupDAO) FindNodeIPAddressGroupName

func (this *NodeIPAddressGroupDAO) FindNodeIPAddressGroupName(tx *dbs.Tx, id uint32) (string, error)

FindNodeIPAddressGroupName 根据主键查找名称

type NodeIPAddressGroupOperator

type NodeIPAddressGroupOperator struct {
	Id    interface{} // ID
	Name  interface{} // 分组名
	Value interface{} // IP值
}

func NewNodeIPAddressGroupOperator

func NewNodeIPAddressGroupOperator() *NodeIPAddressGroupOperator

type NodeIPAddressLog

type NodeIPAddressLog struct {
	Id          uint64 `field:"id"`          // ID
	AddressId   uint64 `field:"addressId"`   // 地址ID
	AdminId     uint32 `field:"adminId"`     // 管理员ID
	Description string `field:"description"` // 描述
	CreatedAt   uint64 `field:"createdAt"`   // 操作时间
	IsUp        bool   `field:"isUp"`        // 是否在线
	IsOn        bool   `field:"isOn"`        // 是否启用
	CanAccess   bool   `field:"canAccess"`   // 是否可访问
	Day         string `field:"day"`         // YYYYMMDD,用来清理
	BackupIP    string `field:"backupIP"`    // 备用IP
}

NodeIPAddressLog IP状态变更日志

type NodeIPAddressLogDAO

type NodeIPAddressLogDAO dbs.DAO
var SharedNodeIPAddressLogDAO *NodeIPAddressLogDAO

func NewNodeIPAddressLogDAO

func NewNodeIPAddressLogDAO() *NodeIPAddressLogDAO

func (*NodeIPAddressLogDAO) CountLogs

func (this *NodeIPAddressLogDAO) CountLogs(tx *dbs.Tx, addrId int64) (int64, error)

CountLogs 计算日志数量

func (*NodeIPAddressLogDAO) CreateLog

func (this *NodeIPAddressLogDAO) CreateLog(tx *dbs.Tx, adminId int64, addrId int64, description string) error

CreateLog 创建日志

func (*NodeIPAddressLogDAO) ListLogs

func (this *NodeIPAddressLogDAO) ListLogs(tx *dbs.Tx, addrId int64, offset int64, size int64) (result []*NodeIPAddressLog, err error)

ListLogs 列出单页日志

type NodeIPAddressLogOperator

type NodeIPAddressLogOperator struct {
	Id          interface{} // ID
	AddressId   interface{} // 地址ID
	AdminId     interface{} // 管理员ID
	Description interface{} // 描述
	CreatedAt   interface{} // 操作时间
	IsUp        interface{} // 是否在线
	IsOn        interface{} // 是否启用
	CanAccess   interface{} // 是否可访问
	Day         interface{} // YYYYMMDD,用来清理
	BackupIP    interface{} // 备用IP
}

func NewNodeIPAddressLogOperator

func NewNodeIPAddressLogOperator() *NodeIPAddressLogOperator

type NodeIPAddressOperator

type NodeIPAddressOperator struct {
	Id                any // ID
	NodeId            any // 节点ID
	ClusterIds        any // 所属集群IDs
	Role              any // 节点角色
	GroupId           any // 所属分组ID
	Name              any // 名称
	Ip                any // IP地址
	Description       any // 描述
	State             any // 状态
	Order             any // 排序
	CanAccess         any // 是否可以访问
	IsOn              any // 是否启用
	IsUp              any // 是否上线
	IsHealthy         any // 是否健康
	Thresholds        any // 上线阈值
	Connectivity      any // 连通性状态
	BackupIP          any // 备用IP
	BackupThresholdId any // 触发备用IP的阈值
	CountUp           any // UP状态次数
	CountDown         any // DOWN状态次数
}

func NewNodeIPAddressOperator

func NewNodeIPAddressOperator() *NodeIPAddressOperator

type NodeIPAddressThreshold

type NodeIPAddressThreshold struct {
	Id         uint64   `field:"id"`         // ID
	AddressId  uint64   `field:"addressId"`  // IP地址ID
	Items      dbs.JSON `field:"items"`      // 阈值条目
	Actions    dbs.JSON `field:"actions"`    // 动作
	NotifiedAt uint64   `field:"notifiedAt"` // 上次通知时间
	IsMatched  bool     `field:"isMatched"`  // 上次是否匹配
	State      uint8    `field:"state"`      // 状态
	Order      uint32   `field:"order"`      // 排序
}

NodeIPAddressThreshold IP地址阈值

func (*NodeIPAddressThreshold) DecodeActions

func (this *NodeIPAddressThreshold) DecodeActions() (result []*nodeconfigs.IPAddressThresholdActionConfig)

func (*NodeIPAddressThreshold) DecodeItems

func (this *NodeIPAddressThreshold) DecodeItems() (result []*nodeconfigs.IPAddressThresholdItemConfig)

type NodeIPAddressThresholdDAO

type NodeIPAddressThresholdDAO dbs.DAO
var SharedNodeIPAddressThresholdDAO *NodeIPAddressThresholdDAO

func NewNodeIPAddressThresholdDAO

func NewNodeIPAddressThresholdDAO() *NodeIPAddressThresholdDAO

func (*NodeIPAddressThresholdDAO) CountAllEnabledThresholdsWithAddrId

func (this *NodeIPAddressThresholdDAO) CountAllEnabledThresholdsWithAddrId(tx *dbs.Tx, addrId int64) (int64, error)

CountAllEnabledThresholdsWithAddrId 计算所有阈值数量

func (*NodeIPAddressThresholdDAO) CreateThreshold

func (this *NodeIPAddressThresholdDAO) CreateThreshold(tx *dbs.Tx, addressId int64, items []*nodeconfigs.IPAddressThresholdItemConfig, actions []*nodeconfigs.IPAddressThresholdActionConfig, order int) (int64, error)

CreateThreshold 创建阈值

func (*NodeIPAddressThresholdDAO) DisableAllThresholdsWithAddrId

func (this *NodeIPAddressThresholdDAO) DisableAllThresholdsWithAddrId(tx *dbs.Tx, addrId int64) error

DisableAllThresholdsWithAddrId 禁用所有阈值

func (*NodeIPAddressThresholdDAO) DisableNodeIPAddressThreshold

func (this *NodeIPAddressThresholdDAO) DisableNodeIPAddressThreshold(tx *dbs.Tx, id int64) error

DisableNodeIPAddressThreshold 禁用条目

func (*NodeIPAddressThresholdDAO) EnableNodeIPAddressThreshold

func (this *NodeIPAddressThresholdDAO) EnableNodeIPAddressThreshold(tx *dbs.Tx, id uint64) error

EnableNodeIPAddressThreshold 启用条目

func (*NodeIPAddressThresholdDAO) ExistsEnabledThreshold

func (this *NodeIPAddressThresholdDAO) ExistsEnabledThreshold(tx *dbs.Tx, thresholdId int64) (bool, error)

ExistsEnabledThreshold 检查阈值是否可以使用

func (*NodeIPAddressThresholdDAO) FindAllEnabledThresholdsWithAddrId

func (this *NodeIPAddressThresholdDAO) FindAllEnabledThresholdsWithAddrId(tx *dbs.Tx, addrId int64) (result []*NodeIPAddressThreshold, err error)

FindAllEnabledThresholdsWithAddrId 查找所有阈值

func (*NodeIPAddressThresholdDAO) FindEnabledNodeIPAddressThreshold

func (this *NodeIPAddressThresholdDAO) FindEnabledNodeIPAddressThreshold(tx *dbs.Tx, id uint64) (*NodeIPAddressThreshold, error)

FindEnabledNodeIPAddressThreshold 查找启用中的条目

func (*NodeIPAddressThresholdDAO) FindThresholdNotifiedAt

func (this *NodeIPAddressThresholdDAO) FindThresholdNotifiedAt(tx *dbs.Tx, thresholdId int64) (int64, error)

FindThresholdNotifiedAt 查找上次通知时间

func (*NodeIPAddressThresholdDAO) UpdateThreshold

func (this *NodeIPAddressThresholdDAO) UpdateThreshold(tx *dbs.Tx, thresholdId int64, items []*nodeconfigs.IPAddressThresholdItemConfig, actions []*nodeconfigs.IPAddressThresholdActionConfig, order int) error

UpdateThreshold 修改阈值

func (*NodeIPAddressThresholdDAO) UpdateThresholdIsMatched

func (this *NodeIPAddressThresholdDAO) UpdateThresholdIsMatched(tx *dbs.Tx, thresholdId int64, isMatched bool) error

UpdateThresholdIsMatched 设置是否匹配

func (*NodeIPAddressThresholdDAO) UpdateThresholdNotifiedAt

func (this *NodeIPAddressThresholdDAO) UpdateThresholdNotifiedAt(tx *dbs.Tx, thresholdId int64, timestamp int64) error

UpdateThresholdNotifiedAt 设置上次通知时间

type NodeIPAddressThresholdOperator

type NodeIPAddressThresholdOperator struct {
	Id         interface{} // ID
	AddressId  interface{} // IP地址ID
	Items      interface{} // 阈值条目
	Actions    interface{} // 动作
	NotifiedAt interface{} // 上次通知时间
	IsMatched  interface{} // 上次是否匹配
	State      interface{} // 状态
	Order      interface{} // 排序
}

func NewNodeIPAddressThresholdOperator

func NewNodeIPAddressThresholdOperator() *NodeIPAddressThresholdOperator

type NodeInstallStatus

type NodeInstallStatus struct {
	IsRunning  bool                     `json:"isRunning"`  // 是否在运行
	IsFinished bool                     `json:"isFinished"` // 是否已结束
	IsOk       bool                     `json:"isOk"`       // 是否正确安装
	Error      string                   `json:"error"`      // 错误信息
	ErrorCode  string                   `json:"errorCode"`  // 错误代号
	UpdatedAt  int64                    `json:"updatedAt"`  // 更新时间,安装过程中需要每隔N秒钟更新这个状态,以便于让系统知道安装仍在进行中
	Steps      []*NodeInstallStatusStep `json:"steps"`      // 步骤
}

节点安装状态

func NewNodeInstallStatus

func NewNodeInstallStatus() *NodeInstallStatus

type NodeInstallStatusStep

type NodeInstallStatusStep struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Percent     int    `json:"percent"`
}

type NodeLog

type NodeLog struct {
	Id          uint64   `field:"id"`          // ID
	Role        string   `field:"role"`        // 节点角色
	Type        string   `field:"type"`        // 类型
	CreatedAt   uint64   `field:"createdAt"`   // 创建时间
	Tag         string   `field:"tag"`         // 标签
	Description string   `field:"description"` // 描述
	Level       string   `field:"level"`       // 级别
	NodeId      uint32   `field:"nodeId"`      // 节点ID
	Day         string   `field:"day"`         // 日期
	ServerId    uint32   `field:"serverId"`    // 服务ID
	OriginId    uint32   `field:"originId"`    // 源站ID
	Hash        string   `field:"hash"`        // 信息内容Hash
	Count       uint32   `field:"count"`       // 重复次数
	IsFixed     bool     `field:"isFixed"`     // 是否已处理
	IsRead      bool     `field:"isRead"`      // 是否已读
	Params      dbs.JSON `field:"params"`      // 参数
}

NodeLog 节点日志

type NodeLogDAO

type NodeLogDAO dbs.DAO
var SharedNodeLogDAO *NodeLogDAO

func NewNodeLogDAO

func NewNodeLogDAO() *NodeLogDAO

func (*NodeLogDAO) CountAllUnreadNodeLogs

func (this *NodeLogDAO) CountAllUnreadNodeLogs(tx *dbs.Tx) (int64, error)

CountAllUnreadNodeLogs 计算未读的日志数量

func (*NodeLogDAO) CountNodeLogs

func (this *NodeLogDAO) CountNodeLogs(tx *dbs.Tx,
	role string,
	nodeClusterId int64,
	nodeId int64,
	serverId int64,
	originId int64,
	allServers bool,
	dayFrom string,
	dayTo string,
	keyword string,
	level string,
	fixedState configutils.BoolState,
	isUnread bool,
	tag string) (int64, error)

CountNodeLogs 计算节点日志数量

func (*NodeLogDAO) CreateLog

func (this *NodeLogDAO) CreateLog(tx *dbs.Tx, nodeRole nodeconfigs.NodeRole, nodeId int64, serverId int64, originId int64, level string, tag string, description string, createdAt int64, logType string, paramsJSON []byte) error

CreateLog 创建日志

func (*NodeLogDAO) DeleteExpiredLogs

func (this *NodeLogDAO) DeleteExpiredLogs(tx *dbs.Tx, days int) error

DeleteExpiredLogs 清除超出一定日期的日志

func (*NodeLogDAO) DeleteExpiredLogsWithLevel

func (this *NodeLogDAO) DeleteExpiredLogsWithLevel(tx *dbs.Tx, level string, days int) error

DeleteExpiredLogsWithLevel 清除超出一定日期的某级别日志

func (*NodeLogDAO) DeleteMatchedNodeLogs added in v0.6.4

func (this *NodeLogDAO) DeleteMatchedNodeLogs(tx *dbs.Tx,
	role string,
	nodeClusterId int64,
	nodeId int64,
	serverId int64,
	originId int64,
	allServers bool,
	dayFrom string,
	dayTo string,
	keyword string,
	level string,
	fixedState configutils.BoolState,
	isUnread bool,
	tag string) error

DeleteMatchedNodeLogs 删除匹配的日志

func (*NodeLogDAO) DeleteNodeLogs added in v0.4.9

func (this *NodeLogDAO) DeleteNodeLogs(tx *dbs.Tx, role nodeconfigs.NodeRole, nodeId int64) error

DeleteNodeLogs 删除某个节点上的日志

func (*NodeLogDAO) DeleteNodeLogsWithCluster added in v0.5.0

func (this *NodeLogDAO) DeleteNodeLogsWithCluster(tx *dbs.Tx, role nodeconfigs.NodeRole, clusterId int64) error

DeleteNodeLogsWithCluster 删除某个集群下的所有日志

func (*NodeLogDAO) ListNodeLogs

func (this *NodeLogDAO) ListNodeLogs(tx *dbs.Tx,
	role string,
	nodeClusterId int64,
	nodeId int64,
	serverId int64,
	originId int64,
	allServers bool,
	dayFrom string,
	dayTo string,
	keyword string,
	level string,
	fixedState configutils.BoolState,
	isUnread bool,
	tag string,
	offset int64,
	size int64) (result []*NodeLog, err error)

ListNodeLogs 列出单页日志

func (*NodeLogDAO) UpdateAllNodeLogsFixed

func (this *NodeLogDAO) UpdateAllNodeLogsFixed(tx *dbs.Tx) error

UpdateAllNodeLogsFixed 设置所有节点日志为已修复

func (*NodeLogDAO) UpdateAllNodeLogsRead

func (this *NodeLogDAO) UpdateAllNodeLogsRead(tx *dbs.Tx) error

UpdateAllNodeLogsRead 设置所有日志为已读

func (*NodeLogDAO) UpdateNodeLogFixed

func (this *NodeLogDAO) UpdateNodeLogFixed(tx *dbs.Tx, logId int64) error

UpdateNodeLogFixed 设置节点日志为已修复

func (*NodeLogDAO) UpdateNodeLogIdsRead added in v0.5.2

func (this *NodeLogDAO) UpdateNodeLogIdsRead(tx *dbs.Tx, nodeLogIds []int64) error

UpdateNodeLogIdsRead 设置一组日志为已读

func (*NodeLogDAO) UpdateNodeLogsRead

func (this *NodeLogDAO) UpdateNodeLogsRead(tx *dbs.Tx, role nodeconfigs.NodeRole, nodeId int64) error

UpdateNodeLogsRead 设置节点日志为已读

type NodeLogOperator

type NodeLogOperator struct {
	Id          interface{} // ID
	Role        interface{} // 节点角色
	Type        interface{} // 类型
	CreatedAt   interface{} // 创建时间
	Tag         interface{} // 标签
	Description interface{} // 描述
	Level       interface{} // 级别
	NodeId      interface{} // 节点ID
	Day         interface{} // 日期
	ServerId    interface{} // 服务ID
	OriginId    interface{} // 源站ID
	Hash        interface{} // 信息内容Hash
	Count       interface{} // 重复次数
	IsFixed     interface{} // 是否已处理
	IsRead      interface{} // 是否已读
	Params      interface{} // 参数
}

func NewNodeLogOperator

func NewNodeLogOperator() *NodeLogOperator

type NodeLogin

type NodeLogin struct {
	Id     uint32   `field:"id"`     // ID
	NodeId uint32   `field:"nodeId"` // 节点ID
	Role   string   `field:"role"`   // 角色
	Name   string   `field:"name"`   // 名称
	Type   string   `field:"type"`   // 类型:ssh,agent
	Params dbs.JSON `field:"params"` // 配置参数
	State  uint8    `field:"state"`  // 状态
}

NodeLogin 节点登录信息

func (*NodeLogin) DecodeSSHParams

func (this *NodeLogin) DecodeSSHParams() (*NodeLoginSSHParams, error)

DecodeSSHParams 解析SSH登录参数

type NodeLoginDAO

type NodeLoginDAO dbs.DAO
var SharedNodeLoginDAO *NodeLoginDAO

func NewNodeLoginDAO

func NewNodeLoginDAO() *NodeLoginDAO

func (*NodeLoginDAO) CreateNodeLogin

func (this *NodeLoginDAO) CreateNodeLogin(tx *dbs.Tx, role nodeconfigs.NodeRole, nodeId int64, name string, loginType string, paramsJSON []byte) (loginId int64, err error)

CreateNodeLogin 创建认证

func (*NodeLoginDAO) DisableNodeLogin

func (this *NodeLoginDAO) DisableNodeLogin(tx *dbs.Tx, loginId int64) (rowsAffected int64, err error)

DisableNodeLogin 禁用条目

func (*NodeLoginDAO) DisableNodeLogins

func (this *NodeLoginDAO) DisableNodeLogins(tx *dbs.Tx, role nodeconfigs.NodeRole, nodeId int64) error

DisableNodeLogins 禁用某个节点的认证

func (*NodeLoginDAO) EnableNodeLogin

func (this *NodeLoginDAO) EnableNodeLogin(tx *dbs.Tx, id uint32) (rowsAffected int64, err error)

EnableNodeLogin 启用条目

func (*NodeLoginDAO) FindEnabledNodeLogin

func (this *NodeLoginDAO) FindEnabledNodeLogin(tx *dbs.Tx, id int64) (*NodeLogin, error)

FindEnabledNodeLogin 查找启用中的条目

func (*NodeLoginDAO) FindEnabledNodeLoginWithNodeId

func (this *NodeLoginDAO) FindEnabledNodeLoginWithNodeId(tx *dbs.Tx, role nodeconfigs.NodeRole, nodeId int64) (*NodeLogin, error)

FindEnabledNodeLoginWithNodeId 查找认证

func (*NodeLoginDAO) FindFrequentGrantIds

func (this *NodeLoginDAO) FindFrequentGrantIds(tx *dbs.Tx, nodeClusterId int64, nsClusterId int64) ([]int64, error)

func (*NodeLoginDAO) FindFrequentPorts

func (this *NodeLoginDAO) FindFrequentPorts(tx *dbs.Tx) ([]int32, error)

func (*NodeLoginDAO) FindNodeLoginName

func (this *NodeLoginDAO) FindNodeLoginName(tx *dbs.Tx, id uint32) (string, error)

FindNodeLoginName 根据主键查找名称

func (*NodeLoginDAO) UpdateNodeLogin

func (this *NodeLoginDAO) UpdateNodeLogin(tx *dbs.Tx, loginId int64, name string, loginType string, paramsJSON []byte) error

UpdateNodeLogin 修改认证

type NodeLoginOperator

type NodeLoginOperator struct {
	Id     interface{} // ID
	NodeId interface{} // 节点ID
	Role   interface{} // 角色
	Name   interface{} // 名称
	Type   interface{} // 类型:ssh,agent
	Params interface{} // 配置参数
	State  interface{} // 状态
}

func NewNodeLoginOperator

func NewNodeLoginOperator() *NodeLoginOperator

type NodeLoginSSHParams

type NodeLoginSSHParams struct {
	GrantId int64  `json:"grantId"`
	Host    string `json:"host"`
	Port    int    `json:"port"`
}

type NodeOperator

type NodeOperator struct {
	Id                     any // ID
	AdminId                any // 管理员ID
	UserId                 any // 用户ID
	Level                  any // 级别
	LnAddrs                any // Ln级别访问地址
	IsOn                   any // 是否启用
	IsUp                   any // 是否在线
	CountUp                any // 连续在线次数
	CountDown              any // 连续下线次数
	IsActive               any // 是否活跃
	InactiveNotifiedAt     any // 离线通知时间
	UniqueId               any // 节点ID
	Secret                 any // 密钥
	Name                   any // 节点名
	Code                   any // 代号
	ClusterId              any // 主集群ID
	SecondaryClusterIds    any // 从集群ID
	RegionId               any // 区域ID
	GroupId                any // 分组ID
	CreatedAt              any // 创建时间
	Status                 any // 最新的状态
	Version                any // 当前版本号
	LatestVersion          any // 最后版本号
	InstallDir             any // 安装目录
	IsInstalled            any // 是否已安装
	InstallStatus          any // 安装状态
	State                  any // 状态
	ConnectedAPINodes      any // 当前连接的API节点
	MaxCPU                 any // 可以使用的最多CPU
	MaxThreads             any // 最大线程数
	DdosProtection         any // DDOS配置
	DnsRoutes              any // DNS线路设置
	MaxCacheDiskCapacity   any // 硬盘缓存容量
	MaxCacheMemoryCapacity any // 内存缓存容量
	CacheDiskDir           any // 主缓存目录
	CacheDiskSubDirs       any // 其他缓存目录
	DnsResolver            any // DNS解析器
	EnableIPLists          any // 启用IP名单
	ApiNodeAddrs           any // API节点地址
	OfflineDay             any // 下线日期YYYYMMDD
	OfflineIsNotified      any // 下线是否已通知
	IsBackupForCluster     any // 是否为集群备用节点
	IsBackupForGroup       any // 是否为分组备用节点
	BackupIPs              any // 备用IP
	ActionStatus           any // 当前动作配置
}

func NewNodeOperator

func NewNodeOperator() *NodeOperator

type NodePriceItem

type NodePriceItem struct {
	Id        uint32 `field:"id"`        // ID
	IsOn      bool   `field:"isOn"`      // 是否启用
	Type      string `field:"type"`      // 类型:峰值|流量
	Name      string `field:"name"`      // 名称
	BitsFrom  uint64 `field:"bitsFrom"`  // 起始值
	BitsTo    uint64 `field:"bitsTo"`    // 结束值
	CreatedAt uint64 `field:"createdAt"` // 创建时间
	State     uint8  `field:"state"`     // 状态
}

NodePriceItem 区域计费设置

type NodePriceItemOperator

type NodePriceItemOperator struct {
	Id        interface{} // ID
	IsOn      interface{} // 是否启用
	Type      interface{} // 类型:峰值|流量
	Name      interface{} // 名称
	BitsFrom  interface{} // 起始值
	BitsTo    interface{} // 结束值
	CreatedAt interface{} // 创建时间
	State     interface{} // 状态
}

func NewNodePriceItemOperator

func NewNodePriceItemOperator() *NodePriceItemOperator

type NodeRegion

type NodeRegion struct {
	Id          uint32   `field:"id"`          // ID
	AdminId     uint32   `field:"adminId"`     // 管理员ID
	IsOn        bool     `field:"isOn"`        // 是否启用
	Name        string   `field:"name"`        // 名称
	Description string   `field:"description"` // 描述
	Order       uint32   `field:"order"`       // 排序
	CreatedAt   uint64   `field:"createdAt"`   // 创建时间
	Prices      dbs.JSON `field:"prices"`      // 流量价格
	State       uint8    `field:"state"`       // 状态
}

NodeRegion 节点区域

func (*NodeRegion) DecodePriceMap

func (this *NodeRegion) DecodePriceMap() map[int64]float64

type NodeRegionDAO

type NodeRegionDAO dbs.DAO
var SharedNodeRegionDAO *NodeRegionDAO

func NewNodeRegionDAO

func NewNodeRegionDAO() *NodeRegionDAO

func (*NodeRegionDAO) CreateRegion

func (this *NodeRegionDAO) CreateRegion(tx *dbs.Tx, adminId int64, name string, description string) (int64, error)

CreateRegion 创建区域

func (*NodeRegionDAO) DisableNodeRegion

func (this *NodeRegionDAO) DisableNodeRegion(tx *dbs.Tx, id int64) error

DisableNodeRegion 禁用条目

func (*NodeRegionDAO) EnableNodeRegion

func (this *NodeRegionDAO) EnableNodeRegion(tx *dbs.Tx, id int64) error

EnableNodeRegion 启用条目

func (*NodeRegionDAO) FindAllAvailableRegions added in v0.5.6

func (this *NodeRegionDAO) FindAllAvailableRegions(tx *dbs.Tx) (result []*NodeRegion, err error)

FindAllAvailableRegions 列出所有启用的区域

func (*NodeRegionDAO) FindAllEnabledRegionPrices

func (this *NodeRegionDAO) FindAllEnabledRegionPrices(tx *dbs.Tx) (result []*NodeRegion, err error)

FindAllEnabledRegionPrices 列出所有价格

func (*NodeRegionDAO) FindAllEnabledRegions

func (this *NodeRegionDAO) FindAllEnabledRegions(tx *dbs.Tx) (result []*NodeRegion, err error)

FindAllEnabledRegions 列出所有区域

func (*NodeRegionDAO) FindAllRegionIds added in v0.5.6

func (this *NodeRegionDAO) FindAllRegionIds(tx *dbs.Tx) ([]int64, error)

FindAllRegionIds 查找所有区域ID

func (*NodeRegionDAO) FindEnabledNodeRegion

func (this *NodeRegionDAO) FindEnabledNodeRegion(tx *dbs.Tx, id int64) (*NodeRegion, error)

FindEnabledNodeRegion 查找启用中的条目

func (*NodeRegionDAO) FindNodeRegionName

func (this *NodeRegionDAO) FindNodeRegionName(tx *dbs.Tx, id int64) (string, error)

FindNodeRegionName 根据主键查找名称

func (*NodeRegionDAO) UpdateRegion

func (this *NodeRegionDAO) UpdateRegion(tx *dbs.Tx, regionId int64, name string, description string, isOn bool) error

UpdateRegion 修改区域

func (*NodeRegionDAO) UpdateRegionItemPrice

func (this *NodeRegionDAO) UpdateRegionItemPrice(tx *dbs.Tx, regionId int64, itemId int64, price float32) error

UpdateRegionItemPrice 修改价格项价格

func (*NodeRegionDAO) UpdateRegionOrders

func (this *NodeRegionDAO) UpdateRegionOrders(tx *dbs.Tx, regionIds []int64) error

UpdateRegionOrders 排序

type NodeRegionOperator

type NodeRegionOperator struct {
	Id          any // ID
	AdminId     any // 管理员ID
	IsOn        any // 是否启用
	Name        any // 名称
	Description any // 描述
	Order       any // 排序
	CreatedAt   any // 创建时间
	Prices      any // 流量价格
	State       any // 状态
}

func NewNodeRegionOperator

func NewNodeRegionOperator() *NodeRegionOperator

type NodeTask

type NodeTask struct {
	Id         uint64 `field:"id"`         // ID
	Role       string `field:"role"`       // 节点角色
	NodeId     uint32 `field:"nodeId"`     // 节点ID
	ClusterId  uint32 `field:"clusterId"`  // 集群ID
	ServerId   uint64 `field:"serverId"`   // 服务ID
	UserId     uint64 `field:"userId"`     // 用户ID
	Type       string `field:"type"`       // 任务类型
	UniqueId   string `field:"uniqueId"`   // 唯一ID:nodeId@type
	UpdatedAt  uint64 `field:"updatedAt"`  // 修改时间
	IsDone     bool   `field:"isDone"`     // 是否已完成
	IsOk       bool   `field:"isOk"`       // 是否已完成
	Error      string `field:"error"`      // 错误信息
	IsNotified bool   `field:"isNotified"` // 是否已通知更新
	Version    uint64 `field:"version"`    // 版本
}

NodeTask 节点同步任务

type NodeTaskDAO

type NodeTaskDAO dbs.DAO
var SharedNodeTaskDAO *NodeTaskDAO

func NewNodeTaskDAO

func NewNodeTaskDAO() *NodeTaskDAO

func (*NodeTaskDAO) CountDoingNodeTasks

func (this *NodeTaskDAO) CountDoingNodeTasks(tx *dbs.Tx, role string) (int64, error)

CountDoingNodeTasks 计算正在执行的任务

func (*NodeTaskDAO) CreateClusterTask

func (this *NodeTaskDAO) CreateClusterTask(tx *dbs.Tx, role string, clusterId int64, userId int64, serverId int64, taskType NodeTaskType) error

CreateClusterTask 创建集群任务

func (*NodeTaskDAO) CreateNodeTask

func (this *NodeTaskDAO) CreateNodeTask(tx *dbs.Tx, role string, clusterId int64, nodeId int64, userId int64, serverId int64, taskType NodeTaskType) error

CreateNodeTask 创建单个节点任务

func (*NodeTaskDAO) DeleteAllClusterTasks

func (this *NodeTaskDAO) DeleteAllClusterTasks(tx *dbs.Tx, role string, clusterId int64) error

DeleteAllClusterTasks 删除集群所有相关任务

func (*NodeTaskDAO) DeleteAllNodeTasks added in v1.2.1

func (this *NodeTaskDAO) DeleteAllNodeTasks(tx *dbs.Tx) error

DeleteAllNodeTasks 删除所有节点相关任务

func (*NodeTaskDAO) DeleteNodeTask

func (this *NodeTaskDAO) DeleteNodeTask(tx *dbs.Tx, taskId int64) error

DeleteNodeTask 删除任务

func (*NodeTaskDAO) DeleteNodeTasks

func (this *NodeTaskDAO) DeleteNodeTasks(tx *dbs.Tx, role string, nodeId int64) error

DeleteNodeTasks 删除节点相关任务

func (*NodeTaskDAO) ExistsDoingNodeTasks

func (this *NodeTaskDAO) ExistsDoingNodeTasks(tx *dbs.Tx, role string, excludeTypes []NodeTaskType) (bool, error)

ExistsDoingNodeTasks 检查是否有正在执行的任务

func (*NodeTaskDAO) ExistsErrorNodeTasks

func (this *NodeTaskDAO) ExistsErrorNodeTasks(tx *dbs.Tx, role string, excludeTypes []NodeTaskType) (bool, error)

ExistsErrorNodeTasks 是否有错误的任务

func (*NodeTaskDAO) ExtractAllClusterTasks

func (this *NodeTaskDAO) ExtractAllClusterTasks(tx *dbs.Tx, role string) error

ExtractAllClusterTasks 分解所有集群任务

func (*NodeTaskDAO) ExtractNSClusterTask

func (this *NodeTaskDAO) ExtractNSClusterTask(tx *dbs.Tx, clusterId int64, taskType NodeTaskType) error

ExtractNSClusterTask 分解NS节点集群任务

func (*NodeTaskDAO) ExtractNodeClusterTask

func (this *NodeTaskDAO) ExtractNodeClusterTask(tx *dbs.Tx, clusterId int64, userId int64, serverId int64, taskType NodeTaskType) error

ExtractNodeClusterTask 分解边缘节点集群任务

func (*NodeTaskDAO) FindAllDoingNodeIds

func (this *NodeTaskDAO) FindAllDoingNodeIds(tx *dbs.Tx, role string) ([]int64, error)

FindAllDoingNodeIds 查询有任务的节点IDs

func (*NodeTaskDAO) FindAllDoingNodeTasksWithClusterId

func (this *NodeTaskDAO) FindAllDoingNodeTasksWithClusterId(tx *dbs.Tx, role string, clusterId int64) (result []*NodeTask, err error)

FindAllDoingNodeTasksWithClusterId 查询某个集群下所有的任务

func (*NodeTaskDAO) FindAllDoingTaskClusterIds

func (this *NodeTaskDAO) FindAllDoingTaskClusterIds(tx *dbs.Tx, role string) ([]int64, error)

FindAllDoingTaskClusterIds 查找正在更新的集群IDs

func (*NodeTaskDAO) FindDoingNodeTasks

func (this *NodeTaskDAO) FindDoingNodeTasks(tx *dbs.Tx, role string, nodeId int64, version int64) (result []*NodeTask, err error)

FindDoingNodeTasks 查询一个节点的所有任务

func (*NodeTaskDAO) FindNotifyingNodeTasks

func (this *NodeTaskDAO) FindNotifyingNodeTasks(tx *dbs.Tx, role string, size int64) (result []*NodeTask, err error)

FindNotifyingNodeTasks 查找需要通知的任务

func (*NodeTaskDAO) UpdateNodeTaskDone

func (this *NodeTaskDAO) UpdateNodeTaskDone(tx *dbs.Tx, taskId int64, isOk bool, errorMessage string) error

UpdateNodeTaskDone 修改节点任务的完成状态

func (*NodeTaskDAO) UpdateTasksNotified

func (this *NodeTaskDAO) UpdateTasksNotified(tx *dbs.Tx, taskIds []int64) error

UpdateTasksNotified 设置任务已通知

type NodeTaskOperator

type NodeTaskOperator struct {
	Id         any // ID
	Role       any // 节点角色
	NodeId     any // 节点ID
	ClusterId  any // 集群ID
	ServerId   any // 服务ID
	UserId     any // 用户ID
	Type       any // 任务类型
	UniqueId   any // 唯一ID:nodeId@type
	UpdatedAt  any // 修改时间
	IsDone     any // 是否已完成
	IsOk       any // 是否已完成
	Error      any // 错误信息
	IsNotified any // 是否已通知更新
	Version    any // 版本
}

func NewNodeTaskOperator

func NewNodeTaskOperator() *NodeTaskOperator

type NodeTaskType

type NodeTaskType = string
const (
	NodeTaskTypeConfigChanged                NodeTaskType = "configChanged"                // 节点整体配置变化
	NodeTaskTypeDDosProtectionChanged        NodeTaskType = "ddosProtectionChanged"        // 节点DDoS配置变更
	NodeTaskTypeGlobalServerConfigChanged    NodeTaskType = "globalServerConfigChanged"    // 全局服务设置变化
	NodeTaskTypeIPListDeleted                NodeTaskType = "ipListDeleted"                // IPList被删除
	NodeTaskTypeIPItemChanged                NodeTaskType = "ipItemChanged"                // IP条目变更
	NodeTaskTypeNodeVersionChanged           NodeTaskType = "nodeVersionChanged"           // 节点版本变化
	NodeTaskTypeScriptsChanged               NodeTaskType = "scriptsChanged"               // 脚本配置变化
	NodeTaskTypeNodeLevelChanged             NodeTaskType = "nodeLevelChanged"             // 节点级别变化
	NodeTaskTypeUserServersStateChanged      NodeTaskType = "userServersStateChanged"      // 用户服务状态变化
	NodeTaskTypeUAMPolicyChanged             NodeTaskType = "uamPolicyChanged"             // UAM策略变化
	NodeTaskTypeHTTPPagesPolicyChanged       NodeTaskType = "httpPagesPolicyChanged"       // 自定义页面变化
	NodeTaskTypeHTTPCCPolicyChanged          NodeTaskType = "httpCCPolicyChanged"          // CC策略变化
	NodeTaskTypeHTTP3PolicyChanged           NodeTaskType = "http3PolicyChanged"           // HTTP3策略变化
	NodeTaskTypeNetworkSecurityPolicyChanged NodeTaskType = "networkSecurityPolicyChanged" // 网络安全策略变化
	NodeTaskTypeUpdatingServers              NodeTaskType = "updatingServers"              // 更新一组服务
	NodeTaskTypeTOAChanged                   NodeTaskType = "toaChanged"                   // TOA配置变化

	NSNodeTaskTypeConfigChanged         NodeTaskType = "nsConfigChanged"
	NSNodeTaskTypeDomainChanged         NodeTaskType = "nsDomainChanged"
	NSNodeTaskTypeRecordChanged         NodeTaskType = "nsRecordChanged"
	NSNodeTaskTypeRouteChanged          NodeTaskType = "nsRouteChanged"
	NSNodeTaskTypeKeyChanged            NodeTaskType = "nsKeyChanged"
	NSNodeTaskTypeDDosProtectionChanged NodeTaskType = "nsDDoSProtectionChanged" // 节点DDoS配置变更
)

type NodeThreshold

type NodeThreshold struct {
	Id             uint64   `field:"id"`             // ID
	Role           string   `field:"role"`           // 节点角色
	ClusterId      uint32   `field:"clusterId"`      // 集群ID
	NodeId         uint32   `field:"nodeId"`         // 节点ID
	IsOn           bool     `field:"isOn"`           // 是否启用
	Item           string   `field:"item"`           // 监控项
	Param          string   `field:"param"`          // 参数
	Operator       string   `field:"operator"`       // 操作符
	Value          dbs.JSON `field:"value"`          // 对比值
	Message        string   `field:"message"`        // 消息内容
	NotifyDuration uint32   `field:"notifyDuration"` // 通知间隔
	NotifiedAt     uint32   `field:"notifiedAt"`     // 上次通知时间
	Duration       uint32   `field:"duration"`       // 时间段
	DurationUnit   string   `field:"durationUnit"`   // 时间段单位
	SumMethod      string   `field:"sumMethod"`      // 聚合方法
	Order          uint32   `field:"order"`          // 排序
	State          uint8    `field:"state"`          // 状态
}

NodeThreshold 集群阈值设置

type NodeThresholdDAO

type NodeThresholdDAO dbs.DAO
var SharedNodeThresholdDAO *NodeThresholdDAO

func NewNodeThresholdDAO

func NewNodeThresholdDAO() *NodeThresholdDAO

func (*NodeThresholdDAO) CountAllEnabledThresholds

func (this *NodeThresholdDAO) CountAllEnabledThresholds(tx *dbs.Tx, role string, clusterId int64, nodeId int64) (int64, error)

CountAllEnabledThresholds 计算阈值的数量

func (*NodeThresholdDAO) CreateThreshold

func (this *NodeThresholdDAO) CreateThreshold(tx *dbs.Tx, role string, clusterId int64, nodeId int64, item nodeconfigs.NodeValueItem, param string, operator nodeconfigs.NodeValueOperator, valueJSON []byte, message string, sumMethod nodeconfigs.NodeValueSumMethod, duration int32, durationUnit nodeconfigs.NodeValueDurationUnit, notifyDuration int32) (int64, error)

CreateThreshold 创建阈值

func (*NodeThresholdDAO) DisableNodeThreshold

func (this *NodeThresholdDAO) DisableNodeThreshold(tx *dbs.Tx, id int64) error

DisableNodeThreshold 禁用条目

func (*NodeThresholdDAO) EnableNodeThreshold

func (this *NodeThresholdDAO) EnableNodeThreshold(tx *dbs.Tx, id int64) error

EnableNodeThreshold 启用条目

func (*NodeThresholdDAO) FindAllEnabledAndOnClusterThresholds

func (this *NodeThresholdDAO) FindAllEnabledAndOnClusterThresholds(tx *dbs.Tx, role string, clusterId int64, item string) (result []*NodeThreshold, err error)

FindAllEnabledAndOnClusterThresholds 查询集群专属的阈值设置

func (*NodeThresholdDAO) FindAllEnabledAndOnNodeThresholds

func (this *NodeThresholdDAO) FindAllEnabledAndOnNodeThresholds(tx *dbs.Tx, role string, clusterId int64, nodeId int64, item string) (result []*NodeThreshold, err error)

FindAllEnabledAndOnNodeThresholds 查询节点专属的阈值设置

func (*NodeThresholdDAO) FindAllEnabledThresholds

func (this *NodeThresholdDAO) FindAllEnabledThresholds(tx *dbs.Tx, role string, clusterId int64, nodeId int64) (result []*NodeThreshold, err error)

FindAllEnabledThresholds 列出所有阈值

func (*NodeThresholdDAO) FindEnabledNodeThreshold

func (this *NodeThresholdDAO) FindEnabledNodeThreshold(tx *dbs.Tx, id int64) (*NodeThreshold, error)

FindEnabledNodeThreshold 查找启用中的条目

func (*NodeThresholdDAO) FireNodeThreshold

func (this *NodeThresholdDAO) FireNodeThreshold(tx *dbs.Tx, role string, nodeId int64, item string) error

FireNodeThreshold 触发相关阈值设置

func (*NodeThresholdDAO) UpdateThreshold

func (this *NodeThresholdDAO) UpdateThreshold(tx *dbs.Tx, thresholdId int64, item nodeconfigs.NodeValueItem, param string, operator nodeconfigs.NodeValueOperator, valueJSON []byte, message string, sumMethod nodeconfigs.NodeValueSumMethod, duration int32, durationUnit nodeconfigs.NodeValueDurationUnit, notifyDuration int32, isOn bool) error

UpdateThreshold 修改阈值

type NodeThresholdOperator

type NodeThresholdOperator struct {
	Id             interface{} // ID
	Role           interface{} // 节点角色
	ClusterId      interface{} // 集群ID
	NodeId         interface{} // 节点ID
	IsOn           interface{} // 是否启用
	Item           interface{} // 监控项
	Param          interface{} // 参数
	Operator       interface{} // 操作符
	Value          interface{} // 对比值
	Message        interface{} // 消息内容
	NotifyDuration interface{} // 通知间隔
	NotifiedAt     interface{} // 上次通知时间
	Duration       interface{} // 时间段
	DurationUnit   interface{} // 时间段单位
	SumMethod      interface{} // 聚合方法
	Order          interface{} // 排序
	State          interface{} // 状态
}

func NewNodeThresholdOperator

func NewNodeThresholdOperator() *NodeThresholdOperator

type NodeTrafficDailyStat added in v1.1.0

type NodeTrafficDailyStat struct {
	Id                  uint64 `field:"id"`                  // ID
	Role                string `field:"role"`                // 节点角色
	ClusterId           uint32 `field:"clusterId"`           // 集群ID
	NodeId              uint32 `field:"nodeId"`              // 集群ID
	Day                 string `field:"day"`                 // YYYYMMDD
	Bytes               uint64 `field:"bytes"`               // 流量字节
	CachedBytes         uint64 `field:"cachedBytes"`         // 缓存流量
	CountRequests       uint64 `field:"countRequests"`       // 请求数
	CountCachedRequests uint64 `field:"countCachedRequests"` // 缓存的请求数
	CountAttackRequests uint64 `field:"countAttackRequests"` // 攻击数
	AttackBytes         uint64 `field:"attackBytes"`         // 攻击流量
}

NodeTrafficDailyStat 总的流量统计(按天)

type NodeTrafficDailyStatDAO added in v1.1.0

type NodeTrafficDailyStatDAO dbs.DAO
var SharedNodeTrafficDailyStatDAO *NodeTrafficDailyStatDAO

func NewNodeTrafficDailyStatDAO added in v1.1.0

func NewNodeTrafficDailyStatDAO() *NodeTrafficDailyStatDAO

func (*NodeTrafficDailyStatDAO) CleanDays added in v1.2.1

func (this *NodeTrafficDailyStatDAO) CleanDays(tx *dbs.Tx, days int) error

CleanDays 清理历史数据

func (*NodeTrafficDailyStatDAO) CleanDefaultDays added in v1.2.1

func (this *NodeTrafficDailyStatDAO) CleanDefaultDays(tx *dbs.Tx, defaultDays int) error

func (*NodeTrafficDailyStatDAO) FindDailyStats added in v1.1.0

func (this *NodeTrafficDailyStatDAO) FindDailyStats(tx *dbs.Tx, role string, nodeId int64, dayFrom string, dayTo string) (result []*NodeTrafficDailyStat, err error)

FindDailyStats 获取日期之间统计

func (*NodeTrafficDailyStatDAO) IncreaseDailyStat added in v1.1.0

func (this *NodeTrafficDailyStatDAO) IncreaseDailyStat(tx *dbs.Tx, clusterId int64, role string, nodeId int64, day string, bytes int64, cachedBytes int64, countRequests int64, countCachedRequests int64, countAttackRequests int64, attackBytes int64) error

IncreaseDailyStat 增加统计数据

func (*NodeTrafficDailyStatDAO) SumDailyStat added in v1.1.0

func (this *NodeTrafficDailyStatDAO) SumDailyStat(tx *dbs.Tx, role string, nodeId int64, dayFrom string, dayTo string) (*NodeTrafficDailyStat, error)

SumDailyStat 计算日期之间的总和

type NodeTrafficDailyStatOperator added in v1.1.0

type NodeTrafficDailyStatOperator struct {
	Id                  interface{} // ID
	Role                interface{} // 节点角色
	ClusterId           interface{} // 集群ID
	NodeId              interface{} // 集群ID
	Day                 interface{} // YYYYMMDD
	Bytes               interface{} // 流量字节
	CachedBytes         interface{} // 缓存流量
	CountRequests       interface{} // 请求数
	CountCachedRequests interface{} // 缓存的请求数
	CountAttackRequests interface{} // 攻击数
	AttackBytes         interface{} // 攻击流量
}

func NewNodeTrafficDailyStatOperator added in v1.1.0

func NewNodeTrafficDailyStatOperator() *NodeTrafficDailyStatOperator

type NodeValue

type NodeValue struct {
	Id        uint64   `field:"id"`        // ID
	ClusterId uint32   `field:"clusterId"` // 集群ID
	NodeId    uint32   `field:"nodeId"`    // 节点ID
	Role      string   `field:"role"`      // 节点角色
	Item      string   `field:"item"`      // 监控项
	Value     dbs.JSON `field:"value"`     // 数据
	CreatedAt uint64   `field:"createdAt"` // 创建时间
	Day       string   `field:"day"`       // 日期
	Hour      string   `field:"hour"`      // 小时
	Minute    string   `field:"minute"`    // 分钟
}

NodeValue 节点监控数据

func (*NodeValue) DecodeMapValue

func (this *NodeValue) DecodeMapValue() maps.Map

type NodeValueDAO

type NodeValueDAO dbs.DAO
var SharedNodeValueDAO *NodeValueDAO

func NewNodeValueDAO

func NewNodeValueDAO() *NodeValueDAO

func (*NodeValueDAO) Clean

func (this *NodeValueDAO) Clean(tx *dbs.Tx) error

Clean 清除数据

func (*NodeValueDAO) ComposeNodeStatus

func (this *NodeValueDAO) ComposeNodeStatus(tx *dbs.Tx, role string, nodeId int64, statusConfig *nodeconfigs.NodeStatus) error

ComposeNodeStatus 组合节点状态值

func (*NodeValueDAO) ComposeNodeStatusJSON

func (this *NodeValueDAO) ComposeNodeStatusJSON(tx *dbs.Tx, role string, nodeId int64, statusJSON []byte) ([]byte, error)

ComposeNodeStatusJSON 组合节点状态值,并转换为JSON数据

func (*NodeValueDAO) CreateValue

func (this *NodeValueDAO) CreateValue(tx *dbs.Tx, clusterId int64, role nodeconfigs.NodeRole, nodeId int64, item string, valueJSON []byte, createdAt int64) error

CreateValue 创建值

func (*NodeValueDAO) FindLatestNodeValue

func (this *NodeValueDAO) FindLatestNodeValue(tx *dbs.Tx, role string, nodeId int64, item string) (*NodeValue, error)

FindLatestNodeValue 获取最近一条数据

func (*NodeValueDAO) ListValues

func (this *NodeValueDAO) ListValues(tx *dbs.Tx, role string, nodeId int64, item string, timeRange nodeconfigs.NodeValueRange) (result []*NodeValue, err error)

ListValues 列出最近的的数据

func (*NodeValueDAO) ListValuesForNSNodes

func (this *NodeValueDAO) ListValuesForNSNodes(tx *dbs.Tx, item string, key string, timeRange nodeconfigs.NodeValueRange) (result []*NodeValue, err error)

ListValuesForNSNodes 列出用户节点相关的平均数据

func (*NodeValueDAO) ListValuesForUserNodes

func (this *NodeValueDAO) ListValuesForUserNodes(tx *dbs.Tx, item string, key string, timeRange nodeconfigs.NodeValueRange) (result []*NodeValue, err error)

ListValuesForUserNodes 列出用户节点相关的平均数据

func (*NodeValueDAO) ListValuesWithClusterId

func (this *NodeValueDAO) ListValuesWithClusterId(tx *dbs.Tx, role string, clusterId int64, item string, key string, timeRange nodeconfigs.NodeValueRange) (result []*NodeValue, err error)

ListValuesWithClusterId 列出集群最近的的平均数据

func (*NodeValueDAO) SumAllNodeValues

func (this *NodeValueDAO) SumAllNodeValues(tx *dbs.Tx, role string, item nodeconfigs.NodeValueItem, param string, duration int32, durationUnit nodeconfigs.NodeValueDurationUnit) (total float64, avg float64, max float64, err error)

SumAllNodeValues 计算所有节点的某项参数值

func (*NodeValueDAO) SumNodeClusterValues

func (this *NodeValueDAO) SumNodeClusterValues(tx *dbs.Tx, role string, clusterId int64, item string, param string, method nodeconfigs.NodeValueSumMethod, duration int32, durationUnit nodeconfigs.NodeValueDurationUnit) (float64, error)

SumNodeClusterValues 计算节点集群的某项参数值

func (*NodeValueDAO) SumNodeGroupValues

func (this *NodeValueDAO) SumNodeGroupValues(tx *dbs.Tx, role string, groupId int64, item string, param string, method nodeconfigs.NodeValueSumMethod, duration int32, durationUnit nodeconfigs.NodeValueDurationUnit) (float64, error)

SumNodeGroupValues 计算节点分组的某项参数值

func (*NodeValueDAO) SumNodeValues

func (this *NodeValueDAO) SumNodeValues(tx *dbs.Tx, role string, nodeId int64, item string, param string, method nodeconfigs.NodeValueSumMethod, duration int32, durationUnit nodeconfigs.NodeValueDurationUnit) (float64, error)

SumNodeValues 计算节点的某项参数值

type NodeValueOperator

type NodeValueOperator struct {
	Id        interface{} // ID
	ClusterId interface{} // 集群ID
	NodeId    interface{} // 节点ID
	Role      interface{} // 节点角色
	Item      interface{} // 监控项
	Value     interface{} // 数据
	CreatedAt interface{} // 创建时间
	Day       interface{} // 日期
	Hour      interface{} // 小时
	Minute    interface{} // 分钟
}

func NewNodeValueOperator

func NewNodeValueOperator() *NodeValueOperator

type Origin

type Origin struct {
	Id                 uint32   `field:"id"`                 // ID
	AdminId            uint32   `field:"adminId"`            // 管理员ID
	UserId             uint32   `field:"userId"`             // 用户ID
	IsOn               bool     `field:"isOn"`               // 是否启用
	Name               string   `field:"name"`               // 名称
	Version            uint32   `field:"version"`            // 版本
	Addr               dbs.JSON `field:"addr"`               // 地址
	Oss                dbs.JSON `field:"oss"`                // OSS配置
	Description        string   `field:"description"`        // 描述
	Code               string   `field:"code"`               // 代号
	Weight             uint32   `field:"weight"`             // 权重
	ConnTimeout        dbs.JSON `field:"connTimeout"`        // 连接超时
	ReadTimeout        dbs.JSON `field:"readTimeout"`        // 读超时
	IdleTimeout        dbs.JSON `field:"idleTimeout"`        // 空闲连接超时
	MaxFails           uint32   `field:"maxFails"`           // 最多失败次数
	MaxConns           uint32   `field:"maxConns"`           // 最大并发连接数
	MaxIdleConns       uint32   `field:"maxIdleConns"`       // 最多空闲连接数
	HttpRequestURI     string   `field:"httpRequestURI"`     // 转发后的请求URI
	HttpRequestHeader  dbs.JSON `field:"httpRequestHeader"`  // 请求Header配置
	HttpResponseHeader dbs.JSON `field:"httpResponseHeader"` // 响应Header配置
	Host               string   `field:"host"`               // 自定义主机名
	HealthCheck        dbs.JSON `field:"healthCheck"`        // 健康检查设置
	Cert               dbs.JSON `field:"cert"`               // 证书设置
	Ftp                dbs.JSON `field:"ftp"`                // FTP相关设置
	CreatedAt          uint64   `field:"createdAt"`          // 创建时间
	Domains            dbs.JSON `field:"domains"`            // 所属域名
	FollowPort         bool     `field:"followPort"`         // 端口跟随
	State              uint8    `field:"state"`              // 状态
	Http2Enabled       bool     `field:"http2Enabled"`       // 是否支持HTTP/2
}

Origin 源站

func (*Origin) DecodeAddr

func (this *Origin) DecodeAddr() (*serverconfigs.NetworkAddressConfig, error)

DecodeAddr 解析地址

func (*Origin) DecodeDomains

func (this *Origin) DecodeDomains() []string

type OriginDAO

type OriginDAO dbs.DAO
var SharedOriginDAO *OriginDAO

func NewOriginDAO

func NewOriginDAO() *OriginDAO

func (*OriginDAO) CheckUserOrigin added in v0.4.9

func (this *OriginDAO) CheckUserOrigin(tx *dbs.Tx, userId int64, originId int64) error

CheckUserOrigin 检查源站权限

func (*OriginDAO) CloneOrigin added in v1.0.0

func (this *OriginDAO) CloneOrigin(tx *dbs.Tx, fromOriginId int64) (newOriginId int64, err error)

CloneOrigin 复制源站

func (*OriginDAO) ComposeOriginConfig

func (this *OriginDAO) ComposeOriginConfig(tx *dbs.Tx, originId int64, dataMap *shared.DataMap, cacheMap *utils.CacheMap) (*serverconfigs.OriginConfig, error)

ComposeOriginConfig 将源站信息转换为配置

func (*OriginDAO) CreateOrigin

func (this *OriginDAO) CreateOrigin(tx *dbs.Tx,
	adminId int64,
	userId int64,
	name string,
	addrJSON []byte,
	ossConfig *ossconfigs.OSSConfig,
	description string,
	weight int32, isOn bool,
	connTimeout *shared.TimeDuration,
	readTimeout *shared.TimeDuration,
	idleTimeout *shared.TimeDuration,
	maxConns int32,
	maxIdleConns int32,
	certRef *sslconfigs.SSLCertRef,
	domains []string,
	host string,
	followPort bool,
	http2Enabled bool) (originId int64, err error)

CreateOrigin 创建源站

func (*OriginDAO) DisableOrigin

func (this *OriginDAO) DisableOrigin(tx *dbs.Tx, originId int64) error

DisableOrigin 禁用条目

func (*OriginDAO) EnableOrigin

func (this *OriginDAO) EnableOrigin(tx *dbs.Tx, id int64) error

EnableOrigin 启用条目

func (*OriginDAO) FindEnabledOrigin

func (this *OriginDAO) FindEnabledOrigin(tx *dbs.Tx, id int64) (*Origin, error)

FindEnabledOrigin 查找启用中的条目

func (*OriginDAO) FindOriginName

func (this *OriginDAO) FindOriginName(tx *dbs.Tx, id int64) (string, error)

FindOriginName 根据主键查找名称

func (*OriginDAO) Init

func (this *OriginDAO) Init()

Init 初始化

func (*OriginDAO) NotifyUpdate

func (this *OriginDAO) NotifyUpdate(tx *dbs.Tx, originId int64) error

NotifyUpdate 通知更新

func (*OriginDAO) UpdateOrigin

func (this *OriginDAO) UpdateOrigin(tx *dbs.Tx,
	originId int64,
	name string,
	addrJSON []byte,
	ossConfig *ossconfigs.OSSConfig,
	description string,
	weight int32,
	isOn bool,
	connTimeout *shared.TimeDuration,
	readTimeout *shared.TimeDuration,
	idleTimeout *shared.TimeDuration,
	maxConns int32,
	maxIdleConns int32,
	certRef *sslconfigs.SSLCertRef,
	domains []string,
	host string,
	followPort bool,
	http2Enabled bool) error

UpdateOrigin 修改源站

type OriginOperator

type OriginOperator struct {
	Id                 any // ID
	AdminId            any // 管理员ID
	UserId             any // 用户ID
	IsOn               any // 是否启用
	Name               any // 名称
	Version            any // 版本
	Addr               any // 地址
	Oss                any // OSS配置
	Description        any // 描述
	Code               any // 代号
	Weight             any // 权重
	ConnTimeout        any // 连接超时
	ReadTimeout        any // 读超时
	IdleTimeout        any // 空闲连接超时
	MaxFails           any // 最多失败次数
	MaxConns           any // 最大并发连接数
	MaxIdleConns       any // 最多空闲连接数
	HttpRequestURI     any // 转发后的请求URI
	HttpRequestHeader  any // 请求Header配置
	HttpResponseHeader any // 响应Header配置
	Host               any // 自定义主机名
	HealthCheck        any // 健康检查设置
	Cert               any // 证书设置
	Ftp                any // FTP相关设置
	CreatedAt          any // 创建时间
	Domains            any // 所属域名
	FollowPort         any // 端口跟随
	State              any // 状态
	Http2Enabled       any // 是否支持HTTP/2
}

func NewOriginOperator

func NewOriginOperator() *OriginOperator

type Plan

type Plan struct {
	Id                        uint32   `field:"id"`                        // ID
	IsOn                      bool     `field:"isOn"`                      // 是否启用
	Name                      string   `field:"name"`                      // 套餐名
	ClusterId                 uint32   `field:"clusterId"`                 // 集群ID
	TrafficLimit              dbs.JSON `field:"trafficLimit"`              // 流量限制
	Features                  dbs.JSON `field:"features"`                  // 允许的功能
	TrafficPrice              dbs.JSON `field:"trafficPrice"`              // 流量价格设定
	BandwidthPrice            dbs.JSON `field:"bandwidthPrice"`            // 带宽价格
	MonthlyPrice              float64  `field:"monthlyPrice"`              // 月付
	SeasonallyPrice           float64  `field:"seasonallyPrice"`           // 季付
	YearlyPrice               float64  `field:"yearlyPrice"`               // 年付
	PriceType                 string   `field:"priceType"`                 // 价格类型
	Order                     uint32   `field:"order"`                     // 排序
	State                     uint8    `field:"state"`                     // 状态
	TotalServers              uint32   `field:"totalServers"`              // 可以绑定的网站数量
	TotalServerNamesPerServer uint32   `field:"totalServerNamesPerServer"` // 每个网站可以绑定的域名数量
	TotalServerNames          uint32   `field:"totalServerNames"`          // 总域名数量
	MonthlyRequests           uint64   `field:"monthlyRequests"`           // 每月访问量额度
	DailyRequests             uint64   `field:"dailyRequests"`             // 每日访问量额度
}

Plan 用户套餐

type PlanDAO

type PlanDAO dbs.DAO
var SharedPlanDAO *PlanDAO

func NewPlanDAO

func NewPlanDAO() *PlanDAO

func (*PlanDAO) CountAllEnabledPlans

func (this *PlanDAO) CountAllEnabledPlans(tx *dbs.Tx) (int64, error)

CountAllEnabledPlans 计算套餐的数量

func (*PlanDAO) DisablePlan

func (this *PlanDAO) DisablePlan(tx *dbs.Tx, id int64) error

DisablePlan 禁用条目

func (*PlanDAO) EnablePlan

func (this *PlanDAO) EnablePlan(tx *dbs.Tx, id uint32) error

EnablePlan 启用条目

func (*PlanDAO) FindAllEnabledPlans

func (this *PlanDAO) FindAllEnabledPlans(tx *dbs.Tx) (result []*Plan, err error)

FindAllEnabledPlans 查找所有可用套餐

func (*PlanDAO) FindEnabledPlan

func (this *PlanDAO) FindEnabledPlan(tx *dbs.Tx, planId int64, cacheMap *utils.CacheMap) (*Plan, error)

FindEnabledPlan 查找启用中的条目

func (*PlanDAO) FindEnabledPlanTrafficLimit

func (this *PlanDAO) FindEnabledPlanTrafficLimit(tx *dbs.Tx, planId int64, cacheMap *utils.CacheMap) (*serverconfigs.TrafficLimitConfig, error)

FindEnabledPlanTrafficLimit 获取套餐的流量限制

func (*PlanDAO) FindPlanName

func (this *PlanDAO) FindPlanName(tx *dbs.Tx, id int64) (string, error)

FindPlanName 根据主键查找名称

func (*PlanDAO) ListEnabledPlans

func (this *PlanDAO) ListEnabledPlans(tx *dbs.Tx, offset int64, size int64) (result []*Plan, err error)

ListEnabledPlans 列出单页套餐

func (*PlanDAO) NotifyUpdate

func (this *PlanDAO) NotifyUpdate(tx *dbs.Tx, planId int64) error

NotifyUpdate 通知变更

func (*PlanDAO) SortPlans

func (this *PlanDAO) SortPlans(tx *dbs.Tx, planIds []int64) error

SortPlans 增加排序

type PlanOperator

type PlanOperator struct {
	Id                        any // ID
	IsOn                      any // 是否启用
	Name                      any // 套餐名
	ClusterId                 any // 集群ID
	TrafficLimit              any // 流量限制
	Features                  any // 允许的功能
	TrafficPrice              any // 流量价格设定
	BandwidthPrice            any // 带宽价格
	MonthlyPrice              any // 月付
	SeasonallyPrice           any // 季付
	YearlyPrice               any // 年付
	PriceType                 any // 价格类型
	Order                     any // 排序
	State                     any // 状态
	TotalServers              any // 可以绑定的网站数量
	TotalServerNamesPerServer any // 每个网站可以绑定的域名数量
	TotalServerNames          any // 总域名数量
	MonthlyRequests           any // 每月访问量额度
	DailyRequests             any // 每日访问量额度
}

func NewPlanOperator

func NewPlanOperator() *PlanOperator

type Provider

type Provider struct {
	Id        uint32 `field:"id"`        // ID
	Username  string `field:"username"`  // 用户名
	Password  string `field:"password"`  // 密码
	Fullname  string `field:"fullname"`  // 真实姓名
	CreatedAt uint64 `field:"createdAt"` // 创建时间
	UpdatedAt uint64 `field:"updatedAt"` // 修改时间
	State     uint8  `field:"state"`     // 状态
}

供应商

type ProviderDAO

type ProviderDAO dbs.DAO
var SharedProviderDAO *ProviderDAO

func NewProviderDAO

func NewProviderDAO() *ProviderDAO

func (*ProviderDAO) DisableProvider

func (this *ProviderDAO) DisableProvider(tx *dbs.Tx, id int64) (rowsAffected int64, err error)

禁用条目

func (*ProviderDAO) EnableProvider

func (this *ProviderDAO) EnableProvider(tx *dbs.Tx, id int64) (rowsAffected int64, err error)

启用条目

func (*ProviderDAO) FindEnabledProvider

func (this *ProviderDAO) FindEnabledProvider(tx *dbs.Tx, id int64) (*Provider, error)

查找启用中的条目

func (*ProviderDAO) FindProviderName

func (this *ProviderDAO) FindProviderName(tx *dbs.Tx, providerId int64) (string, error)

查找供应商名称

type ProviderOperator

type ProviderOperator struct {
	Id        interface{} // ID
	Username  interface{} // 用户名
	Password  interface{} // 密码
	Fullname  interface{} // 真实姓名
	CreatedAt interface{} // 创建时间
	UpdatedAt interface{} // 修改时间
	State     interface{} // 状态
}

func NewProviderOperator

func NewProviderOperator() *ProviderOperator

type ReportNode

type ReportNode struct {
	Id        uint32   `field:"id"`        // ID
	UniqueId  string   `field:"uniqueId"`  // 唯一ID
	Secret    string   `field:"secret"`    // 密钥
	IsOn      bool     `field:"isOn"`      // 是否启用
	Name      string   `field:"name"`      // 名称
	Location  string   `field:"location"`  // 所在区域
	Isp       string   `field:"isp"`       // 网络服务商
	AllowIPs  dbs.JSON `field:"allowIPs"`  // 允许的IP
	IsActive  bool     `field:"isActive"`  // 是否活跃
	Status    dbs.JSON `field:"status"`    // 状态
	State     uint8    `field:"state"`     // 状态
	CreatedAt uint64   `field:"createdAt"` // 创建时间
	GroupIds  dbs.JSON `field:"groupIds"`  // 分组ID
}

ReportNode 连通性报告终端

func (*ReportNode) DecodeAllowIPs

func (this *ReportNode) DecodeAllowIPs() []string

func (*ReportNode) DecodeGroupIds

func (this *ReportNode) DecodeGroupIds() []int64

type ReportNodeDAO

type ReportNodeDAO dbs.DAO
var SharedReportNodeDAO *ReportNodeDAO

func NewReportNodeDAO

func NewReportNodeDAO() *ReportNodeDAO

func (*ReportNodeDAO) ComposeConfig

func (this *ReportNodeDAO) ComposeConfig(tx *dbs.Tx, nodeId int64) (*reporterconfigs.NodeConfig, error)

ComposeConfig 组合配置

func (*ReportNodeDAO) CountAllEnabledAndOnReportNodes

func (this *ReportNodeDAO) CountAllEnabledAndOnReportNodes(tx *dbs.Tx) (int64, error)

CountAllEnabledAndOnReportNodes 计算可用的终端数量

func (*ReportNodeDAO) CountAllEnabledReportNodes

func (this *ReportNodeDAO) CountAllEnabledReportNodes(tx *dbs.Tx, groupId int64, keyword string) (int64, error)

CountAllEnabledReportNodes 计算终端数量

func (*ReportNodeDAO) CountAllLowerVersionNodes

func (this *ReportNodeDAO) CountAllLowerVersionNodes(tx *dbs.Tx, version string) (int64, error)

CountAllLowerVersionNodes 计算所有节点中低于某个版本的节点数量

func (*ReportNodeDAO) CreateReportNode

func (this *ReportNodeDAO) CreateReportNode(tx *dbs.Tx, name string, location string, isp string, allowIPs []string, groupIds []int64) (int64, error)

CreateReportNode 创建终端

func (*ReportNodeDAO) DisableReportNode

func (this *ReportNodeDAO) DisableReportNode(tx *dbs.Tx, nodeId int64) error

DisableReportNode 禁用条目

func (*ReportNodeDAO) EnableReportNode

func (this *ReportNodeDAO) EnableReportNode(tx *dbs.Tx, id int64) error

EnableReportNode 启用条目

func (*ReportNodeDAO) FindEnabledNodeIdWithUniqueId

func (this *ReportNodeDAO) FindEnabledNodeIdWithUniqueId(tx *dbs.Tx, uniqueId string) (int64, error)

FindEnabledNodeIdWithUniqueId 根据唯一ID获取节点ID

func (*ReportNodeDAO) FindEnabledReportNode

func (this *ReportNodeDAO) FindEnabledReportNode(tx *dbs.Tx, id int64) (*ReportNode, error)

FindEnabledReportNode 查找启用中的条目

func (*ReportNodeDAO) FindNodeActive

func (this *ReportNodeDAO) FindNodeActive(tx *dbs.Tx, nodeId int64) (bool, error)

FindNodeActive 检查节点活跃状态

func (*ReportNodeDAO) FindNodeAllowIPs

func (this *ReportNodeDAO) FindNodeAllowIPs(tx *dbs.Tx, nodeId int64) ([]string, error)

FindNodeAllowIPs 查询节点允许的IP

func (*ReportNodeDAO) FindReportNodeName

func (this *ReportNodeDAO) FindReportNodeName(tx *dbs.Tx, id int64) (string, error)

FindReportNodeName 根据主键查找名称

func (*ReportNodeDAO) GenUniqueId

func (this *ReportNodeDAO) GenUniqueId(tx *dbs.Tx) (string, error)

GenUniqueId 生成唯一ID

func (*ReportNodeDAO) ListEnabledReportNodes

func (this *ReportNodeDAO) ListEnabledReportNodes(tx *dbs.Tx, groupId int64, keyword string, offset int64, size int64) (result []*ReportNode, err error)

ListEnabledReportNodes 列出单页终端

func (*ReportNodeDAO) UpdateNodeActive

func (this *ReportNodeDAO) UpdateNodeActive(tx *dbs.Tx, nodeId int64, isActive bool) error

UpdateNodeActive 修改节点活跃状态

func (*ReportNodeDAO) UpdateNodeStatus

func (this *ReportNodeDAO) UpdateNodeStatus(tx *dbs.Tx, nodeId int64, nodeStatus *reporterconfigs.Status) error

UpdateNodeStatus 更改节点状态

func (*ReportNodeDAO) UpdateReportNode

func (this *ReportNodeDAO) UpdateReportNode(tx *dbs.Tx, nodeId int64, name string, location string, isp string, allowIPs []string, groupIds []int64, isOn bool) error

UpdateReportNode 修改终端

type ReportNodeGroup

type ReportNodeGroup struct {
	Id    uint32 `field:"id"`    // ID
	Name  string `field:"name"`  // 名称
	State uint8  `field:"state"` // 状态
	IsOn  bool   `field:"isOn"`  // 是否启用
}

ReportNodeGroup 监控终端区域

type ReportNodeGroupDAO

type ReportNodeGroupDAO dbs.DAO
var SharedReportNodeGroupDAO *ReportNodeGroupDAO

func NewReportNodeGroupDAO

func NewReportNodeGroupDAO() *ReportNodeGroupDAO

func (*ReportNodeGroupDAO) CountAllEnabledGroups

func (this *ReportNodeGroupDAO) CountAllEnabledGroups(tx *dbs.Tx) (int64, error)

CountAllEnabledGroups 查找所有分组的数量

func (*ReportNodeGroupDAO) CreateGroup

func (this *ReportNodeGroupDAO) CreateGroup(tx *dbs.Tx, name string) (int64, error)

CreateGroup 创建

func (*ReportNodeGroupDAO) DisableReportNodeGroup

func (this *ReportNodeGroupDAO) DisableReportNodeGroup(tx *dbs.Tx, id int64) error

DisableReportNodeGroup 禁用条目

func (*ReportNodeGroupDAO) EnableReportNodeGroup

func (this *ReportNodeGroupDAO) EnableReportNodeGroup(tx *dbs.Tx, id uint32) error

EnableReportNodeGroup 启用条目

func (*ReportNodeGroupDAO) FindAllEnabledGroups

func (this *ReportNodeGroupDAO) FindAllEnabledGroups(tx *dbs.Tx) (result []*ReportNodeGroup, err error)

FindAllEnabledGroups 查找所有可用的分组

func (*ReportNodeGroupDAO) FindEnabledReportNodeGroup

func (this *ReportNodeGroupDAO) FindEnabledReportNodeGroup(tx *dbs.Tx, id int64) (*ReportNodeGroup, error)

FindEnabledReportNodeGroup 查找启用中的条目

func (*ReportNodeGroupDAO) FindReportNodeGroupName

func (this *ReportNodeGroupDAO) FindReportNodeGroupName(tx *dbs.Tx, id int64) (string, error)

FindReportNodeGroupName 根据主键查找名称

func (*ReportNodeGroupDAO) UpdateGroup

func (this *ReportNodeGroupDAO) UpdateGroup(tx *dbs.Tx, groupId int64, name string) error

UpdateGroup 修改

type ReportNodeGroupOperator

type ReportNodeGroupOperator struct {
	Id    interface{} // ID
	Name  interface{} // 名称
	State interface{} // 状态
	IsOn  interface{} // 是否启用
}

func NewReportNodeGroupOperator

func NewReportNodeGroupOperator() *ReportNodeGroupOperator

type ReportNodeOperator

type ReportNodeOperator struct {
	Id        interface{} // ID
	UniqueId  interface{} // 唯一ID
	Secret    interface{} // 密钥
	IsOn      interface{} // 是否启用
	Name      interface{} // 名称
	Location  interface{} // 所在区域
	Isp       interface{} // 网络服务商
	AllowIPs  interface{} // 允许的IP
	IsActive  interface{} // 是否活跃
	Status    interface{} // 状态
	State     interface{} // 状态
	CreatedAt interface{} // 创建时间
	GroupIds  interface{} // 分组ID
}

func NewReportNodeOperator

func NewReportNodeOperator() *ReportNodeOperator

type ReportResult

type ReportResult struct {
	Id           uint64  `field:"id"`           // ID
	Type         string  `field:"type"`         // 对象类型
	TargetId     uint64  `field:"targetId"`     // 对象ID
	TargetDesc   string  `field:"targetDesc"`   // 对象描述
	UpdatedAt    uint64  `field:"updatedAt"`    // 更新时间
	ReportNodeId uint32  `field:"reportNodeId"` // 监控节点ID
	IsOk         bool    `field:"isOk"`         // 是否可连接
	Level        string  `field:"level"`        // 级别
	CostMs       float64 `field:"costMs"`       // 单次连接花费的时间
	Error        string  `field:"error"`        // 产生的错误信息
	CountUp      uint32  `field:"countUp"`      // 连续上线次数
	CountDown    uint32  `field:"countDown"`    // 连续下线次数
}

ReportResult 连通性监控结果

type ReportResultDAO

type ReportResultDAO dbs.DAO
var SharedReportResultDAO *ReportResultDAO

func NewReportResultDAO

func NewReportResultDAO() *ReportResultDAO

func (*ReportResultDAO) CountAllResults

func (this *ReportResultDAO) CountAllResults(tx *dbs.Tx, reportNodeId int64, level reporterconfigs.ReportLevel, okState configutils.BoolState) (int64, error)

CountAllResults 计算结果数量

func (*ReportResultDAO) FindAllResults

func (this *ReportResultDAO) FindAllResults(tx *dbs.Tx, taskType string, targetId int64) (result []*ReportResult, err error)

FindAllResults 列出所有结果

func (*ReportResultDAO) FindAvgCostMsWithTarget

func (this *ReportResultDAO) FindAvgCostMsWithTarget(tx *dbs.Tx, taskType reporterconfigs.TaskType, targetId int64) (float64, error)

FindAvgCostMsWithTarget 获取某个对象的平均耗时

func (*ReportResultDAO) FindAvgLevelWithTarget

func (this *ReportResultDAO) FindAvgLevelWithTarget(tx *dbs.Tx, taskType reporterconfigs.TaskType, targetId int64) (string, error)

FindAvgLevelWithTarget 获取某个对象的平均级别

func (*ReportResultDAO) FindConnectivityWithTargetPercent

func (this *ReportResultDAO) FindConnectivityWithTargetPercent(tx *dbs.Tx, taskType reporterconfigs.TaskType, targetId int64, groupId int64) (float64, error)

FindConnectivityWithTargetPercent 获取某个对象的连通率 返回值在0-100

func (*ReportResultDAO) ListResults

func (this *ReportResultDAO) ListResults(tx *dbs.Tx, reportNodeId int64, okState configutils.BoolState, level reporterconfigs.ReportLevel, offset int64, size int64) (result []*ReportResult, err error)

ListResults 列出单页结果

func (*ReportResultDAO) UpdateResult

func (this *ReportResultDAO) UpdateResult(tx *dbs.Tx, taskType string, targetId int64, targetDesc string, reportNodeId int64, level reporterconfigs.ReportLevel, isOk bool, costMs float64, errString string) error

UpdateResult 创建结果

type ReportResultOperator

type ReportResultOperator struct {
	Id           interface{} // ID
	Type         interface{} // 对象类型
	TargetId     interface{} // 对象ID
	TargetDesc   interface{} // 对象描述
	UpdatedAt    interface{} // 更新时间
	ReportNodeId interface{} // 监控节点ID
	IsOk         interface{} // 是否可连接
	Level        interface{} // 级别
	CostMs       interface{} // 单次连接花费的时间
	Error        interface{} // 产生的错误信息
	CountUp      interface{} // 连续上线次数
	CountDown    interface{} // 连续下线次数
}

func NewReportResultOperator

func NewReportResultOperator() *ReportResultOperator

type ReverseProxy

type ReverseProxy struct {
	Id                       uint32   `field:"id"`                       // ID
	AdminId                  uint32   `field:"adminId"`                  // 管理员ID
	UserId                   uint32   `field:"userId"`                   // 用户ID
	TemplateId               uint32   `field:"templateId"`               // 模版ID
	IsOn                     bool     `field:"isOn"`                     // 是否启用
	Scheduling               dbs.JSON `field:"scheduling"`               // 调度算法
	PrimaryOrigins           dbs.JSON `field:"primaryOrigins"`           // 主要源站
	BackupOrigins            dbs.JSON `field:"backupOrigins"`            // 备用源站
	StripPrefix              string   `field:"stripPrefix"`              // 去除URL前缀
	RequestHostType          uint8    `field:"requestHostType"`          // 请求Host类型
	RequestHost              string   `field:"requestHost"`              // 请求Host
	RequestHostExcludingPort bool     `field:"requestHostExcludingPort"` // 移除请求Host中的域名
	RequestURI               string   `field:"requestURI"`               // 请求URI
	AutoFlush                uint8    `field:"autoFlush"`                // 是否自动刷新缓冲区
	AddHeaders               dbs.JSON `field:"addHeaders"`               // 自动添加的Header列表
	State                    uint8    `field:"state"`                    // 状态
	CreatedAt                uint64   `field:"createdAt"`                // 创建时间
	ConnTimeout              dbs.JSON `field:"connTimeout"`              // 连接超时时间
	ReadTimeout              dbs.JSON `field:"readTimeout"`              // 读取超时时间
	IdleTimeout              dbs.JSON `field:"idleTimeout"`              // 空闲超时时间
	MaxConns                 uint32   `field:"maxConns"`                 // 最大并发连接数
	MaxIdleConns             uint32   `field:"maxIdleConns"`             // 最大空闲连接数
	ProxyProtocol            dbs.JSON `field:"proxyProtocol"`            // Proxy Protocol配置
	FollowRedirects          uint8    `field:"followRedirects"`          // 回源跟随
	Retry50X                 bool     `field:"retry50X"`                 // 启用50X重试
	Retry40X                 bool     `field:"retry40X"`                 // 启用40X重试
}

ReverseProxy 反向代理配置

type ReverseProxyDAO

type ReverseProxyDAO dbs.DAO
var SharedReverseProxyDAO *ReverseProxyDAO

func NewReverseProxyDAO

func NewReverseProxyDAO() *ReverseProxyDAO

func (*ReverseProxyDAO) CheckUserReverseProxy

func (this *ReverseProxyDAO) CheckUserReverseProxy(tx *dbs.Tx, userId int64, reverseProxyId int64) error

CheckUserReverseProxy 检查用户权限

func (*ReverseProxyDAO) CloneReverseProxy added in v1.0.0

func (this *ReverseProxyDAO) CloneReverseProxy(tx *dbs.Tx, fromReverseProxyId int64) (newReverseProxyId int64, err error)

CloneReverseProxy 复制反向代理

func (*ReverseProxyDAO) ComposeReverseProxyConfig

func (this *ReverseProxyDAO) ComposeReverseProxyConfig(tx *dbs.Tx, reverseProxyId int64, dataMap *shared.DataMap, cacheMap *utils.CacheMap) (*serverconfigs.ReverseProxyConfig, error)

ComposeReverseProxyConfig 根据ID组合配置

func (*ReverseProxyDAO) CreateReverseProxy

func (this *ReverseProxyDAO) CreateReverseProxy(tx *dbs.Tx, adminId int64, userId int64, schedulingJSON []byte, primaryOriginsJSON []byte, backupOriginsJSON []byte) (int64, error)

CreateReverseProxy 创建反向代理

func (*ReverseProxyDAO) DisableReverseProxy

func (this *ReverseProxyDAO) DisableReverseProxy(tx *dbs.Tx, id int64) error

DisableReverseProxy 禁用条目

func (*ReverseProxyDAO) EnableReverseProxy

func (this *ReverseProxyDAO) EnableReverseProxy(tx *dbs.Tx, id int64) error

EnableReverseProxy 启用条目

func (*ReverseProxyDAO) FindEnabledReverseProxy

func (this *ReverseProxyDAO) FindEnabledReverseProxy(tx *dbs.Tx, id int64) (*ReverseProxy, error)

FindEnabledReverseProxy 查找启用中的条目

func (*ReverseProxyDAO) FindReverseProxyContainsOriginId

func (this *ReverseProxyDAO) FindReverseProxyContainsOriginId(tx *dbs.Tx, originId int64) (int64, error)

FindReverseProxyContainsOriginId 查找包含某个源站的反向代理ID

func (*ReverseProxyDAO) Init

func (this *ReverseProxyDAO) Init()

Init 初始化

func (*ReverseProxyDAO) NotifyUpdate

func (this *ReverseProxyDAO) NotifyUpdate(tx *dbs.Tx, reverseProxyId int64) error

NotifyUpdate 通知更新

func (*ReverseProxyDAO) UpdateReverseProxy

func (this *ReverseProxyDAO) UpdateReverseProxy(tx *dbs.Tx,
	reverseProxyId int64,
	requestHostType int8,
	requestHost string,
	requestHostExcludingPort bool,
	requestURI string,
	stripPrefix string,
	autoFlush bool,
	addHeaders []string,
	connTimeout *shared.TimeDuration,
	readTimeout *shared.TimeDuration,
	idleTimeout *shared.TimeDuration,
	maxConns int32,
	maxIdleConns int32,
	proxyProtocolJSON []byte,
	followRedirects bool,
	retry50X bool,
	retry40X bool) error

UpdateReverseProxy 修改是否启用

func (*ReverseProxyDAO) UpdateReverseProxyBackupOrigins

func (this *ReverseProxyDAO) UpdateReverseProxyBackupOrigins(tx *dbs.Tx, reverseProxyId int64, origins []byte) error

UpdateReverseProxyBackupOrigins 修改备用源站

func (*ReverseProxyDAO) UpdateReverseProxyPrimaryOrigins

func (this *ReverseProxyDAO) UpdateReverseProxyPrimaryOrigins(tx *dbs.Tx, reverseProxyId int64, origins []byte) error

UpdateReverseProxyPrimaryOrigins 修改主要源站

func (*ReverseProxyDAO) UpdateReverseProxyScheduling

func (this *ReverseProxyDAO) UpdateReverseProxyScheduling(tx *dbs.Tx, reverseProxyId int64, schedulingJSON []byte) error

UpdateReverseProxyScheduling 修改反向代理调度算法

type ReverseProxyOperator

type ReverseProxyOperator struct {
	Id                       any // ID
	AdminId                  any // 管理员ID
	UserId                   any // 用户ID
	TemplateId               any // 模版ID
	IsOn                     any // 是否启用
	Scheduling               any // 调度算法
	PrimaryOrigins           any // 主要源站
	BackupOrigins            any // 备用源站
	StripPrefix              any // 去除URL前缀
	RequestHostType          any // 请求Host类型
	RequestHost              any // 请求Host
	RequestHostExcludingPort any // 移除请求Host中的域名
	RequestURI               any // 请求URI
	AutoFlush                any // 是否自动刷新缓冲区
	AddHeaders               any // 自动添加的Header列表
	State                    any // 状态
	CreatedAt                any // 创建时间
	ConnTimeout              any // 连接超时时间
	ReadTimeout              any // 读取超时时间
	IdleTimeout              any // 空闲超时时间
	MaxConns                 any // 最大并发连接数
	MaxIdleConns             any // 最大空闲连接数
	ProxyProtocol            any // Proxy Protocol配置
	FollowRedirects          any // 回源跟随
	Retry50X                 any // 启用50X重试
	Retry40X                 any // 启用40X重试
}

func NewReverseProxyOperator

func NewReverseProxyOperator() *ReverseProxyOperator

type SSLCert

type SSLCert struct {
	Id                 uint32   `field:"id"`                 // ID
	AdminId            uint32   `field:"adminId"`            // 管理员ID
	UserId             uint32   `field:"userId"`             // 用户ID
	State              uint8    `field:"state"`              // 状态
	CreatedAt          uint64   `field:"createdAt"`          // 创建时间
	UpdatedAt          uint64   `field:"updatedAt"`          // 修改时间
	IsOn               bool     `field:"isOn"`               // 是否启用
	Name               string   `field:"name"`               // 证书名
	Description        string   `field:"description"`        // 描述
	CertData           []byte   `field:"certData"`           // 证书内容
	KeyData            []byte   `field:"keyData"`            // 密钥内容
	ServerName         string   `field:"serverName"`         // 证书使用的主机名
	IsCA               bool     `field:"isCA"`               // 是否为CA证书
	GroupIds           dbs.JSON `field:"groupIds"`           // 证书分组
	TimeBeginAt        uint64   `field:"timeBeginAt"`        // 开始时间
	TimeEndAt          uint64   `field:"timeEndAt"`          // 结束时间
	DnsNames           dbs.JSON `field:"dnsNames"`           // DNS名称列表
	CommonNames        dbs.JSON `field:"commonNames"`        // 发行单位列表
	IsACME             bool     `field:"isACME"`             // 是否为ACME自动生成的
	AcmeTaskId         uint64   `field:"acmeTaskId"`         // ACME任务ID
	NotifiedAt         uint64   `field:"notifiedAt"`         // 最后通知时间
	Ocsp               []byte   `field:"ocsp"`               // OCSP缓存
	OcspIsUpdated      uint8    `field:"ocspIsUpdated"`      // OCSP是否已更新
	OcspUpdatedAt      uint64   `field:"ocspUpdatedAt"`      // OCSP更新时间
	OcspError          string   `field:"ocspError"`          // OCSP更新错误
	OcspUpdatedVersion uint64   `field:"ocspUpdatedVersion"` // OCSP更新版本
	OcspExpiresAt      uint64   `field:"ocspExpiresAt"`      // OCSP过期时间(UTC)
	OcspTries          uint32   `field:"ocspTries"`          // OCSP尝试次数
}

SSLCert SSL证书

func (*SSLCert) DecodeCommonNames

func (this *SSLCert) DecodeCommonNames() []string

func (*SSLCert) DecodeDNSNames

func (this *SSLCert) DecodeDNSNames() []string

type SSLCertDAO

type SSLCertDAO dbs.DAO
var SharedSSLCertDAO *SSLCertDAO

func NewSSLCertDAO

func NewSSLCertDAO() *SSLCertDAO

func (*SSLCertDAO) CheckUserCert

func (this *SSLCertDAO) CheckUserCert(tx *dbs.Tx, certId int64, userId int64) error

CheckUserCert 检查用户权限

func (*SSLCertDAO) ComposeCertConfig

func (this *SSLCertDAO) ComposeCertConfig(tx *dbs.Tx, certId int64, ignoreData bool, dataMap *shared.DataMap, cacheMap *utils.CacheMap) (*sslconfigs.SSLCertConfig, error)

ComposeCertConfig 组合配置 ignoreData 是否忽略证书数据,避免因为数据过大影响传输

func (*SSLCertDAO) CountAllSSLCertsWithOCSPError

func (this *SSLCertDAO) CountAllSSLCertsWithOCSPError(tx *dbs.Tx, keyword string) (int64, error)

CountAllSSLCertsWithOCSPError 计算有OCSP错误的证书数量

func (*SSLCertDAO) CountCerts

func (this *SSLCertDAO) CountCerts(tx *dbs.Tx, isCA bool, isAvailable bool, isExpired bool, expiringDays int64, keyword string, userId int64, domains []string, userOnly bool) (int64, error)

CountCerts 计算符合条件的证书数量

func (*SSLCertDAO) CreateCert

func (this *SSLCertDAO) CreateCert(tx *dbs.Tx, adminId int64, userId int64, isOn bool, name string, description string, serverName string, isCA bool, certData []byte, keyData []byte, timeBeginAt int64, timeEndAt int64, dnsNames []string, commonNames []string) (int64, error)

CreateCert 创建证书

func (*SSLCertDAO) DisableSSLCert

func (this *SSLCertDAO) DisableSSLCert(tx *dbs.Tx, certId int64) error

DisableSSLCert 禁用条目

func (*SSLCertDAO) EnableSSLCert

func (this *SSLCertDAO) EnableSSLCert(tx *dbs.Tx, id int64) error

EnableSSLCert 启用条目

func (*SSLCertDAO) FindAllExpiringCerts

func (this *SSLCertDAO) FindAllExpiringCerts(tx *dbs.Tx, days int) (result []*SSLCert, err error)

FindAllExpiringCerts 查找需要自动更新的任务 这里我们只返回有限的字段以节省内存

func (*SSLCertDAO) FindCertOCSPLatestVersion

func (this *SSLCertDAO) FindCertOCSPLatestVersion(tx *dbs.Tx) (int64, error)

FindCertOCSPLatestVersion 获取OCSP最新版本

func (*SSLCertDAO) FindCertUserId added in v1.2.10

func (this *SSLCertDAO) FindCertUserId(tx *dbs.Tx, certId int64) (userId int64, err error)

FindCertUserId 查找证书所属用户ID

func (*SSLCertDAO) FindEnabledSSLCert

func (this *SSLCertDAO) FindEnabledSSLCert(tx *dbs.Tx, id int64) (*SSLCert, error)

FindEnabledSSLCert 查找启用中的条目

func (*SSLCertDAO) FindSSLCertName

func (this *SSLCertDAO) FindSSLCertName(tx *dbs.Tx, id int64) (string, error)

FindSSLCertName 根据主键查找名称

func (*SSLCertDAO) IgnoreSSLCertsWithOCSPError

func (this *SSLCertDAO) IgnoreSSLCertsWithOCSPError(tx *dbs.Tx, certIds []int64) error

IgnoreSSLCertsWithOCSPError 忽略一组OCSP证书错误

func (*SSLCertDAO) Init

func (this *SSLCertDAO) Init()

Init 初始化

func (*SSLCertDAO) ListCertIds

func (this *SSLCertDAO) ListCertIds(tx *dbs.Tx, isCA bool, isAvailable bool, isExpired bool, expiringDays int64, keyword string, userId int64, domains []string, userOnly bool, offset int64, size int64) (certIds []int64, err error)

ListCertIds 列出符合条件的证书

func (*SSLCertDAO) ListCertOCSPAfterVersion

func (this *SSLCertDAO) ListCertOCSPAfterVersion(tx *dbs.Tx, version int64, size int64) (result []*SSLCert, err error)

ListCertOCSPAfterVersion 列出某个版本后的OCSP

func (*SSLCertDAO) ListCertsToUpdateOCSP

func (this *SSLCertDAO) ListCertsToUpdateOCSP(tx *dbs.Tx, maxTries int, size int64) (result []*SSLCert, err error)

ListCertsToUpdateOCSP 查找需要更新OCSP的证书

func (*SSLCertDAO) ListSSLCertsWithOCSPError

func (this *SSLCertDAO) ListSSLCertsWithOCSPError(tx *dbs.Tx, keyword string, offset int64, size int64) (result []*SSLCert, err error)

ListSSLCertsWithOCSPError 列出有OCSP错误的证书

func (*SSLCertDAO) NotifyUpdate

func (this *SSLCertDAO) NotifyUpdate(tx *dbs.Tx, certId int64) error

NotifyUpdate 通知更新

func (*SSLCertDAO) PrepareCertOCSPUpdating

func (this *SSLCertDAO) PrepareCertOCSPUpdating(tx *dbs.Tx, certId int64) error

PrepareCertOCSPUpdating 更新OCSP更新时间,以便于准备更新,相当于锁定

func (*SSLCertDAO) ResetAllSSLCertsWithOCSPError

func (this *SSLCertDAO) ResetAllSSLCertsWithOCSPError(tx *dbs.Tx) error

ResetAllSSLCertsWithOCSPError 重置所有证书OCSP错误状态

func (*SSLCertDAO) ResetSSLCertsWithOCSPError

func (this *SSLCertDAO) ResetSSLCertsWithOCSPError(tx *dbs.Tx, certIds []int64) error

ResetSSLCertsWithOCSPError 重置一组证书OCSP错误状态

func (*SSLCertDAO) UpdateCert

func (this *SSLCertDAO) UpdateCert(tx *dbs.Tx,
	certId int64,
	isOn bool,
	name string,
	description string,
	serverName string,
	isCA bool,
	certData []byte,
	keyData []byte,
	timeBeginAt int64,
	timeEndAt int64,
	dnsNames []string, commonNames []string) error

UpdateCert 修改证书

func (*SSLCertDAO) UpdateCertACME

func (this *SSLCertDAO) UpdateCertACME(tx *dbs.Tx, certId int64, acmeTaskId int64) error

UpdateCertACME 设置证书的ACME信息

func (*SSLCertDAO) UpdateCertNotifiedAt

func (this *SSLCertDAO) UpdateCertNotifiedAt(tx *dbs.Tx, certId int64) error

UpdateCertNotifiedAt 设置当前证书事件通知时间

func (*SSLCertDAO) UpdateCertOCSP

func (this *SSLCertDAO) UpdateCertOCSP(tx *dbs.Tx, certId int64, ocsp []byte, expiresAt int64, hasErr bool, errString string) error

UpdateCertOCSP 修改OCSP

func (*SSLCertDAO) UpdateCertUser added in v0.6.0

func (this *SSLCertDAO) UpdateCertUser(tx *dbs.Tx, certId int64, userId int64) error

UpdateCertUser 修改证书所属用户

type SSLCertGroup

type SSLCertGroup struct {
	Id        uint32 `field:"id"`        // ID
	AdminId   uint32 `field:"adminId"`   // 管理员ID
	UserId    uint32 `field:"userId"`    // 用户ID
	Name      string `field:"name"`      // 分组名
	Order     uint32 `field:"order"`     // 分组排序
	State     uint8  `field:"state"`     // 状态
	CreatedAt uint64 `field:"createdAt"` // 创建时间
}

type SSLCertGroupDAO

type SSLCertGroupDAO dbs.DAO
var SharedSSLCertGroupDAO *SSLCertGroupDAO

func NewSSLCertGroupDAO

func NewSSLCertGroupDAO() *SSLCertGroupDAO

func (*SSLCertGroupDAO) DisableSSLCertGroup

func (this *SSLCertGroupDAO) DisableSSLCertGroup(tx *dbs.Tx, id uint32) error

禁用条目

func (*SSLCertGroupDAO) EnableSSLCertGroup

func (this *SSLCertGroupDAO) EnableSSLCertGroup(tx *dbs.Tx, id uint32) error

启用条目

func (*SSLCertGroupDAO) FindEnabledSSLCertGroup

func (this *SSLCertGroupDAO) FindEnabledSSLCertGroup(tx *dbs.Tx, id uint32) (*SSLCertGroup, error)

查找启用中的条目

func (*SSLCertGroupDAO) FindSSLCertGroupName

func (this *SSLCertGroupDAO) FindSSLCertGroupName(tx *dbs.Tx, id uint32) (string, error)

根据主键查找名称

type SSLCertGroupOperator

type SSLCertGroupOperator struct {
	Id        interface{} // ID
	AdminId   interface{} // 管理员ID
	UserId    interface{} // 用户ID
	Name      interface{} // 分组名
	Order     interface{} // 分组排序
	State     interface{} // 状态
	CreatedAt interface{} // 创建时间
}

func NewSSLCertGroupOperator

func NewSSLCertGroupOperator() *SSLCertGroupOperator

type SSLCertOperator

type SSLCertOperator struct {
	Id                 interface{} // ID
	AdminId            interface{} // 管理员ID
	UserId             interface{} // 用户ID
	State              interface{} // 状态
	CreatedAt          interface{} // 创建时间
	UpdatedAt          interface{} // 修改时间
	IsOn               interface{} // 是否启用
	Name               interface{} // 证书名
	Description        interface{} // 描述
	CertData           interface{} // 证书内容
	KeyData            interface{} // 密钥内容
	ServerName         interface{} // 证书使用的主机名
	IsCA               interface{} // 是否为CA证书
	GroupIds           interface{} // 证书分组
	TimeBeginAt        interface{} // 开始时间
	TimeEndAt          interface{} // 结束时间
	DnsNames           interface{} // DNS名称列表
	CommonNames        interface{} // 发行单位列表
	IsACME             interface{} // 是否为ACME自动生成的
	AcmeTaskId         interface{} // ACME任务ID
	NotifiedAt         interface{} // 最后通知时间
	Ocsp               interface{} // OCSP缓存
	OcspIsUpdated      interface{} // OCSP是否已更新
	OcspUpdatedAt      interface{} // OCSP更新时间
	OcspError          interface{} // OCSP更新错误
	OcspUpdatedVersion interface{} // OCSP更新版本
	OcspExpiresAt      interface{} // OCSP过期时间(UTC)
	OcspTries          interface{} // OCSP尝试次数
}

func NewSSLCertOperator

func NewSSLCertOperator() *SSLCertOperator

type SSLPolicy

type SSLPolicy struct {
	Id               uint32   `field:"id"`               // ID
	AdminId          uint32   `field:"adminId"`          // 管理员ID
	UserId           uint32   `field:"userId"`           // 用户ID
	IsOn             bool     `field:"isOn"`             // 是否启用
	Certs            dbs.JSON `field:"certs"`            // 证书列表
	ClientCACerts    dbs.JSON `field:"clientCACerts"`    // 客户端证书
	ClientAuthType   uint32   `field:"clientAuthType"`   // 客户端认证类型
	MinVersion       string   `field:"minVersion"`       // 支持的SSL最小版本
	CipherSuitesIsOn uint8    `field:"cipherSuitesIsOn"` // 是否自定义加密算法套件
	CipherSuites     dbs.JSON `field:"cipherSuites"`     // 加密算法套件
	Hsts             dbs.JSON `field:"hsts"`             // HSTS设置
	Http2Enabled     bool     `field:"http2Enabled"`     // 是否启用HTTP/2
	Http3Enabled     bool     `field:"http3Enabled"`     // 是否启用HTTP/3
	OcspIsOn         uint8    `field:"ocspIsOn"`         // 是否启用OCSP
	State            uint8    `field:"state"`            // 状态
	CreatedAt        uint64   `field:"createdAt"`        // 创建时间
}

SSLPolicy SSL配置策略

func (*SSLPolicy) DecodeCerts added in v0.6.0

func (this *SSLPolicy) DecodeCerts() []*sslconfigs.SSLCertRef

type SSLPolicyDAO

type SSLPolicyDAO dbs.DAO
var SharedSSLPolicyDAO *SSLPolicyDAO

func NewSSLPolicyDAO

func NewSSLPolicyDAO() *SSLPolicyDAO

func (*SSLPolicyDAO) CheckUserPolicy

func (this *SSLPolicyDAO) CheckUserPolicy(tx *dbs.Tx, userId int64, policyId int64) error

CheckUserPolicy 检查是否为用户所属策略

func (*SSLPolicyDAO) ComposePolicyConfig

func (this *SSLPolicyDAO) ComposePolicyConfig(tx *dbs.Tx, policyId int64, ignoreData bool, dataMap *shared.DataMap, cacheMap *utils.CacheMap) (*sslconfigs.SSLPolicy, error)

ComposePolicyConfig 组合配置

func (*SSLPolicyDAO) CreatePolicy

func (this *SSLPolicyDAO) CreatePolicy(tx *dbs.Tx, adminId int64, userId int64, http2Enabled bool, http3Enabled bool, minVersion string, certsJSON []byte, hstsJSON []byte, ocspIsOn bool, clientAuthType int32, clientCACertsJSON []byte, cipherSuitesIsOn bool, cipherSuites []string) (int64, error)

CreatePolicy 创建Policy

func (*SSLPolicyDAO) DisableSSLPolicy

func (this *SSLPolicyDAO) DisableSSLPolicy(tx *dbs.Tx, policyId int64) error

DisableSSLPolicy 禁用条目

func (*SSLPolicyDAO) EnableSSLPolicy

func (this *SSLPolicyDAO) EnableSSLPolicy(tx *dbs.Tx, id int64) error

EnableSSLPolicy 启用条目

func (*SSLPolicyDAO) FindAllEnabledPolicyIdsWithCertId

func (this *SSLPolicyDAO) FindAllEnabledPolicyIdsWithCertId(tx *dbs.Tx, certId int64) (policyIds []int64, err error)

FindAllEnabledPolicyIdsWithCertId 查询使用单个证书的所有策略ID

func (*SSLPolicyDAO) FindEnabledSSLPolicy

func (this *SSLPolicyDAO) FindEnabledSSLPolicy(tx *dbs.Tx, id int64) (*SSLPolicy, error)

FindEnabledSSLPolicy 查找启用中的条目

func (*SSLPolicyDAO) Init

func (this *SSLPolicyDAO) Init()

Init 初始化

func (*SSLPolicyDAO) NotifyUpdate

func (this *SSLPolicyDAO) NotifyUpdate(tx *dbs.Tx, policyId int64) error

NotifyUpdate 通知更新

func (*SSLPolicyDAO) UpdatePolicy

func (this *SSLPolicyDAO) UpdatePolicy(tx *dbs.Tx, policyId int64, http2Enabled bool, http3Enabled bool, minVersion string, certsJSON []byte, hstsJSON []byte, ocspIsOn bool, clientAuthType int32, clientCACertsJSON []byte, cipherSuitesIsOn bool, cipherSuites []string) error

UpdatePolicy 修改Policy

func (*SSLPolicyDAO) UpdatePolicyUser added in v0.6.0

func (this *SSLPolicyDAO) UpdatePolicyUser(tx *dbs.Tx, policyId int64, userId int64) error

UpdatePolicyUser 修改策略所属用户

type SSLPolicyOperator

type SSLPolicyOperator struct {
	Id               any // ID
	AdminId          any // 管理员ID
	UserId           any // 用户ID
	IsOn             any // 是否启用
	Certs            any // 证书列表
	ClientCACerts    any // 客户端证书
	ClientAuthType   any // 客户端认证类型
	MinVersion       any // 支持的SSL最小版本
	CipherSuitesIsOn any // 是否自定义加密算法套件
	CipherSuites     any // 加密算法套件
	Hsts             any // HSTS设置
	Http2Enabled     any // 是否启用HTTP/2
	Http3Enabled     any // 是否启用HTTP/3
	OcspIsOn         any // 是否启用OCSP
	State            any // 状态
	CreatedAt        any // 创建时间
}

func NewSSLPolicyOperator

func NewSSLPolicyOperator() *SSLPolicyOperator

type Script

type Script struct {
	Id        uint64 `field:"id"`        // ID
	UserId    uint64 `field:"userId"`    // 用户ID
	IsOn      bool   `field:"isOn"`      // 是否启用
	Name      string `field:"name"`      // 名称
	Filename  string `field:"filename"`  // 文件名
	Code      string `field:"code"`      // 代码
	CreatedAt uint64 `field:"createdAt"` // 创建时间
	UpdatedAt uint64 `field:"updatedAt"` // 修改时间
	State     uint8  `field:"state"`     // 是否启用
}

Script 脚本库

type ScriptHistory

type ScriptHistory struct {
	Id       uint32 `field:"id"`       // ID
	UserId   uint64 `field:"userId"`   // 用户ID
	ScriptId uint64 `field:"scriptId"` // 脚本ID
	Filename string `field:"filename"` // 文件名
	Code     string `field:"code"`     // 代码
	Version  uint64 `field:"version"`  // 版本号
}

ScriptHistory 脚本历史记录

type ScriptHistoryOperator

type ScriptHistoryOperator struct {
	Id       interface{} // ID
	UserId   interface{} // 用户ID
	ScriptId interface{} // 脚本ID
	Filename interface{} // 文件名
	Code     interface{} // 代码
	Version  interface{} // 版本号
}

func NewScriptHistoryOperator

func NewScriptHistoryOperator() *ScriptHistoryOperator

type ScriptOperator

type ScriptOperator struct {
	Id        interface{} // ID
	UserId    interface{} // 用户ID
	IsOn      interface{} // 是否启用
	Name      interface{} // 名称
	Filename  interface{} // 文件名
	Code      interface{} // 代码
	CreatedAt interface{} // 创建时间
	UpdatedAt interface{} // 修改时间
	State     interface{} // 是否启用
}

func NewScriptOperator

func NewScriptOperator() *ScriptOperator

type Server

type Server struct {
	Id                  uint32   `field:"id"`                  // ID
	IsOn                bool     `field:"isOn"`                // 是否启用
	UserId              uint32   `field:"userId"`              // 用户ID
	AdminId             uint32   `field:"adminId"`             // 管理员ID
	Type                string   `field:"type"`                // 服务类型
	Name                string   `field:"name"`                // 名称
	Description         string   `field:"description"`         // 描述
	PlainServerNames    dbs.JSON `field:"plainServerNames"`    // 扁平化域名列表
	ServerNames         dbs.JSON `field:"serverNames"`         // 域名列表
	AuditingAt          uint64   `field:"auditingAt"`          // 审核提交时间
	AuditingServerNames dbs.JSON `field:"auditingServerNames"` // 审核中的域名
	IsAuditing          bool     `field:"isAuditing"`          // 是否正在审核
	AuditingResult      dbs.JSON `field:"auditingResult"`      // 审核结果
	Http                dbs.JSON `field:"http"`                // HTTP配置
	Https               dbs.JSON `field:"https"`               // HTTPS配置
	Tcp                 dbs.JSON `field:"tcp"`                 // TCP配置
	Tls                 dbs.JSON `field:"tls"`                 // TLS配置
	Unix                dbs.JSON `field:"unix"`                // Unix配置
	Udp                 dbs.JSON `field:"udp"`                 // UDP配置
	WebId               uint32   `field:"webId"`               // WEB配置
	ReverseProxy        dbs.JSON `field:"reverseProxy"`        // 反向代理配置
	GroupIds            dbs.JSON `field:"groupIds"`            // 分组ID列表
	Config              dbs.JSON `field:"config"`              // 服务配置,自动生成
	ConfigMd5           string   `field:"configMd5"`           // Md5
	ClusterId           uint32   `field:"clusterId"`           // 集群ID
	IncludeNodes        dbs.JSON `field:"includeNodes"`        // 部署条件
	ExcludeNodes        dbs.JSON `field:"excludeNodes"`        // 节点排除条件
	Version             uint32   `field:"version"`             // 版本号
	CreatedAt           uint64   `field:"createdAt"`           // 创建时间
	State               uint8    `field:"state"`               // 状态
	DnsName             string   `field:"dnsName"`             // DNS名称
	TcpPorts            dbs.JSON `field:"tcpPorts"`            // 所包含TCP端口
	UdpPorts            dbs.JSON `field:"udpPorts"`            // 所包含UDP端口
	SupportCNAME        uint8    `field:"supportCNAME"`        // 允许CNAME不在域名名单
	TrafficLimit        dbs.JSON `field:"trafficLimit"`        // 流量限制
	TrafficDay          string   `field:"trafficDay"`          // YYYYMMDD
	TrafficMonth        string   `field:"trafficMonth"`        // YYYYMM
	TotalDailyTraffic   float64  `field:"totalDailyTraffic"`   // 日流量
	TotalMonthlyTraffic float64  `field:"totalMonthlyTraffic"` // 月流量
	TrafficLimitStatus  dbs.JSON `field:"trafficLimitStatus"`  // 流量限制状态
	TotalTraffic        float64  `field:"totalTraffic"`        // 总流量
	UserPlanId          uint32   `field:"userPlanId"`          // 所属套餐ID
	LastUserPlanId      uint32   `field:"lastUserPlanId"`      // 上一次使用的套餐
	Uam                 dbs.JSON `field:"uam"`                 // UAM设置
	BandwidthTime       string   `field:"bandwidthTime"`       // 带宽更新时间,YYYYMMDDHHII
	BandwidthBytes      uint64   `field:"bandwidthBytes"`      // 最近带宽峰值
	CountAttackRequests uint64   `field:"countAttackRequests"` // 最近攻击请求数
	CountRequests       uint64   `field:"countRequests"`       // 最近总请求数
}

Server 服务

func (*Server) DecodeGroupIds

func (this *Server) DecodeGroupIds() []int64

DecodeGroupIds 解析服务所属分组ID

func (*Server) DecodeHTTPPorts

func (this *Server) DecodeHTTPPorts() (ports []int)

DecodeHTTPPorts 获取HTTP所有端口

func (*Server) DecodeHTTPS added in v0.6.0

func (this *Server) DecodeHTTPS() *serverconfigs.HTTPSProtocolConfig

DecodeHTTPS 解析HTTPS设置

func (*Server) DecodeHTTPSPorts

func (this *Server) DecodeHTTPSPorts() (ports []int)

DecodeHTTPSPorts 获取HTTPS所有端口

func (*Server) DecodeServerNames added in v0.5.6

func (this *Server) DecodeServerNames() (serverNames []*serverconfigs.ServerNameConfig, count int)

DecodeServerNames 获取域名

func (*Server) DecodeTCPPorts

func (this *Server) DecodeTCPPorts() (ports []int)

DecodeTCPPorts 获取TCP所有端口

func (*Server) DecodeTLS added in v0.6.0

func (this *Server) DecodeTLS() *serverconfigs.TLSProtocolConfig

DecodeTLS 解析TLS设置

func (*Server) DecodeTLSPorts

func (this *Server) DecodeTLSPorts() (ports []int)

DecodeTLSPorts 获取TLS所有端口

func (*Server) DecodeUDPPorts

func (this *Server) DecodeUDPPorts() (ports []int)

DecodeUDPPorts 获取UDP所有端口

func (*Server) FirstServerName added in v0.5.6

func (this *Server) FirstServerName() string

FirstServerName 获取第一个域名

type ServerBandwidthStat added in v0.4.9

type ServerBandwidthStat struct {
	Id                  uint64 `field:"id"`                  // ID
	UserId              uint64 `field:"userId"`              // 用户ID
	ServerId            uint64 `field:"serverId"`            // 服务ID
	RegionId            uint32 `field:"regionId"`            // 区域ID
	UserPlanId          uint64 `field:"userPlanId"`          // 用户套餐ID
	Day                 string `field:"day"`                 // 日期YYYYMMDD
	TimeAt              string `field:"timeAt"`              // 时间点HHMM
	Bytes               uint64 `field:"bytes"`               // 带宽字节
	AvgBytes            uint64 `field:"avgBytes"`            // 平均流量
	CachedBytes         uint64 `field:"cachedBytes"`         // 缓存的流量
	AttackBytes         uint64 `field:"attackBytes"`         // 攻击流量
	CountRequests       uint64 `field:"countRequests"`       // 请求数
	CountCachedRequests uint64 `field:"countCachedRequests"` // 缓存的请求数
	CountAttackRequests uint64 `field:"countAttackRequests"` // 攻击请求数
	TotalBytes          uint64 `field:"totalBytes"`          // 总流量
}

ServerBandwidthStat 服务峰值带宽统计

type ServerBandwidthStatDAO added in v0.4.9

type ServerBandwidthStatDAO dbs.DAO
var SharedServerBandwidthStatDAO *ServerBandwidthStatDAO

func NewServerBandwidthStatDAO added in v0.4.9

func NewServerBandwidthStatDAO() *ServerBandwidthStatDAO

func (*ServerBandwidthStatDAO) CleanDays added in v1.2.1

func (this *ServerBandwidthStatDAO) CleanDays(tx *dbs.Tx, days int) error

CleanDays 清理过期数据

func (*ServerBandwidthStatDAO) CleanDefaultDays added in v1.2.1

func (this *ServerBandwidthStatDAO) CleanDefaultDays(tx *dbs.Tx, defaultDays int) error

func (*ServerBandwidthStatDAO) CountPartitions added in v1.2.9

func (this *ServerBandwidthStatDAO) CountPartitions() int

CountPartitions 查看分区数量

func (*ServerBandwidthStatDAO) FindAllServerStatsWithDay added in v0.5.0

func (this *ServerBandwidthStatDAO) FindAllServerStatsWithDay(tx *dbs.Tx, serverId int64, day string, useAvg bool) (result []*ServerBandwidthStat, err error)

FindAllServerStatsWithDay 查找某个服务的当天的所有带宽峰值 day YYYYMMDD

func (*ServerBandwidthStatDAO) FindAllServerStatsWithMonth added in v0.5.0

func (this *ServerBandwidthStatDAO) FindAllServerStatsWithMonth(tx *dbs.Tx, serverId int64, month string, useAvg bool) (result []*ServerBandwidthStat, err error)

FindAllServerStatsWithMonth 查找某个服务的当月的所有带宽峰值 month YYYYMM

func (*ServerBandwidthStatDAO) FindBandwidthStatsBetweenDays added in v0.5.6

func (this *ServerBandwidthStatDAO) FindBandwidthStatsBetweenDays(tx *dbs.Tx, serverId int64, dayFrom string, dayTo string, useAvg bool) (result []*pb.FindDailyServerBandwidthStatsBetweenDaysResponse_Stat, err error)

FindBandwidthStatsBetweenDays 查找日期段内的带宽峰值 dayFrom YYYYMMDD dayTo YYYYMMDD

func (*ServerBandwidthStatDAO) FindDailyBandwidthStats added in v0.5.2

func (this *ServerBandwidthStatDAO) FindDailyBandwidthStats(tx *dbs.Tx, serverId int64, days int32, useAvg bool) (result []*pb.FindDailyServerBandwidthStatsResponse_Stat, err error)

FindDailyBandwidthStats 按天获取带宽峰值

func (*ServerBandwidthStatDAO) FindDailyPeekBandwidthBytes added in v0.4.9

func (this *ServerBandwidthStatDAO) FindDailyPeekBandwidthBytes(tx *dbs.Tx, serverId int64, day string, useAvg bool) (int64, error)

FindDailyPeekBandwidthBytes 获取某天的带宽峰值 day YYYYMMDD

func (*ServerBandwidthStatDAO) FindDailyStats added in v1.0.0

func (this *ServerBandwidthStatDAO) FindDailyStats(tx *dbs.Tx, serverId int64, dayFrom string, dayTo string) (result []*ServerBandwidthStat, err error)

FindDailyStats 按天统计

func (*ServerBandwidthStatDAO) FindDistinctServerIdsWithoutPlanAtPartition added in v1.2.9

func (this *ServerBandwidthStatDAO) FindDistinctServerIdsWithoutPlanAtPartition(tx *dbs.Tx, partitionIndex int, month string) (serverIds []int64, err error)

FindDistinctServerIdsWithoutPlanAtPartition 查找没有绑定套餐的有流量网站

func (*ServerBandwidthStatDAO) FindHourlyBandwidthStats added in v0.5.2

func (this *ServerBandwidthStatDAO) FindHourlyBandwidthStats(tx *dbs.Tx, serverId int64, hours int32, useAvg bool) (result []*pb.FindHourlyServerBandwidthStatsResponse_Stat, err error)

FindHourlyBandwidthStats 按小时获取带宽峰值

func (*ServerBandwidthStatDAO) FindHourlyStats added in v1.0.0

func (this *ServerBandwidthStatDAO) FindHourlyStats(tx *dbs.Tx, serverId int64, hourFrom string, hourTo string) (result []*ServerBandwidthStat, err error)

FindHourlyStats 按小时统计

func (*ServerBandwidthStatDAO) FindMinutelyPeekBandwidthBytes added in v0.4.9

func (this *ServerBandwidthStatDAO) FindMinutelyPeekBandwidthBytes(tx *dbs.Tx, serverId int64, day string, minute string, useAvg bool) (int64, error)

FindMinutelyPeekBandwidthBytes 获取某分钟的带宽峰值 day YYYYMMDD minute HHII

func (*ServerBandwidthStatDAO) FindMonthlyPeekBandwidthBytes added in v0.4.9

func (this *ServerBandwidthStatDAO) FindMonthlyPeekBandwidthBytes(tx *dbs.Tx, serverId int64, month string, useAvg bool) (int64, error)

FindMonthlyPeekBandwidthBytes 获取某月的带宽峰值 month YYYYMM

func (*ServerBandwidthStatDAO) FindMonthlyPercentile added in v0.4.9

func (this *ServerBandwidthStatDAO) FindMonthlyPercentile(tx *dbs.Tx, serverId int64, month string, percentile int, useAvg bool, noPlan bool, minSamples int) (result int64, err error)

FindMonthlyPercentile 获取某月内百分位

func (*ServerBandwidthStatDAO) FindPercentileBetweenDays added in v0.5.6

func (this *ServerBandwidthStatDAO) FindPercentileBetweenDays(tx *dbs.Tx, serverId int64, dayFrom string, dayTo string, percentile int32, useAvg bool) (result *ServerBandwidthStat, err error)

FindPercentileBetweenDays 获取日期段内内百分位

func (*ServerBandwidthStatDAO) FindPercentileBetweenTimes added in v0.5.8

func (this *ServerBandwidthStatDAO) FindPercentileBetweenTimes(tx *dbs.Tx, serverId int64, timeFrom string, timeTo string, percentile int32, useAvg bool) (result *ServerBandwidthStat, err error)

FindPercentileBetweenTimes 获取时间段内内百分位 timeFrom 开始时间,格式 YYYYMMDDHHII timeTo 结束时间,格式 YYYYMMDDHHII

func (*ServerBandwidthStatDAO) FindServerStats added in v0.4.9

func (this *ServerBandwidthStatDAO) FindServerStats(tx *dbs.Tx, serverId int64, day string, timeFrom string, timeTo string, useAvg bool) (result []*ServerBandwidthStat, err error)

FindServerStats 查找某个时间段的带宽统计 参数:

  • day YYYYMMDD
  • timeAt HHII

func (*ServerBandwidthStatDAO) HasFullData added in v1.0.0

func (this *ServerBandwidthStatDAO) HasFullData(tx *dbs.Tx, serverId int64, month string) (bool, error)

HasFullData 检查一个月是否完整数据 是为了兼容以前数据,以前的表中没有缓存流量、请求数等字段

func (*ServerBandwidthStatDAO) SumDailyStat added in v1.0.0

func (this *ServerBandwidthStatDAO) SumDailyStat(tx *dbs.Tx, serverId int64, regionId int64, dayFrom string, dayTo string) (stat *pb.ServerDailyStat, err error)

SumDailyStat 获取某天内的流量 dayFrom 格式为YYYYMMDD dayTo 格式为YYYYMMDD

func (*ServerBandwidthStatDAO) SumMonthlyBytes added in v1.2.9

func (this *ServerBandwidthStatDAO) SumMonthlyBytes(tx *dbs.Tx, serverId int64, month string, noPlan bool) (int64, error)

SumMonthlyBytes 统计某个网站单月总流量

func (*ServerBandwidthStatDAO) SumServerMonthlyWithRegion added in v1.2.9

func (this *ServerBandwidthStatDAO) SumServerMonthlyWithRegion(tx *dbs.Tx, serverId int64, regionId int64, month string, noPlan bool) (int64, error)

SumServerMonthlyWithRegion 根据服务计算某月合计 month 格式为YYYYMM

func (*ServerBandwidthStatDAO) UpdateServerBandwidth added in v0.4.9

func (this *ServerBandwidthStatDAO) UpdateServerBandwidth(tx *dbs.Tx, userId int64, serverId int64, regionId int64, userPlanId int64, day string, timeAt string, bandwidthBytes int64, totalBytes int64, cachedBytes int64, attackBytes int64, countRequests int64, countCachedRequests int64, countAttackRequests int64) error

UpdateServerBandwidth 写入数据 现在不需要把 userPlanId 加入到数据表unique key中,因为只会影响5分钟统计,影响非常有限

type ServerBandwidthStatOperator added in v0.4.9

type ServerBandwidthStatOperator struct {
	Id                  any // ID
	UserId              any // 用户ID
	ServerId            any // 服务ID
	RegionId            any // 区域ID
	UserPlanId          any // 用户套餐ID
	Day                 any // 日期YYYYMMDD
	TimeAt              any // 时间点HHMM
	Bytes               any // 带宽字节
	AvgBytes            any // 平均流量
	CachedBytes         any // 缓存的流量
	AttackBytes         any // 攻击流量
	CountRequests       any // 请求数
	CountCachedRequests any // 缓存的请求数
	CountAttackRequests any // 攻击请求数
	TotalBytes          any // 总流量
}

func NewServerBandwidthStatOperator added in v0.4.9

func NewServerBandwidthStatOperator() *ServerBandwidthStatOperator

type ServerBill

type ServerBill struct {
	Id                       uint64  `field:"id"`                       // ID
	UserId                   uint32  `field:"userId"`                   // 用户ID
	ServerId                 uint32  `field:"serverId"`                 // 服务ID
	Amount                   float64 `field:"amount"`                   // 金额
	Month                    string  `field:"month"`                    // 月份
	CreatedAt                uint64  `field:"createdAt"`                // 创建时间
	UserPlanId               uint32  `field:"userPlanId"`               // 用户套餐ID
	PlanId                   uint32  `field:"planId"`                   // 套餐ID
	TotalTrafficBytes        uint64  `field:"totalTrafficBytes"`        // 总流量
	BandwidthPercentileBytes uint64  `field:"bandwidthPercentileBytes"` // 带宽百分位字节
	BandwidthPercentile      uint8   `field:"bandwidthPercentile"`      // 带宽百分位
	PriceType                string  `field:"priceType"`                // 计费类型
}

ServerBill 服务账单

type ServerBillDAO

type ServerBillDAO dbs.DAO
var SharedServerBillDAO *ServerBillDAO

func NewServerBillDAO

func NewServerBillDAO() *ServerBillDAO

func (*ServerBillDAO) CountServerBills

func (this *ServerBillDAO) CountServerBills(tx *dbs.Tx, userId int64, month string) (int64, error)

CountServerBills 计算总账单数量

func (*ServerBillDAO) CreateOrUpdateServerBill

func (this *ServerBillDAO) CreateOrUpdateServerBill(tx *dbs.Tx,
	userId int64,
	serverId int64,
	month string,
	userPlanId int64,
	planId int64,
	totalTrafficBytes int64,
	bandwidthPercentileBytes int64,
	bandwidthPercentile int,
	priceType string,
	fee float64) error

CreateOrUpdateServerBill 创建账单

func (*ServerBillDAO) ListServerBills

func (this *ServerBillDAO) ListServerBills(tx *dbs.Tx, userId int64, month string, offset int64, size int64) (result []*ServerBill, err error)

ListServerBills 列出单页账单

func (*ServerBillDAO) SumUserMonthlyAmount

func (this *ServerBillDAO) SumUserMonthlyAmount(tx *dbs.Tx, userId int64, month string) (float64, error)

SumUserMonthlyAmount 计算总费用

type ServerBillOperator

type ServerBillOperator struct {
	Id                       interface{} // ID
	UserId                   interface{} // 用户ID
	ServerId                 interface{} // 服务ID
	Amount                   interface{} // 金额
	Month                    interface{} // 月份
	CreatedAt                interface{} // 创建时间
	UserPlanId               interface{} // 用户套餐ID
	PlanId                   interface{} // 套餐ID
	TotalTrafficBytes        interface{} // 总流量
	BandwidthPercentileBytes interface{} // 带宽百分位字节
	BandwidthPercentile      interface{} // 带宽百分位
	PriceType                interface{} // 计费类型
}

func NewServerBillOperator

func NewServerBillOperator() *ServerBillOperator

type ServerDAO

type ServerDAO dbs.DAO
var SharedServerDAO *ServerDAO

func NewServerDAO

func NewServerDAO() *ServerDAO

func (*ServerDAO) CheckPortIsUsing

func (this *ServerDAO) CheckPortIsUsing(tx *dbs.Tx, clusterId int64, protocolFamily string, port int, excludeServerId int64, excludeProtocol string) (bool, error)

CheckPortIsUsing 检查端口是否被使用 protocolFamily支持tcp和udp

func (*ServerDAO) CheckServerPlanQuota added in v1.2.9

func (this *ServerDAO) CheckServerPlanQuota(tx *dbs.Tx, serverId int64, countServerNames int) error

CheckServerPlanQuota 检查网站套餐限制

func (*ServerDAO) CheckUserServer

func (this *ServerDAO) CheckUserServer(tx *dbs.Tx, userId int64, serverId int64) error

CheckUserServer 检查用户服务

func (*ServerDAO) ComposeServerConfig

func (this *ServerDAO) ComposeServerConfig(tx *dbs.Tx, server *Server, ignoreCerts bool, dataMap *shared.DataMap, cacheMap *utils.CacheMap, forNode bool, forList bool) (*serverconfigs.ServerConfig, error)

ComposeServerConfig 构造服务的Config forNode 是否是节点请求

func (*ServerDAO) ComposeServerConfigWithServerId

func (this *ServerDAO) ComposeServerConfigWithServerId(tx *dbs.Tx, serverId int64, ignoreCertData bool, forNode bool) (*serverconfigs.ServerConfig, error)

ComposeServerConfigWithServerId 构造服务的Config

func (*ServerDAO) CopyServerConfigToCluster added in v1.0.0

func (this *ServerDAO) CopyServerConfigToCluster(tx *dbs.Tx, fromServerId int64, clusterId int64, configCode string, wafCopyRegions bool) error

CopyServerConfigToCluster 拷贝服务配置到集群

func (*ServerDAO) CopyServerConfigToGroups added in v1.0.0

func (this *ServerDAO) CopyServerConfigToGroups(tx *dbs.Tx, fromServerId int64, groupIds []int64, configCode string, wafCopyRegions bool) error

CopyServerConfigToGroups 拷贝服务配置到分组

func (*ServerDAO) CopyServerConfigToServers added in v1.0.0

func (this *ServerDAO) CopyServerConfigToServers(tx *dbs.Tx, fromServerId int64, toServerIds []int64, configCode serverconfigs.ConfigCode, wafCopyRegions bool) error

CopyServerConfigToServers 拷贝服务配置到一组服务

func (*ServerDAO) CopyServerConfigToUser added in v1.0.0

func (this *ServerDAO) CopyServerConfigToUser(tx *dbs.Tx, fromServerId int64, userId int64, configCode string, wafCopyRegions bool) error

CopyServerConfigToUser 拷贝服务配置到用户

func (*ServerDAO) CopyServerUAMConfigs added in v1.0.0

func (this *ServerDAO) CopyServerUAMConfigs(tx *dbs.Tx, fromServerId int64, toServerIds []int64, wafCopyRegions bool) error

CopyServerUAMConfigs 复制UAM设置

func (*ServerDAO) CountAllEnabledServers

func (this *ServerDAO) CountAllEnabledServers(tx *dbs.Tx) (int64, error)

CountAllEnabledServers 计算所有可用服务数量

func (*ServerDAO) CountAllEnabledServersMatch

func (this *ServerDAO) CountAllEnabledServersMatch(tx *dbs.Tx, groupId int64, keyword string, userId int64, clusterId int64, auditingFlag configutils.BoolState, protocolFamilies []string, userPlanId int64) (int64, error)

CountAllEnabledServersMatch 计算所有可用服务数量 参数:

groupId 分组ID,如果为-1,则搜索没有分组的服务

func (*ServerDAO) CountAllEnabledServersWithGroupId

func (this *ServerDAO) CountAllEnabledServersWithGroupId(tx *dbs.Tx, groupId int64, userId int64) (int64, error)

CountAllEnabledServersWithGroupId 计算使用某个分组的服务数量

func (*ServerDAO) CountAllEnabledServersWithNodeClusterId

func (this *ServerDAO) CountAllEnabledServersWithNodeClusterId(tx *dbs.Tx, clusterId int64) (int64, error)

CountAllEnabledServersWithNodeClusterId 计算使用某个集群的所有服务数量

func (*ServerDAO) CountAllEnabledServersWithSSLPolicyIds

func (this *ServerDAO) CountAllEnabledServersWithSSLPolicyIds(tx *dbs.Tx, sslPolicyIds []int64) (count int64, err error)

CountAllEnabledServersWithSSLPolicyIds 计算使用SSL策略的所有服务数量

func (*ServerDAO) CountAllServerNamesWithUserId added in v1.2.9

func (this *ServerDAO) CountAllServerNamesWithUserId(tx *dbs.Tx, userId int64, userPlanId int64) (int64, error)

CountAllServerNamesWithUserId 计算某个用户下的所有域名数

func (*ServerDAO) CountEnabledServersWithWebIds

func (this *ServerDAO) CountEnabledServersWithWebIds(tx *dbs.Tx, webIds []int64) (count int64, err error)

CountEnabledServersWithWebIds 计算使用某个缓存策略的所有服务数量

func (*ServerDAO) CountServerNames added in v1.2.9

func (this *ServerDAO) CountServerNames(tx *dbs.Tx, serverId int64) (int64, error)

CountServerNames 计算某个网站下的所有域名数

func (*ServerDAO) CreateServer

func (this *ServerDAO) CreateServer(tx *dbs.Tx,
	adminId int64,
	userId int64,
	serverType serverconfigs.ServerType,
	name string,
	description string,
	serverNamesJSON []byte,
	isAuditing bool,
	auditingServerNamesJSON []byte,
	httpJSON []byte,
	httpsJSON []byte,
	tcpJSON []byte,
	tlsJSON []byte,
	unixJSON []byte,
	udpJSON []byte,
	webId int64,
	reverseProxyJSON []byte,
	clusterId int64,
	includeNodesJSON []byte,
	excludeNodesJSON []byte,
	groupIds []int64,
	userPlanId int64) (serverId int64, err error)

CreateServer 创建服务

func (*ServerDAO) DisableServer

func (this *ServerDAO) DisableServer(tx *dbs.Tx, serverId int64) (err error)

DisableServer 禁用条目

func (*ServerDAO) EnableServer

func (this *ServerDAO) EnableServer(tx *dbs.Tx, id uint32) (rowsAffected int64, err error)

EnableServer 启用条目

func (*ServerDAO) ExistEnabledUserServerWithSSLPolicyId

func (this *ServerDAO) ExistEnabledUserServerWithSSLPolicyId(tx *dbs.Tx, userId int64, sslPolicyId int64) (bool, error)

ExistEnabledUserServerWithSSLPolicyId 检查是否存在某个用户的策略

func (*ServerDAO) ExistServerNameInCluster

func (this *ServerDAO) ExistServerNameInCluster(tx *dbs.Tx, clusterId int64, serverName string, excludeServerId int64, supportWildcard bool) (bool, error)

ExistServerNameInCluster 检查ServerName是否已存在

func (*ServerDAO) FindAllAvailableServersWithUserId added in v0.5.6

func (this *ServerDAO) FindAllAvailableServersWithUserId(tx *dbs.Tx, userId int64) (result []*Server, err error)

FindAllAvailableServersWithUserId 查找用户的所有可用服务信息

func (*ServerDAO) FindAllBasicServersWithUserId added in v0.5.6

func (this *ServerDAO) FindAllBasicServersWithUserId(tx *dbs.Tx, userId int64) (result []*Server, err error)

FindAllBasicServersWithUserId 查找用户的所有服务的基础信息

func (*ServerDAO) FindAllEnabledServerIds

func (this *ServerDAO) FindAllEnabledServerIds(tx *dbs.Tx) (serverIds []int64, err error)

FindAllEnabledServerIds 获取所有的服务ID

func (*ServerDAO) FindAllEnabledServerIdsWithGroupId

func (this *ServerDAO) FindAllEnabledServerIdsWithGroupId(tx *dbs.Tx, groupId int64) (serverIds []int64, err error)

FindAllEnabledServerIdsWithGroupId 获取某个分组下的所有的服务ID

func (*ServerDAO) FindAllEnabledServerIdsWithSSLPolicyIds

func (this *ServerDAO) FindAllEnabledServerIdsWithSSLPolicyIds(tx *dbs.Tx, sslPolicyIds []int64) (result []int64, err error)

FindAllEnabledServerIdsWithSSLPolicyIds 查找使用某个SSL策略的所有服务Id

func (*ServerDAO) FindAllEnabledServerIdsWithUserId

func (this *ServerDAO) FindAllEnabledServerIdsWithUserId(tx *dbs.Tx, userId int64) (serverIds []int64, err error)

FindAllEnabledServerIdsWithUserId 获取某个用户的所有的服务ID

func (*ServerDAO) FindAllEnabledServersWithDomain

func (this *ServerDAO) FindAllEnabledServersWithDomain(tx *dbs.Tx, domain string) (result []*Server, err error)

FindAllEnabledServersWithDomain 根据域名查找服务 TODO 需要改成使用plainServerNames

func (*ServerDAO) FindAllEnabledServersWithNode

func (this *ServerDAO) FindAllEnabledServersWithNode(tx *dbs.Tx, nodeId int64) (result []*Server, err error)

FindAllEnabledServersWithNode 获取节点中的所有服务

func (*ServerDAO) FindAllEnabledServersWithSSLPolicyIds

func (this *ServerDAO) FindAllEnabledServersWithSSLPolicyIds(tx *dbs.Tx, sslPolicyIds []int64) (result []*Server, err error)

FindAllEnabledServersWithSSLPolicyIds 查找使用某个SSL策略的所有服务

func (*ServerDAO) FindAllEnabledServersWithWebIds

func (this *ServerDAO) FindAllEnabledServersWithWebIds(tx *dbs.Tx, webIds []int64) (result []*Server, err error)

FindAllEnabledServersWithWebIds 通过WebId查找服务

func (*ServerDAO) FindAllServerDNSNamesWithDNSDomainId

func (this *ServerDAO) FindAllServerDNSNamesWithDNSDomainId(tx *dbs.Tx, dnsDomainId int64) ([]string, error)

FindAllServerDNSNamesWithDNSDomainId 查询使用某个DNS域名的所有服务域名

func (*ServerDAO) FindAllServersDNSWithClusterId

func (this *ServerDAO) FindAllServersDNSWithClusterId(tx *dbs.Tx, clusterId int64) (result []*Server, err error)

FindAllServersDNSWithClusterId 获取某个集群下的服务DNS信息

func (*ServerDAO) FindEnabledServer

func (this *ServerDAO) FindEnabledServer(tx *dbs.Tx, serverId int64) (*Server, error)

FindEnabledServer 查找启用中的服务

func (*ServerDAO) FindEnabledServerBasic

func (this *ServerDAO) FindEnabledServerBasic(tx *dbs.Tx, serverId int64) (*Server, error)

FindEnabledServerBasic 查找服务基本信息

func (*ServerDAO) FindEnabledServerIdWithReverseProxyId

func (this *ServerDAO) FindEnabledServerIdWithReverseProxyId(tx *dbs.Tx, reverseProxyId int64) (serverId int64, err error)

FindEnabledServerIdWithReverseProxyId 查找包含某个反向代理的Server

func (*ServerDAO) FindEnabledServerIdWithUserPlanId

func (this *ServerDAO) FindEnabledServerIdWithUserPlanId(tx *dbs.Tx, userPlanId int64) (int64, error)

FindEnabledServerIdWithUserPlanId 查找使用某个套餐的服务ID

func (*ServerDAO) FindEnabledServerIdWithWebId

func (this *ServerDAO) FindEnabledServerIdWithWebId(tx *dbs.Tx, webId int64) (serverId int64, err error)

FindEnabledServerIdWithWebId 根据WebId查找ServerId

func (*ServerDAO) FindEnabledServerName

func (this *ServerDAO) FindEnabledServerName(tx *dbs.Tx, serverId int64) (string, error)

FindEnabledServerName 查找服务名称

func (*ServerDAO) FindEnabledServerType

func (this *ServerDAO) FindEnabledServerType(tx *dbs.Tx, serverId int64) (string, error)

FindEnabledServerType 查找服务类型

func (*ServerDAO) FindEnabledServerWithDomain

func (this *ServerDAO) FindEnabledServerWithDomain(tx *dbs.Tx, userId int64, domain string) (server *Server, err error)

FindEnabledServerWithDomain 根据域名查找服务集群ID

func (*ServerDAO) FindEnabledServersWithIds added in v1.0.0

func (this *ServerDAO) FindEnabledServersWithIds(tx *dbs.Tx, serverIds []int64) (result []*Server, err error)

FindEnabledServersWithIds 根据ID查找一组服务

func (*ServerDAO) FindEnabledServersWithUserPlanId added in v1.2.9

func (this *ServerDAO) FindEnabledServersWithUserPlanId(tx *dbs.Tx, userPlanId int64) (result []*Server, err error)

FindEnabledServersWithUserPlanId 查找使用某个套餐的网站

func (*ServerDAO) FindFirstHTTPOrHTTPSPortWithClusterId

func (this *ServerDAO) FindFirstHTTPOrHTTPSPortWithClusterId(tx *dbs.Tx, clusterId int64) (int, error)

FindFirstHTTPOrHTTPSPortWithClusterId 获取集群中第一个HTTP或者HTTPS端口

func (*ServerDAO) FindLatestServers

func (this *ServerDAO) FindLatestServers(tx *dbs.Tx, size int64) (result []*Server, err error)

FindLatestServers 查询最近访问的服务

func (*ServerDAO) FindNearbyServersInCluster

func (this *ServerDAO) FindNearbyServersInCluster(tx *dbs.Tx, clusterId int64, serverId int64, size int64) (result []*Server, err error)

FindNearbyServersInCluster 查找所属集群附近的服务

func (*ServerDAO) FindNearbyServersInGroup

func (this *ServerDAO) FindNearbyServersInGroup(tx *dbs.Tx, groupId int64, serverId int64, size int64) (result []*Server, err error)

FindNearbyServersInGroup 查找所属分组附近的服务

func (*ServerDAO) FindReverseProxyRef

func (this *ServerDAO) FindReverseProxyRef(tx *dbs.Tx, serverId int64) (*serverconfigs.ReverseProxyRef, error)

FindReverseProxyRef 根据条件获取反向代理配置

func (*ServerDAO) FindServerAdminIdAndUserId

func (this *ServerDAO) FindServerAdminIdAndUserId(tx *dbs.Tx, serverId int64) (adminId int64, userId int64, err error)

FindServerAdminIdAndUserId 获取当前服务的管理员ID和用户ID

func (*ServerDAO) FindServerClusterId

func (this *ServerDAO) FindServerClusterId(tx *dbs.Tx, serverId int64) (int64, error)

FindServerClusterId 查询当前服务的集群ID

func (*ServerDAO) FindServerDNSName

func (this *ServerDAO) FindServerDNSName(tx *dbs.Tx, serverId int64) (string, error)

FindServerDNSName 查询服务的DNS名称

func (*ServerDAO) FindServerGroupIds

func (this *ServerDAO) FindServerGroupIds(tx *dbs.Tx, serverId int64) ([]int64, error)

FindServerGroupIds 获取服务的分组ID

func (*ServerDAO) FindServerIdWithDNSName added in v0.5.2

func (this *ServerDAO) FindServerIdWithDNSName(tx *dbs.Tx, clusterId int64, dnsName string) (int64, error)

FindServerIdWithDNSName 根据CNAME查询服务ID

func (*ServerDAO) FindServerLastUserPlanIdAndUserId

func (this *ServerDAO) FindServerLastUserPlanIdAndUserId(tx *dbs.Tx, serverId int64) (userPlanId int64, userId int64, err error)

FindServerLastUserPlanIdAndUserId 查找最后使用的套餐

func (*ServerDAO) FindServerNodeFilters

func (this *ServerDAO) FindServerNodeFilters(tx *dbs.Tx, serverId int64) (isOk bool, clusterId int64, err error)

FindServerNodeFilters 查找服务的搜索条件

func (*ServerDAO) FindServerServerNames

func (this *ServerDAO) FindServerServerNames(tx *dbs.Tx, serverId int64) (serverNamesJSON []byte, isAuditing bool, auditingAt int64, auditingServerNamesJSON []byte, auditingResultJSON []byte, err error)

FindServerServerNames 查找ServerNames配置

func (*ServerDAO) FindServerSupportCNAME

func (this *ServerDAO) FindServerSupportCNAME(tx *dbs.Tx, serverId int64) (bool, error)

FindServerSupportCNAME 查询服务是否支持CNAME

func (*ServerDAO) FindServerTrafficLimitConfig

func (this *ServerDAO) FindServerTrafficLimitConfig(tx *dbs.Tx, serverId int64, cacheMap *utils.CacheMap) (*serverconfigs.TrafficLimitConfig, error)

FindServerTrafficLimitConfig 查找服务的流量限制

func (*ServerDAO) FindServerUAM

func (this *ServerDAO) FindServerUAM(tx *dbs.Tx, serverId int64) ([]byte, error)

FindServerUAM 查找服务的UAM配置

func (*ServerDAO) FindServerUserId

func (this *ServerDAO) FindServerUserId(tx *dbs.Tx, serverId int64) (userId int64, err error)

FindServerUserId 查找服务的用户ID

func (*ServerDAO) FindServerUserPlanId

func (this *ServerDAO) FindServerUserPlanId(tx *dbs.Tx, serverId int64) (userPlanId int64, err error)

FindServerUserPlanId 查找服务的套餐ID TODO 需要缓存

func (*ServerDAO) FindServerWebId

func (this *ServerDAO) FindServerWebId(tx *dbs.Tx, serverId int64) (int64, error)

FindServerWebId 查找Server对应的WebId

func (*ServerDAO) FindStatelessServerDNS

func (this *ServerDAO) FindStatelessServerDNS(tx *dbs.Tx, serverId int64) (*Server, error)

FindStatelessServerDNS 查询服务的DNS相关信息,并且不关注状态

func (*ServerDAO) FindUserServerClusterIds added in v0.4.10

func (this *ServerDAO) FindUserServerClusterIds(tx *dbs.Tx, userId int64) ([]int64, error)

FindUserServerClusterIds 获取用户相关服务的集群ID组合

func (*ServerDAO) GenDNSName

func (this *ServerDAO) GenDNSName(tx *dbs.Tx) (string, error)

GenDNSName 生成DNS Name

func (*ServerDAO) GenerateServerDNSName

func (this *ServerDAO) GenerateServerDNSName(tx *dbs.Tx, serverId int64) (string, error)

GenerateServerDNSName 重新生成子域名

func (*ServerDAO) IncreaseServerTotalTraffic

func (this *ServerDAO) IncreaseServerTotalTraffic(tx *dbs.Tx, serverId int64, bytes int64) error

IncreaseServerTotalTraffic 增加服务的总流量

func (*ServerDAO) Init

func (this *ServerDAO) Init()

Init 初始化

func (*ServerDAO) InitServerWeb

func (this *ServerDAO) InitServerWeb(tx *dbs.Tx, serverId int64) (int64, error)

InitServerWeb 初始化Web配置

func (*ServerDAO) ListEnabledServersMatch

func (this *ServerDAO) ListEnabledServersMatch(tx *dbs.Tx, offset int64, size int64, groupId int64, keyword string, userId int64, clusterId int64, auditingFlag int32, protocolFamilies []string, order string) (result []*Server, err error)

ListEnabledServersMatch 列出单页的服务 参数:

groupId 分组ID,如果为-1,则搜索没有分组的服务

func (*ServerDAO) NotifyClusterDNSUpdate

func (this *ServerDAO) NotifyClusterDNSUpdate(tx *dbs.Tx, clusterId int64, serverId int64) error

NotifyClusterDNSUpdate 通知某个集群中的DNS更新

func (*ServerDAO) NotifyClusterUpdate

func (this *ServerDAO) NotifyClusterUpdate(tx *dbs.Tx, clusterId, serverId int64) error

NotifyClusterUpdate 同步指定的集群

func (*ServerDAO) NotifyDNSUpdate

func (this *ServerDAO) NotifyDNSUpdate(tx *dbs.Tx, serverId int64) error

NotifyDNSUpdate 通知当前集群DNS更新

func (*ServerDAO) NotifyDisable

func (this *ServerDAO) NotifyDisable(tx *dbs.Tx, serverId int64) error

NotifyDisable 通知禁用

func (*ServerDAO) NotifyServerPortsUpdate

func (this *ServerDAO) NotifyServerPortsUpdate(tx *dbs.Tx, serverId int64) error

NotifyServerPortsUpdate 通知服务端口变化

func (*ServerDAO) NotifyUpdate

func (this *ServerDAO) NotifyUpdate(tx *dbs.Tx, serverId int64) error

NotifyUpdate 同步服务所在的集群

func (*ServerDAO) NotifyUserClustersChange added in v0.4.10

func (this *ServerDAO) NotifyUserClustersChange(tx *dbs.Tx, userId int64) error

NotifyUserClustersChange 通知用户相关集群更新

func (*ServerDAO) RenewServerTrafficLimitStatus added in v1.2.9

func (this *ServerDAO) RenewServerTrafficLimitStatus(tx *dbs.Tx, trafficLimitConfig *serverconfigs.TrafficLimitConfig, serverId int64, isUpdatingConfig bool) error

RenewServerTrafficLimitStatus 根据限流配置更新网站的流量限制状态

func (*ServerDAO) ResetServerTotalTraffic

func (this *ServerDAO) ResetServerTotalTraffic(tx *dbs.Tx, serverId int64) error

ResetServerTotalTraffic 重置服务总流量

func (*ServerDAO) ResetServersTrafficLimitStatusWithPlanId added in v1.2.9

func (this *ServerDAO) ResetServersTrafficLimitStatusWithPlanId(tx *dbs.Tx, planId int64) error

ResetServersTrafficLimitStatusWithPlanId 重置网站限流状态

func (*ServerDAO) UpdateAuditingServerNames

func (this *ServerDAO) UpdateAuditingServerNames(tx *dbs.Tx, serverId int64, isAuditing bool, auditingServerNamesJSON []byte) error

UpdateAuditingServerNames 修改域名审核

func (*ServerDAO) UpdateServerAuditing

func (this *ServerDAO) UpdateServerAuditing(tx *dbs.Tx, serverId int64, result *pb.ServerNameAuditingResult) error

UpdateServerAuditing 修改域名审核结果

func (*ServerDAO) UpdateServerBandwidth added in v0.5.2

func (this *ServerDAO) UpdateServerBandwidth(tx *dbs.Tx, serverId int64, fullTime string, bandwidthBytes int64, countRequests int64, countAttackRequests int64) error

UpdateServerBandwidth 更新服务带宽 fullTime YYYYMMDDHHII

func (*ServerDAO) UpdateServerBasic

func (this *ServerDAO) UpdateServerBasic(tx *dbs.Tx, serverId int64, name string, description string, clusterId int64, keepOldConfigs bool, isOn bool, groupIds []int64) error

UpdateServerBasic 修改服务基本信息

func (*ServerDAO) UpdateServerDNS

func (this *ServerDAO) UpdateServerDNS(tx *dbs.Tx, serverId int64, supportCNAME bool) error

UpdateServerDNS 修改DNS设置

func (*ServerDAO) UpdateServerDNSName added in v0.5.2

func (this *ServerDAO) UpdateServerDNSName(tx *dbs.Tx, serverId int64, dnsName string) error

UpdateServerDNSName 设置CNAME

func (*ServerDAO) UpdateServerGroupIds added in v0.4.9

func (this *ServerDAO) UpdateServerGroupIds(tx *dbs.Tx, serverId int64, groupIds []int64) error

UpdateServerGroupIds 修改服务所在分组

func (*ServerDAO) UpdateServerHTTP

func (this *ServerDAO) UpdateServerHTTP(tx *dbs.Tx, serverId int64, config []byte) error

UpdateServerHTTP 修改HTTP配置

func (*ServerDAO) UpdateServerHTTPS

func (this *ServerDAO) UpdateServerHTTPS(tx *dbs.Tx, serverId int64, httpsJSON []byte) error

UpdateServerHTTPS 修改HTTPS配置

func (*ServerDAO) UpdateServerIsOn

func (this *ServerDAO) UpdateServerIsOn(tx *dbs.Tx, serverId int64, isOn bool) error

UpdateServerIsOn 修复服务是否启用

func (*ServerDAO) UpdateServerName added in v1.0.0

func (this *ServerDAO) UpdateServerName(tx *dbs.Tx, serverId int64, name string) error

UpdateServerName 修改服务名

func (*ServerDAO) UpdateServerNames

func (this *ServerDAO) UpdateServerNames(tx *dbs.Tx, serverId int64, serverNamesJSON []byte) error

UpdateServerNames 修改ServerNames配置

func (*ServerDAO) UpdateServerReverseProxy

func (this *ServerDAO) UpdateServerReverseProxy(tx *dbs.Tx, serverId int64, config []byte) error

UpdateServerReverseProxy 修改反向代理配置

func (*ServerDAO) UpdateServerTCP

func (this *ServerDAO) UpdateServerTCP(tx *dbs.Tx, serverId int64, config []byte) error

UpdateServerTCP 修改TCP配置

func (*ServerDAO) UpdateServerTLS

func (this *ServerDAO) UpdateServerTLS(tx *dbs.Tx, serverId int64, config []byte) error

UpdateServerTLS 修改TLS配置

func (*ServerDAO) UpdateServerTrafficLimitConfig

func (this *ServerDAO) UpdateServerTrafficLimitConfig(tx *dbs.Tx, serverId int64, trafficLimitConfig *serverconfigs.TrafficLimitConfig) error

UpdateServerTrafficLimitConfig 修改服务的流量限制

func (*ServerDAO) UpdateServerTrafficLimitStatus

func (this *ServerDAO) UpdateServerTrafficLimitStatus(tx *dbs.Tx, serverId int64, day string, planId int64, dateType string, targetType string) error

UpdateServerTrafficLimitStatus 修改网站的流量限制状态

func (*ServerDAO) UpdateServerUAM

func (this *ServerDAO) UpdateServerUAM(tx *dbs.Tx, serverId int64, uamConfig *serverconfigs.UAMConfig) error

UpdateServerUAM 开启UAM

func (*ServerDAO) UpdateServerUDP

func (this *ServerDAO) UpdateServerUDP(tx *dbs.Tx, serverId int64, config []byte) error

UpdateServerUDP 修改UDP配置

func (*ServerDAO) UpdateServerUnix

func (this *ServerDAO) UpdateServerUnix(tx *dbs.Tx, serverId int64, config []byte) error

UpdateServerUnix 修改Unix配置

func (*ServerDAO) UpdateServerUserId added in v0.6.0

func (this *ServerDAO) UpdateServerUserId(tx *dbs.Tx, serverId int64, userId int64) error

UpdateServerUserId 修改服务所属用户

func (*ServerDAO) UpdateServerUserPlanId

func (this *ServerDAO) UpdateServerUserPlanId(tx *dbs.Tx, serverId int64, userPlanId int64) error

UpdateServerUserPlanId 设置服务所属套餐

func (*ServerDAO) UpdateServerWeb

func (this *ServerDAO) UpdateServerWeb(tx *dbs.Tx, serverId int64, webId int64) error

UpdateServerWeb 修改Web配置

func (*ServerDAO) UpdateServersClusterIdWithPlanId

func (this *ServerDAO) UpdateServersClusterIdWithPlanId(tx *dbs.Tx, planId int64, clusterId int64) error

UpdateServersClusterIdWithPlanId 修改套餐所在集群

func (*ServerDAO) UpdateServersTrafficLimitStatusWithUserPlanId added in v1.2.9

func (this *ServerDAO) UpdateServersTrafficLimitStatusWithUserPlanId(tx *dbs.Tx, userPlanId int64, day string, planId int64, dateType string, targetType serverconfigs.TrafficLimitTarget) error

UpdateServersTrafficLimitStatusWithUserPlanId 修改某个套餐下的网站的流量限制状态

func (*ServerDAO) UpdateUserServerBasic

func (this *ServerDAO) UpdateUserServerBasic(tx *dbs.Tx, serverId int64, name string) error

UpdateUserServerBasic 设置用户相关的基本信息

func (*ServerDAO) UpdateUserServersClusterId

func (this *ServerDAO) UpdateUserServersClusterId(tx *dbs.Tx, userId int64, oldClusterId, newClusterId int64) error

UpdateUserServersClusterId 设置一个用户下的所有服务的所属集群

type ServerDailyStat

type ServerDailyStat struct {
	Id                  uint64  `field:"id"`                  // ID
	UserId              uint32  `field:"userId"`              // 用户ID
	ServerId            uint32  `field:"serverId"`            // 服务ID
	RegionId            uint32  `field:"regionId"`            // 区域ID
	Bytes               uint64  `field:"bytes"`               // 流量
	CachedBytes         uint64  `field:"cachedBytes"`         // 缓存的流量
	CountRequests       uint64  `field:"countRequests"`       // 请求数
	CountCachedRequests uint64  `field:"countCachedRequests"` // 缓存的请求数
	CountAttackRequests uint64  `field:"countAttackRequests"` // 攻击请求数
	AttackBytes         uint64  `field:"attackBytes"`         // 攻击流量
	Day                 string  `field:"day"`                 // 日期YYYYMMDD
	Hour                string  `field:"hour"`                // YYYYMMDDHH
	TimeFrom            string  `field:"timeFrom"`            // 开始时间HHMMSS
	TimeTo              string  `field:"timeTo"`              // 结束时间
	IsCharged           bool    `field:"isCharged"`           // 是否已计算费用
	PlanId              uint64  `field:"planId"`              // 套餐ID
	Fee                 float64 `field:"fee"`                 // 费用
}

ServerDailyStat 计费流量统计

func (*ServerDailyStat) AsServerBandwidthStat added in v1.0.0

func (this *ServerDailyStat) AsServerBandwidthStat() *ServerBandwidthStat

func (*ServerDailyStat) AsUserBandwidthStat added in v1.0.0

func (this *ServerDailyStat) AsUserBandwidthStat() *UserBandwidthStat

type ServerDailyStatDAO

type ServerDailyStatDAO dbs.DAO
var SharedServerDailyStatDAO *ServerDailyStatDAO

func NewServerDailyStatDAO

func NewServerDailyStatDAO() *ServerDailyStatDAO

func (*ServerDailyStatDAO) CleanDays added in v1.2.1

func (this *ServerDailyStatDAO) CleanDays(tx *dbs.Tx, days int) error

CleanDays 清理历史数据

func (*ServerDailyStatDAO) CleanDefaultDays added in v1.2.1

func (this *ServerDailyStatDAO) CleanDefaultDays(tx *dbs.Tx, defaultDays int) error

func (*ServerDailyStatDAO) FindDistinctServerIds

func (this *ServerDailyStatDAO) FindDistinctServerIds(tx *dbs.Tx, dayFrom string, dayTo string) (serverIds []int64, err error)

FindDistinctServerIds 查找所有有流量的服务ID列表 dayFrom YYYYMMDD dayTo YYYYMMDD

func (*ServerDailyStatDAO) FindDistinctUserIds added in v0.5.6

func (this *ServerDailyStatDAO) FindDistinctUserIds(tx *dbs.Tx, dayFrom string, dayTo string) (userIds []int64, err error)

FindDistinctUserIds 查找所有有流量的用户ID

func (*ServerDailyStatDAO) FindMonthlyStatsWithPlan

func (this *ServerDailyStatDAO) FindMonthlyStatsWithPlan(tx *dbs.Tx, month string) (result []*ServerDailyStat, err error)

FindMonthlyStatsWithPlan 查找某月有套餐的流量 month YYYYMM

func (*ServerDailyStatDAO) FindStatsBetweenDays added in v0.5.6

func (this *ServerDailyStatDAO) FindStatsBetweenDays(tx *dbs.Tx, userId int64, serverId int64, regionId int64, dayFrom string, dayTo string) (result []*ServerDailyStat, err error)

FindStatsBetweenDays 查找日期段内的5分钟统计

func (*ServerDailyStatDAO) FindStatsWithDay added in v0.5.3

func (this *ServerDailyStatDAO) FindStatsWithDay(tx *dbs.Tx, serverId int64, day string, timeFrom string, timeTo string) (result []*ServerDailyStat, err error)

FindStatsWithDay 按天查找5分钟级统计 day YYYYMMDD timeFrom HHII00 timeTo HHII59

func (*ServerDailyStatDAO) FindTopUserStats

func (this *ServerDailyStatDAO) FindTopUserStats(tx *dbs.Tx, hourFrom string, hourTo string) (result []*ServerDailyStat, err error)

FindTopUserStats 流量排行

func (*ServerDailyStatDAO) SaveStats

func (this *ServerDailyStatDAO) SaveStats(tx *dbs.Tx, stats []*pb.ServerDailyStat) error

SaveStats 提交数据

func (*ServerDailyStatDAO) SumCurrentDailyStat

func (this *ServerDailyStatDAO) SumCurrentDailyStat(tx *dbs.Tx, serverId int64) (*ServerDailyStat, error)

SumCurrentDailyStat 查找当前时刻的数据统计

func (*ServerDailyStatDAO) SumDailyStatBeforeMinute

func (this *ServerDailyStatDAO) SumDailyStatBeforeMinute(tx *dbs.Tx, serverId int64, day string, minute string) (stat *pb.ServerDailyStat, err error)

SumDailyStatBeforeMinute 获取某天内某个时间之前的流量 用于同期流量对比 day 格式为YYYYMMDD minute 格式为HHIISS

func (*ServerDailyStatDAO) SumHourlyStat

func (this *ServerDailyStatDAO) SumHourlyStat(tx *dbs.Tx, serverId int64, hour string) (stat *pb.ServerDailyStat, err error)

SumHourlyStat 获取某个小时内的流量 hour 格式为YYYYMMDDHH

func (*ServerDailyStatDAO) SumMinutelyStat

func (this *ServerDailyStatDAO) SumMinutelyStat(tx *dbs.Tx, serverId int64, minute string) (stat *pb.ServerDailyStat, err error)

SumMinutelyStat 获取某个分钟内的流量 minute 格式为YYYYMMDDHHMM,并且已经格式化成每5分钟一个值

func (*ServerDailyStatDAO) SumMonthlyBytes

func (this *ServerDailyStatDAO) SumMonthlyBytes(tx *dbs.Tx, serverId int64, month string) (result int64, err error)

SumMonthlyBytes 获取某月内的流量 month 格式为YYYYMM

func (*ServerDailyStatDAO) SumMonthlyStat

func (this *ServerDailyStatDAO) SumMonthlyStat(tx *dbs.Tx, serverId int64, month string) (stat *pb.ServerDailyStat, err error)

SumMonthlyStat 获取某月内的流量 month 格式为YYYYMM

func (*ServerDailyStatDAO) SumServerMonthlyWithRegion

func (this *ServerDailyStatDAO) SumServerMonthlyWithRegion(tx *dbs.Tx, serverId int64, regionId int64, month string) (int64, error)

SumServerMonthlyWithRegion 根据服务计算某月合计 month 格式为YYYYMM

func (*ServerDailyStatDAO) SumUserDailyPeek

func (this *ServerDailyStatDAO) SumUserDailyPeek(tx *dbs.Tx, userId int64, regionId int64, day string) (int64, error)

SumUserDailyPeek 获取某天带宽峰值 day 格式为YYYYMMDD

func (*ServerDailyStatDAO) SumUserMonthlyPeek

func (this *ServerDailyStatDAO) SumUserMonthlyPeek(tx *dbs.Tx, userId int64, regionId int64, month string) (int64, error)

SumUserMonthlyPeek 获取某月带宽峰值 month 格式为YYYYMM

func (*ServerDailyStatDAO) SumUserMonthlyWithoutPlan

func (this *ServerDailyStatDAO) SumUserMonthlyWithoutPlan(tx *dbs.Tx, userId int64, regionId int64, month string) (int64, error)

SumUserMonthlyWithoutPlan 根据用户计算某月合计并排除套餐 month 格式为YYYYMM

func (*ServerDailyStatDAO) SumUserTrafficBytesBetweenDays added in v0.5.6

func (this *ServerDailyStatDAO) SumUserTrafficBytesBetweenDays(tx *dbs.Tx, userId int64, regionId int64, dayFrom string, dayTo string) (int64, error)

SumUserTrafficBytesBetweenDays 获取用户某个日期段内的流量总和

func (*ServerDailyStatDAO) UpdateStatFee

func (this *ServerDailyStatDAO) UpdateStatFee(tx *dbs.Tx, statId int64, fee float32) error

UpdateStatFee 设置费用

type ServerDailyStatOperator

type ServerDailyStatOperator struct {
	Id                  interface{} // ID
	UserId              interface{} // 用户ID
	ServerId            interface{} // 服务ID
	RegionId            interface{} // 区域ID
	Bytes               interface{} // 流量
	CachedBytes         interface{} // 缓存的流量
	CountRequests       interface{} // 请求数
	CountCachedRequests interface{} // 缓存的请求数
	CountAttackRequests interface{} // 攻击请求数
	AttackBytes         interface{} // 攻击流量
	Day                 interface{} // 日期YYYYMMDD
	Hour                interface{} // YYYYMMDDHH
	TimeFrom            interface{} // 开始时间HHMMSS
	TimeTo              interface{} // 结束时间
	IsCharged           interface{} // 是否已计算费用
	PlanId              interface{} // 套餐ID
	Fee                 interface{} // 费用
}

func NewServerDailyStatOperator

func NewServerDailyStatOperator() *ServerDailyStatOperator

type ServerGroup

type ServerGroup struct {
	Id               uint32   `field:"id"`               // ID
	AdminId          uint32   `field:"adminId"`          // 管理员ID
	UserId           uint32   `field:"userId"`           // 用户ID
	IsOn             bool     `field:"isOn"`             // 是否启用
	Name             string   `field:"name"`             // 名称
	Order            uint32   `field:"order"`            // 排序
	CreatedAt        uint64   `field:"createdAt"`        // 创建时间
	State            uint8    `field:"state"`            // 状态
	HttpReverseProxy dbs.JSON `field:"httpReverseProxy"` // 反向代理设置
	TcpReverseProxy  dbs.JSON `field:"tcpReverseProxy"`  // TCP反向代理
	UdpReverseProxy  dbs.JSON `field:"udpReverseProxy"`  // UDP反向代理
	WebId            uint32   `field:"webId"`            // Web配置ID
}

ServerGroup 服务分组

type ServerGroupDAO

type ServerGroupDAO dbs.DAO
var SharedServerGroupDAO *ServerGroupDAO

func NewServerGroupDAO

func NewServerGroupDAO() *ServerGroupDAO

func (*ServerGroupDAO) CheckUserGroup

func (this *ServerGroupDAO) CheckUserGroup(tx *dbs.Tx, userId int64, groupId int64) error

CheckUserGroup 检查用户分组

func (*ServerGroupDAO) ComposeGroupConfig

func (this *ServerGroupDAO) ComposeGroupConfig(tx *dbs.Tx, groupId int64, forNode bool, forList bool, dataMap *shared.DataMap, cacheMap *utils.CacheMap) (*serverconfigs.ServerGroupConfig, error)

ComposeGroupConfig 组合配置

func (*ServerGroupDAO) CreateGroup

func (this *ServerGroupDAO) CreateGroup(tx *dbs.Tx, name string, userId int64) (groupId int64, err error)

CreateGroup 创建分组

func (*ServerGroupDAO) DisableServerGroup

func (this *ServerGroupDAO) DisableServerGroup(tx *dbs.Tx, id int64) error

DisableServerGroup 禁用条目

func (*ServerGroupDAO) EnableServerGroup

func (this *ServerGroupDAO) EnableServerGroup(tx *dbs.Tx, id int64) error

EnableServerGroup 启用条目

func (*ServerGroupDAO) ExistsGroup added in v0.4.9

func (this *ServerGroupDAO) ExistsGroup(tx *dbs.Tx, groupId int64) (bool, error)

ExistsGroup 检查分组ID是否存在

func (*ServerGroupDAO) FindAllEnabledGroups

func (this *ServerGroupDAO) FindAllEnabledGroups(tx *dbs.Tx, userId int64) (result []*ServerGroup, err error)

FindAllEnabledGroups 查找所有分组

func (*ServerGroupDAO) FindEnabledGroupIdWithReverseProxyId

func (this *ServerGroupDAO) FindEnabledGroupIdWithReverseProxyId(tx *dbs.Tx, reverseProxyId int64) (serverId int64, err error)

FindEnabledGroupIdWithReverseProxyId 查找包含某个反向代理的服务分组

func (*ServerGroupDAO) FindEnabledGroupIdWithWebId

func (this *ServerGroupDAO) FindEnabledGroupIdWithWebId(tx *dbs.Tx, webId int64) (int64, error)

FindEnabledGroupIdWithWebId 根据WebId查找分组

func (*ServerGroupDAO) FindEnabledServerGroup

func (this *ServerGroupDAO) FindEnabledServerGroup(tx *dbs.Tx, id int64) (*ServerGroup, error)

FindEnabledServerGroup 查找启用中的条目

func (*ServerGroupDAO) FindGroupUserId added in v1.0.0

func (this *ServerGroupDAO) FindGroupUserId(tx *dbs.Tx, groupId int64) (userId int64, err error)

FindGroupUserId 读取分组所属用户

func (*ServerGroupDAO) FindGroupWebId

func (this *ServerGroupDAO) FindGroupWebId(tx *dbs.Tx, groupId int64) (webId int64, err error)

FindGroupWebId 查找分组WebId

func (*ServerGroupDAO) FindHTTPReverseProxyRef

func (this *ServerGroupDAO) FindHTTPReverseProxyRef(tx *dbs.Tx, groupId int64) (*serverconfigs.ReverseProxyRef, error)

FindHTTPReverseProxyRef 根据条件获取HTTP反向代理配置

func (*ServerGroupDAO) FindServerGroupName

func (this *ServerGroupDAO) FindServerGroupName(tx *dbs.Tx, id int64) (string, error)

FindServerGroupName 根据主键查找名称

func (*ServerGroupDAO) FindTCPReverseProxyRef

func (this *ServerGroupDAO) FindTCPReverseProxyRef(tx *dbs.Tx, groupId int64) (*serverconfigs.ReverseProxyRef, error)

FindTCPReverseProxyRef 根据条件获取TCP反向代理配置

func (*ServerGroupDAO) FindUDPReverseProxyRef

func (this *ServerGroupDAO) FindUDPReverseProxyRef(tx *dbs.Tx, groupId int64) (*serverconfigs.ReverseProxyRef, error)

FindUDPReverseProxyRef 根据条件获取UDP反向代理配置

func (*ServerGroupDAO) InitGroupWeb

func (this *ServerGroupDAO) InitGroupWeb(tx *dbs.Tx, groupId int64) (int64, error)

InitGroupWeb 初始化Web配置

func (*ServerGroupDAO) NotifyUpdate

func (this *ServerGroupDAO) NotifyUpdate(tx *dbs.Tx, groupId int64) error

NotifyUpdate 通知更新

func (*ServerGroupDAO) UpdateGroup

func (this *ServerGroupDAO) UpdateGroup(tx *dbs.Tx, groupId int64, name string) error

UpdateGroup 修改分组

func (*ServerGroupDAO) UpdateGroupOrders

func (this *ServerGroupDAO) UpdateGroupOrders(tx *dbs.Tx, groupIds []int64, userId int64) error

UpdateGroupOrders 修改分组排序

func (*ServerGroupDAO) UpdateHTTPReverseProxy

func (this *ServerGroupDAO) UpdateHTTPReverseProxy(tx *dbs.Tx, groupId int64, config []byte) error

UpdateHTTPReverseProxy 修改HTTP反向代理配置

func (*ServerGroupDAO) UpdateTCPReverseProxy

func (this *ServerGroupDAO) UpdateTCPReverseProxy(tx *dbs.Tx, groupId int64, config []byte) error

UpdateTCPReverseProxy 修改TCP反向代理配置

func (*ServerGroupDAO) UpdateUDPReverseProxy

func (this *ServerGroupDAO) UpdateUDPReverseProxy(tx *dbs.Tx, groupId int64, config []byte) error

UpdateUDPReverseProxy 修改UDP反向代理配置

type ServerGroupOperator

type ServerGroupOperator struct {
	Id               interface{} // ID
	AdminId          interface{} // 管理员ID
	UserId           interface{} // 用户ID
	IsOn             interface{} // 是否启用
	Name             interface{} // 名称
	Order            interface{} // 排序
	CreatedAt        interface{} // 创建时间
	State            interface{} // 状态
	HttpReverseProxy interface{} // 反向代理设置
	TcpReverseProxy  interface{} // TCP反向代理
	UdpReverseProxy  interface{} // UDP反向代理
	WebId            interface{} // Web配置ID
}

func NewServerGroupOperator

func NewServerGroupOperator() *ServerGroupOperator

type ServerOperator

type ServerOperator struct {
	Id                  any // ID
	IsOn                any // 是否启用
	UserId              any // 用户ID
	AdminId             any // 管理员ID
	Type                any // 服务类型
	Name                any // 名称
	Description         any // 描述
	PlainServerNames    any // 扁平化域名列表
	ServerNames         any // 域名列表
	AuditingAt          any // 审核提交时间
	AuditingServerNames any // 审核中的域名
	IsAuditing          any // 是否正在审核
	AuditingResult      any // 审核结果
	Http                any // HTTP配置
	Https               any // HTTPS配置
	Tcp                 any // TCP配置
	Tls                 any // TLS配置
	Unix                any // Unix配置
	Udp                 any // UDP配置
	WebId               any // WEB配置
	ReverseProxy        any // 反向代理配置
	GroupIds            any // 分组ID列表
	Config              any // 服务配置,自动生成
	ConfigMd5           any // Md5
	ClusterId           any // 集群ID
	IncludeNodes        any // 部署条件
	ExcludeNodes        any // 节点排除条件
	Version             any // 版本号
	CreatedAt           any // 创建时间
	State               any // 状态
	DnsName             any // DNS名称
	TcpPorts            any // 所包含TCP端口
	UdpPorts            any // 所包含UDP端口
	SupportCNAME        any // 允许CNAME不在域名名单
	TrafficLimit        any // 流量限制
	TrafficDay          any // YYYYMMDD
	TrafficMonth        any // YYYYMM
	TotalDailyTraffic   any // 日流量
	TotalMonthlyTraffic any // 月流量
	TrafficLimitStatus  any // 流量限制状态
	TotalTraffic        any // 总流量
	UserPlanId          any // 所属套餐ID
	LastUserPlanId      any // 上一次使用的套餐
	Uam                 any // UAM设置
	BandwidthTime       any // 带宽更新时间,YYYYMMDDHHII
	BandwidthBytes      any // 最近带宽峰值
	CountAttackRequests any // 最近攻击请求数
	CountRequests       any // 最近总请求数
}

func NewServerOperator

func NewServerOperator() *ServerOperator

type ServerStatBoard

type ServerStatBoard struct {
	Id        uint64 `field:"id"`        // ID
	Name      string `field:"name"`      // 名称
	ClusterId uint32 `field:"clusterId"` // 集群ID
	IsOn      bool   `field:"isOn"`      // 是否启用
	Order     uint32 `field:"order"`     // 排序
	State     uint8  `field:"state"`     // 状态
}

ServerStatBoard 服务统计看板

type ServerStatBoardChart

type ServerStatBoardChart struct {
	Id      uint64 `field:"id"`      // ID
	BoardId uint64 `field:"boardId"` // 看板ID
	Code    string `field:"code"`    // 内置图表代码
	ItemId  uint32 `field:"itemId"`  // 指标ID
	ChartId uint32 `field:"chartId"` // 图表ID
	Order   uint32 `field:"order"`   // 排序
	State   uint8  `field:"state"`   // 状态
}

ServerStatBoardChart 服务看板中的图表

type ServerStatBoardChartDAO

type ServerStatBoardChartDAO dbs.DAO
var SharedServerStatBoardChartDAO *ServerStatBoardChartDAO

func NewServerStatBoardChartDAO

func NewServerStatBoardChartDAO() *ServerStatBoardChartDAO

func (*ServerStatBoardChartDAO) DisableChart

func (this *ServerStatBoardChartDAO) DisableChart(tx *dbs.Tx, boardId int64, chartId int64) error

DisableChart 禁用图表

func (*ServerStatBoardChartDAO) DisableServerStatBoardChart

func (this *ServerStatBoardChartDAO) DisableServerStatBoardChart(tx *dbs.Tx, id uint64) error

DisableServerStatBoardChart 禁用条目

func (*ServerStatBoardChartDAO) EnableChart

func (this *ServerStatBoardChartDAO) EnableChart(tx *dbs.Tx, boardId int64, chartId int64) error

EnableChart 启用图表

func (*ServerStatBoardChartDAO) EnableServerStatBoardChart

func (this *ServerStatBoardChartDAO) EnableServerStatBoardChart(tx *dbs.Tx, id uint64) error

EnableServerStatBoardChart 启用条目

func (*ServerStatBoardChartDAO) FindAllEnabledCharts

func (this *ServerStatBoardChartDAO) FindAllEnabledCharts(tx *dbs.Tx, boardId int64) (result []*ServerStatBoardChart, err error)

FindAllEnabledCharts 查找看板中所有图表

func (*ServerStatBoardChartDAO) FindEnabledServerStatBoardChart

func (this *ServerStatBoardChartDAO) FindEnabledServerStatBoardChart(tx *dbs.Tx, id uint64) (*ServerStatBoardChart, error)

FindEnabledServerStatBoardChart 查找启用中的条目

type ServerStatBoardChartOperator

type ServerStatBoardChartOperator struct {
	Id      interface{} // ID
	BoardId interface{} // 看板ID
	Code    interface{} // 内置图表代码
	ItemId  interface{} // 指标ID
	ChartId interface{} // 图表ID
	Order   interface{} // 排序
	State   interface{} // 状态
}

func NewServerStatBoardChartOperator

func NewServerStatBoardChartOperator() *ServerStatBoardChartOperator

type ServerStatBoardDAO

type ServerStatBoardDAO dbs.DAO
var SharedServerStatBoardDAO *ServerStatBoardDAO

func NewServerStatBoardDAO

func NewServerStatBoardDAO() *ServerStatBoardDAO

func (*ServerStatBoardDAO) DisableServerStatBoard

func (this *ServerStatBoardDAO) DisableServerStatBoard(tx *dbs.Tx, id uint64) error

DisableServerStatBoard 禁用条目

func (*ServerStatBoardDAO) EnableServerStatBoard

func (this *ServerStatBoardDAO) EnableServerStatBoard(tx *dbs.Tx, id uint64) error

EnableServerStatBoard 启用条目

func (*ServerStatBoardDAO) FindAllEnabledBoards

func (this *ServerStatBoardDAO) FindAllEnabledBoards(tx *dbs.Tx, clusterId int64) (result []*ServerStatBoard, err error)

FindAllEnabledBoards 查找看板

func (*ServerStatBoardDAO) FindEnabledServerStatBoard

func (this *ServerStatBoardDAO) FindEnabledServerStatBoard(tx *dbs.Tx, id uint64) (*ServerStatBoard, error)

FindEnabledServerStatBoard 查找启用中的条目

func (*ServerStatBoardDAO) FindServerStatBoardName

func (this *ServerStatBoardDAO) FindServerStatBoardName(tx *dbs.Tx, id uint64) (string, error)

FindServerStatBoardName 根据主键查找名称

type ServerStatBoardOperator

type ServerStatBoardOperator struct {
	Id        interface{} // ID
	Name      interface{} // 名称
	ClusterId interface{} // 集群ID
	IsOn      interface{} // 是否启用
	Order     interface{} // 排序
	State     interface{} // 状态
}

func NewServerStatBoardOperator

func NewServerStatBoardOperator() *ServerStatBoardOperator

type SubUser

type SubUser struct {
	Id       uint32 `field:"id"`       // ID
	UserId   uint32 `field:"userId"`   // 所属主用户ID
	IsOn     bool   `field:"isOn"`     // 是否启用
	Name     string `field:"name"`     // 名称
	Username string `field:"username"` // 用户名
	Password string `field:"password"` // 密码
	State    uint8  `field:"state"`    // 状态
}

SubUser 子用户

type SubUserDAO

type SubUserDAO dbs.DAO
var SharedSubUserDAO *SubUserDAO

func NewSubUserDAO

func NewSubUserDAO() *SubUserDAO

func (*SubUserDAO) DisableSubUser

func (this *SubUserDAO) DisableSubUser(tx *dbs.Tx, id uint32) error

禁用条目

func (*SubUserDAO) EnableSubUser

func (this *SubUserDAO) EnableSubUser(tx *dbs.Tx, id uint32) error

启用条目

func (*SubUserDAO) FindEnabledSubUser

func (this *SubUserDAO) FindEnabledSubUser(tx *dbs.Tx, id uint32) (*SubUser, error)

查找启用中的条目

func (*SubUserDAO) FindSubUserName

func (this *SubUserDAO) FindSubUserName(tx *dbs.Tx, id uint32) (string, error)

根据主键查找名称

type SubUserOperator

type SubUserOperator struct {
	Id       interface{} // ID
	UserId   interface{} // 所属主用户ID
	IsOn     interface{} // 是否启用
	Name     interface{} // 名称
	Username interface{} // 用户名
	Password interface{} // 密码
	State    interface{} // 状态
}

func NewSubUserOperator

func NewSubUserOperator() *SubUserOperator

type SysEvent

type SysEvent struct {
	Id        uint64   `field:"id"`        // ID
	Type      string   `field:"type"`      // 类型
	Params    dbs.JSON `field:"params"`    // 参数
	CreatedAt uint64   `field:"createdAt"` // 创建时间
}

SysEvent 系统事件

func (*SysEvent) DecodeEvent

func (this *SysEvent) DecodeEvent() (EventInterface, error)

DecodeEvent 解码事件

type SysEventDAO

type SysEventDAO dbs.DAO
var SharedSysEventDAO *SysEventDAO

func NewSysEventDAO

func NewSysEventDAO() *SysEventDAO

func (*SysEventDAO) CreateEvent

func (this *SysEventDAO) CreateEvent(tx *dbs.Tx, event EventInterface) error

创建事件

func (*SysEventDAO) DeleteEvent

func (this *SysEventDAO) DeleteEvent(tx *dbs.Tx, eventId int64) error

删除事件

func (*SysEventDAO) FindEvents

func (this *SysEventDAO) FindEvents(tx *dbs.Tx, size int64) (result []*SysEvent, err error)

查找事件

type SysEventOperator

type SysEventOperator struct {
	Id        interface{} // ID
	Type      interface{} // 类型
	Params    interface{} // 参数
	CreatedAt interface{} // 创建时间
}

func NewSysEventOperator

func NewSysEventOperator() *SysEventOperator

type SysLocker

type SysLocker struct {
	Id        uint64 `field:"id"`        // ID
	Key       string `field:"key"`       // 键值
	Version   uint64 `field:"version"`   // 版本号
	TimeoutAt uint64 `field:"timeoutAt"` // 超时时间
}

并发锁

type SysLockerDAO

type SysLockerDAO dbs.DAO
var SharedSysLockerDAO *SysLockerDAO

func NewSysLockerDAO

func NewSysLockerDAO() *SysLockerDAO

func (*SysLockerDAO) Increase

func (this *SysLockerDAO) Increase(tx *dbs.Tx, key string, defaultValue int64) (int64, error)

Increase 增加版本号

func (*SysLockerDAO) Lock

func (this *SysLockerDAO) Lock(tx *dbs.Tx, key string, timeout int64) (ok bool, err error)

Lock 开锁

func (*SysLockerDAO) Read added in v0.5.6

func (this *SysLockerDAO) Read(tx *dbs.Tx, key string) (int64, error)

读取当前版本号

func (*SysLockerDAO) Unlock

func (this *SysLockerDAO) Unlock(tx *dbs.Tx, key string) error

Unlock 解锁

type SysLockerIncrement added in v1.2.3

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

func NewSysLockerIncrement added in v1.2.3

func NewSysLockerIncrement(size int) *SysLockerIncrement

func (*SysLockerIncrement) MaxValue added in v1.2.3

func (this *SysLockerIncrement) MaxValue(key string) int64

func (*SysLockerIncrement) Pop added in v1.2.3

func (this *SysLockerIncrement) Pop(key string) (result int64, ok bool)

func (*SysLockerIncrement) Push added in v1.2.3

func (this *SysLockerIncrement) Push(key string, minValue int64, maxValue int64)

type SysLockerIncrementItem added in v1.2.3

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

func NewSysLockerIncrementItem added in v1.2.3

func NewSysLockerIncrementItem(size int) *SysLockerIncrementItem

func (*SysLockerIncrementItem) MaxValue added in v1.2.3

func (this *SysLockerIncrementItem) MaxValue() int64

func (*SysLockerIncrementItem) Pop added in v1.2.3

func (this *SysLockerIncrementItem) Pop() (result int64, ok bool)

func (*SysLockerIncrementItem) Push added in v1.2.3

func (this *SysLockerIncrementItem) Push(value int64)

func (*SysLockerIncrementItem) Reset added in v1.2.3

func (this *SysLockerIncrementItem) Reset()

type SysLockerOperator

type SysLockerOperator struct {
	Id        interface{} // ID
	Key       interface{} // 键值
	Version   interface{} // 版本号
	TimeoutAt interface{} // 超时时间
}

func NewSysLockerOperator

func NewSysLockerOperator() *SysLockerOperator

type SysSetting

type SysSetting struct {
	Id     uint32   `field:"id"`     // ID
	UserId uint32   `field:"userId"` // 用户ID
	Code   string   `field:"code"`   // 代号
	Value  dbs.JSON `field:"value"`  // 配置值
}

SysSetting 系统配置

type SysSettingDAO

type SysSettingDAO dbs.DAO
var SharedSysSettingDAO *SysSettingDAO

func NewSysSettingDAO

func NewSysSettingDAO() *SysSettingDAO

func (*SysSettingDAO) CompareInt64Setting

func (this *SysSettingDAO) CompareInt64Setting(tx *dbs.Tx, code string, anotherValue int64) (int8, error)

CompareInt64Setting 对比配置中的数字大小

func (*SysSettingDAO) NotifyUpdate

func (this *SysSettingDAO) NotifyUpdate(tx *dbs.Tx, code string) error

NotifyUpdate 通知更改

func (*SysSettingDAO) ReadAdminUIConfig

func (this *SysSettingDAO) ReadAdminUIConfig(tx *dbs.Tx, cacheMap *utils.CacheMap) (*systemconfigs.AdminUIConfig, error)

ReadAdminUIConfig 读取管理员界面配置

func (*SysSettingDAO) ReadDatabaseConfig added in v1.2.1

func (this *SysSettingDAO) ReadDatabaseConfig(tx *dbs.Tx) (config *systemconfigs.DatabaseConfig, err error)

func (*SysSettingDAO) ReadProductName added in v0.6.0

func (this *SysSettingDAO) ReadProductName(tx *dbs.Tx) (string, error)

ReadProductName 读取设置的产品名称

func (*SysSettingDAO) ReadSetting

func (this *SysSettingDAO) ReadSetting(tx *dbs.Tx, code string, codeFormatArgs ...interface{}) (valueJSON []byte, err error)

ReadSetting 读取配置

func (*SysSettingDAO) ReadUserRegisterConfig added in v0.6.0

func (this *SysSettingDAO) ReadUserRegisterConfig(tx *dbs.Tx) (*userconfigs.UserRegisterConfig, error)

ReadUserRegisterConfig 读取用户注册配置

func (*SysSettingDAO) ReadUserServerConfig

func (this *SysSettingDAO) ReadUserServerConfig(tx *dbs.Tx) (*userconfigs.UserServerConfig, error)

ReadUserServerConfig 读取用户服务配置

func (*SysSettingDAO) ReadUserUIConfig added in v0.5.8

func (this *SysSettingDAO) ReadUserUIConfig(tx *dbs.Tx) (*systemconfigs.UserUIConfig, error)

ReadUserUIConfig 读取用户UI配置

func (*SysSettingDAO) UpdateSetting

func (this *SysSettingDAO) UpdateSetting(tx *dbs.Tx, codeFormat string, valueJSON []byte, codeFormatArgs ...interface{}) error

UpdateSetting 设置配置

type SysSettingOperator

type SysSettingOperator struct {
	Id     any // ID
	UserId any // 用户ID
	Code   any // 代号
	Value  any // 配置值
}

func NewSysSettingOperator

func NewSysSettingOperator() *SysSettingOperator

type TCPFirewallPolicy

type TCPFirewallPolicy struct {
	Id         uint32 `field:"id"`         // ID
	AdminId    int32  `field:"adminId"`    // 管理员ID
	UserId     uint32 `field:"userId"`     // 用户ID
	TemplateId uint32 `field:"templateId"` // 模版ID
}

TCP防火墙

type TCPFirewallPolicyDAO

type TCPFirewallPolicyDAO dbs.DAO
var SharedTCPFirewallPolicyDAO *TCPFirewallPolicyDAO

func NewTCPFirewallPolicyDAO

func NewTCPFirewallPolicyDAO() *TCPFirewallPolicyDAO

func (*TCPFirewallPolicyDAO) Init

func (this *TCPFirewallPolicyDAO) Init()

初始化

type TCPFirewallPolicyOperator

type TCPFirewallPolicyOperator struct {
	Id         interface{} // ID
	AdminId    interface{} // 管理员ID
	UserId     interface{} // 用户ID
	TemplateId interface{} // 模版ID
}

func NewTCPFirewallPolicyOperator

func NewTCPFirewallPolicyOperator() *TCPFirewallPolicyOperator

type TrafficPackage added in v0.5.6

type TrafficPackage struct {
	Id    uint32 `field:"id"`    // ID
	Size  uint32 `field:"size"`  // 尺寸
	Unit  string `field:"unit"`  // 单位(gb|tb等)
	Bytes uint64 `field:"bytes"` // 字节
	IsOn  bool   `field:"isOn"`  // 是否启用
	State uint8  `field:"state"` // 状态
}

TrafficPackage 流量包

type TrafficPackageDAO added in v0.5.6

type TrafficPackageDAO dbs.DAO
var SharedTrafficPackageDAO *TrafficPackageDAO

func NewTrafficPackageDAO added in v0.5.6

func NewTrafficPackageDAO() *TrafficPackageDAO

func (*TrafficPackageDAO) DisableTrafficPackage added in v0.5.6

func (this *TrafficPackageDAO) DisableTrafficPackage(tx *dbs.Tx, id int64) error

DisableTrafficPackage 禁用条目

func (*TrafficPackageDAO) EnableTrafficPackage added in v0.5.6

func (this *TrafficPackageDAO) EnableTrafficPackage(tx *dbs.Tx, id uint32) error

EnableTrafficPackage 启用条目

func (*TrafficPackageDAO) FindEnabledTrafficPackage added in v0.5.6

func (this *TrafficPackageDAO) FindEnabledTrafficPackage(tx *dbs.Tx, id int64) (*TrafficPackage, error)

FindEnabledTrafficPackage 查找启用中的条目

type TrafficPackageOperator added in v0.5.6

type TrafficPackageOperator struct {
	Id    any // ID
	Size  any // 尺寸
	Unit  any // 单位(gb|tb等)
	Bytes any // 字节
	IsOn  any // 是否启用
	State any // 状态
}

func NewTrafficPackageOperator added in v0.5.6

func NewTrafficPackageOperator() *TrafficPackageOperator

type TrafficPackagePeriod added in v0.5.6

type TrafficPackagePeriod struct {
	Id     uint32 `field:"id"`     // ID
	IsOn   bool   `field:"isOn"`   // 是否启用
	Count  uint32 `field:"count"`  // 数量
	Unit   string `field:"unit"`   // 单位:month, year
	Months uint32 `field:"months"` // 月数
	State  uint8  `field:"state"`  // 状态
}

TrafficPackagePeriod 流量包有效期

type TrafficPackagePeriodDAO added in v0.5.6

type TrafficPackagePeriodDAO dbs.DAO
var SharedTrafficPackagePeriodDAO *TrafficPackagePeriodDAO

func NewTrafficPackagePeriodDAO added in v0.5.6

func NewTrafficPackagePeriodDAO() *TrafficPackagePeriodDAO

func (*TrafficPackagePeriodDAO) DisableTrafficPackagePeriod added in v0.5.6

func (this *TrafficPackagePeriodDAO) DisableTrafficPackagePeriod(tx *dbs.Tx, id int64) error

DisableTrafficPackagePeriod 禁用条目

func (*TrafficPackagePeriodDAO) EnableTrafficPackagePeriod added in v0.5.6

func (this *TrafficPackagePeriodDAO) EnableTrafficPackagePeriod(tx *dbs.Tx, id int64) error

EnableTrafficPackagePeriod 启用条目

func (*TrafficPackagePeriodDAO) FindEnabledTrafficPackagePeriod added in v0.5.6

func (this *TrafficPackagePeriodDAO) FindEnabledTrafficPackagePeriod(tx *dbs.Tx, id int64) (*TrafficPackagePeriod, error)

FindEnabledTrafficPackagePeriod 查找启用中的条目

type TrafficPackagePeriodOperator added in v0.5.6

type TrafficPackagePeriodOperator struct {
	Id     any // ID
	IsOn   any // 是否启用
	Count  any // 数量
	Unit   any // 单位:month, year
	Months any // 月数
	State  any // 状态
}

func NewTrafficPackagePeriodOperator added in v0.5.6

func NewTrafficPackagePeriodOperator() *TrafficPackagePeriodOperator

type TrafficPackagePrice added in v0.5.6

type TrafficPackagePrice struct {
	Id            uint32  `field:"id"`            // ID
	PackageId     uint32  `field:"packageId"`     // 套餐ID
	RegionId      uint32  `field:"regionId"`      // 区域ID
	PeriodId      uint32  `field:"periodId"`      // 有效期ID
	Price         float64 `field:"price"`         // 价格
	DiscountPrice float64 `field:"discountPrice"` // 折后价格
}

TrafficPackagePrice 流量包价格

type TrafficPackagePriceDAO added in v0.5.6

type TrafficPackagePriceDAO dbs.DAO
var SharedTrafficPackagePriceDAO *TrafficPackagePriceDAO

func NewTrafficPackagePriceDAO added in v0.5.6

func NewTrafficPackagePriceDAO() *TrafficPackagePriceDAO

type TrafficPackagePriceOperator added in v0.5.6

type TrafficPackagePriceOperator struct {
	Id            any // ID
	PackageId     any // 套餐ID
	RegionId      any // 区域ID
	PeriodId      any // 有效期ID
	Price         any // 价格
	DiscountPrice any // 折后价格
}

func NewTrafficPackagePriceOperator added in v0.5.6

func NewTrafficPackagePriceOperator() *TrafficPackagePriceOperator

type UpdatingServerList added in v1.0.0

type UpdatingServerList struct {
	Id        uint64   `field:"id"`        // ID
	ClusterId uint32   `field:"clusterId"` // 集群ID
	UniqueId  string   `field:"uniqueId"`  // 唯一ID
	ServerIds dbs.JSON `field:"serverIds"` // 服务IDs
	Day       string   `field:"day"`       // 创建日期
}

UpdatingServerList 待更新服务列表

func (*UpdatingServerList) DecodeServerIds added in v1.0.0

func (this *UpdatingServerList) DecodeServerIds() []int64

type UpdatingServerListDAO added in v1.0.0

type UpdatingServerListDAO dbs.DAO
var SharedUpdatingServerListDAO *UpdatingServerListDAO

func NewUpdatingServerListDAO added in v1.0.0

func NewUpdatingServerListDAO() *UpdatingServerListDAO

func (*UpdatingServerListDAO) CleanExpiredLists added in v1.0.0

func (this *UpdatingServerListDAO) CleanExpiredLists(tx *dbs.Tx, days int) error

CleanExpiredLists 清除过期列表

func (*UpdatingServerListDAO) CreateList added in v1.0.0

func (this *UpdatingServerListDAO) CreateList(tx *dbs.Tx, clusterId int64, serverIds []int64) error

CreateList 创建待更新的服务列表

func (*UpdatingServerListDAO) FindLatestId added in v1.0.0

func (this *UpdatingServerListDAO) FindLatestId(tx *dbs.Tx) (int64, error)

FindLatestId 读取最新的ID 不需要区分集群

func (*UpdatingServerListDAO) FindLists added in v1.0.0

func (this *UpdatingServerListDAO) FindLists(tx *dbs.Tx, clusterIds []int64, lastId int64) (result []*UpdatingServerList, err error)

FindLists 查找待更新服务列表

type UpdatingServerListOperator added in v1.0.0

type UpdatingServerListOperator struct {
	Id        any // ID
	ClusterId any // 集群ID
	UniqueId  any // 唯一ID
	ServerIds any // 服务IDs
	Day       any // 创建日期
}

func NewUpdatingServerListOperator added in v1.0.0

func NewUpdatingServerListOperator() *UpdatingServerListOperator

type User

type User struct {
	Id                uint32   `field:"id"`                // ID
	IsOn              bool     `field:"isOn"`              // 是否启用
	Username          string   `field:"username"`          // 用户名
	Password          string   `field:"password"`          // 密码
	Fullname          string   `field:"fullname"`          // 真实姓名
	Mobile            string   `field:"mobile"`            // 手机号
	VerifiedMobile    string   `field:"verifiedMobile"`    // 已验证手机号
	MobileIsVerified  uint8    `field:"mobileIsVerified"`  // 手机号是否已验证
	Tel               string   `field:"tel"`               // 联系电话
	Remark            string   `field:"remark"`            // 备注
	Email             string   `field:"email"`             // 邮箱地址
	VerifiedEmail     string   `field:"verifiedEmail"`     // 激活后的邮箱
	EmailIsVerified   uint8    `field:"emailIsVerified"`   // 邮箱是否已验证
	AvatarFileId      uint64   `field:"avatarFileId"`      // 头像文件ID
	CreatedAt         uint64   `field:"createdAt"`         // 创建时间
	Day               string   `field:"day"`               // YYYYMMDD
	UpdatedAt         uint64   `field:"updatedAt"`         // 修改时间
	State             uint8    `field:"state"`             // 状态
	Source            string   `field:"source"`            // 来源
	ClusterId         uint32   `field:"clusterId"`         // 集群ID
	Features          dbs.JSON `field:"features"`          // 允许操作的特征
	RegisteredIP      string   `field:"registeredIP"`      // 注册使用的IP
	IsRejected        bool     `field:"isRejected"`        // 是否已拒绝
	RejectReason      string   `field:"rejectReason"`      // 拒绝理由
	IsVerified        bool     `field:"isVerified"`        // 是否验证通过
	RequirePlans      uint8    `field:"requirePlans"`      // 是否需要购买套餐
	Modules           dbs.JSON `field:"modules"`           // 用户模块
	PriceType         string   `field:"priceType"`         // 计费类型:traffic|bandwidth
	PricePeriod       string   `field:"pricePeriod"`       // 结算周期
	ServersEnabled    uint8    `field:"serversEnabled"`    // 是否禁用所有服务
	Notification      dbs.JSON `field:"notification"`      // 通知设置
	BandwidthAlgo     string   `field:"bandwidthAlgo"`     // 带宽算法
	BandwidthModifier float64  `field:"bandwidthModifier"` // 带宽修正值
	Lang              string   `field:"lang"`              // 语言代号
}

User 用户

func (*User) DecodeModules added in v0.5.3

func (this *User) DecodeModules() []string

DecodeModules 解析模块

type UserADInstance added in v0.6.4

type UserADInstance struct {
	Id          uint64   `field:"id"`          // ID
	AdminId     uint32   `field:"adminId"`     // 管理员ID
	UserId      uint64   `field:"userId"`      // 用户ID
	InstanceId  uint32   `field:"instanceId"`  // 高防实例ID
	PeriodId    uint32   `field:"periodId"`    // 有效期
	PeriodCount uint32   `field:"periodCount"` // 有效期数量
	PeriodUnit  string   `field:"periodUnit"`  // 有效期单位
	DayFrom     string   `field:"dayFrom"`     // 开始日期
	DayTo       string   `field:"dayTo"`       // 结束日期
	MaxObjects  uint32   `field:"maxObjects"`  // 最多防护对象数
	ObjectCodes dbs.JSON `field:"objectCodes"` // 防护对象
	CreatedAt   uint64   `field:"createdAt"`   // 创建时间
	State       uint8    `field:"state"`       // 状态
}

UserADInstance 高防实例

type UserADInstanceDAO added in v0.6.4

type UserADInstanceDAO dbs.DAO
var SharedUserADInstanceDAO *UserADInstanceDAO

func NewUserADInstanceDAO added in v0.6.4

func NewUserADInstanceDAO() *UserADInstanceDAO

func (*UserADInstanceDAO) EnableUserADInstance added in v0.6.4

func (this *UserADInstanceDAO) EnableUserADInstance(tx *dbs.Tx, id uint64) error

EnableUserADInstance 启用条目

type UserADInstanceOperator added in v0.6.4

type UserADInstanceOperator struct {
	Id          any // ID
	AdminId     any // 管理员ID
	UserId      any // 用户ID
	InstanceId  any // 高防实例ID
	PeriodId    any // 有效期
	PeriodCount any // 有效期数量
	PeriodUnit  any // 有效期单位
	DayFrom     any // 开始日期
	DayTo       any // 结束日期
	MaxObjects  any // 最多防护对象数
	ObjectCodes any // 防护对象
	CreatedAt   any // 创建时间
	State       any // 状态
}

func NewUserADInstanceOperator added in v0.6.4

func NewUserADInstanceOperator() *UserADInstanceOperator

type UserAccessKey

type UserAccessKey struct {
	Id          uint32 `field:"id"`          // ID
	AdminId     uint32 `field:"adminId"`     // 管理员ID
	UserId      uint32 `field:"userId"`      // 用户ID
	SubUserId   uint32 `field:"subUserId"`   // 子用户ID
	IsOn        bool   `field:"isOn"`        // 是否启用
	UniqueId    string `field:"uniqueId"`    // 唯一的Key
	Secret      string `field:"secret"`      // 密钥
	Description string `field:"description"` // 备注
	AccessedAt  uint64 `field:"accessedAt"`  // 最近一次访问时间
	State       uint8  `field:"state"`       // 状态
}

UserAccessKey AccessKey

type UserAccessKeyDAO

type UserAccessKeyDAO dbs.DAO
var SharedUserAccessKeyDAO *UserAccessKeyDAO

func NewUserAccessKeyDAO

func NewUserAccessKeyDAO() *UserAccessKeyDAO

func (*UserAccessKeyDAO) CheckUserAccessKey

func (this *UserAccessKeyDAO) CheckUserAccessKey(tx *dbs.Tx, adminId int64, userId int64, accessKeyId int64) (bool, error)

CheckUserAccessKey 检查用户的AccessKey

func (*UserAccessKeyDAO) CountAllEnabledAccessKeys

func (this *UserAccessKeyDAO) CountAllEnabledAccessKeys(tx *dbs.Tx, adminId int64, userId int64) (int64, error)

CountAllEnabledAccessKeys 计算可用AccessKey数量

func (*UserAccessKeyDAO) CreateAccessKey

func (this *UserAccessKeyDAO) CreateAccessKey(tx *dbs.Tx, adminId int64, userId int64, description string) (int64, error)

CreateAccessKey 创建Key

func (*UserAccessKeyDAO) DisableUserAccessKey

func (this *UserAccessKeyDAO) DisableUserAccessKey(tx *dbs.Tx, id int64) error

DisableUserAccessKey 禁用条目

func (*UserAccessKeyDAO) EnableUserAccessKey

func (this *UserAccessKeyDAO) EnableUserAccessKey(tx *dbs.Tx, id int64) error

EnableUserAccessKey 启用条目

func (*UserAccessKeyDAO) FindAccessKeyWithUniqueId

func (this *UserAccessKeyDAO) FindAccessKeyWithUniqueId(tx *dbs.Tx, uniqueId string) (*UserAccessKey, error)

FindAccessKeyWithUniqueId 根据UniqueId查找AccessKey

func (*UserAccessKeyDAO) FindAllEnabledAccessKeys

func (this *UserAccessKeyDAO) FindAllEnabledAccessKeys(tx *dbs.Tx, adminId int64, userId int64) (result []*UserAccessKey, err error)

FindAllEnabledAccessKeys 查找用户所有的Key

func (*UserAccessKeyDAO) FindEnabledUserAccessKey

func (this *UserAccessKeyDAO) FindEnabledUserAccessKey(tx *dbs.Tx, id int64) (*UserAccessKey, error)

FindEnabledUserAccessKey 查找启用中的条目

func (*UserAccessKeyDAO) UpdateAccessKeyAccessedAt

func (this *UserAccessKeyDAO) UpdateAccessKeyAccessedAt(tx *dbs.Tx, accessKeyId int64) error

UpdateAccessKeyAccessedAt 更新AccessKey访问时间

func (*UserAccessKeyDAO) UpdateAccessKeyIsOn

func (this *UserAccessKeyDAO) UpdateAccessKeyIsOn(tx *dbs.Tx, accessKeyId int64, isOn bool) error

UpdateAccessKeyIsOn 设置是否启用

type UserAccessKeyOperator

type UserAccessKeyOperator struct {
	Id          interface{} // ID
	AdminId     interface{} // 管理员ID
	UserId      interface{} // 用户ID
	SubUserId   interface{} // 子用户ID
	IsOn        interface{} // 是否启用
	UniqueId    interface{} // 唯一的Key
	Secret      interface{} // 密钥
	Description interface{} // 备注
	AccessedAt  interface{} // 最近一次访问时间
	State       interface{} // 状态
}

func NewUserAccessKeyOperator

func NewUserAccessKeyOperator() *UserAccessKeyOperator

type UserBandwidthStat added in v0.4.9

type UserBandwidthStat struct {
	Id                  uint64 `field:"id"`                  // ID
	UserId              uint64 `field:"userId"`              // 用户ID
	RegionId            uint32 `field:"regionId"`            // 区域ID
	Day                 string `field:"day"`                 // 日期YYYYMMDD
	TimeAt              string `field:"timeAt"`              // 时间点HHII
	Bytes               uint64 `field:"bytes"`               // 带宽
	TotalBytes          uint64 `field:"totalBytes"`          // 总流量
	AvgBytes            uint64 `field:"avgBytes"`            // 平均流量
	CachedBytes         uint64 `field:"cachedBytes"`         // 缓存的流量
	AttackBytes         uint64 `field:"attackBytes"`         // 攻击流量
	CountRequests       uint64 `field:"countRequests"`       // 请求数
	CountCachedRequests uint64 `field:"countCachedRequests"` // 缓存的请求数
	CountAttackRequests uint64 `field:"countAttackRequests"` // 攻击请求数
}

UserBandwidthStat 用户月带宽峰值

type UserBandwidthStatDAO added in v0.4.9

type UserBandwidthStatDAO dbs.DAO
var SharedUserBandwidthStatDAO *UserBandwidthStatDAO

func NewUserBandwidthStatDAO added in v0.4.9

func NewUserBandwidthStatDAO() *UserBandwidthStatDAO

func (*UserBandwidthStatDAO) CleanDays added in v1.2.1

func (this *UserBandwidthStatDAO) CleanDays(tx *dbs.Tx, days int) error

CleanDays 清理过期数据

func (*UserBandwidthStatDAO) CleanDefaultDays added in v1.2.1

func (this *UserBandwidthStatDAO) CleanDefaultDays(tx *dbs.Tx, defaultDays int) error

func (*UserBandwidthStatDAO) FindDistinctUserIds added in v0.5.6

func (this *UserBandwidthStatDAO) FindDistinctUserIds(tx *dbs.Tx, dayFrom string, dayTo string) (userIds []int64, err error)

FindDistinctUserIds 获取所有有带宽的用户ID dayFrom YYYYMMDD dayTo YYYYMMDD

func (*UserBandwidthStatDAO) FindPercentileBetweenDays added in v0.5.6

func (this *UserBandwidthStatDAO) FindPercentileBetweenDays(tx *dbs.Tx, userId int64, regionId int64, dayFrom string, dayTo string, percentile int32, useAvg bool) (result *UserBandwidthStat, err error)

FindPercentileBetweenDays 获取日期段内内百分位 regionId 如果为 -1 表示没有区域的带宽;如果为 0 表示所有区域的带宽

func (*UserBandwidthStatDAO) FindUserBandwidthStatsBetweenDays added in v0.5.6

func (this *UserBandwidthStatDAO) FindUserBandwidthStatsBetweenDays(tx *dbs.Tx, userId int64, regionId int64, dayFrom string, dayTo string, useAvg bool) (result []*pb.FindDailyServerBandwidthStatsBetweenDaysResponse_Stat, err error)

FindUserBandwidthStatsBetweenDays 查找日期段内的带宽峰值 dayFrom YYYYMMDD dayTo YYYYMMDD

func (*UserBandwidthStatDAO) FindUserPeekBandwidthInDay added in v0.4.9

func (this *UserBandwidthStatDAO) FindUserPeekBandwidthInDay(tx *dbs.Tx, userId int64, day string, useAvg bool) (*UserBandwidthStat, error)

FindUserPeekBandwidthInDay 读取某日带宽峰值 day YYYYMMDD

func (*UserBandwidthStatDAO) FindUserPeekBandwidthInMonth added in v0.4.9

func (this *UserBandwidthStatDAO) FindUserPeekBandwidthInMonth(tx *dbs.Tx, userId int64, month string, useAvg bool) (*UserBandwidthStat, error)

FindUserPeekBandwidthInMonth 读取某月带宽峰值 month YYYYMM

func (*UserBandwidthStatDAO) HasFullData added in v1.0.0

func (this *UserBandwidthStatDAO) HasFullData(tx *dbs.Tx, userId int64, month string) (bool, error)

HasFullData 检查一个月是否完整数据 是为了兼容以前数据,以前的表中没有缓存流量、请求数等字段

func (*UserBandwidthStatDAO) SumDailyStat added in v1.0.0

func (this *UserBandwidthStatDAO) SumDailyStat(tx *dbs.Tx, userId int64, regionId int64, dayFrom string, dayTo string) (stat *pb.ServerDailyStat, err error)

SumDailyStat 获取某天内的流量 dayFrom 格式为YYYYMMDD dayTo 格式为YYYYMMDD

func (*UserBandwidthStatDAO) SumUserDaily added in v1.0.0

func (this *UserBandwidthStatDAO) SumUserDaily(tx *dbs.Tx, userId int64, regionId int64, day string) (stat *UserBandwidthStat, err error)

SumUserDaily 获取某天流量总和 day 格式为YYYYMMDD

func (*UserBandwidthStatDAO) SumUserMonthly added in v1.0.0

func (this *UserBandwidthStatDAO) SumUserMonthly(tx *dbs.Tx, userId int64, month string) (int64, error)

SumUserMonthly 获取某月流量总和 month 格式为YYYYMM

func (*UserBandwidthStatDAO) UpdateUserBandwidth added in v0.4.9

func (this *UserBandwidthStatDAO) UpdateUserBandwidth(tx *dbs.Tx, userId int64, regionId int64, day string, timeAt string, bytes int64, totalBytes int64, cachedBytes int64, attackBytes int64, countRequests int64, countCachedRequests int64, countAttackRequests int64) error

UpdateUserBandwidth 写入数据

type UserBandwidthStatOperator added in v0.4.9

type UserBandwidthStatOperator struct {
	Id                  any // ID
	UserId              any // 用户ID
	RegionId            any // 区域ID
	Day                 any // 日期YYYYMMDD
	TimeAt              any // 时间点HHII
	Bytes               any // 带宽
	TotalBytes          any // 总流量
	AvgBytes            any // 平均流量
	CachedBytes         any // 缓存的流量
	AttackBytes         any // 攻击流量
	CountRequests       any // 请求数
	CountCachedRequests any // 缓存的请求数
	CountAttackRequests any // 攻击请求数
}

func NewUserBandwidthStatOperator added in v0.4.9

func NewUserBandwidthStatOperator() *UserBandwidthStatOperator

type UserBill

type UserBill struct {
	Id          uint64  `field:"id"`          // ID
	UserId      uint32  `field:"userId"`      // 用户ID
	Type        string  `field:"type"`        // 消费类型
	PricePeriod string  `field:"pricePeriod"` // 计费周期
	Description string  `field:"description"` // 描述
	Amount      float64 `field:"amount"`      // 消费数额
	DayFrom     string  `field:"dayFrom"`     // YYYYMMDD
	DayTo       string  `field:"dayTo"`       // YYYYMMDD
	Month       string  `field:"month"`       // 帐期YYYYMM
	CanPay      bool    `field:"canPay"`      // 是否可以支付
	IsPaid      bool    `field:"isPaid"`      // 是否已支付
	PaidAt      uint64  `field:"paidAt"`      // 支付时间
	Code        string  `field:"code"`        // 账单编号
	CreatedAt   uint64  `field:"createdAt"`   // 创建时间
	CreatedDay  string  `field:"createdDay"`  // 创建日期
	State       uint8   `field:"state"`       // 状态
}

UserBill 用户账单

type UserBillDAO

type UserBillDAO dbs.DAO
var SharedUserBillDAO *UserBillDAO

func NewUserBillDAO

func NewUserBillDAO() *UserBillDAO

type UserBillOperator

type UserBillOperator struct {
	Id          any // ID
	UserId      any // 用户ID
	Type        any // 消费类型
	PricePeriod any // 计费周期
	Description any // 描述
	Amount      any // 消费数额
	DayFrom     any // YYYYMMDD
	DayTo       any // YYYYMMDD
	Month       any // 帐期YYYYMM
	CanPay      any // 是否可以支付
	IsPaid      any // 是否已支付
	PaidAt      any // 支付时间
	Code        any // 账单编号
	CreatedAt   any // 创建时间
	CreatedDay  any // 创建日期
	State       any // 状态
}

func NewUserBillOperator

func NewUserBillOperator() *UserBillOperator

type UserDAO

type UserDAO dbs.DAO
var SharedUserDAO *UserDAO

func NewUserDAO

func NewUserDAO() *UserDAO

func (*UserDAO) CheckUserEmailPassword added in v0.6.0

func (this *UserDAO) CheckUserEmailPassword(tx *dbs.Tx, verifiedEmail string, encryptedPassword string) (int64, error)

CheckUserEmailPassword 检查邮箱+密码

func (*UserDAO) CheckUserMobilePassword added in v1.3.0

func (this *UserDAO) CheckUserMobilePassword(tx *dbs.Tx, verifiedEmail string, encryptedPassword string) (int64, error)

CheckUserMobilePassword 检查邮箱+密码

func (*UserDAO) CheckUserPassword

func (this *UserDAO) CheckUserPassword(tx *dbs.Tx, username string, encryptedPassword string) (int64, error)

CheckUserPassword 检查用户名+密码

func (*UserDAO) CheckUserServersEnabled added in v0.5.6

func (this *UserDAO) CheckUserServersEnabled(tx *dbs.Tx, userId int64) (isEnabled bool, err error)

CheckUserServersEnabled 判断用户是否可用服务功能

func (*UserDAO) CountAllEnabledUsers

func (this *UserDAO) CountAllEnabledUsers(tx *dbs.Tx, clusterId int64, keyword string, isVerifying bool) (int64, error)

CountAllEnabledUsers 计算用户数量

func (*UserDAO) CountAllVerifyingUsers

func (this *UserDAO) CountAllVerifyingUsers(tx *dbs.Tx) (int64, error)

CountAllVerifyingUsers 获取等待审核的用户数

func (*UserDAO) CountDailyUsers

func (this *UserDAO) CountDailyUsers(tx *dbs.Tx, dayFrom string, dayTo string) ([]*pb.ComposeUserGlobalBoardResponse_DailyStat, error)

CountDailyUsers 计算每天用户数

func (*UserDAO) CreateUser

func (this *UserDAO) CreateUser(tx *dbs.Tx, username string,
	password string,
	fullname string,
	mobile string,
	tel string,
	email string,
	remark string,
	source string,
	clusterId int64,
	features []string,
	registeredIP string,
	isVerified bool) (int64, error)

CreateUser 创建用户

func (*UserDAO) DisableUser

func (this *UserDAO) DisableUser(tx *dbs.Tx, userId int64) error

DisableUser 禁用条目

func (*UserDAO) EnableUser

func (this *UserDAO) EnableUser(tx *dbs.Tx, userId int64) error

EnableUser 启用条目

func (*UserDAO) ExistUser

func (this *UserDAO) ExistUser(tx *dbs.Tx, userId int64, username string) (bool, error)

ExistUser 检查用户名是否存在

func (*UserDAO) FindBasicUserWithoutState

func (this *UserDAO) FindBasicUserWithoutState(tx *dbs.Tx, id int64) (*User, error)

FindBasicUserWithoutState 查找用户基本信息,并忽略状态

func (*UserDAO) FindEnabledBasicUser

func (this *UserDAO) FindEnabledBasicUser(tx *dbs.Tx, id int64) (*User, error)

FindEnabledBasicUser 查找用户基本信息

func (*UserDAO) FindEnabledUser

func (this *UserDAO) FindEnabledUser(tx *dbs.Tx, userId int64, cacheMap *utils.CacheMap) (*User, error)

FindEnabledUser 查找启用的用户

func (*UserDAO) FindEnabledUserIdWithUsername added in v0.4.10

func (this *UserDAO) FindEnabledUserIdWithUsername(tx *dbs.Tx, username string) (int64, error)

FindEnabledUserIdWithUsername 根据用户名查找用户ID

func (*UserDAO) FindUserBandwidthAlgoForView added in v0.6.4

func (this *UserDAO) FindUserBandwidthAlgoForView(tx *dbs.Tx, userId int64, uiConfig *systemconfigs.UserUIConfig) (bandwidthAlgo string, err error)

FindUserBandwidthAlgoForView 获取用户浏览用的带宽算法

func (*UserDAO) FindUserClusterId

func (this *UserDAO) FindUserClusterId(tx *dbs.Tx, userId int64) (int64, error)

FindUserClusterId 查找用户所在集群

func (*UserDAO) FindUserFeatures

func (this *UserDAO) FindUserFeatures(tx *dbs.Tx, userId int64) ([]*userconfigs.UserFeature, error)

FindUserFeatures 查找用户Features

func (*UserDAO) FindUserFullname

func (this *UserDAO) FindUserFullname(tx *dbs.Tx, userId int64) (string, error)

FindUserFullname 获取用户名称

func (*UserDAO) FindUserId added in v0.6.0

func (this *UserDAO) FindUserId(tx *dbs.Tx, verifiedEmail string, verifiedMobile string) (int64, error)

FindUserId 根据多个条件查找用户ID

func (*UserDAO) FindUserIdWithVerifiedEmail added in v0.6.0

func (this *UserDAO) FindUserIdWithVerifiedEmail(tx *dbs.Tx, verifiedEmail string) (int64, error)

FindUserIdWithVerifiedEmail 使用验证后Email查找用户ID

func (*UserDAO) FindUserIdWithVerifiedMobile added in v1.3.0

func (this *UserDAO) FindUserIdWithVerifiedMobile(tx *dbs.Tx, verifiedMobile string) (int64, error)

FindUserIdWithVerifiedMobile 使用验证后手机号码查找用户ID

func (*UserDAO) FindUserVerifiedEmail added in v0.6.0

func (this *UserDAO) FindUserVerifiedEmail(tx *dbs.Tx, userId int64) (string, error)

FindUserVerifiedEmail 查询用户已绑定邮箱

func (*UserDAO) ListEnabledUserIds

func (this *UserDAO) ListEnabledUserIds(tx *dbs.Tx, offset, size int64) ([]int64, error)

ListEnabledUserIds 列出单页的用户ID

func (*UserDAO) ListEnabledUsers

func (this *UserDAO) ListEnabledUsers(tx *dbs.Tx, clusterId int64, keyword string, isVerifying bool, offset int64, size int64) (result []*User, err error)

ListEnabledUsers 列出单页用户

func (*UserDAO) NotifyUpdate added in v0.5.6

func (this *UserDAO) NotifyUpdate(tx *dbs.Tx, userId int64) error

NotifyUpdate 用户变更通知

func (*UserDAO) RenewUserServersState added in v0.5.6

func (this *UserDAO) RenewUserServersState(tx *dbs.Tx, userId int64) (bool, error)

RenewUserServersState 更新用户服务状态

func (*UserDAO) SumDailyUsers

func (this *UserDAO) SumDailyUsers(tx *dbs.Tx, dayFrom string, dayTo string) (int64, error)

SumDailyUsers 获取当天用户数量

func (*UserDAO) UpdateUser

func (this *UserDAO) UpdateUser(tx *dbs.Tx, userId int64, username string, password string, fullname string, mobile string, tel string, email string, remark string, isOn bool, nodeClusterId int64, bandwidthAlgo systemconfigs.BandwidthAlgo) error

UpdateUser 修改用户

func (*UserDAO) UpdateUserFeatures

func (this *UserDAO) UpdateUserFeatures(tx *dbs.Tx, userId int64, featuresJSON []byte) error

UpdateUserFeatures 更新单个用户Features

func (*UserDAO) UpdateUserInfo

func (this *UserDAO) UpdateUserInfo(tx *dbs.Tx, userId int64, fullname string, mobile string, email string) error

UpdateUserInfo 修改用户基本信息

func (*UserDAO) UpdateUserIsVerified

func (this *UserDAO) UpdateUserIsVerified(tx *dbs.Tx, userId int64, isRejected bool, rejectReason string) error

UpdateUserIsVerified 审核用户

func (*UserDAO) UpdateUserLogin

func (this *UserDAO) UpdateUserLogin(tx *dbs.Tx, userId int64, username string, password string) error

UpdateUserLogin 修改用户登录信息

func (*UserDAO) UpdateUserPassword added in v0.6.0

func (this *UserDAO) UpdateUserPassword(tx *dbs.Tx, userId int64, password string) error

UpdateUserPassword 修改用户密码

func (*UserDAO) UpdateUserVerifiedEmail added in v0.6.0

func (this *UserDAO) UpdateUserVerifiedEmail(tx *dbs.Tx, userId int64, verifiedEmail string) error

UpdateUserVerifiedEmail 修改已激活邮箱

func (*UserDAO) UpdateUserVerifiedMobile added in v1.3.0

func (this *UserDAO) UpdateUserVerifiedMobile(tx *dbs.Tx, userId int64, verifiedMobile string) error

UpdateUserVerifiedMobile 修改已激活手机号码

func (*UserDAO) UpdateUsersFeatures added in v0.5.2

func (this *UserDAO) UpdateUsersFeatures(tx *dbs.Tx, featureCodes []string, overwrite bool) error

UpdateUsersFeatures 更新所有用户的Features

type UserEmailNotification added in v0.6.0

type UserEmailNotification struct {
	Id        uint64 `field:"id"`        // ID
	Email     string `field:"email"`     // 邮箱地址
	Subject   string `field:"subject"`   // 标题
	Body      string `field:"body"`      // 内容
	CreatedAt uint64 `field:"createdAt"` // 创建时间
	Day       string `field:"day"`       // YYYYMMDD
}

UserEmailNotification 邮件通知队列

type UserEmailNotificationDAO added in v0.6.0

type UserEmailNotificationDAO dbs.DAO
var SharedUserEmailNotificationDAO *UserEmailNotificationDAO

func NewUserEmailNotificationDAO added in v0.6.0

func NewUserEmailNotificationDAO() *UserEmailNotificationDAO

type UserEmailNotificationOperator added in v0.6.0

type UserEmailNotificationOperator struct {
	Id        any // ID
	Email     any // 邮箱地址
	Subject   any // 标题
	Body      any // 内容
	CreatedAt any // 创建时间
	Day       any // YYYYMMDD
}

func NewUserEmailNotificationOperator added in v0.6.0

func NewUserEmailNotificationOperator() *UserEmailNotificationOperator

type UserEmailVerification added in v0.6.0

type UserEmailVerification struct {
	Id         uint64 `field:"id"`         // ID
	Email      string `field:"email"`      // 邮箱
	UserId     uint64 `field:"userId"`     // 用户ID
	Code       string `field:"code"`       // 激活码
	CreatedAt  uint64 `field:"createdAt"`  // 创建时间
	IsSent     bool   `field:"isSent"`     // 是否已发送
	IsVerified bool   `field:"isVerified"` // 是否已激活
	Day        string `field:"day"`        // YYYYMMDD
}

UserEmailVerification 邮箱激活邮件队列

type UserEmailVerificationDAO added in v0.6.0

type UserEmailVerificationDAO dbs.DAO
var SharedUserEmailVerificationDAO *UserEmailVerificationDAO

func NewUserEmailVerificationDAO added in v0.6.0

func NewUserEmailVerificationDAO() *UserEmailVerificationDAO

type UserEmailVerificationOperator added in v0.6.0

type UserEmailVerificationOperator struct {
	Id         any // ID
	Email      any // 邮箱
	UserId     any // 用户ID
	Code       any // 激活码
	CreatedAt  any // 创建时间
	IsSent     any // 是否已发送
	IsVerified any // 是否已激活
	Day        any // YYYYMMDD
}

func NewUserEmailVerificationOperator added in v0.6.0

func NewUserEmailVerificationOperator() *UserEmailVerificationOperator

type UserIdentity added in v0.4.9

type UserIdentity struct {
	Id           uint64   `field:"id"`           // ID
	UserId       uint64   `field:"userId"`       // 用户ID
	OrgType      string   `field:"orgType"`      // 组织类型
	Type         string   `field:"type"`         // 证件类型
	RealName     string   `field:"realName"`     // 真实姓名
	Number       string   `field:"number"`       // 编号
	FileIds      dbs.JSON `field:"fileIds"`      // 文件ID
	Status       string   `field:"status"`       // 状态:none,submitted,verified,rejected
	State        uint8    `field:"state"`        // 状态
	CreatedAt    uint64   `field:"createdAt"`    // 创建时间
	UpdatedAt    uint64   `field:"updatedAt"`    // 修改时间
	SubmittedAt  uint64   `field:"submittedAt"`  // 提交时间
	RejectedAt   uint64   `field:"rejectedAt"`   // 拒绝时间
	VerifiedAt   uint64   `field:"verifiedAt"`   // 认证时间
	RejectReason string   `field:"rejectReason"` // 拒绝原因
}

UserIdentity 用户实名认证信息

func (*UserIdentity) DecodeFileIds added in v0.4.9

func (this *UserIdentity) DecodeFileIds() []int64

type UserIdentityDAO added in v0.4.9

type UserIdentityDAO dbs.DAO
var SharedUserIdentityDAO *UserIdentityDAO

func NewUserIdentityDAO added in v0.4.9

func NewUserIdentityDAO() *UserIdentityDAO

func (*UserIdentityDAO) CancelUserIdentity added in v0.4.9

func (this *UserIdentityDAO) CancelUserIdentity(tx *dbs.Tx, identityId int64) error

CancelUserIdentity 取消提交审核

func (*UserIdentityDAO) CheckUserIdentity added in v0.4.9

func (this *UserIdentityDAO) CheckUserIdentity(tx *dbs.Tx, userId int64, identityId int64) error

CheckUserIdentity 检查用户认证

func (*UserIdentityDAO) CheckUserIdentityIsVerified added in v0.4.10

func (this *UserIdentityDAO) CheckUserIdentityIsVerified(tx *dbs.Tx, userId int64, orgType userconfigs.UserIdentityOrgType) (bool, error)

CheckUserIdentityIsVerified 检查实名认证

func (*UserIdentityDAO) CheckUserIdentityStatus added in v0.4.10

func (this *UserIdentityDAO) CheckUserIdentityStatus(tx *dbs.Tx, userId int64, status userconfigs.UserIdentityStatus) (bool, error)

CheckUserIdentityStatus 检查状态

func (*UserIdentityDAO) CreateUserIdentity added in v0.4.9

func (this *UserIdentityDAO) CreateUserIdentity(tx *dbs.Tx, userId int64, orgType userconfigs.UserIdentityOrgType, idType userconfigs.UserIdentityType, realName string, number string, fileIds []int64) (int64, error)

CreateUserIdentity 创建

func (*UserIdentityDAO) DisableUserIdentity added in v0.4.9

func (this *UserIdentityDAO) DisableUserIdentity(tx *dbs.Tx, id uint64) error

DisableUserIdentity 禁用条目

func (*UserIdentityDAO) EnableUserIdentity added in v0.4.9

func (this *UserIdentityDAO) EnableUserIdentity(tx *dbs.Tx, id uint64) error

EnableUserIdentity 启用条目

func (*UserIdentityDAO) FindEnabledUserIdentity added in v0.4.9

func (this *UserIdentityDAO) FindEnabledUserIdentity(tx *dbs.Tx, id int64) (*UserIdentity, error)

FindEnabledUserIdentity 查找启用中的条目

func (*UserIdentityDAO) FindEnabledUserIdentityWithOrgType added in v0.4.10

func (this *UserIdentityDAO) FindEnabledUserIdentityWithOrgType(tx *dbs.Tx, userId int64, orgType userconfigs.UserIdentityOrgType) (*UserIdentity, error)

FindEnabledUserIdentityWithOrgType 查找某个类型的认证信息

func (*UserIdentityDAO) FindUserIdentityStatus added in v0.4.9

func (this *UserIdentityDAO) FindUserIdentityStatus(tx *dbs.Tx, identityId int64) (userconfigs.UserIdentityStatus, error)

FindUserIdentityStatus 查找认证信息当前状态

func (*UserIdentityDAO) RejectUserIdentity added in v0.4.9

func (this *UserIdentityDAO) RejectUserIdentity(tx *dbs.Tx, identityId int64, reason string) error

RejectUserIdentity 拒绝

func (*UserIdentityDAO) ResetUserIdentity added in v0.4.10

func (this *UserIdentityDAO) ResetUserIdentity(tx *dbs.Tx, identityId int64) error

ResetUserIdentity 重置实名认证状态

func (*UserIdentityDAO) SubmitUserIdentity added in v0.4.9

func (this *UserIdentityDAO) SubmitUserIdentity(tx *dbs.Tx, identityId int64) error

SubmitUserIdentity 提交审核

func (*UserIdentityDAO) UpdateUserIdentity added in v0.4.9

func (this *UserIdentityDAO) UpdateUserIdentity(tx *dbs.Tx, identityId int64, idType userconfigs.UserIdentityType, realName string, number string, fileIds []int64) error

UpdateUserIdentity 修改

func (*UserIdentityDAO) VerifyUserIdentity added in v0.4.9

func (this *UserIdentityDAO) VerifyUserIdentity(tx *dbs.Tx, identityId int64) error

VerifyUserIdentity 通过

type UserIdentityOperator added in v0.4.9

type UserIdentityOperator struct {
	Id           interface{} // ID
	UserId       interface{} // 用户ID
	OrgType      interface{} // 组织类型
	Type         interface{} // 证件类型
	RealName     interface{} // 真实姓名
	Number       interface{} // 编号
	FileIds      interface{} // 文件ID
	Status       interface{} // 状态:none,submitted,verified,rejected
	State        interface{} // 状态
	CreatedAt    interface{} // 创建时间
	UpdatedAt    interface{} // 修改时间
	SubmittedAt  interface{} // 提交时间
	RejectedAt   interface{} // 拒绝时间
	VerifiedAt   interface{} // 认证时间
	RejectReason interface{} // 拒绝原因
}

func NewUserIdentityOperator added in v0.4.9

func NewUserIdentityOperator() *UserIdentityOperator

type UserMobileVerification added in v1.3.0

type UserMobileVerification struct {
	Id         uint64 `field:"id"`         // ID
	Mobile     string `field:"mobile"`     // 手机号码
	UserId     uint64 `field:"userId"`     // 用户ID
	Code       string `field:"code"`       // 激活码
	CreatedAt  uint64 `field:"createdAt"`  // 创建时间
	IsSent     bool   `field:"isSent"`     // 是否已发送
	IsVerified bool   `field:"isVerified"` // 是否已激活
	Day        string `field:"day"`        // YYYYMMDD
}

UserMobileVerification 邮箱激活邮件队列

type UserMobileVerificationDAO added in v1.3.0

type UserMobileVerificationDAO dbs.DAO
var SharedUserMobileVerificationDAO *UserMobileVerificationDAO

func NewUserMobileVerificationDAO added in v1.3.0

func NewUserMobileVerificationDAO() *UserMobileVerificationDAO

type UserMobileVerificationOperator added in v1.3.0

type UserMobileVerificationOperator struct {
	Id         any // ID
	Mobile     any // 手机号码
	UserId     any // 用户ID
	Code       any // 激活码
	CreatedAt  any // 创建时间
	IsSent     any // 是否已发送
	IsVerified any // 是否已激活
	Day        any // YYYYMMDD
}

func NewUserMobileVerificationOperator added in v1.3.0

func NewUserMobileVerificationOperator() *UserMobileVerificationOperator

type UserNode

type UserNode struct {
	Id          uint32   `field:"id"`          // ID
	IsOn        bool     `field:"isOn"`        // 是否启用
	UniqueId    string   `field:"uniqueId"`    // 唯一ID
	Secret      string   `field:"secret"`      // 密钥
	Name        string   `field:"name"`        // 名称
	Description string   `field:"description"` // 描述
	Http        dbs.JSON `field:"http"`        // 监听的HTTP配置
	Https       dbs.JSON `field:"https"`       // 监听的HTTPS配置
	AccessAddrs dbs.JSON `field:"accessAddrs"` // 外部访问地址
	Order       uint32   `field:"order"`       // 排序
	State       uint8    `field:"state"`       // 状态
	CreatedAt   uint64   `field:"createdAt"`   // 创建时间
	AdminId     uint32   `field:"adminId"`     // 管理员ID
	Weight      uint32   `field:"weight"`      // 权重
	Status      dbs.JSON `field:"status"`      // 运行状态
}

UserNode 用户节点

func (*UserNode) DecodeAccessAddrStrings

func (this *UserNode) DecodeAccessAddrStrings() ([]string, error)

DecodeAccessAddrStrings 解析访问地址,并返回字符串形式

func (*UserNode) DecodeAccessAddrs

func (this *UserNode) DecodeAccessAddrs() ([]*serverconfigs.NetworkAddressConfig, error)

DecodeAccessAddrs 解析访问地址

func (*UserNode) DecodeHTTP

func (this *UserNode) DecodeHTTP() (*serverconfigs.HTTPProtocolConfig, error)

DecodeHTTP 解析HTTP配置

func (*UserNode) DecodeHTTPS

func (this *UserNode) DecodeHTTPS(cacheMap *utils.CacheMap) (*serverconfigs.HTTPSProtocolConfig, error)

DecodeHTTPS 解析HTTPS配置

type UserNodeDAO

type UserNodeDAO dbs.DAO
var SharedUserNodeDAO *UserNodeDAO

func NewUserNodeDAO

func NewUserNodeDAO() *UserNodeDAO

func (*UserNodeDAO) CountAllEnabledAndOnOfflineNodes

func (this *UserNodeDAO) CountAllEnabledAndOnOfflineNodes(tx *dbs.Tx) (int64, error)

CountAllEnabledAndOnOfflineNodes 计算离线节点数量

func (*UserNodeDAO) CountAllEnabledAndOnUserNodes

func (this *UserNodeDAO) CountAllEnabledAndOnUserNodes(tx *dbs.Tx) (int64, error)

CountAllEnabledAndOnUserNodes 计算启用的用户节点数量

func (*UserNodeDAO) CountAllEnabledUserNodes

func (this *UserNodeDAO) CountAllEnabledUserNodes(tx *dbs.Tx) (int64, error)

CountAllEnabledUserNodes 计算用户节点数量

func (*UserNodeDAO) CountAllEnabledUserNodesWithSSLPolicyIds

func (this *UserNodeDAO) CountAllEnabledUserNodesWithSSLPolicyIds(tx *dbs.Tx, sslPolicyIds []int64) (count int64, err error)

CountAllEnabledUserNodesWithSSLPolicyIds 计算使用SSL策略的所有用户节点数量

func (*UserNodeDAO) CountAllLowerVersionNodes

func (this *UserNodeDAO) CountAllLowerVersionNodes(tx *dbs.Tx, version string) (int64, error)

CountAllLowerVersionNodes 计算所有节点中低于某个版本的节点数量

func (*UserNodeDAO) CreateUserNode

func (this *UserNodeDAO) CreateUserNode(tx *dbs.Tx, name string, description string, httpJSON []byte, httpsJSON []byte, accessAddrsJSON []byte, isOn bool) (nodeId int64, err error)

CreateUserNode 创建用户节点

func (*UserNodeDAO) DisableUserNode

func (this *UserNodeDAO) DisableUserNode(tx *dbs.Tx, nodeId int64) error

DisableUserNode 禁用条目

func (*UserNodeDAO) EnableUserNode

func (this *UserNodeDAO) EnableUserNode(tx *dbs.Tx, id uint32) error

EnableUserNode 启用条目

func (*UserNodeDAO) FindAllEnabledUserNodes

func (this *UserNodeDAO) FindAllEnabledUserNodes(tx *dbs.Tx) (result []*UserNode, err error)

FindAllEnabledUserNodes 列出所有可用用户节点

func (*UserNodeDAO) FindEnabledUserNode

func (this *UserNodeDAO) FindEnabledUserNode(tx *dbs.Tx, id int64) (*UserNode, error)

FindEnabledUserNode 查找启用中的条目

func (*UserNodeDAO) FindEnabledUserNodeIdWithAddr

func (this *UserNodeDAO) FindEnabledUserNodeIdWithAddr(tx *dbs.Tx, protocol string, host string, port int) (int64, error)

FindEnabledUserNodeIdWithAddr 根据主机名和端口获取ID

func (*UserNodeDAO) FindEnabledUserNodeIdWithUniqueId

func (this *UserNodeDAO) FindEnabledUserNodeIdWithUniqueId(tx *dbs.Tx, uniqueId string) (int64, error)

FindEnabledUserNodeIdWithUniqueId 根据唯一ID获取节点ID

func (*UserNodeDAO) FindEnabledUserNodeWithUniqueId

func (this *UserNodeDAO) FindEnabledUserNodeWithUniqueId(tx *dbs.Tx, uniqueId string) (*UserNode, error)

FindEnabledUserNodeWithUniqueId 根据唯一ID获取节点信息

func (*UserNodeDAO) FindUserNodeAccessAddr added in v0.5.4

func (this *UserNodeDAO) FindUserNodeAccessAddr(tx *dbs.Tx) (string, error)

FindUserNodeAccessAddr 获取用户节点访问地址

func (*UserNodeDAO) FindUserNodeName

func (this *UserNodeDAO) FindUserNodeName(tx *dbs.Tx, id int64) (string, error)

FindUserNodeName 根据主键查找名称

func (*UserNodeDAO) GenUniqueId

func (this *UserNodeDAO) GenUniqueId(tx *dbs.Tx) (string, error)

GenUniqueId 生成唯一ID

func (*UserNodeDAO) ListEnabledUserNodes

func (this *UserNodeDAO) ListEnabledUserNodes(tx *dbs.Tx, offset int64, size int64) (result []*UserNode, err error)

ListEnabledUserNodes 列出单页的用户节点

func (*UserNodeDAO) UpdateNodeStatus

func (this *UserNodeDAO) UpdateNodeStatus(tx *dbs.Tx, nodeId int64, nodeStatus *nodeconfigs.NodeStatus) error

UpdateNodeStatus 更改节点状态

func (*UserNodeDAO) UpdateUserNode

func (this *UserNodeDAO) UpdateUserNode(tx *dbs.Tx, nodeId int64, name string, description string, httpJSON []byte, httpsJSON []byte, accessAddrsJSON []byte, isOn bool) error

UpdateUserNode 修改用户节点

type UserNodeOperator

type UserNodeOperator struct {
	Id          any // ID
	IsOn        any // 是否启用
	UniqueId    any // 唯一ID
	Secret      any // 密钥
	Name        any // 名称
	Description any // 描述
	Http        any // 监听的HTTP配置
	Https       any // 监听的HTTPS配置
	AccessAddrs any // 外部访问地址
	Order       any // 排序
	State       any // 状态
	CreatedAt   any // 创建时间
	AdminId     any // 管理员ID
	Weight      any // 权重
	Status      any // 运行状态
}

func NewUserNodeOperator

func NewUserNodeOperator() *UserNodeOperator

type UserOperator

type UserOperator struct {
	Id                any // ID
	IsOn              any // 是否启用
	Username          any // 用户名
	Password          any // 密码
	Fullname          any // 真实姓名
	Mobile            any // 手机号
	VerifiedMobile    any // 已验证手机号
	MobileIsVerified  any // 手机号是否已验证
	Tel               any // 联系电话
	Remark            any // 备注
	Email             any // 邮箱地址
	VerifiedEmail     any // 激活后的邮箱
	EmailIsVerified   any // 邮箱是否已验证
	AvatarFileId      any // 头像文件ID
	CreatedAt         any // 创建时间
	Day               any // YYYYMMDD
	UpdatedAt         any // 修改时间
	State             any // 状态
	Source            any // 来源
	ClusterId         any // 集群ID
	Features          any // 允许操作的特征
	RegisteredIP      any // 注册使用的IP
	IsRejected        any // 是否已拒绝
	RejectReason      any // 拒绝理由
	IsVerified        any // 是否验证通过
	RequirePlans      any // 是否需要购买套餐
	Modules           any // 用户模块
	PriceType         any // 计费类型:traffic|bandwidth
	PricePeriod       any // 结算周期
	ServersEnabled    any // 是否禁用所有服务
	Notification      any // 通知设置
	BandwidthAlgo     any // 带宽算法
	BandwidthModifier any // 带宽修正值
	Lang              any // 语言代号
}

func NewUserOperator

func NewUserOperator() *UserOperator

type UserPlan

type UserPlan struct {
	Id     uint64 `field:"id"`     // ID
	UserId uint32 `field:"userId"` // 用户ID
	PlanId uint32 `field:"planId"` // 套餐ID
	IsOn   bool   `field:"isOn"`   // 是否启用
	Name   string `field:"name"`   // 名称
	DayTo  string `field:"dayTo"`  // 结束日期
	State  uint8  `field:"state"`  // 状态
}

UserPlan 用户的套餐

func (*UserPlan) IsExpired added in v1.2.9

func (this *UserPlan) IsExpired() bool

IsExpired 判断套餐是否过期

type UserPlanBandwidthStat added in v1.2.9

type UserPlanBandwidthStat struct {
	Id                  uint64 `field:"id"`                  // ID
	UserId              uint64 `field:"userId"`              // 用户ID
	UserPlanId          uint64 `field:"userPlanId"`          // 用户套餐ID
	Day                 string `field:"day"`                 // 日期YYYYMMDD
	TimeAt              string `field:"timeAt"`              // 时间点HHII
	Bytes               uint64 `field:"bytes"`               // 带宽
	RegionId            uint32 `field:"regionId"`            // 区域ID
	TotalBytes          uint64 `field:"totalBytes"`          // 总流量
	AvgBytes            uint64 `field:"avgBytes"`            // 平均流量
	CachedBytes         uint64 `field:"cachedBytes"`         // 缓存的流量
	AttackBytes         uint64 `field:"attackBytes"`         // 攻击流量
	CountRequests       uint64 `field:"countRequests"`       // 请求数
	CountCachedRequests uint64 `field:"countCachedRequests"` // 缓存的请求数
	CountAttackRequests uint64 `field:"countAttackRequests"` // 攻击请求数
}

UserPlanBandwidthStat 用户套餐带宽峰值

type UserPlanBandwidthStatDAO added in v1.2.9

type UserPlanBandwidthStatDAO dbs.DAO
var SharedUserPlanBandwidthStatDAO *UserPlanBandwidthStatDAO

func NewUserPlanBandwidthStatDAO added in v1.2.9

func NewUserPlanBandwidthStatDAO() *UserPlanBandwidthStatDAO

func (*UserPlanBandwidthStatDAO) CleanDays added in v1.2.9

func (this *UserPlanBandwidthStatDAO) CleanDays(tx *dbs.Tx, days int) error

CleanDays 清理过期数据

func (*UserPlanBandwidthStatDAO) CleanDefaultDays added in v1.2.9

func (this *UserPlanBandwidthStatDAO) CleanDefaultDays(tx *dbs.Tx, defaultDays int) error

CleanDefaultDays 清理过期数据

func (*UserPlanBandwidthStatDAO) FindMonthlyPercentile added in v1.2.9

func (this *UserPlanBandwidthStatDAO) FindMonthlyPercentile(tx *dbs.Tx, userPlanId int64, month string, percentile int, useAvg bool) (result int64, err error)

FindMonthlyPercentile 获取某月内百分位

func (*UserPlanBandwidthStatDAO) SumMonthlyBytes added in v1.2.9

func (this *UserPlanBandwidthStatDAO) SumMonthlyBytes(tx *dbs.Tx, userPlanId int64, month string) (int64, error)

SumMonthlyBytes 读取单月总流量

func (*UserPlanBandwidthStatDAO) UpdateUserPlanBandwidth added in v1.2.9

func (this *UserPlanBandwidthStatDAO) UpdateUserPlanBandwidth(tx *dbs.Tx, userId int64, userPlanId int64, regionId int64, day string, timeAt string, bandwidthBytes int64, totalBytes int64, cachedBytes int64, attackBytes int64, countRequests int64, countCachedRequests int64, countAttackRequests int64) error

UpdateUserPlanBandwidth 写入数据 暂时不使用region区分

type UserPlanBandwidthStatOperator added in v1.2.9

type UserPlanBandwidthStatOperator struct {
	Id                  any // ID
	UserId              any // 用户ID
	UserPlanId          any // 用户套餐ID
	Day                 any // 日期YYYYMMDD
	TimeAt              any // 时间点HHII
	Bytes               any // 带宽
	RegionId            any // 区域ID
	TotalBytes          any // 总流量
	AvgBytes            any // 平均流量
	CachedBytes         any // 缓存的流量
	AttackBytes         any // 攻击流量
	CountRequests       any // 请求数
	CountCachedRequests any // 缓存的请求数
	CountAttackRequests any // 攻击请求数
}

func NewUserPlanBandwidthStatOperator added in v1.2.9

func NewUserPlanBandwidthStatOperator() *UserPlanBandwidthStatOperator

type UserPlanDAO

type UserPlanDAO dbs.DAO
var SharedUserPlanDAO *UserPlanDAO

func NewUserPlanDAO

func NewUserPlanDAO() *UserPlanDAO

func (*UserPlanDAO) CheckUserPlan

func (this *UserPlanDAO) CheckUserPlan(tx *dbs.Tx, userId int64, userPlanId int64) error

CheckUserPlan 检查用户套餐

func (*UserPlanDAO) CountAllEnabledUserPlans

func (this *UserPlanDAO) CountAllEnabledUserPlans(tx *dbs.Tx, userId int64, isAvailable bool, isExpired bool, expiringDays int32) (int64, error)

CountAllEnabledUserPlans 计算套餐数量

func (*UserPlanDAO) CreateUserPlan

func (this *UserPlanDAO) CreateUserPlan(tx *dbs.Tx, userId int64, planId int64, name string, dayTo string) (int64, error)

CreateUserPlan 创建套餐

func (*UserPlanDAO) DisableUserPlan

func (this *UserPlanDAO) DisableUserPlan(tx *dbs.Tx, id int64) error

DisableUserPlan 禁用条目

func (*UserPlanDAO) EnableUserPlan

func (this *UserPlanDAO) EnableUserPlan(tx *dbs.Tx, id uint64) error

EnableUserPlan 启用条目

func (*UserPlanDAO) FindAllEnabledPlansForServer

func (this *UserPlanDAO) FindAllEnabledPlansForServer(tx *dbs.Tx, userId int64, serverId int64) (result []*UserPlan, err error)

FindAllEnabledPlansForServer 列出服务可用的套餐

func (*UserPlanDAO) FindEnabledUserPlan

func (this *UserPlanDAO) FindEnabledUserPlan(tx *dbs.Tx, userPlanId int64, cacheMap *utils.CacheMap) (*UserPlan, error)

FindEnabledUserPlan 查找启用中的条目

func (*UserPlanDAO) FindUserPlanWithoutState

func (this *UserPlanDAO) FindUserPlanWithoutState(tx *dbs.Tx, userPlanId int64, cacheMap *utils.CacheMap) (*UserPlan, error)

FindUserPlanWithoutState 查找套餐,并不检查状态 防止因为删除套餐而导致计费失败

func (*UserPlanDAO) ListEnabledUserPlans

func (this *UserPlanDAO) ListEnabledUserPlans(tx *dbs.Tx, userId int64, isAvailable bool, isExpired bool, expiringDays int32, offset int64, size int64) (result []*UserPlan, err error)

ListEnabledUserPlans 列出单页套餐

func (*UserPlanDAO) NotifyUpdate

func (this *UserPlanDAO) NotifyUpdate(tx *dbs.Tx, userPlanId int64) error

NotifyUpdate 通知更新

func (*UserPlanDAO) UpdateUserPlan

func (this *UserPlanDAO) UpdateUserPlan(tx *dbs.Tx, userPlanId int64, planId int64, name string, dayTo string, isOn bool) error

UpdateUserPlan 修改套餐

func (*UserPlanDAO) UpdateUserPlanDayTo

func (this *UserPlanDAO) UpdateUserPlanDayTo(tx *dbs.Tx, userPlanId int64, dayTo string) error

UpdateUserPlanDayTo 修改套餐日期

type UserPlanOperator

type UserPlanOperator struct {
	Id     interface{} // ID
	UserId interface{} // 用户ID
	PlanId interface{} // 套餐ID
	IsOn   interface{} // 是否启用
	Name   interface{} // 名称
	DayTo  interface{} // 结束日期
	State  interface{} // 状态
}

func NewUserPlanOperator

func NewUserPlanOperator() *UserPlanOperator

type UserPlanStat added in v1.2.9

type UserPlanStat struct {
	Id            uint64 `field:"id"`            // ID
	UserPlanId    uint64 `field:"userPlanId"`    // 用户套餐ID
	Date          string `field:"date"`          // 日期:YYYYMMDD或YYYYMM
	DateType      string `field:"dateType"`      // 日期类型:day|month
	TrafficBytes  uint64 `field:"trafficBytes"`  // 流量
	CountRequests uint64 `field:"countRequests"` // 总请求数
	IsProcessed   bool   `field:"isProcessed"`   // 是否已处理
}

UserPlanStat 用户套餐统计

type UserPlanStatDAO added in v1.2.9

type UserPlanStatDAO dbs.DAO
var SharedUserPlanStatDAO *UserPlanStatDAO

func NewUserPlanStatDAO added in v1.2.9

func NewUserPlanStatDAO() *UserPlanStatDAO

func (*UserPlanStatDAO) IncreaseUserPlanStat added in v1.2.9

func (this *UserPlanStatDAO) IncreaseUserPlanStat(tx *dbs.Tx, userPlanId int64, trafficBytes int64, countRequests int64) error

type UserPlanStatOperator added in v1.2.9

type UserPlanStatOperator struct {
	Id            any // ID
	UserPlanId    any // 用户套餐ID
	Date          any // 日期:YYYYMMDD或YYYYMM
	DateType      any // 日期类型:day|month
	TrafficBytes  any // 流量
	CountRequests any // 总请求数
	IsProcessed   any // 是否已处理
}

func NewUserPlanStatOperator added in v1.2.9

func NewUserPlanStatOperator() *UserPlanStatOperator

type UserTrafficBill added in v0.5.6

type UserTrafficBill struct {
	Id                    uint64   `field:"id"`                    // ID
	BillId                uint64   `field:"billId"`                // 主账单ID
	RegionId              uint32   `field:"regionId"`              // 区域ID
	Amount                float64  `field:"amount"`                // 金额
	BandwidthMB           float64  `field:"bandwidthMB"`           // 带宽MB
	BandwidthPercentile   uint8    `field:"bandwidthPercentile"`   // 带宽百分位
	TrafficGB             float64  `field:"trafficGB"`             // 流量GB
	TrafficPackageGB      float64  `field:"trafficPackageGB"`      // 使用的流量包GB
	UserTrafficPackageIds dbs.JSON `field:"userTrafficPackageIds"` // 使用的流量包ID
	PricePerUnit          float64  `field:"pricePerUnit"`          // 单位价格
	PriceType             string   `field:"priceType"`             // 计费方式:traffic|bandwidth
	State                 uint8    `field:"state"`                 // 状态
}

UserTrafficBill 用户流量/带宽账单

type UserTrafficBillOperator added in v0.5.6

type UserTrafficBillOperator struct {
	Id                    any // ID
	BillId                any // 主账单ID
	RegionId              any // 区域ID
	Amount                any // 金额
	BandwidthMB           any // 带宽MB
	BandwidthPercentile   any // 带宽百分位
	TrafficGB             any // 流量GB
	TrafficPackageGB      any // 使用的流量包GB
	UserTrafficPackageIds any // 使用的流量包ID
	PricePerUnit          any // 单位价格
	PriceType             any // 计费方式:traffic|bandwidth
	State                 any // 状态
}

func NewUserTrafficBillOperator added in v0.5.6

func NewUserTrafficBillOperator() *UserTrafficBillOperator

type UserTrafficPackage added in v0.5.6

type UserTrafficPackage struct {
	Id          uint64 `field:"id"`          // ID
	AdminId     uint32 `field:"adminId"`     // 管理员ID
	UserId      uint64 `field:"userId"`      // 用户ID
	PackageId   uint32 `field:"packageId"`   // 流量包ID
	TotalBytes  uint64 `field:"totalBytes"`  // 总字节数
	UsedBytes   uint64 `field:"usedBytes"`   // 已使用字节数
	RegionId    uint32 `field:"regionId"`    // 区域ID
	PeriodId    uint32 `field:"periodId"`    // 有效期ID
	PeriodCount uint32 `field:"periodCount"` // 有效期数量
	PeriodUnit  string `field:"periodUnit"`  // 有效期单位
	DayFrom     string `field:"dayFrom"`     // 开始日期
	DayTo       string `field:"dayTo"`       // 结束日期
	CreatedAt   uint64 `field:"createdAt"`   // 创建时间
	State       uint8  `field:"state"`       // 状态
}

UserTrafficPackage 用户购买的流量包

type UserTrafficPackageDAO added in v0.5.6

type UserTrafficPackageDAO dbs.DAO
var SharedUserTrafficPackageDAO *UserTrafficPackageDAO

func NewUserTrafficPackageDAO added in v0.5.6

func NewUserTrafficPackageDAO() *UserTrafficPackageDAO

func (*UserTrafficPackageDAO) DisableUserTrafficPackage added in v0.5.6

func (this *UserTrafficPackageDAO) DisableUserTrafficPackage(tx *dbs.Tx, id int64) error

DisableUserTrafficPackage 禁用条目

func (*UserTrafficPackageDAO) EnableUserTrafficPackage added in v0.5.6

func (this *UserTrafficPackageDAO) EnableUserTrafficPackage(tx *dbs.Tx, id uint64) error

EnableUserTrafficPackage 启用条目

func (*UserTrafficPackageDAO) FindEnabledUserTrafficPackage added in v0.5.6

func (this *UserTrafficPackageDAO) FindEnabledUserTrafficPackage(tx *dbs.Tx, id int64) (*UserTrafficPackage, error)

FindEnabledUserTrafficPackage 查找启用中的条目

type UserTrafficPackageOperator added in v0.5.6

type UserTrafficPackageOperator struct {
	Id          any // ID
	AdminId     any // 管理员ID
	UserId      any // 用户ID
	PackageId   any // 流量包ID
	TotalBytes  any // 总字节数
	UsedBytes   any // 已使用字节数
	RegionId    any // 区域ID
	PeriodId    any // 有效期ID
	PeriodCount any // 有效期数量
	PeriodUnit  any // 有效期单位
	DayFrom     any // 开始日期
	DayTo       any // 结束日期
	CreatedAt   any // 创建时间
	State       any // 状态
}

func NewUserTrafficPackageOperator added in v0.5.6

func NewUserTrafficPackageOperator() *UserTrafficPackageOperator

type UserVerifyCode added in v0.6.0

type UserVerifyCode struct {
	Id         uint64 `field:"id"`         // ID
	Email      string `field:"email"`      // 邮箱地址
	Mobile     string `field:"mobile"`     // 手机号
	Code       string `field:"code"`       // 验证码
	Type       string `field:"type"`       // 类型
	IsSent     bool   `field:"isSent"`     // 是否已发送
	IsVerified bool   `field:"isVerified"` // 是否已激活
	CreatedAt  uint64 `field:"createdAt"`  // 创建时间
	ExpiresAt  uint64 `field:"expiresAt"`  // 过期时间
	Day        string `field:"day"`        // YYYYMMDD
}

UserVerifyCode 重置密码之验证码

type UserVerifyCodeDAO added in v0.6.0

type UserVerifyCodeDAO dbs.DAO
var SharedUserVerifyCodeDAO *UserVerifyCodeDAO

func NewUserVerifyCodeDAO added in v0.6.0

func NewUserVerifyCodeDAO() *UserVerifyCodeDAO

type UserVerifyCodeOperator added in v0.6.0

type UserVerifyCodeOperator struct {
	Id         any // ID
	Email      any // 邮箱地址
	Mobile     any // 手机号
	Code       any // 验证码
	Type       any // 类型
	IsSent     any // 是否已发送
	IsVerified any // 是否已激活
	CreatedAt  any // 创建时间
	ExpiresAt  any // 过期时间
	Day        any // YYYYMMDD
}

func NewUserVerifyCodeOperator added in v0.6.0

func NewUserVerifyCodeOperator() *UserVerifyCodeOperator

type Version

type Version struct {
	Id      uint64 `field:"id"`      // ID
	Version string `field:"version"` //
}

数据库结构版本

type VersionDAO

type VersionDAO dbs.DAO
var SharedVersionDAO *VersionDAO

func NewVersionDAO

func NewVersionDAO() *VersionDAO

type VersionOperator

type VersionOperator struct {
	Id      interface{} // ID
	Version interface{} //
}

func NewVersionOperator

func NewVersionOperator() *VersionOperator

Source Files

Directories

Path Synopsis
dns

Jump to

Keyboard shortcuts

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