utils

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2019 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// General settings
	DataDirFlag = DirectoryFlag{
		Name:  "datadir",
		Usage: "Data directory for the databases and keystore",
		Value: DirectoryString{defaults.DefaultDataDir},
	}

	KeysotreFlag = cli.StringFlag{
		Name:  "keystore",
		Usage: "the keystore file directory",
		Value: defaults.DefaultKeystore,
	}

	ConfigFileFlag = cli.StringFlag{
		Name:  "config",
		Usage: "TOML configuration file",
		Value: defaults.DefaultTOMLConfigPath,
	}

	LogFileFlag = cli.StringFlag{
		Name:  "log",
		Usage: "The path of log file",
		Value: defaults.DefaultLogPath,
	}

	LogLevelFlag = cli.StringFlag{
		Name:  "loglevel",
		Usage: "The level of log [trace | debug | info | warn | error | critical | off]",
		Value: defaults.DefaultLogLevel,
	}

	NodeNameFlag = cli.StringFlag{
		Name:  "nodename",
		Usage: "The name of local node",
		Value: defaults.DefaultNodeName,
	}

	ListenPortFlag = cli.IntFlag{
		Name:  "port",
		Usage: "Network listening port",
		Value: defaults.DefaultNodePort,
	}

	BootNodeUrlFlag = cli.StringFlag{
		Name:  "bootnode",
		Usage: "The url of bootstrap node (bnode://id@ip:port)",
	}

	StaticNodeUrlFlag = cli.StringFlag{
		Name:  "staticnode",
		Usage: "The url of static node (bnode://id@ip:port)",
	}
	//RPC
	HttpModulesFlag = cli.StringFlag{
		Name:  "httpmodules",
		Usage: "A list of API modules to expose via the HTTP RPC interface [bchain,personal,txpool,blockproducer]",
		Value: defaults.DefaultHttpModules,
	}

	HttpPortFlag = cli.IntFlag{
		Name:  "httpport",
		Usage: "The port Rpc listen",
		Value: defaults.DefaultHttpPort,
	}

	HttpHostFlag = cli.StringFlag{
		Name:  "httphost",
		Usage: "The host Rpc listen",
		Value: defaults.DefaultHttpHost,
	}

	StartBlockproducerFlag = cli.BoolFlag{
		Name:  "blockproducer",
		Usage: "The trigger of blockproducer",
	}

	MetricsEnabledFlag = cli.BoolFlag{
		Name:  metrics.MetricsEnabledFlag,
		Usage: "Enable metrics collection and reporting",
	}

	WorkingNetFlag = cli.StringFlag{
		Name:  "net",
		Usage: "A working net(main/beta/alpha) to run. This option is not used in current version",
		Value: defaults.DefaultWorkingNet,
	}

	ResyncBlockFlag = cli.BoolFlag{
		Name:  "resync-block",
		Usage: "Clear chain database and rebuild blockchain.",
	}
)

These are all the command line flags we support. If you add to this list, please remember to include the flag in the appropriate command definition.

The flags are defined here so their names and help texts are the same for all commands.

View Source
var (
	Version = "1.1.1"
)

Functions

func GlobalBig

func GlobalBig(ctx *cli.Context, name string) *big.Int

GlobalBig returns the value of a BigFlag from the global flag set.

func NewApp

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

NewApp creates an app with sane defaults.

Types

type BigFlag

type BigFlag struct {
	Name  string
	Value *big.Int
	Usage string
}

BigFlag is a command line flag that accepts 256 bit big integers in decimal or hexadecimal syntax.

func (BigFlag) Apply

func (f BigFlag) Apply(set *flag.FlagSet)

func (BigFlag) GetName

func (f BigFlag) GetName() string

func (BigFlag) String

func (f BigFlag) String() string

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. ~/.bchain -> /home/username/.bchain

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
}

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

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

func (*DirectoryString) String

func (self *DirectoryString) String() string

type TextMarshaler

type TextMarshaler interface {
	encoding.TextMarshaler
	encoding.TextUnmarshaler
}

func GlobalTextMarshaler

func GlobalTextMarshaler(ctx *cli.Context, name string) TextMarshaler

GlobalTextMarshaler returns the value of a TextMarshalerFlag from the global flag set.

type TextMarshalerFlag

type TextMarshalerFlag struct {
	Name  string
	Value TextMarshaler
	Usage string
}

TextMarshalerFlag wraps a TextMarshaler value.

func (TextMarshalerFlag) Apply

func (f TextMarshalerFlag) Apply(set *flag.FlagSet)

func (TextMarshalerFlag) GetName

func (f TextMarshalerFlag) GetName() string

func (TextMarshalerFlag) String

func (f TextMarshalerFlag) String() string

Jump to

Keyboard shortcuts

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