utils

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateNetworkRates

func CalculateNetworkRates(initialStats map[string][2]int64, interfaceName string) (downloadRate, uploadRate int64, err error)

CalculateNetworkRates calculates the download and upload rates for the active network interface.

func Cexec

func Cexec(command string) (string, error)

Cexec executes a command in the default shell and captures the standard output (stdout) and errors (stderr). It identifies the shell being used by checking the SHELL environment variable.

func GetActiveInterface

func GetActiveInterface(stats map[string][2]int64) (string, error)

GetActiveInterface returns the name of the active network interface.

func GetNetworkStats

func GetNetworkStats() (map[string][2]int64, error)

GetNetworkStats reads the network statistics from /proc/net/dev and returns a map of interface names to their received and transmitted bytes.

func PassInts

func PassInts(values ...string) ([]int, error)

PassInts converts a list of strings into integers. This function was created to be used by other functions that need to convert strings into integers. It receives one or more string values, converts them to integers and returns a slice of integers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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