config

package
v0.1.8-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2019 License: GPL-3.0 Imports: 10 Imported by: 11

Documentation

Index

Constants

View Source
const (
	// ModeProd refers to production mode
	ModeProd = iota
	// ModeDev refers to development mode
	ModeDev
	// ModeTest refers to test mode
	ModeTest
)
View Source
const DefaultNetVersion = "0001"

DefaultNetVersion is the default network version used when no network version is provided.

Variables

View Source
var AccountDirName = "accounts"

AccountDirName is the name of the directory for storing accounts

View Source
var SeedAddresses = []string{
	"ellcrys://12D3KooWKAEhd4DXGPeN71FeSC1ih86Ym2izpoPueaCrME8xu8UM@n1.ellnode.com:9000",
	"ellcrys://12D3KooWD276x1ieiV9cmtBdZeVLN5LtFrnUS6AT2uAkHHFNADRx@n2.ellnode.com:9000",
	"ellcrys://12D3KooWDdUZny1FagkUregeNQUb8PB6Vg1LMWcwWquqovm7QADb@n3.ellnode.com:9000",
	"ellcrys://12D3KooWDWA4g8EXWWBSbWbefSu2RGttNh1QDpQYA7nCDnbVADP1@n4.ellnode.com:9000",
}

SeedAddresses includes addresses to nodes that the client will attempt to synchronize with.

Functions

func SetVersions

func SetVersions(netVersion string)

SetVersions sets the protocol version. All protocol handlers will be prefixed with the version to create a

Types

type EngineConfig

type EngineConfig struct {

	// Node holds the node configurations
	Node *NodeConfig `json:"node" mapstructure:"node"`

	// TxPool holds transaction pool configurations
	TxPool *TxPoolConfig `json:"txPool" mapstructure:"txPool"`

	// Miner holds mining configurations
	Miner *MinerConfig `json:"mining" mapstructure:"mining"`

	// RPC holds rpc configurations
	RPC *RPCConfig `json:"rpc" mapstructure:"rpc"`

	// VersionInfo holds version information
	VersionInfo *VersionInfo `json:"-" mapstructure:"-"`

	// Log is the application logger
	Log logger.Logger `json:"-" mapstructure:"-"`
	// contains filtered or unexported fields
}

EngineConfig represents the client's configuration

func InitConfig

func InitConfig(rootCommand *cobra.Command) *EngineConfig

InitConfig reads in config file and ENV variables if set.

func (*EngineConfig) DataDir

func (c *EngineConfig) DataDir() string

DataDir returns the application's data directory

func (*EngineConfig) NetDataDir

func (c *EngineConfig) NetDataDir() string

NetDataDir returns the network's data directory

func (*EngineConfig) SetDataDir

func (c *EngineConfig) SetDataDir(d string)

SetDataDir sets the application's data directory

func (*EngineConfig) SetNetDataDir

func (c *EngineConfig) SetNetDataDir(d string)

SetNetDataDir sets the network's data directory

type MinerConfig

type MinerConfig struct {

	// Mode describes the mining mode
	Mode uint `json:"-" mapstructure:"-"`
}

MinerConfig defines configuration for mining

type NodeConfig

