utils

package
v0.0.0-...-6d48a2c Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2022 License: Apache-2.0 Imports: 10 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToInt

func BytesToInt(b []byte) int

BytesToInt parse 8 bytes to an int value.

func BytesToUint32

func BytesToUint32(b []byte) uint32

BytesToUint32 parse 4 bytes to uint32.

func BytesToUint64

func BytesToUint64(b []byte) uint64

BytesToUint64 parse 8 bytes to uint64.

func ChainMemberStatusValidateWithCertMode

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

func ChainMemberStatusValidateWithPubKeyMode

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

func CreateProtocolWithChainIdAndFlag

func CreateProtocolWithChainIdAndFlag(chainId, flag string) string

CreateProtocolWithChainIdAndFlag will create a protocol string with a chain id string and a message flag string.

func CurrentTimeMillisSeconds

func CurrentTimeMillisSeconds() int64

CurrentTimeMillisSeconds return current unix timestamp in milliseconds

func CurrentTimeSeconds

func CurrentTimeSeconds() int64

CurrentTimeSeconds return current unix timestamp in seconds

func FibonacciArray

func FibonacciArray(n int) []int64

FibonacciArray create a fibonacci array with length n.

func GZipCompressBytes

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

GZipCompressBytes compress bytes with GZip(BestSpeed mode).

func GZipDeCompressBytes

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

GZipDeCompressBytes decompress bytes with GZip.

func GetChainIdAndFlagWithProtocol

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

GetChainIdAndFlagWithProtocol will load the chain id string and the message flag string from a protocol string.

func IntToBytes

func IntToBytes(n int) []byte

IntToBytes parse an int value to 8 bytes.

func MemberStatusValidateWithCertMode

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

func MemberStatusValidateWithPubKeyMode

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

func ParseAddrInfo

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

ParseAddrInfo parse multi addr string to peer.AddrInfo .

func ParseMultiAddrs

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

ParseMultiAddrs parse multi addr string to multiaddr.Multiaddr .

func Uint32ToBytes

func Uint32ToBytes(n uint32) []byte

Uint32ToBytes parse uint32 to 4 bytes.

func Uint64ToBytes

func Uint64ToBytes(n uint64) []byte

Uint64ToBytes parse uint64 to 8 bytes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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