Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var TraceCmd = &cobra.Command{ Use: "trace", Short: "Perform a traceroute to a given host", RunE: func(cmd *cobra.Command, args []string) error { logger, err := getLogger() if err != nil { return err } _, cancel := context.WithCancel(context.Background()) defer cancel() go listenExitCommand(logger, cancel) if len(args) < 1 { return errors.New(fmt.Sprintf("%s command requires 1 argument: host", cmd.Name())) } logger.Infof("Starting traceroute for host %s ...", args[0]) options := &traceroute.TracerouteOptions{} options.SetRetries(traceParams.Probes - 1) options.SetMaxHops(traceParams.MaxHops + 1) options.SetFirstHop(traceParams.FirstHop) tracer, err := trace.NewTraceFromHost(args[0], options) if err != nil { return errors.Wrap(err, "error setting up traceroute") } err = tracer.Run() if err != nil { return errors.Wrap(err, "error getting traceroute") } logger.Infof("Node trace:\n%s", tracer.String()) return nil }, }
View Source
var WatchCmd = &cobra.Command{ Use: "monitor", Short: "Monitor BCHD instances to be running at most recent block height", Long: `This command will connect to BCHD instances via gRPC and ensure they are running properly.`, RunE: func(cmd *cobra.Command, args []string) error { logger, err := getLogger() if err != nil { return err } ctx, cancel := context.WithCancel(context.Background()) defer cancel() go listenExitCommand(logger, cancel) monitor := createMonitoringClient(ctx, logger) // start all main workers in separate goroutines var wg sync.WaitGroup if monitor != nil { wg.Add(1) go func() { defer wg.Done() monitor.ListenHttp(ctx) }() } wg.Add(1) go func() { defer wg.Done() watchBchdNodes(ctx, logger, monitor) }() wg.Wait() return nil }, }
Functions ¶
Types ¶
type TraceParams ¶
Click to show internal directories.
Click to hide internal directories.