systemconfigs

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: BSD-3-Clause Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultBandwidthDateRangeCode = "latest30days"
View Source
const DefaultBandwidthPercentile int32 = 95

Variables

This section is empty.

Functions

func DefaultThemeBackgroundColors added in v1.0.0

func DefaultThemeBackgroundColors() []string

Types

type AdminModule

type AdminModule struct {
	Code     string   `json:"code"`     // 模块代号
	AllowAll bool     `json:"allowAll"` // 允许所有的动作
	Actions  []string `json:"actions"`  // 只允许的动作
}

AdminModule 管理用户模块权限

type AdminUIConfig

type AdminUIConfig struct {
	ProductName        string   `json:"productName"`        // 产品名
	AdminSystemName    string   `json:"adminSystemName"`    // 管理员系统名称
	ShowOpenSourceInfo bool     `json:"showOpenSourceInfo"` // 是否显示开源信息
	ShowVersion        bool     `json:"showVersion"`        // 是否显示版本号
	Version            string   `json:"version"`            // 显示的版本号
	ShowFinance        bool     `json:"showFinance"`        // 是否显示财务相关信息
	FaviconFileId      int64    `json:"faviconFileId"`      // Favicon文件ID
	LogoFileId         int64    `json:"logoFileId"`         // Logo文件ID
	DefaultPageSize    int      `json:"defaultPageSize"`    // 默认每页显示数
	TimeZone           string   `json:"timeZone"`           // 时区
	Modules            []string `json:"modules"`            // 开通模块
	DNSResolver        struct {
		Type string `json:"type"` // 类型,参考 DNSResolverType*
	} `json:"dnsResolver"` // DNS解析设置
}

AdminUIConfig 管理员界面相关配置

func (*AdminUIConfig) ContainsModule added in v0.5.3

func (this *AdminUIConfig) ContainsModule(module string) bool

type BandwidthAlgo added in v0.6.4

type BandwidthAlgo = string // 带宽算法
const (
	BandwidthAlgoSecondly BandwidthAlgo = "secondly" // 按秒算
	BandwidthAlgoAvg      BandwidthAlgo = "avg"      // N分钟平均
)

type BandwidthDateRange added in v0.5.8

type BandwidthDateRange struct {
	Name    string `json:"name"`
	Code    string `json:"code"`
	DayFrom string `json:"dayFrom"`
	DayTo   string `json:"dayTo"`
}

func FindAllBandwidthDateRanges added in v0.5.8

func FindAllBandwidthDateRanges() []*BandwidthDateRange

func FindBandwidthDateRange added in v0.5.8

func FindBandwidthDateRange(code string) *BandwidthDateRange

type BandwidthUnit added in v0.4.9

type BandwidthUnit = string
const (
	BandwidthUnitByte BandwidthUnit = "byte"
	BandwidthUnitBit  BandwidthUnit = "bit"
)

type CheckUpdatesConfig

type CheckUpdatesConfig struct {
	AutoCheck      bool   `yaml:"autoCheck" json:"autoCheck"`           // 是否开启自动检查
	IgnoredVersion string `yaml:"ignoredVersion" json:"ignoredVersion"` // 上次忽略的版本
}

CheckUpdatesConfig 检查更新配置

func NewCheckUpdatesConfig added in v1.2.0

func NewCheckUpdatesConfig() *CheckUpdatesConfig

type DatabaseConfig

