cmd

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultHostIP   = "0.0.0.0"
	DefaultHostPort = 9050
	DefaultLogLevel = "info"
)
View Source
var ConnectCmd = &cli.Command{
	Name:   "connect",
	Usage:  "connect and identify any given ENR",
	Action: connect,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:        "log-level",
			Aliases:     []string{"v"},
			Usage:       "sets the verbosity of the logs",
			Value:       "info",
			EnvVars:     []string{"RAGNO_LOG_LEVEL"},
			Destination: &connectOptions.lvl,
		},
		&cli.StringFlag{
			Name:        "host-ip",
			Usage:       "IP address of the host",
			Aliases:     []string{"i"},
			Destination: &connectOptions.hostIP,
		},
		&cli.IntFlag{
			Name:        "host-port",
			Usage:       "Port of the host",
			Aliases:     []string{"p"},
			Destination: &connectOptions.hostPort,
		},
		&cli.StringFlag{
			Name:        "enr",
			Usage:       "Enr of the node to connect",
			Aliases:     []string{"e"},
			Required:    true,
			Destination: &connectOptions.enr,
		},
		&cli.DurationFlag{
			Name:        "conn-timeout",
			Usage:       "Timeout in seconds for connection",
			Aliases:     []string{"ct"},
			Required:    true,
			Destination: &connectOptions.connTimeout,
		},
	},
}
View Source
var Discv4Cmd = &cli.Command{
	Name:   "discv4",
	Usage:  "discover4 prints nodes in the discovery4 network",
	Action: discover4,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:        "log-level",
			Aliases:     []string{"v"},
			Usage:       "sets the verbosity of the logs",
			Value:       "info",
			EnvVars:     []string{"RAGNO_LOG_LEVEL"},
			Destination: &discv4Configuration.logLevel,
		},
		&cli.StringFlag{
			Name:        "output",
			Aliases:     []string{"f"},
			Usage:       "path to the file where the output of the file will be flushed",
			Value:       "ragno_crawl.csv",
			EnvVars:     []string{"RAGNO_OUTPUT"},
			Destination: &discv4Configuration.outputFile,
		},
		&cli.IntFlag{
			Name:        "port",
			Aliases:     []string{"p"},
			Usage:       "port that the tool will use for discovery purposes",
			Value:       9045,
			EnvVars:     []string{"RAGNO_PORT"},
			Destination: &discv4Configuration.port,
		},
	},
}
View Source
var RWDeadline time.Duration = 20 * time.Second // for the read and write operations with the remote remoteNodes
View Source
var RunCommand = &cli.Command{
	Name:   "run",
	Usage:  "Run spawns an Ethereum EL crawler and starts discovering and identifying them",
	Action: RunRagno,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:        "log-level",
			Usage:       "Define the log level of the logs it will display on the terminal",
			EnvVars:     []string{"LOG_LEVEL"},
			DefaultText: crawler.DefaultLogLevel,
		},
		&cli.StringFlag{
			Name:        "db-endpoint",
			Usage:       "Endpoint of the database that where the results of the crawl will be stored (needs to be initialized from before)",
			EnvVars:     []string{"DB_URL"},
			DefaultText: crawler.DefaultDBEndpoint,
		},
		&cli.StringFlag{
			Name:        "ip",
			Usage:       "IP that will be assigned to the host",
			EnvVars:     []string{"IP"},
			DefaultText: crawler.DefaultHostIP,
		},
		&cli.IntFlag{
			Name:    "port",
			Usage:   "Port that will be used by the crawler to establish TCP connections with the rest of the network",
			EnvVars: []string{"PORT"},
		},
		&cli.StringFlag{
			Name:        "metrics-ip",
			Usage:       "IP where the metrics of the crawler will be shown into",
			EnvVars:     []string{"METRICS_IP"},
			DefaultText: crawler.DefaultMetricsIP,
		},
		&cli.IntFlag{
			Name:    "metrics-port",
			Usage:   "Port that will be used to expose pprof and prometheus metrics",
			EnvVars: []string{"METRICS_PORT"},
		},
		&cli.StringFlag{
			Name:    "metrics-endpoint",
			Usage:   "Name of the endpoint where metrics will be served",
			EnvVars: []string{"METRICS_ENDPOINT"},
		},
		&cli.StringFlag{
			Name:    "dialers",
			Usage:   "Number of workers that will be used to connect to the nodes",
			Aliases: []string{"cd"},
			EnvVars: []string{"DIALERS"},
		},
		&cli.StringFlag{
			Name:    "persisters",
			Usage:   "Number of workers that will be used to save into the DB",
			Aliases: []string{"cs"},
			EnvVars: []string{"SAVER_NUM"},
		},
		&cli.StringFlag{
			Name:    "conn-timeout",
			Usage:   "Timeout in seconds for peer connection",
			Aliases: []string{"ct"},
			EnvVars: []string{"CONN_TIMEOUT"},
		},
		&cli.StringFlag{
			Name:    "snapshot-interval",
			Usage:   "Time string for how often active_peers snapshots are taken",
			Aliases: []string{"si"},
			EnvVars: []string{"SNAPSHOT_INTERVAL"},
		},
		&cli.StringFlag{
			Name:    "ip-api-url",
			Usage:   "Full template URL for IP API querying",
			Aliases: []string{"ipapi"},
			EnvVars: []string{"IP_API_URL"},
		},
		&cli.StringFlag{
			Name:    "deprecation-time",
			Usage:   "Time threshold for deprecating a node if no connection attempts were succesful",
			Aliases: []string{"dt"},
			EnvVars: []string{"DEPRECATION_TIME"},
		},
	},
}

Functions

func RunRagno

func RunRagno(ctx *cli.Context) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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