diff --git a/Makefile b/Makefile index 25e7212..0151fe3 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ GO_BIN := ${GOPATH}/bin GOBUILD := go build -v -VERSION := v1.2.0 +VERSION := local COMMIT := $(shell git rev-parse HEAD) ifeq ($(OS),Windows_NT) TIMESTAMP := $(shell powershell.exe scripts\get_timestamp.ps1) diff --git a/cmd/proxy/main.go b/cmd/proxy/main.go index c208b90..b93b58c 100644 --- a/cmd/proxy/main.go +++ b/cmd/proxy/main.go @@ -2,76 +2,72 @@ package main import ( "fmt" + "github.com/ExchangeUnion/xud-docker-api/launcher" + "github.com/ExchangeUnion/xud-docker-api/logging" "github.com/ExchangeUnion/xud-docker-api/service" "github.com/docker/docker/pkg/homedir" "github.com/gin-contrib/cors" "github.com/gin-gonic/gin" socketio "github.com/googollee/go-socket.io" - "github.com/joho/godotenv" "github.com/sirupsen/logrus" - "github.com/urfave/cli/v2" + "github.com/spf13/cobra" "net/http" "os" - "path" + "path/filepath" + "strings" ) var ( logger = initLogger() router = initRouter() sioServer *socketio.Server + + port uint16 + tls bool + network string ) func initLogger() *logrus.Entry { logrus.SetLevel(logrus.DebugLevel) - logrus.SetFormatter(&logrus.TextFormatter{ - FullTimestamp: true, + logrus.SetFormatter(&logging.Formatter{ }) logrus.SetOutput(os.Stdout) logger := logrus.NewEntry(logrus.StandardLogger()) return logger } -func initRouter() *gin.Engine { - r := gin.Default() - setupCors(r) - return r +type MyWriter struct { } -type Config struct { - Port int +func (MyWriter) Write(p []byte) (int, error) { + logger.Debugf("%s", strings.TrimSpace(string(p))) + return len(p), nil } -func loadConfig() (*Config, error) { - logger.Debug("Loading config") - - err := godotenv.Load("/root/config.sh") - if err != nil { - logger.Debug("Skip /root/config.sh") - } +func initRouter() *gin.Engine { + r := gin.New() - var port int - - app := &cli.App{ - Flags: []cli.Flag{ - &cli.IntFlag{ - Name: "port, p", - Value: 8080, - }, - }, - Action: func(c *cli.Context) error { - port = c.Int("port") - return nil - }, - } + // Configuring Gin middlewares + //r.Use(ginlogrus.Logger(logrus.StandardLogger())) + //r.Use(gin.LoggerWithWriter(MyWriter{})) + r.Use(logging.LoggerOverLogrus()) + r.Use(gin.Recovery()) - err = app.Run(os.Args) - if err != nil { - logger.Fatal(err) - } + r.NoRoute(func(c *gin.Context) { + if strings.HasPrefix(c.Request.URL.Path, "/api") { + c.JSON(404, gin.H{"message": "not found"}) + } else { + // redirect other non-API requests to ui/index.html to fit SPA requirements + c.File("ui/index.html") + } + }) + r.NoMethod(func(c *gin.Context) { + c.JSON(405, gin.H{"message": "method not allowed"}) + }) - config := Config{Port: port} + setupCors(r) - return &config, nil + return r } func setupCors(r gin.IRouter) { @@ -81,40 +77,20 @@ func setupCors(r gin.IRouter) { // - Credentials share disabled // - Preflight requests cached for 12 hours config := cors.DefaultConfig() - config.AllowOrigins = []string{"https://localhost:3000"} + config.AllowOrigins = []string{"*"} r.Use(cors.New(config)) } -func main() { - - config, err := loadConfig() - if err != nil { - logger.Fatalf("Failed to load config: %s", err) - } - - network := os.Getenv("NETWORK") - - logger.Debug("Creating service manager") - manager, err := service.NewManager(network) +func initSioServer() { + server, err := NewSioServer(network) if err != nil { - logger.Fatalf("Failed to create service manager: %s", err) + logger.Fatal(err) } - defer func() { - err := manager.Close() - if err != nil { - logger.Fatalf("Failed to close service manager: %s", err) - } - }() - server, err := NewSioServer(network) sioServer = server initSioConsole() - if err != nil { - logger.Fatal(err) - } - go func() { err := server.Serve() defer func() { @@ -128,32 +104,76 @@ func main() { } }() - logger.Debug("Creating router") + router.GET("/socket.io/", gin.WrapH(server)) + router.Handle("WS", "/socket.io/", gin.WrapH(server)) +} - r := router +func initLauncherWs() { + router.GET("/launcher", gin.WrapF(launcher.WsHandler)) + router.Handle("WS", "/launcher", gin.WrapF(launcher.WsHandler)) - r.GET("/socket.io/", gin.WrapH(server)) - r.Handle("WS", "/socket.io/", gin.WrapH(server)) + go launcher.StartLauncherRegistry() - r.NoRoute(func(c *gin.Context) { - c.File("ui/index.html") - }) - r.NoMethod(func(c *gin.Context) { - c.JSON(405, gin.H{"message": "method not allowed"}) - }) + launcher.ConfigureRouter(router) +} - logger.Debug("Configuring router") - manager.ConfigureRouter(r) +func initServiceManager() { + logger.Debug("Creating service manager") + manager, err := service.NewManager(network) + if err != nil { + logger.Fatalf("Failed to create service manager: %s", err) + } + defer func() { + err := manager.Close() + if err != nil { + logger.Fatalf("Failed to close service manager: %s", err) + } + }() + + manager.ConfigureRouter(router) +} + +func serve() error { + var err error + + addr := fmt.Sprintf(":%d", port) + logger.Infof("Serving at %s", addr) + + if tls { + certFile := filepath.Join(homedir.Get(), ".proxy", "tls.crt") + keyFile := filepath.Join(homedir.Get(), ".proxy", "tls.key") + err = http.ListenAndServeTLS(addr, certFile, keyFile, router) + } else { + err = http.ListenAndServe(addr, router) + } + if err != nil { + return err + } + return nil +} + +func main() { + var err error - logger.Infof("Serving at :%d", config.Port) - addr := fmt.Sprintf(":%d", config.Port) + network = os.Getenv("NETWORK") + + cmd := &cobra.Command{ + Use: "proxy", + Short: "The API gateway of xud-docker", + } + cmd.PersistentFlags().Uint16VarP(&port, "port", "p", 8080, "The port to listen") + cmd.PersistentFlags().BoolVar(&tls, "tls", false, "Enable TLS support") + err = cmd.Execute() + if err != nil { + logger.Fatalf("Failed to parse command-line options: %s", err) + } - certFile := path.Join(homedir.Get(), ".proxy", "tls.crt") - keyFile := path.Join(homedir.Get(), ".proxy", "tls.key") + initSioServer() + initLauncherWs() + initServiceManager() - err = http.ListenAndServeTLS(addr, certFile, keyFile, r) - //err = http.ListenAndServe(addr, r) + err = serve() if err != nil { - logger.Fatalf("Failed to start the server: %s", err) + logger.Fatalf("Failed to serve: %s", err) } } diff --git a/cmd/proxy/socketio.go b/cmd/proxy/socketio.go index 778f3e6..40573b7 100644 --- a/cmd/proxy/socketio.go +++ b/cmd/proxy/socketio.go @@ -25,22 +25,32 @@ func NewSioServer(network string) (*socketio.Server, error) { logger.Fatal(err) } server.OnConnect("/", func(s socketio.Conn) error { - s.SetContext("") - logger.Infof("[SocketIO] New client connected: ID=%v, RemoteAddr=%v", s.ID(), s.RemoteAddr()) + logger.Debugf("[SocketIO/%s] CONNECT: RemoteAddr=%v", s.ID(), s.RemoteAddr()) + t := s.RemoteHeader().Get("X-Type") + if t != "" { + logger.Debugf("[SocketIO/%s] Type=%s", s.ID(), t) + logger.Debugf("[SocketIO/%s] User-Agent=%s", s.ID(), s.RemoteHeader().Get("User-Agent")) + s.Join("launchers") + s.Emit("welcome! registered launcher id") + } return nil }) server.OnError("/", func(s socketio.Conn, e error) { - removeConsoles(s.ID()) - logger.Errorf("[SocketIO] Client %v got an error: %v", s.ID(), e) + if s != nil { + //removeConsoles(s.ID()) + //logger.Debugf("[SocketIO/%s] ERROR: %s", s.ID(), e) + logger.Debugf("[SocketIO/%v] ERROR: %s", s.ID(), e) + } else { + logger.Debugf("[SocketIO] ERROR: %s", e) + } }) - server.OnDisconnect("/", func(s socketio.Conn, reason string) { removeConsoles(s.ID()) - logger.Infof("[SocketIO] Client %v disconnected: %v", s.ID(), reason) + logger.Infof("[SocketIO/%s] DISCONNECTED: %s", s.ID(), reason) }) server.OnEvent("/", "test", func(s socketio.Conn, data string) { - logger.Debugf("test: %v", data) + logger.Debugf("[SocketIO/%s] TEST: %s", s.ID(), data) }) return server, nil diff --git a/go.mod b/go.mod index 9c952e3..37e093b 100644 --- a/go.mod +++ b/go.mod @@ -4,38 +4,42 @@ go 1.15 require ( github.com/Microsoft/go-winio v0.4.14 // indirect + github.com/containerd/containerd v1.4.3 // indirect github.com/creack/pty v1.1.11 github.com/docker/distribution v2.7.1+incompatible // indirect - github.com/docker/docker v1.13.1 + github.com/docker/docker v20.10.1+incompatible github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.4.0 // indirect github.com/gin-contrib/cors v1.3.1 github.com/gin-gonic/contrib v0.0.0-20201101042839-6a891bf89f19 github.com/gin-gonic/gin v1.6.3 github.com/go-playground/validator/v10 v10.4.1 // indirect + github.com/gogo/protobuf v1.3.1 // indirect github.com/golang/protobuf v1.4.3 github.com/google/uuid v1.1.2 github.com/googollee/go-socket.io v1.4.4 - github.com/joho/godotenv v1.3.0 + github.com/gorilla/mux v1.8.0 // indirect + github.com/gorilla/websocket v1.4.2 github.com/json-iterator/go v1.1.10 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/leodido/go-urn v1.2.1 // indirect + github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 // indirect + github.com/morikuni/aec v1.0.0 // indirect github.com/onsi/gomega v1.10.2 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/runc v0.1.1 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/sirupsen/logrus v1.6.0 - github.com/smartystreets/goconvey v1.6.4 // indirect - github.com/stretchr/testify v1.6.1 // indirect - github.com/ugorji/go v1.1.13 // indirect - github.com/urfave/cli/v2 v2.2.0 + github.com/opencontainers/image-spec v1.0.1 // indirect + github.com/sirupsen/logrus v1.7.0 + github.com/spf13/cobra v1.1.1 + github.com/toorop/gin-logrus v0.0.0-20200831135515-d2ee50d38dae // indirect + github.com/ugorji/go v1.2.2 // indirect github.com/ybbus/jsonrpc v2.1.2+incompatible - golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect - golang.org/x/sys v0.0.0-20201106081118-db71ae66460a // indirect + golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect + golang.org/x/sys v0.0.0-20201223074533-0d417f636930 // indirect + golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 // indirect google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 google.golang.org/grpc v1.32.0 - google.golang.org/protobuf v1.25.0 // indirect + google.golang.org/protobuf v1.25.0 gopkg.in/ini.v1 v1.61.0 gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect + gotest.tools/v3 v3.0.3 // indirect ) diff --git a/go.sum b/go.sum index b438b52..80a6a82 100644 --- a/go.sum +++ b/go.sum @@ -1,22 +1,56 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/containerd/containerd v1.4.3 h1:ijQT13JedHSHrQGWFcGEwzcNKrAGIiZ+jSD5QQG07SY= +github.com/containerd/containerd v1.4.3/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v1.13.1 h1:IkZjBSIc8hBjLpqeAbeE5mca5mNgeatLHBy3GO78BWo= -github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v20.10.1+incompatible h1:u0HIBLwOJdemyBdTCkoBX34u3lb5KyBo0rQE3a5Yg+E= +github.com/docker/docker v20.10.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= @@ -25,8 +59,10 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/cors v1.3.1 h1:doAsuITavI4IOcd0Y19U4B+O0dNWihRyX//nn4sEmgA= github.com/gin-contrib/cors v1.3.1/go.mod h1:jjEJ4268OPZUcU7k9Pm653S7lXUGcqMADzFA61xsmDk= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= @@ -36,6 +72,10 @@ github.com/gin-gonic/contrib v0.0.0-20201101042839-6a891bf89f19/go.mod h1:iqneQ2 github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= @@ -48,9 +88,18 @@ github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1 github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= @@ -65,6 +114,8 @@ github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0 github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -72,28 +123,67 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googollee/go-socket.io v1.4.4 h1:UWOy//wzcT1ENMDeeVsrXwcCY49XOvC/YHVMZJDfy9M= github.com/googollee/go-socket.io v1.4.4/go.mod h1:2lMkHRm5GLg158lACi6Zj6535AQaXuyA+IKbfqKzTOM= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= -github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -104,11 +194,28 @@ github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= +github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 h1:rzf0wL0CHVc8CEsgyygG0Mn9CNCCPZqOPaz8RiiHYQk= +github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= @@ -117,8 +224,12 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLD github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1 h1:mFwc4LvZ0xpSvDZ3E+k8Yte0hLOMxXUlP+yXtJqkYfQ= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= @@ -127,25 +238,54 @@ github.com/onsi/gomega v1.10.2 h1:aY/nuoWlKJud2J6U0E3NWsjlg+0GtwXxgEqthRdzlcs= github.com/onsi/gomega v1.10.2/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/runc v0.1.1 h1:GlxAyO6x8rfZYN9Tt0Kti5a/cP41iuiO2yYT0IJGY8Y= -github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= +github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v1.1.1 h1:KfztREH0tPxJJ+geloSLaAkaPkr4ki2Er5quFV1TDo4= +github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -156,80 +296,166 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/toorop/gin-logrus v0.0.0-20200831135515-d2ee50d38dae h1:xdTAPwtD7sc/YJVgFWn6lfdc9EGGaXKTBf2YN3dXU2c= +github.com/toorop/gin-logrus v0.0.0-20200831135515-d2ee50d38dae/go.mod h1:X3Dd1SB8Gt1V968NTzpKFjMM6O8ccta2NPC6MprOxZQ= github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go v1.1.13 h1:nB3O5kBSQGjEQAcfe1aLUYuxmXdFKmYgBZhY32rQb6Q= -github.com/ugorji/go v1.1.13/go.mod h1:jxau1n+/wyTGLQoCkjok9r5zFa/FxT6eI5HiHKQszjc= +github.com/ugorji/go v1.2.2 h1:60ZHIOcsJlo3bJm9CbTVu7OSqT2mxaEmyQbK2NwCkn0= +github.com/ugorji/go v1.2.2/go.mod h1:bitgyERdV7L7Db/Z5gfd5v2NQMNhhiFiZwpgMw2SP7k= github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ugorji/go/codec v1.1.13 h1:013LbFhocBoIqgHeIHKlV4JWYhqogATYWZhIcH0WHn4= -github.com/ugorji/go/codec v1.1.13/go.mod h1:oNVt3Dq+FO91WNQ/9JnHKQP2QJxTzoN7wCBFCq1OeuU= -github.com/urfave/cli/v2 v2.2.0 h1:JTTnM6wKzdA0Jqodd966MVj4vWbbquZykeX1sKbe2C4= -github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= +github.com/ugorji/go/codec v1.2.2 h1:08Gah8d+dXj4cZNUHhtuD/S4PXD5WpVbj5B8/ClELAQ= +github.com/ugorji/go/codec v1.2.2/go.mod h1:OM8g7OAy52uYl3Yk+RE/3AS1nXFn1Wh4PPLtupCxbuU= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/ybbus/jsonrpc v2.1.2+incompatible h1:V4mkE9qhbDQ92/MLMIhlhMSbz8jNXdagC3xBR5NDwaQ= github.com/ybbus/jsonrpc v2.1.2+incompatible/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY= +golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7 h1:AeiKBIuRw3UomYXSbLy0Mc2dDLfdtbT/IVn4keq83P0= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b h1:ag/x1USPSsqHud38I9BAC88qdNLDHHtQ4mlgQIZPPNA= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201106081118-db71ae66460a h1:ALUFBKlIyeY7y5ZgPJmblk/vKz+zBQSnNiPkt41sgeg= -golang.org/x/sys v0.0.0-20201106081118-db71ae66460a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201223074533-0d417f636930 h1:vRgIt+nup/B/BwIS0g2oC0haq0iqbV3ZA+u6+0TlNCo= +golang.org/x/sys v0.0.0-20201223074533-0d417f636930/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 h1:Hir2P/De0WpUhtrKGGjvSb2YxUgyZ7EFOSLIcSSpiwE= +golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= @@ -245,18 +471,24 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.61.0 h1:LBCdW4FmFYL4s/vDZD1RQYX7oAR6IjujCYgMdbHBR10= gopkg.in/ini.v1 v1.61.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -268,5 +500,12 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= +gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0= +gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/launcher/api.go b/launcher/api.go new file mode 100644 index 0000000..2cdbb84 --- /dev/null +++ b/launcher/api.go @@ -0,0 +1,44 @@ +package launcher + +import ( + "github.com/ExchangeUnion/xud-docker-api/utils" + "github.com/gin-gonic/contrib/static" + "github.com/gin-gonic/gin" + "net/http" +) + +func ConfigureRouter(r *gin.Engine) { + r.Use(static.Serve("/", static.LocalFile("/ui", false))) + + api := r.Group("/api") + { + api.GET("/v1/info", func(c *gin.Context) { + info, err := GetInfo() + if err != nil { + utils.JsonError(c, err.Error(), http.StatusInternalServerError) + return + } + c.JSON(http.StatusOK, info) + }) + api.PUT("/v1/backup", func(c *gin.Context) { + var settings BackupSettings + err := c.BindJSON(&settings) + if err != nil { + utils.JsonError(c, err.Error(), http.StatusBadRequest) + } + ok, err := UpdateBackup(settings) + if ok { + c.Status(http.StatusNoContent) + } + if err != nil { + utils.JsonError(c, err.Error(), http.StatusBadRequest) + } else { + utils.JsonError(c, "", http.StatusBadRequest) + } + }) + api.GET("/v1/launcher/setup-status", func(c *gin.Context) { + + }) + } +} + diff --git a/launcher/ws.go b/launcher/ws.go new file mode 100644 index 0000000..6594f17 --- /dev/null +++ b/launcher/ws.go @@ -0,0 +1,207 @@ +package launcher + +import ( +"encoding/json" +"fmt" +"github.com/gorilla/websocket" + "github.com/sirupsen/logrus" + "net/http" +) + +var ( + wsUpgrader = websocket.Upgrader{ + ReadBufferSize: 1024, + WriteBufferSize: 1024, + } + + launchers []*Launcher + requests = make(chan LauncherRequest) + + logger *logrus.Entry + + errNoLauncher = fmt.Errorf("no launcher") +) + +func init() { + logrus.SetLevel(logrus.DebugLevel) + logger = logrus.NewEntry(logrus.StandardLogger()).WithField("name", "launcher") +} + +type RequestHandler interface { + HandleResponse(resp *Response) +} + +type Launcher struct { + conn *websocket.Conn + + counter uint16 + requests map[uint16]chan Response +} + +type Request struct { + Id uint16 `json:"id"` + Method string `json:"method"` + Params []string `json:"params"` +} + +type Response struct { + Id uint16 `json:"id"` + Result string `json:"result"` + Error interface{} `json:"error"` +} + +type LauncherRequest struct { + Launcher *Launcher + Request *Request +} + +type Info struct { + Test string `json:"test"` +} + +func WsHandler(w http.ResponseWriter, r *http.Request) { + conn, err := wsUpgrader.Upgrade(w, r, nil) + if err != nil { + logger.Errorf("Failed to set websocket upgrade: %+v", err) + return + } + + logger.Debugf("New launcher attached. Launchers = %d", len(launchers)) + + launcher := Launcher{ + conn: conn, + counter: 0, + requests: make(map[uint16]chan Response), + } + + launchers = append(launchers, &launcher) + + go launcher.Listen() +} + +func StartLauncherRegistry() { + for { + req := <-requests + logger.Debugf("launcher %v request %v", req.Launcher, req.Request) + } +} + +func GetInfo() (interface{}, error) { + if len(launchers) == 0 { + return nil, errNoLauncher + } + return launchers[0].GetInfo() +} + +func (t *Launcher) GetInfo() (*json.RawMessage, error){ + t.counter += 1 + req := Request{ + Id: t.counter, + Method: "getinfo", + Params: []string{}, + } + payload, err := json.Marshal(req) + if err != nil { + return nil, err + } + t.conn.WriteMessage(websocket.TextMessage, payload) + + respChan := make(chan Response) + + t.requests[req.Id] = respChan + + resp := <-respChan + + close(respChan) + delete(t.requests, req.Id) + + var info json.RawMessage + + err = json.Unmarshal([]byte(resp.Result), &info) + if err != nil { + return nil, err + } + + return &info, nil +} + +type BackupSettings struct { + Location string +} + +func UpdateBackup(settings BackupSettings) (bool, error) { + if len(launchers) == 0 { + return false, errNoLauncher + } + return launchers[0].UpdateBackup(settings) +} + +func (t *Launcher) UpdateBackup(settings BackupSettings) (bool, error) { + t.counter += 1 + req := Request{ + Id: t.counter, + Method: "backupto", + Params: []string{settings.Location}, + } + payload, err := json.Marshal(req) + if err != nil { + return false, err + } + t.conn.WriteMessage(websocket.TextMessage, payload) + + respChan := make(chan Response) + + t.requests[req.Id] = respChan + + resp := <-respChan + + close(respChan) + delete(t.requests, req.Id) + + if resp.Error == nil { + return true, nil + } + + return false, fmt.Errorf("%s", resp.Error) +} + + +func (t *Launcher) Listen() { + for { + msgType, msg, err := t.conn.ReadMessage() + if err != nil { + logger.Debugf("Failed to listen for messages from launcher: %s", err) + // remove launcher from launchers + for i, launcher := range launchers { + if launcher == t { + launchers = append(launchers[:i], launchers[i+1:]...) + } + } + break + } + if msgType == websocket.TextMessage { + logger.Debugf("[Attach] Got text message: %s", string(msg)) + var resp Response + err = json.Unmarshal(msg, &resp) + if err != nil { + + var req Request + err = json.Unmarshal(msg, &req) + if err != nil { + logrus.Debugf("Failed to parse message: %s", err) + } + + logger.Debugf("[Attach] The message is a request") + requests <- LauncherRequest{Launcher: t, Request: &req} + + } else { + + logger.Debugf("[Attach] The message is a response") + t.requests[resp.Id] <- resp + + } + } else { + logger.Debugf("[Attach] Got non-text message: %v", msg) + } + } +} diff --git a/logging/formatter.go b/logging/formatter.go new file mode 100644 index 0000000..fc87ad3 --- /dev/null +++ b/logging/formatter.go @@ -0,0 +1,39 @@ +package logging + +import ( + "bytes" + "fmt" + "github.com/sirupsen/logrus" + "strings" +) + +type Formatter struct { +} + +func (f *Formatter) Format(entry *logrus.Entry) ([]byte, error) { + data := make(logrus.Fields) + for k, v := range entry.Data { + data[k] = v + } + + var b *bytes.Buffer + if entry.Buffer != nil { + b = entry.Buffer + } else { + b = &bytes.Buffer{} + } + + name := data["name"] + if name == nil { + name = "" + } + + b.WriteString(fmt.Sprintf("%s [%-5s] %-36s: %s\n", + entry.Time.Format("2006-01-02 15:04:05.000"), + strings.ToUpper(entry.Level.String()), + name, + entry.Message, + )) + + return b.Bytes(), nil +} diff --git a/logging/gin.go b/logging/gin.go new file mode 100644 index 0000000..ddd1fe9 --- /dev/null +++ b/logging/gin.go @@ -0,0 +1,35 @@ +package logging + +import ( + "fmt" + "github.com/gin-gonic/gin" + "github.com/sirupsen/logrus" + "math" + "time" +) + +func LoggerOverLogrus() gin.HandlerFunc { + + return func(c *gin.Context) { + path := c.Request.URL.Path + start := time.Now() + + c.Next() + + statusCode := c.Writer.Status() + stop := time.Since(start) + latency := int(math.Ceil(float64(stop.Nanoseconds()) / 1000000.0)) + clientIp := c.ClientIP() + method := c.Request.Method + + logger := logrus.NewEntry(logrus.StandardLogger()).WithFields(logrus.Fields{ + "name": "gin", + "statusCode": statusCode, + "latency": latency, + "clientIp": clientIp, + "method": method, + "path": path, + }) + logger.Debugf(fmt.Sprintf("[%s] %s %s | %d | %dms", clientIp, method, path, statusCode, latency)) + } +} \ No newline at end of file diff --git a/rpc/conn.go b/rpc/conn.go new file mode 100644 index 0000000..a96d8f5 --- /dev/null +++ b/rpc/conn.go @@ -0,0 +1,7 @@ +package rpc + +type Conn interface { + GetClient() interface{} + Open() + Close() error +} diff --git a/rpc/grpc.go b/rpc/grpc.go new file mode 100644 index 0000000..8d1719e --- /dev/null +++ b/rpc/grpc.go @@ -0,0 +1,168 @@ +package rpc + +import ( + "context" + "encoding/hex" + "fmt" + "github.com/sirupsen/logrus" + "google.golang.org/grpc" + "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/credentials" + "io/ioutil" + "os" + "sync" + "time" +) + +// MacaroonCredential implements the credentials.PerRPCCredentials interface. +type MacaroonCredential string + +// GetRequestMetadata implements the PerRPCCredentials interface. This method +// is required in order to pass the wrapped macaroon into the gRPC context. +// With this, the macaroon will be available within the request handling scope +// of the ultimate gRPC server implementation. +func (t MacaroonCredential) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) { + data, err := ioutil.ReadFile(string(t)) + if err != nil { + return nil, err + } + md := make(map[string]string) + md["macaroon"] = hex.EncodeToString(data) + return md, nil +} + +// RequireTransportSecurity implements the PerRPCCredentials interface. +func (t MacaroonCredential) RequireTransportSecurity() bool { + return true +} + +type GrpcConn struct { + host string + port uint16 + tlsCert string + macaroon string + + conn *grpc.ClientConn + mutex *sync.RWMutex + client interface{} + + newClientFunc func(*grpc.ClientConn) interface{} + + logger *logrus.Entry +} + +func NewGrpcConn(host string, port uint16, tlsCert string, macaroon string, logger *logrus.Entry, newClientFunc func(*grpc.ClientConn) interface{}) *GrpcConn { + conn := &GrpcConn{ + host: host, + port: port, + tlsCert: tlsCert, + macaroon: macaroon, + + conn: nil, + mutex: &sync.RWMutex{}, + client: nil, + + newClientFunc: newClientFunc, + + logger: logger, + } + + return conn +} + +func (t *GrpcConn) Update(host string, port uint16, tlsCert string, macaroon string) error { + // TODO update when tlsCert or macaroon file changed + t.host = host + t.port = port + t.tlsCert = tlsCert + t.macaroon = macaroon + + if err := t.reopen(); err != nil { + return err + } + + return nil +} + +func (t *GrpcConn) reopen() error { + if err := t.Close(); err != nil { + return err + } + t.Open() + return nil +} + +func (t *GrpcConn) Open() { + for { + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + err := t.connect(ctx) + cancel() + if err == nil { + break + } + t.logger.Debugf("Failed to establish gRPC connection: %s", err) + time.Sleep(3 * time.Second) + } +} + +func (t *GrpcConn) connect(ctx context.Context) error { + creds, err := credentials.NewClientTLSFromFile(t.tlsCert, "localhost") + if err != nil { + return err + } + + var opts []grpc.DialOption + opts = append(opts, grpc.WithTransportCredentials(creds)) + opts = append(opts, grpc.WithBlock()) + + if t.macaroon != "" { + if _, err := os.Stat(t.macaroon); os.IsNotExist(err) { + return err + } + macaroonCred := MacaroonCredential(t.macaroon) + opts = append(opts, grpc.WithPerRPCCredentials(&macaroonCred)) + } + + addr := fmt.Sprintf("%s:%d", t.host, t.port) + + t.logger.Debugf("Establishing gRPC connection to %s (tlsCert=%s, macaroon=%s)", addr, t.tlsCert, t.macaroon) + conn, err := grpc.DialContext(ctx, addr, opts...) + if err != nil { + return err + } + t.logger.Debugf("Established gRPC connection") + + go func() { + changed := conn.WaitForStateChange(ctx, connectivity.Ready) + if changed { + t.logger.Debugf("gRPC connection broken: %s", conn.GetState()) + } + }() + + t.mutex.Lock() + t.conn = conn + t.client = t.newClientFunc(conn) + t.mutex.Unlock() + + return nil +} + +func (t *GrpcConn) Close() error { + t.mutex.Lock() + defer t.mutex.Unlock() + if t.conn != nil { + err := t.conn.Close() + if err != nil { + return err + } + t.conn = nil + t.client = nil + } + return nil +} + +func (t *GrpcConn) GetClient() interface{} { + t.mutex.RLock() + defer t.mutex.RUnlock() + return t.client +} \ No newline at end of file diff --git a/rpc/http.go b/rpc/http.go new file mode 100644 index 0000000..52876f3 --- /dev/null +++ b/rpc/http.go @@ -0,0 +1,5 @@ +package rpc + +type HttpConn struct { + +} \ No newline at end of file diff --git a/rpc/jsonrpc.go b/rpc/jsonrpc.go new file mode 100644 index 0000000..cf09c17 --- /dev/null +++ b/rpc/jsonrpc.go @@ -0,0 +1,5 @@ +package rpc + +type JsonrpcConn struct { + +} diff --git a/service/boltz/boltz.go b/service/boltz/boltz.go index 22e5459..8995222 100644 --- a/service/boltz/boltz.go +++ b/service/boltz/boltz.go @@ -64,6 +64,7 @@ func (t *Service) checkNode(node Node) NodeStatus { if err == nil { return NodeStatus{Status: string(node) + " up", IsUp: true} } else { + t.logger.Errorf("get info: %s", err) return NodeStatus{Status: string(node) + " down", IsUp: false} } } diff --git a/service/boltz/rpc.go b/service/boltz/rpc.go index 96cac51..5ea84ac 100644 --- a/service/boltz/rpc.go +++ b/service/boltz/rpc.go @@ -5,162 +5,67 @@ import ( "errors" "fmt" "github.com/ExchangeUnion/xud-docker-api/config" + "github.com/ExchangeUnion/xud-docker-api/rpc" pb "github.com/ExchangeUnion/xud-docker-api/service/boltz/boltzrpc" "github.com/ExchangeUnion/xud-docker-api/service/core" "github.com/sirupsen/logrus" "google.golang.org/grpc" - "google.golang.org/grpc/credentials" - "os" "strings" - "sync" - "time" -) - -const ( - RpcRetryDelay = 3 * time.Second ) var ( - NoClient = errors.New("no client") + errNoClient = errors.New("no client") ) type RpcClient struct { - btcConn *grpc.ClientConn - ltcConn *grpc.ClientConn - btcClient pb.BoltzClient - ltcClient pb.BoltzClient - btcMutex *sync.RWMutex - ltcMutex *sync.RWMutex + btcConn *rpc.GrpcConn + ltcConn *rpc.GrpcConn logger *logrus.Entry service *core.SingleContainerService } -type GrpcParams struct { - Host string - Port uint16 - TlsCert string - Macaroon string -} - -func parseGrpcParams(config map[string]interface{}) GrpcParams { - var p GrpcParams - - p.Host = config["host"].(string) - p.Port = uint16(config["port"].(float64)) - p.TlsCert = config["tlsCert"].(string) - p.Macaroon = config["macaroon"].(string) +func newGrpcConn(config map[string]interface{}, logger *logrus.Entry) *rpc.GrpcConn { + host := config["host"].(string) + port := uint16(config["port"].(float64)) + tlsCert := config["tlsCert"].(string) + macaroon := config["macaroon"].(string) - return p + conn := rpc.NewGrpcConn(host, port, tlsCert, macaroon, logger, func(conn *grpc.ClientConn) interface{} { + return pb.NewBoltzClient(conn) + }) + return conn } func NewRpcClient(config config.RpcConfig, service *core.SingleContainerService) *RpcClient { bitcoin := config["bitcoin"].(map[string]interface{}) litecoin := config["litecoin"].(map[string]interface{}) - btcParams := parseGrpcParams(bitcoin) - ltcParams := parseGrpcParams(litecoin) + logger := service.GetLogger().WithField("name", fmt.Sprintf("service.%s.rpc", service.GetName())) + + btcConn := newGrpcConn(bitcoin, logger) + ltcConn := newGrpcConn(litecoin, logger) + + go btcConn.Open() + go ltcConn.Open() c := &RpcClient{ - btcConn: nil, - ltcConn: nil, - btcClient: nil, - ltcClient: nil, - btcMutex: &sync.RWMutex{}, - ltcMutex: &sync.RWMutex{}, - - logger: service.GetLogger().WithField("scope", "RPC"), + btcConn: btcConn, + ltcConn: ltcConn, + logger: logger, service: service, } - go c.lazyInit(btcParams, ltcParams) - return c } -func (t *RpcClient) createClient( - client *pb.BoltzClient, - _conn **grpc.ClientConn, - mutex *sync.RWMutex, - params GrpcParams, -) { - for { - creds, err := credentials.NewClientTLSFromFile(params.TlsCert, "localhost") - if err != nil { - t.logger.Warnf("Failed to create gRPC TLS credentials: %s", err) - time.Sleep(RpcRetryDelay) - continue - } - - var opts []grpc.DialOption - opts = append(opts, grpc.WithTransportCredentials(creds)) - opts = append(opts, grpc.WithBlock()) - - if _, err := os.Stat(params.Macaroon); os.IsNotExist(err) { - t.logger.Warnf("Waiting for %s", params.Macaroon) - time.Sleep(RpcRetryDelay) - continue - } - - opts = append(opts, grpc.WithPerRPCCredentials(&MacaroonCredential{Admin: params.Macaroon})) - - t.logger.Debug("Waiting for a running container") - t.service.WaitContainerRunning() - - addr := fmt.Sprintf("%s:%d", params.Host, params.Port) - t.logger.Debugf("Trying to connect with addr=%s", addr) - - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - conn, err := grpc.DialContext(ctx, addr, opts...) - cancel() // prevent context resource leak - if err != nil { - t.logger.Warnf("Failed to create gRPC connection: %s", err) - time.Sleep(RpcRetryDelay) - continue - } - - t.logger.Debugf("Created gRPC connection") - - *_conn = conn - - mutex.Lock() - *client = pb.NewBoltzClient(conn) - mutex.Unlock() - - break - } -} - -func (t *RpcClient) lazyInit(btcParams GrpcParams, ltcParams GrpcParams) { - var wg sync.WaitGroup - wg.Add(2) - - go func() { - t.createClient(&t.btcClient, &t.btcConn, t.btcMutex, btcParams) - wg.Done() - }() - - go func() { - t.createClient(&t.ltcClient, &t.ltcConn, t.ltcMutex, ltcParams) - wg.Done() - }() - - wg.Wait() -} - func (t *RpcClient) Close() error { - var err error - - err = t.btcConn.Close() - if err != nil { + if err := t.btcConn.Close(); err != nil { return err } - - err = t.ltcConn.Close() - if err != nil { + if err := t.ltcConn.Close(); err != nil { return err } - return nil } @@ -169,18 +74,14 @@ func (t *RpcClient) getRpcClient(currency string) (pb.BoltzClient, error) { var client pb.BoltzClient switch currency { case "btc": - t.btcMutex.RLock() - defer t.btcMutex.RUnlock() - client = t.btcClient + client = t.btcConn.GetClient().(pb.BoltzClient) case "ltc": - t.ltcMutex.RLock() - defer t.ltcMutex.RUnlock() - client = t.ltcClient + client = t.ltcConn.GetClient().(pb.BoltzClient) default: panic(errors.New("invalid currency: " + currency)) } if client == nil { - return nil, NoClient + return nil, errNoClient } return client, nil } diff --git a/service/connext/rpc.go b/service/connext/rpc.go index b93e557..4bb4483 100644 --- a/service/connext/rpc.go +++ b/service/connext/rpc.go @@ -26,7 +26,7 @@ func NewRpcClient(config config.RpcConfig, service *core.SingleContainerService) url: url, healthEndpoint: fmt.Sprintf("%s/health", url), client: &http.Client{}, - logger: service.GetLogger().WithField("scope", "RPC"), + logger: service.GetLogger().WithField("name", fmt.Sprintf("service.%s.rpc", service.GetName())), service: service, } } diff --git a/service/core/abstract_service.go b/service/core/abstract_service.go index 99b0cb7..01444c5 100644 --- a/service/core/abstract_service.go +++ b/service/core/abstract_service.go @@ -1,6 +1,7 @@ package core import ( + "fmt" "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" ) @@ -15,7 +16,7 @@ type AbstractService struct { } func NewAbstractService(name string, services map[string]Service) *AbstractService { - logger := logrus.NewEntry(logrus.StandardLogger()).WithField("service", name) + logger := logrus.NewEntry(logrus.StandardLogger()).WithField("name", fmt.Sprintf("service.%s", name)) return &AbstractService{ name: name, diff --git a/service/core/single_container_service.go b/service/core/single_container_service.go index b650151..6e6338d 100644 --- a/service/core/single_container_service.go +++ b/service/core/single_container_service.go @@ -217,9 +217,9 @@ func (t *SingleContainerService) Exec1(command []string) (string, error) { execId := createResp.ID // ContainerExecAttach = ContainerExecStart - attachResp, err := t.dockerClient.ContainerExecAttach(ctx, execId, types.ExecConfig{ - AttachStdout: true, - AttachStderr: true, + attachResp, err := t.dockerClient.ContainerExecAttach(ctx, execId, types.ExecStartCheck{ + //Detach: true, + //Tty: true, }) if err != nil { return "", err @@ -264,7 +264,7 @@ func (t *SingleContainerService) ExecInteractive(command []string) (string, io.R t.logger.Infof("Created exec: %v", execId) // ContainerExecAttach = ContainerExecStart - attachResp, err := t.dockerClient.ContainerExecAttach(ctx, execId, types.ExecConfig{}) + attachResp, err := t.dockerClient.ContainerExecAttach(ctx, execId, types.ExecStartCheck{}) if err != nil { return execId, nil, nil, err } diff --git a/service/lnd/api.go b/service/lnd/api.go index 87ec456..7f34953 100644 --- a/service/lnd/api.go +++ b/service/lnd/api.go @@ -1,16 +1,20 @@ package lnd import ( + "context" "fmt" "github.com/ExchangeUnion/xud-docker-api/utils" "github.com/gin-gonic/gin" "github.com/golang/protobuf/jsonpb" "net/http" + "time" ) func (t *Service) ConfigureRouter(r *gin.RouterGroup) { r.GET(fmt.Sprintf("/v1/%s/getinfo", t.GetName()), func(c *gin.Context) { - resp, err := t.GetInfo() + ctx, cancel := context.WithTimeout(context.Background(), 3 * time.Second) + resp, err := t.GetInfo(ctx) + cancel() if err != nil { utils.JsonError(c, err.Error(), http.StatusInternalServerError) return diff --git a/service/lnd/lnd.go b/service/lnd/lnd.go index 48800d5..4c56798 100644 --- a/service/lnd/lnd.go +++ b/service/lnd/lnd.go @@ -146,7 +146,7 @@ func (t *Service) GetStatus(ctx context.Context) string { // container is running - info, err := t.GetInfo() + info, err := t.GetInfo(ctx) if err != nil { if strings.Contains(err.Error(), "Wallet is encrypted") { return "Wallet locked. Unlock with lncli unlock." diff --git a/service/lnd/logwatcher.go b/service/lnd/logwatcher.go index b4a5e4e..3faee37 100644 --- a/service/lnd/logwatcher.go +++ b/service/lnd/logwatcher.go @@ -68,7 +68,7 @@ func NewLogWatcher(containerName string, service *core.SingleContainerService) * p1: p1, p2: p2, neutrinoSyncing: NeutrinoSyncing{current: 0, total: 0, done: false}, - logger: service.GetLogger().WithField("scope", "LogWatcher"), + logger: service.GetLogger().WithField("name", fmt.Sprintf("service.%s.logwatcher", service.GetName())), service: service, } return w @@ -111,8 +111,9 @@ func (t *LogWatcher) Start() { line = strings.TrimSpace(line) if t.p0.MatchString(line) { - t.logger.Debugf("*** %s", line) + //t.logger.Debugf("*** %s", line) t.neutrinoSyncing.current = t.getNumber(t.p0, line) + t.logger.Debugf("current=%d", t.neutrinoSyncing.current) if t.neutrinoSyncing.current < t.neutrinoSyncing.total { t.neutrinoSyncing.current = t.neutrinoSyncing.total } else if t.neutrinoSyncing.current > t.neutrinoSyncing.total { @@ -120,11 +121,13 @@ func (t *LogWatcher) Start() { } t.neutrinoSyncing.done = true } else if t.p1.MatchString(line) { - t.logger.Debugf("*** %s", line) + //t.logger.Debugf("*** %s", line) t.neutrinoSyncing.current = t.getNumber(t.p1, line) + t.logger.Debugf("current=%d", t.neutrinoSyncing.current) } else if t.p2.MatchString(line) { - t.logger.Debugf("*** %s", line) + //t.logger.Debugf("*** %s", line) t.neutrinoSyncing.total = t.getNumber(t.p2, line) + t.logger.Debugf("total=%d", t.neutrinoSyncing.total) } else if line == "--- EOF ---" { t.logger.Debugf("Reset Neutrino syncing state") t.neutrinoSyncing.current = 0 diff --git a/service/lnd/rpc.go b/service/lnd/rpc.go index 27f732d..2a8674c 100644 --- a/service/lnd/rpc.go +++ b/service/lnd/rpc.go @@ -5,24 +5,20 @@ import ( "errors" "fmt" "github.com/ExchangeUnion/xud-docker-api/config" + "github.com/ExchangeUnion/xud-docker-api/rpc" "github.com/ExchangeUnion/xud-docker-api/service/core" pb "github.com/ExchangeUnion/xud-docker-api/service/lnd/lnrpc" "github.com/sirupsen/logrus" "google.golang.org/grpc" - "google.golang.org/grpc/credentials" - "os" - "sync" - "time" ) -const ( - RpcRetryDelay = 3 * time.Second +var ( + errNoClient = errors.New("no client") ) type RpcClient struct { - mutex *sync.Mutex - client pb.LightningClient - conn *grpc.ClientConn + conn *rpc.GrpcConn + logger *logrus.Entry service *core.SingleContainerService } @@ -33,79 +29,41 @@ func NewRpcClient(config config.RpcConfig, service *core.SingleContainerService) tlsCert := config["tlsCert"].(string) macaroon := config["macaroon"].(string) - c := &RpcClient{ - mutex: &sync.Mutex{}, - client: nil, - logger: service.GetLogger().WithField("scope", "RPC"), - service: service, - } - - go c.lazyInit(host, port, tlsCert, macaroon) - - return c -} - -func (t *RpcClient) lazyInit(host string, port uint16, tlsCert string, macaroon string) { - for { - creds, err := credentials.NewClientTLSFromFile(tlsCert, "localhost") - if err != nil { - t.logger.Warnf("Failed to create gRPC TLS credentials: %s", err) - time.Sleep(RpcRetryDelay) - continue - } - - var opts []grpc.DialOption - opts = append(opts, grpc.WithTransportCredentials(creds)) - opts = append(opts, grpc.WithBlock()) - - if _, err := os.Stat(macaroon); os.IsNotExist(err) { - t.logger.Warnf("Waiting for %s", macaroon) - time.Sleep(RpcRetryDelay) - continue - } + logger := service.GetLogger().WithField("name", fmt.Sprintf("service.%s.rpc", service.GetName())) - opts = append(opts, grpc.WithPerRPCCredentials(&MacaroonCredential{Readonly: macaroon})) + conn := rpc.NewGrpcConn(host, port, tlsCert, macaroon, logger, func(conn *grpc.ClientConn) interface{}{ + return pb.NewLightningClient(conn) + }) - t.logger.Debug("Waiting for a running container") - t.service.WaitContainerRunning() + go conn.Open() - addr := fmt.Sprintf("%s:%d", host, port) - t.logger.Debugf("Trying to connect with addr=%s tlsCert=%s macaroon=%s", addr, tlsCert, macaroon) - ctx, _ := context.WithTimeout(context.Background(), 10*time.Second) - conn, err := grpc.DialContext(ctx, addr, opts...) - //cancel() // prevent context resource leak - if err != nil { - t.logger.Warnf("Failed to create gRPC connection: %s", err) - time.Sleep(RpcRetryDelay) - continue - } - - t.logger.Debugf("Created gRPC connection") - t.conn = conn - - t.mutex.Lock() - t.client = pb.NewLightningClient(conn) - t.mutex.Unlock() - - break + return &RpcClient{ + conn: conn, + logger: logger, + service: service, } } func (t *RpcClient) Close() error { - err := t.conn.Close() - if err != nil { + if err := t.conn.Close(); err != nil { return err } return nil } -func (t *RpcClient) GetInfo() (*pb.GetInfoResponse, error) { - t.mutex.Lock() - defer t.mutex.Unlock() - if t.client == nil { - return nil, errors.New("no client") +func (t *RpcClient) getClient() (pb.LightningClient, error) { + client := t.conn.GetClient() + if client == nil { + return nil, errNoClient } + return client.(pb.LightningClient), nil +} +func (t *RpcClient) GetInfo(ctx context.Context) (*pb.GetInfoResponse, error) { + client, err := t.getClient() + if err != nil { + return nil, err + } req := pb.GetInfoRequest{} - return t.client.GetInfo(context.Background(), &req) + return client.GetInfo(ctx, &req) } diff --git a/service/xud/api.go b/service/xud/api.go index ad35560..9a9685e 100644 --- a/service/xud/api.go +++ b/service/xud/api.go @@ -9,6 +9,7 @@ import ( "github.com/gin-gonic/gin" "io/ioutil" "net/http" + "os" "path/filepath" "strconv" "strings" @@ -37,7 +38,6 @@ func (t *Service) ConfigureRouter(r *gin.RouterGroup) { }) r.GET("/v1/xud/tradehistory", func(c *gin.Context) { - limitStr := c.DefaultQuery("limit", "0") limit, err := strconv.ParseUint(limitStr, 10, 32) if err != nil { @@ -129,6 +129,10 @@ func (t *Service) ConfigureRouter(r *gin.RouterGroup) { ctx, cancel := context.WithTimeout(context.Background(), config.DefaultApiTimeout) defer cancel() resp, err := t.ChangePassword(ctx, params.NewPassword, params.OldPassword) + err = os.Remove("/root/network/.default-password") + if err != nil { + utils.JsonError(c, err.Error(), http.StatusInternalServerError) + } utils.HandleProtobufResponse(c, resp, err) }) diff --git a/service/xud/proto/xudrpc.proto b/service/xud/proto/xudrpc.proto index 2f828d5..f7ac05b 100644 --- a/service/xud/proto/xudrpc.proto +++ b/service/xud/proto/xudrpc.proto @@ -336,7 +336,7 @@ service Xud { }; } - /* Subscribes to accepted swaps. This stream emits a message when the local xud node + /* Subscribes to accepted swaps. This stream emits a message when the local xud node * accepts a swap request from a peer, but before the swap has actually succeeded. */ rpc SubscribeSwapsAccepted(SubscribeSwapsAcceptedRequest) returns (stream SwapAccepted) { option (google.api.http) = { diff --git a/service/xud/rpc.go b/service/xud/rpc.go index 1de17c2..8bdd65e 100644 --- a/service/xud/rpc.go +++ b/service/xud/rpc.go @@ -5,119 +5,75 @@ import ( "errors" "fmt" "github.com/ExchangeUnion/xud-docker-api/config" + "github.com/ExchangeUnion/xud-docker-api/rpc" "github.com/ExchangeUnion/xud-docker-api/service/core" "github.com/ExchangeUnion/xud-docker-api/service/xud/xudrpc" pb "github.com/ExchangeUnion/xud-docker-api/service/xud/xudrpc" "github.com/sirupsen/logrus" "google.golang.org/grpc" - "google.golang.org/grpc/credentials" - "sync" - "time" -) - -const ( - RetryDelay = 3 * time.Second - GrpcConnectTimeout = 3 * time.Second ) var ( - NoClient = errors.New("no client") - NoInitClient = errors.New("no init client") + errNoClient = errors.New("no client") + errNoInitClient = errors.New("no init client") ) type RpcClient struct { - client xudrpc.XudClient - initClient xudrpc.XudInitClient - conn *grpc.ClientConn - mutex *sync.RWMutex + conn *rpc.GrpcConn logger *logrus.Entry service *core.SingleContainerService } -func NewRpcClient(config config.RpcConfig, service *core.SingleContainerService) *RpcClient { +type Clients struct { + Client pb.XudClient + InitClient pb.XudInitClient +} +func NewRpcClient(config config.RpcConfig, service *core.SingleContainerService) *RpcClient { host := config["host"].(string) port := uint16(config["port"].(float64)) tlsCert := config["tlsCert"].(string) - c := &RpcClient{ - client: nil, - initClient: nil, - conn: nil, - mutex: &sync.RWMutex{}, - - logger: service.GetLogger().WithField("scope", "RPC"), - service: service, - } - - go c.lazyInit(host, port, tlsCert) + logger := service.GetLogger().WithField("name", fmt.Sprintf("service.%s.rpc", service.GetName())) - return c -} - -func (t *RpcClient) lazyInit(host string, port uint16, tlsCert string) { - for { - creds, err := credentials.NewClientTLSFromFile(tlsCert, "localhost") - if err != nil { - time.Sleep(RetryDelay) - continue + conn := rpc.NewGrpcConn(host, port, tlsCert, "", logger, func(conn *grpc.ClientConn) interface{} { + return Clients{ + Client: pb.NewXudClient(conn), + InitClient: pb.NewXudInitClient(conn), } + }) - var opts []grpc.DialOption - opts = append(opts, grpc.WithTransportCredentials(creds)) - opts = append(opts, grpc.WithBlock()) - - t.logger.Debug("Waiting for a running container") - t.service.WaitContainerRunning() - - ctx, cancel := context.WithTimeout(context.Background(), GrpcConnectTimeout) - addr := fmt.Sprintf("%s:%d", host, port) - t.logger.Debugf("Trying to connect with addr=%s tlsCert=%s macaroon=%s", addr, tlsCert) - conn, err := grpc.DialContext(ctx, addr, opts...) - cancel() // TODO make sure this won't close the conn - if err != nil { - t.logger.Warnf("Failed to create gRPC connection: %s", err) - time.Sleep(RetryDelay) - continue - } + go conn.Open() - t.logger.Debugf("Created gRPC connection") - t.conn = conn - - t.mutex.Lock() - t.client = pb.NewXudClient(conn) - t.initClient = pb.NewXudInitClient(conn) - t.mutex.Unlock() - - break + return &RpcClient{ + conn: conn, + logger: logger, + service: service, } } func (t *RpcClient) Close() error { - err := t.conn.Close() - if err != nil { + if err := t.conn.Close(); err != nil { return err } return nil } func (t *RpcClient) getClient() (xudrpc.XudClient, error) { - t.mutex.RLock() - defer t.mutex.RUnlock() - if t.client == nil { - return nil, NoClient + clients := t.conn.GetClient() + if clients == nil { + return nil, errNoClient } - return t.client, nil + return clients.(Clients).Client, nil } func (t *RpcClient) getInitClient() (xudrpc.XudInitClient, error) { - t.mutex.RLock() - defer t.mutex.RUnlock() - if t.client == nil { - return nil, NoInitClient + clients := t.conn.GetClient() + if clients == nil { + return nil, errNoInitClient } - return t.initClient, nil + return clients.(Clients).InitClient, nil } func (t *RpcClient) GetInfo(ctx context.Context) (*pb.GetInfoResponse, error) {