main.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. package main
  17. import (
  18. "os"
  19. "sort"
  20. "github.com/ethereum/go-ethereum/log"
  21. cli "gopkg.in/urfave/cli.v1"
  22. )
  23. var (
  24. endpoints []string
  25. includeLocalhost bool
  26. cluster string
  27. scheme string
  28. filesize int
  29. from int
  30. to int
  31. verbosity int
  32. )
  33. func main() {
  34. app := cli.NewApp()
  35. app.Name = "smoke-test"
  36. app.Usage = ""
  37. app.Flags = []cli.Flag{
  38. cli.StringFlag{
  39. Name: "cluster-endpoint",
  40. Value: "prod",
  41. Usage: "cluster to point to (prod or a given namespace)",
  42. Destination: &cluster,
  43. },
  44. cli.IntFlag{
  45. Name: "cluster-from",
  46. Value: 8501,
  47. Usage: "swarm node (from)",
  48. Destination: &from,
  49. },
  50. cli.IntFlag{
  51. Name: "cluster-to",
  52. Value: 8512,
  53. Usage: "swarm node (to)",
  54. Destination: &to,
  55. },
  56. cli.StringFlag{
  57. Name: "cluster-scheme",
  58. Value: "http",
  59. Usage: "http or https",
  60. Destination: &scheme,
  61. },
  62. cli.BoolFlag{
  63. Name: "include-localhost",
  64. Usage: "whether to include localhost:8500 as an endpoint",
  65. Destination: &includeLocalhost,
  66. },
  67. cli.IntFlag{
  68. Name: "filesize",
  69. Value: 1024,
  70. Usage: "file size for generated random file in KB",
  71. Destination: &filesize,
  72. },
  73. cli.IntFlag{
  74. Name: "verbosity",
  75. Value: 1,
  76. Usage: "verbosity",
  77. Destination: &verbosity,
  78. },
  79. }
  80. app.Commands = []cli.Command{
  81. {
  82. Name: "upload_and_sync",
  83. Aliases: []string{"c"},
  84. Usage: "upload and sync",
  85. Action: cliUploadAndSync,
  86. },
  87. {
  88. Name: "feed_sync",
  89. Aliases: []string{"f"},
  90. Usage: "feed update generate, upload and sync",
  91. Action: cliFeedUploadAndSync,
  92. },
  93. }
  94. sort.Sort(cli.FlagsByName(app.Flags))
  95. sort.Sort(cli.CommandsByName(app.Commands))
  96. err := app.Run(os.Args)
  97. if err != nil {
  98. log.Error(err.Error())
  99. }
  100. }