Documentation
¶
Index ¶
Constants ¶
const ( // ModeProd refers to production mode ModeProd = iota // ModeDev refers to development mode ModeDev // ModeTest refers to test mode ModeTest )
const DefaultNetVersion = "0001"
DefaultNetVersion is the default network version used when no network version is provided.
Variables ¶
var AccountDirName = "accounts"
AccountDirName is the name of the directory for storing accounts
Functions ¶
Types ¶
type DataDir ¶
type DataDir struct {
// contains filtered or unexported fields
}
DataDir manages the client's data directory
func NewDataDir ¶
NewDataDir creates a new DataDir object
func (*DataDir) Load ¶
func (d *DataDir) Load() (*EngineConfig, error)
Load reads the content of the ellcrys.json file into Config struct
type EngineConfig ¶
type EngineConfig struct {
// Node holds the node configurations
Node *PeerConfig `json:"peer"`
// TxPool holds transaction pool configurations
TxPool *TxPoolConfig `json:"txPool"`
// Miner holds mining configurations
Miner *MinerConfig `json:"mining"`
// RPC holds rpc configurations
RPC *RPCConfig `json:"rpc"`
// VersionInfo holds version information
VersionInfo *VersionInfo `json:"-"`
// contains filtered or unexported fields
}
EngineConfig represents the client's configuration
func LoadDataDir ¶
func LoadDataDir(dataDirPath, network string) (*EngineConfig, error)
LoadDataDir loads a data directory and returns the engine configuration
func (*EngineConfig) DataDir ¶
func (c *EngineConfig) DataDir() string
DataDir returns the config directory
func (*EngineConfig) SetConfigDir ¶
func (c *EngineConfig) SetConfigDir(d string)
SetConfigDir sets the config directory
type MinerConfig ¶
type MinerConfig struct {
// Mode describes the mining mode
Mode uint `json:"-"`
}
MinerConfig defines configuration for mining
type PeerConfig ¶
type PeerConfig struct {
// BootstrapAddresses sets addresses to connect to
BootstrapAddresses []string `json:"addresses"`
// Mode determines the current environment type
Mode int `json:"mode"`
// GetAddrInterval is the interval between GetAddr messages
GetAddrInterval int64 `json:"getAddrInt"`
// PingInterval is the interval between Ping messages
PingInterval int64 `json:"pingInt"`
// SelfAdvInterval is the interval self advertisement messages
SelfAdvInterval int64 `json:"selfAdvInt"`
// CleanUpInterval is the interval between address clean ups
CleanUpInterval int64 `json:"cleanUpInt"`
// MaxAddrsExpected is the maximum number addresses
// expected from a remote peer
MaxAddrsExpected int64 `json:"maxAddrsExpected"`
// MaxOutboundConnections is the maximum number of outbound
// connections the node is allowed
MaxOutboundConnections int64 `json:"maxOutConnections"`
// MaxOutboundConnections is the maximum number of inbound
// connections the node is allowed
MaxInboundConnections int64 `json:"maxInConnections"`
// ConnEstInterval is the time interval when the node
ConnEstInterval int64 `json:"conEstInt"`
// MessageTimeout is the number of seconds to attempt to
// connect to or read from a peer.
MessageTimeout int64 `json:"messageTimeout"`
}
PeerConfig represents peer 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
var ( // Versions contains protocol handlers versions information Versions *ProtocolVersions )
type RPCConfig ¶
type RPCConfig struct {
// DisableAuth determines whether to
// perform authentication for requests
// attempting to invoke private methods.
DisableAuth bool `json:"disableAuth"`
// Username is the RPC username
Username string `json:"username"`
// Password is the RPC password
Password string `json:"password"`
// SessionSecretKey is the key used to sign the
// session tokens. Must be kept secret.
SessionSecretKey string `json:"sessionSecretKey"`
}
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:"cap"`
}
TxPoolConfig defines configuration for the transaction pool