utils

package
v0.9.20 Latest Latest
Warning

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

Go to latest
Published: May 12, 2015 License: LGPL-2.1-or-later, GPL-2.0 Imports: 30 Imported by: 0

Documentation

Overview

This file is part of go-ethereum

go-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

go-ethereum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with go-ethereum.  If not, see <http://www.gnu.org/licenses/>.

*

  • @authors
  • Jeffrey Wilcke <i@jev.io>
  • Viktor Tron <viktor@ethdev.com>

Index

Constants

This section is empty.

Variables

View Source
var (
	// General settings
	DataDirFlag = DirectoryFlag{
		Name:  "datadir",
		Usage: "Data directory to be used",
		Value: DirectoryString{common.DefaultDataDir()},
	}
	ProtocolVersionFlag = cli.IntFlag{
		Name:  "protocolversion",
		Usage: "ETH protocol version (integer)",
		Value: eth.ProtocolVersion,
	}
	NetworkIdFlag = cli.IntFlag{
		Name:  "networkid",
		Usage: "Network Id (integer)",
		Value: eth.NetworkId,
	}
	BlockchainVersionFlag = cli.IntFlag{
		Name:  "blockchainversion",
		Usage: "Blockchain version (integer)",
		Value: core.BlockChainVersion,
	}
	IdentityFlag = cli.StringFlag{
		Name:  "identity",
		Usage: "Custom node name",
	}
	NatspecEnabledFlag = cli.BoolFlag{
		Name:  "natspec",
		Usage: "Enable NatSpec confirmation notice",
	}

	// miner settings
	MinerThreadsFlag = cli.IntFlag{
		Name:  "minerthreads",
		Usage: "Number of miner threads",
		Value: runtime.NumCPU(),
	}
	MiningEnabledFlag = cli.BoolFlag{
		Name:  "mine",
		Usage: "Enable mining",
	}
	EtherbaseFlag = cli.StringFlag{
		Name:  "etherbase",
		Usage: "Public address for block mining rewards. By default the address of your primary account is used",
		Value: "primary",
	}
	GasPriceFlag = cli.StringFlag{
		Name:  "gasprice",
		Usage: "Sets the minimal gasprice when mining transactions",
		Value: new(big.Int).Mul(big.NewInt(10), common.Szabo).String(),
	}

	UnlockedAccountFlag = cli.StringFlag{
		Name:  "unlock",
		Usage: "Unlock the account given until this program exits (prompts for password). '--unlock primary' unlocks the primary account",
		Value: "",
	}
	PasswordFileFlag = cli.StringFlag{
		Name:  "password",
		Usage: "Path to password file to use with options and subcommands needing a password",
		Value: "",
	}

	// logging and debug settings
	LogFileFlag = cli.StringFlag{
		Name:  "logfile",
		Usage: "Send log output to a file",
	}
	VerbosityFlag = cli.IntFlag{
		Name:  "verbosity",
		Usage: "Logging verbosity: 0-6 (0=silent, 1=error, 2=warn, 3=info, 4=core, 5=debug, 6=debug detail)",
		Value: int(logger.InfoLevel),
	}
	LogJSONFlag = cli.StringFlag{
		Name:  "logjson",
		Usage: "Send json structured log output to a file or '-' for standard output (default: no json output)",
		Value: "",
	}
	LogToStdErrFlag = cli.BoolFlag{
		Name:  "logtostderr",
		Usage: "Logs are written to standard error instead of to files.",
	}
	LogVModuleFlag = cli.GenericFlag{
		Name:  "vmodule",
		Usage: "The syntax of the argument is a comma-separated list of pattern=N, where pattern is a literal file name (minus the \".go\" suffix) or \"glob\" pattern and N is a log verbosity level.",
		Value: glog.GetVModule(),
	}
	VMDebugFlag = cli.BoolFlag{
		Name:  "vmdebug",
		Usage: "Virtual Machine debug output",
	}
	BacktraceAtFlag = cli.GenericFlag{
		Name:  "backtrace_at",
		Usage: "If set to a file and line number (e.g., \"block.go:271\") holding a logging statement, a stack trace will be logged",
		Value: glog.GetTraceLocation(),
	}
	PProfEanbledFlag = cli.BoolFlag{
		Name:  "pprof",
		Usage: "Enable the profiling server on localhost",
	}
	PProfPortFlag = cli.IntFlag{
		Name:  "pprofport",
		Usage: "Port on which the profiler should listen",
		Value: 6060,
	}

	// RPC settings
	RPCEnabledFlag = cli.BoolFlag{
		Name:  "rpc",
		Usage: "Enable the JSON-RPC server",
	}
	RPCListenAddrFlag = cli.StringFlag{
		Name:  "rpcaddr",
		Usage: "Listening address for the JSON-RPC server",
		Value: "127.0.0.1",
	}
	RPCPortFlag = cli.IntFlag{
		Name:  "rpcport",
		Usage: "Port on which the JSON-RPC server should listen",
		Value: 8545,
	}
	RPCCORSDomainFlag = cli.StringFlag{
		Name:  "rpccorsdomain",
		Usage: "Domain on which to send Access-Control-Allow-Origin header",
		Value: "",
	}
	// Network Settings
	MaxPeersFlag = cli.IntFlag{
		Name:  "maxpeers",
		Usage: "Maximum number of network peers (network disabled if set to 0)",
		Value: 25,
	}
	MaxPendingPeersFlag = cli.IntFlag{
		Name:  "maxpendpeers",
		Usage: "Maximum number of pending connection attempts (defaults used if set to 0)",
		Value: 0,
	}
	ListenPortFlag = cli.IntFlag{
		Name:  "port",
		Usage: "Network listening port",
		Value: 30303,
	}
	BootnodesFlag = cli.StringFlag{
		Name:  "bootnodes",
		Usage: "Space-separated enode URLs for p2p discovery bootstrap",
		Value: "",
	}
	NodeKeyFileFlag = cli.StringFlag{
		Name:  "nodekey",
		Usage: "P2P node key file",
	}
	NodeKeyHexFlag = cli.StringFlag{
		Name:  "nodekeyhex",
		Usage: "P2P node key as hex (for testing)",
	}
	NATFlag = cli.StringFlag{
		Name:  "nat",
		Usage: "NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>)",
		Value: "any",
	}
	WhisperEnabledFlag = cli.BoolFlag{
		Name:  "shh",
		Usage: "Enable whisper",
	}
	// ATM the url is left to the user and deployment to
	JSpathFlag = cli.StringFlag{
		Name:  "jspath",
		Usage: "JS library path to be used with console and js subcommands",
		Value: ".",
	}
	SolcPathFlag = cli.StringFlag{
		Name:  "solc",
		Usage: "solidity compiler to be used",
		Value: "solc",
	}
)

