local

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 14 Imported by: 1

Documentation

Overview

Package local provides a local, non-networked implementation of the interfaces defined by the net package. It should largely be considered a sample implementation, and is not meant to be used at scale in any way.

Index

Constants

View Source
const RetransmissionTick = 50 * time.Millisecond

RetransmissionTick determines the frequency of the retransmissions done by the local broadcast channel implementation.

Variables

View Source
var DefaultCurve elliptic.Curve = btcec.S256()

DefaultCurve is the default elliptic curve implementation used in the net/local package. Local network uses the secp256k1 curve and the specific implementation is provided by the btcec package.

Functions

This section is empty.

Types

type Provider

type Provider interface {
	net.Provider

	// AddPeer allows the simulation of adding a peer to the client's local
	// registry of peers.
	AddPeer(peerID string, publicKey *operator.PublicKey)
}

Provider is an extension of net.Provider. This interface exposes additional functions useful for testing.

func Connect

func Connect() Provider

Connect returns a local instance of a net provider that does not go over the network.

func ConnectWithKey

func ConnectWithKey(operatorPublicKey *operator.PublicKey) Provider

ConnectWithKey returns a local instance of net provider that does not go over the network. The returned instance uses the provided network key to identify network messages.

Jump to

Keyboard shortcuts

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