Documentation
¶
Index ¶
- Variables
- type AcmeService
- type ClientService
- func (s *ClientService) DepleteClients() ([]uint, []string, error)
- func (s *ClientService) Get(id string) (*[]model.Client, error)
- func (s *ClientService) GetAll() (*[]model.Client, error)
- func (s *ClientService) ResetAllClientsTraffic() error
- func (s *ClientService) ResetClients(tx *gorm.DB, dt int64) ([]uint, error)
- func (s *ClientService) Save(tx *gorm.DB, act string, data json.RawMessage, hostname string) ([]uint, error)
- func (s *ClientService) UpdateClientsOnInboundAdd(tx *gorm.DB, initIds string, inboundId uint, hostname string) error
- func (s *ClientService) UpdateClientsOnInboundDelete(tx *gorm.DB, id uint, tag string) error
- func (s *ClientService) UpdateLinksByInboundChange(tx *gorm.DB, inbounds *[]model.Inbound, hostname string, oldTag string) error
- type ConfigService
- func (s *ConfigService) CheckChanges(lu string) (bool, error)
- func (s *ConfigService) CheckOutbound(tag string, link string) core.CheckOutboundResult
- func (s *ConfigService) GetChanges(actor string, chngKey string, count string) []model.Changes
- func (s *ConfigService) GetConfig(data string) (*[]byte, error)
- func (s *ConfigService) RestartCore() error
- func (s *ConfigService) Save(obj string, act string, data json.RawMessage, initUsers string, ...) ([]string, error)
- func (s *ConfigService) StartCore() error
- func (s *ConfigService) StopCore() error
- func (s *ConfigService) TestAcme(domain, email string) error
- type EndpointService
- type InboundService
- func (s *InboundService) FromIds(ids []uint) ([]*model.Inbound, error)
- func (s *InboundService) Get(ids string) (*[]map[string]interface{}, error)
- func (s *InboundService) GetAll() (*[]map[string]interface{}, error)
- func (s *InboundService) GetAllConfig(db *gorm.DB) ([]json.RawMessage, error)
- func (s *InboundService) RestartInbounds(tx *gorm.DB, ids []uint) error
- func (s *InboundService) Save(tx *gorm.DB, act string, data json.RawMessage, initUserIds string, ...) error
- func (s *InboundService) UpdateInboundsUsers(tx *gorm.DB, ids []uint) error
- func (s *InboundService) UpdateOutJsons(tx *gorm.DB, inboundIds []uint, hostname string) error
- type IssueResult
- type NginxStatus
- type NodeMem
- type NodeService
- func (s *NodeService) GetAll() ([]map[string]interface{}, error)
- func (s *NodeService) GetStatuses() map[uint]NodeStatus
- func (s *NodeService) RefreshAll()
- func (s *NodeService) Save(tx *gorm.DB, act string, data json.RawMessage) error
- func (s *NodeService) TestNode(data json.RawMessage) (NodeStatus, error)
- type NodeStatus
- type NodeSyncService
- func (s *NodeSyncService) AdoptInbounds(nodeId uint, tags []string, actor string) error
- func (s *NodeSyncService) CollectTraffic()
- func (s *NodeSyncService) FetchNodeInbounds(nodeId uint) ([]remoteInbound, error)
- func (s *NodeSyncService) MarkAllDirty()
- func (s *NodeSyncService) Reconcile(nodeId uint) error
- func (s *NodeSyncService) ReconcileAllOnline()
- func (s *NodeSyncService) ReconcileDirtyOnline()
- func (s *NodeSyncService) ReconcileNow(nodeId uint) error
- type OutboundService
- type PanelService
- type ServerService
- func (s *ServerService) GenKeypair(keyType string, options string) []string
- func (s *ServerService) GetCpuPercent() float64
- func (s *ServerService) GetDatabaseInfo() map[string]int64
- func (s *ServerService) GetDiskIO() map[string]interface{}
- func (s *ServerService) GetDiskInfo() map[string]interface{}
- func (s *ServerService) GetLogs(count string, level string) []string
- func (s *ServerService) GetMemInfo() map[string]interface{}
- func (s *ServerService) GetNetInfo() map[string]interface{}
- func (s *ServerService) GetSingboxInfo() map[string]interface{}
- func (s *ServerService) GetStatus(request string) *map[string]interface{}
- func (s *ServerService) GetSwapInfo() map[string]interface{}
- func (s *ServerService) GetSystemInfo() map[string]interface{}
- type ServicesService
- func (s *ServicesService) GetAll() (*[]map[string]interface{}, error)
- func (s *ServicesService) GetAllConfig(db *gorm.DB) ([]json.RawMessage, error)
- func (s *ServicesService) RestartServices(tx *gorm.DB, ids []uint) error
- func (s *ServicesService) Save(tx *gorm.DB, act string, data json.RawMessage) error
- type SettingService
- func (s *SettingService) GetAllSetting() (*map[string]string, error)
- func (s *SettingService) GetCertFile() (string, error)
- func (s *SettingService) GetConfig() (string, error)
- func (s *SettingService) GetFinalSubURI(host string) (string, error)
- func (s *SettingService) GetGlobalReset() (string, error)
- func (s *SettingService) GetGlobalResetLast() (int64, error)
- func (s *SettingService) GetKeyFile() (string, error)
- func (s *SettingService) GetListen() (string, error)
- func (s *SettingService) GetPort() (int, error)
- func (s *SettingService) GetSecret() ([]byte, error)
- func (s *SettingService) GetSessionMaxAge() (int, error)
- func (s *SettingService) GetStatsBucketSeconds() (int64, error)
- func (s *SettingService) GetSubAcmeEmail() (string, error)
- func (s *SettingService) GetSubCertFile() (string, error)
- func (s *SettingService) GetSubCertMode() (string, error)
- func (s *SettingService) GetSubClashExt() (string, error)
- func (s *SettingService) GetSubClashNoDefGrp() (bool, error)
- func (s *SettingService) GetSubClashSprtAll() (bool, error)
- func (s *SettingService) GetSubDomain() (string, error)
- func (s *SettingService) GetSubEncode() (bool, error)
- func (s *SettingService) GetSubJsonExt() (string, error)
- func (s *SettingService) GetSubKeyFile() (string, error)
- func (s *SettingService) GetSubListen() (string, error)
- func (s *SettingService) GetSubPath() (string, error)
- func (s *SettingService) GetSubPort() (int, error)
- func (s *SettingService) GetSubShowInfo() (bool, error)
- func (s *SettingService) GetSubURI() (string, error)
- func (s *SettingService) GetSubUpdates() (int, error)
- func (s *SettingService) GetTimeLocation() (*time.Location, error)
- func (s *SettingService) GetTrafficAge() (int, error)
- func (s *SettingService) GetWebAcmeEmail() (string, error)
- func (s *SettingService) GetWebCertMode() (string, error)
- func (s *SettingService) GetWebDomain() (string, error)
- func (s *SettingService) GetWebNginx() (bool, error)
- func (s *SettingService) GetWebPath() (string, error)
- func (s *SettingService) GetWebURI() (string, error)
- func (s *SettingService) ResetSettings() error
- func (s *SettingService) Save(tx *gorm.DB, data json.RawMessage) error
- func (s *SettingService) SaveConfig(tx *gorm.DB, config json.RawMessage) error
- func (s *SettingService) SetConfig(config string) error
- func (s *SettingService) SetGlobalResetLast(value int64) error
- func (s *SettingService) SetPort(port int) error
- func (s *SettingService) SetSubPath(subPath string) error
- func (s *SettingService) SetSubPort(subPort int) error
- func (s *SettingService) SetWebPath(webPath string) error
- type SingBoxConfig
- type StatsService
- type TlsService
- type UpdatePhase
- type UpdateService
- type UpdateStatus
- type UserService
- func (s *UserService) AddToken(username string, expiry int64, desc string) (string, error)
- func (s *UserService) ChangePass(id string, oldPass string, newUser string, newPass string) error
- func (s *UserService) CheckUser(username string, password string, remoteIP string) *model.User
- func (s *UserService) DeleteToken(id string) error
- func (s *UserService) GetFirstUser() (*model.User, error)
- func (s *UserService) GetUserTokens(username string) (*[]model.Tokens, error)
- func (s *UserService) GetUsers() (*[]model.User, error)
- func (s *UserService) LoadTokens() ([]byte, error)
- func (s *UserService) Login(username string, password string, remoteIP string) (string, error)
- func (s *UserService) UpdateFirstUser(username string, password string) error
- type WarpService
Constants ¶
This section is empty.
Variables ¶
var (
LastUpdate int64
)
Functions ¶
This section is empty.
Types ¶
type AcmeService ¶ added in v1.4.7
type AcmeService struct{}
AcmeService 是无状态工具,不嵌入 SettingService(避免与 ApiService 已嵌入的 SettingService 产生方法集二义性)。所有入参由调用方传入,不直接读写数据库。
func (*AcmeService) DetectNginx ¶ added in v1.4.7
func (a *AcmeService) DetectNginx() NginxStatus
DetectNginx 检测 nginx 是否安装并运行,以及 80 端口是否被占用。Windows 直接返回零值。
func (*AcmeService) IssueWeb ¶ added in v1.4.7
func (a *AcmeService) IssueWeb(domain, email, method string, force, behindProxy bool) (*IssueResult, error)
IssueWeb 为面板/订阅申请证书并安装到 /root/cert/{域名}/。
- method :standalone / nginx / auto(空视同 auto),解析与可行性校验见 resolveMethod。
- force :域名已有未到期证书时 acme.sh 默认跳过签发,force 时加 --force 强制续期。
- behindProxy:webNginx=true,即反向代理终结 TLS、nginx 是证书消费方(决定 reloadcmd)。
func (*AcmeService) ListCerts ¶ added in v1.4.7
func (a *AcmeService) ListCerts() (string, error)
ListCerts 返回 acme.sh 已管理的证书列表,供前端展示、避免重复申请触发 LE 限速。
type ClientService ¶
type ClientService struct{}
func (*ClientService) DepleteClients ¶
func (s *ClientService) DepleteClients() ([]uint, []string, error)
DepleteClients disables clients over quota or past expiry and returns both the affected local inbound ids (to hot-restart) and the disabled client names (so the caller can fan the disable out to nodes). With cluster totals folded into up/down, the quota check is already a whole-cluster judgement.
func (*ClientService) ResetAllClientsTraffic ¶ added in v1.5.4
func (s *ClientService) ResetAllClientsTraffic() error
ResetAllClientsTraffic zeroes up/down for every client (accumulating into the total counters) and re-enables all of them, in a single bulk update. Used by the global periodic traffic reset; the caller restarts the core afterwards so re-enabled clients take effect.
func (*ClientService) ResetClients ¶
func (*ClientService) Save ¶
func (s *ClientService) Save(tx *gorm.DB, act string, data json.RawMessage, hostname string) ([]uint, error)
func (*ClientService) UpdateClientsOnInboundAdd ¶
func (*ClientService) UpdateClientsOnInboundDelete ¶
func (*ClientService) UpdateLinksByInboundChange ¶
type ConfigService ¶
type ConfigService struct {
ClientService
TlsService
SettingService
InboundService
OutboundService
ServicesService
EndpointService
NodeService
}
func NewConfigService ¶
func NewConfigService(core *core.Core) *ConfigService
func (*ConfigService) CheckChanges ¶
func (s *ConfigService) CheckChanges(lu string) (bool, error)
func (*ConfigService) CheckOutbound ¶
func (s *ConfigService) CheckOutbound(tag string, link string) core.CheckOutboundResult
func (*ConfigService) GetChanges ¶
func (*ConfigService) RestartCore ¶
func (s *ConfigService) RestartCore() error
func (*ConfigService) Save ¶
func (s *ConfigService) Save(obj string, act string, data json.RawMessage, initUsers string, loginUser string, hostname string) ([]string, error)
func (*ConfigService) StartCore ¶
func (s *ConfigService) StartCore() error
func (*ConfigService) StopCore ¶
func (s *ConfigService) StopCore() error
func (*ConfigService) TestAcme ¶
func (s *ConfigService) TestAcme(domain, email string) error
TestAcme attempts to obtain a certificate for the domain right now, so the UI can verify ACME actually works (domain resolves, port 80 reachable, etc.) BEFORE the user commits the setting. On success the certificate is cached, so the subsequent panel restart serves HTTPS without another challenge.
type EndpointService ¶
type EndpointService struct {
WarpService
}
func (*EndpointService) GetAll ¶
func (o *EndpointService) GetAll() (*[]map[string]interface{}, error)
func (*EndpointService) GetAllConfig ¶
func (o *EndpointService) GetAllConfig(db *gorm.DB) ([]json.RawMessage, error)
func (*EndpointService) Save ¶
func (s *EndpointService) Save(tx *gorm.DB, act string, data json.RawMessage) error
type InboundService ¶
type InboundService struct {
ClientService
}
func (*InboundService) FromIds ¶
func (s *InboundService) FromIds(ids []uint) ([]*model.Inbound, error)
func (*InboundService) Get ¶
func (s *InboundService) Get(ids string) (*[]map[string]interface{}, error)
func (*InboundService) GetAll ¶
func (s *InboundService) GetAll() (*[]map[string]interface{}, error)
func (*InboundService) GetAllConfig ¶
func (s *InboundService) GetAllConfig(db *gorm.DB) ([]json.RawMessage, error)
func (*InboundService) RestartInbounds ¶
func (s *InboundService) RestartInbounds(tx *gorm.DB, ids []uint) error
func (*InboundService) Save ¶
func (s *InboundService) Save(tx *gorm.DB, act string, data json.RawMessage, initUserIds string, hostname string) error
func (*InboundService) UpdateInboundsUsers ¶ added in v1.6.0
func (s *InboundService) UpdateInboundsUsers(tx *gorm.DB, ids []uint) error
func (*InboundService) UpdateOutJsons ¶
type IssueResult ¶ added in v1.4.7
type NginxStatus ¶ added in v1.4.7
type NodeService ¶ added in v1.6.0
type NodeService struct {
}
func (*NodeService) GetAll ¶ added in v1.6.0
func (s *NodeService) GetAll() ([]map[string]interface{}, error)
GetAll returns nodes in panel shape. The token never leaves the server — only a tokenSet flag does.
func (*NodeService) GetStatuses ¶ added in v1.6.0
func (s *NodeService) GetStatuses() map[uint]NodeStatus
GetStatuses returns a copy of the live snapshot for API responses.
func (*NodeService) RefreshAll ¶ added in v1.6.0
func (s *NodeService) RefreshAll()
RefreshAll probes every enabled node with bounded parallelism and atomically swaps in a freshly built snapshot. Called by the @every 5s cron job.
func (*NodeService) Save ¶ added in v1.6.0
func (s *NodeService) Save(tx *gorm.DB, act string, data json.RawMessage) error
func (*NodeService) TestNode ¶ added in v1.6.0
func (s *NodeService) TestNode(data json.RawMessage) (NodeStatus, error)
TestNode probes the node described by the (possibly unsaved) form data with a one-off client, so Test Connection reflects the form, not the DB row. An empty token on an existing node falls back to the stored one.
type NodeStatus ¶ added in v1.6.0
type NodeStatus struct {
State string `json:"state"` // online | offline | core-stopped
Latency int64 `json:"latency"`
Cpu float64 `json:"cpu"`
Mem NodeMem `json:"mem"`
AppVersion string `json:"appVersion"`
CoreVersion string `json:"coreVersion"`
Error string `json:"error,omitempty"`
CheckedAt int64 `json:"checkedAt"`
LastOnline int64 `json:"lastOnline"`
}
type NodeSyncService ¶ added in v1.6.0
type NodeSyncService struct {
NodeService
}
NodeSyncService owns everything that writes TO a node: adopting its inbounds as read-only replicas, and pushing/reconciling the master's clients onto it. Reconcile is the single write channel — first push, offline catch-up, drift repair and the manual button all funnel through it.
func (*NodeSyncService) AdoptInbounds ¶ added in v1.6.0
func (s *NodeSyncService) AdoptInbounds(nodeId uint, tags []string, actor string) error
AdoptInbounds pulls the full panel-shape inbound for each selected tag and stores it as a local replica row (node_id set). tag collisions fail loudly — the tag is the reconciliation key, so we never silently rename.
func (*NodeSyncService) CollectTraffic ¶ added in v1.6.0
func (s *NodeSyncService) CollectTraffic()
CollectTraffic pulls each online node's @cluster client counters and folds the delta since the last collection into the master's per-client totals. The node's clients.up/down are cumulative; a per-(node,client) baseline turns them into deltas, resetting the baseline when the node's counter drops (reset).
func (*NodeSyncService) FetchNodeInbounds ¶ added in v1.6.0
func (s *NodeSyncService) FetchNodeInbounds(nodeId uint) ([]remoteInbound, error)
FetchNodeInbounds lists a node's inbounds, flagging which tags this panel has already adopted as replicas.
func (*NodeSyncService) MarkAllDirty ¶ added in v1.6.0
func (s *NodeSyncService) MarkAllDirty()
func (*NodeSyncService) Reconcile ¶ added in v1.6.0
func (s *NodeSyncService) Reconcile(nodeId uint) error
Reconcile makes a node's @cluster clients match the master's expectation: clients that reference any of this node's replica inbounds. Together with ReconcileNow it is the ONLY path that writes clients to a node.
This is the background entry: single-flight per node plus a 30s backoff so heartbeat/fanout triggers don't stampede. A skip returns nil — the dirty flag stays set and the next heartbeat retries.
func (*NodeSyncService) ReconcileAllOnline ¶ added in v1.6.0
func (s *NodeSyncService) ReconcileAllOnline()
ReconcileAllOnline reconciles all online nodes regardless of dirty flag — the hourly safety net that repairs silent node-side drift.
func (*NodeSyncService) ReconcileDirtyOnline ¶ added in v1.6.0
func (s *NodeSyncService) ReconcileDirtyOnline()
ReconcileDirtyOnline reconciles every enabled node that is online and dirty. Called by the heartbeat so offline-period edits converge once a node returns.
func (*NodeSyncService) ReconcileNow ¶ added in v1.6.0
func (s *NodeSyncService) ReconcileNow(nodeId uint) error
ReconcileNow is the interactive entry (manual sync button, post-adoption push): it skips the backoff — the user asked, so sync — and reports a busy overlap as an error instead of silently doing nothing, so the UI never toasts success for a no-op.
type OutboundService ¶
type OutboundService struct{}
func (*OutboundService) GetAll ¶
func (o *OutboundService) GetAll() (*[]map[string]interface{}, error)
func (*OutboundService) GetAllConfig ¶
func (o *OutboundService) GetAllConfig(db *gorm.DB) ([]json.RawMessage, error)
func (*OutboundService) Save ¶
func (s *OutboundService) Save(tx *gorm.DB, act string, data json.RawMessage) error
type PanelService ¶
type PanelService struct {
}
func (*PanelService) RestartPanel ¶
func (s *PanelService) RestartPanel(delay time.Duration) error
RestartPanel 在 delay 之后给自己发 SIGHUP(Windows 上 Kill)触发重启。 delay 是 time.Duration,别传裸数字——那是纳秒,等于立即重启,调用方的 HTTP 响应 会来不及刷出就随 gin server 一起被拆掉。它存在的意义就是留出这段刷响应的时间。
type ServerService ¶
type ServerService struct{}
func (*ServerService) GenKeypair ¶
func (s *ServerService) GenKeypair(keyType string, options string) []string
func (*ServerService) GetCpuPercent ¶
func (s *ServerService) GetCpuPercent() float64
func (*ServerService) GetDatabaseInfo ¶
func (s *ServerService) GetDatabaseInfo() map[string]int64
func (*ServerService) GetDiskIO ¶
func (s *ServerService) GetDiskIO() map[string]interface{}
func (*ServerService) GetDiskInfo ¶
func (s *ServerService) GetDiskInfo() map[string]interface{}
func (*ServerService) GetLogs ¶
func (s *ServerService) GetLogs(count string, level string) []string
func (*ServerService) GetMemInfo ¶
func (s *ServerService) GetMemInfo() map[string]interface{}
func (*ServerService) GetNetInfo ¶
func (s *ServerService) GetNetInfo() map[string]interface{}
func (*ServerService) GetSingboxInfo ¶
func (s *ServerService) GetSingboxInfo() map[string]interface{}
func (*ServerService) GetStatus ¶
func (s *ServerService) GetStatus(request string) *map[string]interface{}
func (*ServerService) GetSwapInfo ¶
func (s *ServerService) GetSwapInfo() map[string]interface{}
func (*ServerService) GetSystemInfo ¶
func (s *ServerService) GetSystemInfo() map[string]interface{}
type ServicesService ¶
type ServicesService struct{}
func (*ServicesService) GetAll ¶
func (s *ServicesService) GetAll() (*[]map[string]interface{}, error)
func (*ServicesService) GetAllConfig ¶
func (s *ServicesService) GetAllConfig(db *gorm.DB) ([]json.RawMessage, error)
func (*ServicesService) RestartServices ¶
func (s *ServicesService) RestartServices(tx *gorm.DB, ids []uint) error
func (*ServicesService) Save ¶
func (s *ServicesService) Save(tx *gorm.DB, act string, data json.RawMessage) error
type SettingService ¶
type SettingService struct {
}
func (*SettingService) GetAllSetting ¶
func (s *SettingService) GetAllSetting() (*map[string]string, error)
func (*SettingService) GetCertFile ¶
func (s *SettingService) GetCertFile() (string, error)
func (*SettingService) GetConfig ¶
func (s *SettingService) GetConfig() (string, error)
func (*SettingService) GetFinalSubURI ¶
func (s *SettingService) GetFinalSubURI(host string) (string, error)
func (*SettingService) GetGlobalReset ¶ added in v1.5.4
func (s *SettingService) GetGlobalReset() (string, error)
GetGlobalReset returns the configured period for resetting all clients' traffic: "off", "weekly", "monthly" or "yearly".
func (*SettingService) GetGlobalResetLast ¶ added in v1.5.4
func (s *SettingService) GetGlobalResetLast() (int64, error)
GetGlobalResetLast returns the unix time of the last global traffic reset.
func (*SettingService) GetKeyFile ¶
func (s *SettingService) GetKeyFile() (string, error)
func (*SettingService) GetListen ¶
func (s *SettingService) GetListen() (string, error)
func (*SettingService) GetPort ¶
func (s *SettingService) GetPort() (int, error)
func (*SettingService) GetSecret ¶
func (s *SettingService) GetSecret() ([]byte, error)
func (*SettingService) GetSessionMaxAge ¶
func (s *SettingService) GetSessionMaxAge() (int, error)
func (*SettingService) GetStatsBucketSeconds ¶ added in v1.5.4
func (s *SettingService) GetStatsBucketSeconds() (int64, error)
GetStatsBucketSeconds returns the bucket size (in seconds) that traffic samples are rounded down to before being stored. Larger buckets mean fewer rows at the cost of chart resolution. Falls back to the default on a missing or non-positive value.
func (*SettingService) GetSubAcmeEmail ¶
func (s *SettingService) GetSubAcmeEmail() (string, error)
func (*SettingService) GetSubCertFile ¶
func (s *SettingService) GetSubCertFile() (string, error)
func (*SettingService) GetSubCertMode ¶
func (s *SettingService) GetSubCertMode() (string, error)
func (*SettingService) GetSubClashExt ¶
func (s *SettingService) GetSubClashExt() (string, error)
func (*SettingService) GetSubClashNoDefGrp ¶ added in v1.5.5
func (s *SettingService) GetSubClashNoDefGrp() (bool, error)
GetSubClashNoDefGrp reports whether the default "Proxy"/"Auto" proxy-groups should never be injected into a Clash subscription. When true, the config is left with exactly the groups the user defined.
func (*SettingService) GetSubClashSprtAll ¶ added in v1.5.5
func (s *SettingService) GetSubClashSprtAll() (bool, error)
GetSubClashSprtAll reports whether a case-insensitive "all" entry inside a custom proxy-group's "proxies" list should be expanded into every generated proxy tag.
func (*SettingService) GetSubDomain ¶
func (s *SettingService) GetSubDomain() (string, error)
func (*SettingService) GetSubEncode ¶
func (s *SettingService) GetSubEncode() (bool, error)
func (*SettingService) GetSubJsonExt ¶
func (s *SettingService) GetSubJsonExt() (string, error)
func (*SettingService) GetSubKeyFile ¶
func (s *SettingService) GetSubKeyFile() (string, error)
func (*SettingService) GetSubListen ¶
func (s *SettingService) GetSubListen() (string, error)
func (*SettingService) GetSubPath ¶
func (s *SettingService) GetSubPath() (string, error)
func (*SettingService) GetSubPort ¶
func (s *SettingService) GetSubPort() (int, error)
func (*SettingService) GetSubShowInfo ¶
func (s *SettingService) GetSubShowInfo() (bool, error)
func (*SettingService) GetSubURI ¶
func (s *SettingService) GetSubURI() (string, error)
func (*SettingService) GetSubUpdates ¶
func (s *SettingService) GetSubUpdates() (int, error)
func (*SettingService) GetTimeLocation ¶
func (s *SettingService) GetTimeLocation() (*time.Location, error)
func (*SettingService) GetTrafficAge ¶
func (s *SettingService) GetTrafficAge() (int, error)
func (*SettingService) GetWebAcmeEmail ¶
func (s *SettingService) GetWebAcmeEmail() (string, error)
func (*SettingService) GetWebCertMode ¶
func (s *SettingService) GetWebCertMode() (string, error)
func (*SettingService) GetWebDomain ¶
func (s *SettingService) GetWebDomain() (string, error)
func (*SettingService) GetWebNginx ¶ added in v1.4.7
func (s *SettingService) GetWebNginx() (bool, error)
func (*SettingService) GetWebPath ¶
func (s *SettingService) GetWebPath() (string, error)
func (*SettingService) GetWebURI ¶ added in v1.6.0
func (s *SettingService) GetWebURI() (string, error)
GetWebURI 返回面板对外地址的手工覆盖值(空表示未设置,由调用方自行推断)。 反代场景下面板推断不出对外地址,只能靠它,参见 sui uri 与前端 restartApp。
func (*SettingService) ResetSettings ¶
func (s *SettingService) ResetSettings() error
func (*SettingService) Save ¶
func (s *SettingService) Save(tx *gorm.DB, data json.RawMessage) error
func (*SettingService) SaveConfig ¶
func (s *SettingService) SaveConfig(tx *gorm.DB, config json.RawMessage) error
func (*SettingService) SetConfig ¶
func (s *SettingService) SetConfig(config string) error
func (*SettingService) SetGlobalResetLast ¶ added in v1.5.4
func (s *SettingService) SetGlobalResetLast(value int64) error
func (*SettingService) SetPort ¶
func (s *SettingService) SetPort(port int) error
func (*SettingService) SetSubPath ¶
func (s *SettingService) SetSubPath(subPath string) error
func (*SettingService) SetSubPort ¶
func (s *SettingService) SetSubPort(subPort int) error
func (*SettingService) SetWebPath ¶
func (s *SettingService) SetWebPath(webPath string) error
type SingBoxConfig ¶
type SingBoxConfig struct {
Log json.RawMessage `json:"log"`
Dns json.RawMessage `json:"dns"`
Ntp json.RawMessage `json:"ntp"`
Inbounds []json.RawMessage `json:"inbounds"`
Outbounds []json.RawMessage `json:"outbounds"`
Services []json.RawMessage `json:"services"`
Endpoints []json.RawMessage `json:"endpoints"`
Route json.RawMessage `json:"route"`
Experimental json.RawMessage `json:"experimental"`
}
type StatsService ¶
type StatsService struct {
}
func (*StatsService) DelOldStats ¶
func (s *StatsService) DelOldStats(days int) error
func (*StatsService) GetOnlines ¶
func (s *StatsService) GetOnlines() (onlines, error)
type TlsService ¶
type TlsService struct {
InboundService
ServicesService
}
func (*TlsService) Save ¶
func (s *TlsService) Save(tx *gorm.DB, action string, data json.RawMessage, hostname string) error
type UpdatePhase ¶ added in v1.5.6
type UpdatePhase string
const ( UpdateIdle UpdatePhase = "idle" UpdateChecking UpdatePhase = "checking" UpdateDownloading UpdatePhase = "downloading" UpdateVerifying UpdatePhase = "verifying" UpdateExtracting UpdatePhase = "extracting" UpdateSwapping UpdatePhase = "swapping" UpdateRestarting UpdatePhase = "restarting" UpdateDone UpdatePhase = "done" UpdateFailed UpdatePhase = "failed" )
type UpdateService ¶ added in v1.5.6
type UpdateService struct{}
func (*UpdateService) CanSelfUpdate ¶ added in v1.5.6
func (s *UpdateService) CanSelfUpdate() (bool, string)
CanSelfUpdate reports whether an in-panel update can run here, and if not, a short human-readable reason for the UI.
func (*UpdateService) GetStatus ¶ added in v1.5.6
func (s *UpdateService) GetStatus() UpdateStatus
func (*UpdateService) InDocker ¶ added in v1.5.6
func (s *UpdateService) InDocker() bool
InDocker is exposed so the API layer can tell the UI to warn that a container-layer update reverts when the container is recreated.
func (*UpdateService) LatestRelease ¶ added in v1.5.6
func (s *UpdateService) LatestRelease() (string, error)
LatestRelease returns the tag name of the newest GitHub release.
func (*UpdateService) StartUpdate ¶ added in v1.5.6
func (s *UpdateService) StartUpdate() error
StartUpdate validates the environment, then kicks off the update in the background. It returns immediately; callers poll GetStatus.
type UpdateStatus ¶ added in v1.5.6
type UpdateStatus struct {
Phase UpdatePhase `json:"phase"`
Target string `json:"target"`
Message string `json:"message"`
Error string `json:"error"`
}
type UserService ¶
type UserService struct {
}
func (*UserService) ChangePass ¶
func (*UserService) DeleteToken ¶
func (s *UserService) DeleteToken(id string) error
func (*UserService) GetFirstUser ¶
func (s *UserService) GetFirstUser() (*model.User, error)
func (*UserService) GetUserTokens ¶
func (s *UserService) GetUserTokens(username string) (*[]model.Tokens, error)
func (*UserService) LoadTokens ¶
func (s *UserService) LoadTokens() ([]byte, error)
func (*UserService) UpdateFirstUser ¶
func (s *UserService) UpdateFirstUser(username string, password string) error
type WarpService ¶
type WarpService struct{}
func (*WarpService) RegisterWarp ¶
func (s *WarpService) RegisterWarp(ep *model.Endpoint) error
func (*WarpService) SetWarpLicense ¶
func (s *WarpService) SetWarpLicense(old_license string, ep *model.Endpoint) error