utils

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalTransport = &http.Transport{
	DisableKeepAlives: true,
}

Functions

func ContainsIpv4

func ContainsIpv4(str string) bool

func CopyFile

func CopyFile(dst, src string) error

func DirFiles

func DirFiles(path string, count uint32) ([]string, error)

Get the total size of all files in a directory and subdirectories

func DirSize

func DirSize(path string) (uint64, error)

Get the total size of all files in a directory and subdirectories

func Dirs

func Dirs(path string) ([]string, error)

Get the total size of all files in a directory and subdirectories

func FreeLocalPort added in v0.8.1

func FreeLocalPort(port uint16) bool

func GetDirFreeSpace

func GetDirFreeSpace(dir string) (uint64, error)

func GetSysMemAvailable

func GetSysMemAvailable() (uint64, error)

func GetSysMemTotle

func GetSysMemTotle() (uint64, error)

func QueryPeers

func QueryPeers(url string) ([]byte, error)

func RandSlice

func RandSlice(slice interface{})

func RandomInRange

func RandomInRange(min, max int) int

Get a random integer in a specified range

func RecoverError

func RecoverError(err interface{}) string

func RemoveRepeatedAddr

func RemoveRepeatedAddr(arr []multiaddr.Multiaddr) (newArr []multiaddr.Multiaddr)

func Ternary

func Ternary(a, b int64) int64

Types

type MountPathInfo

type MountPathInfo struct {
	Path  string
	Total uint64
	Free  uint64
}

Jump to

Keyboard shortcuts

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