Documentation
¶
Index ¶
- Constants
- Variables
- func NewNetInterfaces() []net.Interface
- type LinuxMemInfo
- type LinuxStatRetriever
- type LoadData
- type MemInfo
- type MemInfoData
- type Miner
- type MinerData
- type MockMemInfo
- type MockMiner
- type MockNetInfo
- type MockNtpdate
- type MockReboot
- type MockStatRetriever
- type NetInfo
- type NetInfoData
- type Networking
- type NetworkingData
- type Ntpdate
- type NtpdateData
- type Reboot
- type RebootData
- type StatRetriever
- type UptimeResult
- type UptimeResultFunc
Constants ¶
View Source
const ( MemBelow = iota MemExactly MemAbove )
View Source
const ( LevelNotEnough = iota LevelBelowFive LevelExactlyFive LevelAboveFive LevelMalformed )
View Source
const MemAvailable = "MemAvailable_bytes"
Variables ¶
View Source
var MemInfoModule = fx.Provide(NewMemInfo)
View Source
var MinerModule = fx.Provide(NewMiner)
View Source
var NetInfoModule = fx.Provide(NewNetInfo)
View Source
var NetworkingModule = fx.Provide(NewNetworking)
View Source
var NtpdateModule = fx.Provide(func() Ntpdate { return &NtpdateData{ run: func(cmd string, arg ...string) error { return exec.Command(cmd, arg...).Run() }, } })
View Source
var RebootModule = fx.Provide(func() Reboot { return &RebootData{ run: func(cmd string, arg string) error { return exec.Command(cmd, arg).Run() }, } })
View Source
var StatRetrieverModule = fx.Provide(NewStatRetriever)
View Source
var UptimeModule = fx.Provide(NewUptimeResultFunc)
Functions ¶
Types ¶
type LinuxMemInfo ¶
type LinuxMemInfo struct {
// contains filtered or unexported fields
}
func (*LinuxMemInfo) Get ¶
func (m *LinuxMemInfo) Get() (MemInfoData, error)
type LinuxStatRetriever ¶
type LinuxStatRetriever struct {
// contains filtered or unexported fields
}
func (*LinuxStatRetriever) GetLoadData ¶
func (lsr *LinuxStatRetriever) GetLoadData() (*LoadData, error)
type LoadData ¶
func ParseLoadData ¶
Parse /proc loadavg and return 1m, 5m and 15m.
type MemInfo ¶
type MemInfo interface {
Get() (data MemInfoData, err error)
}
func NewMemInfo ¶
func NewMemInfo() MemInfo
type MemInfoData ¶
type MockMemInfo ¶
type MockMemInfo struct {
// contains filtered or unexported fields
}
func NewMockMemInfo ¶
func NewMockMemInfo(dataSet int) MockMemInfo
func (*MockMemInfo) Get ¶
func (sr *MockMemInfo) Get() (MemInfoData, error)
type MockMiner ¶
func NewMockMiner ¶
func NewMockMiner() MockMiner
type MockNetInfo ¶
type MockNetInfo struct {
// contains filtered or unexported fields
}
func NewMockNetInfo ¶
func NewMockNetInfo() MockNetInfo
func (*MockNetInfo) GetMacAddress ¶
func (mni *MockNetInfo) GetMacAddress() *string
func (*MockNetInfo) GetNetInterfaces ¶
func (mni *MockNetInfo) GetNetInterfaces() ([]net.Interface, error)
type MockNtpdate ¶
func NewMockNtpdate ¶
func NewMockNtpdate() MockNtpdate
func (*MockNtpdate) Ntpdate ¶
func (ms *MockNtpdate) Ntpdate(server string) error
type MockReboot ¶
func NewMockReboot ¶
func NewMockReboot() MockReboot
func (*MockReboot) Reboot ¶
func (ms *MockReboot) Reboot() error
type MockStatRetriever ¶
type MockStatRetriever struct {
// contains filtered or unexported fields
}
func NewMockStatRetriever ¶
func NewMockStatRetriever(dataSet int) MockStatRetriever
func (*MockStatRetriever) GetLoadData ¶
func (sr *MockStatRetriever) GetLoadData() (*LoadData, error)
type NetInfo ¶
func NewNetInfo ¶
func NewNetInfo() NetInfo
type NetInfoData ¶
type NetInfoData struct {
// contains filtered or unexported fields
}
func (*NetInfoData) GetMacAddress ¶
func (ni *NetInfoData) GetMacAddress() *string
func (*NetInfoData) GetNetInterfaces ¶
func (ni *NetInfoData) GetNetInterfaces() ([]net.Interface, error)
type Networking ¶
type Networking interface {
SetDHCP() error
SetStatic(address string, netmask string, gateway string) error
FormatStatic(address string, netmask string, gateway string) string
}
func NewNetworking ¶
func NewNetworking() Networking
type NetworkingData ¶
type NetworkingData struct {
File string
}
func (*NetworkingData) FormatStatic ¶
func (n *NetworkingData) FormatStatic(address string, netmask string, gateway string) string
func (*NetworkingData) SetDHCP ¶
func (n *NetworkingData) SetDHCP() error
type NtpdateData ¶
type NtpdateData struct {
// contains filtered or unexported fields
}
func (*NtpdateData) Ntpdate ¶
func (r *NtpdateData) Ntpdate(server string) error
type RebootData ¶
type RebootData struct {
// contains filtered or unexported fields
}
func (*RebootData) Reboot ¶
func (r *RebootData) Reboot() error
type StatRetriever ¶
func NewStatRetriever ¶
func NewStatRetriever() StatRetriever
type UptimeResult ¶
type UptimeResultFunc ¶
type UptimeResultFunc func() UptimeResult
func NewUptimeResultFunc ¶
func NewUptimeResultFunc() UptimeResultFunc
Click to show internal directories.
Click to hide internal directories.