Functions

func ExportChain added in v0.9.17

func ExportChain(chainmgr *core.ChainManager, fn string) error

func Fatalf added in v0.9.17

func Fatalf(format string, args ...interface{})

Fatalf formats a message to standard output and exits the program.

func FormatTransactionData

func FormatTransactionData(data string) []byte

func GetAccountManager added in v0.9.17

func GetAccountManager(ctx *cli.Context) *accounts.Manager

func GetChain added in v0.9.17

func GetNAT added in v0.9.17

func GetNAT(ctx *cli.Context) nat.Interface

func GetNodeKey added in v0.9.17

func GetNodeKey(ctx *cli.Context) (key *ecdsa.PrivateKey)

func HandleInterrupt

func HandleInterrupt()

go routine that call interrupt handlers in order of registering

func ImportChain added in v0.8.4

func ImportChain(chainmgr *core.ChainManager, fn string) error

func MakeEthConfig added in v0.9.17

func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config

func NewApp added in v0.9.17

func NewApp(version, usage string) *cli.App

NewApp creates an app with sane defaults.

func RegisterInterrupt

func RegisterInterrupt(cb func(os.Signal))

Register interrupt handlers callbacks

func RunInterruptCallbacks

func RunInterruptCallbacks(sig os.Signal)

func StartEthereum

func StartEthereum(ethereum *eth.Ethereum)

func StartEthereumForTest added in v0.9.17

func StartEthereumForTest(ethereum *eth.Ethereum)

func StartPProf added in v0.9.17

func StartPProf(ctx *cli.Context)

func StartRPC added in v0.9.17

func StartRPC(eth *eth.Ethereum, ctx *cli.Context) error

Types

type DirectoryFlag added in v0.9.17

type DirectoryFlag struct {
	cli.GenericFlag
	Name   string
	Value  DirectoryString
	Usage  string
	EnvVar string
}

Custom cli.Flag type which expand the received string to an absolute path. e.g. ~/.ethereum -> /home/username/.ethereum

func (DirectoryFlag) Apply added in v0.9.17

func (self DirectoryFlag) Apply(set *flag.FlagSet)

called by cli library, grabs variable from environment (if in env) and adds variable to flag set for parsing.

func (*DirectoryFlag) Set added in v0.9.17

func (self *DirectoryFlag) Set(value string)

func (DirectoryFlag) String added in v0.9.17

func (self DirectoryFlag) String() string

type DirectoryString added in v0.9.17

type DirectoryString struct {
	Value string
}

Custom type which is registered in the flags library which cli uses for argument parsing. This allows us to expand Value to an absolute path when the argument is parsed

func (*DirectoryString) Set added in v0.9.17

func (self *DirectoryString) Set(value string) error

func (*DirectoryString) String added in v0.9.17

func (self *DirectoryString) String() string

Jump to

Keyboard shortcuts

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