- .github
- accounts
- build
- cmd
- common
- consensus
- console
- containers
- contracts
-
core
-
asm
-
bloombits
-
constellation-test-keys
-
forkid
-
mps
-
privatecache
-
rawdb
-
state
-
types
-
vm
- .gitignore
- bench_test.go
- block_validator.go
- block_validator_test.go
- blockchain.go
- blockchain_cache_provider_mps_test.go
- blockchain_cache_provider_test.go
- blockchain_insert.go
- blockchain_repair_test.go
- blockchain_sethead_test.go
- blockchain_snapshot_test.go
- blockchain_test.go
- blocks.go
- bloom_indexer.go
- call_helper.go
- chain_indexer.go
- chain_indexer_test.go
- chain_makers.go
- chain_makers_test.go
- config.go
- dao_test.go
- default_psm.go
- default_psm_test.go
- dual_state_test.go
- error.go
- events.go
- evm.go
- gaspool.go
- gen_genesis.go
- gen_genesis_account.go
- genesis.go
- genesis_alloc.go
- genesis_test.go
- headerchain.go
- headerchain_test.go
- mkalloc.go
- multiple_psm.go
- multiple_psm_test.go
- private_state_manager.go
- private_state_test.go
- rlp_test.go
- state_prefetcher.go
- state_prefetcher_private_test.go
- state_processor.go
- state_processor_test.go
- state_transition.go
- state_transition_pmh.go
- state_transition_pmh_test.go
- state_transition_test.go
- tx_cacher.go
- tx_journal.go
- tx_list.go
- tx_list_test.go
- tx_noncer.go
- tx_pool.go
- tx_pool_test.go
- types.go
- upgrade_db_test.go
-
asm
- crypto
- docs
-
eth
-
catalyst
-
downloader
-
ethconfig
-
fetcher
-
filters
-
gasprice
-
protocols
-
tracers
- api.go
- api_backend.go
- api_backend_test.go
- api_test.go
- backend.go
- bloombits.go
- config_test.go
- handler.go
- handler_eth.go
- handler_eth_test.go
- handler_qlight_client.go
- handler_qlight_server.go
- handler_snap.go
- handler_test.go
- peer.go
- peerset.go
- quorum_protocol.go
- state_accessor.go
- sync.go
- sync_test.go
-
catalyst
- ethclient
- ethdb
- ethstats
- event
- extension
- graphql
- internal
-
les
-
checkpointoracle
-
flowcontrol
-
utils
-
vflux
- api.go
- api_backend.go
- api_test.go
- benchmark.go
- bloombits.go
- client.go
- client_handler.go
- commons.go
- costtracker.go
- distributor.go
- distributor_test.go
- enr_entry.go
- fetcher.go
- fetcher_test.go
- handler_test.go
- metrics.go
- odr.go
- odr_requests.go
- odr_test.go
- peer.go
- peer_test.go
- protocol.go
- pruner.go
- pruner_test.go
- request_test.go
- retrieve.go
- server.go
- server_handler.go
- server_requests.go
- servingqueue.go
- state_accessor.go
- sync.go
- sync_test.go
- test_helper.go
- txrelay.go
- ulc.go
- ulc_test.go
-
checkpointoracle
- light
- log
-
metrics
-
exp
-
influxdb
-
librato
-
prometheus
- FORK.md
- LICENSE
- README.md
- config.go
- counter.go
- counter_test.go
- cpu.go
- cpu_disabled.go
- cpu_enabled.go
- cpu_syscall.go
- cpu_windows.go
- debug.go
- debug_test.go
- disk.go
- disk_linux.go
- disk_nop.go
- doc.go
- ewma.go
- ewma_test.go
- gauge.go
- gauge_float64.go
- gauge_float64_test.go
- gauge_test.go
- graphite.go
- graphite_test.go
- healthcheck.go
- histogram.go
- histogram_test.go
- init_test.go
- json.go
- json_test.go
- log.go
- memory.md
- meter.go
- meter_test.go
- metrics.go
- metrics_test.go
- opentsdb.go
- opentsdb_test.go
- registry.go
- registry_test.go
- resetting_sample.go
- resetting_timer.go
- resetting_timer_test.go
- runtime.go
- runtime_cgo.go
- runtime_gccpufraction.go
- runtime_no_cgo.go
- runtime_no_gccpufraction.go
- runtime_test.go
- sample.go
- sample_test.go
- syslog.go
- timer.go
- timer_test.go
- validate.sh
- writer.go
- writer_test.go
-
exp
- miner
- mobile
- multitenancy
- node
- p2p
- params
- permission
-
plugin
-
account
-
gen
-
helloworld
-
initializer
-
qlight
-
security
- api.go
- base.go
- central.go
- central_test.go
- downloader.go
- downloader_test.go
- local_verifier.go
- local_verifier_test.go
- online_verifier.go
- plugin_manager_mockery.go
- plugin_templates.go
- plugin_templates_mockery.go
- service.go
- service_test.go
- settings.go
- settings_test.go
- utils.go
- utils_test.go
- verifier.go
- verifier_test.go
-
account
- private
- qlight
- raft
- rlp
-
rpc
-
testdata
- client.go
- client_example_test.go
- client_test.go
- constants_unix.go
- constants_unix_nocgo.go
- context.go
- doc.go
- endpoints.go
- errors.go
- handler.go
- http.go
- http_test.go
- inproc.go
- ipc.go
- ipc_js.go
- ipc_unix.go
- ipc_windows.go
- json.go
- metrics.go
- security.go
- security_test.go
- server.go
- server_test.go
- service.go
- stdio.go
- subscription.go
- subscription_test.go
- testservice_test.go
- types.go
- types_test.go
- websocket.go
- websocket_test.go
-
testdata
- signer
- swarm
-
tests
-
fuzzers
-
solidity
-
testdata
- block_test.go
- block_test_util.go
- difficulty_test.go
- difficulty_test_util.go
- gen_btheader.go
- gen_difficultytest.go
- gen_stenv.go
- gen_sttransaction.go
- gen_vmexec.go
- init.go
- init_test.go
- rlp_test.go
- rlp_test_util.go
- state_test.go
- state_test_util.go
- transaction_test.go
- transaction_test_util.go
- vm_test.go
- vm_test_util.go
-
fuzzers
- trie
- .bintray.json
- .dockerignore
- .gitattributes
- .gitignore
- .gitmodules
- .golangci.yml
- .mailmap
- .travis.yml
- AUTHORS
- BUILDING.md
- COPYING
- COPYING.LESSER
- Dockerfile
- Dockerfile.alltools
- Makefile
- NOTES.md
- README.md
- SECURITY.md
- appveyor.yml
- circle.yml
- go.mod
- go.sum
- interfaces.go
- logo.png
- mkdocs.yml
- oss-fuzz.sh
Explanation
This code implements a command-line tool for interacting with Ethereum’s devp2p (peer-to-peer) network. It’s a part of the “quorum” project, which provides a private, enterprise-grade blockchain platform based on Ethereum.
Main Function:
main.go
defines the entry point for the CLI application.- It sets up a
cli.App
object (app
) and initializes it with: - Name: The name of the application, derived from the executable filename.
- Usage: A brief description of the application’s purpose.
- Version: The version string, including Git commit and date.
- Flags: A list of global command-line flags, including those related to debugging (
debug.Flags
). - Before & After Hooks: Functions to be executed before and after each command execution. These functions handle debugging setup and cleanup.
- CommandNotFound: Handler for when an invalid command is specified.
- Commands: An array of subcommands, each with its own functionality related to devp2p network components.
Subcommands:
- The
app.Commands
list contains multiple subcommands, each with its own set of functions for interacting with the devp2p network: enrdumpCommand
: A command to dump ENR (Ethereum Node Record) data.keyCommand
: A command to manage and generate keys used for network communication.discv4Command
: A command to interact with the Discovery v4 protocol.discv5Command
: A command to interact with the Discovery v5 protocol.dnsCommand
: A command to interact with DNS-based node discovery.nodesetCommand
: A command to manage and work with lists of nodes.rlpxCommand
: A command for interacting with the RLpx protocol, used for secure communication between nodes.
Helper Functions:
commandHasFlag(ctx *cli.Context, flag cli.Flag)
: Determines if a specific flag is present in the currently executing command’s flags.getNodeArg(ctx *cli.Context)
: A utility function to parse a node descriptor from the command-line arguments, ensuring there’s at least one argument provided and handling potential parsing errors.exit(err interface{})
: A simple function to exit the program with an appropriate exit code, printing any error messages to stderr.
Summary:
This code provides a CLI interface for managing and interacting with various aspects of the Ethereum devp2p network. It offers a collection of subcommands that cater to different functionalities, providing tools for developers and users to manage nodes, discover peers, and interact with different network protocols. The code uses the cli.App
structure from the urfave/cli
library to provide a user-friendly and structured command-line experience.
Graph
The graph shows the usage of functions within the codebase.
Select a code symbol to view it's graph