params

package
v0.0.0-...-b8899bb Latest Latest
Warning

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

Go to latest
Published: May 29, 2017 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ClientIdentifier is client identifier to advertise over the network
	ClientIdentifier = "StatusIM"

	// DataDir is default data directory used by statusd executable
	DataDir = "statusd-data"

	// KeyStoreDir is default directory where private keys are stored, relative to DataDir
	KeyStoreDir = "keystore"

	// IPCFile is filename of exposed IPC RPC Server
	IPCFile = "geth.ipc"

	// HTTPHost is host interface for the HTTP RPC server
	HTTPHost = "localhost"

	// HTTPPort is HTTP-RPC port (replaced in unit tests)
	HTTPPort = 8545

	// DevAPIModules is a list of modules to expose via any type of RPC (HTTP, IPC) during development
	DevAPIModules = "db,eth,net,web3,shh,personal,admin"

	// ProdAPIModules is a list of modules to expose via any type of RPC (HTTP, IPC) in production
	ProdAPIModules = "eth,net,web3,shh,personal"

	// WSHost is a host interface for the websocket RPC server
	WSHost = "localhost"

	// WSPort is a WS-RPC port (replaced in unit tests)
	WSPort = 8546

	// MaxPeers is the maximum number of global peers
	MaxPeers = 25

	// MaxPendingPeers is the maximum number of peers that can be pending in the
	// handshake phase, counted separately for inbound and outbound connections.
	MaxPendingPeers = 0

	// DefaultGas default amount of gas used for transactions
	DefaultGas = 180000

	// DefaultFileDescriptorLimit is fd limit that database can use
	DefaultFileDescriptorLimit = uint64(2048)

	// DatabaseCache is memory (in MBs) allocated to internal caching (min 16MB / database forced)
	DatabaseCache = 16

	// CHTRootConfigURL defines URL to file containing hard-coded CHT roots
	// TODO remove this hack, once CHT sync is implemented on LES side
	CHTRootConfigURL = "https://gist.githubusercontent.com/farazdagi/a8d36e2818b3b2b6074d691da63a0c36/raw/"

	// LogFile defines where to write logs to
	LogFile = "geth.log"

	// LogLevel defines the minimum log level to report
	LogLevel = "INFO"

	// LogLevelSuccinct defines the log level when only errors are reported.
	// Useful when the default INFO level becomes too verbose.
	LogLevelSuccinct = "ERROR"

	// LogToStderr defines whether logged info should also be output to os.Stderr
	LogToStderr = true

	// WhisperDataDir is directory where Whisper data is stored, relative to DataDir
	WhisperDataDir = "wnode"

	// WhisperPort is Whisper node listening port
	WhisperPort = 30379

	// WhisperMinimumPoW amount of work for Whisper message to be added to sending queue
	WhisperMinimumPoW = 0.001

	// WhisperTTL is time to live for messages, in seconds
	WhisperTTL = 120

	// FirebaseNotificationTriggerURL is URL where FCM notification requests are sent to
	FirebaseNotificationTriggerURL = "https://fcm.googleapis.com/fcm/send"

	// MainNetworkID is id of the main network
	MainNetworkID = 1

	// RopstenNetworkID is id of a test network (on PoW)
	RopstenNetworkID = 3

	// RinkebyNetworkID is id of a test network (on PoA)
	RinkebyNetworkID = 4

	// BootClusterConfigFile is default config file containing boot node list (as JSON array)
	BootClusterConfigFile = "ropsten.dev.json"
)
View Source
const (
	// VersionMajor is a major version component of the current release
	VersionMajor = 0

	// VersionMinor is a minor version component of the current release
	VersionMinor = 9

	// VersionPatch is a patch version component of the current release
	VersionPatch = 7

	// VersionMeta is metadata to append to the version string
	VersionMeta = "stable"
)

Variables

View Source
var (
	UseMainnetFlag = "false" // to be overridden via -ldflags '-X geth/params.UseMainnetFlag'
	UseMainnet     = false
)

default node configuration options

View Source
var (
	ErrMissingDataDir            = errors.New("missing required 'DataDir' parameter")
	ErrMissingNetworkID          = errors.New("missing required 'NetworkID' parameter")
	ErrEmptyPasswordFile         = errors.New("password file cannot be empty")
	ErrEmptyIdentityFile         = errors.New("identity file cannot be empty")
	ErrEmptyAuthorizationKeyFile = errors.New("authorization key file cannot be empty")
)

