service

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2025 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LastUpdate int64
)

Functions

This section is empty.

Types

type ClientService

type ClientService struct{}

func (*ClientService) DepleteClients

func (s *ClientService) DepleteClients() ([]uint, error)

func (*ClientService) Get

func (s *ClientService) Get(id string) (*[]model.Client, error)

func (*ClientService) GetAll

func (s *ClientService) GetAll() (*[]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 (s *ClientService) UpdateClientsOnInboundAdd(tx *gorm.DB, initIds string, inboundId uint, hostname string) error

func (*ClientService) UpdateClientsOnInboundDelete

func (s *ClientService) UpdateClientsOnInboundDelete(tx *gorm.DB, id uint, tag string) error

func (*ClientService) UpdateLinksByInboundChange

func (s *ClientService) UpdateLinksByInboundChange(tx *gorm.DB, inbounds *[]model.Inbound, hostname string, oldTag string) error

type ConfigService

func NewConfigService

func NewConfigService(core *core.Core) *ConfigService

func (*ConfigService) CheckChanges

func (s *ConfigService) CheckChanges(lu string) (bool, error)

func (*ConfigService) GetChanges

func (s *ConfigService) GetChanges(actor string, chngKey string, count string) []model.Changes

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 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

func (s *InboundService) UpdateOutJsons(tx *gorm.DB, inboundIds []uint, hostname string) error

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) 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 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) 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) GetStats

func (s *StatsService) GetStats(resource string, tag string, limit int) ([]model.Stats, error)

func (*StatsService) SaveStats

func (s *StatsService) SaveStats(enableTraffic bool) error

type TlsService

type TlsService struct {
	InboundService
	ServicesService
}

func (*TlsService) GetAll

func (s *TlsService) GetAll() ([]model.Tls, error)

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) AddToken

func (s *UserService) AddToken(username string, expiry int64, desc string) (string, error)

func (*UserService) ChangePass

func (s *UserService) ChangePass(id string, oldPass string, newUser string, newPass string) error

func (*UserService) CheckUser

func (s *UserService) CheckUser(username string, password string, remoteIP string) *model.User

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) GetUsers

func (s *UserService) GetUsers() (*[]model.User, error)

func (*UserService) LoadTokens

func (s *UserService) LoadTokens() ([]byte, error)

func (*UserService) Login

func (s *UserService) Login(username string, password string, remoteIP string) (string, 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

Jump to

Keyboard shortcuts

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