p2pkey

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: MIT Imports: 3 Imported by: 0

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.

https://github.com/smartcontractkit/chainlink/blob/develop/core/services/keystore/keys/p2pkey/peer_id.go

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

type PeerID types.PeerID

func MakePeerID

func MakePeerID(s string) (PeerID, error)

MakePeerID creates a PeerID from a string. It returns an error if the string cannot be parsed as a PeerID.

func (*PeerID) MarshalText

func (p *PeerID) MarshalText() ([]byte, error)

MarshalText marshals the PeerID into a byte slice. If the PeerID is zero, it returns nil.

func (PeerID) Raw

func (p PeerID) Raw() string

Raw returns the raw string representation of the PeerID without the "p2p_" prefix.

func (PeerID) String

func (p PeerID) String() 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

func (p *PeerID) UnmarshalString(s string) error

UnmarshalString unmarshals a string into a PeerID.

func (*PeerID) UnmarshalText

func (p *PeerID) UnmarshalText(bs []byte) error

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.

Jump to

Keyboard shortcuts

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