userconfigs

package
v1.3.9 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	EmailVerificationDefaultLife  = 86400 * 2 // 2 days
	EmailResetPasswordDefaultLife = 3600      // 1 hour

	MobileVerificationDefaultLife  = 1800 // 30 minutes
	MobileResetPasswordDefaultLife = 1800 // 30 minutes
)
View Source
const (
	MaxCacheKeysPerTask int32 = 1000
	MaxCacheKeysPerDay  int32 = 10000
)

Variables

View Source
var DefaultUserModules = []UserModule{UserModuleCDN}

Functions

func CheckUserFeature added in v1.3.2

func CheckUserFeature(featureCode string) bool

CheckUserFeature 检查某个功能代号是否正确

func FindAllUserTicketStatusList added in v0.5.0

func FindAllUserTicketStatusList() []*shared.Definition

func UserTicketStatusName added in v0.5.0

func UserTicketStatusName(status UserTicketStatus) string

Types

type HTTPCacheTaskConfig

type HTTPCacheTaskConfig struct {
	MaxKeysPerTask int32 `yaml:"maxKeysPerTask" json:"maxKeysPerTask"`
	MaxKeysPerDay  int32 `yaml:"maxKeysPerDay" json:"maxKeysPerDay"`
}

func DefaultHTTPCacheTaskConfig

func DefaultHTTPCacheTaskConfig() *HTTPCacheTaskConfig

type UserFeature

type UserFeature struct {
	Name        string `json:"name"`
	Code        string `json:"code"`
	Description string `json:"description"`
	SupportPlan bool   `json:"supportPlan"`
}

UserFeature 用户功能

func FindAllUserFeatures

func FindAllUserFeatures() []*UserFeature

FindAllUserFeatures 所有功能列表

func FindUserFeature

func FindUserFeature(code string) *UserFeature

FindUserFeature 查询单个功能

func (*UserFeature) ToPB

func (this *UserFeature) ToPB() *pb.UserFeature

type UserFeatureCode

type UserFeatureCode = string

UserFeatureCode 用户功能代号

const (
	UserFeatureCodePlan UserFeatureCode = "plan"

	UserFeatureCodeServerTCP           UserFeatureCode = "server.tcp"
	UserFeatureCodeServerTCPPort       UserFeatureCode = "server.tcp.port"
	UserFeatureCodeServerUDP           UserFeatureCode = "server.udp"
	UserFeatureCodeServerUDPPort       UserFeatureCode = "server.udp.port"
	UserFeatureCodeServerAccessLog     UserFeatureCode = "server.accessLog"
	UserFeatureCodeServerViewAccessLog UserFeatureCode = "server.viewAccessLog"
	UserFeatureCodeServerScript        UserFeatureCode = "server.script"
	UserFeatureCodeServerWAF           UserFeatureCode = "server.waf"
	UserFeatureCodeServerOptimization  UserFeatureCode = "server.optimization"
	UserFeatureCodeServerUAM           UserFeatureCode = "server.uam"
	UserFeatureCodeServerWebP          UserFeatureCode = "server.webp"
	UserFeatureCodeServerCC            UserFeatureCode = "server.cc"
	UserFeatureCodeServerACME          UserFeatureCode = "server.acme"
	UserFeatureCodeServerAuth          UserFeatureCode = "server.auth"
	UserFeatureCodeServerWebsocket     UserFeatureCode = "server.websocket"
	UserFeatureCodeServerHTTP3         UserFeatureCode = "server.http3"
	UserFeatureCodeServerReferers      UserFeatureCode = "server.referers"
	UserFeatureCodeServerUserAgent     UserFeatureCode = "server.userAgent"
	UserFeatureCodeServerRequestLimit  UserFeatureCode = "server.requestLimit"
	UserFeatureCodeServerCompression   UserFeatureCode = "server.compression"
	UserFeatureCodeServerRewriteRules  UserFeatureCode = "server.rewriteRules"
	UserFeatureCodeServerHostRedirects UserFeatureCode = "server.hostRedirects"
	UserFeatureCodeServerHTTPHeaders   UserFeatureCode = "server.httpHeaders"
	UserFeatureCodeServerPages         UserFeatureCode = "server.pages"
)

type UserIdentityOrgType added in v0.4.10

type UserIdentityOrgType = string
const (
	UserIdentityOrgTypeEnterprise UserIdentityOrgType = "enterprise"
	UserIdentityOrgTypeIndividual UserIdentityOrgType = "individual"
)

type UserIdentityStatus added in v0.4.9

type UserIdentityStatus = string
const (
	UserIdentityStatusNone      UserIdentityStatus = "none"
	UserIdentityStatusSubmitted UserIdentityStatus = "submitted"
	UserIdentityStatusRejected  UserIdentityStatus = "rejected"
	UserIdentityStatusVerified  UserIdentityStatus = "verified"
)

