Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // MetricsAllConnectedPeers counts all connected peers MetricsAllConnectedPeers = promauto.NewGauge(prometheus.GaugeOpts{ Name: "ssv:network:all_connected_peers", Help: "Count connected peers", }) // MetricsConnectedPeers counts connected peers for a topic MetricsConnectedPeers = promauto.NewGaugeVec(prometheus.GaugeOpts{ Name: "ssv:network:connected_peers", Help: "Count connected peers for a validator", }, []string{"pubKey"}) // MetricsPeersIdentity tracks peers identity MetricsPeersIdentity = promauto.NewGaugeVec(prometheus.GaugeOpts{ Name: "ssv:network:peers_identity", Help: "Peers identity", }, []string{"pubKey", "v", "pid", "type"}) )
Functions ¶
Types ¶
type Config ¶
type Config struct { // prod enr Bootnodes string `` /* 373-byte string literal not displayed */ TCPPort int `yaml:"TcpPort" env:"TCP_PORT" env-default:"13001" env-description:"TCP port for p2p transport"` UDPPort int `yaml:"UdpPort" env:"UDP_PORT" env-default:"12001" env-description:"UDP port for discovery"` HostAddress string `yaml:"HostAddress" env:"HOST_ADDRESS" env-description:"External ip node is exposed for discovery"` HostDNS string `yaml:"HostDNS" env:"HOST_DNS" env-description:"External DNS node is exposed for discovery"` RequestTimeout time.Duration `yaml:"RequestTimeout" env:"P2P_REQUEST_TIMEOUT" env-default:"7s"` MaxBatchResponse uint64 `` /* 133-byte string literal not displayed */ MaxPeers int `yaml:"MaxPeers" env:"P2P_MAX_PEERS" env-default:"60" env-description:"Connected peers limit for connections"` TopicMaxPeers int `yaml:"TopicMaxPeers" env:"P2P_TOPIC_MAX_PEERS" env-default:"5" env-description:"Connected peers limit per pubsub topic"` // Subnets is a static bit list of subnets that this node will register upon start. Subnets string `yaml:"Subnets" env:"SUBNETS" env-description:"Hex string that represents the subnets that this node will join upon start"` // PubSubScoring is a flag to turn on/off pubsub scoring PubSubScoring bool `yaml:"PubSubScoring" env:"PUBSUB_SCORING" env-description:"Flag to turn on/off pubsub scoring"` // P2pLog is a flag to turn on/off network logs P2pLog bool `yaml:"P2pLog" env:"P2P_LOG" env-description:"Flag to turn on/off network debug logs"` // PubSubTrace is a flag to turn on/off pubsub tracing in logs PubSubTrace bool `yaml:"PubSubTrace" env:"PUBSUB_TRACE" env-description:"Flag to turn on/off pubsub tracing in logs"` // DiscoveryTrace is a flag to turn on/off discovery tracing in logs DiscoveryTrace bool `yaml:"DiscoveryTrace" env:"DISCOVERY_TRACE" env-description:"Flag to turn on/off discovery tracing in logs"` // NetworkID is the network of this node NetworkID string `yaml:"NetworkID" env:"NETWORK_ID" env-description:"Network ID is the network of this node"` // NetworkPrivateKey is used for network identity, MUST be injected NetworkPrivateKey *ecdsa.PrivateKey // OperatorPublicKey is used for operator identity, optional OperatorID string // Router propagate incoming network messages to the responsive components Router network.MessageRouter // UserAgent to use by libp2p identify protocol UserAgent string // ForkVersion to use ForkVersion forksprotocol.ForkVersion // Logger to used by network services Logger *zap.Logger PubsubMsgCacheTTL time.Duration `yaml:"PubsubMsgCacheTTL" env:"PUBSUB_MSG_CACHE_TTL" env-description:"How long a message ID will be remembered as seen"` PubsubOutQueueSize int `` /* 128-byte string literal not displayed */ PubsubValidationQueueSize int `` /* 129-byte string literal not displayed */ PubsubValidateThrottle int `` /* 135-byte string literal not displayed */ }
Config holds the configuration options for p2p network
func NewNetConfig ¶ added in v0.2.0
func NewNetConfig(logger *zap.Logger, netPrivKey *ecdsa.PrivateKey, operatorID string, forkVersion forksprotocol.ForkVersion, bn *discovery.Bootnode, tcpPort, udpPort, maxPeers int) *Config
NewNetConfig creates a new config for tests
func (*Config) Libp2pOptions ¶ added in v0.2.0
Libp2pOptions creates options list for the libp2p host these are the most basic options required to start a network instance, other options and libp2p components can be configured on top
func (*Config) TransformBootnodes ¶ added in v0.2.0
TransformBootnodes converts bootnodes string and convert it to slice
type HostProvider ¶ added in v0.2.0
HostProvider holds host instance
type LocalNet ¶ added in v0.2.0
type LocalNet struct { Nodes []network.P2PNetwork NodeKeys []testing.NodeKeys Bootnode *discovery.Bootnode // contains filtered or unexported fields }
LocalNet holds the nodes in the local network
func CreateAndStartLocalNet ¶ added in v0.2.0
func CreateAndStartLocalNet(pctx context.Context, loggerFactory LoggerFactory, forkVersion forksprotocol.ForkVersion, n, minConnected int, useDiscv5 bool) (*LocalNet, error)
CreateAndStartLocalNet creates a new local network and starts it
func NewLocalNet ¶ added in v0.2.0
func NewLocalNet(ctx context.Context, loggerFactory LoggerFactory, n int, forkVersion forksprotocol.ForkVersion, useDiscv5 bool) (*LocalNet, error)
NewLocalNet creates a new mdns network
func (*LocalNet) NewTestP2pNetwork ¶ added in v0.2.0
func (ln *LocalNet) NewTestP2pNetwork(ctx context.Context, keys testing.NodeKeys, logger *zap.Logger, forkVersion forksprotocol.ForkVersion, maxPeers int) (network.P2PNetwork, error)
NewTestP2pNetwork creates a new network.P2PNetwork instance
type LoggerFactory ¶ added in v0.2.0
LoggerFactory helps to inject loggers
Click to show internal directories.
Click to hide internal directories.