p2p

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: GPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusProtocolID   = "/eth2/beacon_chain/req/status/1/" + encoder.ProtocolSuffixSSZSnappy
	GoodbyeProtocolID  = "/eth2/beacon_chain/req/goodbye/1/" + encoder.ProtocolSuffixSSZSnappy
	PingProtocolID     = "/eth2/beacon_chain/req/ping/1/" + encoder.ProtocolSuffixSSZSnappy
	MetaDataProtocolID = "/eth2/beacon_chain/req/metadata/2/" + encoder.ProtocolSuffixSSZSnappy
)

Variables

View Source
var (
	MESSAGE_DOMAIN_INVALID_SNAPPY = [4]byte{0x00, 0x00, 0x00, 0x00}
	MESSAGE_DOMAIN_VALID_SNAPPY   = [4]byte{0x01, 0x00, 0x00, 0x00}
)

Functions

func ConvertFromInterfacePrivKey

func ConvertFromInterfacePrivKey(privkey crypto.PrivKey) (*ecdsa.PrivateKey, error)

func EncodeGossip

func EncodeGossip(topic string, msg fastssz.Marshaler) ([]byte, []byte, error)

func PublishTopic

func PublishTopic(ctx context.Context, topicHandle *pubsub.Topic, data []byte, opts ...pubsub.PubOpt) error

Types

type BeaconClientPeer

type BeaconClientPeer struct {
	BeaconClient ENR
}

func (*BeaconClientPeer) GetPeerAddrInfo

func (bcp *BeaconClientPeer) GetPeerAddrInfo(ctx context.Context) (*peer.AddrInfo, error)

type ENR

type ENR interface {
	ENR(ctx context.Context) (string, error)
}

type Goodbye

type Goodbye = primitives.SSZUint64

type PingData

type PingData = primitives.SSZUint64

type TestP2P

type TestP2P struct {
	InstanceID uint64

	// State objects
	ChainStatus *common.Status

	// Config
	ExternalIP             net.IP
	BeaconPortStart        int64
	MaxDevP2PSessionReuses int
	// contains filtered or unexported fields
}

func (*TestP2P) GetNextPeerIDs

func (t *TestP2P) GetNextPeerIDs(count uint64) []string

func (*TestP2P) GetTestPeer

func (t *TestP2P) GetTestPeer(ctx context.Context, count int) (TestPeers, error)

func (*TestP2P) NewTestPeer

func (t *TestP2P) NewTestPeer(ctx context.Context, port int64) (*TestPeer, error)

type TestPeer

type TestPeer struct {
	ID         TestPeerIndex
	Host       host.Host
	PubSub     *pubsub.PubSub
	PrivateKey crypto.PrivKey
	PublicKey  crypto.PubKey
	LocalNode  *enode.LocalNode

	MetaData *eth.MetaDataV1
	// contains filtered or unexported fields
}

func (*TestPeer) BroadcastSignedBeaconBlockDeneb

func (p *TestPeer) BroadcastSignedBeaconBlockDeneb(signedBeaconBlockDeneb *eth.SignedBeaconBlockDeneb) error

func (*TestPeer) BroadcastSignedBlobSidecar

func (p *TestPeer) BroadcastSignedBlobSidecar(signedBlobSidecar *eth.SignedBlobSidecar, subnet *uint64) error

func (*TestPeer) Close

func (p *TestPeer) Close() error

func (*TestPeer) Connect

func (p *TestPeer) Connect(ctx context.Context, peer *BeaconClientPeer) error

func (*TestPeer) Goodbye

func (p *TestPeer) Goodbye(ctx context.Context, peer peer.ID) error

func (*TestPeer) SendInitialStatus

func (p *TestPeer) SendInitialStatus(ctx context.Context, peer peer.ID) error

func (*TestPeer) SetupStreams

func (p *TestPeer) SetupStreams() error

func (*TestPeer) WaitForP2PConnection

func (p *TestPeer) WaitForP2PConnection(ctx context.Context) error

type TestPeerIndex

type TestPeerIndex uint64

func (TestPeerIndex) Keys

func (id TestPeerIndex) Keys(instanceID uint64) (crypto.PrivKey, crypto.PubKey)

func (TestPeerIndex) PeerID

func (id TestPeerIndex) PeerID(instanceID uint64) string

func (TestPeerIndex) String

func (id TestPeerIndex) String() string

type TestPeers

type TestPeers []*TestPeer

func (TestPeers) BroadcastSignedBeaconBlockDeneb

func (p TestPeers) BroadcastSignedBeaconBlockDeneb(signedBeaconBlockDeneb *eth.SignedBeaconBlockDeneb) error

func (TestPeers) BroadcastSignedBlobSidecar

func (p TestPeers) BroadcastSignedBlobSidecar(signedBlobSidecar *eth.SignedBlobSidecar, subnet *uint64) error

func (TestPeers) Close

func (pl TestPeers) Close() error

Jump to

Keyboard shortcuts

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