flags

package
v0.0.0-...-585dd88 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: LGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LanguageFlag = cli.StringFlag{
		Name:  "lang",
		Usage: "Select the language of the GUI",
		Value: "en",
	}
	RemoteIPFlag = cli.StringFlag{
		Name:  "ip",
		Usage: "Remote connection's IP address",
		Value: DefaultConfig.RemoteIP,
	}
	RemoteFTransPortFlag = cli.UintFlag{
		Name:  "ftpport",
		Usage: "Remote connection's port for file transfer protocol",
		Value: DefaultConfig.RemoteFTransPort,
	}
	RemoteRPCPortFlag = cli.UintFlag{
		Name:  "rpcport",
		Usage: "Remote connection's port for http rpc communication",
		Value: DefaultConfig.RemoteRPCPort,
	}
	DataDirFlag = DirectoryFlag{
		Name:  "dir",
		Usage: "Directory for the data storage",
		Value: DefaultConfig.DatasetDir,
	}
	NetworkIdFlag = cli.Uint64Flag{
		Name:  "networkid",
		Usage: "Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten, 4=Rinkeby)",
		Value: DefaultConfig.NetworkId,
	}
	TestnetFlag = cli.BoolFlag{
		Name:  "testnet",
		Usage: "Ropsten network: pre-configured proof-of-work test network",
	}
	RinkebyFlag = cli.BoolFlag{
		Name:  "rinkeby",
		Usage: "Rinkeby network: pre-configured proof-of-authority test network",
	}
	DeveloperFlag = cli.BoolFlag{
		Name:  "dev",
		Usage: "Ephemeral proof-of-authority network with a pre-funded developer account, mining enabled",
	}
	LightModeFlag = cli.BoolFlag{
		Name:  "light",
		Usage: "Enable light client mode",
	}

	// 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,
	}
	UDPListenPortFlag = cli.IntFlag{
		Name:  "udpport",
		Usage: "UDP network listening port",
		Value: 30303,
	}
	NATFlag = cli.StringFlag{
		Name:  "nat",
		Usage: "NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>)",
		Value: "any",
	}
	BootnodesFlag = cli.StringFlag{
		Name:  "bootnodes",
		Usage: "Comma separated enode URLs for P2P discovery bootstrap (set v4+v5 instead for light servers)",
		Value: "",
	}
	BootnodesV4Flag = cli.StringFlag{
		Name:  "bootnodesv4",
		Usage: "Comma separated enode URLs for P2P v4 discovery bootstrap (light server, full nodes)",
		Value: "",
	}
	BootnodesV5Flag = cli.StringFlag{
		Name:  "bootnodesv5",
		Usage: "Comma separated enode URLs for P2P v5 discovery bootstrap (light server, light nodes)",
		Value: "",
	}
	NoDiscoverFlag = cli.BoolFlag{
		Name:  "nodiscover",
		Usage: "Disables the peer discovery mechanism (manual peer addition)",
	}
	DiscoveryV5Flag = cli.BoolFlag{
		Name:  "v5disc",
		Usage: "Enables the experimental RLPx V5 (Topic Discovery) mechanism",
	}
	GuiPortFlag = cli.UintFlag{
		Name:  "guiport",
		Usage: "Connection's port for gui",
		Value: DefaultConfig.GuiPort,
	}
)
View Source
var DefaultConfig = Config{
	NetworkId:        1,
	RemoteIP:         "",
	RemoteFTransPort: 30303,
	RemoteRPCPort:    8545,
	GuiPort:          10309,
}

DefaultConfig contains default settings for use on the Ethereum main net.

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.

func RegisterFTransferService

func RegisterFTransferService(stack *node.Node, cfg *ftransfer.Config, sChan *exporter.ServiceChan)

func SetFTransConfig

func SetFTransConfig(ctx *cli.Context, cfg *ftransfer.Config)

SetFTransConfig applies file-transfer module's flags to the config.

func SetNodeConfig

func SetNodeConfig(ctx *cli.Context, cfg *node.NodeConfig)

SetNodeConfig applies node-related command line flags to the config.

func SetP2PConfig

func SetP2PConfig(ctx *cli.Context, cfg *p2p.ClientCfg)

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 Config

type Config struct {
	// Protocol options
	NetworkId        uint64 // Network ID to use for selecting peers to connect to
	RemoteIP         string // Remote connection's IP address
	RemoteFTransPort uint   // Remote connection's port
	RemoteRPCPort    uint   // Remote http rpc's port
	DatasetDir       DirectoryString
	GuiPort          uint // Connection's port for gui
}

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

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