system

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFolderSize added in v1.1.5

func GetFolderSize(path string) (uint64, error)

GetFolderSize returns the size of the specified folder in bytes.

Types

type Address added in v1.1.4

type Address struct {
	Out []string
	In  []string
	All []string
}

Address holds the outgoing, incoming, and both (all) addresses.

type CPUInfo

type CPUInfo struct {
	NumCores int
	Usage    float64
}

CPUInfo contains information about the server's processor.

func GetCPUInfo

func GetCPUInfo() CPUInfo

GetCPUInfo returns information about the server's processor, including the number of cores and the current CPU usage.

type DiskInfo

type DiskInfo struct {
	Total     uint64
	Used      uint64
	Available uint64
}

DiskInfo is a structure that contains information about the server's disk space. It includes the total, used and available space on the system. This structure is used by the GetDiskInfo function, which is called in the GetInfoServer function function to collect information about the server's disk.

func GetDiskInfo

func GetDiskInfo(path string) DiskInfo

GetDiskInfo returns information about the disk space on the specified path. This function is called inside the GetInfoServer function to get information about the server's disk. It uses syscall.Statfs to access file system statistics and calculate space values.

type DistroInfo

type DistroInfo struct {
	PrettyName      string
	Name            string
	VersionID       string
	Version         string
	VersionCodeName string
	ID              string
	HomeURL         string
	SupportURL      string
	BugReportURL    string
}

DistroInfo contains information about the operating system distribution.

func GetDistroInfo

func GetDistroInfo() (DistroInfo, error)

GetDistroInfo retrieves information about the operating system distribution.

type FileInfo added in v1.1.5

type FileInfo struct {
	FileName          string
	FileSize          int64
	FileLastChange    time.Time
	FileUserPermisson os.FileMode
	FileExtension     string
	FileData          string
	FileDataBuffer    bytes.Buffer
	FileDir           string
}

type HardwareInfo

type HardwareInfo struct {
	KernelVersion string
	ProcessorName string
	Uptime        int
	SwapTotal     int
	SwapFree      int
}

HardwareInfo is a structure that contains information about the server's hardware, such as kernel version, processor name, uptime and swap information. This information can be collected by the GetHardwareInfo function and is part of the information returned by GetInfoServer.

func GetHardwareInfo

func GetHardwareInfo() HardwareInfo

GetHardwareInfo is a function that retrieves information about the system's hardware. It uses operating system commands to extract data about the kernel version, the processor name, the server uptime and the swap area (total and free). This data is then returned in the HardwareInfo structure. The function is called within GetInfoServer to collect information about the server's hardware.

type NetworkInfo

type NetworkInfo struct {
	IPv4      []string
	IPv6      []string
	IPv4Ports PortType
	IPv6Ports PortType
	Download  int64
	Upload    int64
}

NetworkInfo holds the network information.

func GetNetworkInfo

func GetNetworkInfo() NetworkInfo

GetNetworkInfo retrieves the network information.

type PortType added in v1.1.4

type PortType struct {
	TCP Address
	UDP Address
}

PortType holds the TCP and UDP addresses.

type RAMInfo

type RAMInfo struct {
	Total     uint64
	Used      uint64
	Available uint64
}

RAMInfo is a structure that contains information about the system's RAM memory. It is used to store data about the total, usage and availability of RAM memory. This information can be collected by the GetRAMInfo function and is part of the information returned by GetInfoServer.

func GetRAMInfo

func GetRAMInfo() RAMInfo

GetRAMInfo is a function that retrieves information about the system's RAM memory. It reads the `/proc/meminfo` file to obtain data on total and available memory, and calculates the memory used. The function returns this data in the RAMInfo structure. It is called inside GetInfoServer to collect information about the server's RAM.

type ServerInfo

type ServerInfo struct {
	Distribution DistroInfo
	RAM          RAMInfo
	Disk         DiskInfo
	CPU          CPUInfo
	Network      NetworkInfo
	Hardware     HardwareInfo
}

ServerInfo is a structure that groups together various pieces of information about the server. This structure is used to return all the data collected about the server in a single response. It contains substructures that store specific information about the system, such as distribution, memory, disk, CPU, network and hardware. This information is collected by the GetInfoServer function.

Jump to

Keyboard shortcuts

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