utils

package
v8.6.8 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteCountDecimal

func ByteCountDecimal(b int64) string

ByteCountDecimal converts bytes to human readable byte string

func ChunkRangesToChunks

func ChunkRangesToChunks(chunkRanges []int64) (chunks []int64)

ChunkRangesToChunks converts chunk ranges to list

func Exists

func Exists(name string) bool

Exists reports whether the named file or directory exists.

func FindOpenPorts

func FindOpenPorts(host string, portNumStart, numPorts int) (openPorts []int)

func GetInput

func GetInput(prompt string) string

GetInput returns the input with a given prompt

func GetLocalIPs

func GetLocalIPs() (ips []string, err error)

GetLocalIPs returns all local ips

func GetRandomName

func GetRandomName() string

GetRandomName returns mnemoicoded random name

func HashFile

func HashFile(fname string) (hash256 []byte, err error)

HashFile returns the hash of a file

func IMOHashFile

func IMOHashFile(fname string) (hash []byte, err error)

IMOHashFile returns imohash

func IsLocalIP

func IsLocalIP(ipaddress string) bool

func LocalIP

func LocalIP() string

LocalIP returns local ip address

func MD5HashFile

func MD5HashFile(fname string) (hash256 []byte, err error)

MD5HashFile returns MD5 hash

func MissingChunks

func MissingChunks(fname string, fsize int64, chunkSize int) (chunkRanges []int64)

MissingChunks returns the positions of missing chunks. If file doesn't exist, it returns an empty chunk list (all chunks). If the file size is not the same as requested, it returns an empty chunk list (all chunks).

func PublicIP

func PublicIP() (ip string, err error)

PublicIP returns public ip address

func RandomFileName

func RandomFileName() (fname string, err error)

func SHA256

func SHA256(s string) string

SHA256 returns sha256 sum

func XXHashFile

func XXHashFile(fname string) (hash256 []byte, err error)

XXHashFile returns the xxhash of a file

Types

This section is empty.

Jump to

Keyboard shortcuts

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