Documentation
      ¶
    
    
  
    
  
    Index ¶
- Variables
 - func BytesToBloomFilter(val []byte) (pattern.BloomFilter, error)
 - func BytesToFileHash(val []byte) (pattern.FileHash, error)
 - func BytesToPoISKeyInfo(g, n []byte) (pattern.PoISKeyInfo, error)
 - func BytesToWorkPublickey(val []byte) (pattern.WorkerPublicKey, error)
 - func CalcFileSHA256(f *os.File) (string, error)
 - func CalcFileSHA256Bytes(f *os.File) ([]byte, error)
 - func CalcMD5(data string) ([]byte, error)
 - func CalcPathSHA256(fpath string) (string, error)
 - func CalcPathSHA256Bytes(fpath string) ([]byte, error)
 - func CalcSHA256(data []byte) (string, error)
 - func CheckBucketName(name string) bool
 - func CheckDomain(name string) error
 - func CompareSlice(s1, s2 []byte) bool
 - func DateTimeToUnix(t string) (int64, error)
 - func EncodePublicKeyAsCessAccount(publicKey []byte) (string, error)
 - func EncodePublicKeyAsSubstrateAccount(publicKey []byte) (string, error)
 - func FildIpv4(data []byte) (string, bool)
 - func GetDirFreeSpace(dir string) (uint64, error)
 - func GetRandomcode(length uint8) string
 - func GetSysMemAvailable() (uint64, error)
 - func GetUnixTimeAtZeroToday() int64
 - func IsIPv4(ipAddr string) bool
 - func IsIPv6(ipAddr string) bool
 - func IsInterfaceNIL(i interface{}) bool
 - func IsIntranetIpv4(ipv4 string) (bool, error)
 - func IsPortInUse(port int) bool
 - func IsWorkerPublicKeyAllZero(puk pattern.WorkerPublicKey) bool
 - func NumsToByteStr[T constraints.Unsigned](nums []T, opts map[string]bool) (string, error)
 - func NumsToByteStrDefault[T constraints.Unsigned](nums []T) (string, error)
 - func ParsingPublickey(address string) ([]byte, error)
 - func RandSlice(slice interface{})
 - func RandStr(n int) string
 - func RecoverError(err interface{}) error
 - func VerityAddress(address string, prefix []byte) error
 - func WriteBufToFile(buf []byte, file string) error
 
Constants ¶
This section is empty.
Variables ¶
var ( SSPrefix = []byte{0x53, 0x53, 0x35, 0x38, 0x50, 0x52, 0x45} SubstratePrefix = []byte{0x2a} CessPrefix = []byte{0x50, 0xac} )
Functions ¶
func BytesToBloomFilter ¶ added in v0.4.32
func BytesToBloomFilter(val []byte) (pattern.BloomFilter, error)
func BytesToPoISKeyInfo ¶ added in v0.4.32
func BytesToPoISKeyInfo(g, n []byte) (pattern.PoISKeyInfo, error)
func BytesToWorkPublickey ¶ added in v0.4.32
func BytesToWorkPublickey(val []byte) (pattern.WorkerPublicKey, error)
func CalcFileSHA256 ¶
CalcFileSHA256 is used to calculate the sha256 value of the file type.
func CalcFileSHA256Bytes ¶
CalcFileSHA256 is used to calculate the sha256 value of the file type.
func CalcPathSHA256 ¶
CalcPathSHA256 is used to calculate the sha256 value of a file with a given path.
func CalcPathSHA256Bytes ¶
CalcPathSHA256 is used to calculate the sha256 value of a file with a given path.
func CalcSHA256 ¶
CalcSHA256 is used to calculate the sha256 value of the data.
func CheckBucketName ¶
func CheckDomain ¶
CheckDomain returns an error if the domain name is not valid. See https://tools.ietf.org/html/rfc1034#section-3.5 and https://tools.ietf.org/html/rfc1123#section-2.
func CompareSlice ¶
func DateTimeToUnix ¶ added in v0.4.28
func GetDirFreeSpace ¶
func GetSysMemAvailable ¶
func GetUnixTimeAtZeroToday ¶ added in v0.4.28
func GetUnixTimeAtZeroToday() int64
func IsInterfaceNIL ¶ added in v0.4.32
func IsInterfaceNIL(i interface{}) bool
    func IsIntranetIpv4 ¶ added in v0.4.32
func IsPortInUse ¶ added in v0.4.32
func IsWorkerPublicKeyAllZero ¶ added in v0.4.32
func IsWorkerPublicKeyAllZero(puk pattern.WorkerPublicKey) bool
func NumsToByteStr ¶
NumsToByteStr utility function takes an array of unsigned integers and output the corresponding byte string representing it. For example: `[18, 15]` to `120F`.
For `opts` in second parameter it is a map expecting:
- `space` bool: whether to add a space between each byte, default to `false`
 - `prefix` bool: whether to add `0x` as the prefix, default to `false`
 - `uppercase` bool: whether to display hexadecimal in upper case, default to `true`
 
If there is an integer larger than 255 in the array, an error is returned.
func NumsToByteStrDefault ¶
func NumsToByteStrDefault[T constraints.Unsigned](nums []T) (string, error)
func ParsingPublickey ¶
func RecoverError ¶
func RecoverError(err interface{}) error
    RecoverError is used to record the stack information of panic
func VerityAddress ¶
func WriteBufToFile ¶
Types ¶
This section is empty.