consts

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDialTimeout            = 2 * time.Second
	DefaultRunCommandFailedCounts = 3
)
View Source
const (
	PCISysPath   = "/sys/bus/pci/devices"
	PCIInfoRegex = `^([^:]+): \{(.*)\}$`
)
View Source
const (
	SSHKeyTypeED25519               = "ed25519"
	SSHKeyTypeRSA                   = "rsa"
	SSHKeyTypeECDSA                 = "ecdsa"
	SSHKeyTypeDSA                   = "dsa"
	SSHKeyTypeRSA1                  = "rsa1"
	SSHBackupAuthorizedKeysFilePath = "~/.ssh/authorized_keys.migration_scheduling.bak"
	SSHAuthorizedKeysFilePath       = "~/.ssh/authorized_keys"
)

Variables

View Source
var DefaultSSHConfig = SSHConfig{
	Username:  "root",
	Password:  "",
	IPAddress: "",
	Port:      22,
}

DefaultSSHConfig 默认SSH配置

View Source
var (
	PCIDevicesInfoPath = []string{
		"/usr/share/misc/pci.ids",
		"/usr/share/hwdata/pci.ids",
	}
)

Functions

This section is empty.

Types

type AddSSHKeyParam added in v0.0.2

type AddSSHKeyParam struct {
	SSHConfig SSHConfig `json:"ssh_config,omitempty"` // ssh配置
	KeyType   string    `json:"key_type,omitempty"`   // 公钥类型,可选值为 dsa | ecdsa | ed25519 | rsa | rsa1
	Comment   string    `json:"comment,omitempty"`    // 公钥备注
	IsBackup  bool      `json:"is_backup,omitempty"`  // 是否备份authorized_keys文件
}

AddSSHKeyParam 添加免密认证参数

type AsyncCallParam

type AsyncCallParam struct {
	Concurrency int
	Operation   func(ctx context.Context, item interface{}) (interface{}, error)
	Items       []interface{}
}

异步调用参数

type AsyncCallResult

type AsyncCallResult struct {
	Ret interface{}
	Err error
}

type AsyncCallResultList

type AsyncCallResultList struct {
	RetList []AsyncCallResult
}

type DeleteFileParam

type DeleteFileParam struct {
	FilePath string
}

DeleteFileParam 删除文件参数

type DeleteFileResult

type DeleteFileResult struct {
}

DeleteFileResult 删除文件结果

type DeleteSSHKeyParam added in v0.0.2

type DeleteSSHKeyParam struct {
	SSHConfig SSHConfig `json:"ssh_config,omitempty"` // ssh配置
}

DeleteSSHKeyParam 删除免密认证参数

type DownloadFileParam

type DownloadFileParam struct {
	URL      string
	DirPath  string
	FileName string
}

type DownloadFileResult

type DownloadFileResult struct {
	FilePath string
}

DownloadFileResult 下载文件结果

type FileInfo added in v0.0.2

type FileInfo struct {
	Name         string `json:"name,omitempty"`         // 文件名
	Size         int    `json:"size,omitempty"`         // 文件大小
	Mode         string `json:"mode,omitempty"`         // 文件权限
	ModTime      string `json:"mod_time,omitempty"`     // 文件修改时间
	FileType     string `json:"file_type,omitempty"`    // 文件类型
	User         string `json:"user,omitempty"`         // 文件所属用户
	Group        string `json:"group,omitempty"`        // 文件所属组
	LinkPath     string `json:"link_path,omitempty"`    // 链接路径
	GlobalPath   string `json:"global_path,omitempty"`  // 全局路径
	Architecture string `json:"architecture,omitempty"` // 架构
}

文件信息

type FindFileParam added in v0.0.2

type FindFileParam struct {
	DirPath  string
	FileName string
}

FindFileParam 查找文件参数

type FindFileResult added in v0.0.2

type FindFileResult struct {
	FilePathList []string `json:"file_path_list,omitempty"` // 文件路径列表
}

FindFileResult 查找文件结果

type GetFileInfoParam added in v0.0.2

type GetFileInfoParam struct {
	FilePath string
}

