params

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2018 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FleetUndefined = ""
	FleetBeta      = "eth.beta"
	FleetStaging   = "eth.staging"
)

Define available fleets.

View Source
const (
	// StatusDatabase path relative to DataDir.
	StatusDatabase = "status-db"

	// SendTransactionMethodName defines the name for a giving transaction.
	SendTransactionMethodName = "eth_sendTransaction"

	// AccountsMethodName defines the name for listing the currently signed accounts.
	AccountsMethodName = "eth_accounts"

	// PersonalSignMethodName defines the name for `personal.sign` API.
	PersonalSignMethodName = "personal_sign"

	// PersonalRecoverMethodName defines the name for `personal.recover` API.
	PersonalRecoverMethodName = "personal_ecRecover"

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

	// 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

	// MainnetEthereumNetworkURL is URL where the upstream ethereum network is loaded to
	// allow us avoid syncing node.
	MainnetEthereumNetworkURL = "https://mainnet.infura.io/nKmXgiFgc2KqtoQ8BCGJ"

	// RopstenEthereumNetworkURL is URL where the upstream ethereum network is loaded to
	// allow us avoid syncing node.
	RopstenEthereumNetworkURL = "https://ropsten.infura.io/nKmXgiFgc2KqtoQ8BCGJ"

	// RinkebyEthereumNetworkURL is URL where the upstream ethereum network is loaded to
	// allow us avoid syncing node.
	RinkebyEthereumNetworkURL = "https://rinkeby.infura.io/nKmXgiFgc2KqtoQ8BCGJ"

	// 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

	// StatusChainNetworkID is id of a test network (private chain)
	StatusChainNetworkID = 777

	// WhisperDiscv5Topic used to register and search for whisper peers using discovery v5.
	WhisperDiscv5Topic = discv5.Topic("whisper")

	// MailServerDiscv5Topic used to register and search for mail server peers using discovery v5.
	MailServerDiscv5Topic = discv5.Topic("whispermail")

	// LESDiscoveryIdentifier is a prefix for topic used for LES peers discovery.
	LESDiscoveryIdentifier = "LES2@"
)

Variables

View Source
var (
	// WhisperDiscv5Limits declares min and max limits for peers with whisper topic.
	WhisperDiscv5Limits = Limits{2, 2}
	// LesDiscoveryLimits default limits used if LES and discovery are enabled.
	LesDiscoveryLimits = Limits{2, 2}
)
View Source
var Version string

Version relies on a git tag and is passed by linker's '-ldflags' flag.

Functions

func LesTopic added in v0.13.0

func LesTopic(netid int) string

LesTopic returns discovery v5 topic derived from genesis of the provided network. 1 - mainnet, 3 - ropsten, 4 - rinkeby

func NewValidator

func NewValidator() *validator.Validate

NewValidator returns a new validator.Validate.

Types

type Cluster added in v0.12.0

type Cluster struct {
	StaticNodes     []string `json:"staticnodes"`
	BootNodes       []string `json:"bootnodes"`
	MailServers     []string `json:"mailservers"` // list of trusted mail servers
	RendezvousNodes []string `json:"rendezvousnodes"`
}

Cluster defines a list of Ethereum nodes.

type ClusterConfig

type ClusterConfig struct {
	// Enabled flag specifies that nodes in this configuration are taken into account.
	Enabled bool

	// Fleet is a name of a selected fleet. If it has a value, nodes are loaded
	// from a file, namely `fleet-*.{{ .Fleet }}.json`. Nodes can be added to any list
	// in `ClusterConfig`.
	Fleet string

	// StaticNodes is a list of static nodes.
	StaticNodes []string

	// BootNodes is a list of bootnodes.
	BootNodes []string

	// TrustedMailServers is a list of verified and trusted Mail Server nodes.
	TrustedMailServers []string

	// RendezvousNodes is a list rendezvous discovery nodes.
	RendezvousNodes []string
}

ClusterConfig holds configuration for supporting cluster peers, 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 (*ClusterConfig) String

func (c *ClusterConfig) String() string

