main.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright © 2021 Ettore Di Giacinto <[email protected]>
  2. //
  3. // This program is free software; you can redistribute it and/or modify
  4. // it under the terms of the GNU General Public License as published by
  5. // the Free Software Foundation; either version 2 of the License, or
  6. // (at your option) any later version.
  7. //
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. //
  13. // You should have received a copy of the GNU General Public License along
  14. // with this program; if not, see <http://www.gnu.org/licenses/>.
  15. package main
  16. import (
  17. "os"
  18. "github.com/urfave/cli"
  19. "github.com/mudler/edgevpn/cmd"
  20. internal "github.com/mudler/edgevpn/internal"
  21. "go.uber.org/zap"
  22. )
  23. func main() {
  24. l, _ := zap.NewProduction()
  25. defer l.Sync() // flushes buffer, if any
  26. app := &cli.App{
  27. Name: "edgevpn",
  28. Version: internal.Version,
  29. Author: "Ettore Di Giacinto",
  30. Usage: "edgevpn --config /etc/edgevpn/config.yaml",
  31. Description: "edgevpn uses libp2p to build an immutable trusted blockchain addressable p2p network",
  32. Copyright: cmd.Copyright,
  33. Flags: cmd.MainFlags(),
  34. Commands: []cli.Command{
  35. cmd.Join(l),
  36. cmd.API(l),
  37. cmd.ServiceAdd(l),
  38. cmd.ServiceConnect(l),
  39. },
  40. Action: cmd.Main(l),
  41. }
  42. err := app.Run(os.Args)
  43. if err != nil {
  44. l.Sugar().Fatal(err)
  45. }
  46. }