Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // MetricsAllConnectedPeers counts all connected peers MetricsAllConnectedPeers = promauto.NewGauge(prometheus.GaugeOpts{ Name: "ssv_p2p_all_connected_peers", Help: "Count connected peers", }) // MetricsConnectedPeers counts connected peers for a topic MetricsConnectedPeers = promauto.NewGaugeVec(prometheus.GaugeOpts{ Name: "ssv_p2p_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", "operatorID", "v", "pid", "type"}) )
Functions ¶
Types ¶
type Config ¶
type Config struct { Ctx context.Context Bootnodes string `yaml:"Bootnodes" env:"BOOTNODES" env-description:"Bootnodes to use to start discovery, seperated with ';'" env-default:""` Discovery string `yaml:"Discovery" env:"P2P_DISCOVERY" env-description:"Discovery system to use" env-default:"discv5"` 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:"10s"` 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:"10" 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-default:"true" env-description:"Flag to turn on/off pubsub scoring"` // 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"` // 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 // NodeStorage is used to get operator metadata. NodeStorage storage.Storage // Network defines a network configuration. Network networkconfig.NetworkConfig 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 */ // FullNode determines whether the network should sync decided history from peers. // If false, SyncDecidedByRange becomes a no-op. FullNode bool GetValidatorStats network.GetValidatorStats PermissionedActivateEpoch uint64 `` /* 189-byte string literal not displayed */ PermissionedDeactivateEpoch uint64 `` /* 169-byte string literal not displayed */ Permissioned func() bool // this is not loaded from config file but set up in full node setup // WhitelistedOperatorKeys is an array of Operator Public Key PEMs not registered in the contract with which the node will accept connections WhitelistedOperatorKeys []string `` /* 162-byte string literal not displayed */ }
Config holds the configuration options for p2p network
func NewNetConfig ¶ added in v0.2.0
func NewNetConfig(netPrivKey *ecdsa.PrivateKey, operatorID string, 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, logger *zap.Logger, nodesQuantity, minConnected int, useDiscv5 bool) (*LocalNet, error)
CreateAndStartLocalNet creates a new local network and starts it if any errors occurs during starting local network CreateAndStartLocalNet trying to create and start local net one more time until pCtx is not Done()
func NewLocalNet ¶ added in v0.2.0
NewLocalNet creates a new mdns network
type PeersIndexProvider ¶ added in v1.1.0
PeersIndexProvider holds peers index instance