String dumps config object as nicely indented JSON

func (*ClusterConfig) Validate added in v0.15.0

func (c *ClusterConfig) Validate(validate *validator.Validate) error

Validate validates the ClusterConfig struct and returns an error if inconsistent values are found

type LightEthConfig

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

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

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

func (*LightEthConfig) Validate added in v0.15.0

func (c *LightEthConfig) Validate(validate *validator.Validate) error

Validate validates the LightEthConfig struct and returns an error if inconsistent values are found

type Limits

type Limits struct {
	Min, Max int
}

Limits represent min and max amount of peers

func NewLimits

func NewLimits(min, max int) Limits

NewLimits creates new Limits config with given min and max values.

type NodeConfig

type NodeConfig struct {
	// NetworkID sets network to use for selecting peers to connect to
	NetworkID uint64 `json:"NetworkId" validate:"required"`

	// DataDir is the file system folder the node should use for any data storage needs.
	DataDir string `validate:"required"`
	// BackupDisabledDataDir is the file system folder the node should use for any data storage needs that it doesn't want backed up.
	BackupDisabledDataDir string `validate:"required"`
	PFSEnabled            bool

	// KeyStoreDir is the file system folder that contains private keys.
	KeyStoreDir string `validate:"required"`

	// NodeKey is the hex-encoded node ID (private key). Should be a valid secp256k1 private key that will be used for both
	// remote peer identification as well as network traffic encryption.
	NodeKey string

	// NoDiscovery set to true will disable discovery protocol.
	NoDiscovery bool

	// Rendezvous enables discovery protocol.
	Rendezvous bool

	// ListenAddr is an IP address and port of this node (e.g. 127.0.0.1:30303).
	ListenAddr string

	// AdvertiseAddr is a public IP address the node wants to be found with.
	// It is especially useful when using floating IPs attached to a server.
	AdvertiseAddr string

	// Name sets the instance name of the node. It must not contain the / character.
	Name string `validate:"excludes=/"`

	// 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

	// HTTPEnabled specifies whether the http RPC server is to be enabled by default.
	HTTPEnabled bool

	// 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

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

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

	// 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

	// LogEnabled enables the logger
	LogEnabled bool `json:"LogEnabled"`

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

	// LogLevel defines minimum log level. Valid names are "ERROR", "WARN", "INFO", "DEBUG", and "TRACE".
	LogLevel string `validate:"eq=ERROR|eq=WARN|eq=INFO|eq=DEBUG|eq=TRACE"`

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

	// UpstreamConfig extra config for providing upstream infura server.
	UpstreamConfig UpstreamRPCConfig `json:"UpstreamConfig"`

	// ClusterConfig extra configuration for supporting cluster peers.
	ClusterConfig ClusterConfig `json:"ClusterConfig," validate:"structonly"`

	// LightEthConfig extra configuration for LES
	LightEthConfig LightEthConfig `json:"LightEthConfig," validate:"structonly"`

	// WhisperConfig extra configuration for SHH
	WhisperConfig WhisperConfig `json:"WhisperConfig," validate:"structonly"`

	// SwarmConfig extra configuration for Swarm and ENS
	SwarmConfig SwarmConfig `json:"SwarmConfig," validate:"structonly"`

	// RegisterTopics a list of specific topics where the peer wants to be
	// discoverable.
	RegisterTopics []discv5.Topic `json:"RegisterTopics"`

	// RequiredTopics list of topics where a client wants to search for
	// discoverable peers with the discovery limits.
	RequireTopics map[discv5.Topic]Limits `json:"RequireTopics"`

	// StatusServiceEnabled enables status service api
	StatusServiceEnabled bool

	// InstallationId id of the current installation
	InstallationID string

	// DebugAPIEnabled enables debug api
	DebugAPIEnabled bool

	// MailServerRegistryAddress is the MailServerRegistry contract address
	MailServerRegistryAddress string
	// contains filtered or unexported fields
}

NodeConfig stores configuration options for a node

func NewConfigFromJSON added in v0.15.0

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