errors

View Source
var (
	RopstenNetGenesisHash = common.HexToHash("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d")
	RinkebyNetGenesisHash = common.HexToHash("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177")
	MainNetGenesisHash    = common.HexToHash("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3")
)

Version exposes string representation of program version.

Functions

This section is empty.

Types

type BootClusterConfig

type BootClusterConfig struct {
	// Enabled flag specifies whether feature is enabled
	Enabled bool

	// ConfigFile is a path to JSON file containing array of boot nodes
	// See `static/bootcluster/*.json` for cluster configurations provided
	// out of box. You can pass absolute path, and if file at that path can be
	// loaded, it will be used. Otherwise, file is supposed to be relative to
	// `static/bootcluster` folder.
	ConfigFile string
}

BootClusterConfig holds configuration for supporting boot cluster, which is a temporary means for mobile devices to get connected to Ethereum network (UDP-based discovery may not be available, so we need means to discover the network manually).

func (*BootClusterConfig) String

func (c *BootClusterConfig) String() string

String dumps config object as nicely indented JSON

type FirebaseConfig

type FirebaseConfig struct {
	// AuthorizationKeyFile file path that contains FCM authorization key
	AuthorizationKeyFile string

	// NotificationTriggerURL URL used to send push notification requests to
	NotificationTriggerURL string
}

FirebaseConfig holds FCM-related configuration

func (*FirebaseConfig) ReadAuthorizationKeyFile

func (c *FirebaseConfig) ReadAuthorizationKeyFile() ([]byte, error)

ReadAuthorizationKeyFile reads and loads FCM authorization key

type LightEthConfig

type LightEthConfig struct {
	// Enabled flag specifies whether protocol is enabled
	Enabled bool

	// Genesis is JSON to seed the chain database with
	Genesis string

	// DatabaseCache is memory (in MBs) allocated to internal caching (min 16MB / database forced)
	DatabaseCache int

	// CHTRootConfigURL defines URL to file containing hard-coded CHT roots
	// TODO remove this hack, once CHT sync is implemented on LES side
	CHTRootConfigURL string
}

LightEthConfig holds LES-related configuration Status nodes are always lightweight clients (due to mobile platform constraints)

type NodeConfig

type NodeConfig struct {
	// DevMode is true when given configuration is to be used during development.
	// For production, this flag should be turned off, so that more strict requirements
	// are applied to node's configuration
	DevMode bool

	// NetworkID sets network to use for selecting peers to connect to
	NetworkID uint64 `json:"NetworkId,"`

	// DataDir is the file system folder the node should use for any data storage needs.
	DataDir string

	// KeyStoreDir is the file system folder that contains private keys.
	// If KeyStoreDir is empty, the default location is the "keystore" subdirectory of DataDir.
	KeyStoreDir string

	// PrivateKeyFile is a filename with node ID (private key)
	// This file should contain a valid secp256k1 private key that will be used for both
	// remote peer identification as well as network traffic encryption.
	NodeKeyFile string

	// Name sets the instance name of the node. It must not contain the / character.
	Name string

	// Version exposes program's version. It is used in the devp2p node identifier.
	Version string

	// APIModules is a comma-separated list of API modules exposed via *any* (HTTP/WS/IPC) RPC interface.
	APIModules string

	// HTTPHost is the host interface on which to start the HTTP RPC server.
	// Pass empty string if no HTTP RPC interface needs to be started.
	HTTPHost string

	// HTTPPort is the TCP port number on which to start the Geth's HTTP RPC server.
	HTTPPort int

	// WSHost is a host interface for the WebSocket RPC server
	WSHost string

	// WSPort is the TCP port number on which to start the Geth's WebSocket RPC server.
	WSPort int

	// WSEnabled specifies whether WS-RPC Server is enabled or not
	WSEnabled bool

	// IPCFile is filename of exposed IPC RPC Server
	IPCFile string

	// IPCEnabled specifies whether IPC-RPC Server is enabled or not
	IPCEnabled bool

	// TLSEnabled specifies whether TLS support should be enabled on node or not
	// TLS support is only planned in go-ethereum, so we are using our own patch.
	TLSEnabled bool

	// MaxPeers is the maximum number of (global) peers that can be connected.
	// Set to zero, if only static or trusted peers are allowed to connect.
	MaxPeers int

	// MaxPendingPeers is the maximum number of peers that can be pending in the
	// handshake phase, counted separately for inbound and outbound connections.
	MaxPendingPeers int

	// LogToFile specified whether logs should be saved into file
	LogEnabled bool

	// LogFile is filename where exposed logs get written to
	LogFile string

	// LogLevel defines minimum log level. Valid names are "ERROR", "WARNING", "INFO", "DEBUG", and "TRACE".
	LogLevel string

	// LogToStderr defines whether logged info should also be output to os.Stderr
	LogToStderr bool

	// BootClusterConfig extra configuration for supporting cluster
	BootClusterConfig *BootClusterConfig `json:"BootClusterConfig,"`

	// LightEthConfig extra configuration for LES
	LightEthConfig *LightEthConfig `json:"LightEthConfig,"`

	// WhisperConfig extra configuration for SHH
	WhisperConfig *WhisperConfig `json:"WhisperConfig,"`

	// SwarmConfig extra configuration for Swarm and ENS
	SwarmConfig *SwarmConfig `json:"SwarmConfig,"`
}

