utils

package
v2.1.2+incompatible Latest Latest
Warning

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

Go to latest
Published: May 21, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Config settings
	ConfigFileFlag = cli.StringFlag{
		Name:  "config",
		Usage: "Json configuration file",
	}

	// General settings
	DataDirFlag = DirectoryFlag{
		Name:  "datadir",
		Usage: "use for store all files",
	}

	KeyStoreDirFlag = DirectoryFlag{
		Name:  "keystore",
		Usage: "Directory for the keystore (default = inside the datadir)",
	}

	// Network Settings
	TestNetFlag = cli.BoolFlag{
		Name:  "testnet",
		Usage: "Ropsten network: pre-configured proof-of-work test network",
	}

	DevNetFlag = cli.BoolFlag{
		Name:  "devnet",
		Usage: "Rinkeby network: pre-configured proof-of-authority dev network",
	}

	MainNetFlag = cli.BoolFlag{
		Name:  "mainnet",
		Usage: "Rinkeby network: pre-configured proof-of-authority prod network",
	}

	IdentityFlag = cli.StringFlag{
		Name:  "identity",
		Usage: "Custom node name",
	}
	NetworkIdFlag = cli.UintFlag{
		Name: "networkid",
		Usage: "Network identifier (integer," +
			" 1=MainNet," +
			" 2=TestNet," +
			" 3~12=DevNet,)",
	}
	MaxPeersFlag = cli.UintFlag{
		Name:  "maxpeers",
		Usage: "Maximum number of network peers (network disabled if set to 0)",
	}
	MaxPendingPeersFlag = cli.UintFlag{
		Name:  "maxpendpeers",
		Usage: "Maximum number of db connection attempts (defaults used if set to 0)",
	}
	ListenPortFlag = cli.IntFlag{
		Name:  "port",
		Usage: "Network listening port",
	}
	NodeKeyHexFlag = cli.StringFlag{
		Name:  "nodekeyhex",
		Usage: "P2P node key as hex",
	}
	DiscoveryFlag = cli.StringFlag{
		Name:  "discovery",
		Usage: "enable p2p discovery or not",
	}

	//IPC Settings
	IPCEnabledFlag = cli.BoolFlag{
		Name:  "ipc",
		Usage: "Enable the IPC-RPC server",
	}
	IPCPathFlag = DirectoryFlag{
		Name:  "ipcpath",
		Usage: "Filename for IPC socket/pipe within the datadir (explicit paths escape it)",
	}

	//HTTP RPC Settings
	RPCEnabledFlag = cli.BoolFlag{
		Name:  "rpc",
		Usage: "Enable the HTTP-RPC server",
	}
	RPCListenAddrFlag = cli.StringFlag{
		Name:  "rpcaddr",
		Usage: "HTTP-RPC server listening interface",
	}
	RPCPortFlag = cli.IntFlag{
		Name:  "rpcport",
		Usage: "HTTP-RPC server listening port",
	}

	//WS Settings
	WSEnabledFlag = cli.BoolFlag{
		Name:  "ws",
		Usage: "Enable the WS-RPC server",
	}
	WSListenAddrFlag = cli.StringFlag{
		Name:  "wsaddr",
		Usage: "WS-RPC server listening interface",
	}
	WSPortFlag = cli.IntFlag{
		Name:  "wsport",
		Usage: "WS-RPC server listening port",
	}

	//Console Settings
	JSPathFlag = cli.StringFlag{
		Name:  "jspath",
		Usage: "JavaScript root path for `loadScript`",
		Value: ".",
	}
	ExecFlag = cli.StringFlag{
		Name:  "exec",
		Usage: "Execute JavaScript statement",
	}
	PreloadJSFlag = cli.StringFlag{
		Name:  "preload",
		Usage: "Comma separated list of JavaScript files to preload into the console",
	}

	//Producer
	MinerFlag = cli.BoolFlag{
		Name:  "miner",
		Usage: "Enable the Miner",
	}

	CoinBaseFlag = cli.StringFlag{
		Name:  "coinbase",
		Usage: "Coinbase is an address into which the rewards for the SuperNode produce snapshot-block",
	}

	MinerIntervalFlag = cli.IntFlag{
		Name:  "minerinterval",
		Usage: "Miner Interval(unit: second)",
	}

	//Log Lvl
	LogLvlFlag = cli.StringFlag{
		Name:  "loglevel",
		Usage: "log level (info,eror,warn,dbug)",
	}

	//VM
	VMTestFlag = cli.BoolFlag{
		Name:  "vmtest",
		Usage: "Enable the VM Test ",
	}
	VMTestParamFlag = cli.BoolFlag{
		Name:  "vmtestparam",
		Usage: "Enable the VM Test params ",
	}
	VMDebugFlag = cli.BoolFlag{
		Name:  "vmdebug",
		Usage: "Enable VM debug",
	}

	// Subscribe
	SubscribeFlag = cli.BoolFlag{
		Name:  "subscribe",
		Usage: "Enable Subscribe",
	}

	// Ledger
	LedgerDeleteToHeight = cli.Uint64Flag{
		Name:  "del",
		Usage: "Delete to height",
	}

	// Trie
	RecoverTrieFlag = cli.BoolFlag{
		Name:  "trie",
		Usage: "Recover trie",
	}

	// Export sb height
	ExportSbHeightFlags = cli.Uint64Flag{
		Name:  "sbHeight",
		Usage: "The snapshot block height",
	}

	//Net
	SingleFlag = cli.BoolFlag{
		Name:  "single",
		Usage: "Enable the NodeServer single ",
	}

	FilePortFlag = cli.IntFlag{
		Name:  "fileport",
		Usage: "File transfer listening port",
	}

	//Stat
	PProfEnabledFlag = cli.BoolFlag{
		Name:  "pprof",
		Usage: "Enable chain performance analysis tool, you can visit the address[http://localhost:8080/debug/pprof]",
	}

	PProfPortFlag = cli.UintFlag{
		Name:  "pprofport",
		Usage: "pporof visit `port`, you can visit the address[http://localhost:`port`/debug/pprof]",
	}

	// Metrics flags
	MetricsEnabledFlag = cli.BoolFlag{
		Name:  "metrics",
		Usage: "Enable metrics collection and reporting",
	}
	InfluxDBEnableFlag = cli.BoolFlag{
		Name:  "metrics.influxdb",
		Usage: "Enable metrics export/push to an external InfluxDB database",
	}
	InfluxDBEndpointFlag = cli.StringFlag{
		Name:  "metrics.influxdb.endpoint",
		Usage: "InfluxDB API endpoint to report metrics to",
	}
	InfluxDBDatabaseFlag = cli.StringFlag{
		Name:  "metrics.influxdb.database",
		Usage: "InfluxDB database name to push reported metrics to",
		Value: "metrics",
	}
	InfluxDBUsernameFlag = cli.StringFlag{
		Name:  "metrics.influxdb.username",
		Usage: "Username to authorize access to the database",
		Value: "test",
	}
	InfluxDBPasswordFlag = cli.StringFlag{
		Name:  "metrics.influxdb.password",
		Usage: "Password to authorize access to the database",
		Value: "test",
	}
	// The `host` tag is part of every measurement sent to InfluxDB. Queries on tags are faster in InfluxDB.
	// It is used so that we can group all nodes and average chain measurement across all of them, but also so
	// that we can select chain specific node and inspect its measurements.
	// https://docs.influxdata.com/influxdb/v1.4/concepts/key_concepts/#tag-key
	InfluxDBHostTagFlag = cli.StringFlag{
		Name:  "metrics.influxdb.host.tag",
		Usage: "InfluxDB `host` tag attached to all measurements",
		Value: "localhost",
	}
)
View Source
var (
	CommandHelpTemplate = `` /* 471-byte string literal not displayed */

)

Functions

func AbsolutePath

func AbsolutePath(datadir string, filename string) string

AbsolutePath returns datadir + filename, or filename if it is absolute.

func MergeFlags

func MergeFlags(flagsSet ...[]cli.Flag) []cli.Flag

merge flags

func MigrateFlags

func MigrateFlags(action func(ctx *cli.Context) error) func(*cli.Context) error

This allows the use of the existing configuration functionality. When all flags are migrated this function can be removed and the existing configuration functionality must be changed that is uses local flags

func SetupMetricsExport added in v1.3.0

func SetupMetricsExport(ctx *cli.Context)

Types

type DirectoryFlag

type DirectoryFlag struct {
	Name  string
	Value DirectoryString
	Usage string
}

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

func (DirectoryFlag) Apply

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) GetName

func (self DirectoryFlag) GetName() string

func (*DirectoryFlag) Set

func (self *DirectoryFlag) Set(value string)

func (DirectoryFlag) String

func (self DirectoryFlag) String() string

type DirectoryString

type DirectoryString struct {
	Value string
}

func (*DirectoryString) Set

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

func (*DirectoryString) String

func (self *DirectoryString) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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