utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SSPrefix                = []byte{0x53, 0x53, 0x35, 0x38, 0x50, 0x52, 0x45}
	SubstratePrefix         = []byte{0x2a}
	ChainKumandraTestPrefix = []byte{0x50, 0xac}
)

Functions

func CalcFileHash

func CalcFileHash(fpath string) (string, error)

Calculate the file hash value

func CreatDirIfNotExist

func CreatDirIfNotExist(dir string) error

Create a directory

func DecodeToKumandraPub

func DecodeToKumandraPub(address string) ([]byte, error)

func DecodeToPub

func DecodeToPub(address string, prefix []byte) ([]byte, error)

func DirSize

func DirSize(path string) (uint64, error)

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

func EncodeToKumandraAddr

func EncodeToKumandraAddr(publicKeyHash []byte) (string, error)

func EncodeToSS58

func EncodeToSS58(publicKeyHash []byte) (string, error)

func GetRandomcode

func GetRandomcode(length uint8) string

Generate random password

func IsIPv4

func IsIPv4(ipAddr string) bool

func PubBytesToString

func PubBytesToString(b []byte) string

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 VerityAddress

func VerityAddress(address string, prefix []byte) error

func WriteStringtoFile

func WriteStringtoFile(content, fileName string) error

Write string content to file

Types

type MountPathInfo

type MountPathInfo struct {
	Path  string
	Total uint64
	Free  uint64
}

func GetMountPathInfo

func GetMountPathInfo(mountpath string) (MountPathInfo, error)

Jump to

Keyboard shortcuts

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