NodeConfig stores configuration options for a node

func LoadNodeConfig

func LoadNodeConfig(configJSON string) (*NodeConfig, error)

LoadNodeConfig parses incoming JSON and returned it as Config

func NewNodeConfig

func NewNodeConfig(dataDir string, networkID uint64, devMode bool) (*NodeConfig, error)

NewNodeConfig creates new node configuration object

func (*NodeConfig) LoadBootClusterNodes

func (c *NodeConfig) LoadBootClusterNodes() ([]string, error)

LoadBootClusterNodes loads boot nodes from a config file provided in BootClusterConfig

func (*NodeConfig) Save

func (c *NodeConfig) Save() error

Save dumps configuration to the disk

func (*NodeConfig) String

func (c *NodeConfig) String() string

String dumps config object as nicely indented JSON

type SwarmConfig

type SwarmConfig struct {
	// Enabled flag specifies whether protocol is enabled
	Enabled bool
}

SwarmConfig holds Swarm-related configuration

func (*SwarmConfig) String

func (c *SwarmConfig) String() string

String dumps config object as nicely indented JSON

type WhisperConfig

type WhisperConfig struct {
	// Enabled flag specifies whether protocol is enabled
	Enabled bool

	// IdentityFile path to private key, that will be loaded as identity into Whisper
	IdentityFile string

	// PasswordFile path to password file, for non-interactive password entry
	// (if no account file selected, then this password is used for symmetric encryption)
	PasswordFile string

	// EchoMode if mode is on, prints some arguments for diagnostics
	EchoMode bool

	// BootstrapNode whether node doesn't actively connect to peers, and waits for incoming connections
	BootstrapNode bool

	// ForwarderNode is mode when node only forwards messages, neither sends nor decrypts messages
	ForwarderNode bool

	// MailServerNode is mode when node is capable of delivering expired messages on demand
	MailServerNode bool

	// NotificationServerNode is mode when node is capable of sending Push (and probably other kinds) Notifications
	NotificationServerNode bool

	// DataDir is the file system folder Whisper should use for any data storage needs.
	DataDir string

	// Port Whisper node's listening port
	Port int

	// MinimumPoW minimum PoW for Whisper messages
	MinimumPoW float64

	// TTL time to live for messages, in seconds
	TTL int

	// FirebaseConfig extra configuration for Firebase Cloud Messaging
	FirebaseConfig *FirebaseConfig `json:"FirebaseConfig,"`
}

WhisperConfig holds SHH-related configuration

func (*WhisperConfig) ReadIdentityFile

func (c *WhisperConfig) ReadIdentityFile() (*ecdsa.PrivateKey, error)

ReadIdentityFile reads and loads identity private key

func (*WhisperConfig) ReadPasswordFile

func (c *WhisperConfig) ReadPasswordFile() ([]byte, error)

ReadPasswordFile reads and returns content of the password file

func (*WhisperConfig) String

func (c *WhisperConfig) String() string

String dumps config object as nicely indented JSON

Jump to

Keyboard shortcuts

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