Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v1.15.21 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const AdminTelegramChatIdsKey = "system:telegram_admin_chat_ids"

AdminTelegramChatIdsKey cached admin Telegram chat ID list (not system config)

View Source
const AuthCodeCacheKey = "auth:verify:email"

AuthCodeCacheKey Register Code Cache Key

View Source
const AuthCodeTelephoneCacheKey = "auth:verify:telephone"

AuthCodeTelephoneCacheKey Register Code Cache Key

View Source
const CommonStatCacheKey = "common:stat"

CommonStatCacheKey CommonStat Cache Key

View Source
const CurrencyConfigKey = "system:currency_config"

CurrencyConfigKey Currency Config Key

View Source
const EmailSmtpConfigKey = "system:email_smtp_config"

EmailSmtpConfigKey Email Smtp Config Key

View Source
const GlobalConfigKey = "system:global_config"

GlobalConfigKey Global Config Key

View Source
const InviteConfigKey = "system:invite_config"

InviteConfigKey Invite Config Key

View Source
const NodeConfigKey = "system:node_config"

NodeConfigKey Node Config Key

View Source
const RegisterConfigKey = "system:register_config"

RegisterConfigKey Register Config Key

View Source
const RegisterIPLimitKeyPrefix = "register:limit:ip:"

RegisterIPLimitKeyPrefix limits new accounts created by the same client IP.

View Source
const SendCountLimitKeyPrefix = "send:limit:"

SendCountLimitKeyPrefix Send Count Limit Key Prefix eg. send:limit:register:email:xxx@ppanel.dev

View Source
const SendIntervalKeyPrefix = "send:interval:"

SendIntervalKeyPrefix Auth Code Send Interval Key Prefix

View Source
const ServerCountCacheKey = "server:count"

ServerCountCacheKey Server Count Cache Key

View Source
const SessionIdKey = "auth:session_id"

SessionIdKey cache session key

View Source
const SiteConfigKey = "system:site_config"

SiteConfigKey Site Config Key

View Source
const SmsConfigKey = "system:sms_config"

SmsConfigKey Mobile Config Key

View Source
const SubscribeConfigKey = "system:subscribe_config"

SubscribeConfigKey Subscribe Config Key

View Source
const TelegramBindKey = "auth:telegram_bind"

TelegramBindKey prefixes the single-use Telegram account-binding tokens handed to the bot's deep link. It is deliberately separate from SessionIdKey: a binding capability must not double as a session credential, and it is consumed on first use.

View Source
const TelegramCallbackKey = "auth:telegram_callback"

TelegramCallbackKey prefixes the redeemed Telegram login/bind callbacks. The widget result is a bearer credential that travels in a URL fragment, so it may only be exchanged once.

View Source
const TelegramConfigKey = "system:telegram_config"

TelegramConfigKey Telegram Config Key

View Source
const TosConfigKey = "system:tos_config"

TosConfigKey Tos配置

View Source
const VerifyCodeAttemptKeyPrefix = "auth:verify:attempt:"

VerifyCodeAttemptKeyPrefix limits guesses against a verification code.

View Source
const VerifyCodeConfigKey = "system:verify_code_config"

VerifyCodeConfigKey Verify Code Config Key

View Source
const VerifyConfigKey = "system:verify_config"

VerifyConfigKey Verify Config Key

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Model         string              `yaml:"Model" default:"prod"`
	Host          string              `yaml:"Host" default:"0.0.0.0"`
	Port          int                 `yaml:"Port" default:"8080"`
	Debug         bool                `yaml:"Debug" default:"false"`
	AppLocation   string              `yaml:"AppLocation" default:"Asia/Shanghai"`
	Transport     TransportConfig     `yaml:"Transport"`
	TLS           TLS                 `yaml:"TLS"`
	JwtAuth       JwtAuth             `yaml:"JwtAuth"`
	Logger        logger.LogConf      `yaml:"Logger"`
	Database      orm.Config          `yaml:"Database"`
	MySQL         *orm.Config         `yaml:"MySQL,omitempty"` // Deprecated: use Database.
	Redis         RedisConfig         `yaml:"Redis"`
	Site          SiteConfig          `yaml:"Site"`
	Node          NodeConfig          `yaml:"Node"`
	Mobile        MobileConfig        `yaml:"Mobile"`
	Email         EmailConfig         `yaml:"Email"`
	Device        DeviceConfig        `yaml:"device"`
	Verify        Verify              `yaml:"Verify"`
	VerifyCode    VerifyCode          `yaml:"VerifyCode"`
	Register      RegisterConfig      `yaml:"Register"`
	Subscribe     SubscribeConfig     `yaml:"Subscribe"`
	EdgeSubscribe EdgeSubscribeConfig `yaml:"EdgeSubscribe"`
	Invite        InviteConfig        `yaml:"Invite"`
	Telegram      Telegram            `yaml:"Telegram"`
	Log           Log                 `yaml:"Log"`
	Currency      Currency            `yaml:"Currency"`
	Administrator struct {
		Email    string `yaml:"Email" default:"admin@ppanel.dev"`
		Password string `yaml:"Password" default:"password"`
	} `yaml:"Administrator"`
}

