suite

package
v0.31.16-num-compactors Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateRPCInspector

type AggregateRPCInspector struct {
	// contains filtered or unexported fields
}

AggregateRPCInspector gossip sub RPC inspector that combines multiple RPC inspectors into a single inspector. Each individual inspector will be invoked synchronously.

func NewAggregateRPCInspector

func NewAggregateRPCInspector(inspectors ...p2p.GossipSubRPCInspector) *AggregateRPCInspector

NewAggregateRPCInspector returns new aggregate RPC inspector.

func (*AggregateRPCInspector) Inspect

func (a *AggregateRPCInspector) Inspect(peerID peer.ID, rpc *pubsub.RPC) error

Inspect func with the p2p.GossipSubAppSpecificRpcInspector func signature that will invoke all the configured inspectors.

func (*AggregateRPCInspector) Inspectors

type GossipSubInspectorSuite

type GossipSubInspectorSuite struct {
	component.Component
	// contains filtered or unexported fields
}

GossipSubInspectorSuite encapsulates what is exposed to the libp2p node regarding the gossipsub RPC inspectors as well as their notification distributors.

func NewGossipSubInspectorSuite

func NewGossipSubInspectorSuite(inspectors []p2p.GossipSubRPCInspector, ctrlMsgInspectDistributor p2p.GossipSubInspectorNotifDistributor) *GossipSubInspectorSuite

NewGossipSubInspectorSuite creates a new GossipSubInspectorSuite. The suite is composed of the aggregated inspector, which is used to inspect the gossipsub rpc messages, and the control message notification distributor, which is used to notify consumers when a misbehaving peer regarding gossipsub control messages is detected. The suite is also a component, which is used to start and stop the rpc inspectors. Args:

  • inspectors: the rpc inspectors that are used to inspect the gossipsub rpc messages.
  • ctrlMsgInspectDistributor: the notification distributor that is used to notify consumers when a misbehaving peer

regarding gossipsub control messages is detected. Returns:

  • the new GossipSubInspectorSuite.

func (*GossipSubInspectorSuite) AddInvCtrlMsgNotifConsumer

func (s *GossipSubInspectorSuite) AddInvCtrlMsgNotifConsumer(c p2p.GossipSubInvCtrlMsgNotifConsumer)

AddInvalidCtrlMsgNotificationConsumer adds a consumer to the invalid control message notification distributor. This consumer is notified when a misbehaving peer regarding gossipsub control messages is detected. This follows a pub/sub pattern where the consumer is notified when a new notification is published. A consumer is only notified once for each notification, and only receives notifications that were published after it was added.

func (*GossipSubInspectorSuite) InspectFunc

func (s *GossipSubInspectorSuite) InspectFunc() func(peer.ID, *pubsub.RPC) error

InspectFunc returns the inspect function that is used to inspect the gossipsub rpc messages. This function follows a dependency injection pattern, where the inspect function is injected into the gossipsu, and is called whenever a gossipsub rpc message is received.

func (*GossipSubInspectorSuite) Inspectors

Inspectors returns all inspectors in the inspector suite.

Jump to

Keyboard shortcuts

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