type NodeConfig struct {

	// BootstrapAddresses sets addresses to connect to
	BootstrapAddresses []string `json:"bootstrapAddrs" mapstructure:"bootstrapAddrs"`

	// ListeningAddr is the address the node binds on to listen to incoming messages
	ListeningAddr string `json:"address" mapstructure:"address"`

	// Mode determines the current environment type
	Mode int `json:"mode" mapstructure:"mode"`

	// GetAddrInterval is the interval between GetAddr messages
	GetAddrInterval int64 `json:"getAddrInt" mapstructure:"getAddrInt"`

	// PingInterval is the interval between Ping messages
	PingInterval int64 `json:"pingInt" mapstructure:"pingInt"`

	// SelfAdvInterval is the interval self advertisement messages
	SelfAdvInterval int64 `json:"selfAdvInt" mapstructure:"selfAdvInt"`

	// CleanUpInterval is the interval between address clean ups
	CleanUpInterval int64 `json:"cleanUpInt" mapstructure:"cleanUpInt"`

	// MaxAddrsExpected is the maximum number addresses
	// expected from a remote peer
	MaxAddrsExpected int64 `json:"maxAddrsExpected" mapstructure:"maxAddrsExpected"`

	// MaxOutboundConnections is the maximum number of outbound
	// connections the node is allowed
	MaxOutboundConnections int64 `json:"maxOutConnections" mapstructure:"maxOutConnections"`

	// MaxOutboundConnections is the maximum number of inbound
	// connections the node is allowed
	MaxInboundConnections int64 `json:"maxInConnections" mapstructure:"maxInConnections"`

	// ConnEstInterval is the time interval when the node
	ConnEstInterval int64 `json:"conEstInt" mapstructure:"conEstInt"`

	// MessageTimeout is the number of seconds to attempt to
	// connect to or read from a peer.
	MessageTimeout int64 `json:"messageTimeout" mapstructure:"messageTimeout"`

	// Account is the coinbase account
	Account string `json:"account" mapstructure:"account"`
}

NodeConfig represents node's configuration

type ProtocolVersions

type ProtocolVersions struct {

	// Protocol is the network version supported by this client
	Protocol string

	// Handshake is the message version for handling wire.Handshake
	Handshake string

	// Ping is the version for handling wire.Ping messages
	Ping string

	// GetAddr is the message version for handling wire.GetAddr messages
	GetAddr string

	// Addr is the message version for handling wire.Addr messages
	Addr string

	// Tx is the message version for handing wire.Transaction messages
	Tx string

	// BlockInfo is the message version for handling wire.BlockInfo messages
	BlockInfo string

	// BlockBody is the message version for handling wire.BlockBody messages
	BlockBody string

	// GetBlockHashes is the message version for handling wire.BlockHashes messages
	GetBlockHashes string

	// RequestBlock is the message version for handling wire.RequestBlock messages
	RequestBlock string

	// GetBlockBodies is the message version for handling wire.GetBlockBodies messages
	GetBlockBodies string
}

ProtocolVersions hold protocol message handler versions

func GetVersions

func GetVersions() *ProtocolVersions

GetVersions returns the protocol version object

type RPCConfig

type RPCConfig struct {

	// DisableAuth determines whether to
	// perform authentication for requests
	// attempting to invoke private methods.
	DisableAuth bool `json:"disableAuth" mapstructure:"disableAuth"`

	// Username is the RPC username
	Username string `json:"username" mapstructure:"username"`

	// Password is the RPC password
	Password string `json:"password" mapstructure:"password"`

	// SessionSecretKey is the key used to sign the
	// session tokens. Must be kept secret.
	SessionSecretKey string `json:"sessionSecretKey" mapstructure:"sessionSecretKey"`

	// SessionTTL is the duration a session can
	// remain active before it is considered expired.
	SessionTTL int64 `json:"sessionTTL" mapstructure:"sessionTTL"`
}

RPCConfig defines configuration for the RPC component

type TxPoolConfig

type TxPoolConfig struct {

	// Capacity is the maximum amount of item the transaction pool can hold
	Capacity int64 `json:"capacity" mapstructure:"capacity"`
}

TxPoolConfig defines configuration for the transaction pool

type VersionInfo

type VersionInfo struct {
	BuildVersion string `json:"buildVersion" mapstructure:"buildVersion"`
	BuildCommit  string `json:"buildCommit" mapstructure:"buildCommit"`
	BuildDate    string `json:"buildDate" mapstructure:"buildDate"`
	GoVersion    string `json:"goVersion" mapstructure:"goVersion"`
}

VersionInfo describes the clients components and runtime version information

Jump to

Keyboard shortcuts

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