GetFileInfoParam 获取文件信息参数

type GetFileInfoResult added in v0.0.2

type GetFileInfoResult struct {
	FileInfo
}

GetFileInfoResult 获取文件信息结果

type GetFilePathListParam added in v0.0.2

type GetFilePathListParam struct {
	FilePath string `json:"file_path,omitempty"` // 文件路径
}

GetFilePathListParam 获取某个路径下的文件清单参数

type GetFilePathListResult added in v0.0.2

type GetFilePathListResult struct {
	FileInfoList []FileInfo `json:"file_info_list,omitempty"` // 文件信息列表
}

GetFilePathListResult 获取某个路径下的文件清单结果

type GetInstalledPackageListParam

type GetInstalledPackageListParam struct {
}

获取已经安装的软件包列表入参

type GetInstalledPackageListResult

type GetInstalledPackageListResult struct {
	PackageList []string
}

获取已经安装的软件包列表出参

type GetPCIInfoByPCISlotNameParam added in v0.0.2

type GetPCIInfoByPCISlotNameParam struct {
	PCISlotName string `json:"pci_slot_name,omitempty"` // PCI插槽名称

}

GetPCIInfoByPCISlotNameParam 获取PCI信息参数

type GetPCIInfoByPCISlotNameResult added in v0.0.2

type GetPCIInfoByPCISlotNameResult struct {
	PCIInfo `json:"pci_info,omitempty"` // PCI信息
}

GetPCIInfoByPCISlotNameResult 获取PCI信息结果

type GetPCIInfoListParam added in v0.0.2

type GetPCIInfoListParam struct {
	Async       bool `json:"async,omitempty"`       // 是否异步
	Concurrency int  `json:"concurrency,omitempty"` // 并发数
}

GetPCIInfoListParam 获取PCI信息列表参数

type GetPCIInfoListResult added in v0.0.2

type GetPCIInfoListResult struct {
	PCIInfoList []PCIInfo `json:"pci_info_list,omitempty"` // PCI信息列表
}

GetPCIInfoListResult 获取PCI信息列表结果

type GetPackageFileListParam

type GetPackageFileListParam struct {
	PackageName string
}

获取某个软件包的文件列表入参

type GetPackageFileListResult

type GetPackageFileListResult struct {
	PackageInfo
}

获取某个软件包的文件列表出参

type GetPackageInfoParam

type GetPackageInfoParam struct {
	PackageName string
}

获取某个软件包的详细信息入参

type GetPackageInfoResult

type GetPackageInfoResult struct {
	PackageInfo
}

获取某个软件包的详细信息出参

type GetPackagesFileListParam

type GetPackagesFileListParam struct {
	PackageList []string
	Async       bool
}

获取多个软件包文件列表入参

type GetPackagesFileListResult

type GetPackagesFileListResult struct {
	PackageList []GetPackageFileListResult
}

获取多个软件包文件列表出参

type GetSSHKeyParam added in v0.0.2

type GetSSHKeyParam struct {
	Generate bool   `json:"generate,omitempty"` // 是否生成公钥
	KeyType  string `json:"key_type,omitempty"` // 公钥类型,可选值为 dsa | ecdsa | ed25519 | rsa | rsa1
	Comment  string `json:"comment,omitempty"`  // 公钥备注
}

GetSSHKeyParam 获取ssh公钥入参

type GetSSHKeyResult added in v0.0.2

type GetSSHKeyResult struct {
	FilePath      string `json:"file_path,omitempty"`       // 公钥文件路径
	PubKeyContent string `json:"pub_key_content,omitempty"` // 公钥内容
}

GetSSHKeyResult 获取ssh公钥结果

type GetSystemFileParam added in v0.0.2

type GetSystemFileParam struct {
	FilePath string `json:"file_path,omitempty"` // 文件路径
	Async    bool   `json:"async,omitempty"`     // 是否异步
}

GetSystemFileParam 获取系统文件参数

type GetSystemFileResult added in v0.0.2

