func main() { flag.Parse() nodnodClient := client.NewClient(*flServer) if err := nodnodClient.Connect(); err != nil { log.Fatal("Failed to connect", err) } defer nodnodClient.Disconnect() count := 0 for { if allStats, err := nodnodClient.StatAll(); err != nil { log.Error("Failed to get stats:", err) } else { prettyPrint(allStats) } count++ if *flCount > 0 && count >= *flCount { log.Info("Reached maximum number of requests: ", count) nodnodClient.Disconnect() fmt.Println("Disconnected client.\nBye!") return } time.Sleep(5 * time.Second) } }
func newNode(address string) *Node { return &Node{ address: address, client: client.NewClient(address), } }