func (Config) DatabaseConfig added in v1.2.12

func (c Config) DatabaseConfig() orm.Config

func (*Config) SetDatabaseConfig added in v1.2.12

func (c *Config) SetDatabaseConfig(cfg orm.Config)

type Currency added in v1.2.5

type Currency struct {
	Unit      string `yaml:"Unit" default:"CNY"`
	Symbol    string `yaml:"Symbol" default:"USD"`
	AccessKey string `yaml:"AccessKey" default:""`
}

type DeviceConfig added in v1.1.8

type DeviceConfig struct {
	Enable         bool   `yaml:"enable" default:"true"`
	ShowAds        bool   `yaml:"show_ads"`
	EnableSecurity bool   `yaml:"enable_security"`
	OnlyRealDevice bool   `yaml:"only_real_device"`
	SecuritySecret string `yaml:"security_secret"`
}

type EdgeSubscribeAccessKey added in v1.14.15

type EdgeSubscribeAccessKey struct {
	ID     string `yaml:"ID"`
	Secret string `yaml:"Secret"`
}

EdgeSubscribeAccessKey is an HMAC credential owned by a Worker deployment. Secret must be stored only in the PPanel runtime config and the Worker secret store; it must never be returned from an API.

type EdgeSubscribeConfig added in v1.14.15

type EdgeSubscribeConfig struct {
	Enabled             bool                     `yaml:"Enabled" default:"false"`
	MaxClockSkewSeconds int64                    `yaml:"MaxClockSkewSeconds" default:"300"`
	Keys                []EdgeSubscribeAccessKey `yaml:"Keys"`
}

EdgeSubscribeConfig configures the private manifest API consumed by the Cloudflare edge-subscribe Worker. It intentionally has no relationship to the user-facing subscription template configuration above.

type EmailConfig

type EmailConfig struct {
	Enable                     bool   `yaml:"Enable" default:"true"`
	Platform                   string `yaml:"platform"`
	PlatformConfig             string `yaml:"platform_config"`
	EnableVerify               bool   `yaml:"enable_verify"`
	EnableNotify               bool   `yaml:"enable_notify"`
	EnableDomainSuffix         bool   `yaml:"enable_domain_suffix"`
	DomainSuffixList           string `yaml:"domain_suffix_list"`
	VerifyEmailTemplate        string `yaml:"verify_email_template"`
	ExpirationEmailTemplate    string `yaml:"expiration_email_template"`
	MaintenanceEmailTemplate   string `yaml:"maintenance_email_template"`
	TrafficExceedEmailTemplate string `yaml:"traffic_exceed_email_template"`
	// Subjects pair with the templates above and hydrate from the email auth
	// config by field name (tool.DeepCopy); empty means the queued fallback
	// subject is used.
	VerifyEmailSubject        string `yaml:"verify_email_subject"`
	ExpirationEmailSubject    string `yaml:"expiration_email_subject"`
	MaintenanceEmailSubject   string `yaml:"maintenance_email_subject"`
	TrafficExceedEmailSubject string `yaml:"traffic_exceed_email_subject"`
}

type File

type File struct {
	Host          string              `yaml:"Host" default:"0.0.0.0"`
	Port          int                 `yaml:"Port" default:"8080"`
	Transport     TransportConfig     `yaml:"Transport"`
	TLS           TLS                 `yaml:"TLS"`
	Debug         bool                `yaml:"Debug" default:"true"`
	JwtAuth       JwtAuth             `yaml:"JwtAuth"`
	Logger        logger.LogConf      `yaml:"Logger"`
	Database      orm.Config          `yaml:"Database"`
	MySQL         *orm.Config         `yaml:"MySQL,omitempty"` // Deprecated: use Database.
	Redis         RedisConfig         `yaml:"Redis"`
	EdgeSubscribe EdgeSubscribeConfig `yaml:"EdgeSubscribe"`
}

func (File) DatabaseConfig added in v1.2.12

func (f File) DatabaseConfig() orm.Config

func (*File) SetDatabaseConfig added in v1.2.12

func (f *File) SetDatabaseConfig(cfg orm.Config)

type InviteConfig

