package
0.0.0-20220616152218-3da4c06c590a
Repository: https://github.com/astra-net/astra-network.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# Functions

AddLogFile creates a StreamHandler that outputs JSON logs into rotating files with specified max file size and storing at max rotateCount files.
AddLogHandler add a log handler.
AnalysisEnd ..
AnalysisStart ..
AppendIfMissing appends an item if it's missing in the slice, returns appended slice and true Otherwise, return the original slice and false.
AskForPassphrase return passphrase using password input.
CountOneBits counts the number of 1 bit in byte array.
FatalErrMsg prints the given error wrapped with the given message in the extended format (%+v) onto stderr, then exits with status 1.
FatalError prints the given error in the extended format (%+v) onto stderr, then exits with status 1.
FromHex returns the bytes represented by the hexadecimal string s.
GenKeyP2P generates a pair of RSA keys used in libp2p host.
GenKeyP2PRand generates a pair of RSA keys used in libp2p host, using random seed.
GetAddressFromBLSPubKeyBytes return the address object from bls pub key.
GetCallStackInfo return a string containing the file name, function name and the line number of a specified entry on the call stack.
GetLogger is a shorthand for WithCaller(GetLogInstance()).
GetLogInstance returns logging singleton.
GetPassphraseFromSource reads a passphrase such as a key-encrypting one non-interactively from the given source.
GetPendingCXKey creates pending CXReceiptsProof key given shardID and blockNum it is to avoid adding duplicated CXReceiptsProof from the same source shard.
GetUniqueIDFromIPPort --.
Hex2Bytes returns the bytes represented by the hexadecimal string str.
IsPrivateIP checks if an IP address is private or not.
Load loads the file at path into v.
LoadKeyFromFile load private key from keyfile If the private key is not loadable or no file, it will generate a new random private key.
LoadPrivateKey parses the key string in base64 format and return PrivKey.
Logger returns a zerolog.Logger singleton.
Marshal is a function that marshals the object into an io.Reader.
NewTimeout creates a new timeout class.
PrintError prints the given error in the extended format (%+v) onto stderr.
SampledLogger returns a sampled zerolog singleton to be used in criticial path like p2p message handling.
Save saves a representation of v to the file at path.
SaveKeyToFile save private key to keyfile.
SavePrivateKey convert the PrivKey to base64 format and return string.
SetLogContext used to print out loggings of node with port and ip.
SetLogVerbosity specifies the verbosity of global logger.
Unmarshal is a function that unmarshals the data from the reader into the specified value.
WithCaller logs the caller info in three context items "funcFile", "funcLine", and "funcName".
WithCallerSkip logs the caller info in three context items "funcFile", "funcLine", and "funcName".

# Constants

Enum for different TimeoutState.
Enum for different TimeoutState.
Enum for different TimeoutState.

# Structs

PrivKeyStore is used to persist private key to/from file.
Timeout is the implementation of timeout.

# Type aliases

TimeoutState indicates the state of Timeout class.