system

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PreviewNodeMultiplier

func PreviewNodeMultiplier(now time.Time, periods []TimePeriod) float32

Types

type CurrencyConfig

type CurrencyConfig struct {
	AccessKey      string `json:"AccessKey"`
	CurrencyUnit   string `json:"CurrencyUnit"`
	CurrencySymbol string `json:"CurrencySymbol"`
}

CurrencyConfig 货币配置

type InviteConfig

type InviteConfig struct {
	ForcedInvite       bool `json:"ForcedInvite"`
	ReferralPercentage int  `json:"ReferralPercentage"`
	OnlyFirstPurchase  bool `json:"OnlyFirstPurchase"`
}

InviteConfig 邀请配置

type NodeConfig

type NodeConfig struct {
	NodeSecret             string `json:"NodeSecret"`
	NodePullInterval       int    `json:"NodePullInterval"`
	NodePushInterval       int    `json:"NodePushInterval"`
	TrafficReportThreshold int    `json:"TrafficReportThreshold"`
	IPStrategy             string `json:"IPStrategy"`
	DNS                    string `json:"DNS"`      // JSON string
	Block                  string `json:"Block"`    // JSON string
	Outbound               string `json:"Outbound"` // JSON string
	DeviceAdmissionEnabled bool   `json:"DeviceAdmissionEnabled"`
	DeviceCountMode        string `json:"DeviceCountMode"`
}

NodeConfig 节点配置

type NodeDNS

type NodeDNS struct {
	Proto   string   `json:"Proto"`
	Address string   `json:"Address"`
	Domains []string `json:"Domains"`
}

NodeDNS 节点DNS配置

type NodeOutbound

type NodeOutbound struct {
	Name     string   `json:"Name"`
	Protocol string   `json:"Protocol"`
	Address  string   `json:"Address"`
	Port     int      `json:"Port"`
	Password string   `json:"Password"`
	Rules    []string `json:"Rules"`
}

NodeOutbound 节点出站配置

type PrivacyPolicyConfig

type PrivacyPolicyConfig struct {
	PrivacyPolicy string `json:"PrivacyPolicy"`
}

PrivacyPolicyConfig 隐私政策配置

type RegisterConfig

type RegisterConfig struct {
	StopRegister            bool   `json:"StopRegister"`
	EnableTrial             bool   `json:"EnableTrial"`
	TrialSubscribe          int    `json:"TrialSubscribe"`
	TrialTime               int    `json:"TrialTime"`
	TrialTimeUnit           string `json:"TrialTimeUnit"`
	EnableIpRegisterLimit   bool   `json:"EnableIpRegisterLimit"`
	IpRegisterLimit         int    `json:"IpRegisterLimit"`
	IpRegisterLimitDuration int    `json:"IpRegisterLimitDuration"`
	DeviceLimit             int    `json:"DeviceLimit"`
}

RegisterConfig 注册配置

type SiteConfig

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

SiteConfig 站点配置

type SubscribeConfig

type SubscribeConfig struct {
	SingleModel     bool   `json:"SingleModel"`
	SubscribePath   string `json:"SubscribePath"`
	SubscribeDomain string `json:"SubscribeDomain"`
	PanDomain       bool   `json:"PanDomain"`
	UserAgentLimit  bool   `json:"UserAgentLimit"`
	UserAgentList   string `json:"UserAgentList"`
}

SubscribeConfig 订阅配置

type SystemModule

type SystemModule struct {
	ServiceName    string
	ServiceVersion string
	Secret         string
}

type SystemRepo

type SystemRepo interface {
	GetConfigByCategory(ctx context.Context, category string) ([]*tool.SystemConfig, error)
	UpdateConfigByCategory(ctx context.Context, category string, configs map[string]*tool.SystemConfig) error
	GetNodeMultiplier(ctx context.Context) (string, error)
	UpdateNodeMultiplier(ctx context.Context, value string) error
	ApplyTelegramBot(ctx context.Context) error
}

SystemRepo defines the interface for system repository

type SystemUsecase

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

SystemUsecase is the system use case

func NewSystemUsecase

func NewSystemUsecase(repo SystemRepo, logger log.Logger) *SystemUsecase

NewSystemUsecase creates a new system use case

func (*SystemUsecase) ApplyTelegramBot

func (uc *SystemUsecase) ApplyTelegramBot(ctx context.Context) error

func (*SystemUsecase) GetCurrencyConfig

func (uc *SystemUsecase) GetCurrencyConfig(ctx context.Context) (*CurrencyConfig, error)

GetCurrencyConfig 获取货币配置

func (*SystemUsecase) GetInviteConfig

func (uc *SystemUsecase) GetInviteConfig(ctx context.Context) (*InviteConfig, error)

GetInviteConfig 获取邀请配置

func (*SystemUsecase) GetNodeConfig

func (uc *SystemUsecase) GetNodeConfig(ctx context.Context) (*NodeConfig, error)

GetNodeConfig 获取节点配置

func (*SystemUsecase) GetNodeMultiplier

func (uc *SystemUsecase) GetNodeMultiplier(ctx context.Context) ([]TimePeriod, error)

GetNodeMultiplier 获取节点倍率配置

func (*SystemUsecase) GetPrivacyPolicyConfig

func (uc *SystemUsecase) GetPrivacyPolicyConfig(ctx context.Context) (*PrivacyPolicyConfig, error)

