service

package
v0.0.0-...-8fb3e78 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: GPL-3.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHostInfo

func GetHostInfo(id uint) (*model.Host, error)

func LoadScriptInfo

func LoadScriptInfo(id uint) (model.ScriptLibrary, error)

func StartSync

func StartSync()

Types

type AuthService

type AuthService struct{}

func (*AuthService) GetResponsePage

func (u *AuthService) GetResponsePage() (string, error)

func (*AuthService) GetSecurityEntrance

func (u *AuthService) GetSecurityEntrance() string

func (*AuthService) IsLogin

func (u *AuthService) IsLogin(c *gin.Context) bool

func (*AuthService) LogOut

func (u *AuthService) LogOut(c *gin.Context) error

func (*AuthService) Login

func (u *AuthService) Login(c *gin.Context, info dto.Login, entrance string) (*dto.UserLoginInfo, string, error)

func (*AuthService) MFALogin

func (u *AuthService) MFALogin(c *gin.Context, info dto.MFALogin, entrance string) (*dto.UserLoginInfo, string, error)

func (*AuthService) VerifyCode

func (u *AuthService) VerifyCode(code string) (bool, error)

type BackupService

type BackupService struct{}

func (*BackupService) Create

func (u *BackupService) Create(req dto.BackupOperate) error

func (*BackupService) Delete

func (u *BackupService) Delete(name string) error

func (*BackupService) LoadBackupClientInfo

func (u *BackupService) LoadBackupClientInfo(clientType string) (dto.BackupClientInfo, error)

func (*BackupService) RefreshToken

func (u *BackupService) RefreshToken(req dto.OperateByName) error

func (*BackupService) Update

func (u *BackupService) Update(req dto.BackupOperate) error

type CommandService

type CommandService struct{}

func (*CommandService) Create

func (u *CommandService) Create(req dto.CommandOperate) error

func (*CommandService) Delete

func (u *CommandService) Delete(ids []uint) error

func (*CommandService) Export

func (u *CommandService) Export() (string, error)

func (*CommandService) List

func (*CommandService) SearchForTree

func (u *CommandService) SearchForTree(req dto.OperateByType) ([]dto.CommandTree, error)

func (*CommandService) SearchWithPage

func (u *CommandService) SearchWithPage(req dto.SearchCommandWithPage) (int64, interface{}, error)

func (*CommandService) Update

func (u *CommandService) Update(req dto.CommandOperate) error

type GroupService

type GroupService struct{}

func (*GroupService) Create

func (u *GroupService) Create(req dto.GroupCreate) error

func (*GroupService) Delete

func (u *GroupService) Delete(id uint) error

func (*GroupService) List

func (u *GroupService) List(req dto.OperateByType) ([]dto.GroupInfo, error)

func (*GroupService) Update

func (u *GroupService) Update(req dto.GroupUpdate) error

type HostService

type HostService struct{}

func (*HostService) Create

func (u *HostService) Create(req dto.HostOperate) (*dto.HostInfo, error)

func (*HostService) Delete

func (u *HostService) Delete(ids []uint) error

func (*HostService) EncryptHost

func (u *HostService) EncryptHost(itemVal string) (string, error)

func (*HostService) GetHostByID

func (u *HostService) GetHostByID(id uint) (*dto.HostInfo, error)

func (*HostService) SearchForTree

func (u *HostService) SearchForTree(search dto.SearchForTree) ([]dto.HostTree, error)

func (*HostService) SearchWithPage

func (u *HostService) SearchWithPage(req dto.SearchPageWithGroup) (int64, interface{}, error)

func (*HostService) TestByInfo

func (u *HostService) TestByInfo(req dto.HostConnTest) bool

func (*HostService) TestLocalConn

func (u *HostService) TestLocalConn(id uint) bool

func (*HostService) Update

func (u *HostService) Update(id uint, upMap map[string]interface{}) (*dto.HostInfo, error)

type IAuthService

type IAuthService interface {
	GetResponsePage() (string, error)
	VerifyCode(code string) (bool, error)
	Login(c *gin.Context, info dto.Login, entrance string) (*dto.UserLoginInfo, string, error)
	LogOut(c *gin.Context) error
	MFALogin(c *gin.Context, info dto.MFALogin, entrance string) (*dto.UserLoginInfo, string, error)
	GetSecurityEntrance() string
	IsLogin(c *gin.Context) bool
}

func NewIAuthService

func NewIAuthService() IAuthService

type IBackupService

