config

package
v0.1.8-c Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	P2PDirectoryPath   = "p2p"
	NodeDataFileName   = "id.json"
	NodesDirectoryName = "nodes"
	UnlimitedMsgSize   = 0
)
View Source
const (
	ClientVersion    = "go-spacemesh/0.0.1"
	MinClientVersion = "0.0.1"
)

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 (
	ConfigValues = DefaultConfig()
)

ConfigValues specifies default values for node config params.

Functions

This section is empty.

Types

type Config

type Config struct {
	TCPPort               int           `mapstructure:"tcp-port"`
	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