Documentation
¶
Index ¶
- Variables
- func GenerateMTProtoSecret() (string, error)
- type ChiselService
- func (s *ChiselService) CreateChiselConfig(config *model.ChiselConfig) error
- func (s *ChiselService) DeleteChiselConfig(id uint) error
- func (s *ChiselService) GetActiveChiselConfigIDs() []uint
- func (s *ChiselService) GetAllChiselConfigs() ([]model.ChiselConfig, error)
- func (s *ChiselService) GetChiselConfig(id uint) (*model.ChiselConfig, error)
- func (s *ChiselService) GetChiselConfigByName(name string) (*model.ChiselConfig, error)
- func (s *ChiselService) Save(act string, data json.RawMessage) error
- func (s *ChiselService) StartChisel(config *model.ChiselConfig) error
- func (s *ChiselService) StopAllActiveChiselServices()
- func (s *ChiselService) StopChisel(config *model.ChiselConfig) error
- func (s *ChiselService) UpdateChiselConfig(config *model.ChiselConfig) error
- type ClientService
- func (s *ClientService) DepleteClients() ([]uint, error)
- func (s *ClientService) Get(id string) (*[]model.Client, error)
- func (s *ClientService) GetAllUsers() (*[]model.Client, error)
- func (s *ClientService) GetUserByEmail(email string) (*model.Client, 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 Cmd
- type CmdWithContext
- type ConfigService
- func (s *ConfigService) CheckChanges(lu string) (bool, error)
- func (s *ConfigService) GetAllInbounds() ([]model.Inbound, error)
- func (s *ConfigService) GetAllOutbounds() ([]model.Outbound, error)
- func (s *ConfigService) GetChanges(actor string, chngKey string, count string) []model.Changes
- func (s *ConfigService) GetConfig(data string) (*SingBoxConfig, 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(defaultConfig string) error
- func (s *ConfigService) StopCore() error
- type EndpointService
- type GostService
- func (s *GostService) CreateGostConfig(cfg *model.GostConfig) error
- func (s *GostService) DeleteGostConfig(id uint) error
- func (s *GostService) GetAllGostConfigs() ([]model.GostConfig, error)
- func (s *GostService) GetGostConfigByName(name string) (*model.GostConfig, error)
- func (s *GostService) StartGost(cfg *model.GostConfig) error
- func (s *GostService) StopGost(id uint) error
- type GreService
- func (s *GreService) CreateGreTunnel(config *model.GreTunnel) error
- func (s *GreService) DeleteGreTunnel(id uint) error
- func (s *GreService) GetAllGreTunnels() ([]model.GreTunnel, error)
- func (s *GreService) GetGreTunnel(id uint) (*model.GreTunnel, error)
- func (s *GreService) GetGreTunnelByName(name string) (*model.GreTunnel, error)
- 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) GetAllInbounds() ([]model.Inbound, error)
- func (s *InboundService) GetFirstInboundId() (uint, error)
- func (s *InboundService) GetInboundByTag(tag string) (*model.Inbound, 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 MTProtoEmbeddedService
- func (s *MTProtoEmbeddedService) CreateMTProtoConfig(cfg *model.MTProtoProxyConfig) error
- func (s *MTProtoEmbeddedService) DeleteMTProtoConfig(id uint) error
- func (s *MTProtoEmbeddedService) GetAllMTProtoConfigs() ([]model.MTProtoProxyConfig, error)
- func (s *MTProtoEmbeddedService) GetMTProtoConfigByName(name string) (*model.MTProtoProxyConfig, error)
- func (s *MTProtoEmbeddedService) StartMTProto(cfg *model.MTProtoProxyConfig) error
- func (s *MTProtoEmbeddedService) StopMTProto(id uint) error
- func (s *MTProtoEmbeddedService) UpdateMTProtoConfig(cfg *model.MTProtoProxyConfig) error
- type MTProtoService
- func (s *MTProtoService) CreateMTProtoProxy(config *model.MTProtoProxyConfig) error
- func (s *MTProtoService) DeleteMTProtoProxy(id uint) error
- func (s *MTProtoService) GetAllMTProtoProxies() ([]model.MTProtoProxyConfig, error)
- func (s *MTProtoService) GetMTProtoProxy(id uint) (*model.MTProtoProxyConfig, error)
- func (s *MTProtoService) GetMTProtoProxyByName(name string) (*model.MTProtoProxyConfig, error)
- func (s *MTProtoService) StartMTProtoProxy(cfg *model.MTProtoProxyConfig) error
- func (s *MTProtoService) StopMTProtoProxy(id uint) error
- func (s *MTProtoService) UpdateMTProtoProxy(config *model.MTProtoProxyConfig) error
- type Onlines
- type OutboundService
- func (o *OutboundService) GetAll() (*[]map[string]interface{}, error)
- func (o *OutboundService) GetAllConfig(db *gorm.DB) ([]json.RawMessage, error)
- func (o *OutboundService) GetAllOutbounds() ([]model.Outbound, error)
- func (s *OutboundService) Save(tx *gorm.DB, act string, data json.RawMessage) error
- type PanelService
- type ServerService
- func (s *ServerService) GenKeypair(keyType string, options string) []string
- func (s *ServerService) GetCpuPercent() float64
- 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{}
- func (s *ServerService) GetUptime() uint64
- type ServicesBundle
- 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) GetSubCertFile() (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) GetWebDomain() (string, 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) SetSubscriptionDomain(domain string) error
- func (s *SettingService) SetWebPath(webPath string) error
- type SingBoxConfig
- type StatsService
- type TapService
- func (s *TapService) CreateTapTunnel(config *model.TapTunnel) error
- func (s *TapService) DeleteTapTunnel(id uint) error
- func (s *TapService) GetAllTapTunnels() ([]model.TapTunnel, error)
- func (s *TapService) GetTapTunnel(id uint) (*model.TapTunnel, error)
- func (s *TapService) GetTapTunnelByName(name string) (*model.TapTunnel, error)
- type TlsService
- type UdpTunnelInstance
- type UdpTunnelService
- func (s *UdpTunnelService) AutoStartUdpTunnels()
- func (s *UdpTunnelService) CreateUdpTunnel(cfg *model.UdpTunnelConfig) error
- func (s *UdpTunnelService) DeleteUdpTunnel(id uint) error
- func (s *UdpTunnelService) GetAllUdpTunnels() ([]model.UdpTunnelConfig, error)
- func (s *UdpTunnelService) GetUdpTunnelByID(id uint) (*model.UdpTunnelConfig, error)
- func (s *UdpTunnelService) GetUdpTunnelByName(name string) (*model.UdpTunnelConfig, error)
- func (s *UdpTunnelService) StartUdpTunnel(cfg *model.UdpTunnelConfig) error
- func (s *UdpTunnelService) StopUdpTunnel(id uint) error
- func (s *UdpTunnelService) UpdateUdpTunnel(cfg *model.UdpTunnelConfig) error
- 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 ¶
func GenerateMTProtoSecret ¶
GenerateMTProtoSecret generates a random 32-byte hex string suitable for an MTProto secret.
Types ¶
type ChiselService ¶
type ChiselService struct {
// contains filtered or unexported fields
}
func NewChiselService ¶
func NewChiselService() *ChiselService
func (*ChiselService) CreateChiselConfig ¶
func (s *ChiselService) CreateChiselConfig(config *model.ChiselConfig) error
func (*ChiselService) DeleteChiselConfig ¶
func (s *ChiselService) DeleteChiselConfig(id uint) error
func (*ChiselService) GetActiveChiselConfigIDs ¶
func (s *ChiselService) GetActiveChiselConfigIDs() []uint
GetActiveChiselConfigIDs returns a slice of IDs for currently active Chisel services.
func (*ChiselService) GetAllChiselConfigs ¶
func (s *ChiselService) GetAllChiselConfigs() ([]model.ChiselConfig, error)
func (*ChiselService) GetChiselConfig ¶
func (s *ChiselService) GetChiselConfig(id uint) (*model.ChiselConfig, error)
func (*ChiselService) GetChiselConfigByName ¶
func (s *ChiselService) GetChiselConfigByName(name string) (*model.ChiselConfig, error)
func (*ChiselService) Save ¶
func (s *ChiselService) Save(act string, data json.RawMessage) error
func (*ChiselService) StartChisel ¶
func (s *ChiselService) StartChisel(config *model.ChiselConfig) error
func (*ChiselService) StopAllActiveChiselServices ¶
func (s *ChiselService) StopAllActiveChiselServices()
StopAllActiveChiselServices iterates through all active Chisel services and stops them.
func (*ChiselService) StopChisel ¶
func (s *ChiselService) StopChisel(config *model.ChiselConfig) error
func (*ChiselService) UpdateChiselConfig ¶
func (s *ChiselService) UpdateChiselConfig(config *model.ChiselConfig) error
type ClientService ¶
type ClientService struct{}
func (*ClientService) DepleteClients ¶
func (s *ClientService) DepleteClients() ([]uint, error)
func (*ClientService) GetAllUsers ¶
func (s *ClientService) GetAllUsers() (*[]model.Client, error)
func (*ClientService) GetUserByEmail ¶
func (s *ClientService) GetUserByEmail(email string) (*model.Client, error)
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 Cmd ¶
Cmd is a wrapper around os/exec.Cmd that supports context cancellation.
type CmdWithContext ¶
type CmdWithContext struct {
Cmd *Cmd
Cancel context.CancelFunc
}
CmdWithContext holds the command and its cancel function
type ConfigService ¶
type ConfigService struct {
ClientService
TlsService
SettingService
InboundService
OutboundService
ServicesService
EndpointService
Chisel *ChiselService
}
func NewConfigService ¶
func NewConfigService(core *core.Core, chiselService *ChiselService) *ConfigService
func (*ConfigService) CheckChanges ¶
func (s *ConfigService) CheckChanges(lu string) (bool, error)
func (*ConfigService) GetAllInbounds ¶
func (s *ConfigService) GetAllInbounds() ([]model.Inbound, error)
func (*ConfigService) GetAllOutbounds ¶
func (s *ConfigService) GetAllOutbounds() ([]model.Outbound, error)
func (*ConfigService) GetChanges ¶
func (*ConfigService) GetConfig ¶
func (s *ConfigService) GetConfig(data string) (*SingBoxConfig, error)
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(defaultConfig string) error
func (*ConfigService) StopCore ¶
func (s *ConfigService) StopCore() error
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 GostService ¶
type GostService struct {
// contains filtered or unexported fields
}
GostService provides embedded reverse tunnel functionality (no external binaries needed).
func (*GostService) CreateGostConfig ¶
func (s *GostService) CreateGostConfig(cfg *model.GostConfig) error
CreateGostConfig saves a new gost configuration to the database.
func (*GostService) DeleteGostConfig ¶
func (s *GostService) DeleteGostConfig(id uint) error
DeleteGostConfig deletes a gost configuration from the database.
func (*GostService) GetAllGostConfigs ¶
func (s *GostService) GetAllGostConfigs() ([]model.GostConfig, error)
GetAllGostConfigs retrieves all gost tunnel configurations from the database.
func (*GostService) GetGostConfigByName ¶
func (s *GostService) GetGostConfigByName(name string) (*model.GostConfig, error)
GetGostConfigByName retrieves a gost configuration by name.
func (*GostService) StartGost ¶
func (s *GostService) StartGost(cfg *model.GostConfig) error
StartGost starts an embedded reverse tunnel based on configuration.
func (*GostService) StopGost ¶
func (s *GostService) StopGost(id uint) error
StopGost stops a running reverse tunnel by ID.
type GreService ¶
type GreService struct {
// contains filtered or unexported fields
}
GreService handles the business logic for GRE tunnels. NOTE: All methods that manipulate network interfaces require root privileges to run.
func NewGreService ¶
func NewGreService() *GreService
NewGreService creates a new instance of GreService.
func (*GreService) CreateGreTunnel ¶
func (s *GreService) CreateGreTunnel(config *model.GreTunnel) error
CreateGreTunnel creates a new GRE tunnel interface and saves its config to the DB. This operation requires root privileges.
func (*GreService) DeleteGreTunnel ¶
func (s *GreService) DeleteGreTunnel(id uint) error
DeleteGreTunnel deletes a GRE tunnel interface and removes its config from the DB. This operation requires root privileges.
func (*GreService) GetAllGreTunnels ¶
func (s *GreService) GetAllGreTunnels() ([]model.GreTunnel, error)
GetAllGreTunnels retrieves all GRE tunnel configurations from the database.
func (*GreService) GetGreTunnel ¶
func (s *GreService) GetGreTunnel(id uint) (*model.GreTunnel, error)
GetGreTunnel retrieves a single GRE tunnel configuration by its ID.
func (*GreService) GetGreTunnelByName ¶
func (s *GreService) GetGreTunnelByName(name string) (*model.GreTunnel, error)
GetGreTunnelByName retrieves a single GRE tunnel configuration by its name.
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) GetAllInbounds ¶
func (s *InboundService) GetAllInbounds() ([]model.Inbound, error)
func (*InboundService) GetFirstInboundId ¶
func (s *InboundService) GetFirstInboundId() (uint, error)
func (*InboundService) GetInboundByTag ¶
func (s *InboundService) GetInboundByTag(tag string) (*model.Inbound, 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 MTProtoEmbeddedService ¶
type MTProtoEmbeddedService struct {
// contains filtered or unexported fields
}
MTProtoEmbeddedService provides embedded MTProto proxy support
func NewMTProtoEmbeddedService ¶
func NewMTProtoEmbeddedService() *MTProtoEmbeddedService
NewMTProtoEmbeddedService creates a new MTProto service instance
func (*MTProtoEmbeddedService) CreateMTProtoConfig ¶
func (s *MTProtoEmbeddedService) CreateMTProtoConfig(cfg *model.MTProtoProxyConfig) error
CreateMTProtoConfig creates a new MTProto configuration
func (*MTProtoEmbeddedService) DeleteMTProtoConfig ¶
func (s *MTProtoEmbeddedService) DeleteMTProtoConfig(id uint) error
DeleteMTProtoConfig deletes an MTProto configuration
func (*MTProtoEmbeddedService) GetAllMTProtoConfigs ¶
func (s *MTProtoEmbeddedService) GetAllMTProtoConfigs() ([]model.MTProtoProxyConfig, error)
GetAllMTProtoConfigs retrieves all MTProto configurations
func (*MTProtoEmbeddedService) GetMTProtoConfigByName ¶
func (s *MTProtoEmbeddedService) GetMTProtoConfigByName(name string) (*model.MTProtoProxyConfig, error)
GetMTProtoConfigByName retrieves MTProto config by name
func (*MTProtoEmbeddedService) StartMTProto ¶
func (s *MTProtoEmbeddedService) StartMTProto(cfg *model.MTProtoProxyConfig) error
StartMTProto starts an MTProto proxy tunnel
func (*MTProtoEmbeddedService) StopMTProto ¶
func (s *MTProtoEmbeddedService) StopMTProto(id uint) error
StopMTProto stops an MTProto proxy tunnel
func (*MTProtoEmbeddedService) UpdateMTProtoConfig ¶
func (s *MTProtoEmbeddedService) UpdateMTProtoConfig(cfg *model.MTProtoProxyConfig) error
UpdateMTProtoConfig updates an MTProto configuration
type MTProtoService ¶
type MTProtoService struct {
// contains filtered or unexported fields
}
MTProtoService handles the business logic for MTProto Proxy.
func NewMTProtoService ¶
func NewMTProtoService() *MTProtoService
NewMTProtoService creates a new instance of MTProtoService.
func (*MTProtoService) CreateMTProtoProxy ¶
func (s *MTProtoService) CreateMTProtoProxy(config *model.MTProtoProxyConfig) error
CreateMTProtoProxy saves a new MTProto Proxy configuration to the database.
func (*MTProtoService) DeleteMTProtoProxy ¶
func (s *MTProtoService) DeleteMTProtoProxy(id uint) error
DeleteMTProtoProxy deletes an MTProto Proxy configuration from the database.
func (*MTProtoService) GetAllMTProtoProxies ¶
func (s *MTProtoService) GetAllMTProtoProxies() ([]model.MTProtoProxyConfig, error)
GetAllMTProtoProxies retrieves all MTProto Proxy configurations from the database.
func (*MTProtoService) GetMTProtoProxy ¶
func (s *MTProtoService) GetMTProtoProxy(id uint) (*model.MTProtoProxyConfig, error)
GetMTProtoProxy retrieves a single MTProto Proxy configuration by its ID.
func (*MTProtoService) GetMTProtoProxyByName ¶
func (s *MTProtoService) GetMTProtoProxyByName(name string) (*model.MTProtoProxyConfig, error)
GetMTProtoProxyByName retrieves a single MTProto Proxy configuration by its name.
func (*MTProtoService) StartMTProtoProxy ¶
func (s *MTProtoService) StartMTProtoProxy(cfg *model.MTProtoProxyConfig) error
StartMTProtoProxy starts an MTProto Proxy instance as an external process.
func (*MTProtoService) StopMTProtoProxy ¶
func (s *MTProtoService) StopMTProtoProxy(id uint) error
StopMTProtoProxy stops a running MTProto Proxy instance.
func (*MTProtoService) UpdateMTProtoProxy ¶
func (s *MTProtoService) UpdateMTProtoProxy(config *model.MTProtoProxyConfig) error
UpdateMTProtoProxy updates an existing MTProto Proxy configuration in the database.
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) GetAllOutbounds ¶
func (o *OutboundService) GetAllOutbounds() ([]model.Outbound, 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) 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{}
func (*ServerService) GetUptime ¶
func (s *ServerService) GetUptime() uint64
type ServicesBundle ¶
type ServicesBundle struct {
SettingService SettingService
UserService UserService
ConfigService *ConfigService
ClientService ClientService
TlsService TlsService
InboundService InboundService
OutboundService OutboundService
EndpointService EndpointService
ServicesService ServicesService
PanelService PanelService
StatsService StatsService
ServerService ServerService
ChiselService *ChiselService
GostService *GostService
TapService *TapService
UdpTunnelService *UdpTunnelService
}
ServicesBundle groups initialized service instances to pass between application components (app -> web -> api) without creating import cycles.
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) GetSubCertFile ¶
func (s *SettingService) GetSubCertFile() (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) GetWebDomain ¶
func (s *SettingService) GetWebDomain() (string, 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) SetSubscriptionDomain ¶
func (s *SettingService) SetSubscriptionDomain(domain string) 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 TapService ¶
type TapService struct {
// contains filtered or unexported fields
}
TapService handles the business logic for TAP tunnels. NOTE: All methods that manipulate network interfaces (assigning IP, bringing up/down) require root privileges to run. Creating the TAP device itself might not, depending on /dev/net/tun permissions, but full configuration does.
func NewTapService ¶
func NewTapService() *TapService
NewTapService creates a new instance of TapService.
func (*TapService) CreateTapTunnel ¶
func (s *TapService) CreateTapTunnel(config *model.TapTunnel) error
CreateTapTunnel creates a new TAP interface and saves its config to the DB. This operation requires root privileges for full configuration.
func (*TapService) DeleteTapTunnel ¶
func (s *TapService) DeleteTapTunnel(id uint) error
DeleteTapTunnel deletes a TAP interface and removes its config from the DB. This operation requires root privileges.
func (*TapService) GetAllTapTunnels ¶
func (s *TapService) GetAllTapTunnels() ([]model.TapTunnel, error)
GetAllTapTunnels retrieves all TAP tunnel configurations from the database.
func (*TapService) GetTapTunnel ¶
func (s *TapService) GetTapTunnel(id uint) (*model.TapTunnel, error)
GetTapTunnel retrieves a single TAP tunnel configuration by its ID.
func (*TapService) GetTapTunnelByName ¶
func (s *TapService) GetTapTunnelByName(name string) (*model.TapTunnel, error)
GetTapTunnelByName retrieves a single TAP tunnel configuration by its name.
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 UdpTunnelInstance ¶
type UdpTunnelInstance struct {
Cancel context.CancelFunc
Config *model.UdpTunnelConfig
}
UdpTunnelInstance holds the context and cancel function for a running tunnel
type UdpTunnelService ¶
type UdpTunnelService struct {
// contains filtered or unexported fields
}
UdpTunnelService manages UDP tunnels with udp2raw features.
func NewUdpTunnelService ¶
func NewUdpTunnelService(db *gorm.DB) *UdpTunnelService
NewUdpTunnelService creates a new UdpTunnelService
func (*UdpTunnelService) AutoStartUdpTunnels ¶
func (s *UdpTunnelService) AutoStartUdpTunnels()
func (*UdpTunnelService) CreateUdpTunnel ¶
func (s *UdpTunnelService) CreateUdpTunnel(cfg *model.UdpTunnelConfig) error
func (*UdpTunnelService) DeleteUdpTunnel ¶
func (s *UdpTunnelService) DeleteUdpTunnel(id uint) error
func (*UdpTunnelService) GetAllUdpTunnels ¶
func (s *UdpTunnelService) GetAllUdpTunnels() ([]model.UdpTunnelConfig, error)
... (rest of the CRUD functions remain the same)
func (*UdpTunnelService) GetUdpTunnelByID ¶
func (s *UdpTunnelService) GetUdpTunnelByID(id uint) (*model.UdpTunnelConfig, error)
func (*UdpTunnelService) GetUdpTunnelByName ¶
func (s *UdpTunnelService) GetUdpTunnelByName(name string) (*model.UdpTunnelConfig, error)
func (*UdpTunnelService) StartUdpTunnel ¶
func (s *UdpTunnelService) StartUdpTunnel(cfg *model.UdpTunnelConfig) error
StartUdpTunnel starts a UDP tunnel based on the provided configuration.
func (*UdpTunnelService) StopUdpTunnel ¶
func (s *UdpTunnelService) StopUdpTunnel(id uint) error
StopUdpTunnel stops a running UDP tunnel.
func (*UdpTunnelService) UpdateUdpTunnel ¶
func (s *UdpTunnelService) UpdateUdpTunnel(cfg *model.UdpTunnelConfig) 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