config

package
v0.2400.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package config implements global configuration options.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BootstrapConfig

type BootstrapConfig struct {
	// Enable bootstrap discovery protocol.
	Enable bool `yaml:"enable"`
	// Retention period for peers discovered through seed nodes.
	RetentionPeriod time.Duration `yaml:"retention_period"`
}

BootstrapConfig is the P2P discovery bootstrap configuration structure.

type Config

type Config struct {
	// Port to use for incoming P2P connections.
	Port uint16 `yaml:"port"`

	// Seed node(s) of the form pubkey@IP:port.
	Seeds []string `yaml:"seeds,omitempty"`

	Discovery         DiscoveryConfig         `yaml:"discovery,omitempty"`
	Registration      RegistrationConfig      `yaml:"registration,omitempty"`
	Gossipsub         GossipsubConfig         `yaml:"gossipsub,omitempty"`
	PeerManager       PeerManagerConfig       `yaml:"peer_manager,omitempty"`
	ConnectionManager ConnectionManagerConfig `yaml:"connection_manager,omitempty"`
	ConnectionGater   ConnectionGaterConfig   `yaml:"connection_gater,omitempty"`
}

Config is the P2P configuration structure.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configuration settings.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration settings.

type ConnectionGaterConfig

type ConnectionGaterConfig struct {
	// List of blocked peer IPs.
	BlockedPeerIPs []string `yaml:"blocked_peers"`
}

ConnectionGaterConfig is the P2P connection gater configuration structure.

type ConnectionManagerConfig

type ConnectionManagerConfig struct {
	// Set maximum number of P2P peers.
	MaxNumPeers int `yaml:"max_num_peers"`
	// Time duration for new peer connections to be immune from pruning.
	PeerGracePeriod time.Duration `yaml:"peer_grace_period"`
	// List of persistent peer node addresses in format P2Ppubkey@IP:port.
	PersistentPeers []string `yaml:"persistent_peers,omitempty"`
}

ConnectionManagerConfig is the P2P connection manager configuration structure.

type DiscoveryConfig

type DiscoveryConfig struct {
	Bootstrap BootstrapConfig `yaml:"bootstrap"`
}

DiscoveryConfig is the P2P discovery configuration structure.

type GossipsubConfig

type GossipsubConfig struct {
	// Set libp2p gossipsub buffer size for outbound messages.
	PeerOutboundQueueSize int `yaml:"peer_outbound_queue_size"`
	// Set libp2p gossipsub buffer size of the validate queue.
	ValidateQueueSize int `yaml:"validate_queue_size"`
	// Set libp2p gossipsub per topic validator concurrency limit.
	ValidateConcurrency int `yaml:"validate_concurrency"`
	// Set libp2p gossipsub validator concurrency limit.
	// Note: This is a global (across all topics) validator concurrency limit.
	ValidateThrottle int `yaml:"validate_throttle"`
}

GossipsubConfig is the P2P gossipsub configuration structure.

type PeerManagerConfig

type PeerManagerConfig struct {
	// Set the low water mark at which the peer manager will try to reconnect to peers.
	ConnectednessLowWater float64 `yaml:"connectedness_low_water"`
}

PeerManagerConfig is the P2P peer manager configuration structure.

type RegistrationConfig

type RegistrationConfig struct {
	// Address/port(s) to use for P2P connections when registering this node
	// (if not set, all non-loopback local interfaces will be used).
	Addresses []string `yaml:"addresses"`
}

RegistrationConfig is the P2P registration configuration structure.

Jump to

Keyboard shortcuts

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