Documentation ¶
Index ¶
- func DecodeHexString(input string) ([]byte, error)
- func EcdsaPrivKeyToSecp256k1PrivKey(privKey *ecdsa.PrivateKey) *crypto.Secp256k1PrivateKey
- func EcdsaPubKeyToSecp256k1PublicKey(pubKey *ecdsa.PublicKey) *crypto.Secp256k1PublicKey
- func EncapsulatePeerID(peerID peer.ID, addrs ...multiaddr.Multiaddr) []multiaddr.Multiaddr
- func GetPeerID(m multiaddr.Multiaddr) (peer.ID, error)
- func GetUnixEpoch(timesource ...Timesource) *int64
- func GetUnixEpochFrom(now time.Time) *int64
- func InitLogger(encoding string, output string)
- func IsIPv4(str string) bool
- func IsIPv6(str string) bool
- func Logger() *zap.Logger
- func MessagesLogger(prefix string) *zap.Logger
- func MultiAddrSet(addr ...multiaddr.Multiaddr) map[multiaddr.Multiaddr]struct{}
- type Timesource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeHexString ¶
DecodeHexString decodes input string into a hex string. Note that if the string is prefixed by 0x , it is trimmed
func EcdsaPrivKeyToSecp256k1PrivKey ¶
func EcdsaPrivKeyToSecp256k1PrivKey(privKey *ecdsa.PrivateKey) *crypto.Secp256k1PrivateKey
EcdsaPrivKeyToSecp256k1PrivKey converts an `ecdsa.PrivateKey` into a libp2p `crypto.Secp256k1PrivateKey“
func EcdsaPubKeyToSecp256k1PublicKey ¶
func EcdsaPubKeyToSecp256k1PublicKey(pubKey *ecdsa.PublicKey) *crypto.Secp256k1PublicKey
EcdsaPubKeyToSecp256k1PublicKey converts an `ecdsa.PublicKey` into a libp2p `crypto.Secp256k1PublicKey“
func EncapsulatePeerID ¶ added in v0.8.0
EncapsulatePeerID takes a peer.ID and adds a p2p component to all multiaddresses it receives
func GetUnixEpoch ¶
func GetUnixEpoch(timesource ...Timesource) *int64
GetUnixEpoch returns the current time in unix timestamp with the integer part representing seconds and the decimal part representing subseconds. Optionally receives a timesource to obtain the time from
func GetUnixEpochFrom ¶
GetUnixEpochFrom converts a time into a unix timestamp with nanoseconds
func InitLogger ¶
InitLogger initializes a global logger using an specific encoding
func MessagesLogger ¶ added in v0.9.0
MessagesLogger returns a logger used for debug logging of receivent/sent messages
func MultiAddrSet ¶ added in v0.9.0
func MultiAddrSet(addr ...multiaddr.Multiaddr) map[multiaddr.Multiaddr]struct{}