Documentation ¶
Overview ¶
Package utils contains internal helper functions for go-ethereum commands.
Package utils contains internal helper functions for go-ethereum commands.
Index ¶
- Variables
- func DefaultDataDir() string
- func Fatalf(format string, args ...interface{})
- func GlobalBig(ctx *cli.Context, name string) *big.Int
- func MakeAddress(ks *keystore.KeyStore, account string) (accounts.Account, error)
- func MakePasswordList(ctx *cli.Context) []string
- func NewApp(appVersion, usage string) *cli.App
- func ReadGitCommit() string
- func SetNodeConfig(ctx *cli.Context, cfg *Config)
- type BigFlag
- type Config
- type DirectoryFlag
- type DirectoryString
- type TextMarshaler
- type TextMarshalerFlag
Constants ¶
This section is empty.
Variables ¶
var ( VerbosityFlag = cli.IntFlag{ Name: "verbosity", Usage: "log verbosity (0-9)", Value: int(log.LvlInfo), } // General settings DataDirFlag = DirectoryFlag{ Name: "datadir", Usage: "Data directory for the databases and keystore", Value: DirectoryString{DefaultDataDir()}, } KeyStoreDirFlag = DirectoryFlag{ Name: "keystore", Usage: "Directory for the keystore (default = inside the datadir)", } NetworkIdFlag = cli.Uint64Flag{ Name: "networkid", Usage: "Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten, 4=Rinkeby)", Value: 32659, } TestnetFlag = cli.BoolFlag{ Name: "testnet", Usage: "Ropsten network: pre-configured proof-of-work test network", } DevnetFlag = cli.BoolFlag{ Name: "devnet", Usage: "Develop network: pre-configured proof-of-stake test network", } IdentityFlag = cli.StringFlag{ Name: "identity", Usage: "Custom node name", } DocRootFlag = DirectoryFlag{ Name: "docroot", Usage: "Document Root for HTTPClient file scheme", Value: DirectoryString{homeDir()}, } // Account settings UnlockedAccountFlag = cli.StringFlag{ Name: "unlock", Usage: "Comma separated list of accounts to unlock", Value: "", } PasswordFileFlag = cli.StringFlag{ Name: "password", Usage: "Password file to use for non-interactive password input", Value: "", } // RPC settings RPCEnabledFlag = cli.BoolFlag{ Name: "rpc", Usage: "Enable the HTTP-RPC server", } RPCListenAddrFlag = cli.StringFlag{ Name: "rpcaddr", Usage: "HTTP-RPC server listening interface", Value: "localhost", } RPCPortFlag = cli.IntFlag{ Name: "rpcport", Usage: "HTTP-RPC server listening port", Value: 0, } RPCCORSDomainFlag = cli.StringFlag{ Name: "rpccorsdomain", Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced)", Value: "", } RPCApiFlag = cli.StringFlag{ Name: "rpcapi", Usage: "API's offered over the HTTP-RPC interface", Value: "", } IPCDisabledFlag = cli.BoolFlag{ Name: "ipcdisable", Usage: "Disable the IPC-RPC server", } IPCPathFlag = DirectoryFlag{ Name: "ipcpath", Usage: "Filename for IPC socket/pipe within the datadir (explicit paths escape it)", } WSEnabledFlag = cli.BoolFlag{ Name: "ws", Usage: "Enable the WS-RPC server", } WSListenAddrFlag = cli.StringFlag{ Name: "wsaddr", Usage: "WS-RPC server listening interface", Value: "localhost", } WSPortFlag = cli.IntFlag{ Name: "wsport", Usage: "WS-RPC server listening port", Value: 0, } WSApiFlag = cli.StringFlag{ Name: "wsapi", Usage: "API's offered over the WS-RPC interface", Value: "", } WSAllowedOriginsFlag = cli.StringFlag{ Name: "wsorigins", Usage: "Origins from which to accept websockets requests", Value: "", } JsonFlag = cli.BoolFlag{ Name: "json", Usage: "output log in json format", } )
Functions ¶
func DefaultDataDir ¶
func DefaultDataDir() string
DefaultDataDir is the default data directory to use for the databases and other persistence requirements.
func Fatalf ¶
func Fatalf(format string, args ...interface{})
Fatalf formats a message to standard error and exits the program. The message is also printed to standard output if standard error is redirected to a different file.
func MakeAddress ¶
MakeAddress converts an account specified directly as a hex encoded string or a key index in the key store to an internal account representation.
func MakePasswordList ¶
func MakePasswordList(ctx *cli.Context) []string
MakePasswordList reads password lines from the file specified by the global --password flag.
func NewApp ¶
func NewApp(appVersion, usage string) *cli.App
NewApp creates an app with sane defaults.
func ReadGitCommit ¶
func ReadGitCommit() string
func SetNodeConfig ¶
func SetNodeConfig(ctx *cli.Context, cfg *Config)
SetNodeConfig applies node-related command line flags to the config.
Types ¶
type BigFlag ¶
BigFlag is a command line flag that accepts 256 bit big integers in decimal or hexadecimal syntax.
type Config ¶
func (*Config) AccountConfig ¶
AccountConfig determines the settings for scrypt and keydirectory
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. ~/.ethereum -> /home/username/.ethereum
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