config

package
v0.1.19-profiler Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package config defines configuration used in the p2p package

Index

Constants

View Source
const (
	// P2PDirectoryPath is the name of the directory where we store p2p stuff
	P2PDirectoryPath = "p2p"
	// NodeDataFileName is the name of the file we store the the p2p identity keys
	NodeDataFileName = "id.json"
	// NodesDirectoryName is the name of the directory we store nodes identities under
	NodesDirectoryName = "nodes"
	// UnlimitedMsgSize is a constant used to check whether message size is set to unlimited size
	UnlimitedMsgSize = 0
)
View Source
const (
	ClientVersion    = "go-spacemesh/0.0.2"
	MinClientVersion = "0.0.2"
)

params are non-configurable (hard-coded) consts. To create a configurable param use Config. add all node params here (non-configurable consts) - ideally most node params should be configurable.

View Source
const (
	MainNet = iota
	TestNet
)

NetworkID represents the network that the node lives in that indicates what nodes it can communicate with, and which bootstrap nodes to use

Variables

View Source
var (
	Values = DefaultConfig()
)

Values specifies default values for node config params.

Functions

This section is empty.

Types

type Config

type Config struct {
	TCPPort               int           `mapstructure:"tcp-port"`
	TCPInterface          string        `mapstructure:"tcp-interface"`
	AcquirePort           bool          `mapstructure:"acquire-port"`
	NodeID                string        `mapstructure:"node-id"`
	DialTimeout           time.Duration `mapstructure:"dial-timeout"`
	ConnKeepAlive         time.Duration `mapstructure:"conn-keepalive"`
	NetworkID             int8          `mapstructure:"network-id"`
	ResponseTimeout       time.Duration `mapstructure:"response-timeout"`
	SessionTimeout        time.Duration `mapstructure:"session-timeout"`
	MaxPendingConnections int           `mapstructure:"max-pending-connections"`
	OutboundPeersTarget   int           `mapstructure:"outbound-target"`
	MaxInboundPeers       int           `mapstructure:"max-inbound"`
	SwarmConfig           SwarmConfig   `mapstructure:"swarm"`
	BufferSize            int           `mapstructure:"buffer-size"`
	MsgSizeLimit          int           `mapstructure:"msg-size-limit"` // in bytes
}

Config defines the configuration options for the Spacemesh peer-to-peer networking layer

func DefaultConfig

func DefaultConfig() Config

DefaultConfig defines the default p2p configuration

type SwarmConfig

type SwarmConfig struct {
	Gossip                 bool     `mapstructure:"gossip"`
	Bootstrap              bool     `mapstructure:"bootstrap"`
	RoutingTableBucketSize int      `mapstructure:"bucketsize"`
	RoutingTableAlpha      int      `mapstructure:"alpha"`
	RandomConnections      int      `mapstructure:"randcon"`
	BootstrapNodes         []string `mapstructure:"bootnodes"`
	PeersFile              string   `mapstructure:"peers-file"`
}

SwarmConfig specifies swarm config params.

Jump to

Keyboard shortcuts

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