NewConfigFromJSON parses incoming JSON and returned it as Config

func NewNodeConfig

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

NewNodeConfig creates new node configuration object with bare-minimum defaults

func NewNodeConfigWithDefaults added in v0.15.0

func NewNodeConfigWithDefaults(dataDir string, networkID uint64, opts ...Option) (*NodeConfig, error)

NewNodeConfigWithDefaults creates new node configuration object with some defaults suitable for adhoc use.

func NewNodeConfigWithDefaultsAndFiles added in v0.15.1

func NewNodeConfigWithDefaultsAndFiles(
	dataDir string, networkID uint64, opts []Option, files []string,
) (*NodeConfig, error)

NewNodeConfigWithDefaultsAndFiles creates new node configuration object with some defaults suitable for adhoc use and applies config files on top.

func (*NodeConfig) AddAPIModule

func (c *NodeConfig) AddAPIModule(m string)

AddAPIModule adds a mobule to APIModules

func (*NodeConfig) FormatAPIModules

func (c *NodeConfig) FormatAPIModules() []string

FormatAPIModules returns a slice of APIModules.

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

func (*NodeConfig) Validate

func (c *NodeConfig) Validate() error

Validate checks if NodeConfig fields have valid values.

It returns nil if there are no errors, otherwise one or more errors can be returned. Multiple errors are joined with a new line.

A single error for a struct:

type TestStruct struct {
    TestField string `validate:"required"`
}

has the following format:

Key: 'TestStruct.TestField' Error:Field validation for 'TestField' failed on the 'required' tag

type Option added in v0.15.1

type Option func(*NodeConfig) error

Option is an additional setting when creating a NodeConfig using NewNodeConfigWithDefaults.

func WithFleet added in v0.15.1

func WithFleet(fleet string) Option

WithFleet loads one of the preconfigured Status fleets.

func WithLES added in v0.15.1

func WithLES() Option

WithLES enabled LES protocol.

func WithMailserver added in v0.15.1

func WithMailserver() Option

WithMailserver enables MailServer.

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

func (*SwarmConfig) Validate added in v0.15.0

func (c *SwarmConfig) Validate(validate *validator.Validate) error

Validate validates the SwarmConfig struct and returns an error if inconsistent values are found

type UpstreamRPCConfig

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

	// URL sets the rpc upstream host address for communication with
	// a non-local infura endpoint.
	URL string
}

UpstreamRPCConfig stores configuration for upstream rpc connection.

func (*UpstreamRPCConfig) Validate added in v0.15.0

func (c *UpstreamRPCConfig) Validate(validate *validator.Validate) error

Validate validates the UpstreamRPCConfig struct and returns an error if inconsistent values are found

type WhisperConfig

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

	// LightClient should be true if the node should start with an empty bloom filter and not forward messages from other nodes
	LightClient bool

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

	// DataDir is the file system folder Whisper should use for any data storage needs.
	// For instance, MailServer will use this directory to store its data.
	DataDir string

	// MinimumPoW minimum PoW for Whisper messages
	MinimumPoW float64

	// MailServerPassword for symmetric encryption with MailServer.
	// (if no account file selected, then this password is used for symmetric encryption).
	MailServerPassword string

	// MailServerAsymKey is an hex-encoded asymmetric key to decrypt messages sent to MailServer.
	MailServerAsymKey string

	// RateLimit minimum time between queries to mail server per peer
	MailServerRateLimit int

	// MailServerCleanupPeriod time in seconds to wait to run mail server cleanup
	MailServerCleanupPeriod int

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

	// EnableNTPSync enables NTP synchronizations
	EnableNTPSync bool
}

WhisperConfig holds SHH-related configuration

func (*WhisperConfig) String

func (c *WhisperConfig) String() string

String dumps config object as nicely indented JSON

func (*WhisperConfig) Validate added in v0.15.0

func (c *WhisperConfig) Validate(validate *validator.Validate) error

Validate validates the WhisperConfig struct and returns an error if inconsistent values are found

Jump to

Keyboard shortcuts

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