GetPrivacyPolicyConfig 获取隐私政策配置

func (*SystemUsecase) GetRegisterConfig

func (uc *SystemUsecase) GetRegisterConfig(ctx context.Context) (*RegisterConfig, error)

GetRegisterConfig 获取注册配置

func (*SystemUsecase) GetSiteConfig

func (uc *SystemUsecase) GetSiteConfig(ctx context.Context) (*SiteConfig, error)

GetSiteConfig 获取站点配置

func (*SystemUsecase) GetSubscribeConfig

func (uc *SystemUsecase) GetSubscribeConfig(ctx context.Context) (*SubscribeConfig, error)

GetSubscribeConfig 获取订阅配置

func (*SystemUsecase) GetSystemModule

func (uc *SystemUsecase) GetSystemModule(ctx context.Context) (*SystemModule, error)

func (*SystemUsecase) GetTosConfig

func (uc *SystemUsecase) GetTosConfig(ctx context.Context) (*TosConfig, error)

GetTosConfig 获取服务条款配置

func (*SystemUsecase) GetVerifyCodeConfig

func (uc *SystemUsecase) GetVerifyCodeConfig(ctx context.Context) (*VerifyCodeConfig, error)

GetVerifyCodeConfig 获取验证码配置

func (*SystemUsecase) GetVerifyConfig

func (uc *SystemUsecase) GetVerifyConfig(ctx context.Context) (*VerifyConfig, error)

GetVerifyConfig 获取验证配置

func (*SystemUsecase) SetNodeMultiplier

func (uc *SystemUsecase) SetNodeMultiplier(ctx context.Context, periods []TimePeriod) error

SetNodeMultiplier 设置节点倍率配置

func (*SystemUsecase) UpdateCurrencyConfig

func (uc *SystemUsecase) UpdateCurrencyConfig(ctx context.Context, config *CurrencyConfig) error

UpdateCurrencyConfig 更新货币配置

func (*SystemUsecase) UpdateInviteConfig

func (uc *SystemUsecase) UpdateInviteConfig(ctx context.Context, config *InviteConfig) error

UpdateInviteConfig 更新邀请配置

func (*SystemUsecase) UpdateNodeConfig

func (uc *SystemUsecase) UpdateNodeConfig(ctx context.Context, config *NodeConfig) error

UpdateNodeConfig 更新节点配置

func (*SystemUsecase) UpdatePrivacyPolicyConfig

func (uc *SystemUsecase) UpdatePrivacyPolicyConfig(ctx context.Context, config *PrivacyPolicyConfig) error

UpdatePrivacyPolicyConfig 更新隐私政策配置

func (*SystemUsecase) UpdateRegisterConfig

func (uc *SystemUsecase) UpdateRegisterConfig(ctx context.Context, config *RegisterConfig) error

UpdateRegisterConfig 更新注册配置

func (*SystemUsecase) UpdateSiteConfig

func (uc *SystemUsecase) UpdateSiteConfig(ctx context.Context, config *SiteConfig) error

UpdateSiteConfig 更新站点配置

func (*SystemUsecase) UpdateSubscribeConfig

func (uc *SystemUsecase) UpdateSubscribeConfig(ctx context.Context, config *SubscribeConfig) error

UpdateSubscribeConfig 更新订阅配置

func (*SystemUsecase) UpdateTosConfig

func (uc *SystemUsecase) UpdateTosConfig(ctx context.Context, config *TosConfig) error

UpdateTosConfig 更新服务条款配置

func (*SystemUsecase) UpdateVerifyCodeConfig

func (uc *SystemUsecase) UpdateVerifyCodeConfig(ctx context.Context, config *VerifyCodeConfig) error

UpdateVerifyCodeConfig 更新验证码配置

func (*SystemUsecase) UpdateVerifyConfig

func (uc *SystemUsecase) UpdateVerifyConfig(ctx context.Context, config *VerifyConfig) error

UpdateVerifyConfig 更新验证配置

type TimePeriod

type TimePeriod struct {
	StartTime  string  `json:"StartTime"`
	EndTime    string  `json:"EndTime"`
	Multiplier float32 `json:"Multiplier"`
}

TimePeriod 时间段倍率

type TosConfig

type TosConfig struct {
	TosContent string `json:"TosContent"`
}

TosConfig 服务条款配置

type VerifyCodeConfig

type VerifyCodeConfig struct {
	VerifyCodeExpireTime int `json:"VerifyCodeExpireTime"`
	VerifyCodeLimit      int `json:"VerifyCodeLimit"`
	VerifyCodeInterval   int `json:"VerifyCodeInterval"`
}

VerifyCodeConfig 验证码配置

type VerifyConfig

type VerifyConfig struct {
	CaptchaType                    string `json:"CaptchaType"`
	TurnstileSiteKey               string `json:"TurnstileSiteKey"`
	TurnstileSecret                string `json:"TurnstileSecret"`
	EnableUserLoginCaptcha         bool   `json:"EnableUserLoginCaptcha"`
	EnableUserRegisterCaptcha      bool   `json:"EnableUserRegisterCaptcha"`
	EnableAdminLoginCaptcha        bool   `json:"EnableAdminLoginCaptcha"`
	EnableUserResetPasswordCaptcha bool   `json:"EnableUserResetPasswordCaptcha"`
}

VerifyConfig 验证配置

Jump to

Keyboard shortcuts

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