type UserIdentityType added in v0.4.9

type UserIdentityType = string
const (
	UserIdentityTypeIDCard            UserIdentityType = "idCard"
	UserIdentityTypeEnterpriseLicense UserIdentityType = "enterpriseLicense"
)

type UserModule added in v0.5.3

type UserModule = string
const (
	UserModuleCDN      UserModule = "cdn"
	UserModuleAntiDDoS UserModule = "antiDDoS"
	UserModuleNS       UserModule = "ns"
)

type UserRegisterConfig

type UserRegisterConfig struct {
	IsOn                bool `yaml:"isOn" json:"isOn"`                               // 是否启用用户注册
	ComplexPassword     bool `yaml:"complexPassword" json:"complexPassword"`         // 必须使用复杂密码
	RequireVerification bool `yaml:"requireVerification" json:"requireVerification"` // 是否需要审核
	RequireIdentity     bool `yaml:"requireIdentity" json:"requireIdentity"`         // 是否需要实名认证
	CheckClientRegion   bool `yaml:"checkClientRegion" json:"checkClientRegion"`     // 在登录状态下检查客户端区域

	// 电子邮箱激活设置
	EmailVerification struct {
		IsOn       bool   `yaml:"isOn" json:"isOn"`             // 是否启用
		ShowNotice bool   `yaml:"showNotice" json:"showNotice"` // 提示用户未绑定
		Subject    string `yaml:"subject" json:"subject"`       // 标题
		Body       string `yaml:"body" json:"body"`             // 内容
		CanLogin   bool   `yaml:"canLogin" json:"canLogin"`     // 是否可以使用激活的邮箱登录
		Life       int32  `yaml:"life" json:"life"`             // 有效期
	} `yaml:"emailVerification" json:"emailVerification"`

	// 通过邮件找回密码设置
	EmailResetPassword struct {
		IsOn    bool   `yaml:"isOn" json:"isOn"`       // 是否启用
		Subject string `yaml:"subject" json:"subject"` // 标题
		Body    string `yaml:"body" json:"body"`       // 内容
		Life    int32  `yaml:"life" json:"life"`       // 有效期
	} `yaml:"emailResetPassword" json:"emailResetPassword"`

	// 手机号码激活设置
	MobileVerification struct {
		IsOn       bool   `yaml:"isOn" json:"isOn"`             // 是否启用
		ShowNotice bool   `yaml:"showNotice" json:"showNotice"` // 提示用户未绑定
		CanLogin   bool   `yaml:"canLogin" json:"canLogin"`     // 是否可以使用激活的邮箱登录
		Body       string `yaml:"body" json:"body"`             // 内容
		Life       int32  `yaml:"life" json:"life"`             // 有效期
		Force      bool   `yaml:"force" json:"force"`           // 是否强制绑定
	} `yaml:"mobileVerification" json:"mobileVerification"`

	// CDN
	CDNIsOn   bool     `json:"cdnIsOn"`                    // 是否开启CDN服务
	ClusterId int64    `yaml:"clusterId" json:"clusterId"` // 用户创建服务集群
	Features  []string `yaml:"features" json:"features"`   // 默认启用的功能

	// 开通DNS服务
	NSIsOn bool `json:"nsIsOn"` // 是否开启智能DNS服务

	// 开通高防服务
	ADIsOn bool `json:"adIsOn"` // 是否开启高防服务
}

func DefaultUserRegisterConfig

func DefaultUserRegisterConfig() *UserRegisterConfig

type UserServerConfig

type UserServerConfig struct {
	GroupId                  int64                `yaml:"groupId" json:"groupId"`                                   // 分组
	RequirePlan              bool                 `yaml:"requirePlan" json:"requirePlan"`                           // 必须使用套餐
	EnableStat               bool                 `yaml:"enableStat" json:"enableStat"`                             // 开启统计
	HTTPCacheTaskPurgeConfig *HTTPCacheTaskConfig `yaml:"httpCacheTaskPurgeConfig" json:"httpCacheTaskPurgeConfig"` // 缓存任务删除配置
	HTTPCacheTaskFetchConfig *HTTPCacheTaskConfig `yaml:"httpCacheTaskFetchConfig" json:"httpCacheTaskFetchConfig"` // 缓存任务预热配置
}

UserServerConfig 用户服务设置

func DefaultUserServerConfig

func DefaultUserServerConfig() *UserServerConfig

type UserTicketStatus added in v0.5.0

type UserTicketStatus = string
const (
	UserTicketStatusNone   UserTicketStatus = "none"
	UserTicketStatusSolved UserTicketStatus = "solved"
	UserTicketStatusClosed UserTicketStatus = "closed"
)

Jump to

Keyboard shortcuts

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