utils

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: Apache-2.0 Imports: 10 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToInt

func BytesToInt(b []byte) int

BytesToInt . @Description: parse 8 bytes to an int value. @param b @return int

func BytesToUint32

func BytesToUint32(b []byte) uint32

BytesToUint32 . @Description: parse 4 bytes to uint32. @param b @return uint32

func BytesToUint64

func BytesToUint64(b []byte) uint64

BytesToUint64 . @Description: parse 8 bytes to uint64. @param b @return uint64

func ChainMemberStatusValidateWithCertMode

func ChainMemberStatusValidateWithCertMode(
	chainId string,
	memberStatusValidator *common.MemberStatusValidator,
	certBytes []byte) (passed bool, err error)

ChainMemberStatusValidateWithCertMode . @Description: check the member status in the cert mode with the chain @param chainId @param memberStatusValidator @param certBytes @return passed @return err

func ChainMemberStatusValidateWithPubKeyMode

func ChainMemberStatusValidateWithPubKeyMode(
	chainId string,
	memberStatusValidator *common.MemberStatusValidator,
	pubKeyBytes []byte) (passed bool, err error)

ChainMemberStatusValidateWithPubKeyMode . @Description: check the member status in the public key mode with the chain @param chainId @param memberStatusValidator @param pubKeyBytes @return passed @return err

func CreateProtocolWithChainIdAndFlag

func CreateProtocolWithChainIdAndFlag(chainId, flag string) string

CreateProtocolWithChainIdAndFlag . @Description: will create a protocol string with a chain id string and a message flag string. @param chainId @param flag @return string

func CurrentTimeMillisSeconds

func CurrentTimeMillisSeconds() int64

CurrentTimeMillisSeconds . @Description: return current unix timestamp in milliseconds @return int64

func CurrentTimeSeconds

func CurrentTimeSeconds() int64

CurrentTimeSeconds . @Description: return current unix timestamp in seconds @return int64

func FibonacciArray

func FibonacciArray(n int) []int64

FibonacciArray . @Description: create a fibonacci array with length n. @param n @return []int64

func GZipCompressBytes

func GZipCompressBytes(data []byte) ([]byte, error)

GZipCompressBytes . @Description: compress bytes with GZip(BestSpeed mode). @param data @return []byte @return error

func GZipDeCompressBytes

func GZipDeCompressBytes(data []byte) ([]byte, error)

GZipDeCompressBytes . @Description: decompress bytes with GZip. @param data @return []byte @return error

func GetChainIdAndFlagWithProtocol

func GetChainIdAndFlagWithProtocol(p string) (chainId, flag string)

GetChainIdAndFlagWithProtocol . @Description: will load the chain id string and the message flag string from a protocol string. @param p @return chainId @return flag

func IntToBytes

func IntToBytes(n int) []byte

IntToBytes . @Description: parse an int value to 8 bytes. @param n @return []byte

func MemberStatusValidateWithCertMode

func MemberStatusValidateWithCertMode(
	memberStatusValidator *common.MemberStatusValidator,
	certBytes []byte) (chainIds []string, passed bool, err error)

MemberStatusValidateWithCertMode . @Description: check the member status in the cert mode @param memberStatusValidator @param certBytes @return chainIds @return passed @return err

func MemberStatusValidateWithPubKeyMode

func MemberStatusValidateWithPubKeyMode(
	memberStatusValidator *common.MemberStatusValidator,
	pubKeyBytes []byte) (chainIds []string, passed bool, err error)

MemberStatusValidateWithPubKeyMode . @Description: check the member status in the public key mode @param memberStatusValidator @param pubKeyBytes @return chainIds @return passed @return err

func ParseAddrInfo

func ParseAddrInfo(addrs []string) ([]peer.AddrInfo, error)

ParseAddrInfo . @Description: parse multi addr string to peer.AddrInfo . @param addrs @return []peer.AddrInfo @return error

func ParseMultiAddrs

func ParseMultiAddrs(addrs []string) ([]multiaddr.Multiaddr, error)

ParseMultiAddrs . @Description: parse multi addr string to multiaddr.Multiaddr . @param addrs @return []multiaddr.Multiaddr @return error

func Uint32ToBytes

func Uint32ToBytes(n uint32) []byte

Uint32ToBytes . @Description: parse uint32 to 4 bytes. @param n @return []byte

func Uint64ToBytes

func Uint64ToBytes(n uint64) []byte

Uint64ToBytes . @Description: parse uint64 to 8 bytes. @param n @return []byte

Types

This section is empty.

Jump to

Keyboard shortcuts

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