type InviteConfig struct {
	ForcedInvite       bool  `yaml:"ForcedInvite" default:"false"`
	ReferralPercentage int64 `yaml:"ReferralPercentage" default:"0"`
	OnlyFirstPurchase  bool  `yaml:"OnlyFirstPurchase" default:"false"`
}

type JwtAuth

type JwtAuth struct {
	AccessSecret string `yaml:"AccessSecret"`
	AccessExpire int64  `yaml:"AccessExpire" default:"604800"`
}

type Log added in v1.1.0

type Log struct {
	AutoClear bool  `yaml:"AutoClear" default:"true"`
	ClearDays int64 `yaml:"ClearDays" default:"7"`
}

type MobileConfig

type MobileConfig struct {
	Enable          bool     `yaml:"Enable" default:"true"`
	Platform        string   `yaml:"platform"`
	PlatformConfig  string   `yaml:"platform_config"`
	EnableVerify    bool     `yaml:"enable_verify"`
	EnableWhitelist bool     `yaml:"enable_whitelist"`
	Whitelist       []string `yaml:"whitelist"`
}

type NodeConfig

type NodeConfig struct {
	NodeSecret             string         `yaml:"NodeSecret" default:""`
	NodePullInterval       int64          `yaml:"NodePullInterval" default:"60"`
	NodePushInterval       int64          `yaml:"NodePushInterval" default:"60"`
	TrafficReportThreshold int64          `yaml:"TrafficReportThreshold" default:"0"`
	IPStrategy             string         `yaml:"IPStrategy" default:""`
	DNS                    []NodeDNS      `yaml:"DNS"`
	Block                  []string       `yaml:"Block" `
	Outbound               []NodeOutbound `yaml:"Outbound"`
}

func (*NodeConfig) Marshal added in v1.1.2

func (n *NodeConfig) Marshal() ([]byte, error)

func (*NodeConfig) Unmarshal added in v1.1.2

func (n *NodeConfig) Unmarshal(data []byte) error

type NodeDBConfig added in v1.1.2

type NodeDBConfig struct {
	NodeSecret             string
	NodePullInterval       int64
	NodePushInterval       int64
	TrafficReportThreshold int64
	IPStrategy             string
	DNS                    string
	Block                  string
	Outbound               string
}

type NodeDNS added in v1.1.2

type NodeDNS struct {
	Proto      string   `json:"proto"`
	Address    string   `json:"address"`
	ServerName string   `json:"server_name,omitempty"`
	Domains    []string `json:"domains"`
}

func (*NodeDNS) Marshal added in v1.1.2

func (n *NodeDNS) Marshal() ([]byte, error)

func (*NodeDNS) Unmarshal added in v1.1.2

func (n *NodeDNS) Unmarshal(data []byte) error

type NodeOutbound added in v1.1.2

type NodeOutbound struct {
	Name                 string   `json:"name"`
	Protocol             string   `json:"protocol"`
	Address              string   `json:"address"`
	Port                 int64    `json:"port"`
	User                 string   `json:"user,omitempty"`
	Password             string   `json:"password"`
	UUID                 string   `json:"uuid,omitempty"`
	Cipher               string   `json:"cipher,omitempty"`
	Plugin               string   `json:"plugin,omitempty"`
	PluginOptions        any      `json:"plugin_opts,omitempty"`
	Security             string   `json:"security,omitempty"`
	SNI                  string   `json:"sni,omitempty"`
	ALPN                 []string `json:"alpn,omitempty"`
	AllowInsecure        bool     `json:"allow_insecure,omitempty"`
	Fingerprint          string   `json:"fingerprint,omitempty"`
	Transport            string   `json:"transport,omitempty"`
	Host                 string   `json:"host,omitempty"`
	Path                 string   `json:"path,omitempty"`
	ServiceName          string   `json:"service_name,omitempty"`
	XHTTPMode            string   `json:"xhttp_mode,omitempty"`
	XHTTPExtra           string   `json:"xhttp_extra,omitempty"`
	Flow                 string   `json:"flow,omitempty"`
	Encryption           string   `json:"encryption,omitempty"`
	EncryptionMode       string   `json:"encryption_mode,omitempty"`
	EncryptionRTT        string   `json:"encryption_rtt,omitempty"`
	EncryptionTicket     string   `json:"encryption_ticket,omitempty"`
	EncryptionPadding    string   `json:"encryption_client_padding,omitempty"`
	EncryptionPassword   string   `json:"encryption_password,omitempty"`
	Multiplex            string   `json:"multiplex,omitempty"`
	UoT                  bool     `json:"uot,omitempty"`
	UoTVersion           int      `json:"uot_version,omitempty"`
	CongestionController string   `json:"congestion_controller,omitempty"`
	UDPStream            bool     `json:"udp_stream,omitempty"`
	ReduceRtt            bool     `json:"reduce_rtt,omitempty"`
	Heartbeat            int      `json:"heartbeat,omitempty"`
	RealityPublicKey     string   `json:"reality_public_key,omitempty"`
	RealityShortId       string   `json:"reality_short_id,omitempty"`
	SpiderX              string   `json:"spider_x,omitempty"`
	Settings             string   `json:"settings,omitempty"`
	StreamSettings       string   `json:"stream_settings,omitempty"`
	Rules                []string `json:"rules"`
}

