Documentation ¶
Index ¶
- func CheckSudo(password string) bool
- func CurlToSave(url, filename string, cover bool) bool
- func Developer() bool
- func DpkgCheckInstalledKey(pac1, pac2 string, debug bool) (bool, string)
- func DpkgCheckPackageVersion(package_ string, version string) (status_ bool, ver_ string)
- func DpkgGetPackageStatus(pacPackage string) (m map[string]string, err error)
- func DpkgInstalled(pacPackage string) bool
- func GetOsInfo() (osType, osArch string, osVersion int)
- func GetUserInfo(display bool) (ok bool, username string, userid int, UserHome string)
- func IsIPv4(ipAddr string) bool
- func IsLoopbackV4(ipAddr string) bool
- func NewDpkg(password string, realtime bool) *dpkgApi
- func NewNmcli() *nmcliApi
- func Version()
- func WgetToSave(url, filename string) bool
- type AptApi
- func (a *AptApi) AptInstall(Package string) (res bool)
- func (a *AptApi) AptInstallList(pacList list.List) (ok, failed list.List)
- func (a *AptApi) AptInstallSlice(pacList []string) (ok, failed list.List)
- func (a *AptApi) AptLocalInstallFile(filename, name string) (err error)
- func (a *AptApi) AptLocalInstallStr(installStr, name string) bool
- func (a *AptApi) AptUninstall(Package string, name string) (res bool)
- func (a *AptApi) AptUninstallList(pacList list.List) (ok, failed list.List)
- func (a *AptApi) AptUninstallSlice(pacList []string) (ok, failed list.List)
- func (a *AptApi) AptUpdateIndex() (res bool)
- func (a *AptApi) AptUpgrade() (res bool)
- func (a *AptApi) LocalInstallList(fileList []string, name string) bool
- type Connection
- type EthApi
- type ServiceApi
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurlToSave ¶
CurlToSave 使用Curl下载文件到指定路径(cover是否覆盖已有文件)
func DpkgCheckInstalledKey ¶ added in v1.3.3
DpkgCheckInstalledKey 使用两个关键词查询本地是否已安装某个软件包
func DpkgCheckPackageVersion ¶
DpkgCheckPackageVersion 使用dpkg检查本地安装版本与标准版本是否一致
func DpkgGetPackageStatus ¶
DpkgGetPackageStatus 使用 Dpkg查询包状态, 通过res返回字典,通过status返回查询状态,字典key(status/Name/version)
func GetUserInfo ¶
GetUserInfo 获取当前系统环境信息(display: 是否显示信息)
Types ¶
type AptApi ¶ added in v1.5.3
type AptApi struct { Sudo gcs.SudoConfig // 执行sudo命令 // contains filtered or unexported fields }
AptApi 定义一个命令行密码结构体
func (*AptApi) AptInstall ¶ added in v1.5.3
AptInstall 使用apt在线安装包
func (*AptApi) AptInstallList ¶ added in v1.5.3
AptInstallList 通过apt安装包(列表传入)
func (*AptApi) AptInstallSlice ¶ added in v1.5.3
AptInstallSlice 通过apt安装包(切片传入) - 推荐
func (*AptApi) AptLocalInstallFile ¶ added in v1.5.3
AptLocalInstallFile 使用apt安装本地文件(单个),安装之前将会检测文件是否存在
func (*AptApi) AptLocalInstallStr ¶ added in v1.5.3
AptLocalInstallStr 使用apt安装本地文件(字符串),直接安装,不会检测文件是否存在
func (*AptApi) AptUninstall ¶ added in v1.5.3
AptUninstall 通过apt卸载单个包
func (*AptApi) AptUninstallList ¶ added in v1.5.3
AptUninstallList 通过apt卸载包(列表传入)
func (*AptApi) AptUninstallSlice ¶ added in v1.5.3
AptUninstallSlice 通过apt卸载包(列表传入)
func (*AptApi) AptUpdateIndex ¶ added in v1.5.3
AptUpdateIndex 更新索引
func (*AptApi) AptUpgrade ¶ added in v1.5.3
AptUpgrade 更新系统
type Connection ¶ added in v1.4.3
type Connection struct { Name string // 连接名称(例如: dhcp) Types string // 连接类型(bridge/wifi/ethernet) Method string // 连接模式(auto) Dns []string // DNS列表 Dev string // 设备名称 Gw string // 网关地址 Address string // IP地址 Mask int // 子网掩码 // 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 EthApi ¶ added in v1.5.3
type EthApi struct { Index int // 网卡设备索引 Name string // 网卡名称 Ipv4 string // IPV4地址 Mask int //子网掩码 Mac string // Mac物理地址 }
EthApi 网卡信息结构体
type ServiceApi ¶ added in v1.5.5
type ServiceApi struct { Name string // 服务名称 Err error //错误 Status string // 当前状态 Password string // Sudo权限密码 // contains filtered or unexported fields }
func NewService ¶ added in v1.5.5
func NewService(name string) *ServiceApi
func (*ServiceApi) ReLoad ¶ added in v1.5.5
func (api *ServiceApi) ReLoad() *ServiceApi
func (*ServiceApi) ReLoadDaemon ¶ added in v1.5.5
func (api *ServiceApi) ReLoadDaemon() *ServiceApi
func (*ServiceApi) ReStart ¶ added in v1.5.5
func (api *ServiceApi) ReStart()
func (*ServiceApi) Start ¶ added in v1.5.5
func (api *ServiceApi) Start()
func (*ServiceApi) Stop ¶ added in v1.5.5
func (api *ServiceApi) Stop()