type IBackupService interface {
	LoadBackupClientInfo(clientType string) (dto.BackupClientInfo, error)
	Create(backupDto dto.BackupOperate) error
	Update(req dto.BackupOperate) error
	Delete(name string) error
	RefreshToken(req dto.OperateByName) error
}

func NewIBackupService

func NewIBackupService() IBackupService

type ICommandService

type ICommandService interface {
	List(req dto.OperateByType) ([]dto.CommandInfo, error)
	SearchForTree(req dto.OperateByType) ([]dto.CommandTree, error)
	SearchWithPage(search dto.SearchCommandWithPage) (int64, interface{}, error)
	Create(req dto.CommandOperate) error
	Update(req dto.CommandOperate) error
	Delete(ids []uint) error

	Export() (string, error)
}

func NewICommandService

func NewICommandService() ICommandService

type IGroupService

type IGroupService interface {
	List(req dto.OperateByType) ([]dto.GroupInfo, error)
	Create(req dto.GroupCreate) error
	Update(req dto.GroupUpdate) error
	Delete(id uint) error
}

func NewIGroupService

func NewIGroupService() IGroupService

type IHostService

type IHostService interface {
	TestLocalConn(id uint) bool
	TestByInfo(req dto.HostConnTest) bool
	GetHostByID(id uint) (*dto.HostInfo, error)
	SearchForTree(search dto.SearchForTree) ([]dto.HostTree, error)
	SearchWithPage(search dto.SearchPageWithGroup) (int64, interface{}, error)
	Create(req dto.HostOperate) (*dto.HostInfo, error)
	Update(id uint, upMap map[string]interface{}) (*dto.HostInfo, error)
	Delete(id []uint) error

	EncryptHost(itemVal string) (string, error)
}

func NewIHostService

func NewIHostService() IHostService

type ILogService

type ILogService interface {
	CreateLoginLog(operation model.LoginLog) error
	PageLoginLog(ctx *gin.Context, search dto.SearchLgLogWithPage) (int64, interface{}, error)

	CreateOperationLog(operation *model.OperationLog) error
	PageOperationLog(search dto.SearchOpLogWithPage) (int64, interface{}, error)

	CleanLogs(logtype string) error
}

func NewILogService

func NewILogService() ILogService

type IScriptService

type IScriptService interface {
	Run()
	Search(ctx *gin.Context, req dto.SearchPageWithGroup) (int64, interface{}, error)
	Create(req dto.ScriptOperate) error
	Update(req dto.ScriptOperate) error
	Delete(ids dto.OperateByIDs) error
	Sync(req dto.OperateByTaskID) error
}

func NewIScriptService

func NewIScriptService() IScriptService

type ISettingService

type ISettingService interface {
	GetSettingInfo() (*dto.SettingInfo, error)
	LoadInterfaceAddr() ([]string, error)
	Update(key, value string) error
	UpdatePassword(c *gin.Context, old, new string) error
	UpdatePort(port uint) error
	UpdateBindInfo(req dto.BindInfo) error
	UpdateSSL(c *gin.Context, req dto.SSLUpdate) error
	LoadFromCert() (*dto.SSLInfo, error)
	HandlePasswordExpired(c *gin.Context, old, new string) error
	GenerateApiKey() (string, error)
	UpdateApiConfig(req dto.ApiInterfaceConfig) error

	UpdateProxy(req dto.ProxyUpdate) error

	GetTerminalInfo() (*dto.TerminalInfo, error)
	UpdateTerminal(req dto.TerminalInfo) error

	UpdateSystemSSL() error
	GenerateRSAKey() error

	GetLoginSetting() (*dto.SystemSetting, error)

	UpdateAppstoreConfig(req dto.AppstoreUpdate) error
	GetAppstoreConfig() (*dto.AppstoreConfig, error)
	DefaultMenu() error
}

func NewISettingService

func NewISettingService() ISettingService

type IUpgradeService

type IUpgradeService interface {
	Upgrade(req dto.Upgrade) error
	Rollback(req dto.OperateByID) error
	LoadNotes(req dto.Upgrade) (string, error)
	SearchUpgrade() (*dto.UpgradeInfo, error)
	LoadRelease() ([]dto.ReleasesNotes, error)
}

func NewIUpgradeService

func NewIUpgradeService() IUpgradeService

type LogService

type LogService struct{}

func (*LogService) CleanLogs

func (u *LogService) CleanLogs(logtype string) error

func (*LogService) CreateLoginLog

func (u *LogService) CreateLoginLog(operation model.LoginLog) error

func (*LogService) CreateOperationLog

func (u *LogService) CreateOperationLog(operation *model.OperationLog) error

func (*LogService) PageLoginLog