func (*NodeOutbound) Marshal added in v1.1.2

func (n *NodeOutbound) Marshal() ([]byte, error)

type RedisConfig

type RedisConfig struct {
	Host string `yaml:"Host" default:"localhost:6379"`
	Pass string `yaml:"Pass" default:""`
	DB   int    `yaml:"DB" default:"0"`
}

type RegisterConfig

type RegisterConfig struct {
	StopRegister            bool   `yaml:"StopRegister" default:"false"`
	EnableTrial             bool   `yaml:"EnableTrial" default:"false"`
	TrialSubscribe          int64  `yaml:"TrialSubscribe" default:"0"`
	TrialTime               int64  `yaml:"TrialTime" default:"0"`
	TrialTimeUnit           string `yaml:"TrialTimeUnit" default:""`
	IpRegisterLimit         int64  `yaml:"IpRegisterLimit" default:"0"`
	IpRegisterLimitDuration int64  `yaml:"IpRegisterLimitDuration" default:"0"`
	EnableIpRegisterLimit   bool   `yaml:"EnableIpRegisterLimit" default:"false"`
}

type SiteConfig

type SiteConfig struct {
	Host       string `yaml:"Host" default:""`
	SiteName   string `yaml:"SiteName" default:""`
	SiteDesc   string `yaml:"SiteDesc" default:""`
	Keywords   string `yaml:"Keywords" default:""`
	CustomHTML string `yaml:"CustomHTML" default:""`
	CustomData string `yaml:"CustomData" default:""`
}

type SubscribeConfig

type SubscribeConfig struct {
	SingleModel           bool   `yaml:"SingleModel" default:"false"`
	SubscribePath         string `yaml:"SubscribePath" default:"/v1/subscribe/config"`
	SubscribeDomain       string `yaml:"SubscribeDomain" default:""`
	PanDomain             bool   `yaml:"PanDomain" default:"false"`
	UserAgentLimit        bool   `yaml:"UserAgentLimit" default:"false"`
	UserAgentList         string `yaml:"UserAgentList" default:""`
	ShowTutorial          bool   `yaml:"ShowTutorial" default:"true"`
	ProfileUpdateInterval int64  `yaml:"ProfileUpdateInterval" default:"0"`
	ProfileWebPageURL     string `yaml:"ProfileWebPageURL" default:""`
}

type TLS

type TLS struct {
	Enable   bool   `yaml:"Enable" default:"false"`
	CertFile string `yaml:"CertFile" default:""`
	KeyFile  string `yaml:"KeyFile" default:""`
}

type Telegram

type Telegram struct {
	Enable        bool   `yaml:"Enable" default:"false"`
	BotID         int64  `yaml:"BotID" default:""`
	BotName       string `yaml:"BotName" default:""`
	BotToken      string `yaml:"BotToken" default:""`
	EnableNotify  bool   `yaml:"EnableNotify" default:"false"`
	WebHookDomain string `yaml:"WebHookDomain" default:""`
	// GroupChatID is the validated administrators' group; zero when the
	// group is unconfigured or failed validation, which disables every
	// group-side feature (admin commands, topics, notifications).
	GroupChatID int64 `yaml:"GroupChatID" default:"0"`
}

type TransportConfig added in v1.2.14

type TransportConfig struct {
	Driver string `yaml:"Driver" default:"hertz"`
}

type Verify

type Verify struct {
	TurnstileSiteKey    string `yaml:"TurnstileSiteKey" default:""`
	TurnstileSecret     string `yaml:"TurnstileSecret" default:""`
	LoginVerify         bool   `yaml:"LoginVerify" default:"false"`
	RegisterVerify      bool   `yaml:"RegisterVerify" default:"false"`
	ResetPasswordVerify bool   `yaml:"ResetPasswordVerify" default:"false"`
}

type VerifyCode

type VerifyCode struct {
	ExpireTime int64 `yaml:"ExpireTime" default:"300"`
	Limit      int64 `yaml:"Limit" default:"15"`
	Interval   int64 `yaml:"Interval" default:"60"`
}

Jump to

Keyboard shortcuts

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