agent

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatStdOut

func FormatStdOut(stdout []byte, userfulIndex int) []string

func GetDiskSpace

func GetDiskSpace() int64

GetDiskSpace uses df -k with the DataDir as parameter to return the amount of diskspace available for that folder

func GetNetworkInterfaceName

func GetNetworkInterfaceName() (string, error)

func GetPrivateIPs

func GetPrivateIPs() ([]net.IP, error)

GetPrivateIPs reads the information of the network interfaces to return the private IP addresses

func GetPublicIP

func GetPublicIP() (net.IP, error)

GetPublicIP uses an external site to retrieve the agent's public IP address

func GetSystemInfo

func GetSystemInfo() common.AgentSystemInfo

GetSystemInfo composes a copy of the common.AgentSystemInfo struct base on the current system information

func GetSystemMemory

func GetSystemMemory() (int64, int64)

GetSystemMemory reads from /proc/meminfo how much memory is available to the process

func RecordPackets

func RecordPackets(w io.WriteCloser, stop chan bool) error

func SetSystemTime

func SetSystemTime(newTime time.Time) error

SetSystemTime uses the system's date binary to set the current system time to the given newTime

Types

type Agent

type Agent struct {
	// contains filtered or unexported fields
}

Agent is the main class for the agent binary

func NewAgent

func NewAgent(
	version string,
	coordinatorHost string,
	coordinatorPort int,
) (*Agent, error)

NewAgent creates a new instance of the Agent class. Requires injection of the version number from the main binary, as well as the coordinator's host and port to connect to

func (*Agent) RunClient

func (a *Agent) RunClient()

RunClient is the main loop for an agent

func (*Agent) SyncTime

func (a *Agent) SyncTime()

SyncTime fetches the latest time from an NTP server and then tries to set the system's clock to it

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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