func (u *LogService) PageLoginLog(ctx *gin.Context, req dto.SearchLgLogWithPage) (int64, interface{}, error)

func (*LogService) PageOperationLog

func (u *LogService) PageOperationLog(req dto.SearchOpLogWithPage) (int64, interface{}, error)

type ScriptDetail

type ScriptDetail struct {
	Sh []ScriptHelper `json:"sh"`
}

type ScriptHelper

type ScriptHelper struct {
	Key         string            `json:"key"`
	Sort        uint              `json:"sort"`
	Groups      string            `json:"groups"`
	Name        map[string]string `json:"name"`
	Interactive bool              `json:"interactive"`
	Description map[string]string `json:"description"`
}

type ScriptService

type ScriptService struct{}

func (*ScriptService) Create

func (u *ScriptService) Create(req dto.ScriptOperate) error

func (*ScriptService) Delete

func (u *ScriptService) Delete(req dto.OperateByIDs) error

func (*ScriptService) Run

func (u *ScriptService) Run()

func (*ScriptService) Search

func (u *ScriptService) Search(ctx *gin.Context, req dto.SearchPageWithGroup) (int64, interface{}, error)

func (*ScriptService) Sync

func (u *ScriptService) Sync(req dto.OperateByTaskID) error

func (*ScriptService) Update

func (u *ScriptService) Update(req dto.ScriptOperate) error

type Scripts

type Scripts struct {
	Scripts ScriptDetail `json:"scripts"`
}

type SettingService

type SettingService struct{}

func (*SettingService) DefaultMenu

func (u *SettingService) DefaultMenu() error

func (*SettingService) GenerateApiKey

func (u *SettingService) GenerateApiKey() (string, error)

func (*SettingService) GenerateRSAKey

func (u *SettingService) GenerateRSAKey() error

func (*SettingService) GetAppstoreConfig

func (u *SettingService) GetAppstoreConfig() (*dto.AppstoreConfig, error)

func (*SettingService) GetLoginSetting

func (u *SettingService) GetLoginSetting() (*dto.SystemSetting, error)

func (*SettingService) GetSettingInfo

func (u *SettingService) GetSettingInfo() (*dto.SettingInfo, error)

func (*SettingService) GetTerminalInfo

func (u *SettingService) GetTerminalInfo() (*dto.TerminalInfo, error)

func (*SettingService) HandlePasswordExpired

func (u *SettingService) HandlePasswordExpired(c *gin.Context, old, new string) error

func (*SettingService) LoadFromCert

func (u *SettingService) LoadFromCert() (*dto.SSLInfo, error)

func (*SettingService) LoadInterfaceAddr

func (u *SettingService) LoadInterfaceAddr() ([]string, error)

func (*SettingService) Update

func (u *SettingService) Update(key, value string) error

func (*SettingService) UpdateApiConfig

func (u *SettingService) UpdateApiConfig(req dto.ApiInterfaceConfig) error

func (*SettingService) UpdateAppstoreConfig

func (u *SettingService) UpdateAppstoreConfig(req dto.AppstoreUpdate) error

func (*SettingService) UpdateBindInfo

func (u *SettingService) UpdateBindInfo(req dto.BindInfo) error

func (*SettingService) UpdatePassword

func (u *SettingService) UpdatePassword(c *gin.Context, old, new string) error

func (*SettingService) UpdatePort

func (u *SettingService) UpdatePort(port uint) error

func (*SettingService) UpdateProxy

func (u *SettingService) UpdateProxy(req dto.ProxyUpdate) error

func (*SettingService) UpdateSSL

func (u *SettingService) UpdateSSL(c *gin.Context, req dto.SSLUpdate) error

func (*SettingService) UpdateSystemSSL

func (u *SettingService) UpdateSystemSSL() error

func (*SettingService) UpdateTerminal

func (u *SettingService) UpdateTerminal(req dto.TerminalInfo) error

type UpgradeService

type UpgradeService struct{}

func (*UpgradeService) LoadNotes

func (u *UpgradeService) LoadNotes(req dto.Upgrade) (string, error)

func (*UpgradeService) LoadRelease

func (u *UpgradeService) LoadRelease() ([]dto.ReleasesNotes, error)

func (*UpgradeService) Rollback

func (u *UpgradeService) Rollback(req dto.OperateByID) error

func (*UpgradeService) SearchUpgrade

func (u *UpgradeService) SearchUpgrade() (*dto.UpgradeInfo, error)

func (*UpgradeService) Upgrade

func (u *UpgradeService) Upgrade(req dto.Upgrade) error

Jump to

Keyboard shortcuts

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