Documentation ¶
Index ¶
- Variables
- func DNSlookup(host string, server string, qtype string, timeout int) ([]string, error)
- func DetectDistro() string
- func DetectPackageManager() string
- func DetectService() string
- func GetPorts(lookupPids bool) map[string][]GOnetstat.Process
- func GetProcs() (map[string][]ps.Process, error)
- func HasCommand(cmd string) bool
- func HeaderToArray(header http.Header) (res []string)
- func IsSupportedPackageManager(p string) bool
- func LookupA(host string, server string, c *dns.Client, m *dns.Msg) (addrs []string, err error)
- func LookupAAAA(host string, server string, c *dns.Client, m *dns.Msg) (addrs []string, err error)
- func LookupCAA(host string, server string, c *dns.Client, m *dns.Msg) (addrs []string, err error)
- func LookupCNAME(host string, server string, c *dns.Client, m *dns.Msg) (addrs []string, err error)
- func LookupHost(host string, server string, c *dns.Client, m *dns.Msg) (addrs []string, err error)
- func LookupMX(host string, server string, c *dns.Client, m *dns.Msg) (addrs []string, err error)
- func LookupNS(host string, server string, c *dns.Client, m *dns.Msg) (addrs []string, err error)
- func LookupPTR(addr string, server string, c *dns.Client, m *dns.Msg) (name []string, err error)
- func LookupSRV(host string, server string, c *dns.Client, m *dns.Msg) (addrs []string, err error)
- func LookupTXT(host string, server string, c *dns.Client, m *dns.Msg) (addrs []string, err error)
- func SupportedPackageManagers() []string
- type Addr
- type AlpinePackage
- type Command
- type DNS
- type DebPackage
- type DefAddr
- type DefCommand
- type DefDNS
- type DefFile
- func (f *DefFile) Contains() (io.Reader, error)
- func (f *DefFile) Exists() (bool, error)
- func (f *DefFile) Filetype() (string, error)
- func (f *DefFile) Group() (string, error)
- func (f *DefFile) LinkedTo() (string, error)
- func (f *DefFile) Md5() (string, error)
- func (f *DefFile) Mode() (string, error)
- func (f *DefFile) Owner() (string, error)
- func (f *DefFile) Path() string
- func (f *DefFile) Sha256() (string, error)
- func (f *DefFile) Sha512() (string, error)
- func (f *DefFile) Size() (int, error)
- type DefGossfile
- type DefGroup
- type DefHTTP
- func (u *DefHTTP) Body() (io.Reader, error)
- func (u *DefHTTP) Exists() (bool, error)
- func (u *DefHTTP) HTTP() string
- func (u *DefHTTP) Headers() (io.Reader, error)
- func (u *DefHTTP) ID() string
- func (u *DefHTTP) SetAllowInsecure(t bool)
- func (u *DefHTTP) SetNoFollowRedirects(t bool)
- func (u *DefHTTP) Status() (int, error)
- type DefInterface
- type DefKernelParam
- type DefMount
- type DefPort
- type DefProcess
- type DefUser
- type File
- type Gossfile
- type Group
- type HTTP
- type Interface
- type KernelParam
- type Mount
- type NullPackage
- type Package
- func NewAlpinePackage(name string, system *System, config util.Config) Package
- func NewDebPackage(name string, system *System, config util.Config) Package
- func NewNullPackage(name string, system *System, config util.Config) Package
- func NewPacmanPackage(name string, system *System, config util.Config) Package
- func NewRpmPackage(name string, system *System, config util.Config) Package
- type PacmanPackage
- type Port
- type Process
- type Resource
- type RpmPackage
- type Service
- func NewAlpineServiceInit(service string, system *System, config util.Config) Service
- func NewServiceInit(service string, system *System, config util.Config) Service
- func NewServiceSystemd(service string, system *System, config util.Config) Service
- func NewServiceSystemdLegacy(service string, system *System, config util.Config) Service
- func NewServiceUpstart(service string, system *System, config util.Config) Service
- type ServiceInit
- type ServiceSystemd
- type ServiceUpstart
- type System
- type User
Constants ¶
This section is empty.
Variables ¶
var ErrNullPackage = errors.New("Could not detect Package type on this system, please use --package flag to explicity set it")
Functions ¶
func DetectDistro ¶ added in v0.1.4
func DetectDistro() string
DetectDistro attempts to detect which Linux distribution this computer is using. One of "ubuntu", "redhat" (including Centos), "alpine", "arch", or "debian". If it can't decide, it returns an empty string.
func DetectPackageManager ¶ added in v0.1.4
func DetectPackageManager() string
DetectPackageManager attempts to detect whether or not the system is using "dpkg", "rpm", "apk", or "pacman" package managers. It first attempts to detect the distro. If that fails, it falls back to finding package manager executables. If that fails, it returns the empty string.
func DetectService ¶ added in v0.1.4
func DetectService() string
DetectService attempts to detect what kind of service management the system is using, "systemd", "upstart", "alpineinit", or "init". It looks for systemctl command to detect systemd, and falls back on DetectDistro otherwise. If it can't decide, it returns "init".
func HasCommand ¶ added in v0.1.4
HasCommand returns whether or not an executable by this name is on the PATH.
func HeaderToArray ¶ added in v0.3.8
func IsSupportedPackageManager ¶ added in v0.3.11
IsSupportedPackageManager determines if p is a supported package manager
func LookupAAAA ¶ added in v0.2.6
AAAA (IPv6) record lookup
func LookupCNAME ¶ added in v0.2.6
CNAME record lookup
func LookupHost ¶ added in v0.2.6
A and AAAA record lookup - similar to net.LookupHost
func SupportedPackageManagers ¶ added in v0.3.11
func SupportedPackageManagers() []string
SupportedPackageManagers is a list of package managers we support
Types ¶
type AlpinePackage ¶ added in v0.0.20
type AlpinePackage struct {
// contains filtered or unexported fields
}
func (*AlpinePackage) Exists ¶ added in v0.0.20
func (p *AlpinePackage) Exists() (bool, error)
func (*AlpinePackage) Installed ¶ added in v0.0.20
func (p *AlpinePackage) Installed() (bool, error)
func (*AlpinePackage) Name ¶ added in v0.0.20
func (p *AlpinePackage) Name() string
func (*AlpinePackage) Versions ¶ added in v0.0.20
func (p *AlpinePackage) Versions() ([]string, error)
type Command ¶
type DNS ¶
type DebPackage ¶ added in v0.0.4
type DebPackage struct {
// contains filtered or unexported fields
}
func (*DebPackage) Exists ¶ added in v0.0.4
func (p *DebPackage) Exists() (bool, error)
func (*DebPackage) Installed ¶ added in v0.0.4
func (p *DebPackage) Installed() (bool, error)
func (*DebPackage) Name ¶ added in v0.0.4
func (p *DebPackage) Name() string
func (*DebPackage) Versions ¶ added in v0.0.4
func (p *DebPackage) Versions() ([]string, error)
type DefCommand ¶ added in v0.0.4
type DefCommand struct { Timeout int // contains filtered or unexported fields }
func (*DefCommand) Command ¶ added in v0.0.4
func (c *DefCommand) Command() string
func (*DefCommand) ExitStatus ¶ added in v0.0.4
func (c *DefCommand) ExitStatus() (int, error)
type DefDNS ¶ added in v0.0.4
type DefDNS struct { Timeout int // contains filtered or unexported fields }
func (*DefDNS) Resolvable ¶ added in v0.3.5
type DefGossfile ¶ added in v0.0.4
type DefGossfile struct {
// contains filtered or unexported fields
}
func (*DefGossfile) Path ¶ added in v0.0.4
func (g *DefGossfile) Path() string
type DefHTTP ¶ added in v0.1.10
type DefHTTP struct { RequestHeader http.Header RequestBody string Timeout int Username string Password string CAFile string CertFile string KeyFile string Method string Proxy string // contains filtered or unexported fields }
func (*DefHTTP) SetAllowInsecure ¶ added in v0.1.10
func (*DefHTTP) SetNoFollowRedirects ¶ added in v0.2.5
type DefInterface ¶ added in v0.1.8
type DefInterface struct {
// contains filtered or unexported fields
}
func (*DefInterface) Addrs ¶ added in v0.1.8
func (i *DefInterface) Addrs() ([]string, error)
func (*DefInterface) Exists ¶ added in v0.1.8
func (i *DefInterface) Exists() (bool, error)
func (*DefInterface) ID ¶ added in v0.1.8
func (i *DefInterface) ID() string
func (*DefInterface) MTU ¶ added in v0.3.6
func (i *DefInterface) MTU() (int, error)
func (*DefInterface) Name ¶ added in v0.1.8
func (i *DefInterface) Name() string
type DefKernelParam ¶ added in v0.1.8
type DefKernelParam struct {
// contains filtered or unexported fields
}
func (*DefKernelParam) Exists ¶ added in v0.1.8
func (k *DefKernelParam) Exists() (bool, error)
func (*DefKernelParam) ID ¶ added in v0.1.8
func (k *DefKernelParam) ID() string
func (*DefKernelParam) Key ¶ added in v0.1.8
func (k *DefKernelParam) Key() string
func (*DefKernelParam) Value ¶ added in v0.1.8
func (k *DefKernelParam) Value() (string, error)
type DefMount ¶ added in v0.1.8
type DefMount struct {
// contains filtered or unexported fields
}
func (*DefMount) Filesystem ¶ added in v0.1.8
func (*DefMount) MountPoint ¶ added in v0.1.8
type DefProcess ¶ added in v0.0.4
type DefProcess struct {
// contains filtered or unexported fields
}
func (*DefProcess) Executable ¶ added in v0.0.4
func (p *DefProcess) Executable() string
func (*DefProcess) Exists ¶ added in v0.0.4
func (p *DefProcess) Exists() (bool, error)
func (*DefProcess) Pids ¶ added in v0.0.4
func (p *DefProcess) Pids() ([]int, error)
func (*DefProcess) Running ¶ added in v0.0.4
func (p *DefProcess) Running() (bool, error)
type File ¶
type File interface { Path() string Exists() (bool, error) Contains() (io.Reader, error) Mode() (string, error) Size() (int, error) Filetype() (string, error) Owner() (string, error) Group() (string, error) LinkedTo() (string, error) Md5() (string, error) Sha256() (string, error) Sha512() (string, error) }
type HTTP ¶ added in v0.1.10
type Interface ¶ added in v0.1.8
type KernelParam ¶ added in v0.1.8
func NewDefKernelParam ¶ added in v0.1.8
func NewDefKernelParam(key string, system *System, config util.Config) KernelParam
type Mount ¶ added in v0.1.8
type NullPackage ¶ added in v0.0.4
type NullPackage struct {
// contains filtered or unexported fields
}
func (*NullPackage) Exists ¶ added in v0.0.4
func (p *NullPackage) Exists() (bool, error)
func (*NullPackage) Installed ¶ added in v0.0.4
func (p *NullPackage) Installed() (bool, error)
func (*NullPackage) Name ¶ added in v0.0.4
func (p *NullPackage) Name() string
func (*NullPackage) Versions ¶ added in v0.0.4
func (p *NullPackage) Versions() ([]string, error)
type Package ¶
type Package interface { Name() string Exists() (bool, error) Installed() (bool, error) Versions() ([]string, error) }
func NewAlpinePackage ¶ added in v0.0.20
func NewDebPackage ¶ added in v0.0.4
func NewNullPackage ¶ added in v0.0.4
func NewPacmanPackage ¶ added in v0.1.4
type PacmanPackage ¶ added in v0.1.4
type PacmanPackage struct {
// contains filtered or unexported fields
}
func (*PacmanPackage) Exists ¶ added in v0.1.4
func (p *PacmanPackage) Exists() (bool, error)
func (*PacmanPackage) Installed ¶ added in v0.1.4
func (p *PacmanPackage) Installed() (bool, error)
func (*PacmanPackage) Name ¶ added in v0.1.4
func (p *PacmanPackage) Name() string
func (*PacmanPackage) Versions ¶ added in v0.1.4
func (p *PacmanPackage) Versions() ([]string, error)
type Port ¶
type Process ¶
type RpmPackage ¶ added in v0.0.4
type RpmPackage struct {
// contains filtered or unexported fields
}
func (*RpmPackage) Exists ¶ added in v0.0.4
func (p *RpmPackage) Exists() (bool, error)
func (*RpmPackage) Installed ¶ added in v0.0.4
func (p *RpmPackage) Installed() (bool, error)
func (*RpmPackage) Name ¶ added in v0.0.4
func (p *RpmPackage) Name() string
func (*RpmPackage) Versions ¶ added in v0.0.4
func (p *RpmPackage) Versions() ([]string, error)
type Service ¶
type Service interface { Service() string Exists() (bool, error) Enabled() (bool, error) Running() (bool, error) }
func NewAlpineServiceInit ¶ added in v0.0.20
func NewServiceInit ¶
func NewServiceSystemd ¶ added in v0.1.8
func NewServiceSystemdLegacy ¶ added in v0.3.8
type ServiceInit ¶
type ServiceInit struct {
// contains filtered or unexported fields
}
func (*ServiceInit) Enabled ¶
func (s *ServiceInit) Enabled() (bool, error)
func (*ServiceInit) Exists ¶ added in v0.0.2
func (s *ServiceInit) Exists() (bool, error)
func (*ServiceInit) Running ¶
func (s *ServiceInit) Running() (bool, error)
func (*ServiceInit) Service ¶
func (s *ServiceInit) Service() string
type ServiceSystemd ¶ added in v0.1.8
type ServiceSystemd struct {
// contains filtered or unexported fields
}
func (*ServiceSystemd) Enabled ¶ added in v0.1.8
func (s *ServiceSystemd) Enabled() (bool, error)
func (*ServiceSystemd) Exists ¶ added in v0.1.8
func (s *ServiceSystemd) Exists() (bool, error)
func (*ServiceSystemd) Running ¶ added in v0.1.8
func (s *ServiceSystemd) Running() (bool, error)
func (*ServiceSystemd) Service ¶ added in v0.1.8
func (s *ServiceSystemd) Service() string
type ServiceUpstart ¶ added in v0.0.14
type ServiceUpstart struct {
// contains filtered or unexported fields
}
func (*ServiceUpstart) Enabled ¶ added in v0.0.14
func (s *ServiceUpstart) Enabled() (bool, error)
func (*ServiceUpstart) Exists ¶ added in v0.0.14
func (s *ServiceUpstart) Exists() (bool, error)
func (*ServiceUpstart) Running ¶ added in v0.0.14
func (s *ServiceUpstart) Running() (bool, error)
func (*ServiceUpstart) Service ¶ added in v0.0.14
func (s *ServiceUpstart) Service() string
type System ¶
type System struct { NewPackage func(string, *System, util2.Config) Package NewFile func(string, *System, util2.Config) File NewAddr func(string, *System, util2.Config) Addr NewPort func(string, *System, util2.Config) Port NewService func(string, *System, util2.Config) Service NewUser func(string, *System, util2.Config) User NewGroup func(string, *System, util2.Config) Group NewCommand func(string, *System, util2.Config) Command NewDNS func(string, *System, util2.Config) DNS NewProcess func(string, *System, util2.Config) Process NewGossfile func(string, *System, util2.Config) Gossfile NewKernelParam func(string, *System, util2.Config) KernelParam NewMount func(string, *System, util2.Config) Mount NewInterface func(string, *System, util2.Config) Interface NewHTTP func(string, *System, util2.Config) HTTP // contains filtered or unexported fields }
Source Files ¶
- addr.go
- command.go
- command_posix.go
- dns.go
- file.go
- file_posix.go
- gossfile.go
- group.go
- http.go
- interface.go
- kernel_param.go
- mount.go
- mount_posix.go
- package.go
- package_alpine.go
- package_deb.go
- package_pacman.go
- package_rpm.go
- port.go
- process.go
- service.go
- service_init.go
- service_systemd.go
- service_upstart.go
- system.go
- user.go
- user_group_unix.go
- user_unix.go