Documentation
¶
Index ¶
- Variables
- type AcmeService
- type ClientService
- func (s *ClientService) DepleteClients() ([]uint, error)
- func (s *ClientService) Get(id string) (*[]model.Client, error)
- func (s *ClientService) GetAll() (*[]model.Client, 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) UpdateOutJsons(tx *gorm.DB, inboundIds []uint, hostname string) error
- type IssueResult
- type NginxStatus
- 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) 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) GetSubAcmeEmail() (string, error)
- func (s *SettingService) GetSubCertFile() (string, error)
- func (s *SettingService) GetSubCertMode() (string, error)
- func (s *SettingService) GetSubClashExt() (string, 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) 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) 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 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 ¶
View Source
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 是否安装并运行。Windows 直接返回未安装。
func (*AcmeService) IssueWeb ¶ added in v1.4.7
func (a *AcmeService) IssueWeb(domain, email string, useNginx, force bool) (*IssueResult, error)
IssueWeb 为面板申请证书并安装到 /root/cert/{域名}/。
- useNginx=false:standalone 模式占用 80 端口申请(需 socat)。
- useNginx=true :nginx 模式申请,不抢 80 端口,证书供 nginx 使用。
- force=true :域名已有未到期证书时 acme.sh 默认跳过签发,force 时加 --force 强制续期。
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, error)
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
}
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) UpdateOutJsons ¶
type IssueResult ¶ added in v1.4.7
type NginxStatus ¶ added in v1.4.7
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
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) 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) 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) 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) 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) 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)
func (*StatsService) SaveStats ¶
func (s *StatsService) SaveStats(enableTraffic bool) 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 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
Click to show internal directories.
Click to hide internal directories.