type DatabaseConfig struct {
	ServerAccessLog struct {
		Clean struct {
			Days int `json:"days"` // 日志保留天数,0表示不限制
		} `json:"clean"` // 清理相关配置
	} `json:"serverAccessLog"` // 服务访问日志相关配置

	HTTPCacheTask struct {
		Clean struct {
			Days int `json:"days"`
		} `json:"clean"`
	} `json:"httpCacheTask"` // 缓存任务

	NodeTrafficDailyStat struct {
		Clean struct {
			Days int `json:"days"`
		} `json:"clean"`
	} `json:"nodeTrafficDailyStat"`

	ServerBandwidthStat struct {
		Clean struct {
			Days int `json:"days"`
		} `json:"clean"`
	} `json:"serverBandwidthStat"`

	ServerDailyStat struct {
		Clean struct {
			Days int `json:"days"`
		} `json:"clean"`
	} `json:"serverDailyStat"`

	UserBandwidthStat struct {
		Clean struct {
			Days int `json:"days"`
		} `json:"clean"`
	} `json:"userBandwidthStat"`

	UserPlanBandwidthStat struct {
		Clean struct {
			Days int `json:"days"`
		} `json:"clean"`
	} `json:"userPlanBandwidthStat"`

	NodeClusterTrafficDailyStat struct {
		Clean struct {
			Days int `json:"days"`
		} `json:"clean"`
	} `json:"nodeClusterTrafficDailyStat"`

	NodeTrafficHourlyStat struct {
		Clean struct {
			Days int `json:"days"`
		} `json:"clean"`
	} `json:"nodeTrafficHourlyStat"`

	ServerDomainHourlyStat struct {
		Clean struct {
			Days int `json:"days"`
		} `json:"clean"`
	} `json:"serverDomainHourlyStat"`

	TrafficDailyStat struct {
		Clean struct {
			Days int `json:"days"`
		} `json:"clean"`
	} `json:"trafficDailyStat"`

	TrafficHourlyStat struct {
		Clean struct {
			Days int `json:"days"`
		} `json:"clean"`
	} `json:"trafficHourlyStat"`
}

DatabaseConfig 数据库相关配置

func NewDatabaseConfig added in v1.2.1

func NewDatabaseConfig() *DatabaseConfig

type LogConfig

type LogConfig struct {
	CanDelete bool                 `json:"canDelete"` // 是否可删除
	CanClean  bool                 `json:"canClean"`  // 是否可清理
	Capacity  *shared.SizeCapacity `json:"capacity"`  // 容量
	Days      int                  `json:"days"`      // 自动保存天数
	CanChange bool                 `json:"canChange"` // 是否允许再次修改配置
}

LogConfig 操作日志相关配置

func DefaultLogConfig

func DefaultLogConfig() *LogConfig

DefaultLogConfig 默认日志配置

type SecurityConfig

type SecurityConfig struct {
	Frame                  string   `json:"frame"`                  // Frame嵌套
	AllowCountryIds        []int64  `json:"allowCountryIds"`        // 允许的国家/地区
	AllowProvinceIds       []int64  `json:"allowProvinceIds"`       // 允许的省份
	AllowLocal             bool     `json:"allowLocal"`             // 允许本地+局域网IP访问
	AllowIPs               []string `json:"allowIPs"`               // 允许访问的IP
	AllowRememberLogin     bool     `json:"allowRememberLogin"`     // 是否允许在设备上记住登录
	DenySearchEngines      bool     `json:"denySearchEngines"`      // 禁止常见的搜索引擎访问
	DenySpiders            bool     `json:"denySpiders"`            // 禁止常见的爬虫
	AllowDomains           []string `json:"allowDomains"`           // 允许访问的域名
	CheckClientFingerprint bool     `json:"checkClientFingerprint"` // 在登录状态下检查客户端指纹
	CheckClientRegion      bool     `json:"checkClientRegion"`      // 在登录状态下检查客户端区域

	ClientIPHeaderNames string `json:"clientIPHeaderNames"` // 客户端IP获取报头名称列表
	ClientIPHeaderOnly  bool   `json:"clientIPHeaderOnly"`  // 是否仅从报头中获取IP
	// contains filtered or unexported fields
}

SecurityConfig 安全相关配置

func (*SecurityConfig) AllowIPRanges

func (this *SecurityConfig) AllowIPRanges() []*shared.IPRangeConfig

AllowIPRanges 查询允许的IP区域

func (*SecurityConfig) Init

func (this *SecurityConfig) Init() error

Init 初始化

type SettingCode

