node

package
v0.0.0-...-cf96749 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKeyPair

func GenerateKeyPair() (*ecdsa.PrivateKey, *ecdsa.PublicKey, error)

GenerateKeyPair generates a new key pair

Types

type PiNode

type PiNode struct {
	host.Host
	// contains filtered or unexported fields
}

PiNode represents a node in the Pi network

func NewPiNode

func NewPiNode(ctx context.Context, privateKey *ecdsa.PrivateKey) (*PiNode, error)

NewPiNode creates a new PiNode instance

func UnmarshalJSON

func UnmarshalJSON(data []byte) (*PiNode, error)

UnmarshalJSON unmarshals a JSON byte slice to a PiNode

func (*PiNode) MarshalJSON

func (n *PiNode) MarshalJSON() ([]byte, error)

MarshalJSON marshals the PiNode to JSON

func (*PiNode) Send

func (n *PiNode) Send(ctx context.Context, to peer.ID, message []byte) error

Send sends a message to another node

func (*PiNode) Start

func (n *PiNode) Start(ctx context.Context) error

Start starts the PiNode

Jump to

Keyboard shortcuts

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