github.com/oskarth/go-ethereum@v1.6.8-0.20191013093314-dac24a9d3494/cmd/swarm/swarm-smoke/main.go (about) 1 // Copyright 2018 The go-ethereum Authors 2 // This file is part of go-ethereum. 3 // 4 // go-ethereum is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // go-ethereum is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. 16 17 package main 18 19 import ( 20 "os" 21 "sort" 22 23 "github.com/ethereum/go-ethereum/log" 24 25 cli "gopkg.in/urfave/cli.v1" 26 ) 27 28 var ( 29 endpoints []string 30 includeLocalhost bool 31 cluster string 32 scheme string 33 filesize int 34 from int 35 to int 36 verbosity int 37 ) 38 39 func main() { 40 41 app := cli.NewApp() 42 app.Name = "smoke-test" 43 app.Usage = "" 44 45 app.Flags = []cli.Flag{ 46 cli.StringFlag{ 47 Name: "cluster-endpoint", 48 Value: "testing", 49 Usage: "cluster to point to (local, open or testing)", 50 Destination: &cluster, 51 }, 52 cli.IntFlag{ 53 Name: "cluster-from", 54 Value: 8501, 55 Usage: "swarm node (from)", 56 Destination: &from, 57 }, 58 cli.IntFlag{ 59 Name: "cluster-to", 60 Value: 8512, 61 Usage: "swarm node (to)", 62 Destination: &to, 63 }, 64 cli.StringFlag{ 65 Name: "cluster-scheme", 66 Value: "http", 67 Usage: "http or https", 68 Destination: &scheme, 69 }, 70 cli.BoolFlag{ 71 Name: "include-localhost", 72 Usage: "whether to include localhost:8500 as an endpoint", 73 Destination: &includeLocalhost, 74 }, 75 cli.IntFlag{ 76 Name: "filesize", 77 Value: 1024, 78 Usage: "file size for generated random file in KB", 79 Destination: &filesize, 80 }, 81 cli.IntFlag{ 82 Name: "verbosity", 83 Value: 1, 84 Usage: "verbosity", 85 Destination: &verbosity, 86 }, 87 } 88 89 app.Commands = []cli.Command{ 90 { 91 Name: "upload_and_sync", 92 Aliases: []string{"c"}, 93 Usage: "upload and sync", 94 Action: cliUploadAndSync, 95 }, 96 { 97 Name: "feed_sync", 98 Aliases: []string{"f"}, 99 Usage: "feed update generate, upload and sync", 100 Action: cliFeedUploadAndSync, 101 }, 102 } 103 104 sort.Sort(cli.FlagsByName(app.Flags)) 105 sort.Sort(cli.CommandsByName(app.Commands)) 106 107 err := app.Run(os.Args) 108 if err != nil { 109 log.Error(err.Error()) 110 } 111 }