type SettingCode = string
const (
	SettingCodeNodeMonitor           SettingCode = "nodeMonitor"         // 监控节点状态
	SettingCodeClusterHealthCheck    SettingCode = "clusterHealthCheck"  // 集群健康检查
	SettingCodeIPListVersion         SettingCode = "ipListVersion"       // IP名单的版本号
	SettingCodeAdminSecurityConfig   SettingCode = "adminSecurityConfig" // 管理员安全设置
	SettingCodeAdminUIConfig         SettingCode = "adminUIConfig"       // 管理员界面设置
	SettingCodeDatabaseConfigSetting SettingCode = "databaseConfig"      // 数据库相关配置
	SettingCodeAccessLogQueue        SettingCode = "accessLogQueue"      // 访问日志队列
	SettingCodeCheckUpdates          SettingCode = "checkUpdates"        // 检查自动更新配置

	SettingCodeUserServerConfig   SettingCode = "userServerConfig"   // 用户服务设置
	SettingCodeUserRegisterConfig SettingCode = "userRegisterConfig" // 用户注册配置
	SettingCodeUserUIConfig       SettingCode = "userUIConfig"       // 用户界面配置

	SettingCodeStandaloneInstanceInitialized SettingCode = "standaloneInstanceInitialized" // 单体实例是否已经被初始化:0 未被初始化, 1 已经成功初始化
)

type ThemeConfig added in v1.0.0

type ThemeConfig struct {
	BackgroundColor string `yaml:"backgroundColor" json:"backgroundColor"` // 背景色,16进制,不需要带井号(#)
}

ThemeConfig 风格模板设置

type UserUIConfig

type UserUIConfig struct {
	ProductName    string `json:"productName"`    // 产品名
	UserSystemName string `json:"userSystemName"` // 管理员系统名称
	ShowPageFooter bool   `json:"showPageFooter"` // 是否显示页脚
	PageFooterHTML string `json:"pageFooterHTML"` // 页脚HTML
	ShowVersion    bool   `json:"showVersion"`    // 是否显示版本号
	Version        string `json:"version"`        // 显示的版本号
	ShowFinance    bool   `json:"showFinance"`    // 是否显示财务相关信息
	FaviconFileId  int64  `json:"faviconFileId"`  // Favicon文件ID
	LogoFileId     int64  `json:"logoFileId"`     // 控制面板Logo文件ID

	TimeZone string `json:"timeZone"` // 时区

	DNSResolver struct {
		Type string `json:"type"` // 类型,参考 DNSResolverType*
	} `json:"dnsResolver"` // DNS解析设置

	ClientIPHeaderNames string `json:"clientIPHeaderNames"` // 客户端IP获取报头名称列表

	Server struct {
		CheckCNAME bool `json:"checkCNAME"` // 是否检查CNAME
	} `json:"server"` // 服务相关设置

	BandwidthUnit                BandwidthUnit `json:"bandwidthUnit"`                // 带宽单位
	ShowTrafficCharts            bool          `json:"showTrafficCharts"`            // 是否显示流量相关图表和数据
	ShowCacheInfoInTrafficCharts bool          `json:"showCacheInfoInTrafficCharts"` // 在流量图中显示缓存相关信息
	ShowBandwidthCharts          bool          `json:"showBandwidthCharts"`          // 是否显示带宽相关图表和数据

	TrafficStats struct {
		BandwidthPercentile       int32         `json:"bandwidthPercentile"`       // 带宽百分位
		DefaultBandwidthDateRange string        `json:"defaultBandwidthDateRange"` // 默认带宽周期
		BandwidthAlgo             BandwidthAlgo `json:"bandwidthAlgo"`             // 带宽算法
	} `json:"trafficStats"` // 流量统计相关设置

	Portal struct {
		IsOn       bool  `json:"isOn"`       // 是否启用
		LogoFileId int64 `json:"logoFileId"` // Logo文件ID
	} `json:"portal"` // 门户页面相关设置

	Theme ThemeConfig `yaml:"theme" json:"theme"` // 风格模板
}

UserUIConfig 用户界面相关配置

func NewUserUIConfig added in v1.3.4

func NewUserUIConfig() *UserUIConfig

Jump to

Keyboard shortcuts

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