Documentation ¶
Index ¶
- Variables
- func CheckExclusive(ctx *cli.Context, args ...interface{})
- func CheckSetGlobalCfg(ctx *cli.Context) (*node.Config, *you.Config, error)
- func Fatalf(format string, args ...interface{})
- func GetId() string
- func MakeConsolePreloads(jspath, preload string) []string
- func ParseNodes(input []string) []*enode.Node
- func SetMetricsConfig(ctx *cli.Context, cfg *node.MetricsConfig) error
- func SetP2PConfig(ctx *cli.Context, nodeConfig *node.Config) error
- func SetRPCConfig(ctx *cli.Context, cfg *rpc.Config)
- func StartPProf(address string)
Constants ¶
This section is empty.
Variables ¶
var ( BasicFlags = []cli.Flag{ cli.StringFlag{Name: "datadir", Value: nodeCfg.DataDir, Destination: &nodeCfg.DataDir, Usage: "datadir"}, cli.StringFlag{Name: "nodetype", Value: "full", Destination: &nodeCfg.NodeType, Usage: "node type (archive, full, light or ultralight)"}, cli.Uint64Flag{Name: "networkid", Value: nodeCfg.NetworkId, Destination: &nodeCfg.NetworkId, Usage: "Network identifier (unsigned integer, 1=MainNet, 2=PubTestNet, others for specific purpose(develop, self-net etc.))"}, } //miner config MinerFlags = []cli.Flag{ cli.BoolFlag{Name: "mine", Destination: &nodeCfg.MiningEnabled, Usage: "enable mining, default false -> disable "}, cli.StringFlag{Name: "valaddr", Usage: "the address representing a validator key to use", Destination: &nodeCfg.ValAddr}, cli.StringFlag{Name: "pwd", Usage: "the password for the validator key", Destination: &nodeCfg.Password}, cli.BoolFlag{Name: "keep", Usage: "whether to keep the validator key in plaintext ", Destination: &nodeCfg.Keep}, } //consensus flags, mainly for testing or running a new chain ConsFlags = []cli.Flag{ cli.IntFlag{Name: "constype", Value: 0, Destination: &nodeCfg.ConsType, Usage: "consensus type: 0 - YPOS, 1 - Solo"}, cli.StringFlag{Name: "genesis", Usage: "Path to genesis", Destination: &nodeCfg.Genesis}, cli.StringFlag{Name: "uconkey", Destination: &nodeCfg.UConKey}, cli.StringFlag{Name: "blssignkey", Destination: &nodeCfg.BlsSignKey}, cli.DurationFlag{Name: "soloblocktime", Value: 3 * time.Second, Destination: &nodeCfg.SoloBlockTime, Usage: "1s,1000ms"}, } )
var ( RPCGlobalGasCap = cli.Uint64Flag{ Name: "rpc.gascap", Usage: "Sets a cap on gas that can be used in eth_call/estimateGas", } RPCFlags = []cli.Flag{ RPCGlobalGasCap, cli.StringFlag{ Name: "rpc.host", Usage: "HTTP-RPC server listening interface", Value: nodeCfg.RPC.HTTPHost, Destination: &nodeCfg.RPC.HTTPHost, }, cli.IntFlag{ Name: "rpc.port", Usage: "HTTP-RPC server listening port", Value: nodeCfg.RPC.HTTPPort, Destination: &nodeCfg.RPC.HTTPPort, }, cli.StringFlag{ Name: rpcHTTPCorsFlagName, Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced)", Value: strings.Join(nodeCfg.RPC.HTTPCors, ","), }, cli.StringFlag{ Name: rpcHTTPVirtualHostsFlagName, Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.", Value: strings.Join(nodeCfg.RPC.HTTPVirtualHosts, ","), }, cli.StringFlag{ Name: rpcHTTPModulesFlagName, Usage: "API's offered over the HTTP-RPC interface", Value: strings.Join(nodeCfg.RPC.HTTPModules, ","), }, cli.StringFlag{ Name: "rpc.wshost", Usage: "WS-RPC server listening interface", Value: nodeCfg.RPC.WSHost, Destination: &nodeCfg.RPC.WSHost, }, cli.IntFlag{ Name: "rpc.wsport", Usage: "WS-RPC server listening port", Value: nodeCfg.RPC.WSPort, Destination: &nodeCfg.RPC.WSPort, }, cli.StringFlag{ Name: rpcWSModulesFlagName, Usage: "API's offered over the WS-RPC interface", Value: strings.Join(nodeCfg.RPC.WSModules, ","), }, cli.StringFlag{ Name: rpcWSOriginsFlagName, Usage: "Origins from which to accept websockets requests", Value: strings.Join(nodeCfg.RPC.WSOrigins, ","), }, cli.BoolFlag{ Name: "rpc.ipcenabled", Usage: "Enable the IPC-RPC server, default is false", Destination: &nodeCfg.RPC.IPCEnabled, }, cli.StringFlag{ Name: "rpc.ipcpath", Usage: "ipc path, default: youchain.ipc", Destination: &nodeCfg.RPC.IPCPath, }, } )
var ( TxPoolJournalFlag = cli.StringFlag{ Name: "txpool.journal", Usage: "Disk journal for local transaction to survive node restarts", Value: core.DefaultTxPoolConfig.Journal, } TxPoolRejournalFlag = cli.DurationFlag{ Name: "txpool.rejournal", Usage: "Time interval to regenerate the local transaction journal", Value: core.DefaultTxPoolConfig.Rejournal, } TxPoolPriceLimitFlag = cli.Uint64Flag{ Name: "txpool.pricelimit", Usage: "Minimum gas price limit to enforce for acceptance into the pool", Value: params.DefaultMinGasPrice, } TxPoolPriceBumpFlag = cli.Uint64Flag{ Name: "txpool.pricebump", Usage: "Price bump percentage to replace an already existing transaction", Value: you.DefaultConfig.TxPool.PriceBump, } TxPoolAccountSlotsFlag = cli.Uint64Flag{ Name: "txpool.accountslots", Usage: "Minimum number of executable transaction slots guaranteed per account", Value: you.DefaultConfig.TxPool.AccountSlots, } TxPoolGlobalSlotsFlag = cli.Uint64Flag{ Name: "txpool.globalslots", Usage: "Maximum number of executable transaction slots for all accounts", Value: you.DefaultConfig.TxPool.GlobalSlots, } TxPoolAccountQueueFlag = cli.Uint64Flag{ Name: "txpool.accountqueue", Usage: "Maximum number of non-executable transaction slots permitted per account", Value: you.DefaultConfig.TxPool.AccountQueue, } TxPoolGlobalQueueFlag = cli.Uint64Flag{ Name: "txpool.globalqueue", Usage: "Maximum number of non-executable transaction slots for all accounts", Value: you.DefaultConfig.TxPool.GlobalQueue, } TxPoolLifetimeFlag = cli.DurationFlag{ Name: "txpool.lifetime", Usage: "Maximum amount of time non-executable transaction are queued", Value: you.DefaultConfig.TxPool.Lifetime, } TxPoolFlags = []cli.Flag{ TxPoolJournalFlag, TxPoolRejournalFlag, TxPoolPriceLimitFlag, TxPoolPriceBumpFlag, TxPoolAccountSlotsFlag, TxPoolGlobalSlotsFlag, TxPoolAccountQueueFlag, TxPoolGlobalQueueFlag, TxPoolLifetimeFlag, } )
var AppHelpFlagGroups = []flagGroup{ { Name: "Basic", Description: "", Flags: BasicFlags, }, { Name: "Miner", Description: "Options for miner, be cautious about the validator key options, see corresponding document for detail.", Flags: MinerFlags, }, { Name: "Consensus", Description: "These options are mainly for testing or running a new chain.", Flags: ConsFlags, }, { Name: "RPC", Description: "Options for providing rpc services.", Flags: RPCFlags, }, { Name: "P2P", Description: "These options are mainly for P2P.", Flags: P2PFlags, }, { Name: "Metrics", Description: "These options are mainly for debugging.", Flags: MetricsFlags, }, { Name: "TxPool", Description: "These options are mainly for TxPool.", Flags: TxPoolFlags, }, { Name: "DevOp", Description: "These options are mainly for DevOp.", Flags: DevOpFlags, }, }
var AppHelpTemplate = `` /* 1107-byte string literal not displayed */
AppHelpTemplate is the template for the default, global app help topic.
var CliDefaultHelpTemplate string
var ( DevOpFlags = []cli.Flag{ cli.IntFlag{Name: "bootnodeid", Value: -1, Destination: &nodeCfg.BootNodeId, Usage: "bootNodeId"}, cli.StringFlag{Name: "bootuconfile", Destination: &nodeCfg.BootUconFile, Usage: "bootuconfile"}, cli.StringFlag{Name: "bootnodesvcname", Destination: &nodeCfg.BootNodeSvcName, Usage: "boot node service name in k8s"}, } )
var ( MetricsFlags = []cli.Flag{ cli.BoolFlag{Name: "pprof", Destination: &nodeCfg.Metrics.PProf}, cli.StringFlag{Name: "pprof.host", Value: params.DefaultPProfHost, Destination: &nodeCfg.Metrics.PProfHost}, cli.IntFlag{Name: "pprof.port", Value: params.DefaultPProfPort, Destination: &nodeCfg.Metrics.PProfPort}, cli.IntFlag{Name: "log.level", Value: int(logging.LvlInfo), Destination: &nodeCfg.LogLevel}, cli.StringFlag{Name: "log.vmodule", Destination: &nodeCfg.LogVmodule}, cli.StringFlag{Name: "log.path", Destination: &nodeCfg.LogPath}, cli.BoolFlag{Name: "watch", Destination: &nodeCfg.Watch, Usage: "enable watching some more detailed non-consensus data, and will just stored locally in a independent database."}, cli.BoolFlag{Name: "metrics", Destination: &nodeCfg.Metrics.Metrics}, cli.BoolFlag{Name: "metrics.influxdb", Destination: &nodeCfg.Metrics.InfluxDB}, cli.StringFlag{Name: "metrics.influxdb.hostname", Destination: &nodeCfg.Metrics.InfluxDBConfig.Hostname}, cli.StringFlag{Name: "metrics.influxdb.database", Destination: &nodeCfg.Metrics.InfluxDBConfig.Database}, cli.StringFlag{Name: "metrics.influxdb.username", Destination: &nodeCfg.Metrics.InfluxDBConfig.Username}, cli.StringFlag{Name: "metrics.influxdb.password", Destination: &nodeCfg.Metrics.InfluxDBConfig.Password}, } )
var ( P2PFlags = []cli.Flag{ cli.StringFlag{Name: "p2p.bootnode", Usage: "P2P discovery bootstrap", Destination: &nodeCfg.P2PBootNode}, cli.IntFlag{Name: "p2p.port", Value: params.DefaultP2PListenPort, Destination: &nodeCfg.P2pPort, Usage: fmt.Sprintf("Network listening port (default: %d)", params.DefaultP2PListenPort)}, cli.IntFlag{Name: "p2p.discover", Value: params.DefaultP2PDiscoverPort, Destination: &nodeCfg.P2pDiscover, Usage: fmt.Sprintf("P2P discover port (default: %d)", params.DefaultP2PDiscoverPort)}, cli.StringFlag{Name: "p2p.nodekey", Value: "", Destination: &p2pKeyFile, Usage: "P2P node key file"}, cli.StringFlag{Name: "p2p.nodekeyhex", Value: "", Destination: &p2pPrivateKey, Usage: "P2P node key as hex (for testing)"}, cli.IntFlag{Name: "p2p.maxpeers", Value: p2p.DefaultMaxPeers, Destination: &p2pMaxPeers, Usage: fmt.Sprintf("Maximum number of nodes that can be connected (default: %d)", p2p.DefaultMaxPeers)}, cli.IntFlag{Name: "p2p.maxpendpeers", Value: 0, Destination: &p2pMaxPendingPeers, Usage: "Maximum number of pending connection attempts (defaults used if set to 0) (default: 0)"}, cli.BoolFlag{Name: "p2p.msgevent", Destination: &p2pMsgEvents, Usage: "Open the node msg report(true is open, false is close)"}, cli.BoolFlag{Name: "p2p.nodiscovery", Destination: &p2pNoDiscovery, Usage: "Disables the peer discovery mechanism (manual peer addition)"}, cli.BoolFlag{Name: "p2p.localnet", Destination: &p2pLoaclNet, Usage: "The node runs on the local area network"}, cli.StringFlag{Name: "nat.type", Value: "Unknown", Destination: &defaultNatType, Usage: "NAT type, vales:Unknown|None|Full|Restricted|PortRestricted|Symmetric"}, cli.StringFlag{Name: "nat.master", Value: "42.62.25.77:45521", Usage: "NAT master server IP address and port", Destination: &natMasterAddr}, cli.StringFlag{Name: "nat.slave", Value: "42.62.25.79:45523", Usage: "NAT slave server IP address and port", Destination: &natSlaveAddr}, cli.StringFlag{Name: "nat.pubservice", Value: "stun.stunprotocol.org:3478,stun.ekiga.net:3478", Destination: &natPublicService, Usage: "Comma separated list of NAT public detection service addresses"}, } )
var ( PerfTuningFlags = []cli.Flag{ cli.IntFlag{ Name: "cache", Usage: "Megabytes of memory allocated to internal caching (default = 2048 for mainnet full/archive node, 512 for light node and 128 for ultralight node)", Value: 0, Destination: &cache, }, } )
Functions ¶
func CheckExclusive ¶
CheckExclusive verifies that only a single instance of the provided flags was set by the user. Each flag might optionally be followed by a string type to specialize it further.
func CheckSetGlobalCfg ¶
CheckSetGlobalCfg will check and/or set the node config according to global flags, and also do some initialization for some business modules, and then return the final node config
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 MakeConsolePreloads ¶
MakeConsolePreloads retrieves the absolute paths for the console JavaScript scripts to preload before starting.
func ParseNodes ¶
func SetMetricsConfig ¶
func SetMetricsConfig(ctx *cli.Context, cfg *node.MetricsConfig) error
func SetRPCConfig ¶
SetRPCConfig applies rpc-related command line flags to the config.
func StartPProf ¶
func StartPProf(address string)
Types ¶
This section is empty.