Documentation ¶
Index ¶
- func CheckSudo(password string) bool
- func CurlToSave(url, filename string, cover bool) bool
- func DeleteFile(file string) error
- func Developer() bool
- func DpkgCheckInstalledKey(pac1, pac2 string, debug bool) (bool, string)
- func DpkgCheckPackageVersion(package_ string, version string) (status_ bool, ver_ string)
- func DpkgConfig(password string, realtime bool) *dpkg
- func DpkgGetPackageStatus(pacPackage string) (m map[string]string, err error)
- func DpkgInstalled(pacPackage string) bool
- func EchoAdd(text, filename string, wrap bool) error
- func Exists(path string) error
- func GetOsInfo() (osType, osArch string, osVersion int)
- func GetUserInfo(display bool) (ok bool, username string, userid int, UserHome string)
- func IsDir(path string) (bool, error)
- func IsFile(path string) error
- func IsIPv4(ipAddr string) bool
- func IsLoopbackV4(ipAddr string) bool
- func Mkdir(dir string, mode fs.FileMode) error
- func ReadLine(line int, filename string) (string, error)
- func ReadOnlyAll(filename string) (string, error)
- func Version()
- func WgetToSave(url, filename string) bool
- func WriteTxtAppend(text, filename string, wrap bool) error
- type AptPassword
- func (a *AptPassword) AptInstall(Package string) bool
- func (a *AptPassword) AptInstallList(pacList list.List) (ok, failed list.List)
- func (a *AptPassword) AptInstallSlice(pacList []string) (ok, failed list.List)
- func (a *AptPassword) AptLocalInstallFile(filename, name string) (err error)
- func (a *AptPassword) AptLocalInstallStr(installStr, name string) bool
- func (a *AptPassword) AptUninstall(Package string, name string) bool
- func (a *AptPassword) AptUninstallList(pacList list.List) (ok, failed list.List)
- func (a *AptPassword) AptUninstallSlice(pacList []string) (ok, failed list.List)
- func (a *AptPassword) AptUpdateIndex() bool
- func (a *AptPassword) AptUpgrade() bool
- func (a *AptPassword) LocalInstallList(fileList []string, name string) bool
- type Connection
- type EthInterface
- type NetDevice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurlToSave ¶
CurlToSave 使用Curk下载文件到指定路径(cover是否覆盖已有文件)
func DpkgCheckInstalledKey ¶ added in v1.3.3
DpkgCheckInstalledKey 使用两个关键词查询本地是否已安装某个软件包
func DpkgCheckPackageVersion ¶
DpkgCheckPackageVersion 使用dpkg检查本地安装版本与标准版本是否一致
func DpkgConfig ¶
DpkgConfig 初始化(realtime: 是否开启实时刷新)
func DpkgGetPackageStatus ¶
DpkgGetPackageStatus 使用 Dpkg查询包状态, 通过res返回字典,通过status返回查询状态,字典key(status/name/version)
func GetUserInfo ¶
GetUserInfo 获取当前系统环境信息(display: 是否显示信息)
func WriteTxtAppend ¶
WriteTxtAppend 追加方式写入文本(wrap: 是否在末尾追加换行符)
Types ¶
type AptPassword ¶
type AptPassword struct { Sudo gcs.SudoConfig // 执行sudo命令 // contains filtered or unexported fields }
AptPassword 定义一个命令行密码结构体
func AptInitConfig ¶
func AptInitConfig(password string, debug, realtime bool) *AptPassword
AptInitConfig Apt 管理初始化
func (*AptPassword) AptInstall ¶
func (a *AptPassword) AptInstall(Package string) bool
AptInstall 使用apt在线安装包
func (*AptPassword) AptInstallList ¶
func (a *AptPassword) AptInstallList(pacList list.List) (ok, failed list.List)
AptInstallList 通过apt安装包(列表传入)
func (*AptPassword) AptInstallSlice ¶
func (a *AptPassword) AptInstallSlice(pacList []string) (ok, failed list.List)
AptInstallSlice 通过apt安装包(切片传入) - 推荐
func (*AptPassword) AptLocalInstallFile ¶
func (a *AptPassword) AptLocalInstallFile(filename, name string) (err error)
AptLocalInstallFile 使用apt安装本地文件(单个),安装之前将会检测文件是否存在
func (*AptPassword) AptLocalInstallStr ¶
func (a *AptPassword) AptLocalInstallStr(installStr, name string) bool
AptLocalInstallStr 使用apt安装本地文件(字符串),直接安装,不会检测文件是否存在
func (*AptPassword) AptUninstall ¶
func (a *AptPassword) AptUninstall(Package string, name string) bool
AptUninstall 通过apt卸载单个包
func (*AptPassword) AptUninstallList ¶
func (a *AptPassword) AptUninstallList(pacList list.List) (ok, failed list.List)
AptUninstallList 通过apt卸载包(列表传入)
func (*AptPassword) AptUninstallSlice ¶ added in v1.3.7
func (a *AptPassword) AptUninstallSlice(pacList []string) (ok, failed list.List)
AptUninstallSlice 通过apt卸载包(列表传入)
func (*AptPassword) AptUpdateIndex ¶
func (a *AptPassword) AptUpdateIndex() bool
AptUpdateIndex 更新索引
func (*AptPassword) LocalInstallList ¶ added in v1.3.7
func (a *AptPassword) LocalInstallList(fileList []string, name string) bool
LocalInstallList 使用apt安装本地文件(列表传入)
type Connection ¶ added in v1.4.3
type Connection struct {
// contains filtered or unexported fields
}
func (*Connection) AddDns ¶ added in v1.4.3
func (c *Connection) AddDns() (err error)
AddDns 增加DNS,默认(119.29.29.29 180.76.76.76)
func (*Connection) ConnectAdd ¶ added in v1.4.3
func (c *Connection) ConnectAdd() error
ConnectAdd 新增连接
type EthInterface ¶ added in v1.4.3
type EthInterface struct { Index int // 网卡设备索引 Name string // 网卡名称 Ipv4 string // IPV4地址 Mask int //子网掩码 Mac string // Mac物理地址 }
EthInterface 网卡信息结构体
type NetDevice ¶
type NetDevice struct { DefaultGw string // 当前默认网关 DefaultDevices string // 当前默认网卡设备 // contains filtered or unexported fields }
NetDevice 网卡管理
func (*NetDevice) GetConnectionList ¶
GetConnectionList 获取指定设备及类型的连接列表
func (*NetDevice) GetDefaultGw ¶ added in v1.4.3
GetDefaultGw 获取默认网关/网卡设备
func (*NetDevice) GetEthInfo ¶ added in v1.4.3
func (n *NetDevice) GetEthInfo() ([]EthInterface, error)
GetEthInfo 获取所有网卡信息(IPV4)