type GetSystemFileResult struct {
	FilePath string `json:"file_path,omitempty"` // 文件路径
	Content  string `json:"content,omitempty"`   // 文件内容
}

GetSystemFileResult 获取系统文件结果

type InstallPackagesParam added in v0.0.2

type InstallPackagesParam struct {
	PackageList []PackageInfo
}

InstallPackageParam 安装软件包入参

type InstallPackagesResult added in v0.0.2

type InstallPackagesResult struct {
	IgnoredInstallPackageList      []PackageInfo `json:"ignored_install_package_list"`
	SuccessfullyInstallPackageList []PackageInfo `json:"successfully_install_package_list"`
	FailedInstallPackageList       []PackageInfo `json:"failed_install_package_list"`
	Total                          int           `json:"total"`
}

InstallPackageResult 安装软件包结果

type PCIInfo added in v0.0.2

type PCIInfo struct {
	PCIClass    string `json:"pci_class,omitempty"`     // PCI类
	PCIID       string `json:"pci_id,omitempty"`        // PCIID
	PCISubsysID string `json:"pci_subsys_id,omitempty"` // PCI子系统ID
	PCISlotName string `json:"pci_slot_name,omitempty"` // PCI插槽名称
	MODALIAS    string `json:"modalias,omitempty"`      // 模块别名
	Driver      string `json:"driver"`                  // 驱动
	SysPath     string `json:"sys_path,omitempty"`      // 系统路径
	DeviceName  string `json:"device_name,omitempty"`   // 设备名称
	VendorName  string `json:"vendor_name,omitempty"`   // 厂商名称
	DeviceID    string `json:"device_id,omitempty"`     // 设备ID
	VendorID    string `json:"vendor_id,omitempty"`     // 厂商ID
}

type PackageInfo

type PackageInfo struct {
	ID            string   `json:"id,omitempty"`
	FullName      string   `json:"full_name,omitempty"`
	Name          string   `json:"name,omitempty"`
	Version       string   `json:"version,omitempty"`
	ReleaseNumber string   `json:"release_number,omitempty"`
	OS            string   `json:"os,omitempty"`
	Architecture  string   `json:"architecture,omitempty"`
	Description   string   `json:"description,omitempty"`
	Files         []string `json:"files,omitempty"`
	Requires      []string `json:"requires,omitempty"`
	Provides      []string `json:"provides,omitempty"`
}

PackageInfo 包信息

type RunCommandConfig

type RunCommandConfig struct {
	Command                string
	RunCommandFailedCounts int
}

RunCommandConfig 用于存储远程运行参数

type SSHConfig

type SSHConfig struct {
	Username  string `json:"username,omitempty"`
	Password  string `json:"password,omitempty"`
	IPAddress string `json:"ip_address,omitempty"`
	Port      int    `json:"port,omitempty"`
}

SSHConfig 用于存储 SSH 配置

type SystemInfo

type SystemInfo struct {
	FullName        string `json:"full_name,omitempty"`
	Name            string `json:"name,omitempty"`
	Version         string `json:"version,omitempty"`
	ID              string `json:"id,omitempty"`
	IDLike          string `json:"id_like,omitempty"`
	VersionCodename string `json:"version_codename,omitempty"`
	VersionID       string `json:"version_id,omitempty"`
	PrettyName      string `json:"pretty_name,omitempty"`
	AnsiColor       string `json:"ansi_color,omitempty"`
	CPEName         string `json:"cpe_name,omitempty"`
	HomeUrl         string `json:"home_url,omitempty"`
	BuildID         string `json:"build_id,omitempty"`
	Variant         string `json:"variant,omitempty"`
	VariantID       string `json:"variant_id,omitempty"`
	OSVersion       string `json:"os_version,omitempty"`
	Architecture    string `json:"architecture,omitempty"`
	KernelVersion   string `json:"kernel_version,omitempty"`
}

SystemInfo 用于存储系统基本信息

type WriteFileParam added in v0.0.2

type WriteFileParam struct {
	FilePath  string
	Content   string
	Overwrite bool
}

WriteFileParam 写入文件参数

Jump to

Keyboard shortcuts

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