Documentation
¶
Overview ¶
Package p2pkey contains code adapted from the Chainlink core node with minor modifications. These changes allow us to avoid a direct dependency on the Chainlink core node.
Modifications include: - Retained only the functionality for marshaling and unmarshaling PeerID strings. - Updated error handling to use the standard library `errors` package. - Updates to pass linting and formatting checks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PeerID ¶
func MakePeerID ¶
MakePeerID creates a PeerID from a string. It returns an error if the string cannot be parsed as a PeerID.
func (*PeerID) MarshalText ¶
MarshalText marshals the PeerID into a byte slice. If the PeerID is zero, it returns nil.
func (PeerID) Raw ¶
Raw returns the raw string representation of the PeerID without the "p2p_" prefix.
func (PeerID) String ¶
PeerID returns the string representation of the PeerID. It is prefixed with "p2p_" to indicate that it is a PeerID. If the PeerID is zero, it returns an empty string.
func (*PeerID) UnmarshalString ¶
UnmarshalString unmarshals a string into a PeerID.
func (*PeerID) UnmarshalText ¶
UnmarshalText unmarshals a byte slice into a PeerID. It expects the byte slice to be a string representation of a PeerID. If the byte slice is empty, it returns nil. If the byte slice has the "p2p_" prefix, it removes it before unmarshaling. If the unmarshaling fails, it returns an error.