[
  {
    "path": ".gitignore",
    "content": ".svn\n.svn/*\n*.swp\n*.swn\n*.swo\n*.tmp\n*.swm\napp/logs/*\napp/log/*\nlogs/*\nlog/*\ndevelopment\n.tags*\n.idea\n.vscode\n.DS_Store\n__debug_bin\ncover.out\ncover.html\ncover.txt\n.apollo_config\ngo.work\n*.log\n"
  },
  {
    "path": "LICENSE",
    "content": "\nThe MIT License (MIT)\n\nCopyright (c) 2021 AirGo\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE."
  },
  {
    "path": "Makefile",
    "content": ".PHONY: all build test clean\n\nall: build test\n\nformat:\n\tgo vet ./...\n\tgofmt -w .\n\tgolint ./...\nbuild:\n\tgo mod download \n\ntest:\n\tgo test -race -cover -coverpkg=./... ./...  -gcflags=\"-N -l\"\n\nclean:\n\tgo clean -i -n -r\n\n"
  },
  {
    "path": "README.md",
    "content": "<!--\n * @Descripttion:\n * @Author: weihaoyu\n-->\n\n# gin-api\nGo 微服务框架，同时支持 gRPC 和 HTTP，封装各种常用组件，开箱即用，专注业务。\n<br>\n本代码库已停止维护，请移步：<a href=\"https://github.com/air-go/rpc\">air-go/rpc</a>\n<br><br>\n"
  },
  {
    "path": "app/Dockerfile",
    "content": "# 使用最新golang镜像\nFROM golang:latest\n\n# 作者\nMAINTAINER AirGo\n\n# 环境变量配置\nENV GOPROXY https://goproxy.cn,direct\nENV GO111MODULE on\n\n# 指定工作目录，用于保存文件\nWORKDIR /tmp\n\n# 移动代码到容器中\nCOPY . .\n\n# 指定工作目录，用于保存执行文件和配置文件\nWORKDIR /app/\n\n# 移动执行文件和配置文件\nRUN cp /tmp/gin-api/app/app .\nRUN cp -rf /tmp/gin-api/app/conf ./\n\n# 向外暴露8888端口\nEXPOSE 8888\n\n# 启动容器时运行的命令\nENTRYPOINT [\"./app -env online\"]"
  },
  {
    "path": "app/Makefile",
    "content": ".PHONY: all build test clean\n\nall: build test\n\nformat:\n\tgo vet ./...\n\tgofmt -w .\n\tgolint ./...\nbuild:\n\tgo mod download \n\tGOOS=linux GOARCH=386 go build -o app main.go\n\ntest:\n\tgo test -race -cover -coverpkg=./... ./...  -gcflags=\"-N -l\"\n\nclean:\n\tgo clean -i -n -r\n\n"
  },
  {
    "path": "app/conf/dev/app.toml",
    "content": "AppName = \"gin-api-dev\"\nAppPort = 8777\nPprof = true\nIsDebug = true\nContextTimeout = 100000\nConnectTimeout = 100000\nWriteTimeout =  100000\nReadTimeout =  100000"
  },
  {
    "path": "app/conf/dev/default_rabbitmq.toml",
    "content": "ServiceName = \"default_rabbitmq\"\nHost = \"127.0.0.1\"\nPort = 5672\nVirtual = \"why\"\nUser = \"why\"\nPass = \"why\"\nExchangeType = \"direct\"\nExchangeName = \"why_exchange\"\nQueueName = \"why_queue\"\nRouteName = \"why_route\""
  },
  {
    "path": "app/conf/dev/default_redis.toml",
    "content": "ServiceName = \"default_redis\"\nHost = \"127.0.0.1\"\nPort = 6379\nAuth = \"\"\nDB = 0\nConnectTimeout = 1\nReadTimeout = 1\nWriteTimeout = 1\nMaxActive = 30\nMaxIdle = 10\nIsLog = true\nExecTimeout = 100000"
  },
  {
    "path": "app/conf/dev/etcd.toml",
    "content": "Endpoints = \"localhost:23790;localhost:23791;localhost:23792\"\nDialTimeout = 5\n"
  },
  {
    "path": "app/conf/dev/jaeger.toml",
    "content": "Host = \"127.0.0.1\"\nPort = \"6831\""
  },
  {
    "path": "app/conf/dev/log/gorm.toml",
    "content": "SlowThreshold = 1000\nInfoFile = \"./log/gorm/info.log\"\nErrorFile = \"./log/gorm/error.wf.log\"\nLevel = 4 # Silent(1) < Error(2) < Warn(3) < Info(4)\nSkipCallerLookup = false\nIgnoreRecordNotFoundError = true"
  },
  {
    "path": "app/conf/dev/log/queue.toml",
    "content": "InfoFile = \"./log/queue/info.log\"\nErrorFile = \"./log/queue/error.wf.log\"\nLevel = \"debug\" # debug < info < warn < error < fatal"
  },
  {
    "path": "app/conf/dev/log/redis.toml",
    "content": "InfoFile = \"./log/redis/info.log\"\nErrorFile = \"./log/redis/error.wf.log\"\nLevel = \"debug\" # debug < info < warn < error < fatal"
  },
  {
    "path": "app/conf/dev/log/rpc.toml",
    "content": "InfoFile = \"./log/rpc/info.log\"\nErrorFile = \"./log/rpc/error.wf.log\"\nLevel = \"info\" # debug < info < warn < error < fatal"
  },
  {
    "path": "app/conf/dev/log/service.toml",
    "content": "InfoFile = \"./log/service/info.log\"\nErrorFile = \"./log/service/error.wf.log\"\nLevel = \"debug\" # debug < info < warn < error < fatal"
  },
  {
    "path": "app/conf/dev/registry.toml",
    "content": "Lease = 5\n"
  },
  {
    "path": "app/conf/dev/services/gin-api.toml",
    "content": "ServiceName = \"gin-api-dev\"\nType = 2 # 1-注册发现，2-IP+PORT，3-域名\nHost = \"127.0.0.1\"\nPort = 8777\nSelector = \"wr\" #参考selector\nRefreshSecond = 10"
  },
  {
    "path": "app/conf/dev/test_mysql.toml",
    "content": "ServiceName = \"test_mysql\"\n\n[master]\nHost = \"127.0.0.1\"\nPort = \"3306\"\nUser = \"root\"\nPassword = \"123456\"\nDB = \"test\"\nCharset = \"utf8mb4\"\nMaxOpen = 8\nMaxIdle = 4\n\n[slave]\nHost = \"127.0.0.1\"\nPort = \"3306\"\nUser = \"root\"\nPassword = \"123456\"\nDB = \"test\"\nCharset = \"utf8mb4\"\nMaxOpen = 8\nMaxIdle = 4"
  },
  {
    "path": "app/conf/liantiao/app.toml",
    "content": "AppName = \"gin-api-liantiao\"\nAppPort = 888\nPprof = true\nIsDebug = true\nContextTimeout = 100000\nConnectTimeout = 100000\nWriteTimeout =  100000\nReadTimeout =  100000"
  },
  {
    "path": "app/conf/liantiao/default_rabbitmq.toml",
    "content": "ServiceName = \"default_rabbitmq\"\nHost = \"127.0.0.1\"\nPort = 5672\nVirtual = \"why\"\nUser = \"why\"\nPass = \"why\"\nExchangeType = \"direct\"\nExchangeName = \"why_exchange\"\nQueueName = \"why_queue\"\nRouteName = \"why_route\""
  },
  {
    "path": "app/conf/liantiao/default_redis.toml",
    "content": "ServiceName = \"default_redis\"\nHost = \"127.0.0.1\"\nPort = 6379\nAuth = \"\"\nDB = 0\nConnectTimeout = 1\nReadTimeout = 1\nWriteTimeout = 1\nMaxActive = 30\nMaxIdle = 10\nIsLog = true\nExecTimeout = 100000"
  },
  {
    "path": "app/conf/liantiao/etcd.toml",
    "content": "Endpoints = \"localhost:23790;localhost:23791;localhost:23792\"\nDialTimeout = 5\n"
  },
  {
    "path": "app/conf/liantiao/jaeger.toml",
    "content": "Host = \"127.0.0.1\"\nPort = \"6831\""
  },
  {
    "path": "app/conf/liantiao/log/gorm.toml",
    "content": "SlowThreshold = 1000\nInfoFile = \"./log/gorm/info.log\"\nErrorFile = \"./log/gorm/error.wf.log\"\nLevel = 4 # Silent(1) < Error(2) < Warn(3) < Info(4)\nSkipCallerLookup = false\nIgnoreRecordNotFoundError = true"
  },
  {
    "path": "app/conf/liantiao/log/queue.toml",
    "content": "InfoFile = \"./log/queue/info.log\"\nErrorFile = \"./log/queue/error.wf.log\"\nLevel = \"debug\" # debug < info < warn < error < fatal"
  },
  {
    "path": "app/conf/liantiao/log/redis.toml",
    "content": "InfoFile = \"./log/redis/info.log\"\nErrorFile = \"./log/redis/error.wf.log\"\nLevel = \"debug\" # debug < info < warn < error < fatal"
  },
  {
    "path": "app/conf/liantiao/log/rpc.toml",
    "content": "InfoFile = \"./log/rpc/info.log\"\nErrorFile = \"./log/rpc/error.wf.log\"\nLevel = \"info\" # debug < info < warn < error < fatal"
  },
  {
    "path": "app/conf/liantiao/log/service.toml",
    "content": "InfoFile = \"./log/service/info.log\"\nErrorFile = \"./log/service/error.wf.log\"\nLevel = \"debug\" # debug < info < warn < error < fatal"
  },
  {
    "path": "app/conf/liantiao/services/gin-api.toml",
    "content": "ServiceName = \"gin-api\"\nType = 2 # 1-注册发现，2-IP+PORT，3-域名\nHost = \"127.0.0.1\"\nPort = 777\nSelector = \"wr\" #参考selector\nRefreshSecond = 10"
  },
  {
    "path": "app/conf/liantiao/test_mysql.toml",
    "content": "[master]\nHost = \"127.0.0.1\"\nPort = \"3306\"\nUser = \"root\"\nPassword = \"123456\"\nDB = \"test\"\nCharset = \"utf8mb4\"\nMaxOpen = 8\nMaxIdle = 4\n\n[slave]\nHost = \"127.0.0.1\"\nPort = \"3306\"\nUser = \"root\"\nPassword = \"123456\"\nDB = \"test\"\nCharset = \"utf8mb4\"\nMaxOpen = 8\nMaxIdle = 4"
  },
  {
    "path": "app/conf/online/app.toml",
    "content": "AppName = \"gin-api-online\"\nAppPort = 1000\nPprof = false\nIsDebug = false\nContextTimeout = 100000\nConnectTimeout = 100000\nWriteTimeout =  100000\nReadTimeout =  100000"
  },
  {
    "path": "app/conf/online/default_rabbitmq.toml",
    "content": "ServiceName = \"default_rabbitmq\"\nHost = \"127.0.0.1\"\nPort = 5672\nVirtual = \"why\"\nUser = \"why\"\nPass = \"why\"\nExchangeType = \"direct\"\nExchangeName = \"why_exchange\"\nQueueName = \"why_queue\"\nRouteName = \"why_route\""
  },
  {
    "path": "app/conf/online/default_redis.toml",
    "content": "ServiceName = \"default_redis\"\nHost = \"127.0.0.1\"\nPort = 6379\nAuth = \"\"\nDB = 0\nConnectTimeout = 1\nReadTimeout = 1\nWriteTimeout = 1\nMaxActive = 30\nMaxIdle = 10\nIsLog = true\nExecTimeout = 100000"
  },
  {
    "path": "app/conf/online/etcd.toml",
    "content": "Endpoints = \"localhost:23790;localhost:23791;localhost:23792\"\nDialTimeout = 5\n"
  },
  {
    "path": "app/conf/online/jaeger.toml",
    "content": "Host = \"127.0.0.1\"\nPort = \"6831\""
  },
  {
    "path": "app/conf/online/log/gorm.toml",
    "content": "SlowThreshold = 1000\nInfoFile = \"./log/gorm/info.log\"\nErrorFile = \"./log/gorm/error.wf.log\"\nLevel = 4 # Silent(1) < Error(2) < Warn(3) < Info(4)\nSkipCallerLookup = false\nIgnoreRecordNotFoundError = true"
  },
  {
    "path": "app/conf/online/log/queue.toml",
    "content": "InfoFile = \"./log/queue/info.log\"\nErrorFile = \"./log/queue/error.wf.log\"\nLevel = \"debug\" # debug < info < warn < error < fatal"
  },
  {
    "path": "app/conf/online/log/redis.toml",
    "content": "InfoFile = \"./log/redis/info.log\"\nErrorFile = \"./log/redis/error.wf.log\"\nLevel = \"debug\" # debug < info < warn < error < fatal"
  },
  {
    "path": "app/conf/online/log/rpc.toml",
    "content": "InfoFile = \"./log/rpc/info.log\"\nErrorFile = \"./log/rpc/error.wf.log\"\nLevel = \"info\" # debug < info < warn < error < fatal"
  },
  {
    "path": "app/conf/online/log/service.toml",
    "content": "InfoFile = \"./log/service/info.log\"\nErrorFile = \"./log/service/error.wf.log\"\nLevel = \"debug\" # debug < info < warn < error < fatal"
  },
  {
    "path": "app/conf/online/services/gin-api.toml",
    "content": "ServiceName = \"gin-api\"\nType = 2 # 1-注册发现，2-IP+PORT，3-域名\nHost = \"127.0.0.1\"\nPort = 777\nSelector = \"wr\" #参考selector\nRefreshSecond = 10"
  },
  {
    "path": "app/conf/online/test_mysql.toml",
    "content": "[master]\nHost = \"127.0.0.1\"\nPort = \"3306\"\nUser = \"root\"\nPassword = \"123456\"\nDB = \"test\"\nCharset = \"utf8mb4\"\nMaxOpen = 8\nMaxIdle = 4\n\n[slave]\nHost = \"127.0.0.1\"\nPort = \"3306\"\nUser = \"root\"\nPassword = \"123456\"\nDB = \"test\"\nCharset = \"utf8mb4\"\nMaxOpen = 8\nMaxIdle = 4"
  },
  {
    "path": "app/conf/qa/app.toml",
    "content": "AppName = \"gin-api-qa\"\nAppPort = 999\nPprof = true\nIsDebug = true\nContextTimeout = 100000\nConnectTimeout = 100000\nWriteTimeout =  100000\nReadTimeout =  100000"
  },
  {
    "path": "app/conf/qa/default_rabbitmq.toml",
    "content": "ServiceName = \"default_rabbitmq\"\nHost = \"127.0.0.1\"\nPort = 5672\nVirtual = \"why\"\nUser = \"why\"\nPass = \"why\"\nExchangeType = \"direct\"\nExchangeName = \"why_exchange\"\nQueueName = \"why_queue\"\nRouteName = \"why_route\""
  },
  {
    "path": "app/conf/qa/default_redis.toml",
    "content": "ServiceName = \"default_redis\"\nHost = \"127.0.0.1\"\nPort = 6379\nAuth = \"\"\nDB = 0\nConnectTimeout = 1\nReadTimeout = 1\nWriteTimeout = 1\nMaxActive = 30\nMaxIdle = 10\nIsLog = true\nExecTimeout = 100000"
  },
  {
    "path": "app/conf/qa/etcd.toml",
    "content": "Endpoints = \"localhost:23790;localhost:23791;localhost:23792\"\nDialTimeout = 5\n"
  },
  {
    "path": "app/conf/qa/jaeger.toml",
    "content": "Host = \"127.0.0.1\"\nPort = \"6831\""
  },
  {
    "path": "app/conf/qa/log/gorm.toml",
    "content": "SlowThreshold = 1000\nInfoFile = \"./log/gorm/info.log\"\nErrorFile = \"./log/gorm/error.wf.log\"\nLevel = 4 # Silent(1) < Error(2) < Warn(3) < Info(4)\nSkipCallerLookup = false\nIgnoreRecordNotFoundError = true"
  },
  {
    "path": "app/conf/qa/log/queue.toml",
    "content": "InfoFile = \"./log/queue/info.log\"\nErrorFile = \"./log/queue/error.wf.log\"\nLevel = \"debug\" # debug < info < warn < error < fatal"
  },
  {
    "path": "app/conf/qa/log/redis.toml",
    "content": "InfoFile = \"./log/redis/info.log\"\nErrorFile = \"./log/redis/error.wf.log\"\nLevel = \"debug\" # debug < info < warn < error < fatal"
  },
  {
    "path": "app/conf/qa/log/rpc.toml",
    "content": "InfoFile = \"./log/rpc/info.log\"\nErrorFile = \"./log/rpc/error.wf.log\"\nLevel = \"info\" # debug < info < warn < error < fatal"
  },
  {
    "path": "app/conf/qa/log/service.toml",
    "content": "InfoFile = \"./log/service/info.log\"\nErrorFile = \"./log/service/error.wf.log\"\nLevel = \"debug\" # debug < info < warn < error < fatal"
  },
  {
    "path": "app/conf/qa/services/gin-api.toml",
    "content": "ServiceName = \"gin-api\"\nType = 2 # 1-注册发现，2-IP+PORT，3-域名\nHost = \"127.0.0.1\"\nPort = 777\nSelector = \"wr\" #参考selector\nRefreshSecond = 10"
  },
  {
    "path": "app/conf/qa/test_mysql.toml",
    "content": "[master]\nHost = \"127.0.0.1\"\nPort = \"3306\"\nUser = \"root\"\nPassword = \"123456\"\nDB = \"test\"\nCharset = \"utf8mb4\"\nMaxOpen = 8\nMaxIdle = 4\n\n[slave]\nHost = \"127.0.0.1\"\nPort = \"3306\"\nUser = \"root\"\nPassword = \"123456\"\nDB = \"test\"\nCharset = \"utf8mb4\"\nMaxOpen = 8\nMaxIdle = 4"
  },
  {
    "path": "app/loader/loader.go",
    "content": "package loader\n\nimport (\n\t\"strings\"\n\n\t\"github.com/pkg/errors\"\n\t\"github.com/why444216978/go-util/assert\"\n\t\"github.com/why444216978/go-util/sys\"\n\n\t\"github.com/why444216978/gin-api/app/resource\"\n\thttpClient \"github.com/why444216978/gin-api/client/http\"\n\t\"github.com/why444216978/gin-api/client/http/transport\"\n\t\"github.com/why444216978/gin-api/library/app\"\n\tredisCache \"github.com/why444216978/gin-api/library/cache/redis\"\n\t\"github.com/why444216978/gin-api/library/config\"\n\t\"github.com/why444216978/gin-api/library/etcd\"\n\t\"github.com/why444216978/gin-api/library/jaeger\"\n\tjaegerGorm \"github.com/why444216978/gin-api/library/jaeger/gorm\"\n\tjaegerRedis \"github.com/why444216978/gin-api/library/jaeger/redis\"\n\tredisLock \"github.com/why444216978/gin-api/library/lock/redis\"\n\tloggerGorm \"github.com/why444216978/gin-api/library/logger/zap/gorm\"\n\tloggerRedis \"github.com/why444216978/gin-api/library/logger/zap/redis\"\n\tloggerRPC \"github.com/why444216978/gin-api/library/logger/zap/rpc\"\n\tserviceLogger \"github.com/why444216978/gin-api/library/logger/zap/service\"\n\t\"github.com/why444216978/gin-api/library/orm\"\n\t\"github.com/why444216978/gin-api/library/queue/rabbitmq\"\n\t\"github.com/why444216978/gin-api/library/redis\"\n\t\"github.com/why444216978/gin-api/library/registry\"\n\tetcdRegistry \"github.com/why444216978/gin-api/library/registry/etcd\"\n\t\"github.com/why444216978/gin-api/library/servicer/service\"\n\t\"github.com/why444216978/gin-api/server\"\n)\n\nfunc Load() (err error) {\n\t// TODO\n\t// ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)\n\t// defer cancel()\n\n\tif err = loadLogger(); err != nil {\n\t\treturn\n\t}\n\tif err = loadClientHTTP(); err != nil {\n\t\treturn\n\t}\n\t// TODO 避免用户第一次使用运行panic，留给用户自己打开需要的依赖\n\t// if err = loadMysql(\"test_mysql\"); err != nil {\n\t// \treturn\n\t// }\n\t// if err = loadRedis(\"default_redis\"); err != nil {\n\t// \treturn\n\t// }\n\t// if err = loadRabbitMQ(\"default_rabbitmq\"); err != nil {\n\t// \treturn\n\t// }\n\t// if err = loadJaeger(); err != nil {\n\t// \treturn\n\t// }\n\t// if err = loadLock(); err != nil {\n\t// \treturn\n\t// }\n\t// if err = loadCache(); err != nil {\n\t// \treturn\n\t// }\n\t// if err = loadEtcd(); err != nil {\n\t// \treturn\n\t// }\n\t// if err = loadRegistry(); err != nil {\n\t// \treturn\n\t// }\n\tif err = service.LoadGlobPattern(\"services\", \"toml\", resource.Etcd); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}\n\nfunc loadLogger() (err error) {\n\tcfg := &serviceLogger.Config{}\n\n\tif err = config.ReadConfig(\"log/service\", \"toml\", &cfg); err != nil {\n\t\treturn\n\t}\n\n\tif resource.ServiceLogger, err = serviceLogger.NewServiceLogger(app.Name(), cfg); err != nil {\n\t\treturn\n\t}\n\n\tserver.RegisterCloseFunc(resource.ServiceLogger.Close())\n\n\treturn\n}\n\nfunc loadMysql(db string) (err error) {\n\tcfg := &orm.Config{}\n\tlogCfg := &loggerGorm.GormConfig{}\n\n\tif err = config.ReadConfig(db, \"toml\", cfg); err != nil {\n\t\treturn\n\t}\n\n\tif err = config.ReadConfig(\"log/gorm\", \"toml\", logCfg); err != nil {\n\t\treturn\n\t}\n\n\tlogCfg.ServiceName = cfg.ServiceName\n\tlogger, err := loggerGorm.NewGorm(logCfg)\n\tif err != nil {\n\t\treturn\n\t}\n\tserver.RegisterCloseFunc(logger.Close())\n\n\tif resource.TestDB, err = orm.NewOrm(cfg,\n\t\torm.WithTrace(jaegerGorm.GormTrace),\n\t\torm.WithLogger(logger),\n\t); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}\n\nfunc loadRedis(db string) (err error) {\n\tcfg := &redis.Config{}\n\tlogCfg := &loggerRedis.RedisConfig{}\n\n\tif err = config.ReadConfig(db, \"toml\", cfg); err != nil {\n\t\treturn\n\t}\n\tif err = config.ReadConfig(\"log/redis\", \"toml\", &logCfg); err != nil {\n\t\treturn\n\t}\n\n\tlogCfg.ServiceName = cfg.ServiceName\n\tlogCfg.Host = cfg.Host\n\tlogCfg.Port = cfg.Port\n\n\tlogger, err := loggerRedis.NewRedisLogger(logCfg)\n\tif err != nil {\n\t\treturn\n\t}\n\tserver.RegisterCloseFunc(logger.Close())\n\n\trc := redis.NewClient(cfg)\n\trc.AddHook(jaegerRedis.NewJaegerHook())\n\trc.AddHook(logger)\n\tresource.RedisDefault = rc\n\n\treturn\n}\n\nfunc loadRabbitMQ(service string) (err error) {\n\tcfg := &rabbitmq.Config{}\n\tif err = config.ReadConfig(service, \"toml\", cfg); err != nil {\n\t\treturn\n\t}\n\n\tif resource.RabbitMQ, err = rabbitmq.New(cfg); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}\n\nfunc loadLock() (err error) {\n\tresource.RedisLock, err = redisLock.New(resource.RedisDefault)\n\treturn\n}\n\nfunc loadCache() (err error) {\n\tresource.RedisCache, err = redisCache.New(resource.RedisDefault, resource.RedisLock)\n\treturn\n}\n\nfunc loadJaeger() (err error) {\n\tcfg := &jaeger.Config{}\n\n\tif err = config.ReadConfig(\"jaeger\", \"toml\", cfg); err != nil {\n\t\treturn\n\t}\n\n\tif _, _, err = jaeger.NewJaegerTracer(cfg, app.Name()); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}\n\nfunc loadEtcd() (err error) {\n\tcfg := &etcd.Config{}\n\n\tif err = config.ReadConfig(\"etcd\", \"toml\", cfg); err != nil {\n\t\treturn\n\t}\n\n\tif resource.Etcd, err = etcd.NewClient(\n\t\tetcd.WithEndpoints(strings.Split(cfg.Endpoints, \";\")),\n\t\tetcd.WithDialTimeout(cfg.DialTimeout),\n\t); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}\n\nfunc loadRegistry() (err error) {\n\tvar (\n\t\tlocalIP string\n\t\tcfg     = &registry.RegistryConfig{}\n\t)\n\n\tif err = config.ReadConfig(\"registry\", \"toml\", cfg); err != nil {\n\t\treturn\n\t}\n\n\tif localIP, err = sys.LocalIP(); err != nil {\n\t\treturn\n\t}\n\n\tif assert.IsNil(resource.Etcd) {\n\t\terr = errors.New(\"resource.Etcd is nil\")\n\t\treturn\n\t}\n\n\tif resource.Registrar, err = etcdRegistry.NewRegistry(\n\t\tetcdRegistry.WithRegistrarClient(resource.Etcd.Client),\n\t\tetcdRegistry.WithRegistrarServiceName(app.Name()),\n\t\tetcdRegistry.WithRegistarHost(localIP),\n\t\tetcdRegistry.WithRegistarPort(app.Port()),\n\t\tetcdRegistry.WithRegistrarLease(cfg.Lease)); err != nil {\n\t\treturn\n\t}\n\n\tif err = server.RegisterCloseFunc(resource.Registrar.DeRegister); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}\n\nfunc loadClientHTTP() (err error) {\n\tcfg := &loggerRPC.RPCConfig{}\n\tif err = config.ReadConfig(\"log/rpc\", \"toml\", cfg); err != nil {\n\t\treturn\n\t}\n\n\tlogger, err := loggerRPC.NewRPCLogger(cfg)\n\tif err != nil {\n\t\treturn\n\t}\n\tserver.RegisterCloseFunc(logger.Close())\n\n\tresource.ClientHTTP = transport.New(\n\t\ttransport.WithLogger(logger),\n\t\ttransport.WithBeforePlugins(&httpClient.JaegerBeforePlugin{}))\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}\n"
  },
  {
    "path": "app/main.go",
    "content": "package main\n\nimport (\n\t\"flag\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/why444216978/gin-api/app/loader\"\n\tjobGRPC \"github.com/why444216978/gin-api/app/module/test/job/grpc\"\n\tserviceGRPC \"github.com/why444216978/gin-api/app/module/test/service/grpc\"\n\t\"github.com/why444216978/gin-api/app/resource\"\n\t\"github.com/why444216978/gin-api/app/router\"\n\t\"github.com/why444216978/gin-api/bootstrap\"\n\t\"github.com/why444216978/gin-api/library/app\"\n\tjobLib \"github.com/why444216978/gin-api/library/job\"\n\tserverGRPC \"github.com/why444216978/gin-api/server/grpc\"\n\tserverH2C \"github.com/why444216978/gin-api/server/grpc/h2c\"\n\thttpServer \"github.com/why444216978/gin-api/server/http\"\n\tlogMiddleware \"github.com/why444216978/gin-api/server/http/middleware/log\"\n\tpanicMiddleware \"github.com/why444216978/gin-api/server/http/middleware/panic\"\n\ttimeoutMiddleware \"github.com/why444216978/gin-api/server/http/middleware/timeout\"\n)\n\nvar (\n\tenv    = flag.String(\"env\", \"dev\", \"config path\")\n\tjob    = flag.String(\"job\", \"\", \"is job\")\n\tserver = flag.String(\"server\", \"http\", \"is server type\")\n)\n\nfunc main() {\n\tflag.Parse()\n\n\tvar err error\n\n\tif err = bootstrap.Init(*env, loader.Load); err != nil {\n\t\tlog.Printf(\"bootstrap.Init err %s\", err.Error())\n\t\treturn\n\t}\n\n\tif *job != \"\" {\n\t\tjobLib.Handlers = map[string]jobLib.HandleFunc{\n\t\t\t\"grpc-test\": jobGRPC.Start,\n\t\t}\n\t\tjobLib.Handle(*job, resource.ServiceLogger)\n\t\treturn\n\t}\n\n\tport := app.Port()\n\tif *server == \"http\" {\n\t\tlog.Printf(\"start http, port %d\", port)\n\t\tstartHTTP(port)\n\t} else {\n\t\tlog.Printf(\"start grpc, port %d\", port)\n\t\tstartGRPC(port)\n\t}\n}\n\nfunc startHTTP(port int) {\n\tsrv := httpServer.New(fmt.Sprintf(\":%d\", port),\n\t\thttpServer.WithReadTimeout(app.ReadTimeout()),\n\t\thttpServer.WithWriteTimeout(app.WriteTimeout()),\n\t\thttpServer.WithRegisterRouter(router.RegisterRouter),\n\t\thttpServer.WithMiddlewares(\n\t\t\tpanicMiddleware.ThrowPanic(resource.ServiceLogger),\n\t\t\ttimeoutMiddleware.TimeoutMiddleware(app.ContextTimeout()),\n\t\t\tlogMiddleware.LoggerMiddleware(resource.ServiceLogger),\n\t\t),\n\t\thttpServer.WithPprof(app.Pprof()),\n\t\thttpServer.WithDebug(app.Debug()),\n\t)\n\n\tif err := bootstrap.NewApp(srv, resource.Registrar).Start(); err != nil {\n\t\tlog.Println(err)\n\t}\n}\n\nfunc startGRPC(port int) {\n\tsrv := serverH2C.NewH2C(fmt.Sprintf(\":%d\", port),\n\t\t[]serverGRPC.Register{serviceGRPC.NewService()},\n\t)\n\n\tif err := bootstrap.NewApp(srv, resource.Registrar).Start(); err != nil {\n\t\tlog.Println(err)\n\t}\n}\n"
  },
  {
    "path": "app/module/goods/api/conn.go",
    "content": "package api\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"time\"\n\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/go-redis/redis/v8\"\n\t\"golang.org/x/sync/errgroup\"\n\n\t\"github.com/why444216978/gin-api/app/module/goods/respository\"\n\tgoodsService \"github.com/why444216978/gin-api/app/module/goods/service\"\n\t\"github.com/why444216978/gin-api/app/resource\"\n\t\"github.com/why444216978/gin-api/app/response\"\n\thttpResponse \"github.com/why444216978/gin-api/server/http/response\"\n)\n\nfunc Do(c *gin.Context) {\n\tvar (\n\t\terr   error\n\t\tgoods respository.Test\n\t)\n\n\tctx := c.Request.Context()\n\n\tgoods, err = goodsService.Instance.CrudGoods(ctx)\n\tif err != nil {\n\t\tresource.ServiceLogger.Error(ctx, err.Error())\n\t\tresponse.ResponseJSON(c, response.CodeServer, goods, httpResponse.WrapToast(err, err.Error()))\n\t\treturn\n\t}\n\n\tdata := &Data{}\n\n\tg, _ := errgroup.WithContext(ctx)\n\tg.Go(func() (err error) {\n\t\tgoods.Name = \"golang\"\n\t\t_, err = goodsService.Instance.GetGoodsName(ctx, 1)\n\t\treturn\n\t})\n\tg.Go(func() (err error) {\n\t\terr = resource.RedisCache.GetData(ctx, \"cache_key\", time.Hour, time.Hour, GetDataA, data)\n\t\treturn\n\t})\n\tg.Go(func() (err error) {\n\t\tresult := make([]*redis.StringCmd, 0)\n\t\tpipe := resource.RedisDefault.Pipeline()\n\t\tresult = append(result, pipe.Get(ctx, \"test\"))\n\t\tresult = append(result, pipe.Get(ctx, \"test\"))\n\t\tresult = append(result, pipe.Get(ctx, \"test\"))\n\t\t_, _ = pipe.Exec(ctx)\n\t\treturn\n\t})\n\terr = g.Wait()\n\tif err != nil {\n\t\tresource.ServiceLogger.Error(ctx, err.Error())\n\t\tresponse.ResponseJSON(c, response.CodeServer, goods, httpResponse.WrapToast(err, err.Error()))\n\t\treturn\n\t}\n\n\tresponse.ResponseJSON(c, response.CodeSuccess, goods, nil)\n}\n\ntype Data struct {\n\tA string `json:\"a\"`\n}\n\nfunc GetDataA(ctx context.Context, _data interface{}) (err error) {\n\tdata, ok := _data.(*Data)\n\tif !ok {\n\t\terr = errors.New(\"err assert\")\n\t\treturn\n\t}\n\tdata.A = \"a\"\n\treturn\n}\n"
  },
  {
    "path": "app/module/goods/job/job.go",
    "content": "package job\n"
  },
  {
    "path": "app/module/goods/respository/respository.go",
    "content": "package respository\n\ntype Test struct {\n\tId      uint   `gorm:\"column:id\" json:\"id\"`\n\tGoodsId uint64 `gorm:\"column:goods_id\" json:\"goods_id\"`\n\tName    string `gorm:\"column:name\" json:\"name\"`\n}\n\nfunc (Test) TableName() string {\n\treturn \"test\"\n}\n"
  },
  {
    "path": "app/module/goods/service/service.go",
    "content": "package goods\n\nimport (\n\t\"context\"\n\t\"strconv\"\n\n\t\"github.com/go-redis/redis/v8\"\n\t\"github.com/pkg/errors\"\n\t\"github.com/why444216978/go-util/assert\"\n\t\"github.com/why444216978/go-util/orm\"\n\n\t\"github.com/why444216978/gin-api/app/module/goods/respository\"\n\t\"github.com/why444216978/gin-api/app/resource\"\n)\n\ntype GoodsInterface interface {\n\tGetGoodsName(ctx context.Context, id int) (string, error)\n\tCrudGoods(ctx context.Context) (goods respository.Test, err error)\n}\n\nvar Instance GoodsInterface\n\ntype GoodsService struct{}\n\nfunc init() {\n\tInstance = &GoodsService{}\n}\n\nconst (\n\tGOODS_NAME_KEY  = \"goods::name::\"\n\tGOODS_PRICE_KEY = \"goods::price::\"\n)\n\nfunc (gs *GoodsService) GetGoodsName(ctx context.Context, id int) (string, error) {\n\tdata, err := resource.RedisDefault.Get(ctx, GOODS_NAME_KEY+strconv.Itoa(id)).Result()\n\tif errors.Is(err, redis.Nil) {\n\t\treturn \"\", nil\n\t}\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"redis get goods price error：\")\n\t}\n\treturn data, nil\n}\n\nfunc (gs *GoodsService) CrudGoods(ctx context.Context) (goods respository.Test, err error) {\n\tif assert.IsNil(resource.TestDB) {\n\t\terr = errors.New(\"db is nil\")\n\t\treturn\n\t}\n\tdb := resource.TestDB.DB.WithContext(ctx).Begin()\n\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tdb.WithContext(ctx).Rollback()\n\t\t\treturn\n\t\t}\n\t\terr = db.WithContext(ctx).Commit().Error\n\t}()\n\n\terr = db.WithContext(ctx).Select(\"*\").First(&goods).Error\n\tif err != nil {\n\t\treturn\n\t}\n\n\t_, err = orm.Insert(ctx, db, &respository.Test{\n\t\tGoodsId: 333,\n\t\tName:    \"a\",\n\t})\n\tif err != nil {\n\t\treturn\n\t}\n\n\twhere := map[string]interface{}{\"goods_id\": 333}\n\tupdate := map[string]interface{}{\"name\": 333}\n\n\t_, err = orm.Update(ctx, db, &respository.Test{}, where, update)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t_, err = orm.Delete(ctx, db, &respository.Test{}, where)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar name string\n\terr = db.WithContext(ctx).Table(\"test\").Where(\"id = ?\", 1).Select(\"name\").Row().Scan(&name)\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = db.WithContext(ctx).Raw(\"select * from test where id = 1 limit 1\").Scan(&goods).Error\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}\n"
  },
  {
    "path": "app/module/ping/api/ping.go",
    "content": "package api\n\nimport (\n\t\"github.com/gin-gonic/gin\"\n\n\t\"github.com/why444216978/gin-api/app/response\"\n\tgin_api \"github.com/why444216978/gin-api/app/rpc/gin-api\"\n\thttpResponse \"github.com/why444216978/gin-api/server/http/response\"\n)\n\nfunc Ping(c *gin.Context) {\n\tresponse.ResponseJSON(c, response.CodeSuccess, nil, nil)\n}\n\nfunc RPC(c *gin.Context) {\n\tret, err := gin_api.Ping(c.Request.Context())\n\tif err != nil {\n\t\tresponse.ResponseJSON(c, response.CodeServer, ret, httpResponse.WrapToast(err, err.Error()))\n\t\treturn\n\t}\n\tresponse.ResponseJSON(c, response.CodeSuccess, ret, nil)\n}\n"
  },
  {
    "path": "app/module/ping/job/job.go",
    "content": "package job\n"
  },
  {
    "path": "app/module/ping/responsitory/responsitory.go",
    "content": "package responsitory\n"
  },
  {
    "path": "app/module/ping/service/service.go",
    "content": "package service\n"
  },
  {
    "path": "app/module/test/api/test.go",
    "content": "package api\n\nimport (\n\t\"time\"\n\n\t\"github.com/gin-gonic/gin\"\n\n\t\"github.com/why444216978/gin-api/app/response\"\n\tgin_api \"github.com/why444216978/gin-api/app/rpc/gin-api\"\n\thttpResponse \"github.com/why444216978/gin-api/server/http/response\"\n\t\"github.com/why444216978/go-util/http\"\n)\n\nfunc Rpc(c *gin.Context) {\n\ttime.Sleep(time.Millisecond * 30)\n\tret, err := gin_api.RPC(c.Request.Context())\n\tif err != nil {\n\t\tresponse.ResponseJSON(c, response.CodeServer, ret, httpResponse.WrapToast(err, err.Error()))\n\t\treturn\n\t}\n\n\tresponse.ResponseJSON(c, response.CodeSuccess, ret, nil)\n}\n\ntype RPC1Request struct {\n\tA string `json:\"a\"`\n}\n\nfunc Rpc1(c *gin.Context) {\n\ttime.Sleep(time.Millisecond * 99)\n\tvar req RPC1Request\n\tif err := http.ParseAndValidateBody(c.Request, &req); err != nil {\n\t\tresponse.ResponseJSON(c, response.CodeParams, nil, httpResponse.WrapToast(err, err.Error()))\n\t\treturn\n\t}\n\n\tret, err := gin_api.RPC1(c.Request.Context())\n\tif err != nil {\n\t\tresponse.ResponseJSON(c, response.CodeServer, ret, httpResponse.WrapToast(err, err.Error()))\n\t\treturn\n\t}\n\n\tresponse.ResponseJSON(c, response.CodeSuccess, ret, nil)\n}\n\nfunc Panic(c *gin.Context) {\n\tpanic(\"test err\")\n}\n"
  },
  {
    "path": "app/module/test/job/grpc/job.go",
    "content": "package grpc\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"time\"\n\n\tpb \"github.com/why444216978/gin-api/app/module/test/service/grpc/helloworld\"\n\tclient \"github.com/why444216978/gin-api/client/grpc\"\n\t\"github.com/why444216978/gin-api/library/app\"\n)\n\nfunc Start(ctx context.Context) (err error) {\n\tcall()\n\treturn\n}\n\nfunc call() {\n\tcc, err := client.Conn(context.Background(), fmt.Sprintf(\":%d\", app.Port()))\n\tif err != nil {\n\t\treturn\n\t}\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tclient := pb.NewGreeterClient(cc)\n\n\tticker := time.NewTicker(time.Second)\n\tfor range ticker.C {\n\t\treply, err := client.SayHello(context.Background(), &pb.HelloRequest{Name: \"why\"})\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tfmt.Println(reply)\n\t}\n}\n"
  },
  {
    "path": "app/module/test/respository/respository.go",
    "content": "package respository\n"
  },
  {
    "path": "app/module/test/service/grpc/google/api/annotations.proto",
    "content": "// Copyright (c) 2015, Google Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nsyntax = \"proto3\";\n\npackage google.api;\n\nimport \"google/api/http.proto\";\nimport \"google/protobuf/descriptor.proto\";\n\noption go_package = \"google.golang.org/genproto/googleapis/api/annotations;annotations\";\noption java_multiple_files = true;\noption java_outer_classname = \"AnnotationsProto\";\noption java_package = \"com.google.api\";\noption objc_class_prefix = \"GAPI\";\n\nextend google.protobuf.MethodOptions {\n  // See `HttpRule`.\n  HttpRule http = 72295728;\n}\n"
  },
  {
    "path": "app/module/test/service/grpc/google/api/http.proto",
    "content": "// Copyright 2018 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nsyntax = \"proto3\";\n\npackage google.api;\n\noption cc_enable_arenas = true;\noption go_package = \"google.golang.org/genproto/googleapis/api/annotations;annotations\";\noption java_multiple_files = true;\noption java_outer_classname = \"HttpProto\";\noption java_package = \"com.google.api\";\noption objc_class_prefix = \"GAPI\";\n\n\n// Defines the HTTP configuration for an API service. It contains a list of\n// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method\n// to one or more HTTP REST API methods.\nmessage Http {\n  // A list of HTTP configuration rules that apply to individual API methods.\n  //\n  // **NOTE:** All service configuration rules follow \"last one wins\" order.\n  repeated HttpRule rules = 1;\n\n  // When set to true, URL path parmeters will be fully URI-decoded except in\n  // cases of single segment matches in reserved expansion, where \"%2F\" will be\n  // left encoded.\n  //\n  // The default behavior is to not decode RFC 6570 reserved characters in multi\n  // segment matches.\n  bool fully_decode_reserved_expansion = 2;\n}\n\n// `HttpRule` defines the mapping of an RPC method to one or more HTTP\n// REST API methods. The mapping specifies how different portions of the RPC\n// request message are mapped to URL path, URL query parameters, and\n// HTTP request body. The mapping is typically specified as an\n// `google.api.http` annotation on the RPC method,\n// see \"google/api/annotations.proto\" for details.\n//\n// The mapping consists of a field specifying the path template and\n// method kind.  The path template can refer to fields in the request\n// message, as in the example below which describes a REST GET\n// operation on a resource collection of messages:\n//\n//\n//     service Messaging {\n//       rpc GetMessage(GetMessageRequest) returns (Message) {\n//         option (google.api.http).get = \"/v1/messages/{message_id}/{sub.subfield}\";\n//       }\n//     }\n//     message GetMessageRequest {\n//       message SubMessage {\n//         string subfield = 1;\n//       }\n//       string message_id = 1; // mapped to the URL\n//       SubMessage sub = 2;    // `sub.subfield` is url-mapped\n//     }\n//     message Message {\n//       string text = 1; // content of the resource\n//     }\n//\n// The same http annotation can alternatively be expressed inside the\n// `GRPC API Configuration` YAML file.\n//\n//     http:\n//       rules:\n//         - selector: <proto_package_name>.Messaging.GetMessage\n//           get: /v1/messages/{message_id}/{sub.subfield}\n//\n// This definition enables an automatic, bidrectional mapping of HTTP\n// JSON to RPC. Example:\n//\n// HTTP | RPC\n// -----|-----\n// `GET /v1/messages/123456/foo`  | `GetMessage(message_id: \"123456\" sub: SubMessage(subfield: \"foo\"))`\n//\n// In general, not only fields but also field paths can be referenced\n// from a path pattern. Fields mapped to the path pattern cannot be\n// repeated and must have a primitive (non-message) type.\n//\n// Any fields in the request message which are not bound by the path\n// pattern automatically become (optional) HTTP query\n// parameters. Assume the following definition of the request message:\n//\n//\n//     service Messaging {\n//       rpc GetMessage(GetMessageRequest) returns (Message) {\n//         option (google.api.http).get = \"/v1/messages/{message_id}\";\n//       }\n//     }\n//     message GetMessageRequest {\n//       message SubMessage {\n//         string subfield = 1;\n//       }\n//       string message_id = 1; // mapped to the URL\n//       int64 revision = 2;    // becomes a parameter\n//       SubMessage sub = 3;    // `sub.subfield` becomes a parameter\n//     }\n//\n//\n// This enables a HTTP JSON to RPC mapping as below:\n//\n// HTTP | RPC\n// -----|-----\n// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: \"123456\" revision: 2 sub: SubMessage(subfield: \"foo\"))`\n//\n// Note that fields which are mapped to HTTP parameters must have a\n// primitive type or a repeated primitive type. Message types are not\n// allowed. In the case of a repeated type, the parameter can be\n// repeated in the URL, as in `...?param=A&param=B`.\n//\n// For HTTP method kinds which allow a request body, the `body` field\n// specifies the mapping. Consider a REST update method on the\n// message resource collection:\n//\n//\n//     service Messaging {\n//       rpc UpdateMessage(UpdateMessageRequest) returns (Message) {\n//         option (google.api.http) = {\n//           put: \"/v1/messages/{message_id}\"\n//           body: \"message\"\n//         };\n//       }\n//     }\n//     message UpdateMessageRequest {\n//       string message_id = 1; // mapped to the URL\n//       Message message = 2;   // mapped to the body\n//     }\n//\n//\n// The following HTTP JSON to RPC mapping is enabled, where the\n// representation of the JSON in the request body is determined by\n// protos JSON encoding:\n//\n// HTTP | RPC\n// -----|-----\n// `PUT /v1/messages/123456 { \"text\": \"Hi!\" }` | `UpdateMessage(message_id: \"123456\" message { text: \"Hi!\" })`\n//\n// The special name `*` can be used in the body mapping to define that\n// every field not bound by the path template should be mapped to the\n// request body.  This enables the following alternative definition of\n// the update method:\n//\n//     service Messaging {\n//       rpc UpdateMessage(Message) returns (Message) {\n//         option (google.api.http) = {\n//           put: \"/v1/messages/{message_id}\"\n//           body: \"*\"\n//         };\n//       }\n//     }\n//     message Message {\n//       string message_id = 1;\n//       string text = 2;\n//     }\n//\n//\n// The following HTTP JSON to RPC mapping is enabled:\n//\n// HTTP | RPC\n// -----|-----\n// `PUT /v1/messages/123456 { \"text\": \"Hi!\" }` | `UpdateMessage(message_id: \"123456\" text: \"Hi!\")`\n//\n// Note that when using `*` in the body mapping, it is not possible to\n// have HTTP parameters, as all fields not bound by the path end in\n// the body. This makes this option more rarely used in practice of\n// defining REST APIs. The common usage of `*` is in custom methods\n// which don't use the URL at all for transferring data.\n//\n// It is possible to define multiple HTTP methods for one RPC by using\n// the `additional_bindings` option. Example:\n//\n//     service Messaging {\n//       rpc GetMessage(GetMessageRequest) returns (Message) {\n//         option (google.api.http) = {\n//           get: \"/v1/messages/{message_id}\"\n//           additional_bindings {\n//             get: \"/v1/users/{user_id}/messages/{message_id}\"\n//           }\n//         };\n//       }\n//     }\n//     message GetMessageRequest {\n//       string message_id = 1;\n//       string user_id = 2;\n//     }\n//\n//\n// This enables the following two alternative HTTP JSON to RPC\n// mappings:\n//\n// HTTP | RPC\n// -----|-----\n// `GET /v1/messages/123456` | `GetMessage(message_id: \"123456\")`\n// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: \"me\" message_id: \"123456\")`\n//\n// # Rules for HTTP mapping\n//\n// The rules for mapping HTTP path, query parameters, and body fields\n// to the request message are as follows:\n//\n// 1. The `body` field specifies either `*` or a field path, or is\n//    omitted. If omitted, it indicates there is no HTTP request body.\n// 2. Leaf fields (recursive expansion of nested messages in the\n//    request) can be classified into three types:\n//     (a) Matched in the URL template.\n//     (b) Covered by body (if body is `*`, everything except (a) fields;\n//         else everything under the body field)\n//     (c) All other fields.\n// 3. URL query parameters found in the HTTP request are mapped to (c) fields.\n// 4. Any body sent with an HTTP request can contain only (b) fields.\n//\n// The syntax of the path template is as follows:\n//\n//     Template = \"/\" Segments [ Verb ] ;\n//     Segments = Segment { \"/\" Segment } ;\n//     Segment  = \"*\" | \"**\" | LITERAL | Variable ;\n//     Variable = \"{\" FieldPath [ \"=\" Segments ] \"}\" ;\n//     FieldPath = IDENT { \".\" IDENT } ;\n//     Verb     = \":\" LITERAL ;\n//\n// The syntax `*` matches a single path segment. The syntax `**` matches zero\n// or more path segments, which must be the last part of the path except the\n// `Verb`. The syntax `LITERAL` matches literal text in the path.\n//\n// The syntax `Variable` matches part of the URL path as specified by its\n// template. A variable template must not contain other variables. If a variable\n// matches a single path segment, its template may be omitted, e.g. `{var}`\n// is equivalent to `{var=*}`.\n//\n// If a variable contains exactly one path segment, such as `\"{var}\"` or\n// `\"{var=*}\"`, when such a variable is expanded into a URL path, all characters\n// except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the\n// Discovery Document as `{var}`.\n//\n// If a variable contains one or more path segments, such as `\"{var=foo/*}\"`\n// or `\"{var=**}\"`, when such a variable is expanded into a URL path, all\n// characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables\n// show up in the Discovery Document as `{+var}`.\n//\n// NOTE: While the single segment variable matches the semantics of\n// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2\n// Simple String Expansion, the multi segment variable **does not** match\n// RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion\n// does not expand special characters like `?` and `#`, which would lead\n// to invalid URLs.\n//\n// NOTE: the field paths in variables and in the `body` must not refer to\n// repeated fields or map fields.\nmessage HttpRule {\n  // Selects methods to which this rule applies.\n  //\n  // Refer to [selector][google.api.DocumentationRule.selector] for syntax details.\n  string selector = 1;\n\n  // Determines the URL pattern is matched by this rules. This pattern can be\n  // used with any of the {get|put|post|delete|patch} methods. A custom method\n  // can be defined using the 'custom' field.\n  oneof pattern {\n    // Used for listing and getting information about resources.\n    string get = 2;\n\n    // Used for updating a resource.\n    string put = 3;\n\n    // Used for creating a resource.\n    string post = 4;\n\n    // Used for deleting a resource.\n    string delete = 5;\n\n    // Used for updating a resource.\n    string patch = 6;\n\n    // The custom pattern is used for specifying an HTTP method that is not\n    // included in the `pattern` field, such as HEAD, or \"*\" to leave the\n    // HTTP method unspecified for this rule. The wild-card rule is useful\n    // for services that provide content to Web (HTML) clients.\n    CustomHttpPattern custom = 8;\n  }\n\n  // The name of the request field whose value is mapped to the HTTP body, or\n  // `*` for mapping all fields not captured by the path pattern to the HTTP\n  // body. NOTE: the referred field must not be a repeated field and must be\n  // present at the top-level of request message type.\n  string body = 7;\n\n  // Optional. The name of the response field whose value is mapped to the HTTP\n  // body of response. Other response fields are ignored. When\n  // not set, the response message will be used as HTTP body of response.\n  string response_body = 12;\n\n  // Additional HTTP bindings for the selector. Nested bindings must\n  // not contain an `additional_bindings` field themselves (that is,\n  // the nesting may only be one level deep).\n  repeated HttpRule additional_bindings = 11;\n}\n\n// A custom pattern is used for defining custom HTTP verb.\nmessage CustomHttpPattern {\n  // The name of this custom HTTP verb.\n  string kind = 1;\n\n  // The path matched by this custom verb.\n  string path = 2;\n}\n"
  },
  {
    "path": "app/module/test/service/grpc/google/api/httpbody.proto",
    "content": "// Copyright 2018 Google LLC.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n\nsyntax = \"proto3\";\n\npackage google.api;\n\nimport \"google/protobuf/any.proto\";\n\noption cc_enable_arenas = true;\noption go_package = \"google.golang.org/genproto/googleapis/api/httpbody;httpbody\";\noption java_multiple_files = true;\noption java_outer_classname = \"HttpBodyProto\";\noption java_package = \"com.google.api\";\noption objc_class_prefix = \"GAPI\";\n\n// Message that represents an arbitrary HTTP body. It should only be used for\n// payload formats that can't be represented as JSON, such as raw binary or\n// an HTML page.\n//\n//\n// This message can be used both in streaming and non-streaming API methods in\n// the request as well as the response.\n//\n// It can be used as a top-level request field, which is convenient if one\n// wants to extract parameters from either the URL or HTTP template into the\n// request fields and also want access to the raw HTTP body.\n//\n// Example:\n//\n//     message GetResourceRequest {\n//       // A unique request id.\n//       string request_id = 1;\n//\n//       // The raw HTTP body is bound to this field.\n//       google.api.HttpBody http_body = 2;\n//     }\n//\n//     service ResourceService {\n//       rpc GetResource(GetResourceRequest) returns (google.api.HttpBody);\n//       rpc UpdateResource(google.api.HttpBody) returns\n//       (google.protobuf.Empty);\n//     }\n//\n// Example with streaming methods:\n//\n//     service CaldavService {\n//       rpc GetCalendar(stream google.api.HttpBody)\n//         returns (stream google.api.HttpBody);\n//       rpc UpdateCalendar(stream google.api.HttpBody)\n//         returns (stream google.api.HttpBody);\n//     }\n//\n// Use of this type only changes how the request and response bodies are\n// handled, all other features will continue to work unchanged.\nmessage HttpBody {\n  // The HTTP Content-Type header value specifying the content type of the body.\n  string content_type = 1;\n\n  // The HTTP request/response body as raw binary.\n  bytes data = 2;\n\n  // Application specific response metadata. Must be set in the first response\n  // for streaming APIs.\n  repeated google.protobuf.Any extensions = 3;\n}"
  },
  {
    "path": "app/module/test/service/grpc/google/protobuf/descriptor.proto",
    "content": "// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// https://developers.google.com/protocol-buffers/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Author: kenton@google.com (Kenton Varda)\n//  Based on original Protocol Buffers design by\n//  Sanjay Ghemawat, Jeff Dean, and others.\n//\n// The messages in this file describe the definitions found in .proto files.\n// A valid .proto file can be translated directly to a FileDescriptorProto\n// without any other information (e.g. without reading its imports).\n\n\nsyntax = \"proto2\";\n\npackage google.protobuf;\n\noption go_package = \"google.golang.org/protobuf/types/descriptorpb\";\noption java_package = \"com.google.protobuf\";\noption java_outer_classname = \"DescriptorProtos\";\noption csharp_namespace = \"Google.Protobuf.Reflection\";\noption objc_class_prefix = \"GPB\";\noption cc_enable_arenas = true;\n\n// descriptor.proto must be optimized for speed because reflection-based\n// algorithms don't work during bootstrapping.\noption optimize_for = SPEED;\n\n// The protocol compiler can output a FileDescriptorSet containing the .proto\n// files it parses.\nmessage FileDescriptorSet {\n  repeated FileDescriptorProto file = 1;\n}\n\n// Describes a complete .proto file.\nmessage FileDescriptorProto {\n  optional string name = 1;     // file name, relative to root of source tree\n  optional string package = 2;  // e.g. \"foo\", \"foo.bar\", etc.\n\n  // Names of files imported by this file.\n  repeated string dependency = 3;\n  // Indexes of the public imported files in the dependency list above.\n  repeated int32 public_dependency = 10;\n  // Indexes of the weak imported files in the dependency list.\n  // For Google-internal migration only. Do not use.\n  repeated int32 weak_dependency = 11;\n\n  // All top-level definitions in this file.\n  repeated DescriptorProto message_type = 4;\n  repeated EnumDescriptorProto enum_type = 5;\n  repeated ServiceDescriptorProto service = 6;\n  repeated FieldDescriptorProto extension = 7;\n\n  optional FileOptions options = 8;\n\n  // This field contains optional information about the original source code.\n  // You may safely remove this entire field without harming runtime\n  // functionality of the descriptors -- the information is needed only by\n  // development tools.\n  optional SourceCodeInfo source_code_info = 9;\n\n  // The syntax of the proto file.\n  // The supported values are \"proto2\" and \"proto3\".\n  optional string syntax = 12;\n}\n\n// Describes a message type.\nmessage DescriptorProto {\n  optional string name = 1;\n\n  repeated FieldDescriptorProto field = 2;\n  repeated FieldDescriptorProto extension = 6;\n\n  repeated DescriptorProto nested_type = 3;\n  repeated EnumDescriptorProto enum_type = 4;\n\n  message ExtensionRange {\n    optional int32 start = 1;  // Inclusive.\n    optional int32 end = 2;    // Exclusive.\n\n    optional ExtensionRangeOptions options = 3;\n  }\n  repeated ExtensionRange extension_range = 5;\n\n  repeated OneofDescriptorProto oneof_decl = 8;\n\n  optional MessageOptions options = 7;\n\n  // Range of reserved tag numbers. Reserved tag numbers may not be used by\n  // fields or extension ranges in the same message. Reserved ranges may\n  // not overlap.\n  message ReservedRange {\n    optional int32 start = 1;  // Inclusive.\n    optional int32 end = 2;    // Exclusive.\n  }\n  repeated ReservedRange reserved_range = 9;\n  // Reserved field names, which may not be used by fields in the same message.\n  // A given name may only be reserved once.\n  repeated string reserved_name = 10;\n}\n\nmessage ExtensionRangeOptions {\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\n// Describes a field within a message.\nmessage FieldDescriptorProto {\n  enum Type {\n    // 0 is reserved for errors.\n    // Order is weird for historical reasons.\n    TYPE_DOUBLE = 1;\n    TYPE_FLOAT = 2;\n    // Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if\n    // negative values are likely.\n    TYPE_INT64 = 3;\n    TYPE_UINT64 = 4;\n    // Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if\n    // negative values are likely.\n    TYPE_INT32 = 5;\n    TYPE_FIXED64 = 6;\n    TYPE_FIXED32 = 7;\n    TYPE_BOOL = 8;\n    TYPE_STRING = 9;\n    // Tag-delimited aggregate.\n    // Group type is deprecated and not supported in proto3. However, Proto3\n    // implementations should still be able to parse the group wire format and\n    // treat group fields as unknown fields.\n    TYPE_GROUP = 10;\n    TYPE_MESSAGE = 11;  // Length-delimited aggregate.\n\n    // New in version 2.\n    TYPE_BYTES = 12;\n    TYPE_UINT32 = 13;\n    TYPE_ENUM = 14;\n    TYPE_SFIXED32 = 15;\n    TYPE_SFIXED64 = 16;\n    TYPE_SINT32 = 17;  // Uses ZigZag encoding.\n    TYPE_SINT64 = 18;  // Uses ZigZag encoding.\n  }\n\n  enum Label {\n    // 0 is reserved for errors\n    LABEL_OPTIONAL = 1;\n    LABEL_REQUIRED = 2;\n    LABEL_REPEATED = 3;\n  }\n\n  optional string name = 1;\n  optional int32 number = 3;\n  optional Label label = 4;\n\n  // If type_name is set, this need not be set.  If both this and type_name\n  // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.\n  optional Type type = 5;\n\n  // For message and enum types, this is the name of the type.  If the name\n  // starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping\n  // rules are used to find the type (i.e. first the nested types within this\n  // message are searched, then within the parent, on up to the root\n  // namespace).\n  optional string type_name = 6;\n\n  // For extensions, this is the name of the type being extended.  It is\n  // resolved in the same manner as type_name.\n  optional string extendee = 2;\n\n  // For numeric types, contains the original text representation of the value.\n  // For booleans, \"true\" or \"false\".\n  // For strings, contains the default text contents (not escaped in any way).\n  // For bytes, contains the C escaped value.  All bytes >= 128 are escaped.\n  // TODO(kenton):  Base-64 encode?\n  optional string default_value = 7;\n\n  // If set, gives the index of a oneof in the containing type's oneof_decl\n  // list.  This field is a member of that oneof.\n  optional int32 oneof_index = 9;\n\n  // JSON name of this field. The value is set by protocol compiler. If the\n  // user has set a \"json_name\" option on this field, that option's value\n  // will be used. Otherwise, it's deduced from the field's name by converting\n  // it to camelCase.\n  optional string json_name = 10;\n\n  optional FieldOptions options = 8;\n\n  // If true, this is a proto3 \"optional\". When a proto3 field is optional, it\n  // tracks presence regardless of field type.\n  //\n  // When proto3_optional is true, this field must be belong to a oneof to\n  // signal to old proto3 clients that presence is tracked for this field. This\n  // oneof is known as a \"synthetic\" oneof, and this field must be its sole\n  // member (each proto3 optional field gets its own synthetic oneof). Synthetic\n  // oneofs exist in the descriptor only, and do not generate any API. Synthetic\n  // oneofs must be ordered after all \"real\" oneofs.\n  //\n  // For message fields, proto3_optional doesn't create any semantic change,\n  // since non-repeated message fields always track presence. However it still\n  // indicates the semantic detail of whether the user wrote \"optional\" or not.\n  // This can be useful for round-tripping the .proto file. For consistency we\n  // give message fields a synthetic oneof also, even though it is not required\n  // to track presence. This is especially important because the parser can't\n  // tell if a field is a message or an enum, so it must always create a\n  // synthetic oneof.\n  //\n  // Proto2 optional fields do not set this flag, because they already indicate\n  // optional with `LABEL_OPTIONAL`.\n  optional bool proto3_optional = 17;\n}\n\n// Describes a oneof.\nmessage OneofDescriptorProto {\n  optional string name = 1;\n  optional OneofOptions options = 2;\n}\n\n// Describes an enum type.\nmessage EnumDescriptorProto {\n  optional string name = 1;\n\n  repeated EnumValueDescriptorProto value = 2;\n\n  optional EnumOptions options = 3;\n\n  // Range of reserved numeric values. Reserved values may not be used by\n  // entries in the same enum. Reserved ranges may not overlap.\n  //\n  // Note that this is distinct from DescriptorProto.ReservedRange in that it\n  // is inclusive such that it can appropriately represent the entire int32\n  // domain.\n  message EnumReservedRange {\n    optional int32 start = 1;  // Inclusive.\n    optional int32 end = 2;    // Inclusive.\n  }\n\n  // Range of reserved numeric values. Reserved numeric values may not be used\n  // by enum values in the same enum declaration. Reserved ranges may not\n  // overlap.\n  repeated EnumReservedRange reserved_range = 4;\n\n  // Reserved enum value names, which may not be reused. A given name may only\n  // be reserved once.\n  repeated string reserved_name = 5;\n}\n\n// Describes a value within an enum.\nmessage EnumValueDescriptorProto {\n  optional string name = 1;\n  optional int32 number = 2;\n\n  optional EnumValueOptions options = 3;\n}\n\n// Describes a service.\nmessage ServiceDescriptorProto {\n  optional string name = 1;\n  repeated MethodDescriptorProto method = 2;\n\n  optional ServiceOptions options = 3;\n}\n\n// Describes a method of a service.\nmessage MethodDescriptorProto {\n  optional string name = 1;\n\n  // Input and output type names.  These are resolved in the same way as\n  // FieldDescriptorProto.type_name, but must refer to a message type.\n  optional string input_type = 2;\n  optional string output_type = 3;\n\n  optional MethodOptions options = 4;\n\n  // Identifies if client streams multiple client messages\n  optional bool client_streaming = 5 [default = false];\n  // Identifies if server streams multiple server messages\n  optional bool server_streaming = 6 [default = false];\n}\n\n\n// ===================================================================\n// Options\n\n// Each of the definitions above may have \"options\" attached.  These are\n// just annotations which may cause code to be generated slightly differently\n// or may contain hints for code that manipulates protocol messages.\n//\n// Clients may define custom options as extensions of the *Options messages.\n// These extensions may not yet be known at parsing time, so the parser cannot\n// store the values in them.  Instead it stores them in a field in the *Options\n// message called uninterpreted_option. This field must have the same name\n// across all *Options messages. We then use this field to populate the\n// extensions when we build a descriptor, at which point all protos have been\n// parsed and so all extensions are known.\n//\n// Extension numbers for custom options may be chosen as follows:\n// * For options which will only be used within a single application or\n//   organization, or for experimental options, use field numbers 50000\n//   through 99999.  It is up to you to ensure that you do not use the\n//   same number for multiple options.\n// * For options which will be published and used publicly by multiple\n//   independent entities, e-mail protobuf-global-extension-registry@google.com\n//   to reserve extension numbers. Simply provide your project name (e.g.\n//   Objective-C plugin) and your project website (if available) -- there's no\n//   need to explain how you intend to use them. Usually you only need one\n//   extension number. You can declare multiple options with only one extension\n//   number by putting them in a sub-message. See the Custom Options section of\n//   the docs for examples:\n//   https://developers.google.com/protocol-buffers/docs/proto#options\n//   If this turns out to be popular, a web service will be set up\n//   to automatically assign option numbers.\n\nmessage FileOptions {\n\n  // Sets the Java package where classes generated from this .proto will be\n  // placed.  By default, the proto package is used, but this is often\n  // inappropriate because proto packages do not normally start with backwards\n  // domain names.\n  optional string java_package = 1;\n\n\n  // Controls the name of the wrapper Java class generated for the .proto file.\n  // That class will always contain the .proto file's getDescriptor() method as\n  // well as any top-level extensions defined in the .proto file.\n  // If java_multiple_files is disabled, then all the other classes from the\n  // .proto file will be nested inside the single wrapper outer class.\n  optional string java_outer_classname = 8;\n\n  // If enabled, then the Java code generator will generate a separate .java\n  // file for each top-level message, enum, and service defined in the .proto\n  // file.  Thus, these types will *not* be nested inside the wrapper class\n  // named by java_outer_classname.  However, the wrapper class will still be\n  // generated to contain the file's getDescriptor() method as well as any\n  // top-level extensions defined in the file.\n  optional bool java_multiple_files = 10 [default = false];\n\n  // This option does nothing.\n  optional bool java_generate_equals_and_hash = 20 [deprecated=true];\n\n  // If set true, then the Java2 code generator will generate code that\n  // throws an exception whenever an attempt is made to assign a non-UTF-8\n  // byte sequence to a string field.\n  // Message reflection will do the same.\n  // However, an extension field still accepts non-UTF-8 byte sequences.\n  // This option has no effect on when used with the lite runtime.\n  optional bool java_string_check_utf8 = 27 [default = false];\n\n\n  // Generated classes can be optimized for speed or code size.\n  enum OptimizeMode {\n    SPEED = 1;         // Generate complete code for parsing, serialization,\n                       // etc.\n    CODE_SIZE = 2;     // Use ReflectionOps to implement these methods.\n    LITE_RUNTIME = 3;  // Generate code using MessageLite and the lite runtime.\n  }\n  optional OptimizeMode optimize_for = 9 [default = SPEED];\n\n  // Sets the Go package where structs generated from this .proto will be\n  // placed. If omitted, the Go package will be derived from the following:\n  //   - The basename of the package import path, if provided.\n  //   - Otherwise, the package statement in the .proto file, if present.\n  //   - Otherwise, the basename of the .proto file, without extension.\n  optional string go_package = 11;\n\n\n\n\n  // Should generic services be generated in each language?  \"Generic\" services\n  // are not specific to any particular RPC system.  They are generated by the\n  // main code generators in each language (without additional plugins).\n  // Generic services were the only kind of service generation supported by\n  // early versions of google.protobuf.\n  //\n  // Generic services are now considered deprecated in favor of using plugins\n  // that generate code specific to your particular RPC system.  Therefore,\n  // these default to false.  Old code which depends on generic services should\n  // explicitly set them to true.\n  optional bool cc_generic_services = 16 [default = false];\n  optional bool java_generic_services = 17 [default = false];\n  optional bool py_generic_services = 18 [default = false];\n  optional bool php_generic_services = 42 [default = false];\n\n  // Is this file deprecated?\n  // Depending on the target platform, this can emit Deprecated annotations\n  // for everything in the file, or it will be completely ignored; in the very\n  // least, this is a formalization for deprecating files.\n  optional bool deprecated = 23 [default = false];\n\n  // Enables the use of arenas for the proto messages in this file. This applies\n  // only to generated classes for C++.\n  optional bool cc_enable_arenas = 31 [default = true];\n\n\n  // Sets the objective c class prefix which is prepended to all objective c\n  // generated classes from this .proto. There is no default.\n  optional string objc_class_prefix = 36;\n\n  // Namespace for generated classes; defaults to the package.\n  optional string csharp_namespace = 37;\n\n  // By default Swift generators will take the proto package and CamelCase it\n  // replacing '.' with underscore and use that to prefix the types/symbols\n  // defined. When this options is provided, they will use this value instead\n  // to prefix the types/symbols defined.\n  optional string swift_prefix = 39;\n\n  // Sets the php class prefix which is prepended to all php generated classes\n  // from this .proto. Default is empty.\n  optional string php_class_prefix = 40;\n\n  // Use this option to change the namespace of php generated classes. Default\n  // is empty. When this option is empty, the package name will be used for\n  // determining the namespace.\n  optional string php_namespace = 41;\n\n  // Use this option to change the namespace of php generated metadata classes.\n  // Default is empty. When this option is empty, the proto file name will be\n  // used for determining the namespace.\n  optional string php_metadata_namespace = 44;\n\n  // Use this option to change the package of ruby generated classes. Default\n  // is empty. When this option is not set, the package name will be used for\n  // determining the ruby package.\n  optional string ruby_package = 45;\n\n\n  // The parser stores options it doesn't recognize here.\n  // See the documentation for the \"Options\" section above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message.\n  // See the documentation for the \"Options\" section above.\n  extensions 1000 to max;\n\n  reserved 38;\n}\n\nmessage MessageOptions {\n  // Set true to use the old proto1 MessageSet wire format for extensions.\n  // This is provided for backwards-compatibility with the MessageSet wire\n  // format.  You should not use this for any other reason:  It's less\n  // efficient, has fewer features, and is more complicated.\n  //\n  // The message must be defined exactly as follows:\n  //   message Foo {\n  //     option message_set_wire_format = true;\n  //     extensions 4 to max;\n  //   }\n  // Note that the message cannot have any defined fields; MessageSets only\n  // have extensions.\n  //\n  // All extensions of your type must be singular messages; e.g. they cannot\n  // be int32s, enums, or repeated messages.\n  //\n  // Because this is an option, the above two restrictions are not enforced by\n  // the protocol compiler.\n  optional bool message_set_wire_format = 1 [default = false];\n\n  // Disables the generation of the standard \"descriptor()\" accessor, which can\n  // conflict with a field of the same name.  This is meant to make migration\n  // from proto1 easier; new code should avoid fields named \"descriptor\".\n  optional bool no_standard_descriptor_accessor = 2 [default = false];\n\n  // Is this message deprecated?\n  // Depending on the target platform, this can emit Deprecated annotations\n  // for the message, or it will be completely ignored; in the very least,\n  // this is a formalization for deprecating messages.\n  optional bool deprecated = 3 [default = false];\n\n  reserved 4, 5, 6;\n\n  // Whether the message is an automatically generated map entry type for the\n  // maps field.\n  //\n  // For maps fields:\n  //     map<KeyType, ValueType> map_field = 1;\n  // The parsed descriptor looks like:\n  //     message MapFieldEntry {\n  //         option map_entry = true;\n  //         optional KeyType key = 1;\n  //         optional ValueType value = 2;\n  //     }\n  //     repeated MapFieldEntry map_field = 1;\n  //\n  // Implementations may choose not to generate the map_entry=true message, but\n  // use a native map in the target language to hold the keys and values.\n  // The reflection APIs in such implementations still need to work as\n  // if the field is a repeated message field.\n  //\n  // NOTE: Do not set the option in .proto files. Always use the maps syntax\n  // instead. The option should only be implicitly set by the proto compiler\n  // parser.\n  optional bool map_entry = 7;\n\n  reserved 8;  // javalite_serializable\n  reserved 9;  // javanano_as_lite\n\n\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\nmessage FieldOptions {\n  // The ctype option instructs the C++ code generator to use a different\n  // representation of the field than it normally would.  See the specific\n  // options below.  This option is not yet implemented in the open source\n  // release -- sorry, we'll try to include it in a future version!\n  optional CType ctype = 1 [default = STRING];\n  enum CType {\n    // Default mode.\n    STRING = 0;\n\n    CORD = 1;\n\n    STRING_PIECE = 2;\n  }\n  // The packed option can be enabled for repeated primitive fields to enable\n  // a more efficient representation on the wire. Rather than repeatedly\n  // writing the tag and type for each element, the entire array is encoded as\n  // a single length-delimited blob. In proto3, only explicit setting it to\n  // false will avoid using packed encoding.\n  optional bool packed = 2;\n\n  // The jstype option determines the JavaScript type used for values of the\n  // field.  The option is permitted only for 64 bit integral and fixed types\n  // (int64, uint64, sint64, fixed64, sfixed64).  A field with jstype JS_STRING\n  // is represented as JavaScript string, which avoids loss of precision that\n  // can happen when a large value is converted to a floating point JavaScript.\n  // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to\n  // use the JavaScript \"number\" type.  The behavior of the default option\n  // JS_NORMAL is implementation dependent.\n  //\n  // This option is an enum to permit additional types to be added, e.g.\n  // goog.math.Integer.\n  optional JSType jstype = 6 [default = JS_NORMAL];\n  enum JSType {\n    // Use the default type.\n    JS_NORMAL = 0;\n\n    // Use JavaScript strings.\n    JS_STRING = 1;\n\n    // Use JavaScript numbers.\n    JS_NUMBER = 2;\n  }\n\n  // Should this field be parsed lazily?  Lazy applies only to message-type\n  // fields.  It means that when the outer message is initially parsed, the\n  // inner message's contents will not be parsed but instead stored in encoded\n  // form.  The inner message will actually be parsed when it is first accessed.\n  //\n  // This is only a hint.  Implementations are free to choose whether to use\n  // eager or lazy parsing regardless of the value of this option.  However,\n  // setting this option true suggests that the protocol author believes that\n  // using lazy parsing on this field is worth the additional bookkeeping\n  // overhead typically needed to implement it.\n  //\n  // This option does not affect the public interface of any generated code;\n  // all method signatures remain the same.  Furthermore, thread-safety of the\n  // interface is not affected by this option; const methods remain safe to\n  // call from multiple threads concurrently, while non-const methods continue\n  // to require exclusive access.\n  //\n  //\n  // Note that implementations may choose not to check required fields within\n  // a lazy sub-message.  That is, calling IsInitialized() on the outer message\n  // may return true even if the inner message has missing required fields.\n  // This is necessary because otherwise the inner message would have to be\n  // parsed in order to perform the check, defeating the purpose of lazy\n  // parsing.  An implementation which chooses not to check required fields\n  // must be consistent about it.  That is, for any particular sub-message, the\n  // implementation must either *always* check its required fields, or *never*\n  // check its required fields, regardless of whether or not the message has\n  // been parsed.\n  optional bool lazy = 5 [default = false];\n\n  // Is this field deprecated?\n  // Depending on the target platform, this can emit Deprecated annotations\n  // for accessors, or it will be completely ignored; in the very least, this\n  // is a formalization for deprecating fields.\n  optional bool deprecated = 3 [default = false];\n\n  // For Google-internal migration only. Do not use.\n  optional bool weak = 10 [default = false];\n\n\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n\n  reserved 4;  // removed jtype\n}\n\nmessage OneofOptions {\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\nmessage EnumOptions {\n\n  // Set this option to true to allow mapping different tag names to the same\n  // value.\n  optional bool allow_alias = 2;\n\n  // Is this enum deprecated?\n  // Depending on the target platform, this can emit Deprecated annotations\n  // for the enum, or it will be completely ignored; in the very least, this\n  // is a formalization for deprecating enums.\n  optional bool deprecated = 3 [default = false];\n\n  reserved 5;  // javanano_as_lite\n\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\nmessage EnumValueOptions {\n  // Is this enum value deprecated?\n  // Depending on the target platform, this can emit Deprecated annotations\n  // for the enum value, or it will be completely ignored; in the very least,\n  // this is a formalization for deprecating enum values.\n  optional bool deprecated = 1 [default = false];\n\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\nmessage ServiceOptions {\n\n  // Note:  Field numbers 1 through 32 are reserved for Google's internal RPC\n  //   framework.  We apologize for hoarding these numbers to ourselves, but\n  //   we were already using them long before we decided to release Protocol\n  //   Buffers.\n\n  // Is this service deprecated?\n  // Depending on the target platform, this can emit Deprecated annotations\n  // for the service, or it will be completely ignored; in the very least,\n  // this is a formalization for deprecating services.\n  optional bool deprecated = 33 [default = false];\n\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\nmessage MethodOptions {\n\n  // Note:  Field numbers 1 through 32 are reserved for Google's internal RPC\n  //   framework.  We apologize for hoarding these numbers to ourselves, but\n  //   we were already using them long before we decided to release Protocol\n  //   Buffers.\n\n  // Is this method deprecated?\n  // Depending on the target platform, this can emit Deprecated annotations\n  // for the method, or it will be completely ignored; in the very least,\n  // this is a formalization for deprecating methods.\n  optional bool deprecated = 33 [default = false];\n\n  // Is this method side-effect-free (or safe in HTTP parlance), or idempotent,\n  // or neither? HTTP based RPC implementation may choose GET verb for safe\n  // methods, and PUT verb for idempotent methods instead of the default POST.\n  enum IdempotencyLevel {\n    IDEMPOTENCY_UNKNOWN = 0;\n    NO_SIDE_EFFECTS = 1;  // implies idempotent\n    IDEMPOTENT = 2;       // idempotent, but may have side effects\n  }\n  optional IdempotencyLevel idempotency_level = 34\n      [default = IDEMPOTENCY_UNKNOWN];\n\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\n\n// A message representing a option the parser does not recognize. This only\n// appears in options protos created by the compiler::Parser class.\n// DescriptorPool resolves these when building Descriptor objects. Therefore,\n// options protos in descriptor objects (e.g. returned by Descriptor::options(),\n// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions\n// in them.\nmessage UninterpretedOption {\n  // The name of the uninterpreted option.  Each string represents a segment in\n  // a dot-separated name.  is_extension is true iff a segment represents an\n  // extension (denoted with parentheses in options specs in .proto files).\n  // E.g.,{ [\"foo\", false], [\"bar.baz\", true], [\"qux\", false] } represents\n  // \"foo.(bar.baz).qux\".\n  message NamePart {\n    required string name_part = 1;\n    required bool is_extension = 2;\n  }\n  repeated NamePart name = 2;\n\n  // The value of the uninterpreted option, in whatever type the tokenizer\n  // identified it as during parsing. Exactly one of these should be set.\n  optional string identifier_value = 3;\n  optional uint64 positive_int_value = 4;\n  optional int64 negative_int_value = 5;\n  optional double double_value = 6;\n  optional bytes string_value = 7;\n  optional string aggregate_value = 8;\n}\n\n// ===================================================================\n// Optional source code info\n\n// Encapsulates information about the original source file from which a\n// FileDescriptorProto was generated.\nmessage SourceCodeInfo {\n  // A Location identifies a piece of source code in a .proto file which\n  // corresponds to a particular definition.  This information is intended\n  // to be useful to IDEs, code indexers, documentation generators, and similar\n  // tools.\n  //\n  // For example, say we have a file like:\n  //   message Foo {\n  //     optional string foo = 1;\n  //   }\n  // Let's look at just the field definition:\n  //   optional string foo = 1;\n  //   ^       ^^     ^^  ^  ^^^\n  //   a       bc     de  f  ghi\n  // We have the following locations:\n  //   span   path               represents\n  //   [a,i)  [ 4, 0, 2, 0 ]     The whole field definition.\n  //   [a,b)  [ 4, 0, 2, 0, 4 ]  The label (optional).\n  //   [c,d)  [ 4, 0, 2, 0, 5 ]  The type (string).\n  //   [e,f)  [ 4, 0, 2, 0, 1 ]  The name (foo).\n  //   [g,h)  [ 4, 0, 2, 0, 3 ]  The number (1).\n  //\n  // Notes:\n  // - A location may refer to a repeated field itself (i.e. not to any\n  //   particular index within it).  This is used whenever a set of elements are\n  //   logically enclosed in a single code segment.  For example, an entire\n  //   extend block (possibly containing multiple extension definitions) will\n  //   have an outer location whose path refers to the \"extensions\" repeated\n  //   field without an index.\n  // - Multiple locations may have the same path.  This happens when a single\n  //   logical declaration is spread out across multiple places.  The most\n  //   obvious example is the \"extend\" block again -- there may be multiple\n  //   extend blocks in the same scope, each of which will have the same path.\n  // - A location's span is not always a subset of its parent's span.  For\n  //   example, the \"extendee\" of an extension declaration appears at the\n  //   beginning of the \"extend\" block and is shared by all extensions within\n  //   the block.\n  // - Just because a location's span is a subset of some other location's span\n  //   does not mean that it is a descendant.  For example, a \"group\" defines\n  //   both a type and a field in a single declaration.  Thus, the locations\n  //   corresponding to the type and field and their components will overlap.\n  // - Code which tries to interpret locations should probably be designed to\n  //   ignore those that it doesn't understand, as more types of locations could\n  //   be recorded in the future.\n  repeated Location location = 1;\n  message Location {\n    // Identifies which part of the FileDescriptorProto was defined at this\n    // location.\n    //\n    // Each element is a field number or an index.  They form a path from\n    // the root FileDescriptorProto to the place where the definition.  For\n    // example, this path:\n    //   [ 4, 3, 2, 7, 1 ]\n    // refers to:\n    //   file.message_type(3)  // 4, 3\n    //       .field(7)         // 2, 7\n    //       .name()           // 1\n    // This is because FileDescriptorProto.message_type has field number 4:\n    //   repeated DescriptorProto message_type = 4;\n    // and DescriptorProto.field has field number 2:\n    //   repeated FieldDescriptorProto field = 2;\n    // and FieldDescriptorProto.name has field number 1:\n    //   optional string name = 1;\n    //\n    // Thus, the above path gives the location of a field name.  If we removed\n    // the last element:\n    //   [ 4, 3, 2, 7 ]\n    // this path refers to the whole field declaration (from the beginning\n    // of the label to the terminating semicolon).\n    repeated int32 path = 1 [packed = true];\n\n    // Always has exactly three or four elements: start line, start column,\n    // end line (optional, otherwise assumed same as start line), end column.\n    // These are packed into a single field for efficiency.  Note that line\n    // and column numbers are zero-based -- typically you will want to add\n    // 1 to each before displaying to a user.\n    repeated int32 span = 2 [packed = true];\n\n    // If this SourceCodeInfo represents a complete declaration, these are any\n    // comments appearing before and after the declaration which appear to be\n    // attached to the declaration.\n    //\n    // A series of line comments appearing on consecutive lines, with no other\n    // tokens appearing on those lines, will be treated as a single comment.\n    //\n    // leading_detached_comments will keep paragraphs of comments that appear\n    // before (but not connected to) the current element. Each paragraph,\n    // separated by empty lines, will be one comment element in the repeated\n    // field.\n    //\n    // Only the comment content is provided; comment markers (e.g. //) are\n    // stripped out.  For block comments, leading whitespace and an asterisk\n    // will be stripped from the beginning of each line other than the first.\n    // Newlines are included in the output.\n    //\n    // Examples:\n    //\n    //   optional int32 foo = 1;  // Comment attached to foo.\n    //   // Comment attached to bar.\n    //   optional int32 bar = 2;\n    //\n    //   optional string baz = 3;\n    //   // Comment attached to baz.\n    //   // Another line attached to baz.\n    //\n    //   // Comment attached to qux.\n    //   //\n    //   // Another line attached to qux.\n    //   optional double qux = 4;\n    //\n    //   // Detached comment for corge. This is not leading or trailing comments\n    //   // to qux or corge because there are blank lines separating it from\n    //   // both.\n    //\n    //   // Detached comment for corge paragraph 2.\n    //\n    //   optional string corge = 5;\n    //   /* Block comment attached\n    //    * to corge.  Leading asterisks\n    //    * will be removed. */\n    //   /* Block comment attached to\n    //    * grault. */\n    //   optional int32 grault = 6;\n    //\n    //   // ignored detached comments.\n    optional string leading_comments = 3;\n    optional string trailing_comments = 4;\n    repeated string leading_detached_comments = 6;\n  }\n}\n\n// Describes the relationship between generated code and its original source\n// file. A GeneratedCodeInfo message is associated with only one generated\n// source file, but may contain references to different source .proto files.\nmessage GeneratedCodeInfo {\n  // An Annotation connects some span of text in generated code to an element\n  // of its generating .proto file.\n  repeated Annotation annotation = 1;\n  message Annotation {\n    // Identifies the element in the original source .proto file. This field\n    // is formatted the same as SourceCodeInfo.Location.path.\n    repeated int32 path = 1 [packed = true];\n\n    // Identifies the filesystem path to the original source .proto.\n    optional string source_file = 2;\n\n    // Identifies the starting offset in bytes in the generated code\n    // that relates to the identified object.\n    optional int32 begin = 3;\n\n    // Identifies the ending offset in bytes in the generated code that\n    // relates to the identified offset. The end offset should be one past\n    // the last relevant byte (so the length of the text = end - begin).\n    optional int32 end = 4;\n  }\n}\n"
  },
  {
    "path": "app/module/test/service/grpc/grpc.go",
    "content": "package grpc\n\nimport (\n\t\"context\"\n\n\t\"google.golang.org/grpc\"\n\n\tpb \"github.com/why444216978/gin-api/app/module/test/service/grpc/helloworld\"\n\tserverGRPC \"github.com/why444216978/gin-api/server/grpc\"\n)\n\ntype Server struct {\n\tpb.UnimplementedGreeterServer\n}\n\nfunc (s *Server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) {\n\treturn &pb.HelloReply{Message: in.Name + \" world\"}, nil\n}\n\nfunc RegisterServer(s *grpc.Server) {\n\tpb.RegisterGreeterServer(s, &Server{})\n}\n\nfunc NewService() serverGRPC.Register {\n\treturn serverGRPC.NewRegister(RegisterServer, pb.RegisterGreeterHandlerFromEndpoint)\n}\n"
  },
  {
    "path": "app/module/test/service/grpc/helloworld/hello_world.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.27.1\n// \tprotoc        v3.18.0\n// source: helloworld/hello_world.proto\n\npackage helloworld\n\nimport (\n\t_ \"google.golang.org/genproto/googleapis/api/annotations\"\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n\tsync \"sync\"\n)\n\nconst (\n\t// Verify that this generated code is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)\n\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)\n)\n\n// The request message containing the user's name\ntype HelloRequest struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tName string `protobuf:\"bytes,1,opt,name=name,proto3\" json:\"name,omitempty\"`\n}\n\nfunc (x *HelloRequest) Reset() {\n\t*x = HelloRequest{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_helloworld_hello_world_proto_msgTypes[0]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *HelloRequest) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*HelloRequest) ProtoMessage() {}\n\nfunc (x *HelloRequest) ProtoReflect() protoreflect.Message {\n\tmi := &file_helloworld_hello_world_proto_msgTypes[0]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use HelloRequest.ProtoReflect.Descriptor instead.\nfunc (*HelloRequest) Descriptor() ([]byte, []int) {\n\treturn file_helloworld_hello_world_proto_rawDescGZIP(), []int{0}\n}\n\nfunc (x *HelloRequest) GetName() string {\n\tif x != nil {\n\t\treturn x.Name\n\t}\n\treturn \"\"\n}\n\n// The response message containing the greetings\ntype HelloReply struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tMessage string `protobuf:\"bytes,1,opt,name=message,proto3\" json:\"message,omitempty\"`\n}\n\nfunc (x *HelloReply) Reset() {\n\t*x = HelloReply{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_helloworld_hello_world_proto_msgTypes[1]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *HelloReply) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*HelloReply) ProtoMessage() {}\n\nfunc (x *HelloReply) ProtoReflect() protoreflect.Message {\n\tmi := &file_helloworld_hello_world_proto_msgTypes[1]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use HelloReply.ProtoReflect.Descriptor instead.\nfunc (*HelloReply) Descriptor() ([]byte, []int) {\n\treturn file_helloworld_hello_world_proto_rawDescGZIP(), []int{1}\n}\n\nfunc (x *HelloReply) GetMessage() string {\n\tif x != nil {\n\t\treturn x.Message\n\t}\n\treturn \"\"\n}\n\nvar File_helloworld_hello_world_proto protoreflect.FileDescriptor\n\nvar file_helloworld_hello_world_proto_rawDesc = []byte{\n\t0x0a, 0x1c, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2f, 0x68, 0x65, 0x6c,\n\t0x6c, 0x6f, 0x5f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a,\n\t0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67,\n\t0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f,\n\t0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x22, 0x0a, 0x0c, 0x48, 0x65, 0x6c, 0x6c,\n\t0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,\n\t0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x26, 0x0a, 0x0a,\n\t0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65,\n\t0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73,\n\t0x73, 0x61, 0x67, 0x65, 0x32, 0x61, 0x0a, 0x07, 0x47, 0x72, 0x65, 0x65, 0x74, 0x65, 0x72, 0x12,\n\t0x56, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x18, 0x2e, 0x68, 0x65,\n\t0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65,\n\t0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72,\n\t0x6c, 0x64, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x18, 0x82,\n\t0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70,\n\t0x6c, 0x65, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x42, 0x19, 0x5a, 0x17, 0x2e, 0x2f, 0x68, 0x65, 0x6c,\n\t0x6c, 0x6f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x3b, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x6f, 0x72,\n\t0x6c, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar (\n\tfile_helloworld_hello_world_proto_rawDescOnce sync.Once\n\tfile_helloworld_hello_world_proto_rawDescData = file_helloworld_hello_world_proto_rawDesc\n)\n\nfunc file_helloworld_hello_world_proto_rawDescGZIP() []byte {\n\tfile_helloworld_hello_world_proto_rawDescOnce.Do(func() {\n\t\tfile_helloworld_hello_world_proto_rawDescData = protoimpl.X.CompressGZIP(file_helloworld_hello_world_proto_rawDescData)\n\t})\n\treturn file_helloworld_hello_world_proto_rawDescData\n}\n\nvar file_helloworld_hello_world_proto_msgTypes = make([]protoimpl.MessageInfo, 2)\nvar file_helloworld_hello_world_proto_goTypes = []interface{}{\n\t(*HelloRequest)(nil), // 0: helloworld.HelloRequest\n\t(*HelloReply)(nil),   // 1: helloworld.HelloReply\n}\nvar file_helloworld_hello_world_proto_depIdxs = []int32{\n\t0, // 0: helloworld.Greeter.SayHello:input_type -> helloworld.HelloRequest\n\t1, // 1: helloworld.Greeter.SayHello:output_type -> helloworld.HelloReply\n\t1, // [1:2] is the sub-list for method output_type\n\t0, // [0:1] is the sub-list for method input_type\n\t0, // [0:0] is the sub-list for extension type_name\n\t0, // [0:0] is the sub-list for extension extendee\n\t0, // [0:0] is the sub-list for field type_name\n}\n\nfunc init() { file_helloworld_hello_world_proto_init() }\nfunc file_helloworld_hello_world_proto_init() {\n\tif File_helloworld_hello_world_proto != nil {\n\t\treturn\n\t}\n\tif !protoimpl.UnsafeEnabled {\n\t\tfile_helloworld_hello_world_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*HelloRequest); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_helloworld_hello_world_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*HelloReply); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}\n\ttype x struct{}\n\tout := protoimpl.TypeBuilder{\n\t\tFile: protoimpl.DescBuilder{\n\t\t\tGoPackagePath: reflect.TypeOf(x{}).PkgPath(),\n\t\t\tRawDescriptor: file_helloworld_hello_world_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   2,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   1,\n\t\t},\n\t\tGoTypes:           file_helloworld_hello_world_proto_goTypes,\n\t\tDependencyIndexes: file_helloworld_hello_world_proto_depIdxs,\n\t\tMessageInfos:      file_helloworld_hello_world_proto_msgTypes,\n\t}.Build()\n\tFile_helloworld_hello_world_proto = out.File\n\tfile_helloworld_hello_world_proto_rawDesc = nil\n\tfile_helloworld_hello_world_proto_goTypes = nil\n\tfile_helloworld_hello_world_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "app/module/test/service/grpc/helloworld/hello_world.pb.gw.go",
    "content": "// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.\n// source: helloworld/hello_world.proto\n\n/*\nPackage helloworld is a reverse proxy.\n\nIt translates gRPC into RESTful JSON APIs.\n*/\npackage helloworld\n\nimport (\n\t\"context\"\n\t\"io\"\n\t\"net/http\"\n\n\t\"github.com/grpc-ecosystem/grpc-gateway/v2/runtime\"\n\t\"github.com/grpc-ecosystem/grpc-gateway/v2/utilities\"\n\t\"google.golang.org/grpc\"\n\t\"google.golang.org/grpc/codes\"\n\t\"google.golang.org/grpc/grpclog\"\n\t\"google.golang.org/grpc/metadata\"\n\t\"google.golang.org/grpc/status\"\n\t\"google.golang.org/protobuf/proto\"\n)\n\n// Suppress \"imported and not used\" errors\nvar _ codes.Code\nvar _ io.Reader\nvar _ status.Status\nvar _ = runtime.String\nvar _ = utilities.NewDoubleArray\nvar _ = metadata.Join\n\nvar (\n\tfilter_Greeter_SayHello_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}\n)\n\nfunc request_Greeter_SayHello_0(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {\n\tvar protoReq HelloRequest\n\tvar metadata runtime.ServerMetadata\n\n\tif err := req.ParseForm(); err != nil {\n\t\treturn nil, metadata, status.Errorf(codes.InvalidArgument, \"%v\", err)\n\t}\n\tif err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_0); err != nil {\n\t\treturn nil, metadata, status.Errorf(codes.InvalidArgument, \"%v\", err)\n\t}\n\n\tmsg, err := client.SayHello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))\n\treturn msg, metadata, err\n\n}\n\nfunc local_request_Greeter_SayHello_0(ctx context.Context, marshaler runtime.Marshaler, server GreeterServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {\n\tvar protoReq HelloRequest\n\tvar metadata runtime.ServerMetadata\n\n\tif err := req.ParseForm(); err != nil {\n\t\treturn nil, metadata, status.Errorf(codes.InvalidArgument, \"%v\", err)\n\t}\n\tif err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Greeter_SayHello_0); err != nil {\n\t\treturn nil, metadata, status.Errorf(codes.InvalidArgument, \"%v\", err)\n\t}\n\n\tmsg, err := server.SayHello(ctx, &protoReq)\n\treturn msg, metadata, err\n\n}\n\n// RegisterGreeterHandlerServer registers the http handlers for service Greeter to \"mux\".\n// UnaryRPC     :call GreeterServer directly.\n// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.\n// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterGreeterHandlerFromEndpoint instead.\nfunc RegisterGreeterHandlerServer(ctx context.Context, mux *runtime.ServeMux, server GreeterServer) error {\n\n\tmux.Handle(\"GET\", pattern_Greeter_SayHello_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tvar stream runtime.ServerTransportStream\n\t\tctx = grpc.NewContextWithServerTransportStream(ctx, &stream)\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, \"/helloworld.Greeter/SayHello\", runtime.WithHTTPPathPattern(\"/v1/example/echo\"))\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := local_request_Greeter_SayHello_0(rctx, inboundMarshaler, server, req, pathParams)\n\t\tmd.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Greeter_SayHello_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}\n\n// RegisterGreeterHandlerFromEndpoint is same as RegisterGreeterHandler but\n// automatically dials to \"endpoint\" and closes the connection when \"ctx\" gets done.\nfunc RegisterGreeterHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {\n\tconn, err := grpc.Dial(endpoint, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tgo func() {\n\t\t\t<-ctx.Done()\n\t\t\tif cerr := conn.Close(); cerr != nil {\n\t\t\t\tgrpclog.Infof(\"Failed to close conn to %s: %v\", endpoint, cerr)\n\t\t\t}\n\t\t}()\n\t}()\n\n\treturn RegisterGreeterHandler(ctx, mux, conn)\n}\n\n// RegisterGreeterHandler registers the http handlers for service Greeter to \"mux\".\n// The handlers forward requests to the grpc endpoint over \"conn\".\nfunc RegisterGreeterHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {\n\treturn RegisterGreeterHandlerClient(ctx, mux, NewGreeterClient(conn))\n}\n\n// RegisterGreeterHandlerClient registers the http handlers for service Greeter\n// to \"mux\". The handlers forward requests to the grpc endpoint over the given implementation of \"GreeterClient\".\n// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in \"GreeterClient\"\n// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in\n// \"GreeterClient\" to call the correct interceptors.\nfunc RegisterGreeterHandlerClient(ctx context.Context, mux *runtime.ServeMux, client GreeterClient) error {\n\n\tmux.Handle(\"GET\", pattern_Greeter_SayHello_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(req.Context())\n\t\tdefer cancel()\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, mux, req, \"/helloworld.Greeter/SayHello\", runtime.WithHTTPPathPattern(\"/v1/example/echo\"))\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\t\tresp, md, err := request_Greeter_SayHello_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_Greeter_SayHello_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}\n\nvar (\n\tpattern_Greeter_SayHello_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{\"v1\", \"example\", \"echo\"}, \"\"))\n)\n\nvar (\n\tforward_Greeter_SayHello_0 = runtime.ForwardResponseMessage\n)\n"
  },
  {
    "path": "app/module/test/service/grpc/helloworld/hello_world.proto",
    "content": "syntax = \"proto3\";\n\noption go_package=\"./helloworld;helloworld\";\npackage helloworld;\n\nimport \"google/api/annotations.proto\";\n\nservice Greeter {\n  // Sends a greeting\n  rpc SayHello (HelloRequest) returns (HelloReply) {\n    option (google.api.http) = {\n      get: \"/v1/example/echo\"\n    };\n  }\n}\n\n// The request message containing the user's name\nmessage HelloRequest {\n  string name = 1;\n}\n\n// The response message containing the greetings\nmessage HelloReply {\n  string message = 1;\n}"
  },
  {
    "path": "app/module/test/service/grpc/helloworld/hello_world_grpc.pb.go",
    "content": "// Code generated by protoc-gen-go-grpc. DO NOT EDIT.\n\npackage helloworld\n\nimport (\n\tcontext \"context\"\n\tgrpc \"google.golang.org/grpc\"\n\tcodes \"google.golang.org/grpc/codes\"\n\tstatus \"google.golang.org/grpc/status\"\n)\n\n// This is a compile-time assertion to ensure that this generated file\n// is compatible with the grpc package it is being compiled against.\n// Requires gRPC-Go v1.32.0 or later.\nconst _ = grpc.SupportPackageIsVersion7\n\n// GreeterClient is the client API for Greeter service.\n//\n// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.\ntype GreeterClient interface {\n\t// Sends a greeting\n\tSayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error)\n}\n\ntype greeterClient struct {\n\tcc grpc.ClientConnInterface\n}\n\nfunc NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient {\n\treturn &greeterClient{cc}\n}\n\nfunc (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) {\n\tout := new(HelloReply)\n\terr := c.cc.Invoke(ctx, \"/helloworld.Greeter/SayHello\", in, out, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn out, nil\n}\n\n// GreeterServer is the server API for Greeter service.\n// All implementations must embed UnimplementedGreeterServer\n// for forward compatibility\ntype GreeterServer interface {\n\t// Sends a greeting\n\tSayHello(context.Context, *HelloRequest) (*HelloReply, error)\n\tmustEmbedUnimplementedGreeterServer()\n}\n\n// UnimplementedGreeterServer must be embedded to have forward compatible implementations.\ntype UnimplementedGreeterServer struct {\n}\n\nfunc (UnimplementedGreeterServer) SayHello(context.Context, *HelloRequest) (*HelloReply, error) {\n\treturn nil, status.Errorf(codes.Unimplemented, \"method SayHello not implemented\")\n}\nfunc (UnimplementedGreeterServer) mustEmbedUnimplementedGreeterServer() {}\n\n// UnsafeGreeterServer may be embedded to opt out of forward compatibility for this service.\n// Use of this interface is not recommended, as added methods to GreeterServer will\n// result in compilation errors.\ntype UnsafeGreeterServer interface {\n\tmustEmbedUnimplementedGreeterServer()\n}\n\nfunc RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer) {\n\ts.RegisterService(&Greeter_ServiceDesc, srv)\n}\n\nfunc _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {\n\tin := new(HelloRequest)\n\tif err := dec(in); err != nil {\n\t\treturn nil, err\n\t}\n\tif interceptor == nil {\n\t\treturn srv.(GreeterServer).SayHello(ctx, in)\n\t}\n\tinfo := &grpc.UnaryServerInfo{\n\t\tServer:     srv,\n\t\tFullMethod: \"/helloworld.Greeter/SayHello\",\n\t}\n\thandler := func(ctx context.Context, req interface{}) (interface{}, error) {\n\t\treturn srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest))\n\t}\n\treturn interceptor(ctx, in, info, handler)\n}\n\n// Greeter_ServiceDesc is the grpc.ServiceDesc for Greeter service.\n// It's only intended for direct use with grpc.RegisterService,\n// and not to be introspected or modified (even as a copy)\nvar Greeter_ServiceDesc = grpc.ServiceDesc{\n\tServiceName: \"helloworld.Greeter\",\n\tHandlerType: (*GreeterServer)(nil),\n\tMethods: []grpc.MethodDesc{\n\t\t{\n\t\t\tMethodName: \"SayHello\",\n\t\t\tHandler:    _Greeter_SayHello_Handler,\n\t\t},\n\t},\n\tStreams:  []grpc.StreamDesc{},\n\tMetadata: \"helloworld/hello_world.proto\",\n}\n"
  },
  {
    "path": "app/resource/resource.go",
    "content": "package resource\n\nimport (\n\t\"github.com/go-redis/redis/v8\"\n\n\thttpClient \"github.com/why444216978/gin-api/client/http\"\n\t\"github.com/why444216978/gin-api/library/cache\"\n\t\"github.com/why444216978/gin-api/library/etcd\"\n\t\"github.com/why444216978/gin-api/library/lock\"\n\t\"github.com/why444216978/gin-api/library/logger\"\n\t\"github.com/why444216978/gin-api/library/orm\"\n\t\"github.com/why444216978/gin-api/library/queue\"\n\t\"github.com/why444216978/gin-api/library/registry\"\n)\n\nvar (\n\tTestDB        *orm.Orm\n\tRedisDefault  *redis.Client\n\tEtcd          *etcd.Etcd\n\tClientHTTP    httpClient.Client\n\tServiceLogger logger.Logger\n\tRedisLock     lock.Locker\n\tRedisCache    cache.Cacher\n\tRegistrar     registry.Registrar\n\tRabbitMQ      queue.Queue\n)\n"
  },
  {
    "path": "app/response/response.go",
    "content": "package response\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\n\t\"github.com/why444216978/gin-api/server/http/response\"\n)\n\nconst (\n\tCodeSuccess     response.Code = 0\n\tCodeParams      response.Code = 1\n\tCodeUriNotFound response.Code = http.StatusNotFound\n\tCodeServer      response.Code = http.StatusInternalServerError\n\tCodeUnavailable response.Code = http.StatusServiceUnavailable\n\tCodeTimeout     response.Code = http.StatusGatewayTimeout\n)\n\nvar codeToast = map[response.Code]string{\n\tCodeSuccess:     \"success\",\n\tCodeParams:      \"参数错误\",\n\tCodeUriNotFound: \"资源不存在\",\n\tCodeUnavailable: \"服务器暂时不可用\",\n\tCodeTimeout:     \"请求超时\",\n\tCodeServer:      \"服务器错误\",\n}\n\nfunc ResponseJSON(c *gin.Context, code response.Code, data interface{}, err *response.ResponseError) {\n\tif err == nil {\n\t\terr = response.WrapToast(nil, codeToast[code])\n\t}\n\n\tresponse.ResponseJSON(c, code, data, err)\n}\n"
  },
  {
    "path": "app/router/router.go",
    "content": "package router\n\nimport (\n\t\"github.com/gin-gonic/gin\"\n\n\tconn \"github.com/why444216978/gin-api/app/module/goods/api\"\n\tping \"github.com/why444216978/gin-api/app/module/ping/api\"\n\ttest \"github.com/why444216978/gin-api/app/module/test/api\"\n)\n\nfunc RegisterRouter(server *gin.Engine) {\n\tpingGroup := server.Group(\"/ping\")\n\t{\n\t\tpingGroup.GET(\"\", ping.Ping)\n\t\tpingGroup.GET(\"/rpc\", ping.RPC)\n\t}\n\n\ttestGroup := server.Group(\"/test\")\n\t{\n\t\ttestGroup.POST(\"/rpc\", test.Rpc)\n\t\ttestGroup.POST(\"/rpc1\", test.Rpc1)\n\t\ttestGroup.POST(\"/panic\", test.Panic)\n\t\ttestGroup.POST(\"/conn\", conn.Do)\n\t}\n}\n"
  },
  {
    "path": "app/rpc/gin-api/test.go",
    "content": "package gin_api\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"time\"\n\n\tjsonCodec \"github.com/why444216978/codec/json\"\n\n\t\"github.com/why444216978/gin-api/app/resource\"\n\thttpClient \"github.com/why444216978/gin-api/client/http\"\n\t\"github.com/why444216978/gin-api/library/logger\"\n)\n\nconst (\n\tserviceName = \"gin-api-dev\"\n)\n\nfunc RPC(ctx context.Context) (resp *httpClient.Response, err error) {\n\treq := httpClient.Request{\n\t\tURI:     fmt.Sprintf(\"/test/rpc1?logid=%s\", logger.ValueLogID(ctx)),\n\t\tMethod:  http.MethodPost,\n\t\tHeader:  nil,\n\t\tTimeout: time.Second,\n\t\tBody:    map[string]interface{}{\"rpc\": \"rpc\"},\n\t\tCodec:   jsonCodec.JSONCodec{},\n\t}\n\tresp = &httpClient.Response{\n\t\tBody:  new(map[string]interface{}),\n\t\tCodec: jsonCodec.JSONCodec{},\n\t}\n\n\tif err = resource.ClientHTTP.Send(ctx, serviceName, req, resp); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}\n\nfunc RPC1(ctx context.Context) (resp *httpClient.Response, err error) {\n\treq := httpClient.Request{\n\t\tURI:     fmt.Sprintf(\"/test/conn?logid=%s\", logger.ValueLogID(ctx)),\n\t\tMethod:  http.MethodPost,\n\t\tHeader:  nil,\n\t\tTimeout: time.Second,\n\t\tBody:    map[string]interface{}{\"rpc1\": \"rpc1\"},\n\t\tCodec:   jsonCodec.JSONCodec{},\n\t}\n\n\tresp = &httpClient.Response{\n\t\tBody:  new(map[string]interface{}),\n\t\tCodec: jsonCodec.JSONCodec{},\n\t}\n\n\tif err = resource.ClientHTTP.Send(ctx, serviceName, req, resp); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}\n\nfunc Ping(ctx context.Context) (resp *httpClient.Response, err error) {\n\treq := httpClient.Request{\n\t\tURI:     fmt.Sprintf(\"/ping?logid=%s\", logger.ValueLogID(ctx)),\n\t\tMethod:  http.MethodGet,\n\t\tHeader:  nil,\n\t\tTimeout: time.Second,\n\t\tBody:    map[string]interface{}{\"rpc1\": \"rpc1\"},\n\t\tCodec:   jsonCodec.JSONCodec{},\n\t}\n\n\tresp = &httpClient.Response{\n\t\tBody:  new(map[string]interface{}),\n\t\tCodec: jsonCodec.JSONCodec{},\n\t}\n\n\tif err = resource.ClientHTTP.Send(ctx, serviceName, req, resp); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}\n"
  },
  {
    "path": "bootstrap/app.go",
    "content": "package bootstrap\n\nimport (\n\t\"context\"\n\t\"os\"\n\t\"os/signal\"\n\t\"syscall\"\n\t\"time\"\n\n\t\"github.com/pkg/errors\"\n\t\"github.com/why444216978/go-util/assert\"\n\t\"golang.org/x/sync/errgroup\"\n\n\t\"github.com/why444216978/gin-api/library/registry\"\n\t\"github.com/why444216978/gin-api/server\"\n)\n\ntype Option struct{}\n\nfunc defaultOption() *Option {\n\treturn &Option{}\n}\n\ntype OptionFunc func(*Option)\n\ntype App struct {\n\topt       *Option\n\tctx       context.Context\n\tserver    server.Server\n\tregistrar registry.Registrar\n\tcancel    func()\n}\n\nfunc NewApp(srv server.Server, registrar registry.Registrar, opts ...OptionFunc) *App {\n\topt := defaultOption()\n\tfor _, o := range opts {\n\t\to(opt)\n\t}\n\n\tctx, cancel := context.WithCancel(context.Background())\n\n\tapp := &App{\n\t\topt:    opt,\n\t\tctx:    ctx,\n\t\tcancel: cancel,\n\t\tserver: srv,\n\t}\n\n\treturn app\n}\n\nfunc (app *App) Start() error {\n\tg, _ := errgroup.WithContext(app.ctx)\n\tg.Go(func() (err error) {\n\t\treturn app.start()\n\t})\n\tg.Go(func() (err error) {\n\t\treturn app.registerSignal()\n\t})\n\tg.Go(func() (err error) {\n\t\treturn app.registerService()\n\t})\n\tg.Go(func() (err error) {\n\t\treturn app.shutdown()\n\t})\n\treturn g.Wait()\n}\n\nfunc (a *App) start() error {\n\treturn a.server.Start()\n}\n\nfunc (a *App) registerSignal() (err error) {\n\tch := make(chan os.Signal, 1)\n\tsignal.Notify(ch, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGTERM)\n\n\terr = errors.Errorf(\"%s: exit by signal %v\\n\", time.Now().Format(\"2006-01-02 15:04:05\"), <-ch)\n\n\t// trigger shutdown\n\ta.cancel()\n\n\treturn\n}\n\nfunc (a *App) registerService() (err error) {\n\tif assert.IsNil(a.registrar) {\n\t\treturn\n\t}\n\n\treturn a.registrar.Register(a.ctx)\n}\n\nfunc (a *App) shutdown() (err error) {\n\t<-a.ctx.Done()\n\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second*3)\n\tdefer cancel()\n\n\t// server shutdown\n\terr = a.server.Close()\n\n\t// clean resource\n\tfor _, f := range server.CloseFunc {\n\t\t_ = f(ctx)\n\t}\n\n\treturn\n}\n"
  },
  {
    "path": "bootstrap/init.go",
    "content": "package bootstrap\n\nimport (\n\t\"log\"\n\t\"syscall\"\n\n\t\"github.com/why444216978/gin-api/library/app\"\n\t\"github.com/why444216978/gin-api/library/config\"\n)\n\nfunc Init(env string, load func() error) (err error) {\n\tlog.Printf(\"Actual pid is %d\", syscall.Getpid())\n\n\tconfig.Init(env)\n\n\tif err = app.InitApp(); err != nil {\n\t\treturn\n\t}\n\n\tif err = load(); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}\n"
  },
  {
    "path": "client/grpc/conn.go",
    "content": "package client\n\nimport (\n\t\"context\"\n\n\t\"google.golang.org/grpc\"\n\n\tserverGRPC \"github.com/why444216978/gin-api/server/grpc\"\n)\n\nfunc Conn(ctx context.Context, target string) (cc *grpc.ClientConn, err error) {\n\t// TODO resolver\n\tcc, err = grpc.DialContext(ctx, target, serverGRPC.NewDialOption()...)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}\n"
  },
  {
    "path": "client/http/client.go",
    "content": "package http\n\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"time\"\n\n\t\"github.com/why444216978/codec\"\n)\n\ntype Request struct {\n\tURI     string\n\tMethod  string\n\tHeader  http.Header\n\tTimeout time.Duration\n\tBody    interface{}\n\tCodec   codec.Codec\n}\n\ntype Response struct {\n\tHTTPCode int\n\tBody     interface{}\n\tCodec    codec.Codec\n}\n\ntype Client interface {\n\tSend(ctx context.Context, serviceName string, request Request, response *Response) (err error)\n}\n"
  },
  {
    "path": "client/http/plugin.go",
    "content": "package http\n\nimport (\n\t\"context\"\n\t\"net/http\"\n\n\tjaeger \"github.com/why444216978/gin-api/library/jaeger/http\"\n\t\"github.com/why444216978/gin-api/library/logger\"\n)\n\ntype BeforeRequestPlugin interface {\n\tHandle(ctx context.Context, req *http.Request) error\n}\n\ntype AfterRequestPlugin interface {\n\tHandle(ctx context.Context, req *http.Request, resp *http.Response) error\n}\n\ntype JaegerBeforePlugin struct{}\n\nvar _ BeforeRequestPlugin = (*JaegerBeforePlugin)(nil)\n\nfunc (*JaegerBeforePlugin) Handle(ctx context.Context, req *http.Request) error {\n\tlogID := logger.ValueLogID(ctx)\n\treq.Header.Add(logger.LogHeader, logID)\n\treturn jaeger.InjectHTTP(ctx, req, logID)\n}\n"
  },
  {
    "path": "client/http/transport/transport.go",
    "content": "package transport\n\nimport (\n\t\"context\"\n\t\"crypto/tls\"\n\t\"crypto/x509\"\n\t\"errors\"\n\t\"fmt\"\n\t\"net\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"time\"\n\n\t\"github.com/why444216978/go-util/assert\"\n\n\tclient \"github.com/why444216978/gin-api/client/http\"\n\t\"github.com/why444216978/gin-api/library/logger\"\n\tloggerRPC \"github.com/why444216978/gin-api/library/logger/zap/rpc\"\n\t\"github.com/why444216978/gin-api/library/servicer\"\n\ttimeoutLib \"github.com/why444216978/gin-api/server/http/middleware/timeout\"\n)\n\ntype RPC struct {\n\tlogger        logger.Logger\n\tbeforePlugins []client.BeforeRequestPlugin\n\tafterPlugins  []client.AfterRequestPlugin\n}\n\ntype Option func(r *RPC)\n\nfunc WithLogger(logger *loggerRPC.RPCLogger) Option {\n\treturn func(r *RPC) { r.logger = logger }\n}\n\nfunc WithBeforePlugins(plugins ...client.BeforeRequestPlugin) Option {\n\treturn func(r *RPC) { r.beforePlugins = plugins }\n}\n\nfunc WithAfterPlugins(plugins ...client.AfterRequestPlugin) Option {\n\treturn func(r *RPC) { r.afterPlugins = plugins }\n}\n\nfunc New(opts ...Option) *RPC {\n\tr := &RPC{}\n\tfor _, o := range opts {\n\t\to(r)\n\t}\n\n\treturn r\n}\n\n// Send is send HTTP request\nfunc (r *RPC) Send(ctx context.Context, serviceName string, request client.Request, response *client.Response) (err error) {\n\tvar (\n\t\tcost int64\n\t\tnode = &servicer.Node{}\n\t)\n\n\tif response == nil {\n\t\treturn errors.New(\"response is nil\")\n\t}\n\n\tif assert.IsNil(request.Codec) {\n\t\treturn errors.New(\"request.Codec is nil\")\n\t}\n\n\tif assert.IsNil(response.Codec) {\n\t\treturn errors.New(\"request.Codec is nil\")\n\t}\n\n\tif request.Header == nil {\n\t\trequest.Header = http.Header{}\n\t}\n\n\tdefer func() {\n\t\tif r.logger == nil {\n\t\t\treturn\n\t\t}\n\t\tfields := []logger.Field{\n\t\t\tlogger.Reflect(logger.ServiceName, serviceName),\n\t\t\tlogger.Reflect(logger.Header, request.Header),\n\t\t\tlogger.Reflect(logger.Method, request.Method),\n\t\t\tlogger.Reflect(logger.API, request.URI),\n\t\t\tlogger.Reflect(logger.Request, request.Body),\n\t\t\tlogger.Reflect(logger.Response, response.Body),\n\t\t\tlogger.Reflect(logger.ServerIP, node.Host),\n\t\t\tlogger.Reflect(logger.ServerPort, node.Port),\n\t\t\tlogger.Reflect(logger.Code, response.HTTPCode),\n\t\t\tlogger.Reflect(logger.Cost, cost),\n\t\t\tlogger.Reflect(logger.Timeout, request.Timeout),\n\t\t}\n\t\tif err == nil {\n\t\t\tr.logger.Info(ctx, \"rpc success\", fields...)\n\t\t\treturn\n\t\t}\n\t\tr.logger.Error(ctx, err.Error(), fields...)\n\t}()\n\n\treqReader, err := request.Codec.Encode(request.Body)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar (\n\t\tclient *http.Client\n\t\treq    *http.Request\n\t)\n\n\tservice, ok := servicer.GetServicer(serviceName)\n\tif !ok {\n\t\terr = errors.New(\"service is nil\")\n\t\treturn\n\t}\n\n\tclient, node, err = r.getClient(ctx, serviceName, service)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// 构建req\n\turl := fmt.Sprintf(\"http://%s:%d%s\", node.Host, node.Port, request.URI)\n\treq, err = http.NewRequestWithContext(ctx, request.Method, url, reqReader)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// 超时传递\n\tremain, err := timeoutLib.CalcRemainTimeout(ctx)\n\tif err != nil {\n\t\treturn\n\t}\n\trequest.Header.Set(timeoutLib.TimeoutKey, strconv.FormatInt(remain, 10))\n\n\t// 设置请求header\n\treq.Header = request.Header\n\n\t// 请求结束前插件\n\tfor _, plugin := range r.beforePlugins {\n\t\t_ = plugin.Handle(ctx, req)\n\t}\n\n\t// 请求开始时间\n\tstart := time.Now()\n\n\t// 判断是否cancel\n\tif err = ctx.Err(); err != nil {\n\t\treturn\n\t}\n\n\t// 发送请求\n\tresp, err := client.Do(req)\n\n\t_ = service.Done(ctx, node, err)\n\n\t// 请求结束后插件\n\tfor _, plugin := range r.afterPlugins {\n\t\t_ = plugin.Handle(ctx, req, resp)\n\t}\n\n\tcost = time.Since(start).Milliseconds()\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\tresponse.HTTPCode = resp.StatusCode\n\tif resp.StatusCode != http.StatusOK {\n\t\terr = fmt.Errorf(\"http code is %d\", resp.StatusCode)\n\t\treturn\n\t}\n\n\terr = response.Codec.Decode(resp.Body, response.Body)\n\n\treturn\n}\n\nfunc (r *RPC) getClient(ctx context.Context, serviceName string, service servicer.Servicer) (client *http.Client, node *servicer.Node, err error) {\n\tnode, err = service.Pick(ctx)\n\tif err != nil {\n\t\treturn\n\t}\n\n\taddress := fmt.Sprintf(\"%s:%d\", node.Host, node.Port)\n\n\ttp := &http.Transport{\n\t\tMaxIdleConnsPerHost: 30,\n\t\tMaxConnsPerHost:     30,\n\t\tIdleConnTimeout:     time.Minute,\n\t\tDialContext: func(ctx context.Context, network, _ string) (net.Conn, error) {\n\t\t\tconn, err := (&net.Dialer{\n\t\t\t\tTimeout:   30 * time.Second,\n\t\t\t\tKeepAlive: 60 * time.Second,\n\t\t\t}).DialContext(context.TODO(), \"tcp\", address)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn conn, nil\n\t\t},\n\t\tDialTLSContext: func(ctx context.Context, network, _ string) (net.Conn, error) {\n\t\t\tpool := x509.NewCertPool()\n\t\t\tpool.AppendCertsFromPEM(service.GetCaCrt())\n\t\t\tcliCrt, err := tls.X509KeyPair(service.GetClientPem(), service.GetClientKey())\n\t\t\tif err != nil {\n\t\t\t\terr = errors.New(\"server pem error \" + err.Error())\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tconn, err := (&net.Dialer{\n\t\t\t\tTimeout:   30 * time.Second,\n\t\t\t\tKeepAlive: 60 * time.Second,\n\t\t\t}).DialContext(context.TODO(), \"tcp\", address)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\treturn tls.Client(conn, &tls.Config{\n\t\t\t\tRootCAs:      pool,\n\t\t\t\tCertificates: []tls.Certificate{cliCrt},\n\t\t\t\tServerName:   serviceName,\n\t\t\t}), err\n\t\t},\n\t}\n\tclient = &http.Client{Transport: tp}\n\n\treturn\n}\n"
  },
  {
    "path": "go.mod",
    "content": "module github.com/why444216978/gin-api\n\ngo 1.16\n\nrequire (\n\tgithub.com/HdrHistogram/hdrhistogram-go v1.1.0 // indirect\n\tgithub.com/agiledragon/gomonkey/v2 v2.4.0 // indirect\n\tgithub.com/antihax/optional v1.0.0 // indirect\n\tgithub.com/apolloconfig/agollo/v4 v4.1.1 // indirect\n\tgithub.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6 // indirect\n\tgithub.com/cespare/xxhash v1.1.0 // indirect\n\tgithub.com/coreos/bbolt v1.3.2 // indirect\n\tgithub.com/coreos/go-etcd v2.0.0+incompatible // indirect\n\tgithub.com/coreos/go-semver v0.3.0 // indirect\n\tgithub.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e // indirect\n\tgithub.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect\n\tgithub.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect\n\tgithub.com/dustin/go-humanize v1.0.0 // indirect\n\tgithub.com/fsnotify/fsnotify v1.5.4 // indirect\n\tgithub.com/gin-contrib/cors v1.3.1 // indirect\n\tgithub.com/gin-contrib/pprof v1.3.0 // indirect\n\tgithub.com/gin-contrib/sse v0.1.0 // indirect\n\tgithub.com/gin-gonic/gin v1.8.1\n\tgithub.com/go-playground/validator/v10 v10.11.0 // indirect\n\tgithub.com/go-redis/redis/v8 v8.11.4\n\tgithub.com/go-redis/redismock/v8 v8.0.6\n\tgithub.com/golang/glog v1.0.0 // indirect\n\tgithub.com/golang/mock v1.6.0 // indirect\n\tgithub.com/golang/protobuf v1.5.2 // indirect\n\tgithub.com/google/btree v1.0.0 // indirect\n\tgithub.com/gorilla/csrf v1.7.1 // indirect\n\tgithub.com/gorilla/websocket v1.4.2 // indirect\n\tgithub.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect\n\tgithub.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0\n\tgithub.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect\n\tgithub.com/jonboulle/clockwork v0.1.0 // indirect\n\tgithub.com/json-iterator/go v1.1.12 // indirect\n\tgithub.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible\n\tgithub.com/lestrrat-go/strftime v1.0.4 // indirect\n\tgithub.com/mitchellh/mapstructure v1.5.0 // indirect\n\tgithub.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect\n\tgithub.com/opentracing/opentracing-go v1.2.0\n\tgithub.com/pelletier/go-toml v1.9.5 // indirect\n\tgithub.com/pelletier/go-toml/v2 v2.0.2 // indirect\n\tgithub.com/pkg/errors v0.9.1\n\tgithub.com/robfig/cron/v3 v3.0.0 // indirect\n\tgithub.com/smartystreets/assertions v1.2.0 // indirect\n\tgithub.com/smartystreets/goconvey v1.7.2\n\tgithub.com/soheilhy/cmux v0.1.5\n\tgithub.com/spf13/pflag v1.0.5 // indirect\n\tgithub.com/spf13/viper v1.11.0\n\tgithub.com/streadway/amqp v1.0.0\n\tgithub.com/stretchr/testify v1.7.4 // indirect\n\tgithub.com/turtlemonvh/gin-wraphh v0.0.0-20160304035037-ea8e4927b3a6 // indirect\n\tgithub.com/uber/jaeger-client-go v2.25.0+incompatible\n\tgithub.com/uber/jaeger-lib v2.4.0+incompatible // indirect\n\tgithub.com/valyala/bytebufferpool v1.0.0 // indirect\n\tgithub.com/why444216978/codec v1.0.2 // indirect\n\tgithub.com/why444216978/go-util v1.0.20\n\tgithub.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect\n\tgithub.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77 // indirect\n\tgo.etcd.io/etcd/api/v3 v3.5.2\n\tgo.etcd.io/etcd/client/v3 v3.5.0\n\tgo.uber.org/zap v1.17.0\n\tgolang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect\n\tgolang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 // indirect\n\tgolang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect\n\tgolang.org/x/net v0.0.0-20220607020251-c690dde0001d // indirect\n\tgolang.org/x/sync v0.0.0-20210220032951-036812b2e83c\n\tgolang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d // indirect\n\tgolang.org/x/text v0.3.7 // indirect\n\tgolang.org/x/time v0.0.0-20191024005414-555d28b269f0\n\tgoogle.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac\n\tgoogle.golang.org/grpc v1.47.0\n\tgoogle.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 // indirect\n\tgoogle.golang.org/protobuf v1.28.0\n\tgopkg.in/go-playground/validator.v8 v8.18.2 // indirect\n\tgorm.io/driver/mysql v1.1.0\n\tgorm.io/gorm v1.21.9\n\tgorm.io/plugin/dbresolver v1.1.0\n\thonnef.co/go/tools v0.0.1-2020.1.4 // indirect\n\trsc.io/quote/v3 v3.1.0 // indirect\n\tsigs.k8s.io/yaml v1.2.0 // indirect\n)\n"
  },
  {
    "path": "go.sum",
    "content": "cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=\ncloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=\ncloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=\ncloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=\ncloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=\ncloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=\ncloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=\ncloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=\ncloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=\ncloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=\ncloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=\ncloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=\ncloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=\ncloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=\ncloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=\ncloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=\ncloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI=\ncloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk=\ncloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY=\ncloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg=\ncloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8=\ncloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0=\ncloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY=\ncloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM=\ncloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY=\ncloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ=\ncloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI=\ncloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4=\ncloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc=\ncloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA=\ncloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A=\ncloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=\ncloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=\ncloud.google.com/go/bigquery v1.4.0 h1:xE3CPsOgttP4ACBePh79zTKALtXwn/Edhcr16R5hMWU=\ncloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=\ncloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=\ncloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=\ncloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=\ncloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow=\ncloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM=\ncloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M=\ncloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=\ncloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=\ncloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=\ncloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY=\ncloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=\ncloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=\ncloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=\ncloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=\ncloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=\ncloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=\ncloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=\ncloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=\ncloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=\ncloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=\ndmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=\ngithub.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=\ngithub.com/BurntSushi/toml v1.0.0 h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU=\ngithub.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=\ngithub.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=\ngithub.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=\ngithub.com/HdrHistogram/hdrhistogram-go v1.1.0/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo=\ngithub.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=\ngithub.com/agiledragon/gomonkey/v2 v2.3.1 h1:k+UnUY0EMNYUFUAQVETGY9uUTxjMdnUkP0ARyJS1zzs=\ngithub.com/agiledragon/gomonkey/v2 v2.3.1/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY=\ngithub.com/agiledragon/gomonkey/v2 v2.4.0 h1:YDQJYiSQ8o78dCMXehU1E4F/Kh4jPX+MV+/iK/yfL7s=\ngithub.com/agiledragon/gomonkey/v2 v2.4.0/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY=\ngithub.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=\ngithub.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=\ngithub.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=\ngithub.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=\ngithub.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=\ngithub.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=\ngithub.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=\ngithub.com/apolloconfig/agollo/v4 v4.0.11 h1:7NSDLZzcaIe5UwcpFhk1/ojmSCeuv9198PjN0lj1KBk=\ngithub.com/apolloconfig/agollo/v4 v4.0.11/go.mod h1:SuvTjtg0p4UlSzSbik+ibLRr6oR1xRsfy65QzP3GEAs=\ngithub.com/apolloconfig/agollo/v4 v4.1.1 h1:bYD60nI5oVXZw3YTgr9EtU2ptCaNC8qw1gRj8LFhYsE=\ngithub.com/apolloconfig/agollo/v4 v4.1.1/go.mod h1:SuvTjtg0p4UlSzSbik+ibLRr6oR1xRsfy65QzP3GEAs=\ngithub.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=\ngithub.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=\ngithub.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=\ngithub.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=\ngithub.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=\ngithub.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=\ngithub.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=\ngithub.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=\ngithub.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=\ngithub.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=\ngithub.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=\ngithub.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=\ngithub.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=\ngithub.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=\ngithub.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=\ngithub.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=\ngithub.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=\ngithub.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=\ngithub.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=\ngithub.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=\ngithub.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=\ngithub.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=\ngithub.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=\ngithub.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=\ngithub.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=\ngithub.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=\ngithub.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=\ngithub.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=\ngithub.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=\ngithub.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=\ngithub.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=\ngithub.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=\ngithub.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=\ngithub.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=\ngithub.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=\ngithub.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=\ngithub.com/coreos/etcd v3.3.10+incompatible h1:jFneRYjIvLMLhDLCzuTuU4rSJUjRplcJQ7pD7MnhC04=\ngithub.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=\ngithub.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=\ngithub.com/coreos/etcd v3.3.25+incompatible h1:0GQEw6h3YnuOVdtwygkIfJ+Omx0tZ8/QkVyXI4LkbeY=\ngithub.com/coreos/etcd v3.3.25+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=\ngithub.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=\ngithub.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=\ngithub.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=\ngithub.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=\ngithub.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e h1:Wf6HqHfScWJN9/ZjdUKyjop4mf3Qdd+1TvvltAvM3m8=\ngithub.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=\ngithub.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI=\ngithub.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=\ngithub.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg=\ngithub.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=\ngithub.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=\ngithub.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=\ngithub.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=\ngithub.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=\ngithub.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=\ngithub.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=\ngithub.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=\ngithub.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=\ngithub.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=\ngithub.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=\ngithub.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=\ngithub.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=\ngithub.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=\ngithub.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=\ngithub.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=\ngithub.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=\ngithub.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=\ngithub.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=\ngithub.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=\ngithub.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=\ngithub.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=\ngithub.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=\ngithub.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=\ngithub.com/frankban/quicktest v1.14.0/go.mod h1:NeW+ay9A/U67EYXNFA1nPE8e/tnQv/09mUdL/ijj8og=\ngithub.com/frankban/quicktest v1.14.2/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps=\ngithub.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=\ngithub.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=\ngithub.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=\ngithub.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=\ngithub.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=\ngithub.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=\ngithub.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=\ngithub.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=\ngithub.com/gin-contrib/cors v1.3.1 h1:doAsuITavI4IOcd0Y19U4B+O0dNWihRyX//nn4sEmgA=\ngithub.com/gin-contrib/cors v1.3.1/go.mod h1:jjEJ4268OPZUcU7k9Pm653S7lXUGcqMADzFA61xsmDk=\ngithub.com/gin-contrib/pprof v1.3.0 h1:G9eK6HnbkSqDZBYbzG4wrjCsA4e+cvYAHUZw6W+W9K0=\ngithub.com/gin-contrib/pprof v1.3.0/go.mod h1:waMjT1H9b179t3CxuG1cV3DHpga6ybizwfBaM5OXaB0=\ngithub.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=\ngithub.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=\ngithub.com/gin-gonic/gin v1.3.0 h1:kCmZyPklC0gVdL728E6Aj20uYBJV93nj/TkwBTKhFbs=\ngithub.com/gin-gonic/gin v1.3.0/go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y=\ngithub.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do=\ngithub.com/gin-gonic/gin v1.6.2 h1:88crIK23zO6TqlQBt+f9FrPJNKm9ZEr7qjp9vl/d5TM=\ngithub.com/gin-gonic/gin v1.6.2/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=\ngithub.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8=\ngithub.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk=\ngithub.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=\ngithub.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=\ngithub.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=\ngithub.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=\ngithub.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=\ngithub.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=\ngithub.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=\ngithub.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=\ngithub.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=\ngithub.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=\ngithub.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=\ngithub.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM=\ngithub.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=\ngithub.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=\ngithub.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU=\ngithub.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=\ngithub.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY=\ngithub.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=\ngithub.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=\ngithub.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho=\ngithub.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=\ngithub.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=\ngithub.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=\ngithub.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=\ngithub.com/go-playground/validator/v10 v10.10.0 h1:I7mrTYv78z8k8VXa/qJlOlEXn/nBh+BF8dHX5nt/dr0=\ngithub.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos=\ngithub.com/go-playground/validator/v10 v10.11.0 h1:0W+xRM511GY47Yy3bZUbJVitCNg2BOGlCyvTqsp/xIw=\ngithub.com/go-playground/validator/v10 v10.11.0/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU=\ngithub.com/go-redis/redis/v8 v8.8.0/go.mod h1:F7resOH5Kdug49Otu24RjHWwgK7u9AmtqWMnCV1iP5Y=\ngithub.com/go-redis/redis/v8 v8.11.3 h1:GCjoYp8c+yQTJfc0n69iwSiHjvuAdruxl7elnZCxgt8=\ngithub.com/go-redis/redis/v8 v8.11.3/go.mod h1:xNJ9xDG09FsIPwh3bWdk+0oDWHbtF9rPN0F/oD9XeKc=\ngithub.com/go-redis/redis/v8 v8.11.4 h1:kHoYkfZP6+pe04aFTnhDH6GDROa5yJdHJVNxV3F46Tg=\ngithub.com/go-redis/redis/v8 v8.11.4/go.mod h1:2Z2wHZXdQpCDXEGzqMockDpNyYvi2l4Pxt6RJr792+w=\ngithub.com/go-redis/redismock/v8 v8.0.6 h1:rtuijPgGynsRB2Y7KDACm09WvjHWS4RaG44Nm7rcj4Y=\ngithub.com/go-redis/redismock/v8 v8.0.6/go.mod h1:sDIF73OVsmaKzYe/1FJXGiCQ4+oHYbzjpaL9Vor0sS4=\ngithub.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=\ngithub.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=\ngithub.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=\ngithub.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=\ngithub.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=\ngithub.com/goccy/go-json v0.9.7 h1:IcB+Aqpx/iMHu5Yooh7jEzJk1JZ7Pjtmys2ukPr7EeM=\ngithub.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=\ngithub.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=\ngithub.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=\ngithub.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=\ngithub.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=\ngithub.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=\ngithub.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=\ngithub.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=\ngithub.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ=\ngithub.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4=\ngithub.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=\ngithub.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=\ngithub.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=\ngithub.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=\ngithub.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=\ngithub.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=\ngithub.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=\ngithub.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=\ngithub.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=\ngithub.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=\ngithub.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=\ngithub.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=\ngithub.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8=\ngithub.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=\ngithub.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=\ngithub.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=\ngithub.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=\ngithub.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=\ngithub.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=\ngithub.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=\ngithub.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=\ngithub.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=\ngithub.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=\ngithub.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=\ngithub.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=\ngithub.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=\ngithub.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=\ngithub.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=\ngithub.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=\ngithub.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=\ngithub.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=\ngithub.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=\ngithub.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=\ngithub.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=\ngithub.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=\ngithub.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=\ngithub.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=\ngithub.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=\ngithub.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=\ngithub.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=\ngithub.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=\ngithub.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=\ngithub.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=\ngithub.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=\ngithub.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk=\ngithub.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=\ngithub.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=\ngithub.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=\ngithub.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=\ngithub.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=\ngithub.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=\ngithub.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=\ngithub.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=\ngithub.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=\ngithub.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=\ngithub.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=\ngithub.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=\ngithub.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=\ngithub.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=\ngithub.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=\ngithub.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=\ngithub.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=\ngithub.com/google/uuid v1.1.5 h1:kxhtnfFVi+rYdOALN0B3k9UT86zVJKfBimRaciULW4I=\ngithub.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=\ngithub.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=\ngithub.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=\ngithub.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0=\ngithub.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM=\ngithub.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM=\ngithub.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM=\ngithub.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=\ngithub.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=\ngithub.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=\ngithub.com/gorilla/csrf v1.7.1 h1:Ir3o2c1/Uzj6FBxMlAUB6SivgVMy1ONXwYgXn+/aHPE=\ngithub.com/gorilla/csrf v1.7.1/go.mod h1:+a/4tCmqhG6/w4oafeAZ9pEa3/NZOWYVbD9fV0FwIQA=\ngithub.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=\ngithub.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=\ngithub.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=\ngithub.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=\ngithub.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw=\ngithub.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y=\ngithub.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=\ngithub.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=\ngithub.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=\ngithub.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=\ngithub.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0 h1:rgxjzoDmDXw5q8HONgyHhBas4to0/XWRo/gPpJhsUNQ=\ngithub.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0/go.mod h1:qrJPVzv9YlhsrxJc3P/Q85nr0w1lIRikTl4JlhdDH5w=\ngithub.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 h1:MJG/KsmcqMwFAkh8mTnAwhyKoB+sTAnY4CACC110tbU=\ngithub.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw=\ngithub.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=\ngithub.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0=\ngithub.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=\ngithub.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms=\ngithub.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=\ngithub.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=\ngithub.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=\ngithub.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=\ngithub.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=\ngithub.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=\ngithub.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=\ngithub.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=\ngithub.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=\ngithub.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=\ngithub.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=\ngithub.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=\ngithub.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=\ngithub.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=\ngithub.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=\ngithub.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=\ngithub.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=\ngithub.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=\ngithub.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=\ngithub.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=\ngithub.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=\ngithub.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=\ngithub.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=\ngithub.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=\ngithub.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=\ngithub.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=\ngithub.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc=\ngithub.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=\ngithub.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=\ngithub.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=\ngithub.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4=\ngithub.com/hashicorp/serf v0.9.7/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4=\ngithub.com/hexops/autogold v0.8.1/go.mod h1:97HLDXyG23akzAoRYJh/2OBs3kd80eHyKPvZw0S5ZBY=\ngithub.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=\ngithub.com/hexops/valast v1.4.1/go.mod h1:G+D6TExWuKs5he+hYlPMfYyhQ8w8qbc2vm4gDWwLdDg=\ngithub.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=\ngithub.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=\ngithub.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=\ngithub.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=\ngithub.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=\ngithub.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=\ngithub.com/jinzhu/now v1.1.2 h1:eVKgfIdy9b6zbWBMgFpfDPoAMifwSZagU9HmEU6zgiI=\ngithub.com/jinzhu/now v1.1.2/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=\ngithub.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=\ngithub.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=\ngithub.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=\ngithub.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=\ngithub.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=\ngithub.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=\ngithub.com/json-iterator/go v1.1.11 h1:uVUAXhF2To8cbw/3xN3pxj6kk7TYKs98NIrTqPlMWAQ=\ngithub.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=\ngithub.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=\ngithub.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=\ngithub.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=\ngithub.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=\ngithub.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=\ngithub.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=\ngithub.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=\ngithub.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=\ngithub.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=\ngithub.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=\ngithub.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=\ngithub.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=\ngithub.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=\ngithub.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=\ngithub.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=\ngithub.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=\ngithub.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=\ngithub.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=\ngithub.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=\ngithub.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=\ngithub.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=\ngithub.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=\ngithub.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=\ngithub.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw=\ngithub.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=\ngithub.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=\ngithub.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=\ngithub.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=\ngithub.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc/go.mod h1:kopuH9ugFRkIXf3YoqHKyrJ9YfUFsckUU9S7B+XP+is=\ngithub.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible h1:Y6sqxHMyB1D2YSzWkLibYKgg+SwmyFU9dF2hn6MdTj4=\ngithub.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible/go.mod h1:ZQnN8lSECaebrkQytbHj4xNgtg8CR7RYXnPok8e0EHA=\ngithub.com/lestrrat-go/strftime v1.0.4 h1:T1Rb9EPkAhgxKqbcMIPguPq8glqXTA1koF8n9BHElA8=\ngithub.com/lestrrat-go/strftime v1.0.4/go.mod h1:E1nN3pCbtMSu1yjSVeyuRFVm/U0xoR76fd03sz+Qz4g=\ngithub.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=\ngithub.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4=\ngithub.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=\ngithub.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo=\ngithub.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=\ngithub.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=\ngithub.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=\ngithub.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=\ngithub.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=\ngithub.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=\ngithub.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=\ngithub.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=\ngithub.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=\ngithub.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=\ngithub.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=\ngithub.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=\ngithub.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA=\ngithub.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=\ngithub.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=\ngithub.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=\ngithub.com/mattn/go-sqlite3 v1.14.5 h1:1IdxlwTNazvbKJQSxoJ5/9ECbEeaTTyeU7sEAZ5KKTQ=\ngithub.com/mattn/go-sqlite3 v1.14.5/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI=\ngithub.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=\ngithub.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=\ngithub.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=\ngithub.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI=\ngithub.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=\ngithub.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI=\ngithub.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=\ngithub.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=\ngithub.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=\ngithub.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=\ngithub.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=\ngithub.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=\ngithub.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=\ngithub.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=\ngithub.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=\ngithub.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=\ngithub.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=\ngithub.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=\ngithub.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=\ngithub.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=\ngithub.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=\ngithub.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=\ngithub.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=\ngithub.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=\ngithub.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=\ngithub.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=\ngithub.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=\ngithub.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=\ngithub.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=\ngithub.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=\ngithub.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=\ngithub.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=\ngithub.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=\ngithub.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=\ngithub.com/onsi/ginkgo v1.15.0/go.mod h1:hF8qUzuuC8DJGygJH3726JnCZX4MYbRB8yFfISqnKUg=\ngithub.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc=\ngithub.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=\ngithub.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=\ngithub.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=\ngithub.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48=\ngithub.com/onsi/gomega v1.15.0 h1:WjP/FQ/sk43MRmnEcT+MlDw2TFvkrXlprrPST/IudjU=\ngithub.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0=\ngithub.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=\ngithub.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=\ngithub.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=\ngithub.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=\ngithub.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=\ngithub.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=\ngithub.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=\ngithub.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=\ngithub.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=\ngithub.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=\ngithub.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=\ngithub.com/pelletier/go-toml/v2 v2.0.0-beta.8/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo=\ngithub.com/pelletier/go-toml/v2 v2.0.0 h1:P7Bq0SaI8nsexyay5UAyDo+ICWy5MQPgEZ5+l8JQTKo=\ngithub.com/pelletier/go-toml/v2 v2.0.0/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo=\ngithub.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo=\ngithub.com/pelletier/go-toml/v2 v2.0.2 h1:+jQXlF3scKIcSEKkdHzXhCTDLPFi5r1wnK6yPS+49Gw=\ngithub.com/pelletier/go-toml/v2 v2.0.2/go.mod h1:MovirKjgVRESsAvNZlAjtFwV867yGuwRkXbG66OzopI=\ngithub.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=\ngithub.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=\ngithub.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=\ngithub.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=\ngithub.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=\ngithub.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=\ngithub.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=\ngithub.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=\ngithub.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=\ngithub.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=\ngithub.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=\ngithub.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=\ngithub.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=\ngithub.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=\ngithub.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=\ngithub.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=\ngithub.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=\ngithub.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=\ngithub.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=\ngithub.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=\ngithub.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=\ngithub.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=\ngithub.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=\ngithub.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=\ngithub.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=\ngithub.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=\ngithub.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=\ngithub.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=\ngithub.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=\ngithub.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=\ngithub.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=\ngithub.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=\ngithub.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=\ngithub.com/robfig/cron/v3 v3.0.0 h1:kQ6Cb7aHOHTSzNVNEhmp8EcWKLb4CbiMW9h9VyIhO4E=\ngithub.com/robfig/cron/v3 v3.0.0/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=\ngithub.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=\ngithub.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=\ngithub.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=\ngithub.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=\ngithub.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=\ngithub.com/rogpeppe/go-internal v1.8.1-0.20211023094830-115ce09fd6b4/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o=\ngithub.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o=\ngithub.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=\ngithub.com/sagikazarmark/crypt v0.5.0/go.mod h1:l+nzl7KWh51rpzp2h7t4MZWyiEWdhNpOAnclKvg+mdA=\ngithub.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=\ngithub.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ=\ngithub.com/shurcooL/go-goon v0.0.0-20210110234559-7585751d9a17/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ=\ngithub.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=\ngithub.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=\ngithub.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=\ngithub.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=\ngithub.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs=\ngithub.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=\ngithub.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=\ngithub.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=\ngithub.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg=\ngithub.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM=\ngithub.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E=\ngithub.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=\ngithub.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js=\ngithub.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0=\ngithub.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=\ngithub.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=\ngithub.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=\ngithub.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo=\ngithub.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo=\ngithub.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8=\ngithub.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=\ngithub.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA=\ngithub.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=\ngithub.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=\ngithub.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=\ngithub.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=\ngithub.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=\ngithub.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=\ngithub.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=\ngithub.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=\ngithub.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M=\ngithub.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=\ngithub.com/spf13/viper v1.7.1 h1:pM5oEahlgWv/WnHXpgbKz7iLIxRf65tye2Ci+XFK5sk=\ngithub.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=\ngithub.com/spf13/viper v1.11.0 h1:7OX/1FS6n7jHD1zGrZTM7WtY13ZELRyosK4k93oPr44=\ngithub.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUsX7Zk=\ngithub.com/streadway/amqp v1.0.0 h1:kuuDrUJFZL1QYL9hUNuCxNObNzB0bV/ZG5jV3RWAQgo=\ngithub.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=\ngithub.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=\ngithub.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=\ngithub.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4=\ngithub.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=\ngithub.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=\ngithub.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=\ngithub.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=\ngithub.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=\ngithub.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=\ngithub.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=\ngithub.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=\ngithub.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=\ngithub.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=\ngithub.com/stretchr/testify v1.7.4 h1:wZRexSlwd7ZXfKINDLsO4r7WBt3gTKONc6K/VesHvHM=\ngithub.com/stretchr/testify v1.7.4/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=\ngithub.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=\ngithub.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=\ngithub.com/tevid/gohamcrest v1.1.1/go.mod h1:3UvtWlqm8j5JbwYZh80D/PVBt0mJ1eJiYgZMibh0H/k=\ngithub.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=\ngithub.com/turtlemonvh/gin-wraphh v0.0.0-20160304035037-ea8e4927b3a6 h1:LXn2Epw3+6TJxFwYbUo0M32riVbVfSTqCf41kJCmLb8=\ngithub.com/turtlemonvh/gin-wraphh v0.0.0-20160304035037-ea8e4927b3a6/go.mod h1:9ACh8xdjPLhq9E8Rp80s6QqYzuAAx75ZNPLnjgtei6Q=\ngithub.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=\ngithub.com/uber/jaeger-client-go v2.25.0+incompatible h1:IxcNZ7WRY1Y3G4poYlx24szfsn/3LvK9QHCq9oQw8+U=\ngithub.com/uber/jaeger-client-go v2.25.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=\ngithub.com/uber/jaeger-lib v2.4.0+incompatible h1:fY7QsGQWiCt8pajv4r7JEvmATdCVaWxXbjwyYwsNaLQ=\ngithub.com/uber/jaeger-lib v2.4.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=\ngithub.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=\ngithub.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=\ngithub.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo=\ngithub.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=\ngithub.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=\ngithub.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=\ngithub.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=\ngithub.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=\ngithub.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=\ngithub.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=\ngithub.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=\ngithub.com/why444216978/codec v1.0.1 h1:BK2IhwlhfXPeIlS0cIpb+lcO22HG9SGUJJO+cyDwgE8=\ngithub.com/why444216978/codec v1.0.1/go.mod h1:L9NF37yg7sTsYf5qxzlVy8pMKtc4IFAhruw/d1Mc4KQ=\ngithub.com/why444216978/codec v1.0.2 h1:yW6OgRDPbK2/a/W7h95hVjmt6kI3a7lZ08dXAaJ8ilA=\ngithub.com/why444216978/codec v1.0.2/go.mod h1:nPjhT8IFTCjduNEntyUD/G73E4FDayWxWJTG8edBoC4=\ngithub.com/why444216978/go-util v1.0.12 h1:aMMY4lBSfXyPMmzdLK9adBhiHb7xLHMamtZAqsa1tRA=\ngithub.com/why444216978/go-util v1.0.12/go.mod h1:Ig1wkItwcPRQGjpAzv5+i3NRIUBadmyKCdV/Nl1OKLc=\ngithub.com/why444216978/go-util v1.0.15 h1:nfXzb0neAe70tQWhDSKpL1r2DIJW171cD6/LUxb+wRk=\ngithub.com/why444216978/go-util v1.0.15/go.mod h1:eOQgFhp/KyB6QtJAG0PuwLDMs7wCtBWQRwFAW0VDD48=\ngithub.com/why444216978/go-util v1.0.16 h1:P6Rjrj+kALXRQHmL6Xo+DG8cx/tcD6p9DOPLKTaFOg0=\ngithub.com/why444216978/go-util v1.0.16/go.mod h1:ICoXMJruQGu3eJkh26R+Eeinc8Cw+AvAY/zscpSXQ/A=\ngithub.com/why444216978/go-util v1.0.17 h1:9teRuYd6/LuMqrJkwQnCYJ9WZSchq/Rtkr24CU4cbII=\ngithub.com/why444216978/go-util v1.0.17/go.mod h1:YNkAVzpl2y7ZhTeDnn8TJT+d0OZEjswObwdEghwnlGo=\ngithub.com/why444216978/go-util v1.0.19 h1:Q3gMncwWSFwWEk0bL0YwBHKdge8A/Hyo+srKN+s+6wA=\ngithub.com/why444216978/go-util v1.0.19/go.mod h1:YgFaoou91kwsOQsV2IuWNYCadnlFWVr0dmloeI4fgGQ=\ngithub.com/why444216978/go-util v1.0.20 h1:SWHwT5HaVYRuVakkaZUijDDuaIxwpl9922KOIiLF1pQ=\ngithub.com/why444216978/go-util v1.0.20/go.mod h1:YgFaoou91kwsOQsV2IuWNYCadnlFWVr0dmloeI4fgGQ=\ngithub.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=\ngithub.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=\ngithub.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=\ngithub.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=\ngithub.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=\ngithub.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=\ngithub.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=\ngithub.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=\ngo.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=\ngo.etcd.io/etcd/api/v3 v3.5.0 h1:GsV3S+OfZEOCNXdtNkBSR7kgLobAa/SO6tCxRa0GAYw=\ngo.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=\ngo.etcd.io/etcd/api/v3 v3.5.2 h1:tXok5yLlKyuQ/SXSjtqHc4uzNaMqZi2XsoSPr/LlJXI=\ngo.etcd.io/etcd/api/v3 v3.5.2/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A=\ngo.etcd.io/etcd/client/pkg/v3 v3.5.0 h1:2aQv6F436YnN7I4VbI8PPYrBhu+SmrTaADcf8Mi/6PU=\ngo.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=\ngo.etcd.io/etcd/client/pkg/v3 v3.5.2 h1:4hzqQ6hIb3blLyQ8usCU4h3NghkqcsohEQ3o3VetYxE=\ngo.etcd.io/etcd/client/pkg/v3 v3.5.2/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=\ngo.etcd.io/etcd/client/v2 v2.305.2/go.mod h1:2D7ZejHVMIfog1221iLSYlQRzrtECw3kz4I4VAQm3qI=\ngo.etcd.io/etcd/client/v3 v3.5.0 h1:62Eh0XOro+rDwkrypAGDfgmNh5Joq+z+W9HZdlXMzek=\ngo.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0=\ngo.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=\ngo.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=\ngo.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=\ngo.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=\ngo.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=\ngo.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=\ngo.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=\ngo.opentelemetry.io/otel v0.19.0/go.mod h1:j9bF567N9EfomkSidSfmMwIwIBuP37AMAIzVW85OxSg=\ngo.opentelemetry.io/otel/metric v0.19.0/go.mod h1:8f9fglJPRnXuskQmKpnad31lcLJ2VmNNqIsx/uIwBSc=\ngo.opentelemetry.io/otel/oteltest v0.19.0/go.mod h1:tI4yxwh8U21v7JD6R3BcA/2+RBoTKFexE/PJ/nSO7IA=\ngo.opentelemetry.io/otel/trace v0.19.0/go.mod h1:4IXiNextNOpPnRlI4ryK69mn5iC84bjBWZQA5DXz/qg=\ngo.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=\ngo.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=\ngo.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=\ngo.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=\ngo.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=\ngo.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=\ngo.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=\ngo.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=\ngo.uber.org/zap v1.17.0 h1:MTjgFu6ZLKvY6Pvaqk97GlxNBuMpV4Hy/3P6tRGlI2U=\ngo.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=\ngolang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=\ngolang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=\ngolang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=\ngolang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=\ngolang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=\ngolang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=\ngolang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=\ngolang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=\ngolang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=\ngolang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 h1:It14KIkyBFYkHkwZ7k45minvA9aorojkyjGk9KJ5B/w=\ngolang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=\ngolang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=\ngolang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI=\ngolang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=\ngolang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=\ngolang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=\ngolang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA=\ngolang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=\ngolang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM=\ngolang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=\ngolang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=\ngolang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=\ngolang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=\ngolang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=\ngolang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=\ngolang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=\ngolang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=\ngolang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=\ngolang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=\ngolang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=\ngolang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=\ngolang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=\ngolang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=\ngolang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=\ngolang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=\ngolang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=\ngolang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=\ngolang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=\ngolang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=\ngolang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=\ngolang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=\ngolang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=\ngolang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=\ngolang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=\ngolang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=\ngolang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=\ngolang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=\ngolang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=\ngolang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=\ngolang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=\ngolang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=\ngolang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=\ngolang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=\ngolang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=\ngolang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=\ngolang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=\ngolang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=\ngolang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=\ngolang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=\ngolang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38=\ngolang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=\ngolang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=\ngolang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=\ngolang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=\ngolang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=\ngolang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=\ngolang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=\ngolang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=\ngolang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=\ngolang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=\ngolang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=\ngolang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=\ngolang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=\ngolang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=\ngolang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=\ngolang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=\ngolang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=\ngolang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=\ngolang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=\ngolang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=\ngolang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=\ngolang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=\ngolang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=\ngolang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=\ngolang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=\ngolang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8=\ngolang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=\ngolang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=\ngolang.org/x/net v0.0.0-20210825183410-e898025ed96a h1:bRuuGXV8wwSdGTB+CtJf+FjgO1APK1CoO39T4BN/XBw=\ngolang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=\ngolang.org/x/net v0.0.0-20210924151903-3ad01bbaa167 h1:eDd+TJqbgfXruGQ5sJRU7tEtp/58OAx4+Ayjxg4SM+4=\ngolang.org/x/net v0.0.0-20210924151903-3ad01bbaa167/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=\ngolang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY=\ngolang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=\ngolang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=\ngolang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=\ngolang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=\ngolang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=\ngolang.org/x/net v0.0.0-20220412020605-290c469a71a5 h1:bRb386wvrE+oBNdF1d/Xh9mQrfQ4ecYhW5qJ5GvTGT4=\ngolang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=\ngolang.org/x/net v0.0.0-20220607020251-c690dde0001d h1:4SFsTMi4UahlKoloni7L4eYzhFRifURQLw+yv0QDCx8=\ngolang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=\ngolang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=\ngolang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=\ngolang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=\ngolang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=\ngolang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=\ngolang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=\ngolang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=\ngolang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=\ngolang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=\ngolang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210902050250-f475640dd07b h1:S7hKs0Flbq0bbc9xgYt4stIEG1zNDFqyrPwAX2Wj/sE=\ngolang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20211102192858-4dd72447c267/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20211117180635-dee7805ff2e1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 h1:y/woIyUBFbpQGKS0u1aHF/40WUDnek3fPOyD08H5Vng=\ngolang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0=\ngolang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d h1:Zu/JngovGLVi6t2J3nmAf3AoTDwuzw85YZ3b9o4yU7s=\ngolang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=\ngolang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=\ngolang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=\ngolang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=\ngolang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=\ngolang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=\ngolang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=\ngolang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=\ngolang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=\ngolang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=\ngolang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=\ngolang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=\ngolang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=\ngolang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=\ngolang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=\ngolang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=\ngolang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=\ngolang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=\ngolang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=\ngolang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=\ngolang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=\ngolang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=\ngolang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=\ngolang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=\ngolang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=\ngolang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=\ngolang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=\ngolang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=\ngolang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=\ngolang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=\ngolang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=\ngolang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=\ngolang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=\ngolang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=\ngolang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=\ngolang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=\ngolang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=\ngolang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=\ngolang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=\ngolang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=\ngolang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=\ngolang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=\ngolang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=\ngolang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=\ngolang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=\ngolang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=\ngolang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=\ngolang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=\ngolang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=\ngolang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=\ngolang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=\ngolang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=\ngolang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=\ngolang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=\ngolang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=\ngolang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=\ngolang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=\ngolang.org/x/tools v0.1.8-0.20211102182255-bb4add04ddef/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=\ngolang.org/x/tools v0.1.9 h1:j9KsMiaP1c3B0OTQGth0/k+miLGTgLsAFUCrF2vLcF8=\ngolang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=\ngolang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=\ngolang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=\ngolang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=\ngolang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=\ngolang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=\ngolang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U=\ngolang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=\ngonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=\ngonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0=\ngonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=\ngonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc=\ngoogle.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=\ngoogle.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=\ngoogle.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=\ngoogle.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=\ngoogle.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=\ngoogle.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=\ngoogle.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=\ngoogle.golang.org/api v0.15.1/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=\ngoogle.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=\ngoogle.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=\ngoogle.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=\ngoogle.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=\ngoogle.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=\ngoogle.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=\ngoogle.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=\ngoogle.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=\ngoogle.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=\ngoogle.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg=\ngoogle.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=\ngoogle.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=\ngoogle.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=\ngoogle.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=\ngoogle.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo=\ngoogle.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4=\ngoogle.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw=\ngoogle.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU=\ngoogle.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k=\ngoogle.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE=\ngoogle.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE=\ngoogle.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI=\ngoogle.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU=\ngoogle.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I=\ngoogle.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo=\ngoogle.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g=\ngoogle.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA=\ngoogle.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8=\ngoogle.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs=\ngoogle.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=\ngoogle.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=\ngoogle.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=\ngoogle.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=\ngoogle.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=\ngoogle.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=\ngoogle.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=\ngoogle.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=\ngoogle.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=\ngoogle.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=\ngoogle.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=\ngoogle.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=\ngoogle.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=\ngoogle.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=\ngoogle.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=\ngoogle.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=\ngoogle.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=\ngoogle.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=\ngoogle.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=\ngoogle.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=\ngoogle.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=\ngoogle.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=\ngoogle.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=\ngoogle.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=\ngoogle.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=\ngoogle.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=\ngoogle.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A=\ngoogle.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c h1:wtujag7C+4D6KMoulW9YauvK2lgdvCMS260jsqqBXr0=\ngoogle.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=\ngoogle.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=\ngoogle.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=\ngoogle.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24=\ngoogle.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k=\ngoogle.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k=\ngoogle.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=\ngoogle.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=\ngoogle.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w=\ngoogle.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=\ngoogle.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=\ngoogle.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=\ngoogle.golang.org/genproto v0.0.0-20210903162649-d08c68adba83 h1:3V2dxSZpz4zozWWUq36vUxXEKnSYitEH2LdsAx+RUmg=\ngoogle.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=\ngoogle.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=\ngoogle.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=\ngoogle.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=\ngoogle.golang.org/genproto v0.0.0-20211028162531-8db9c33dc351/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=\ngoogle.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=\ngoogle.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=\ngoogle.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=\ngoogle.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=\ngoogle.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=\ngoogle.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=\ngoogle.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=\ngoogle.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=\ngoogle.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=\ngoogle.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=\ngoogle.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E=\ngoogle.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac h1:qSNTkEN+L2mvWcLgJOR+8bdHX9rN/IdU3A1Ghpfb1Rg=\ngoogle.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=\ngoogle.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac h1:ByeiW1F67iV9o8ipGskA+HWzSkMbRJuKLlwCdPxzn7A=\ngoogle.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=\ngoogle.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=\ngoogle.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=\ngoogle.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=\ngoogle.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=\ngoogle.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=\ngoogle.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=\ngoogle.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=\ngoogle.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=\ngoogle.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=\ngoogle.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=\ngoogle.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=\ngoogle.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=\ngoogle.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=\ngoogle.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=\ngoogle.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=\ngoogle.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=\ngoogle.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=\ngoogle.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=\ngoogle.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=\ngoogle.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=\ngoogle.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=\ngoogle.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0=\ngoogle.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=\ngoogle.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=\ngoogle.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=\ngoogle.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q=\ngoogle.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=\ngoogle.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=\ngoogle.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=\ngoogle.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M=\ngoogle.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ=\ngoogle.golang.org/grpc v1.47.0 h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8=\ngoogle.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=\ngoogle.golang.org/grpc/cmd/protoc-gen-go-grpc v0.0.0-20200527211525-6c9e30c09db2/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=\ngoogle.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 h1:M1YKkFIboKNieVO5DLUEVzQfGwJD30Nv2jfUgzb5UcE=\ngoogle.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=\ngoogle.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=\ngoogle.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=\ngoogle.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=\ngoogle.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=\ngoogle.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=\ngoogle.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=\ngoogle.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=\ngoogle.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=\ngoogle.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=\ngoogle.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=\ngoogle.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=\ngoogle.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=\ngoogle.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=\ngoogle.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=\ngoogle.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=\ngoogle.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=\ngoogle.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=\ngopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=\ngopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=\ngopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=\ngopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=\ngopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=\ngopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=\ngopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=\ngopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=\ngopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=\ngopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=\ngopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=\ngopkg.in/go-playground/validator.v8 v8.18.2 h1:lFB4DoMU6B626w8ny76MV7VX6W2VHct2GVOI3xgiMrQ=\ngopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y=\ngopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=\ngopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw=\ngopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno=\ngopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=\ngopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4=\ngopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=\ngopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=\ngopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=\ngopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=\ngopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=\ngopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=\ngopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=\ngopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=\ngopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=\ngopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=\ngopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=\ngopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=\ngopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=\ngopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=\ngopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=\ngopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=\ngopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=\ngopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=\ngopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=\ngorm.io/driver/mysql v1.0.3/go.mod h1:twGxftLBlFgNVNakL7F+P/x9oYqoymG3YYT8cAfI9oI=\ngorm.io/driver/mysql v1.1.0 h1:3PgFPJlFq5Xt/0WRiRjxIVaXjeHY+2TQ5feXgpSpEC4=\ngorm.io/driver/mysql v1.1.0/go.mod h1:KdrTanmfLPPyAOeYGyG+UpDys7/7eeWT1zCq+oekYnU=\ngorm.io/driver/sqlite v1.1.4 h1:PDzwYE+sI6De2+mxAneV9Xs11+ZyKV6oxD3wDGkaNvM=\ngorm.io/driver/sqlite v1.1.4/go.mod h1:mJCeTFr7+crvS+TRnWc5Z3UvwxUN1BGBLMrf5LA9DYw=\ngorm.io/gorm v1.20.4/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=\ngorm.io/gorm v1.20.7/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=\ngorm.io/gorm v1.20.11/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=\ngorm.io/gorm v1.21.3/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=\ngorm.io/gorm v1.21.9 h1:INieZtn4P2Pw6xPJ8MzT0G4WUOsHq3RhfuDF1M6GW0E=\ngorm.io/gorm v1.21.9/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0=\ngorm.io/plugin/dbresolver v1.1.0 h1:cegr4DeprR6SkLIQlKhJLYxH8muFbJ4SmnojXvoeb00=\ngorm.io/plugin/dbresolver v1.1.0/go.mod h1:tpImigFAEejCALOttyhWqsy4vfa2Uh/vAUVnL5IRF7Y=\nhonnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=\nhonnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=\nhonnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=\nhonnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=\nhonnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=\nhonnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=\nhonnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=\nmvdan.cc/gofumpt v0.2.0/go.mod h1:TiGmrf914DAuT6+hDIxOqoDb4QXIzAuEUSXqEf9hGKY=\nmvdan.cc/gofumpt v0.3.0/go.mod h1:0+VyGZWleeIj5oostkOex+nDBA0eyavuDnDusAJ8ylo=\nrsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=\nrsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=\nrsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=\nrsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=\nsigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=\n"
  },
  {
    "path": "library/apollo/agollo/README.md",
    "content": "### Example\n\n```golang\npackage agollo\n\nimport (\n\t\"context\"\n\n\t\"github.com/why444216978/gin-api/library/apollo/agollo/listener\"\n\t\"github.com/why444216978/gin-api/library/apollo/agollo/listener/structlistener\"\n)\n\ntype Conf struct {\n\tKey string\n}\n\nfunc TestNew(t *testing.T) {\n\tconf := &Conf{}\n\tlisteners := []listener.CustomListener{\n\t\t{\n\t\t\tNamespaceStruct: map[string]interface{}{\n\t\t\t\t\"test.json\": conf,\n\t\t\t},\n\t\t\tCustomListener: &structlistener.StructChangeListener{},\n\t\t},\n\t}\n\tNew(context.Background(), \"test\", []string{\"test.json\"}, WithCustomListeners(listeners))\n}\n```"
  },
  {
    "path": "library/apollo/agollo/agollo.go",
    "content": "package agollo\n\nimport (\n\t\"context\"\n\t\"io/fs\"\n\t\"os\"\n\t\"strings\"\n\n\t\"github.com/apolloconfig/agollo/v4\"\n\t\"github.com/apolloconfig/agollo/v4/agcache\"\n\t\"github.com/apolloconfig/agollo/v4/cluster\"\n\t\"github.com/apolloconfig/agollo/v4/component/log\"\n\t\"github.com/apolloconfig/agollo/v4/env/config\"\n\t\"github.com/apolloconfig/agollo/v4/env/file\"\n\t\"github.com/apolloconfig/agollo/v4/protocol/auth\"\n\n\t\"github.com/why444216978/gin-api/library/apollo/agollo/listener\"\n)\n\nconst (\n\tenvIP      = \"APOLLO_IP\"\n\tenvSecret  = \"APOLLO_SECRET\"\n\tenvCluster = \"APOLLO_CLUSTER\"\n)\n\nconst (\n\tdefaultBackupConfigFileMode fs.FileMode = 0744\n\tdefaultIsBackupConfig                   = true\n\tdefaultBackupConfigPath                 = \".apollo_config\"\n)\n\ntype Option func(*ApolloClient)\n\nfunc WithIsBackupConfig(isBackup bool) Option {\n\treturn func(a *ApolloClient) { a.appConfig.IsBackupConfig = isBackup }\n}\n\nfunc WithBackupConfigPath(backupPath string) Option {\n\treturn func(a *ApolloClient) { a.appConfig.BackupConfigPath = backupPath }\n}\n\nfunc WithSyncServerTimeout(syncServerTimeout int) Option {\n\treturn func(a *ApolloClient) { a.appConfig.SyncServerTimeout = syncServerTimeout }\n}\n\nfunc WithCustomListeners(listeners []listener.CustomListener) Option {\n\treturn func(a *ApolloClient) { a.listeners = listeners }\n}\n\nfunc WithLogger(logger log.LoggerInterface) Option {\n\treturn func(a *ApolloClient) { a.logger = logger }\n}\n\nfunc WithCache(cache agcache.CacheFactory) Option {\n\treturn func(a *ApolloClient) { a.cache = cache }\n}\n\nfunc WithAuth(auth auth.HTTPAuth) Option {\n\treturn func(a *ApolloClient) { a.auth = auth }\n}\n\nfunc WithLoadBalance(loadBalance cluster.LoadBalance) Option {\n\treturn func(a *ApolloClient) { a.loadBalance = loadBalance }\n}\n\nfunc WithFileHandler(fileHandler file.FileHandler) Option {\n\treturn func(a *ApolloClient) { a.fileHandler = fileHandler }\n}\n\ntype ApolloClient struct {\n\tclient         agollo.Client\n\tlogger         log.LoggerInterface\n\tcache          agcache.CacheFactory\n\tauth           auth.HTTPAuth\n\tloadBalance    cluster.LoadBalance\n\tfileHandler    file.FileHandler\n\tlisteners      []listener.CustomListener\n\tappConfig      *config.AppConfig\n\tbackupFileMode fs.FileMode\n}\n\nvar defaultAppConfig = func(appID string, namespaces []string) *config.AppConfig {\n\treturn &config.AppConfig{\n\t\tAppID:            appID,\n\t\tNamespaceName:    strings.Join(namespaces, \",\"),\n\t\tIP:               os.Getenv(envIP),\n\t\tCluster:          os.Getenv(envCluster),\n\t\tIsBackupConfig:   defaultIsBackupConfig,\n\t\tBackupConfigPath: defaultBackupConfigPath,\n\t\tSecret:           os.Getenv(envSecret),\n\t}\n}\n\nfunc New(ctx context.Context, appID string, namespaces []string, opts ...Option) (err error) {\n\tac := &ApolloClient{\n\t\tappConfig: defaultAppConfig(appID, namespaces),\n\t}\n\tac.appConfig.IP = \"http://10.169.32.38:80\"\n\tac.appConfig.Cluster = \"default\"\n\n\tfor _, o := range opts {\n\t\to(ac)\n\t}\n\n\tif ac.backupFileMode == 0 {\n\t\tac.backupFileMode = defaultBackupConfigFileMode\n\t}\n\n\t// init back file\n\terr = os.MkdirAll(ac.appConfig.BackupConfigPath, ac.backupFileMode)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// init client\n\tclient, err := agollo.StartWithConfig(func() (*config.AppConfig, error) { return ac.appConfig, nil })\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// init handler\n\tac.setHandler()\n\n\t// init listener\n\tfor _, l := range ac.listeners {\n\t\tclient.AddChangeListener(l.CustomListener)\n\t\tl.CustomListener.InitConfig(client, l.NamespaceStruct)\n\t}\n\n\treturn\n}\n\nfunc (ac *ApolloClient) setHandler() {\n\tif ac.auth != nil {\n\t\tagollo.SetSignature(ac.auth)\n\t}\n\n\tif ac.loadBalance != nil {\n\t\tagollo.SetLoadBalance(ac.loadBalance)\n\t}\n\n\tif ac.logger != nil {\n\t\tagollo.SetLogger(ac.logger)\n\t}\n\n\tif ac.cache != nil {\n\t\tagollo.SetCache(ac.cache)\n\t}\n\n\tif ac.fileHandler != nil {\n\t\tagollo.SetBackupFileHandler(ac.fileHandler)\n\t}\n}\n"
  },
  {
    "path": "library/apollo/agollo/agollo_test.go",
    "content": "package agollo\n\nimport (\n\t\"context\"\n\t\"testing\"\n\n\t\"github.com/golang/mock/gomock\"\n\n\t\"github.com/why444216978/gin-api/library/apollo/agollo/listener\"\n\t\"github.com/why444216978/gin-api/library/apollo/agollo/listener/mock\"\n)\n\ntype Conf struct {\n\tKey string\n}\n\nfunc TestNew(t *testing.T) {\n\tctl := gomock.NewController(t)\n\tl := mock.NewMockListener(ctl)\n\tl.EXPECT().InitConfig(gomock.Any(), gomock.Any()).AnyTimes()\n\n\tconf := &Conf{}\n\tlisteners := []listener.CustomListener{\n\t\t{\n\t\t\tNamespaceStruct: map[string]interface{}{\n\t\t\t\t\"test.json\": conf,\n\t\t\t},\n\t\t\tCustomListener: l,\n\t\t},\n\t}\n\tNew(context.Background(), \"test\", []string{\"test.json\"}, WithCustomListeners(listeners))\n}\n"
  },
  {
    "path": "library/apollo/agollo/listener/listener.go",
    "content": "package listener\n\nimport (\n\t\"github.com/apolloconfig/agollo/v4\"\n\t\"github.com/apolloconfig/agollo/v4/storage\"\n)\n\ntype CustomListener struct {\n\tNamespaceStruct map[string]interface{} // namespace to struct\n\tNamespaceFile   map[string]string      // TODO namespace file dir, used to backup\n\tCustomListener  Listener\n}\n\ntype Listener interface {\n\tstorage.ChangeListener\n\tInitConfig(client agollo.Client, namespaceStruct map[string]interface{})\n\tGetNamespace(namespace string) (interface{}, bool)\n}\n"
  },
  {
    "path": "library/apollo/agollo/listener/mock/listener.go",
    "content": "// Code generated by MockGen. DO NOT EDIT.\n// Source: library/apollo/agollo/listener/listener.go\n\n// Package mock is a generated GoMock package.\npackage mock\n\nimport (\n\treflect \"reflect\"\n\n\tagollo \"github.com/apolloconfig/agollo/v4\"\n\tstorage \"github.com/apolloconfig/agollo/v4/storage\"\n\tgomock \"github.com/golang/mock/gomock\"\n)\n\n// MockListener is a mock of Listener interface.\ntype MockListener struct {\n\tctrl     *gomock.Controller\n\trecorder *MockListenerMockRecorder\n}\n\n// MockListenerMockRecorder is the mock recorder for MockListener.\ntype MockListenerMockRecorder struct {\n\tmock *MockListener\n}\n\n// NewMockListener creates a new mock instance.\nfunc NewMockListener(ctrl *gomock.Controller) *MockListener {\n\tmock := &MockListener{ctrl: ctrl}\n\tmock.recorder = &MockListenerMockRecorder{mock}\n\treturn mock\n}\n\n// EXPECT returns an object that allows the caller to indicate expected use.\nfunc (m *MockListener) EXPECT() *MockListenerMockRecorder {\n\treturn m.recorder\n}\n\n// GetNamespace mocks base method.\nfunc (m *MockListener) GetNamespace(namespace string) (interface{}, bool) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetNamespace\", namespace)\n\tret0, _ := ret[0].(interface{})\n\tret1, _ := ret[1].(bool)\n\treturn ret0, ret1\n}\n\n// GetNamespace indicates an expected call of GetNamespace.\nfunc (mr *MockListenerMockRecorder) GetNamespace(namespace interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetNamespace\", reflect.TypeOf((*MockListener)(nil).GetNamespace), namespace)\n}\n\n// InitConfig mocks base method.\nfunc (m *MockListener) InitConfig(client agollo.Client, namespaceStruct map[string]interface{}) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"InitConfig\", client, namespaceStruct)\n}\n\n// InitConfig indicates an expected call of InitConfig.\nfunc (mr *MockListenerMockRecorder) InitConfig(client, namespaceStruct interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"InitConfig\", reflect.TypeOf((*MockListener)(nil).InitConfig), client, namespaceStruct)\n}\n\n// OnChange mocks base method.\nfunc (m *MockListener) OnChange(event *storage.ChangeEvent) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"OnChange\", event)\n}\n\n// OnChange indicates an expected call of OnChange.\nfunc (mr *MockListenerMockRecorder) OnChange(event interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"OnChange\", reflect.TypeOf((*MockListener)(nil).OnChange), event)\n}\n\n// OnNewestChange mocks base method.\nfunc (m *MockListener) OnNewestChange(event *storage.FullChangeEvent) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"OnNewestChange\", event)\n}\n\n// OnNewestChange indicates an expected call of OnNewestChange.\nfunc (mr *MockListenerMockRecorder) OnNewestChange(event interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"OnNewestChange\", reflect.TypeOf((*MockListener)(nil).OnNewestChange), event)\n}\n"
  },
  {
    "path": "library/apollo/agollo/listener/structlistener/listener.go",
    "content": "package structlistener\n\nimport (\n\t\"sync\"\n\n\t\"github.com/apolloconfig/agollo/v4\"\n\t\"github.com/apolloconfig/agollo/v4/component/log\"\n\t\"github.com/apolloconfig/agollo/v4/storage\"\n\n\t\"github.com/why444216978/gin-api/library/apollo/agollo/listener\"\n\t\"github.com/why444216978/gin-api/library/apollo/agollo/util\"\n)\n\ntype StructChangeListener struct {\n\tnamespaces sync.Map\n}\n\nvar _ listener.Listener = (*StructChangeListener)(nil)\n\nfunc (c *StructChangeListener) OnChange(changeEvent *storage.ChangeEvent) {}\n\nfunc (c *StructChangeListener) OnNewestChange(event *storage.FullChangeEvent) {\n\tconf, ok := c.namespaces.Load(event.Namespace)\n\tif !ok {\n\t\treturn\n\t}\n\n\tvalue, ok := event.Changes[\"content\"]\n\tif !ok {\n\t\tlog.Errorf(\"StructChangeListener.OnNewestChange %s err: content not exists\", event.Namespace)\n\t\treturn\n\t}\n\n\tcontent, ok := value.(string)\n\tif !ok {\n\t\tlog.Errorf(\"StructChangeListener.OnNewestChange %s err: content assert fail\", event.Namespace)\n\t\treturn\n\t}\n\n\tif err := util.ExtractConf(event.Namespace, content, conf); err != nil {\n\t\tlog.Errorf(\"StructChangeListener.OnNewestChange %s err: %s\", event.Namespace, err.Error())\n\t\treturn\n\t}\n}\n\nfunc (c *StructChangeListener) InitConfig(client agollo.Client, namespaceStruct map[string]interface{}) {\n\tfor namespace, confStruct := range namespaceStruct {\n\t\tconf := client.GetConfig(namespace)\n\t\tif conf == nil {\n\t\t\tpanic(namespace + \" conf nil\")\n\t\t}\n\n\t\tcontent := conf.GetValue(\"content\")\n\t\tif err := util.ExtractConf(namespace, content, confStruct); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tc.namespaces.Store(namespace, confStruct)\n\t}\n}\n\nfunc (c *StructChangeListener) GetNamespace(namespace string) (interface{}, bool) {\n\treturn c.namespaces.Load(namespace)\n}\n"
  },
  {
    "path": "library/apollo/agollo/util/util.go",
    "content": "package util\n\nimport (\n\t\"bytes\"\n\t\"path\"\n\n\t\"github.com/pkg/errors\"\n\t\"github.com/why444216978/codec/json\"\n\t\"github.com/why444216978/codec/toml\"\n\t\"github.com/why444216978/codec/xml\"\n\t\"github.com/why444216978/codec/yaml\"\n)\n\nvar (\n\tjsonCodec = json.JSONCodec{}\n\ttomlCodec = toml.TomlCodec{}\n\tyamlCodec = yaml.YamlCodec{}\n\txmlCodec  = xml.XMLCodec{}\n)\n\nfunc ExtractConf(namespace, content string, conf interface{}) error {\n\tswitch path.Ext(namespace) {\n\tcase \"\":\n\t\treturn errors.New(\"ext is empty, maybe it is not support properties type\")\n\tcase \".json\":\n\t\treturn jsonCodec.Decode(bytes.NewReader([]byte(content)), conf)\n\tcase \".txt\":\n\t\treturn tomlCodec.Decode(bytes.NewReader([]byte(content)), conf)\n\tcase \".yaml\", \".yml\":\n\t\treturn yamlCodec.Decode(bytes.NewReader([]byte(content)), conf)\n\tcase \".xml\":\n\t\treturn xmlCodec.Decode(bytes.NewReader([]byte(content)), conf)\n\t}\n\n\treturn errors.New(\"namespace ext error\")\n}\n"
  },
  {
    "path": "library/apollo/http/apollo.go",
    "content": "//vim ~/.bash_profile\n//export RUNTIME_CLUSTER=development     #填写对应的集群名称\n//export CONFIG_CENTER_URL=http://development.apollo.com   #填写开发环境配置中心域名\n//export CONFIG_CENTER_TOKEN=abc123   #填写正确的token信息\n//保存退出\n//source ~/.bash_profile  #使刚才的环境变量生效\n//\n//验证是否配置成功\n//echo $RUNTIME_CLUSTER\n//echo CONFIG_CENTER_URL\n//echo CONFIG_CENTER_TOKEN\n//echo CONFIG_CENTER_APPID\n\npackage http\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"net/http\"\n\t\"os\"\n\t\"sync\"\n\t\"time\"\n)\n\ntype AppoloConf struct {\n\tAppId          string            `json:\"appId\"`\n\tCluster        string            `json:\"cluster\"`\n\tNamespaceName  string            `json:\"namespaceName\"`\n\tConfigurations map[string]string `json:\"configurations\"`\n\tReleaseKey     string            `json:\"releaseKey\"`\n}\n\nvar apolloOnce sync.Once\nvar apolloConfigs map[string]string\n\nfunc DoLoadApolloConf(host, service, cluster, token string, space []string) (map[string]string, error) {\n\tclient := &http.Client{\n\t\tTimeout: time.Second * 60, // Notifications由于服务端会hold住请求60秒，所以请确保客户端访问服务端的超时时间要大于60秒。\n\t}\n\n\tcfgMap := make(map[string]string)\n\n\tfor _, v := range space {\n\t\tServiceUriFmt := fmt.Sprintf(\"%s/configs/%s/%s/%s\", host, service, cluster, v)\n\t\treq, err := http.NewRequest(\"GET\", ServiceUriFmt, nil)\n\t\tquery := req.URL.Query()\n\t\tquery.Add(\"token\", token)\n\t\treq.URL.RawQuery = query.Encode()\n\t\tresponse, err := client.Do(req)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdefer response.Body.Close()\n\n\t\tif response.StatusCode != http.StatusOK {\n\t\t\treturn nil, fmt.Errorf(\"http status is not ok.\")\n\t\t}\n\n\t\tresponseData, err := ioutil.ReadAll(response.Body)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvar ac AppoloConf\n\t\terr = json.Unmarshal(responseData, &ac)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcfgMap = ac.Configurations\n\t}\n\n\treturn cfgMap, nil\n}\n\n// LoadApolloConf\n// example: LoadApolloConf(\"777\", []string{\"application\"})\nfunc LoadApolloConf(service string, space []string) (map[string]string, error) {\n\tvar err error\n\tapolloOnce.Do(func() {\n\t\tapolloConfigs = make(map[string]string)\n\t\thost := os.Getenv(\"CONFIG_CENTER_URL\")\n\t\tcluster := os.Getenv(\"RUNTIME_CLUSTER\")\n\t\ttoken := os.Getenv(\"CONFIG_CENTER_TOKEN\")\n\t\tapolloConfigs, err = DoLoadApolloConf(host, service, cluster, token, space)\n\t\tfmt.Println(\"get apollo\")\n\t})\n\n\treturn apolloConfigs, err\n}\n"
  },
  {
    "path": "library/app/app.go",
    "content": "package app\n\nimport (\n\t\"time\"\n\n\t\"github.com/why444216978/gin-api/library/config\"\n)\n\nvar app struct {\n\tAppName        string\n\tAppPort        int\n\tPprof          bool\n\tIsDebug        bool\n\tContextTimeout int\n\tConnectTimeout int\n\tWriteTimeout   int\n\tReadTimeout    int\n}\n\nfunc InitApp() (err error) {\n\treturn config.ReadConfig(\"app\", \"toml\", &app)\n}\n\nfunc Name() string {\n\treturn app.AppName\n}\n\nfunc Port() int {\n\treturn app.AppPort\n}\n\nfunc Pprof() bool {\n\treturn app.Pprof\n}\n\nfunc Debug() bool {\n\treturn app.IsDebug\n}\n\nfunc ContextTimeout() time.Duration {\n\tif app.ConnectTimeout == 0 {\n\t\treturn time.Duration(100000) * time.Millisecond\n\t}\n\treturn time.Duration(app.ContextTimeout) * time.Millisecond\n}\n\nfunc ConnectTimeout() time.Duration {\n\tif app.ConnectTimeout == 0 {\n\t\treturn time.Duration(100000) * time.Millisecond\n\t}\n\treturn time.Duration(app.ConnectTimeout) * time.Millisecond\n}\n\nfunc WriteTimeout() time.Duration {\n\tif app.WriteTimeout == 0 {\n\t\treturn time.Duration(100000) * time.Millisecond\n\t}\n\treturn time.Duration(app.WriteTimeout) * time.Millisecond\n}\n\nfunc ReadTimeout() time.Duration {\n\tif app.ReadTimeout == 0 {\n\t\treturn time.Duration(100000) * time.Millisecond\n\t}\n\treturn time.Duration(app.ReadTimeout) * time.Millisecond\n}\n"
  },
  {
    "path": "library/cache/cache.go",
    "content": "package cache\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"runtime/debug\"\n\t\"time\"\n)\n\n// CacheData is cache data struct\ntype CacheData struct {\n\tExpireAt int64  // ExpireAt is virtual expire time\n\tData     string // Data is cache data\n}\n\n// LoadFunc is define load data func\ntype LoadFunc func(ctx context.Context, target interface{}) (err error)\n\n// Cacher is used to load cache\ntype Cacher interface {\n\t// GetData load data from cache\n\t// if cache not exist load data by LoadFunc\n\t// ttl is redis server ttl\n\t// virtualTTL is developer ttl\n\tGetData(ctx context.Context, key string, ttl time.Duration, virtualTTL time.Duration, f LoadFunc, data interface{}) (err error)\n\n\t// FlushCache flush cache\n\t// if cache not exist, load data and save cache\n\tFlushCache(ctx context.Context, key string, ttl time.Duration, virtualTTL time.Duration, f LoadFunc, data interface{}) (err error)\n}\n\n// panicError https://cs.opensource.google/go/x/sync/+/036812b2:singleflight/singleflight.go\ntype panicError struct {\n\tvalue interface{}\n\tstack []byte\n}\n\n// Error implements error interface.\nfunc (p *panicError) Error() string {\n\treturn fmt.Sprintf(\"%v\\n\\n%s\", p.value, p.stack)\n}\n\n// newPanicError is format panic error\nfunc newPanicError(v interface{}) error {\n\tstack := debug.Stack()\n\n\t// The first line of the stack trace is of the form \"goroutine N [status]:\"\n\t// but by the time the panic reaches Do the goroutine may no longer exist\n\t// and its status will have changed. Trim out the misleading line.\n\tif line := bytes.IndexByte(stack[:], '\\n'); line >= 0 {\n\t\tstack = stack[line+1:]\n\t}\n\treturn &panicError{value: v, stack: stack}\n}\n\n// HandleLoad is used load cache\nfunc HandleLoad(ctx context.Context, f LoadFunc, data interface{}) (err error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\terr = newPanicError(r)\n\t\t}\n\t}()\n\terr = f(ctx, data)\n\treturn\n}\n"
  },
  {
    "path": "library/cache/redis/redis_cache.go",
    "content": "package cache\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"time\"\n\n\t\"github.com/go-redis/redis/v8\"\n\t\"github.com/why444216978/go-util/assert\"\n\tutilCtx \"github.com/why444216978/go-util/context\"\n\t\"github.com/why444216978/go-util/snowflake\"\n\n\t\"github.com/why444216978/gin-api/library/cache\"\n\t\"github.com/why444216978/gin-api/library/lock\"\n)\n\ntype RedisCache struct {\n\tc    *redis.Client\n\tlock lock.Locker\n}\n\nvar _ cache.Cacher = (*RedisCache)(nil)\n\nfunc New(c *redis.Client, locker lock.Locker) (*RedisCache, error) {\n\tif assert.IsNil(c) {\n\t\treturn nil, errors.New(\"redis is nil\")\n\t}\n\n\tif assert.IsNil(locker) {\n\t\treturn nil, errors.New(\"locker is nil\")\n\t}\n\n\treturn &RedisCache{\n\t\tc:    c,\n\t\tlock: locker,\n\t}, nil\n}\n\nfunc (rc *RedisCache) GetData(ctx context.Context, key string, ttl time.Duration, virtualTTL time.Duration, f cache.LoadFunc, data interface{}) (err error) {\n\tcache, err := rc.getCache(ctx, key)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// 无缓存\n\tif cache.ExpireAt == 0 || cache.Data == \"\" {\n\t\terr = rc.FlushCache(ctx, key, ttl, virtualTTL, f, data)\n\t\treturn\n\t}\n\n\terr = json.Unmarshal([]byte(cache.Data), data)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif time.Now().Before(time.Unix(cache.ExpireAt, 0)) {\n\t\treturn\n\t}\n\n\tctxNew := utilCtx.RemoveCancel(ctx)\n\tgo rc.FlushCache(ctxNew, key, ttl, virtualTTL, f, data)\n\n\treturn\n}\n\nfunc (rc *RedisCache) FlushCache(ctx context.Context, key string, ttl time.Duration, virtualTTL time.Duration, f cache.LoadFunc, data interface{}) (err error) {\n\tlockKey := \"LOCK::\" + key\n\trandom := snowflake.Generate().String()\n\n\t// 获取锁，自旋三次\n\t// TODO 这里可优化为客户端传入控制\n\ttry := 0\n\tfor {\n\t\ttry = try + 1\n\t\tif try > 3 {\n\t\t\tbreak\n\t\t}\n\t\terr = rc.lock.Lock(ctx, lockKey, random, time.Second*10)\n\t\tif err == lock.ErrLock {\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer rc.lock.Unlock(ctx, lockKey, random)\n\n\t// load data\n\terr = cache.HandleLoad(ctx, f, data)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdataStr, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// save cache\n\terr = rc.setCache(ctx, key, string(dataStr), ttl, virtualTTL)\n\n\treturn\n}\n\nfunc (rc *RedisCache) getCache(ctx context.Context, key string) (data *cache.CacheData, err error) {\n\tdata = &cache.CacheData{}\n\n\tres, err := rc.c.Get(ctx, key).Result()\n\tif err == redis.Nil {\n\t\terr = nil\n\t}\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif res == \"\" {\n\t\treturn\n\t}\n\n\terr = json.Unmarshal([]byte(res), data)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}\n\nfunc (rc *RedisCache) setCache(ctx context.Context, key, val string, ttl time.Duration, virtualTTL time.Duration) (err error) {\n\t_data := cache.CacheData{\n\t\tExpireAt: time.Now().Add(virtualTTL).Unix(),\n\t\tData:     val,\n\t}\n\tdata, err := json.Marshal(_data)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t_, err = rc.c.Set(ctx, key, string(data), ttl).Result()\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}\n"
  },
  {
    "path": "library/config/viper.go",
    "content": "package config\n\nimport (\n\t\"log\"\n\t\"os\"\n\t\"path/filepath\"\n\n\t\"github.com/spf13/viper\"\n)\n\ntype Viper struct {\n\t*viper.Viper\n\tpath string\n}\n\nvar Env = map[string]struct{}{\n\t\"dev\":      {},\n\t\"liantiao\": {},\n\t\"qa\":       {},\n\t\"online\":   {},\n}\n\nvar defaultConf *Viper\n\nfunc ReadConfig(file, typ string, data interface{}) (err error) {\n\treturn defaultConf.ReadConfig(file, typ, data)\n}\n\nfunc Path() string {\n\treturn defaultConf.Path()\n}\n\nfunc Dir() (string, error) {\n\treturn filepath.Abs(Path())\n}\n\nfunc Config() *Viper {\n\treturn defaultConf\n}\n\nfunc Init(env string) {\n\tdefaultConf = New(env)\n}\n\nfunc New(env string) *Viper {\n\tlog.Println(\"The environment is :\" + env)\n\n\tif _, ok := Env[env]; !ok {\n\t\tpanic(env + \" error\")\n\t}\n\n\tpath := \"conf/\" + env\n\tif _, err := os.Stat(path); err != nil {\n\t\tpanic(err)\n\t}\n\n\tconfig := viper.New()\n\tconfig.AddConfigPath(path)\n\n\treturn &Viper{\n\t\tViper: config,\n\t\tpath:  path,\n\t}\n}\n\nfunc (v *Viper) ReadConfig(file, typ string, data interface{}) (err error) {\n\tv.SetConfigName(file)\n\tv.SetConfigType(typ)\n\tif err = v.ReadInConfig(); err != nil {\n\t\treturn\n\t}\n\n\treturn v.Unmarshal(&data)\n}\n\nfunc (v *Viper) Path() string {\n\treturn v.path\n}\n"
  },
  {
    "path": "library/cron/cron.go",
    "content": "package cron\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"runtime\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/pkg/errors\"\n\t\"github.com/robfig/cron/v3\"\n\t\"github.com/why444216978/go-util/assert\"\n\t\"github.com/why444216978/go-util/snowflake\"\n\t\"github.com/why444216978/go-util/sys\"\n\n\t\"github.com/why444216978/gin-api/library/lock\"\n\t\"github.com/why444216978/gin-api/library/logger\"\n)\n\nvar (\n\tdefaultMiniLockTTL = time.Second\n\tdefaultLockFormat  = \"lock:cron:%s:%s\"\n)\n\nvar secondParser = cron.NewParser(\n\tcron.Second | cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow | cron.Descriptor,\n)\n\ntype Cron struct {\n\t*cron.Cron\n\tlogger     logger.Logger\n\tlock       lock.Locker\n\topts       *Options\n\tname       string\n\trw         sync.RWMutex\n\tfuncEntity map[string]cron.Entry\n}\n\ntype Options struct {\n\tlocker        lock.Locker\n\terrorCallback func(error)\n\tminiLockTTL   time.Duration\n\tlockFormat    string\n}\n\nfunc defaultOptions() *Options {\n\treturn &Options{\n\t\tminiLockTTL: defaultMiniLockTTL,\n\t\tlockFormat:  defaultLockFormat,\n\t}\n}\n\ntype Option func(*Options)\n\nfunc WithLocker(l lock.Locker) Option {\n\treturn func(o *Options) { o.locker = l }\n}\n\nfunc WithErrCallback(f func(error)) Option {\n\treturn func(o *Options) { o.errorCallback = f }\n}\n\nfunc WithMiniLockTTL(ttl time.Duration) Option {\n\treturn func(o *Options) { o.miniLockTTL = ttl }\n}\n\nfunc WithLockFormat(lockFormat string) Option {\n\treturn func(o *Options) { o.lockFormat = lockFormat }\n}\n\nfunc NewCron(name string, l logger.Logger, options ...Option) (c *Cron, err error) {\n\topts := defaultOptions()\n\n\tfor _, o := range options {\n\t\to(opts)\n\t}\n\n\tif assert.IsNil(l == nil) {\n\t\terr = errors.New(\"logger is nil\")\n\t\treturn\n\t}\n\n\tif opts.miniLockTTL < time.Second {\n\t\topts.miniLockTTL = time.Second\n\t}\n\n\tc = &Cron{\n\t\tlogger:     l,\n\t\tlock:       opts.locker,\n\t\tCron:       cron.New(cron.WithSeconds()),\n\t\topts:       opts,\n\t\tname:       name,\n\t\tfuncEntity: make(map[string]cron.Entry),\n\t}\n\n\treturn c, nil\n}\n\nfunc (c *Cron) AddJob(spec string, cmd func()) (cron.EntryID, error) {\n\treturn c.addJob(spec, FuncJob(cmd))\n}\n\nfunc (c *Cron) Start() {\n\tc.Cron.Start()\n}\n\nfunc (c *Cron) Stop() {\n\tc.Cron.Stop()\n}\n\nfunc (c *Cron) Name() string {\n\treturn c.name\n}\n\nfunc (c *Cron) addJob(spec string, cmd cron.Job) (cron.EntryID, error) {\n\tctx := context.TODO()\n\tip, _ := sys.LocalIP()\n\tfuncName := cmd.(FuncJob).FunctionName()\n\tlockKey := c.getLockKey(funcName)\n\n\tentityID, err := c.AddFunc(spec, c.handle(ctx, cmd, funcName, spec, ip, lockKey))\n\tc.setFuncEntity(funcName, entityID)\n\n\treturn entityID, err\n}\n\nfunc (c *Cron) handle(ctx context.Context, cmd cron.Job, funcName, spec, ip, lockKey string) func() {\n\treturn func() {\n\t\tvar err error\n\n\t\tschedule := c.getFuncEntity(funcName).Schedule\n\t\tttl := c.getLockDuration(schedule)\n\t\trandom := snowflake.Generate().String()\n\n\t\tif !assert.IsNil(c.lock) {\n\t\t\tif err = c.lock.Lock(ctx, lockKey, random, ttl); err != nil {\n\t\t\t\tc.logger.Error(ctx, errors.Wrap(err, \"crontab fun Lock err\").Error(),\n\t\t\t\t\tlogger.Reflect(\"spec\", spec),\n\t\t\t\t\tlogger.Reflect(logger.ClientIP, ip),\n\t\t\t\t\tlogger.Reflect(logger.API, c.name),\n\t\t\t\t\tlogger.Reflect(logger.Method, funcName))\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tstart := time.Now()\n\t\tfunc() {\n\t\t\tdefer func() {\n\t\t\t\tif err := recover(); err != nil {\n\t\t\t\t\tc.logger.Error(ctx, \"crontab handler panic\",\n\t\t\t\t\t\tlogger.Reflect(\"panic\", err),\n\t\t\t\t\t\tlogger.Reflect(\"spec\", spec),\n\t\t\t\t\t\tlogger.Reflect(logger.ClientIP, ip),\n\t\t\t\t\t\tlogger.Reflect(logger.API, c.name),\n\t\t\t\t\t\tlogger.Reflect(logger.Method, funcName))\n\t\t\t\t}\n\t\t\t}()\n\t\t\tcmd.Run()\n\t\t}()\n\n\t\tc.logger.Info(ctx, \"handle \"+c.name,\n\t\t\tlogger.Reflect(\"spec\", spec),\n\t\t\tlogger.Reflect(logger.Cost, time.Since(start).Milliseconds()),\n\t\t\tlogger.Reflect(logger.ClientIP, ip),\n\t\t\tlogger.Reflect(logger.API, c.name),\n\t\t\tlogger.Reflect(logger.Method, funcName))\n\n\t\tif !assert.IsNil(c.lock) {\n\t\t\tif err = c.lock.Unlock(ctx, lockKey, random); err != nil {\n\t\t\t\tc.logger.Error(ctx, errors.Wrap(err, \"crontab fun Unlock err\").Error(),\n\t\t\t\t\tlogger.Reflect(\"spec\", spec),\n\t\t\t\t\tlogger.Reflect(logger.ClientIP, ip),\n\t\t\t\t\tlogger.Reflect(logger.API, c.name),\n\t\t\t\t\tlogger.Reflect(logger.Method, funcName))\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc (c *Cron) getLockDuration(schedule cron.Schedule) time.Duration {\n\tnow := time.Now()\n\tnext := schedule.Next(now)\n\tttl := time.Until(next)\n\tif ttl < c.opts.miniLockTTL {\n\t\tttl = c.opts.miniLockTTL\n\t}\n\n\treturn ttl\n}\n\nfunc (c *Cron) getLockKey(funcName string) string {\n\treturn fmt.Sprintf(c.opts.lockFormat, c.name, funcName)\n}\n\nfunc (c *Cron) setFuncEntity(funcName string, entityID cron.EntryID) {\n\tc.rw.Lock()\n\tdefer c.rw.Unlock()\n\n\tc.funcEntity[funcName] = c.Entry(entityID)\n}\n\nfunc (c *Cron) getFuncEntity(funcName string) cron.Entry {\n\tc.rw.RLock()\n\tdefer c.rw.RUnlock()\n\n\treturn c.funcEntity[funcName]\n}\n\ntype FuncJob func()\n\nfunc (f FuncJob) Run() { f() }\n\nfunc (f FuncJob) Function() func() { return f }\n\nfunc (f FuncJob) FunctionName() string {\n\treturn runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name()\n}\n"
  },
  {
    "path": "library/cron/cron_test.go",
    "content": "package cron\n\nimport (\n\t\"log\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/golang/mock/gomock\"\n\t\"github.com/stretchr/testify/assert\"\n\n\tlockmock \"github.com/why444216978/gin-api/library/lock/mock\"\n\tzapLogger \"github.com/why444216978/gin-api/library/logger/zap\"\n)\n\nfunc JobFunc() {\n\tlog.Println(\"JobFunc handle\")\n}\n\nfunc TestCron_AddJob(t *testing.T) {\n\tlogger, err := zapLogger.NewLogger()\n\tassert.Equal(t, err, nil)\n\n\tctl := gomock.NewController(t)\n\tlocker := lockmock.NewMockLocker(ctl)\n\tlocker.EXPECT().Lock(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return(nil)\n\tlocker.EXPECT().Unlock(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return(nil)\n\n\tcron, err := NewCron(\"JobFunc\", logger, WithLocker(locker))\n\tassert.Equal(t, err, nil)\n\n\tentryID, err := cron.AddJob(\"*/3 * * * * *\", JobFunc)\n\tassert.Equal(t, err, nil)\n\tassert.Equal(t, entryID > 0, true)\n\n\tcron.Start()\n\ttime.Sleep(time.Second * 9)\n\tcron.Stop()\n}\n"
  },
  {
    "path": "library/endless/endless.go",
    "content": "package endless\n\nimport (\n\t\"crypto/tls\"\n\t\"errors\"\n\t\"fmt\"\n\t\"log\"\n\t\"net\"\n\t\"net/http\"\n\t\"os\"\n\t\"os/exec\"\n\t\"os/signal\"\n\t\"runtime\"\n\t\"strings\"\n\t\"sync\"\n\t\"syscall\"\n\t\"time\"\n\t// \"github.com/fvbock/uds-go/introspect\"\n)\n\nconst (\n\tPRE_SIGNAL = iota\n\tPOST_SIGNAL\n\n\tSTATE_INIT\n\tSTATE_RUNNING\n\tSTATE_SHUTTING_DOWN\n\tSTATE_TERMINATE\n)\n\nvar (\n\trunningServerReg     sync.RWMutex\n\trunningServers       map[string]*endlessServer\n\trunningServersOrder  []string\n\tsocketPtrOffsetMap   map[string]uint\n\trunningServersForked bool\n\n\tDefaultReadTimeOut    time.Duration\n\tDefaultWriteTimeOut   time.Duration\n\tDefaultMaxHeaderBytes int\n\tDefaultHammerTime     time.Duration\n\n\tisChild     bool\n\tsocketOrder string\n\n\thookableSignals []os.Signal\n)\n\nfunc init() {\n\trunningServerReg = sync.RWMutex{}\n\trunningServers = make(map[string]*endlessServer)\n\trunningServersOrder = []string{}\n\tsocketPtrOffsetMap = make(map[string]uint)\n\n\tDefaultMaxHeaderBytes = 0 // use http.DefaultMaxHeaderBytes - which currently is 1 << 20 (1MB)\n\n\t// after a restart the parent will finish ongoing requests before\n\t// shutting down. set to a negative value to disable\n\tDefaultHammerTime = 60 * time.Second\n\n\thookableSignals = []os.Signal{\n\t\tsyscall.SIGHUP,\n\t\tsyscall.SIGUSR1,\n\t\tsyscall.SIGUSR2,\n\t\tsyscall.SIGINT,\n\t\tsyscall.SIGTERM,\n\t\tsyscall.SIGTSTP,\n\t}\n}\n\ntype endlessServer struct {\n\thttp.Server\n\tEndlessListener  net.Listener\n\tSignalHooks      map[int]map[os.Signal][]func()\n\ttlsInnerListener *endlessListener\n\twg               sync.WaitGroup\n\tsigChan          chan os.Signal\n\tisChild          bool\n\tstate            uint8\n\tlock             *sync.RWMutex\n\tBeforeBegin      func(add string)\n}\n\n/*\nNewServer returns an intialized endlessServer Object. Calling Serve on it will\nactually \"start\" the server.\n*/\nfunc NewServer(addr string, handler http.Handler) (srv *endlessServer) {\n\trunningServerReg.Lock()\n\tdefer runningServerReg.Unlock()\n\n\tsocketOrder = os.Getenv(\"ENDLESS_SOCKET_ORDER\")\n\tisChild = os.Getenv(\"ENDLESS_CONTINUE\") != \"\"\n\n\tif len(socketOrder) > 0 {\n\t\tfor i, addr := range strings.Split(socketOrder, \",\") {\n\t\t\tsocketPtrOffsetMap[addr] = uint(i)\n\t\t}\n\t} else {\n\t\tsocketPtrOffsetMap[addr] = uint(len(runningServersOrder))\n\t}\n\n\tsrv = &endlessServer{\n\t\twg:      sync.WaitGroup{},\n\t\tsigChan: make(chan os.Signal),\n\t\tisChild: isChild,\n\t\tSignalHooks: map[int]map[os.Signal][]func(){\n\t\t\tPRE_SIGNAL: map[os.Signal][]func(){\n\t\t\t\tsyscall.SIGHUP:  []func(){},\n\t\t\t\tsyscall.SIGUSR1: []func(){},\n\t\t\t\tsyscall.SIGUSR2: []func(){},\n\t\t\t\tsyscall.SIGINT:  []func(){},\n\t\t\t\tsyscall.SIGTERM: []func(){},\n\t\t\t\tsyscall.SIGTSTP: []func(){},\n\t\t\t},\n\t\t\tPOST_SIGNAL: map[os.Signal][]func(){\n\t\t\t\tsyscall.SIGHUP:  []func(){},\n\t\t\t\tsyscall.SIGUSR1: []func(){},\n\t\t\t\tsyscall.SIGUSR2: []func(){},\n\t\t\t\tsyscall.SIGINT:  []func(){},\n\t\t\t\tsyscall.SIGTERM: []func(){},\n\t\t\t\tsyscall.SIGTSTP: []func(){},\n\t\t\t},\n\t\t},\n\t\tstate: STATE_INIT,\n\t\tlock:  &sync.RWMutex{},\n\t}\n\n\tsrv.Server.Addr = addr\n\tsrv.Server.ReadTimeout = DefaultReadTimeOut\n\tsrv.Server.WriteTimeout = DefaultWriteTimeOut\n\tsrv.Server.MaxHeaderBytes = DefaultMaxHeaderBytes\n\tsrv.Server.Handler = handler\n\n\tsrv.BeforeBegin = func(addr string) {\n\t\tlog.Println(syscall.Getpid(), addr)\n\t}\n\n\trunningServersOrder = append(runningServersOrder, addr)\n\trunningServers[addr] = srv\n\n\treturn\n}\n\n/*\nListenAndServe listens on the TCP network address addr and then calls Serve\nwith handler to handle requests on incoming connections. Handler is typically\nnil, in which case the DefaultServeMux is used.\n*/\nfunc ListenAndServe(addr string, handler http.Handler) error {\n\tserver := NewServer(addr, handler)\n\treturn server.ListenAndServe()\n}\n\n/*\nListenAndServeTLS acts identically to ListenAndServe, except that it expects\nHTTPS connections. Additionally, files containing a certificate and matching\nprivate key for the server must be provided. If the certificate is signed by a\ncertificate authority, the certFile should be the concatenation of the server's\ncertificate followed by the CA's certificate.\n*/\nfunc ListenAndServeTLS(addr string, certFile string, keyFile string, handler http.Handler) error {\n\tserver := NewServer(addr, handler)\n\treturn server.ListenAndServeTLS(certFile, keyFile)\n}\n\nfunc (srv *endlessServer) getState() uint8 {\n\tsrv.lock.RLock()\n\tdefer srv.lock.RUnlock()\n\n\treturn srv.state\n}\n\nfunc (srv *endlessServer) setState(st uint8) {\n\tsrv.lock.Lock()\n\tdefer srv.lock.Unlock()\n\n\tsrv.state = st\n}\n\n/*\nServe accepts incoming HTTP connections on the listener l, creating a new\nservice goroutine for each. The service goroutines read requests and then call\nhandler to reply to them. Handler is typically nil, in which case the\nDefaultServeMux is used.\n\nIn addition to the stl Serve behaviour each connection is added to a\nsync.Waitgroup so that all outstanding connections can be served before shutting\ndown the server.\n*/\nfunc (srv *endlessServer) Serve() (err error) {\n\tdefer log.Println(syscall.Getpid(), \"Serve() returning...\")\n\tsrv.setState(STATE_RUNNING)\n\terr = srv.Server.Serve(srv.EndlessListener)\n\tlog.Println(syscall.Getpid(), \"Waiting for connections to finish...\")\n\tsrv.wg.Wait()\n\tsrv.setState(STATE_TERMINATE)\n\treturn\n}\n\n/*\nListenAndServe listens on the TCP network address srv.Addr and then calls Serve\nto handle requests on incoming connections. If srv.Addr is blank, \":http\" is\nused.\n*/\nfunc (srv *endlessServer) ListenAndServe() (err error) {\n\taddr := srv.Addr\n\tif addr == \"\" {\n\t\taddr = \":http\"\n\t}\n\n\tgo srv.handleSignals()\n\n\tl, err := srv.getListener(addr)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tsrv.EndlessListener = newEndlessListener(l, srv)\n\n\tif srv.isChild {\n\t\tsyscall.Kill(syscall.Getppid(), syscall.SIGTERM)\n\t}\n\n\tsrv.BeforeBegin(srv.Addr)\n\n\treturn srv.Serve()\n}\n\n/*\nListenAndServeTLS listens on the TCP network address srv.Addr and then calls\nServe to handle requests on incoming TLS connections.\n\nFilenames containing a certificate and matching private key for the server must\nbe provided. If the certificate is signed by a certificate authority, the\ncertFile should be the concatenation of the server's certificate followed by the\nCA's certificate.\n\nIf srv.Addr is blank, \":https\" is used.\n*/\nfunc (srv *endlessServer) ListenAndServeTLS(certFile, keyFile string) (err error) {\n\taddr := srv.Addr\n\tif addr == \"\" {\n\t\taddr = \":https\"\n\t}\n\n\tconfig := &tls.Config{}\n\tif srv.TLSConfig != nil {\n\t\t*config = *srv.TLSConfig\n\t}\n\tif config.NextProtos == nil {\n\t\tconfig.NextProtos = []string{\"http/1.1\"}\n\t}\n\n\tconfig.Certificates = make([]tls.Certificate, 1)\n\tconfig.Certificates[0], err = tls.LoadX509KeyPair(certFile, keyFile)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tgo srv.handleSignals()\n\n\tl, err := srv.getListener(addr)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tsrv.tlsInnerListener = newEndlessListener(l, srv)\n\tsrv.EndlessListener = tls.NewListener(srv.tlsInnerListener, config)\n\n\tif srv.isChild {\n\t\tsyscall.Kill(syscall.Getppid(), syscall.SIGTERM)\n\t}\n\n\tlog.Println(syscall.Getpid(), srv.Addr)\n\treturn srv.Serve()\n}\n\n/*\ngetListener either opens a new socket to listen on, or takes the acceptor socket\nit got passed when restarted.\n*/\nfunc (srv *endlessServer) getListener(laddr string) (l net.Listener, err error) {\n\tif srv.isChild {\n\t\tvar ptrOffset uint = 0\n\t\trunningServerReg.RLock()\n\t\tdefer runningServerReg.RUnlock()\n\t\tif len(socketPtrOffsetMap) > 0 {\n\t\t\tptrOffset = socketPtrOffsetMap[laddr]\n\t\t\t// log.Println(\"laddr\", laddr, \"ptr offset\", socketPtrOffsetMap[laddr])\n\t\t}\n\n\t\tf := os.NewFile(uintptr(3+ptrOffset), \"\")\n\t\tl, err = net.FileListener(f)\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"net.FileListener error: %v\", err)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tl, err = net.Listen(\"tcp\", laddr)\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"net.Listen error: %v\", err)\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}\n\n/*\nhandleSignals listens for os Signals and calls any hooked in function that the\nuser had registered with the signal.\n*/\nfunc (srv *endlessServer) handleSignals() {\n\tvar sig os.Signal\n\n\tsignal.Notify(\n\t\tsrv.sigChan,\n\t\thookableSignals...,\n\t)\n\n\tpid := syscall.Getpid()\n\tfor {\n\t\tsig = <-srv.sigChan\n\t\tsrv.signalHooks(PRE_SIGNAL, sig)\n\t\tswitch sig {\n\t\tcase syscall.SIGHUP:\n\t\t\tlog.Println(pid, \"Received SIGHUP. forking.\")\n\t\t\terr := srv.fork()\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Fork err:\", err)\n\t\t\t}\n\t\tcase syscall.SIGUSR1:\n\t\t\tlog.Println(pid, \"Received SIGUSR1.\")\n\t\tcase syscall.SIGUSR2:\n\t\t\tlog.Println(pid, \"Received SIGUSR2.\")\n\t\t\tsrv.hammerTime(0 * time.Second)\n\t\tcase syscall.SIGINT:\n\t\t\tlog.Println(pid, \"Received SIGINT.\")\n\t\t\tsrv.shutdown()\n\t\tcase syscall.SIGTERM:\n\t\t\tlog.Println(pid, \"Received SIGTERM.\")\n\t\t\tsrv.shutdown()\n\t\tcase syscall.SIGTSTP:\n\t\t\tlog.Println(pid, \"Received SIGTSTP.\")\n\t\tdefault:\n\t\t\tlog.Printf(\"Received %v: nothing i care about...\\n\", sig)\n\t\t}\n\t\tsrv.signalHooks(POST_SIGNAL, sig)\n\t}\n}\n\nfunc (srv *endlessServer) signalHooks(ppFlag int, sig os.Signal) {\n\tif _, notSet := srv.SignalHooks[ppFlag][sig]; !notSet {\n\t\treturn\n\t}\n\tfor _, f := range srv.SignalHooks[ppFlag][sig] {\n\t\tf()\n\t}\n\treturn\n}\n\n/*\nshutdown closes the listener so that no new connections are accepted. it also\nstarts a goroutine that will hammer (stop all running requests) the server\nafter DefaultHammerTime.\n*/\nfunc (srv *endlessServer) shutdown() {\n\tif srv.getState() != STATE_RUNNING {\n\t\treturn\n\t}\n\n\tsrv.setState(STATE_SHUTTING_DOWN)\n\tif DefaultHammerTime >= 0 {\n\t\tgo srv.hammerTime(DefaultHammerTime)\n\t}\n\t// disable keep-alives on existing connections\n\tsrv.SetKeepAlivesEnabled(false)\n\terr := srv.EndlessListener.Close()\n\tif err != nil {\n\t\tlog.Println(syscall.Getpid(), \"Listener.Close() error:\", err)\n\t} else {\n\t\tlog.Println(syscall.Getpid(), srv.EndlessListener.Addr(), \"Listener closed.\")\n\t}\n}\n\n/*\nhammerTime forces the server to shutdown in a given timeout - whether it\nfinished outstanding requests or not. if Read/WriteTimeout are not set or the\nmax header size is very big a connection could hang...\n\nsrv.Serve() will not return until all connections are served. this will\nunblock the srv.wg.Wait() in Serve() thus causing ListenAndServe(TLS) to\nreturn.\n*/\nfunc (srv *endlessServer) hammerTime(d time.Duration) {\n\tdefer func() {\n\t\t// we are calling srv.wg.Done() until it panics which means we called\n\t\t// Done() when the counter was already at 0 and we're done.\n\t\t// (and thus Serve() will return and the parent will exit)\n\t\tif r := recover(); r != nil {\n\t\t\tlog.Println(\"WaitGroup at 0\", r)\n\t\t}\n\t}()\n\tif srv.getState() != STATE_SHUTTING_DOWN {\n\t\treturn\n\t}\n\ttime.Sleep(d)\n\tlog.Println(\"[STOP - Hammer Time] Forcefully shutting down parent\")\n\tfor {\n\t\tif srv.getState() == STATE_TERMINATE {\n\t\t\tbreak\n\t\t}\n\t\tsrv.wg.Done()\n\t\truntime.Gosched()\n\t}\n}\n\nfunc (srv *endlessServer) fork() (err error) {\n\trunningServerReg.Lock()\n\tdefer runningServerReg.Unlock()\n\n\t// only one server instance should fork!\n\tif runningServersForked {\n\t\treturn errors.New(\"Another process already forked. Ignoring this one.\")\n\t}\n\n\trunningServersForked = true\n\n\tvar files = make([]*os.File, len(runningServers))\n\tvar orderArgs = make([]string, len(runningServers))\n\t// get the accessor socket fds for _all_ server instances\n\tfor _, srvPtr := range runningServers {\n\t\t// introspect.PrintTypeDump(srvPtr.EndlessListener)\n\t\tswitch srvPtr.EndlessListener.(type) {\n\t\tcase *endlessListener:\n\t\t\t// normal listener\n\t\t\tfiles[socketPtrOffsetMap[srvPtr.Server.Addr]] = srvPtr.EndlessListener.(*endlessListener).File()\n\t\tdefault:\n\t\t\t// tls listener\n\t\t\tfiles[socketPtrOffsetMap[srvPtr.Server.Addr]] = srvPtr.tlsInnerListener.File()\n\t\t}\n\t\torderArgs[socketPtrOffsetMap[srvPtr.Server.Addr]] = srvPtr.Server.Addr\n\t}\n\n\tenv := append(\n\t\tos.Environ(),\n\t\t\"ENDLESS_CONTINUE=1\",\n\t)\n\tif len(runningServers) > 1 {\n\t\tenv = append(env, fmt.Sprintf(`ENDLESS_SOCKET_ORDER=%s`, strings.Join(orderArgs, \",\")))\n\t}\n\n\t// log.Println(files)\n\tpath := os.Args[0]\n\tvar args []string\n\tif len(os.Args) > 1 {\n\t\targs = os.Args[1:]\n\t}\n\n\tcmd := exec.Command(path, args...)\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\tcmd.ExtraFiles = files\n\tcmd.Env = env\n\n\t// cmd.SysProcAttr = &syscall.SysProcAttr{\n\t// \tSetsid:  true,\n\t// \tSetctty: true,\n\t// \tCtty:    ,\n\t// }\n\n\terr = cmd.Start()\n\tif err != nil {\n\t\tlog.Fatalf(\"Restart: Failed to launch, error: %v\", err)\n\t}\n\n\treturn\n}\n\ntype endlessListener struct {\n\tnet.Listener\n\tstopped bool\n\tserver  *endlessServer\n}\n\nfunc (el *endlessListener) Accept() (c net.Conn, err error) {\n\ttc, err := el.Listener.(*net.TCPListener).AcceptTCP()\n\tif err != nil {\n\t\treturn\n\t}\n\n\ttc.SetKeepAlive(true)                  // see http.tcpKeepAliveListener\n\ttc.SetKeepAlivePeriod(3 * time.Minute) // see http.tcpKeepAliveListener\n\n\tc = endlessConn{\n\t\tConn:   tc,\n\t\tserver: el.server,\n\t}\n\n\tel.server.wg.Add(1)\n\treturn\n}\n\nfunc newEndlessListener(l net.Listener, srv *endlessServer) (el *endlessListener) {\n\tel = &endlessListener{\n\t\tListener: l,\n\t\tserver:   srv,\n\t}\n\n\treturn\n}\n\nfunc (el *endlessListener) Close() error {\n\tif el.stopped {\n\t\treturn syscall.EINVAL\n\t}\n\n\tel.stopped = true\n\treturn el.Listener.Close()\n}\n\nfunc (el *endlessListener) File() *os.File {\n\t// returns a dup(2) - FD_CLOEXEC flag *not* set\n\ttl := el.Listener.(*net.TCPListener)\n\tfl, _ := tl.File()\n\treturn fl\n}\n\ntype endlessConn struct {\n\tnet.Conn\n\tserver *endlessServer\n}\n\nfunc (w endlessConn) Close() error {\n\terr := w.Conn.Close()\n\tif err == nil {\n\t\tw.server.wg.Done()\n\t}\n\treturn err\n}\n\n/*\nRegisterSignalHook registers a function to be run PRE_SIGNAL or POST_SIGNAL for\na given signal. PRE or POST in this case means before or after the signal\nrelated code endless itself runs\n*/\nfunc (srv *endlessServer) RegisterSignalHook(prePost int, sig os.Signal, f func()) (err error) {\n\tif prePost != PRE_SIGNAL && prePost != POST_SIGNAL {\n\t\terr = fmt.Errorf(\"Cannot use %v for prePost arg. Must be endless.PRE_SIGNAL or endless.POST_SIGNAL.\", sig)\n\t\treturn\n\t}\n\tfor _, s := range hookableSignals {\n\t\tif s == sig {\n\t\t\tsrv.SignalHooks[prePost][sig] = append(srv.SignalHooks[prePost][sig], f)\n\t\t\treturn\n\t\t}\n\t}\n\terr = fmt.Errorf(\"Signal %v is not supported.\", sig)\n\treturn\n}\n"
  },
  {
    "path": "library/etcd/etcd.go",
    "content": "package etcd\n\nimport (\n\t\"time\"\n\n\tclientv3 \"go.etcd.io/etcd/client/v3\"\n)\n\ntype Config struct {\n\tEndpoints   string\n\tDialTimeout time.Duration\n}\n\n// Etcd\ntype Etcd struct {\n\t*clientv3.Client\n\tendpoints   []string\n\tdialTimeout time.Duration\n}\n\ntype Option func(*Etcd)\n\nfunc WithEndpoints(endpoints []string) Option {\n\treturn func(e *Etcd) { e.endpoints = endpoints }\n}\n\nfunc WithDialTimeout(duration time.Duration) Option {\n\treturn func(e *Etcd) { e.dialTimeout = duration * time.Second }\n}\n\n// NewClient\nfunc NewClient(opts ...Option) (*Etcd, error) {\n\tvar err error\n\te := &Etcd{}\n\n\tfor _, o := range opts {\n\t\to(e)\n\t}\n\n\te.Client, err = clientv3.New(clientv3.Config{\n\t\tEndpoints:   e.endpoints,\n\t\tDialTimeout: e.dialTimeout,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn e, nil\n}\n"
  },
  {
    "path": "library/jaeger/gorm/gorm.go",
    "content": "package gorm\n\nimport (\n\t\"github.com/opentracing/opentracing-go\"\n\t\"github.com/opentracing/opentracing-go/ext\"\n\topentracing_log \"github.com/opentracing/opentracing-go/log\"\n\t\"gorm.io/gorm\"\n\n\t\"github.com/why444216978/gin-api/library/jaeger\"\n\t\"github.com/why444216978/go-util/assert\"\n)\n\n// gorm hook\nconst (\n\tcomponentGorm      = \"Gorm\"\n\tgormSpanKey        = \"gorm_span\"\n\tcallBackBeforeName = \"opentracing:before\"\n\tcallBackAfterName  = \"opentracing:after\"\n)\n\n// before gorm before execute action do something\nfunc before(db *gorm.DB) {\n\tif assert.IsNil(jaeger.Tracer) {\n\t\treturn\n\t}\n\tspan, _ := opentracing.StartSpanFromContextWithTracer(db.Statement.Context, jaeger.Tracer, componentGorm)\n\tdb.InstanceSet(gormSpanKey, span)\n\treturn\n}\n\n// after gorm after execute action do something\nfunc after(db *gorm.DB) {\n\tif assert.IsNil(jaeger.Tracer) {\n\t\treturn\n\t}\n\t_span, isExist := db.InstanceGet(gormSpanKey)\n\tif !isExist {\n\t\treturn\n\t}\n\tspan, ok := _span.(opentracing.Span)\n\tif !ok {\n\t\treturn\n\t}\n\tdefer span.Finish()\n\n\tjaeger.SetCommonTag(db.Statement.Context, span)\n\n\tif db.Error != nil {\n\t\tspan.LogFields(opentracing_log.Error(db.Error))\n\t\tspan.SetTag(string(ext.Error), true)\n\t}\n\tspan.LogFields(opentracing_log.String(\"SQL\", db.Dialector.Explain(db.Statement.SQL.String(), db.Statement.Vars...)))\n\n\treturn\n}\n\ntype opentracingPlugin struct{}\n\nvar GormTrace gorm.Plugin = &opentracingPlugin{}\n\nfunc (op *opentracingPlugin) Name() string {\n\treturn \"opentracingPlugin\"\n}\n\nfunc (op *opentracingPlugin) Initialize(db *gorm.DB) (err error) {\n\t// create\n\tif err = db.Callback().Create().Before(\"gorm:before_create\").Register(callBackBeforeName, before); err != nil {\n\t\treturn err\n\t}\n\tif err = db.Callback().Create().After(\"gorm:after_create\").Register(callBackAfterName, after); err != nil {\n\t\treturn err\n\t}\n\n\t// query\n\tif err = db.Callback().Query().Before(\"gorm:query\").Register(callBackBeforeName, before); err != nil {\n\t\treturn err\n\t}\n\tif err = db.Callback().Query().After(\"gorm:after_query\").Register(callBackAfterName, after); err != nil {\n\t\treturn err\n\t}\n\n\t// delete\n\tif err = db.Callback().Delete().Before(\"gorm:before_delete\").Register(callBackBeforeName, before); err != nil {\n\t\treturn err\n\t}\n\tif err = db.Callback().Delete().After(\"gorm:after_delete\").Register(callBackAfterName, after); err != nil {\n\t\treturn err\n\t}\n\n\t// update\n\tif err = db.Callback().Update().Before(\"gorm:before_update\").Register(callBackBeforeName, before); err != nil {\n\t\treturn err\n\t}\n\tif err = db.Callback().Update().After(\"gorm:after_update\").Register(callBackAfterName, after); err != nil {\n\t\treturn err\n\t}\n\n\t// row\n\tif err = db.Callback().Row().Before(\"gorm:row\").Register(callBackBeforeName, before); err != nil {\n\t\treturn err\n\t}\n\tif err = db.Callback().Row().After(\"gorm:row\").Register(callBackAfterName, after); err != nil {\n\t\treturn err\n\t}\n\n\t// raw\n\tif err = db.Callback().Raw().Before(\"gorm:raw\").Register(callBackBeforeName, before); err != nil {\n\t\treturn err\n\t}\n\tif err = db.Callback().Raw().After(\"gorm:raw\").Register(callBackAfterName, after); err != nil {\n\t\treturn err\n\t}\n\n\t// associations\n\tif err = db.Callback().Raw().Before(\"gorm:save_before_associations\").Register(callBackBeforeName, before); err != nil {\n\t\treturn err\n\t}\n\tif err = db.Callback().Update().After(\"gorm:save_after_associations\").Register(callBackAfterName, after); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "library/jaeger/gorm/gorm_test.go",
    "content": "package gorm\n\nimport (\n\t\"errors\"\n\t\"testing\"\n\n\t\"github.com/opentracing/opentracing-go\"\n\t\"github.com/opentracing/opentracing-go/mocktracer\"\n\t\"github.com/smartystreets/goconvey/convey\"\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/why444216978/gin-api/library/jaeger\"\n\t\"github.com/why444216978/go-util/orm\"\n)\n\ntype TestTable struct {\n\tId      uint   `gorm:\"column:id\" json:\"id\"`\n\tGoodsId uint64 `gorm:\"column:goods_id\" json:\"goods_id\"`\n\tName    string `gorm:\"column:name\" json:\"name\"`\n}\n\nfunc (TestTable) TableName() string {\n\treturn \"test\"\n}\n\nfunc Test_before(t *testing.T) {\n\tconvey.Convey(\"Test_before\", t, func() {\n\t\tconvey.Convey(\"Tracer nil\", func() {\n\t\t\tdb := orm.NewMemoryDB()\n\t\t\tif err := db.Migrator().CreateTable(&TestTable{}); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\ttracer := mocktracer.New()\n\t\t\tjaeger.Tracer = nil\n\n\t\t\tbefore(db)\n\n\t\t\tassert.Len(t, tracer.FinishedSpans(), 0)\n\t\t})\n\t\tconvey.Convey(\"success\", func() {\n\t\t\tdb := orm.NewMemoryDB()\n\t\t\tif err := db.Migrator().CreateTable(&TestTable{}); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\ttracer := mocktracer.New()\n\t\t\tjaeger.Tracer = tracer\n\n\t\t\tbefore(db)\n\n\t\t\tassert.Len(t, tracer.FinishedSpans(), 0)\n\t\t})\n\t})\n}\n\nfunc Test_after(t *testing.T) {\n\tconvey.Convey(\"Test_after\", t, func() {\n\t\tconvey.Convey(\"Tracer nil\", func() {\n\t\t\tdb := orm.NewMemoryDB()\n\t\t\tif err := db.Migrator().CreateTable(&TestTable{}); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\ttracer := mocktracer.New()\n\t\t\tjaeger.Tracer = nil\n\n\t\t\tafter(db)\n\n\t\t\tassert.Len(t, tracer.FinishedSpans(), 0)\n\t\t})\n\t\tconvey.Convey(\"!isExist\", func() {\n\t\t\tdb := orm.NewMemoryDB()\n\t\t\tif err := db.Migrator().CreateTable(&TestTable{}); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\ttracer := mocktracer.New()\n\t\t\tjaeger.Tracer = tracer\n\n\t\t\tafter(db)\n\n\t\t\tassert.Len(t, tracer.FinishedSpans(), 0)\n\t\t})\n\t\tconvey.Convey(\"span not opentracing.Span\", func() {\n\t\t\tdb := orm.NewMemoryDB()\n\t\t\tif err := db.Migrator().CreateTable(&TestTable{}); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\ttracer := mocktracer.New()\n\t\t\tjaeger.Tracer = tracer\n\n\t\t\tdb = db.InstanceSet(gormSpanKey, 1)\n\n\t\t\tafter(db)\n\n\t\t\tassert.Len(t, tracer.FinishedSpans(), 0)\n\t\t})\n\t\tconvey.Convey(\"success and db err\", func() {\n\t\t\tdb := orm.NewMemoryDB()\n\t\t\tif err := db.Migrator().CreateTable(&TestTable{}); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\ttracer := mocktracer.New()\n\t\t\tjaeger.Tracer = tracer\n\n\t\t\tspan, _ := opentracing.StartSpanFromContextWithTracer(db.Statement.Context, jaeger.Tracer, componentGorm)\n\t\t\tdb = db.InstanceSet(gormSpanKey, span)\n\n\t\t\tafter(db)\n\n\t\t\tassert.Len(t, tracer.FinishedSpans(), 1)\n\t\t})\n\t\tconvey.Convey(\"success\", func() {\n\t\t\tdb := orm.NewMemoryDB()\n\t\t\tif err := db.Migrator().CreateTable(&TestTable{}); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\ttracer := mocktracer.New()\n\t\t\tjaeger.Tracer = tracer\n\n\t\t\tspan, _ := opentracing.StartSpanFromContextWithTracer(db.Statement.Context, jaeger.Tracer, componentGorm)\n\t\t\tdb = db.InstanceSet(gormSpanKey, span)\n\t\t\tdb.Error = errors.New(\"\")\n\n\t\t\tafter(db)\n\n\t\t\tassert.Len(t, tracer.FinishedSpans(), 1)\n\t\t})\n\t})\n}\n\nfunc TestOpentracingPlugin_Name(t *testing.T) {\n\tconvey.Convey(\"TestOpentracingPlugin_Name\", t, func() {\n\t\tconvey.Convey(\"success\", func() {\n\t\t\top := &opentracingPlugin{}\n\t\t\tassert.Equal(t, op.Name(), \"opentracingPlugin\")\n\t\t})\n\t})\n}\n\nfunc TestOpentracingPlugin_Initialize(t *testing.T) {\n\tconvey.Convey(\"TestOpentracingPlugin_Name\", t, func() {\n\t\tconvey.Convey(\"success\", func() {\n\t\t\tdb := orm.NewMemoryDB()\n\t\t\top := &opentracingPlugin{}\n\t\t\tassert.Equal(t, op.Initialize(db), nil)\n\t\t})\n\t})\n}\n"
  },
  {
    "path": "library/jaeger/http/http.go",
    "content": "package http\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"net/http\"\n\n\t\"github.com/opentracing/opentracing-go\"\n\t\"github.com/opentracing/opentracing-go/ext\"\n\t\"github.com/why444216978/go-util/assert\"\n\n\t\"github.com/why444216978/gin-api/library/jaeger\"\n)\n\nconst (\n\thttpClientComponentPrefix = \"HTTP-Client-\"\n\thttpServerComponentPrefix = \"HTTP-Server-\"\n)\n\nvar ErrTracerNil = errors.New(\"Tracer is nil\")\n\n// ExtractHTTP is used to extract span context by HTTP middleware\nfunc ExtractHTTP(ctx context.Context, req *http.Request, logID string) (context.Context, opentracing.Span, string) {\n\tif assert.IsNil(jaeger.Tracer) {\n\t\treturn ctx, nil, \"\"\n\t}\n\n\tvar span opentracing.Span\n\n\tparentSpanContext, err := jaeger.Tracer.Extract(opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(req.Header))\n\tif assert.IsNil(parentSpanContext) || err == opentracing.ErrSpanContextNotFound {\n\t\tspan, ctx = opentracing.StartSpanFromContextWithTracer(ctx, jaeger.Tracer, httpServerComponentPrefix+req.URL.Path, ext.SpanKindRPCServer)\n\t} else {\n\t\tspan = jaeger.Tracer.StartSpan(\n\t\t\thttpServerComponentPrefix+req.URL.Path,\n\t\t\text.RPCServerOption(parentSpanContext),\n\t\t\text.SpanKindRPCServer,\n\t\t)\n\t}\n\tspan.SetTag(string(ext.Component), httpServerComponentPrefix+req.URL.Path)\n\tspan.SetTag(jaeger.FieldLogID, logID)\n\tjaeger.SetCommonTag(ctx, span)\n\n\tctx = opentracing.ContextWithSpan(ctx, span)\n\n\treturn ctx, span, jaeger.GetTraceID(span)\n}\n\n// InjectHTTP is used to inject HTTP span\nfunc InjectHTTP(ctx context.Context, req *http.Request, logID string) error {\n\tif assert.IsNil(jaeger.Tracer) {\n\t\treturn ErrTracerNil\n\t}\n\n\tspan, ctx := opentracing.StartSpanFromContextWithTracer(ctx, jaeger.Tracer, httpClientComponentPrefix+req.URL.Path, ext.SpanKindRPCClient)\n\tdefer span.Finish()\n\tspan.SetTag(string(ext.Component), httpClientComponentPrefix+req.URL.Path)\n\tspan.SetTag(jaeger.FieldLogID, logID)\n\tjaeger.SetCommonTag(ctx, span)\n\n\treturn jaeger.Tracer.Inject(span.Context(), opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(req.Header))\n}\n\nfunc SetHTTPLog(span opentracing.Span, req, resp string) {\n\tif assert.IsNil(span) {\n\t\treturn\n\t}\n\tjaeger.SetRequest(span, req)\n\tjaeger.SetResponse(span, resp)\n}\n"
  },
  {
    "path": "library/jaeger/http/http_test.go",
    "content": "package http\n\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"testing\"\n\n\t\"github.com/opentracing/opentracing-go\"\n\t\"github.com/opentracing/opentracing-go/mocktracer\"\n\t\"github.com/smartystreets/goconvey/convey\"\n\t\"github.com/stretchr/testify/assert\"\n\n\t\"github.com/why444216978/gin-api/library/jaeger\"\n)\n\nfunc TestExtractHTTP(t *testing.T) {\n\tctx := context.Background()\n\treq := &http.Request{\n\t\tHeader: http.Header{},\n\t\tURL:    &url.URL{},\n\t}\n\tlogID := \"logID\"\n\n\tconvey.Convey(\"TestExtractHTTP\", t, func() {\n\t\tconvey.Convey(\"Tracer nil\", func() {\n\t\t\tjaeger.Tracer = nil\n\n\t\t\t_, span, spanID := ExtractHTTP(ctx, req, logID)\n\t\t\tassert.Equal(t, span, nil)\n\t\t\tassert.Equal(t, spanID, \"\")\n\t\t})\n\t\tconvey.Convey(\"success no parentSpanContext\", func() {\n\t\t\ttracer := mocktracer.New()\n\t\t\tjaeger.Tracer = tracer\n\n\t\t\tctx, span, _ := ExtractHTTP(ctx, req, logID)\n\t\t\tspan.Finish()\n\n\t\t\t_, ok := span.Context().(mocktracer.MockSpanContext)\n\n\t\t\tassert.Equal(t, ok, true)\n\t\t\tassert.Equal(t, span, opentracing.SpanFromContext(ctx))\n\t\t\tassert.Len(t, tracer.FinishedSpans(), 1)\n\t\t})\n\t\tconvey.Convey(\"success has parentSpanContext\", func() {\n\t\t\ttracer := mocktracer.New()\n\t\t\tjaeger.Tracer = tracer\n\n\t\t\tspan := tracer.StartSpan(httpServerComponentPrefix + req.URL.Path)\n\t\t\tspan.Finish()\n\t\t\t_ = tracer.Inject(span.Context(), opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(req.Header))\n\n\t\t\tctx, span, _ = ExtractHTTP(ctx, req, logID)\n\t\t\tspan.Finish()\n\n\t\t\t_, ok := span.Context().(mocktracer.MockSpanContext)\n\n\t\t\tassert.Equal(t, ok, true)\n\t\t\tassert.Equal(t, span, opentracing.SpanFromContext(ctx))\n\t\t\tassert.Len(t, tracer.FinishedSpans(), 2)\n\t\t})\n\t})\n}\n\nfunc TestInjectHTTP(t *testing.T) {\n\tctx := context.Background()\n\treq := &http.Request{\n\t\tHeader: http.Header{},\n\t\tURL:    &url.URL{},\n\t}\n\tlogID := \"logID\"\n\n\tconvey.Convey(\"TestInjectHTTP\", t, func() {\n\t\tconvey.Convey(\"Tracer nil\", func() {\n\t\t\tjaeger.Tracer = nil\n\n\t\t\terr := InjectHTTP(ctx, req, logID)\n\t\t\tassert.Equal(t, err, ErrTracerNil)\n\t\t})\n\t\tconvey.Convey(\"success\", func() {\n\t\t\ttracer := mocktracer.New()\n\t\t\tjaeger.Tracer = tracer\n\n\t\t\tspan := tracer.StartSpan(httpServerComponentPrefix + req.URL.Path)\n\t\t\tspan.Finish()\n\t\t\t_ = tracer.Inject(span.Context(), opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(req.Header))\n\n\t\t\terr := InjectHTTP(ctx, req, logID)\n\t\t\tassert.Equal(t, err, nil)\n\t\t\tassert.Len(t, tracer.FinishedSpans(), 2)\n\t\t})\n\t})\n}\n\nfunc TestSetHTTPLog(t *testing.T) {\n\tconvey.Convey(\"TestSetHTTPLog\", t, func() {\n\t\tconvey.Convey(\"success\", func() {\n\t\t\ttracer := mocktracer.New()\n\t\t\tspan := tracer.StartSpan(httpServerComponentPrefix + \"uri\")\n\t\t\tspan.Finish()\n\t\t\tSetHTTPLog(span, \"req\", \"resp\")\n\t\t})\n\t})\n}\n"
  },
  {
    "path": "library/jaeger/jaeger.go",
    "content": "package jaeger\n\nimport (\n\t\"context\"\n\t\"io\"\n\n\t\"github.com/opentracing/opentracing-go\"\n\topentracingLog \"github.com/opentracing/opentracing-go/log\"\n\t\"github.com/uber/jaeger-client-go\"\n\t\"github.com/uber/jaeger-client-go/config\"\n)\n\nconst (\n\tFieldLogID   = \"Log-Id\"\n\tFieldTraceID = \"Trace-Id\"\n\tFieldSpanID  = \"Span-Id\"\n)\n\nconst (\n\tLogFieldsRequest  = \"request\"\n\tLogFieldsResponse = \"response\"\n\tLogFieldsArgs     = \"args\"\n)\n\nvar Tracer opentracing.Tracer\n\ntype Config struct {\n\tHost string\n\tPort string\n}\n\nfunc NewJaegerTracer(connCfg *Config, serviceName string) (opentracing.Tracer, io.Closer, error) {\n\tcfg := &config.Configuration{\n\t\tSampler: &config.SamplerConfig{\n\t\t\tType:  \"const\", // 固定采样\n\t\t\tParam: 1,       // 1=全采样、0=不采样\n\t\t},\n\n\t\tReporter: &config.ReporterConfig{\n\t\t\tLogSpans:           true,\n\t\t\tLocalAgentHostPort: connCfg.Host + \":\" + connCfg.Port,\n\t\t},\n\n\t\tServiceName: serviceName,\n\t}\n\n\ttracer, closer, err := cfg.NewTracer()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\topentracing.SetGlobalTracer(tracer)\n\tTracer = tracer\n\treturn tracer, closer, nil\n}\n\nfunc SetError(span opentracing.Span, err error) {\n\tspan.LogFields(opentracingLog.Error(err))\n}\n\nfunc SetRequest(span opentracing.Span, request string) {\n\tspan.LogFields(opentracingLog.String(LogFieldsRequest, request))\n}\n\nfunc SetResponse(span opentracing.Span, resp string) {\n\tspan.LogFields(opentracingLog.String(LogFieldsResponse, resp))\n}\n\nfunc SetCommonTag(ctx context.Context, span opentracing.Span) {\n\tjaegerSpanContext := spanContextToJaegerContext(span.Context())\n\tspan.SetTag(FieldTraceID, jaegerSpanContext.TraceID().String())\n\tspan.SetTag(FieldSpanID, jaegerSpanContext.SpanID().String())\n}\n\nfunc GetTraceID(span opentracing.Span) string {\n\tjaegerSpanContext := spanContextToJaegerContext(span.Context())\n\treturn jaegerSpanContext.TraceID().String()\n}\n\nfunc GetSpanID(span opentracing.Span) string {\n\tjaegerSpanContext := spanContextToJaegerContext(span.Context())\n\treturn jaegerSpanContext.SpanID().String()\n}\n\nfunc spanContextToJaegerContext(spanContext opentracing.SpanContext) jaeger.SpanContext {\n\tif sc, ok := spanContext.(jaeger.SpanContext); ok {\n\t\treturn sc\n\t} else {\n\t\treturn jaeger.SpanContext{}\n\t}\n}\n"
  },
  {
    "path": "library/jaeger/redis/redis.go",
    "content": "package redis\n\nimport (\n\t\"context\"\n\t\"strconv\"\n\n\t\"github.com/why444216978/gin-api/library/jaeger\"\n\t\"github.com/why444216978/go-util/assert\"\n\n\t\"github.com/go-redis/redis/v8\"\n\t\"github.com/opentracing/opentracing-go\"\n\t\"github.com/opentracing/opentracing-go/ext\"\n\ttracerLog \"github.com/opentracing/opentracing-go/log\"\n)\n\nconst (\n\toperationRedis = \"Redis-\"\n\tlogCmdName     = \"command\"\n\tlogCmdArgs     = \"args\"\n\tlogCmdResult   = \"result\"\n)\n\ntype contextKey int\n\nconst (\n\tcmdStart contextKey = iota\n)\n\n// jaegerHook is go-redis jaeger hook\ntype jaegerHook struct{}\n\n// NewJaegerHook return jaegerHook\nfunc NewJaegerHook() redis.Hook {\n\treturn &jaegerHook{}\n}\n\n// BeforeProcess redis before execute action do something\nfunc (jh *jaegerHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error) {\n\tif assert.IsNil(jaeger.Tracer) {\n\t\treturn ctx, nil\n\t}\n\tspan, ctx := opentracing.StartSpanFromContextWithTracer(ctx, jaeger.Tracer, operationRedis+cmd.Name())\n\n\tjaeger.SetCommonTag(ctx, span)\n\n\tctx = opentracing.ContextWithSpan(ctx, span)\n\treturn ctx, nil\n}\n\n// AfterProcess redis after execute action do something\nfunc (jh *jaegerHook) AfterProcess(ctx context.Context, cmd redis.Cmder) error {\n\tif assert.IsNil(jaeger.Tracer) {\n\t\treturn nil\n\t}\n\tspan := opentracing.SpanFromContext(ctx)\n\tif assert.IsNil(span) {\n\t\treturn nil\n\t}\n\tdefer span.Finish()\n\n\tspan.LogFields(tracerLog.String(logCmdName, cmd.Name()))\n\tspan.LogFields(tracerLog.Object(logCmdArgs, cmd.Args()))\n\tspan.LogFields(tracerLog.Object(logCmdResult, cmd.String()))\n\n\tif err := cmd.Err(); isRedisError(err) {\n\t\tspan.LogFields(tracerLog.Error(err))\n\t\tspan.SetTag(string(ext.Error), true)\n\t}\n\n\treturn nil\n}\n\n// BeforeProcessPipeline before command process handle\nfunc (jh *jaegerHook) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error) {\n\tif assert.IsNil(jaeger.Tracer) {\n\t\treturn ctx, nil\n\t}\n\n\tspan, ctx := opentracing.StartSpanFromContextWithTracer(ctx, jaeger.Tracer, operationRedis+\"pipeline\")\n\n\tctx = context.WithValue(ctx, cmdStart, span)\n\n\treturn ctx, nil\n}\n\n// AfterProcessPipeline after command process handle\nfunc (jh *jaegerHook) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error {\n\tif assert.IsNil(jaeger.Tracer) {\n\t\treturn nil\n\t}\n\n\tspan, ok := ctx.Value(cmdStart).(opentracing.Span)\n\tif !ok {\n\t\treturn nil\n\t}\n\tdefer span.Finish()\n\n\thasErr := false\n\tfor idx, cmd := range cmds {\n\t\tif err := cmd.Err(); isRedisError(err) {\n\t\t\thasErr = true\n\t\t}\n\t\tspan.LogFields(tracerLog.String(jh.getPipeLineLogKey(logCmdName, idx), cmd.Name()))\n\t\tspan.LogFields(tracerLog.Object(jh.getPipeLineLogKey(logCmdArgs, idx), cmd.Args()))\n\t\tspan.LogFields(tracerLog.String(jh.getPipeLineLogKey(logCmdResult, idx), cmd.String()))\n\t}\n\tif hasErr {\n\t\tspan.SetTag(string(ext.Error), true)\n\t}\n\n\treturn nil\n}\n\nfunc (jh *jaegerHook) getPipeLineLogKey(logField string, idx int) string {\n\treturn logField + \"-\" + strconv.Itoa(idx)\n}\n\nfunc isRedisError(err error) bool {\n\tif err == redis.Nil {\n\t\treturn false\n\t}\n\t_, ok := err.(redis.Error)\n\treturn ok\n}\n"
  },
  {
    "path": "library/jaeger/redis/redis_test.go",
    "content": "package redis\n\nimport (\n\t\"context\"\n\t\"testing\"\n\n\t\"github.com/agiledragon/gomonkey/v2\"\n\t\"github.com/go-redis/redis/v8\"\n\t\"github.com/opentracing/opentracing-go/mocktracer\"\n\t\"github.com/smartystreets/goconvey/convey\"\n\t\"github.com/stretchr/testify/assert\"\n\n\t\"github.com/why444216978/gin-api/library/jaeger\"\n)\n\nfunc TestNewJaegerHook(t *testing.T) {\n\tconvey.Convey(\"TestNewJaegerHook\", t, func() {\n\t\tconvey.Convey(\"success\", func() {\n\t\t\t_ = NewJaegerHook()\n\t\t})\n\t})\n}\n\nfunc Test_jaegerHook_BeforeProcess(t *testing.T) {\n\tconvey.Convey(\"Test_jaegerHook_BeforeProcess\", t, func() {\n\t\tconvey.Convey(\"Tracer nil\", func() {\n\t\t\tctx := context.Background()\n\t\t\tjaeger.Tracer = nil\n\t\t\tjh := NewJaegerHook()\n\t\t\tcmd := redis.NewStringCmd(ctx, \"get\")\n\t\t\tctx, err := jh.BeforeProcess(ctx, cmd)\n\t\t\tassert.Equal(t, err, nil)\n\t\t})\n\t\tconvey.Convey(\"success\", func() {\n\t\t\tctx := context.Background()\n\t\t\ttracer := mocktracer.New()\n\t\t\tjaeger.Tracer = tracer\n\t\t\tjh := NewJaegerHook()\n\t\t\tcmd := redis.NewStringCmd(ctx, \"get\")\n\t\t\tctx, err := jh.BeforeProcess(ctx, cmd)\n\t\t\tassert.Equal(t, err, nil)\n\t\t\tassert.Len(t, tracer.FinishedSpans(), 0)\n\t\t})\n\t})\n}\n\nfunc Test_jaegerHook_AfterProcess(t *testing.T) {\n\tconvey.Convey(\"Test_jaegerHook_AfterProcess\", t, func() {\n\t\tconvey.Convey(\"Tracer nil\", func() {\n\t\t\tctx := context.Background()\n\t\t\tjaeger.Tracer = nil\n\t\t\tjh := NewJaegerHook()\n\t\t\tcmd := redis.NewStringCmd(ctx, \"get\")\n\t\t\terr := jh.AfterProcess(ctx, cmd)\n\t\t\tassert.Equal(t, err, nil)\n\t\t})\n\t\tconvey.Convey(\"extract span from ctx nil\", func() {\n\t\t\tctx := context.Background()\n\t\t\ttracer := mocktracer.New()\n\t\t\tjaeger.Tracer = tracer\n\t\t\tjh := NewJaegerHook()\n\t\t\tcmd := redis.NewStringCmd(ctx, \"get\")\n\t\t\terr := jh.AfterProcess(ctx, cmd)\n\t\t\tassert.Equal(t, err, nil)\n\t\t\tassert.Len(t, tracer.FinishedSpans(), 0)\n\t\t})\n\t\tconvey.Convey(\"success\", func() {\n\t\t\tctx := context.Background()\n\t\t\ttracer := mocktracer.New()\n\t\t\tjaeger.Tracer = tracer\n\t\t\tjh := NewJaegerHook()\n\t\t\tcmd := redis.NewStringCmd(ctx, \"get\")\n\t\t\tctx, err := jh.BeforeProcess(ctx, cmd)\n\t\t\terr = jh.AfterProcess(ctx, cmd)\n\t\t\tassert.Equal(t, err, nil)\n\t\t\tassert.Len(t, tracer.FinishedSpans(), 1)\n\t\t})\n\t\tconvey.Convey(\"success and cmd err\", func() {\n\t\t\tpatche := gomonkey.ApplyFuncSeq(isRedisError, []gomonkey.OutputCell{\n\t\t\t\t{Values: gomonkey.Params{true}},\n\t\t\t})\n\t\t\tdefer patche.Reset()\n\n\t\t\tctx := context.Background()\n\t\t\ttracer := mocktracer.New()\n\t\t\tjaeger.Tracer = tracer\n\t\t\tjh := NewJaegerHook()\n\t\t\tcmd := redis.NewBoolResult(false, redis.ErrClosed)\n\t\t\tctx, err := jh.BeforeProcess(ctx, cmd)\n\t\t\terr = jh.AfterProcess(ctx, cmd)\n\t\t\tassert.Equal(t, err, nil)\n\t\t\tassert.Len(t, tracer.FinishedSpans(), 1)\n\t\t})\n\t})\n}\n\nfunc Test_jaegerHook_BeforeProcessPipeline(t *testing.T) {\n\tconvey.Convey(\"Test_jaegerHook_BeforeProcessPipeline\", t, func() {\n\t\tconvey.Convey(\"Tracer nil\", func() {\n\t\t\tctx := context.Background()\n\t\t\tjaeger.Tracer = nil\n\t\t\tjh := NewJaegerHook()\n\t\t\tcmd := redis.NewStringCmd(ctx, \"get\")\n\t\t\tctx, err := jh.BeforeProcessPipeline(ctx, []redis.Cmder{cmd})\n\t\t\tassert.Equal(t, err, nil)\n\t\t})\n\t\tconvey.Convey(\"success\", func() {\n\t\t\tctx := context.Background()\n\t\t\ttracer := mocktracer.New()\n\t\t\tjaeger.Tracer = tracer\n\t\t\tjh := NewJaegerHook()\n\t\t\tcmd := redis.NewStringCmd(ctx, \"get\")\n\t\t\tctx, err := jh.BeforeProcessPipeline(ctx, []redis.Cmder{cmd})\n\t\t\tassert.Equal(t, err, nil)\n\t\t\tassert.Len(t, tracer.FinishedSpans(), 0)\n\t\t})\n\t})\n}\n\nfunc Test_jaegerHook_AfterProcessPipeline(t *testing.T) {\n\tconvey.Convey(\"Test_jaegerHook_AfterProcessPipeline\", t, func() {\n\t\tconvey.Convey(\"Tracer nil\", func() {\n\t\t\tctx := context.Background()\n\t\t\tjaeger.Tracer = nil\n\t\t\tjh := NewJaegerHook()\n\t\t\tcmd := redis.NewStringCmd(ctx, \"get\")\n\t\t\terr := jh.AfterProcessPipeline(ctx, []redis.Cmder{cmd})\n\t\t\tassert.Equal(t, err, nil)\n\t\t})\n\t\tconvey.Convey(\"extract span from ctx nil\", func() {\n\t\t\tctx := context.Background()\n\t\t\ttracer := mocktracer.New()\n\t\t\tjaeger.Tracer = tracer\n\t\t\tjh := NewJaegerHook()\n\t\t\tcmd := redis.NewStringCmd(ctx, \"get\")\n\t\t\terr := jh.AfterProcessPipeline(ctx, []redis.Cmder{cmd})\n\t\t\tassert.Equal(t, err, nil)\n\t\t\tassert.Len(t, tracer.FinishedSpans(), 0)\n\t\t})\n\t\tconvey.Convey(\"success\", func() {\n\t\t\tctx := context.Background()\n\t\t\ttracer := mocktracer.New()\n\t\t\tjaeger.Tracer = tracer\n\t\t\tjh := NewJaegerHook()\n\t\t\tcmd := redis.NewStringCmd(ctx, \"get\")\n\t\t\tctx, err := jh.BeforeProcessPipeline(ctx, []redis.Cmder{cmd})\n\t\t\terr = jh.AfterProcessPipeline(ctx, []redis.Cmder{cmd})\n\t\t\tassert.Equal(t, err, nil)\n\t\t\tassert.Len(t, tracer.FinishedSpans(), 1)\n\t\t})\n\t\tconvey.Convey(\"success and cmd err\", func() {\n\t\t\tpatche := gomonkey.ApplyFuncSeq(isRedisError, []gomonkey.OutputCell{\n\t\t\t\t{Values: gomonkey.Params{true}},\n\t\t\t})\n\t\t\tdefer patche.Reset()\n\n\t\t\tctx := context.Background()\n\t\t\ttracer := mocktracer.New()\n\t\t\tjaeger.Tracer = tracer\n\t\t\tjh := NewJaegerHook()\n\t\t\tcmd := redis.NewBoolResult(false, redis.ErrClosed)\n\t\t\tctx, err := jh.BeforeProcessPipeline(ctx, []redis.Cmder{cmd})\n\t\t\terr = jh.AfterProcessPipeline(ctx, []redis.Cmder{cmd})\n\t\t\tassert.Equal(t, err, nil)\n\t\t\tassert.Len(t, tracer.FinishedSpans(), 1)\n\t\t})\n\t})\n}\n\nfunc Test_jaegerHook_getPipeLineLogKey(t *testing.T) {\n\tconvey.Convey(\"Test_jaegerHook_getPipeLineLogKey\", t, func() {\n\t\tconvey.Convey(\"success\", func() {\n\t\t\tassert.Equal(t, (&jaegerHook{}).getPipeLineLogKey(\"a\", 1), \"a-1\")\n\t\t})\n\t})\n}\n\nfunc Test_isRedisError(t *testing.T) {\n\tconvey.Convey(\"Test_isRedisError\", t, func() {\n\t\tconvey.Convey(\"redis.Nil\", func() {\n\t\t\tassert.Equal(t, isRedisError(redis.Nil), false)\n\t\t})\n\t\tconvey.Convey(\"not redis.Nil\", func() {\n\t\t\tassert.Equal(t, isRedisError(nil), false)\n\t\t})\n\t})\n}\n"
  },
  {
    "path": "library/job/job.go",
    "content": "package job\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/pkg/errors\"\n\t\"github.com/why444216978/go-util/assert\"\n\t\"github.com/why444216978/go-util/snowflake\"\n\n\t\"github.com/why444216978/gin-api/library/logger\"\n)\n\ntype HandleFunc func(ctx context.Context) error\n\nvar Handlers = map[string]HandleFunc{}\n\nfunc Handle(job string, l logger.Logger) {\n\tctx := logger.WithLogID(context.Background(), snowflake.Generate().String())\n\n\tlog.Println(\"start job by \" + job)\n\n\thandle, ok := Handlers[job]\n\tif !ok {\n\t\tlog.Println(\"job \" + job + \" not found\")\n\t\treturn\n\t}\n\n\terr := handle(ctx)\n\tif err != nil {\n\t\tif !assert.IsNil(l) {\n\t\t\tl.Error(ctx, errors.Wrap(err, \"handle job \"+job).Error())\n\t\t}\n\t\tos.Exit(1)\n\t}\n}\n"
  },
  {
    "path": "library/lock/lock.go",
    "content": "package lock\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"time\"\n)\n\nvar (\n\t// ErrClientNil 客户端nil\n\tErrClientNil = errors.New(\"client is nil\")\n\t// ErrLock 加锁/获取锁失败\n\tErrLock = errors.New(\"lock fail\")\n\t// ErrUnLock 解锁失败\n\tErrUnLock = errors.New(\"unlock fail\")\n)\n\ntype Locker interface {\n\tLock(ctx context.Context, key string, random interface{}, duration time.Duration) (err error)\n\tUnlock(ctx context.Context, key string, random interface{}) (err error)\n}\n"
  },
  {
    "path": "library/lock/mock/lock.go",
    "content": "// Code generated by MockGen. DO NOT EDIT.\n// Source: library/lock/lock.go\n\n// Package redis is a generated GoMock package.\npackage redis\n\nimport (\n\tcontext \"context\"\n\treflect \"reflect\"\n\ttime \"time\"\n\n\tgomock \"github.com/golang/mock/gomock\"\n)\n\n// MockLocker is a mock of Locker interface.\ntype MockLocker struct {\n\tctrl     *gomock.Controller\n\trecorder *MockLockerMockRecorder\n}\n\n// MockLockerMockRecorder is the mock recorder for MockLocker.\ntype MockLockerMockRecorder struct {\n\tmock *MockLocker\n}\n\n// NewMockLocker creates a new mock instance.\nfunc NewMockLocker(ctrl *gomock.Controller) *MockLocker {\n\tmock := &MockLocker{ctrl: ctrl}\n\tmock.recorder = &MockLockerMockRecorder{mock}\n\treturn mock\n}\n\n// EXPECT returns an object that allows the caller to indicate expected use.\nfunc (m *MockLocker) EXPECT() *MockLockerMockRecorder {\n\treturn m.recorder\n}\n\n// Lock mocks base method.\nfunc (m *MockLocker) Lock(ctx context.Context, key string, random interface{}, duration time.Duration) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Lock\", ctx, key, random, duration)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}\n\n// Lock indicates an expected call of Lock.\nfunc (mr *MockLockerMockRecorder) Lock(ctx, key, random, duration interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Lock\", reflect.TypeOf((*MockLocker)(nil).Lock), ctx, key, random, duration)\n}\n\n// Unlock mocks base method.\nfunc (m *MockLocker) Unlock(ctx context.Context, key string, random interface{}) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Unlock\", ctx, key, random)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}\n\n// Unlock indicates an expected call of Unlock.\nfunc (mr *MockLockerMockRecorder) Unlock(ctx, key, random interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Unlock\", reflect.TypeOf((*MockLocker)(nil).Unlock), ctx, key, random)\n}\n"
  },
  {
    "path": "library/lock/redis/redis_lock.go",
    "content": "package redis\n\nimport (\n\t\"context\"\n\t\"time\"\n\n\t\"github.com/why444216978/gin-api/library/lock\"\n\n\t\"github.com/go-redis/redis/v8\"\n)\n\nconst (\n\tlockSuccess = 1\n\tlockFail    = 0\n\tlockLua     = `if redis.call(\"GET\", KEYS[1]) == ARGV[1] then redis.call(\"DEL\", KEYS[1]) return 1 else return 0 end`\n)\n\nvar _ lock.Locker = (*RedisLock)(nil)\n\ntype RedisLock struct {\n\tc *redis.Client\n}\n\nfunc New(c *redis.Client) (*RedisLock, error) {\n\tif c == nil {\n\t\treturn nil, lock.ErrClientNil\n\t}\n\treturn &RedisLock{\n\t\tc: c,\n\t}, nil\n}\n\n// Lock lock\nfunc (rl *RedisLock) Lock(ctx context.Context, key string, random interface{}, duration time.Duration) (err error) {\n\tisSuccess, err := rl.c.SetNX(ctx, key, random, duration).Result()\n\tif err != nil {\n\t\treturn\n\t}\n\tif !isSuccess {\n\t\treturn lock.ErrLock\n\t}\n\n\treturn\n}\n\n// UnLock unlock\nfunc (rl *RedisLock) Unlock(ctx context.Context, key string, random interface{}) (err error) {\n\tres, err := rl.c.Eval(ctx, lockLua, []string{key}, random).Result()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif res == lockFail {\n\t\terr = lock.ErrUnLock\n\t\treturn\n\t}\n\n\treturn\n}\n"
  },
  {
    "path": "library/lock/redis/redis_lock_test.go",
    "content": "package redis\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"testing\"\n\t\"time\"\n\n\tredismock \"github.com/go-redis/redismock/v8\"\n\t\"github.com/why444216978/gin-api/library/lock\"\n\n\t. \"github.com/smartystreets/goconvey/convey\"\n)\n\nvar (\n\tctx      = context.Background()\n\tkey      = \"lock\"\n\tval      = \"1\"\n\tduration = time.Second\n)\n\nfunc TestNew(t *testing.T) {\n\tr, _ := redismock.NewClientMock()\n\n\tConvey(\"TestNew\", t, func() {\n\t\tConvey(\"success\", func() {\n\t\t\tvar err error\n\n\t\t\t_rc, _err := New(r)\n\t\t\tSo(_rc.c, ShouldEqual, r)\n\t\t\tSo(_err, ShouldEqual, err)\n\t\t})\n\t\tConvey(\"fail\", func() {\n\t\t\t_rc, _err := New(nil)\n\t\t\tSo(_rc, ShouldEqual, nil)\n\t\t\tSo(_err, ShouldEqual, lock.ErrClientNil)\n\t\t})\n\t})\n}\n\nfunc TestRedisLock_Lock(t *testing.T) {\n\tConvey(\"TestRedisLock_Lock\", t, func() {\n\t\tConvey(\"success\", func() {\n\t\t\tr, rc := redismock.NewClientMock()\n\t\t\trl, _ := New(r)\n\n\t\t\texpect := rc.ExpectSetNX(key, val, duration)\n\t\t\texpect.SetVal(true)\n\t\t\texpect.SetErr(nil)\n\n\t\t\trl.Lock(ctx, key, val, duration)\n\t\t})\n\t\tConvey(\"fail error\", func() {\n\t\t\tr, rc := redismock.NewClientMock()\n\t\t\trl, _ := New(r)\n\n\t\t\texpect := rc.ExpectSetNX(key, val, duration)\n\t\t\texpect.SetVal(false)\n\t\t\texpect.SetErr(errors.New(\"err\"))\n\n\t\t\trl.Lock(ctx, key, val, duration)\n\t\t})\n\t})\n}\n\nfunc TestRedisLock_Unlock(t *testing.T) {\n\tConvey(\"TestRedisLock_Unlock\", t, func() {\n\t\tConvey(\"success\", func() {\n\t\t\tr, rc := redismock.NewClientMock()\n\t\t\trl, _ := New(r)\n\n\t\t\texpect := rc.ExpectEval(lockLua, []string{key}, val)\n\t\t\texpect.SetVal(true)\n\t\t\texpect.SetErr(nil)\n\n\t\t\trl.Unlock(ctx, key, val)\n\t\t})\n\t\tConvey(\"fail error\", func() {\n\t\t\tr, rc := redismock.NewClientMock()\n\t\t\trl, _ := New(r)\n\n\t\t\texpect := rc.ExpectEval(lockLua, []string{key}, val)\n\t\t\texpect.SetErr(errors.New(\"err\"))\n\n\t\t\trl.Unlock(ctx, key, val)\n\t\t})\n\t\tConvey(\"fail result lockFail\", func() {\n\t\t\tr, rc := redismock.NewClientMock()\n\t\t\trl, _ := New(r)\n\n\t\t\texpect := rc.ExpectEval(lockLua, []string{key}, val)\n\t\t\texpect.SetVal(lockFail)\n\t\t\texpect.SetErr(nil)\n\n\t\t\trl.Unlock(ctx, key, val)\n\t\t})\n\t})\n}\n"
  },
  {
    "path": "library/logger/context.go",
    "content": "package logger\n\nimport (\n\t\"context\"\n)\n\ntype contextKey uint64\n\nconst (\n\tcontextLogID contextKey = iota\n\tcontextHTTPLogFields\n\tcontextTraceID\n)\n\n// WithLogID inject log id to context\nfunc WithLogID(ctx context.Context, val interface{}) context.Context {\n\treturn context.WithValue(ctx, contextLogID, val)\n}\n\n// ValueLogID extract log id from context\nfunc ValueLogID(ctx context.Context) string {\n\tval := ctx.Value(contextLogID)\n\tlogID, ok := val.(string)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\treturn logID\n}\n\n// WithTraceID inject trace_id id to context\nfunc WithTraceID(ctx context.Context, val interface{}) context.Context {\n\treturn context.WithValue(ctx, contextTraceID, val)\n}\n\n// ValueTraceID extract trace id from context\nfunc ValueTraceID(ctx context.Context) string {\n\tval := ctx.Value(contextTraceID)\n\tlogID, ok := val.(string)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\treturn logID\n}\n\n// WithFields inject common http log fields to context\nfunc WithFields(ctx context.Context, fields []Field) context.Context {\n\treturn context.WithValue(ctx, contextHTTPLogFields, fields)\n}\n\n// ValueFields extrect common http log fields from context\nfunc ValueFields(ctx context.Context) []Field {\n\tval := ctx.Value(contextHTTPLogFields)\n\tfields, ok := val.([]Field)\n\tif !ok {\n\t\treturn []Field{}\n\t}\n\treturn fields\n}\n\nfunc AddField(ctx context.Context, fields ...Field) context.Context {\n\tf := ValueFields(ctx)\n\tf = append(f, fields...)\n\treturn WithFields(ctx, f)\n}\n"
  },
  {
    "path": "library/logger/fields.go",
    "content": "package logger\n\nimport (\n\t\"net/http\"\n\t\"time\"\n)\n\nconst (\n\tLogHeader = \"Log-Id\"\n)\n\nconst (\n\tModuleHTTP  = \"HTTP\"\n\tModuleRPC   = \"RPC\"\n\tModuleMySQL = \"MySQL\"\n\tModuleRedis = \"Redis\"\n\tModuleQueue = \"Queue\"\n\tModuleCron  = \"Cron\"\n)\n\nconst (\n\tAppName     = \"app_name\"\n\tModule      = \"module\"\n\tServiceName = \"service_name\"\n\tLogID       = \"log_id\"\n\tTraceID     = \"trace_id\"\n\tHeader      = \"header\"\n\tMethod      = \"method\"\n\tRequest     = \"request\"\n\tResponse    = \"response\"\n\tCode        = \"code\"\n\tClientIP    = \"client_ip\"\n\tClientPort  = \"client_port\"\n\tServerIP    = \"server_ip\"\n\tServerPort  = \"server_port\"\n\tAPI         = \"api\"\n\tCost        = \"cost\"\n\tTimeout     = \"timeout\"\n\tTrace       = \"trace\"\n)\n\ntype Fields struct {\n\tAppName     string        `json:\"app_name\"`\n\tModule      string        `json:\"module\"`\n\tServiceName string        `json:\"service_name\"`\n\tLogID       string        `json:\"log_id\"`\n\tTraceID     string        `json:\"trace_id\"`\n\tHeader      http.Header   `json:\"header\"`\n\tMethod      string        `json:\"method\"`\n\tRequest     interface{}   `json:\"request\"`\n\tResponse    interface{}   `json:\"response\"`\n\tCode        int           `json:\"code\"`\n\tClientIP    string        `json:\"client_ip\"`\n\tClientPort  int           `json:\"client_port\"`\n\tServerIP    string        `json:\"server_ip\"`\n\tServerPort  int           `json:\"server_port\"`\n\tAPI         string        `json:\"api\"`\n\tCost        int64         `json:\"cost\"`\n\tTimeout     time.Duration `json:\"timeout\"`\n\tTrace       string        `json:\"trace\"`\n}\n\ntype Field interface {\n\tKey() string\n\tValue() interface{}\n}\n\ntype field struct {\n\tkey   string\n\tvalue interface{}\n}\n\nfunc (f *field) Key() string {\n\treturn f.key\n}\n\nfunc (f *field) Value() interface{} {\n\treturn f.value\n}\n\nfunc Reflect(key string, value interface{}) Field {\n\treturn &field{key: key, value: value}\n}\n\nfunc Error(err error) Field {\n\treturn &field{key: \"error\", value: err}\n}\n\nfunc Find(key string, fields []Field) interface{} {\n\tfor _, f := range fields {\n\t\tif f.Key() == key {\n\t\t\treturn f.Value()\n\t\t}\n\t}\n\treturn \"\"\n}\n"
  },
  {
    "path": "library/logger/http.go",
    "content": "package logger\n\nimport (\n\t\"bytes\"\n\t\"io/ioutil\"\n\t\"net/http\"\n\n\t\"github.com/why444216978/go-util/conversion\"\n\t\"github.com/why444216978/go-util/snowflake\"\n)\n\n// ExtractLogID init log id\nfunc ExtractLogID(req *http.Request) string {\n\tlogID := req.Header.Get(LogHeader)\n\n\tif logID == \"\" {\n\t\tlogID = snowflake.Generate().String()\n\t}\n\n\treq.Header.Add(LogHeader, logID)\n\n\treturn logID\n}\n\n// GetRequestBody get http request body\nfunc GetRequestBody(req *http.Request) map[string]interface{} {\n\treqBody := []byte{}\n\tif req.Body != nil { // Read\n\t\treqBody, _ = ioutil.ReadAll(req.Body)\n\t}\n\treqBodyMap, _ := conversion.JsonToMap(string(reqBody))\n\treq.Body = ioutil.NopCloser(bytes.NewBuffer(reqBody)) // Reset\n\n\treturn reqBodyMap\n}\n"
  },
  {
    "path": "library/logger/level.go",
    "content": "package logger\n\ntype Level int8\n\nconst (\n\tUnknownLevel Level = iota - 1\n\n\tDebugLevel\n\n\tInfoLevel\n\n\tWarnLevel\n\n\tErrorLevel\n\n\tFatalLevel\n)\n\nfunc (l Level) String() string {\n\tswitch l {\n\tcase DebugLevel:\n\t\treturn \"debug\"\n\tcase InfoLevel:\n\t\treturn \"info\"\n\tcase WarnLevel:\n\t\treturn \"warn\"\n\tcase ErrorLevel:\n\t\treturn \"error\"\n\tcase FatalLevel:\n\t\treturn \"fatal\"\n\tdefault:\n\t\treturn \"unknown\"\n\t}\n}\n\nfunc StringToLevel(l string) Level {\n\tswitch l {\n\tcase \"debug\":\n\t\treturn DebugLevel\n\tcase \"info\":\n\t\treturn InfoLevel\n\tcase \"warn\":\n\t\treturn WarnLevel\n\tcase \"error\":\n\t\treturn ErrorLevel\n\tcase \"fatal\":\n\t\treturn FatalLevel\n\tdefault:\n\t\treturn UnknownLevel\n\t}\n}\n"
  },
  {
    "path": "library/logger/logger.go",
    "content": "package logger\n\nimport (\n\t\"context\"\n)\n\ntype Logger interface {\n\tDebug(ctx context.Context, msg string, fields ...Field)\n\tInfo(ctx context.Context, msg string, fields ...Field)\n\tWarn(ctx context.Context, msg string, fields ...Field)\n\tError(ctx context.Context, msg string, fields ...Field)\n\tFatal(ctx context.Context, msg string, fields ...Field)\n\tGetLevel() Level\n\tClose() error\n}\n"
  },
  {
    "path": "library/logger/logid.go",
    "content": "package logger\n\nimport (\n\t\"crypto/md5\"\n\t\"crypto/rand\"\n\t\"encoding/binary\"\n\t\"encoding/hex\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"sync/atomic\"\n\t\"time\"\n)\n\n// LogId is a unique ID identifying a log record. It must be exactly 12 bytes\n// long.\n//\n// Reference:http://www.mongodb.org/display/DOCS/Object+IDs\ntype ObjectId [12]byte\n\nvar (\n\t// objectIdCounter is atomically incremented when generating a new ObjectId\n\t// using NewObjectId() function. It's used as a counter part of an id.\n\tobjectIdCounter uint64 = 0\n\n\t// machineId stores machine id generated once and used in subsequent calls\n\t// to NewObjectId function.\n\tmachineId = initMachineId()\n)\n\n// StrToObjectId string id to object\nfunc StrToObjectId(str string) (ObjectId, error) {\n\tvar b [12]byte\n\tbyteArr, err := hex.DecodeString(str)\n\tif err != nil {\n\t\treturn b, err\n\t}\n\n\ti := 0\n\tfor {\n\t\tif i == 12 {\n\t\t\tbreak\n\t\t}\n\t\tb[i] = byteArr[i]\n\t\ti++\n\t}\n\n\treturn b, nil\n}\n\n// readMachineId generates machine id and puts it into the machineId global\n// variable. If this function fails to get the hostname, it will cause\n// a runtime error.\nfunc initMachineId() []byte {\n\tvar sum [3]byte\n\tid := sum[:]\n\thostname, err1 := os.Hostname()\n\tif err1 != nil {\n\t\t_, err2 := io.ReadFull(rand.Reader, id)\n\t\tif err2 != nil {\n\t\t\tpanic(fmt.Errorf(\"cannot get hostname: %v; %v\", err1, err2))\n\t\t}\n\t\treturn id\n\t}\n\thw := md5.New()\n\thw.Write([]byte(hostname))\n\tcopy(id, hw.Sum(nil))\n\treturn id\n}\n\n// NewObjectId returns a new unique ObjectId.\nfunc NewObjectId() ObjectId {\n\tvar b [12]byte\n\t// Timestamp, 4 bytes, big endian\n\tbinary.BigEndian.PutUint32(b[:], uint32(time.Now().Unix()))\n\t// Machine, first 3 bytes of md5(hostname)\n\tb[4] = machineId[0]\n\tb[5] = machineId[1]\n\tb[6] = machineId[2]\n\t// Pid, 2 bytes, specs don't specify endianness, but we use big endian.\n\tpid := os.Getpid()\n\tb[7] = byte(pid >> 8)\n\tb[8] = byte(pid)\n\t// Increment, 3 bytes, big endian\n\ti := atomic.AddUint64(&objectIdCounter, 1)\n\tb[9] = byte(i >> 16)\n\tb[10] = byte(i >> 8)\n\tb[11] = byte(i)\n\treturn b\n}\n\n// NewObjectIdWithTime returns a dummy ObjectId with the timestamp part filled\n// with the provided number of seconds from epoch UTC, and all other parts\n// filled with zeroes. It's not safe to insert a document with an id generated\n// by this method, it is useful only for queries to find documents with ids\n// generated before or after the specified timestamp.\nfunc NewObjectIdWithTime(t time.Time) ObjectId {\n\tvar b [12]byte\n\tbinary.BigEndian.PutUint32(b[:4], uint32(t.Unix()))\n\treturn b\n}\n\nfunc NewObjectIdWithHexString(s string) (o ObjectId, err error) {\n\td, err := hex.DecodeString(s)\n\tif err != nil || len(d) != 12 {\n\t\treturn\n\t}\n\tcopy(o[:], d[:12])\n\treturn\n}\n\n// Hex returns a hex representation of the ObjectId.\nfunc (id ObjectId) Hex() string {\n\treturn hex.EncodeToString(id[:])\n}\n\n// Time returns the timestamp part of the id.\n// It's a runtime error to call this method with an invalid id.\nfunc (id ObjectId) Time() time.Time {\n\t// First 4 bytes of ObjectId is 32-bit big-endian seconds from epoch.\n\tsecs := int64(binary.BigEndian.Uint32(id[:4]))\n\treturn time.Unix(secs, 0)\n}\n\n// Machine returns the 3-byte machine id part of the id.\n// It's a runtime error to call this method with an invalid id.\nfunc (id ObjectId) Machine() []byte {\n\treturn id[4:7]\n}\n\n// Pid returns the process id part of the id.\n// It's a runtime error to call this method with an invalid id.\nfunc (id ObjectId) Pid() uint16 {\n\treturn binary.BigEndian.Uint16(id[7:9])\n}\n\n// Counter returns the incrementing value part of the id.\n// It's a runtime error to call this method with an invalid id.\nfunc (id ObjectId) Counter() int32 {\n\tb := id[9:12]\n\t// Counter is stored as big-endian 3-byte value\n\treturn int32(uint32(b[0])<<16 | uint32(b[1])<<8 | uint32(b[2]))\n}\n"
  },
  {
    "path": "library/logger/rotate.go",
    "content": "package logger\n\nimport (\n\t\"io\"\n\t\"strings\"\n\t\"time\"\n\n\trotatelogs \"github.com/lestrrat-go/file-rotatelogs\"\n)\n\nfunc RotateWriter(infoFile, errFile string) (infoWriter io.Writer, errWriter io.Writer, err error) {\n\tif infoWriter, err = rotateWriter(infoFile); err != nil {\n\t\treturn\n\t}\n\n\tif errWriter, err = rotateWriter(errFile); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}\n\nfunc rotateWriter(filename string) (io.Writer, error) {\n\treturn rotatelogs.New(\n\t\tstrings.Replace(filename, \".log\", \"\", -1)+\"-%Y%m%d%H.log\", // 2022年1月1日12点 => filename-2022010112.log\n\t\trotatelogs.WithLinkName(filename),\n\t\trotatelogs.WithMaxAge(time.Hour*24*7),  // log max save seven days\n\t\trotatelogs.WithRotationTime(time.Hour), // rotate once an hour\n\t)\n}\n"
  },
  {
    "path": "library/logger/rotate_test.go",
    "content": "package logger\n\nimport (\n\t\"testing\"\n\n\t\"github.com/smartystreets/goconvey/convey\"\n\t\"github.com/stretchr/testify/assert\"\n)\n\nfunc TestRotateWriter(t *testing.T) {\n\tconvey.Convey(\"TestRotateWriter\", t, func() {\n\t\tconvey.Convey(\"success\", func() {\n\t\t\t_, _, err := RotateWriter(\"info.log\", \"error.log\")\n\t\t\tassert.Nil(t, err)\n\t\t})\n\t})\n}\n\nfunc Test_rotateWriter(t *testing.T) {\n\tconvey.Convey(\"Test_rotateWriter\", t, func() {\n\t\tconvey.Convey(\"success\", func() {\n\t\t\t_, err := rotateWriter(\"log\")\n\t\t\tassert.Nil(t, err)\n\t\t})\n\t})\n}\n"
  },
  {
    "path": "library/logger/zap/gorm/gorm.go",
    "content": "package gorm\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"runtime\"\n\t\"strings\"\n\t\"time\"\n\n\t\"go.uber.org/zap\"\n\t\"go.uber.org/zap/zapcore\"\n\t\"gorm.io/gorm\"\n\tgormLogger \"gorm.io/gorm/logger\"\n\n\t\"github.com/why444216978/gin-api/library/logger\"\n\tzapLogger \"github.com/why444216978/gin-api/library/logger/zap\"\n)\n\n// GormConfig is used to parse configuration file\n// logger should be controlled with Options\ntype GormConfig struct {\n\tServiceName               string\n\tSlowThreshold             int\n\tInfoFile                  string\n\tErrorFile                 string\n\tLevel                     int\n\tSkipCallerLookup          bool\n\tIgnoreRecordNotFoundError bool\n}\n\ntype GormLogger struct {\n\t*zap.Logger\n\tconfig                    *GormConfig\n\tLogLevel                  gormLogger.LogLevel\n\tSlowThreshold             time.Duration\n\tSkipCallerLookup          bool\n\tIgnoreRecordNotFoundError bool\n}\n\ntype GormOption func(gl *GormLogger)\n\nvar _ gormLogger.Interface = (*GormLogger)(nil)\n\nfunc NewGorm(config *GormConfig, opts ...GormOption) (gl *GormLogger, err error) {\n\tgl = &GormLogger{\n\t\tconfig:                    config,\n\t\tLogLevel:                  gormLogger.LogLevel(config.Level),\n\t\tSlowThreshold:             time.Duration(config.SlowThreshold) * time.Millisecond,\n\t\tSkipCallerLookup:          config.SkipCallerLookup,\n\t\tIgnoreRecordNotFoundError: config.IgnoreRecordNotFoundError,\n\t}\n\n\tfor _, o := range opts {\n\t\to(gl)\n\t}\n\n\tlevel := zap.InfoLevel.String()\n\tswitch gl.LogLevel {\n\tcase gormLogger.Silent:\n\t\tlevel = zapcore.FatalLevel.String()\n\tcase gormLogger.Error:\n\t\tlevel = zapcore.ErrorLevel.String()\n\tcase gormLogger.Warn:\n\t\tlevel = zapcore.WarnLevel.String()\n\tcase gormLogger.Info:\n\t\tlevel = zapcore.InfoLevel.String()\n\t}\n\n\tinfoWriter, errWriter, err := logger.RotateWriter(config.InfoFile, config.ErrorFile)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tl, err := zapLogger.NewLogger(\n\t\tzapLogger.WithModule(logger.ModuleMySQL),\n\t\tzapLogger.WithServiceName(config.ServiceName),\n\t\tzapLogger.WithInfoWriter(infoWriter),\n\t\tzapLogger.WithErrorWriter(errWriter),\n\t\tzapLogger.WithLevel(level),\n\t)\n\tif err != nil {\n\t\treturn\n\t}\n\tgl.Logger = l.Logger\n\n\tgormLogger.Default = gl\n\n\treturn\n}\n\nfunc (l *GormLogger) LogMode(level gormLogger.LogLevel) gormLogger.Interface {\n\treturn &GormLogger{\n\t\tLogger:                    l.Logger,\n\t\tSlowThreshold:             l.SlowThreshold,\n\t\tLogLevel:                  level,\n\t\tSkipCallerLookup:          l.SkipCallerLookup,\n\t\tIgnoreRecordNotFoundError: l.IgnoreRecordNotFoundError,\n\t}\n}\n\nfunc (l *GormLogger) Info(ctx context.Context, msg string, args ...interface{}) {}\n\nfunc (l *GormLogger) Warn(ctx context.Context, msg string, args ...interface{}) {}\n\nfunc (l *GormLogger) Error(ctx context.Context, msg string, args ...interface{}) {}\n\nfunc (l *GormLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error) {\n\tif l.LogLevel <= 0 {\n\t\treturn\n\t}\n\n\tfields := logger.ValueFields(ctx)\n\n\telapsed := time.Since(begin)\n\n\tsql, rows := fc()\n\tsqlSlice := strings.Split(sql, \" \")\n\tapi := \"\"\n\tif len(sqlSlice) > 1 {\n\t\tapi = sqlSlice[0]\n\t}\n\n\tf := []zapcore.Field{\n\t\tzap.String(logger.LogID, logger.ValueLogID(ctx)),\n\t\tzap.String(logger.TraceID, logger.ValueTraceID(ctx)),\n\t\tzap.Int64(logger.Cost, elapsed.Milliseconds()),\n\t\tzap.String(logger.Request, sql),\n\t\tzap.Int64(logger.Response, rows),\n\t\tzap.String(logger.API, api),\n\t\tzap.Reflect(logger.ClientIP, logger.Find(logger.ServerIP, fields)),\n\t\tzap.Reflect(logger.ClientPort, logger.Find(logger.ServerPort, fields)),\n\t}\n\n\tswitch {\n\tcase err != nil && l.LogLevel >= gormLogger.Error && (!l.IgnoreRecordNotFoundError || !errors.Is(err, gorm.ErrRecordNotFound)):\n\t\tl.logger().Error(err.Error(), f...)\n\tcase l.SlowThreshold != 0 && elapsed > l.SlowThreshold && l.LogLevel >= gormLogger.Warn:\n\t\tl.logger().Warn(\"warn\", f...)\n\tcase l.LogLevel >= gormLogger.Info:\n\t\tl.logger().Info(\"info\", f...)\n\t}\n}\n\nfunc (l *GormLogger) logger() *zap.Logger {\n\tfor i := 2; i < 15; i++ {\n\t\t_, file, _, ok := runtime.Caller(i)\n\t\tswitch {\n\t\tcase !ok:\n\t\tcase strings.Contains(file, \"gorm.io\"):\n\t\tcase strings.Contains(file, \"go-util/orm/orm.go\"):\n\t\tdefault:\n\t\t\treturn l.Logger.WithOptions(zap.AddCallerSkip(i - 2))\n\t\t}\n\t}\n\treturn l.Logger\n}\n\nfunc (l *GormLogger) Close() error {\n\treturn l.Logger.Sync()\n}\n"
  },
  {
    "path": "library/logger/zap/redis/redis.go",
    "content": "package redis\n\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/go-redis/redis/v8\"\n\n\t\"github.com/why444216978/gin-api/library/logger\"\n\tzapLogger \"github.com/why444216978/gin-api/library/logger/zap\"\n)\n\ntype contextKey int\n\nconst (\n\tcmdStart contextKey = iota\n)\n\n// RedisConfig is used to parse configuration file\n// logger should be controlled with Options\ntype RedisConfig struct {\n\tInfoFile    string\n\tErrorFile   string\n\tLevel       string\n\tServiceName string\n\tHost        string\n\tPort        int\n}\n\n// RedisLogger is go-redis logger Hook\ntype RedisLogger struct {\n\t*zapLogger.ZapLogger\n\tconfig *RedisConfig\n}\n\ntype RedisOption func(rl *RedisLogger)\n\n// NewRedisLogger\nfunc NewRedisLogger(config *RedisConfig, opts ...RedisOption) (rl *RedisLogger, err error) {\n\trl = &RedisLogger{config: config}\n\n\tfor _, o := range opts {\n\t\to(rl)\n\t}\n\n\tinfoWriter, errWriter, err := logger.RotateWriter(config.InfoFile, config.ErrorFile)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tl, err := zapLogger.NewLogger(\n\t\tzapLogger.WithModule(logger.ModuleRedis),\n\t\tzapLogger.WithServiceName(config.ServiceName),\n\t\tzapLogger.WithCallerSkip(6),\n\t\tzapLogger.WithInfoWriter(infoWriter),\n\t\tzapLogger.WithErrorWriter(errWriter),\n\t\tzapLogger.WithLevel(config.Level),\n\t)\n\tif err != nil {\n\t\treturn\n\t}\n\trl.ZapLogger = l\n\n\treturn\n}\n\n// BeforeProcess redis before execute action do something\nfunc (rl *RedisLogger) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error) {\n\tctx = rl.setCmdStart(ctx)\n\treturn ctx, nil\n}\n\n// AfterProcess redis after execute action do something\nfunc (rl *RedisLogger) AfterProcess(ctx context.Context, cmd redis.Cmder) error {\n\tif rl.Logger == nil {\n\t\treturn nil\n\t}\n\n\tcost := rl.getCmdCost(ctx)\n\tif err := cmd.Err(); err != nil && err != redis.Nil {\n\t\trl.Error(ctx, false, []redis.Cmder{cmd}, cost)\n\t\treturn nil\n\t}\n\n\trl.Info(ctx, false, []redis.Cmder{cmd}, cost)\n\n\treturn nil\n}\n\n// BeforeProcessPipeline before command process handle\nfunc (rl *RedisLogger) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error) {\n\tctx = rl.setCmdStart(ctx)\n\treturn ctx, nil\n}\n\n// AfterProcessPipeline after command process handle\nfunc (rl *RedisLogger) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error {\n\tif rl.Logger == nil {\n\t\treturn nil\n\t}\n\tcost := rl.getCmdCost(ctx)\n\n\thasErr := false\n\tfor _, cmd := range cmds {\n\t\tif err := cmd.Err(); err != nil && err != redis.Nil {\n\t\t\thasErr = true\n\t\t}\n\t}\n\n\tif hasErr {\n\t\trl.Error(ctx, true, cmds, cost)\n\t\treturn nil\n\t}\n\trl.Info(ctx, true, cmds, cost)\n\n\treturn nil\n}\n\nfunc (rl *RedisLogger) Info(ctx context.Context, isPipeline bool, cmds []redis.Cmder, cost int64) {\n\tnewCtx, logFields := rl.fields(ctx, isPipeline, cmds, cost)\n\trl.logger().Info(newCtx, \"info\", logFields...)\n}\n\nfunc (rl *RedisLogger) Error(ctx context.Context, isPipeline bool, cmds []redis.Cmder, cost int64) {\n\terrs := make([]string, 0)\n\tfor idx, cmd := range cmds {\n\t\terr := cmd.Err()\n\t\tif err == nil {\n\t\t\treturn\n\t\t}\n\t\terrs = append(errs, strconv.Itoa(idx)+\"-\"+err.Error())\n\t}\n\tnewCtx, logFields := rl.fields(ctx, isPipeline, cmds, cost)\n\trl.logger().Error(newCtx, strings.Join(errs, \",\"), logFields...)\n}\n\nfunc (rl *RedisLogger) fields(ctx context.Context, isPipeline bool, cmds []redis.Cmder, cost int64) (context.Context, []logger.Field) {\n\tl := len(cmds)\n\tnames := make([]string, l)\n\targs := make([]interface{}, l)\n\tresponse := make([]string, l)\n\tfor idx, cmd := range cmds {\n\t\tnames[idx] = cmd.Name()\n\t\targs[idx] = cmd.Args()\n\t\tresponse[idx] = cmd.String()\n\t}\n\n\tmethod := \"pipeline\"\n\tif !isPipeline {\n\t\tmethod = cmds[0].Name()\n\t}\n\n\tfields := logger.ValueFields(ctx)\n\tf := []logger.Field{\n\t\tlogger.Reflect(logger.Header, http.Header{}),\n\t\tlogger.Reflect(logger.Method, method),\n\t\tlogger.Reflect(logger.Request, args),\n\t\tlogger.Reflect(logger.Response, response),\n\t\tlogger.Reflect(logger.Code, 0),\n\t\tlogger.Reflect(logger.ClientIP, logger.Find(logger.ServerIP, fields)),\n\t\tlogger.Reflect(logger.ClientPort, logger.Find(logger.ServerPort, fields)),\n\t\tlogger.Reflect(logger.ServerIP, rl.config.Host),\n\t\tlogger.Reflect(logger.ServerPort, rl.config.Port),\n\t\tlogger.Reflect(logger.API, method),\n\t\tlogger.Reflect(logger.Cost, cost),\n\t}\n\n\tnewCtx := context.WithValue(ctx, \"rpc\", \"rpc\")\n\tnewCtx = logger.WithFields(newCtx, f)\n\treturn newCtx, []logger.Field{}\n}\n\nfunc (rl *RedisLogger) logger() *zapLogger.ZapLogger {\n\treturn rl.ZapLogger\n}\n\nfunc (rl *RedisLogger) setCmdStart(ctx context.Context) context.Context {\n\treturn context.WithValue(ctx, cmdStart, time.Now())\n}\n\nfunc (rl *RedisLogger) getCmdCost(ctx context.Context) int64 {\n\treturn time.Since(ctx.Value(cmdStart).(time.Time)).Milliseconds()\n}\n"
  },
  {
    "path": "library/logger/zap/rpc/rpc.go",
    "content": "package rpc\n\nimport (\n\t\"context\"\n\n\t\"github.com/why444216978/gin-api/library/logger\"\n\tzapLogger \"github.com/why444216978/gin-api/library/logger/zap\"\n)\n\n// RPCConfig is used to parse configuration file\n// logger should be controlled with Options\ntype RPCConfig struct {\n\tInfoFile  string\n\tErrorFile string\n\tLevel     string\n}\n\n// RPCLogger is go-redis logger Hook\ntype RPCLogger struct {\n\t*zapLogger.ZapLogger\n\tconfig *RPCConfig\n}\n\ntype RPCOption func(rl *RPCLogger)\n\n// NewRPCLogger\nfunc NewRPCLogger(config *RPCConfig, opts ...RPCOption) (rl *RPCLogger, err error) {\n\trl = &RPCLogger{config: config}\n\n\tfor _, o := range opts {\n\t\to(rl)\n\t}\n\n\tinfoWriter, errWriter, err := logger.RotateWriter(config.InfoFile, config.ErrorFile)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tl, err := zapLogger.NewLogger(\n\t\tzapLogger.WithCallerSkip(4),\n\t\tzapLogger.WithModule(logger.ModuleRPC),\n\t\tzapLogger.WithInfoWriter(infoWriter),\n\t\tzapLogger.WithErrorWriter(errWriter),\n\t\tzapLogger.WithLevel(config.Level),\n\t)\n\tif err != nil {\n\t\treturn\n\t}\n\trl.ZapLogger = l\n\n\treturn\n}\n\nfunc (rl *RPCLogger) Info(ctx context.Context, msg string, fields ...logger.Field) {\n\tnewCtx := context.WithValue(ctx, \"rpc\", \"rpc\")\n\trl.logger().Info(newCtx, msg, fields...)\n}\n\nfunc (rl *RPCLogger) Error(ctx context.Context, msg string, fields ...logger.Field) {\n\tnewCtx := context.WithValue(ctx, \"rpc\", \"rpc\")\n\trl.logger().Error(newCtx, msg, fields...)\n}\n\nfunc (rl *RPCLogger) logger() *zapLogger.ZapLogger {\n\treturn rl.ZapLogger\n}\n"
  },
  {
    "path": "library/logger/zap/service/service.go",
    "content": "package service\n\nimport (\n\t\"github.com/why444216978/gin-api/library/logger\"\n\t\"github.com/why444216978/gin-api/library/logger/zap\"\n)\n\ntype Config struct {\n\tInfoFile  string\n\tErrorFile string\n\tLevel     string\n}\n\ntype ServiceLogger struct {\n\t*zap.ZapLogger\n\tconfig *Config\n}\n\nfunc NewServiceLogger(serviceName string, config *Config) (*ServiceLogger, error) {\n\tinfoWriter, errWriter, err := logger.RotateWriter(config.InfoFile, config.ErrorFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tl, err := zap.NewLogger(\n\t\tzap.WithModule(logger.ModuleHTTP),\n\t\tzap.WithServiceName(serviceName),\n\t\tzap.WithInfoWriter(infoWriter),\n\t\tzap.WithErrorWriter(errWriter),\n\t\tzap.WithLevel(config.Level),\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &ServiceLogger{ZapLogger: l, config: config}, nil\n}\n"
  },
  {
    "path": "library/logger/zap/zap.go",
    "content": "package zap\n\nimport (\n\t\"context\"\n\t\"io\"\n\t\"os\"\n\t\"time\"\n\n\t\"go.uber.org/zap\"\n\t\"go.uber.org/zap/zapcore\"\n\n\t\"github.com/why444216978/gin-api/library/app\"\n\t\"github.com/why444216978/gin-api/library/logger\"\n)\n\ntype ZapLogger struct {\n\t*zap.Logger\n\topts *Options\n}\n\ntype Options struct {\n\tlevel       logger.Level\n\tcallSkip    int\n\tmodule      string\n\tserviceName string\n\tinfoWriter  io.Writer\n\terrorWriter io.Writer\n}\n\nvar _ logger.Logger = (*ZapLogger)(nil)\n\ntype Option func(l *Options)\n\nfunc defaultOptions() *Options {\n\treturn &Options{\n\t\tlevel:       logger.InfoLevel,\n\t\tcallSkip:    1,\n\t\tmodule:      \"default\",\n\t\tserviceName: \"default\",\n\t\tinfoWriter:  os.Stdout,\n\t\terrorWriter: os.Stdout,\n\t}\n}\n\nfunc WithCallerSkip(skip int) Option {\n\treturn func(o *Options) { o.callSkip = skip }\n}\n\nfunc WithModule(module string) Option {\n\treturn func(o *Options) { o.module = module }\n}\n\nfunc WithServiceName(serviceName string) Option {\n\treturn func(o *Options) { o.serviceName = serviceName }\n}\n\nfunc WithInfoWriter(w io.Writer) Option {\n\treturn func(o *Options) { o.infoWriter = w }\n}\n\nfunc WithErrorWriter(w io.Writer) Option {\n\treturn func(o *Options) { o.errorWriter = w }\n}\n\nfunc WithLevel(l string) Option {\n\treturn func(o *Options) { o.level = logger.StringToLevel(l) }\n}\n\nfunc NewLogger(options ...Option) (l *ZapLogger, err error) {\n\topts := defaultOptions()\n\tfor _, o := range options {\n\t\to(opts)\n\t}\n\n\tl = &ZapLogger{\n\t\topts: opts,\n\t}\n\n\tencoder := l.formatEncoder()\n\n\tinfoEnabler := l.infoEnabler()\n\terrorEnabler := l.errorEnabler()\n\n\tcore := zapcore.NewTee(\n\t\tzapcore.NewCore(encoder, zapcore.AddSync(opts.infoWriter), infoEnabler),\n\t\tzapcore.NewCore(encoder, zapcore.AddSync(opts.errorWriter), errorEnabler),\n\t)\n\n\tfields := []zapcore.Field{\n\t\tzap.String(logger.AppName, app.Name()),\n\t\tzap.String(logger.Module, l.opts.module),\n\t\tzap.String(logger.ServiceName, l.opts.serviceName),\n\t}\n\n\tl.Logger = zap.New(core,\n\t\tzap.AddCaller(),\n\t\tzap.AddStacktrace(errorEnabler),\n\t\tzap.AddCallerSkip(l.opts.callSkip),\n\t\tzap.Fields(fields...),\n\t)\n\n\treturn\n}\n\nfunc (l *ZapLogger) infoEnabler() zap.LevelEnablerFunc {\n\treturn zap.LevelEnablerFunc(func(lvl zapcore.Level) bool {\n\t\tif lvl < zapLevel(l.opts.level) {\n\t\t\treturn false\n\t\t}\n\t\treturn lvl <= zapcore.InfoLevel\n\t})\n}\n\nfunc (l *ZapLogger) errorEnabler() zap.LevelEnablerFunc {\n\treturn zap.LevelEnablerFunc(func(lvl zapcore.Level) bool {\n\t\tif lvl < zapLevel(l.opts.level) {\n\t\t\treturn false\n\t\t}\n\t\treturn lvl >= zapcore.WarnLevel\n\t})\n}\n\nfunc (l *ZapLogger) formatEncoder() zapcore.Encoder {\n\treturn zapcore.NewJSONEncoder(zapcore.EncoderConfig{\n\t\tMessageKey:    \"msg\",\n\t\tLevelKey:      \"level\",\n\t\tEncodeLevel:   zapcore.CapitalLevelEncoder,\n\t\tTimeKey:       \"time\",\n\t\tCallerKey:     \"file\",\n\t\tFunctionKey:   \"func\",\n\t\tStacktraceKey: \"stack\",\n\t\tEncodeTime: func(t time.Time, enc zapcore.PrimitiveArrayEncoder) {\n\t\t\tenc.AppendString(t.Format(\"2006-01-02 15:04:05\"))\n\t\t},\n\t\tEncodeCaller: zapcore.ShortCallerEncoder,\n\t\tEncodeDuration: func(d time.Duration, enc zapcore.PrimitiveArrayEncoder) {\n\t\t\tenc.AppendInt64(int64(d) / 1000000)\n\t\t},\n\t})\n}\n\nfunc (l *ZapLogger) GetLevel() logger.Level {\n\treturn l.opts.level\n}\n\nfunc zapLevel(level logger.Level) zapcore.Level {\n\tswitch level {\n\tcase logger.DebugLevel:\n\t\treturn zapcore.DebugLevel\n\tcase logger.InfoLevel:\n\t\treturn zapcore.InfoLevel\n\tcase logger.WarnLevel:\n\t\treturn zapcore.WarnLevel\n\tcase logger.ErrorLevel:\n\t\treturn zapcore.ErrorLevel\n\tcase logger.FatalLevel:\n\t\treturn zapcore.FatalLevel\n\tdefault:\n\t\treturn zapcore.InfoLevel\n\t}\n}\n\nfunc (l *ZapLogger) Debug(ctx context.Context, msg string, fields ...logger.Field) {\n\tl.Logger.Debug(msg, l.extractFields(ctx, fields...)...)\n}\n\nfunc (l *ZapLogger) Info(ctx context.Context, msg string, fields ...logger.Field) {\n\tl.Logger.Info(msg, l.extractFields(ctx, fields...)...)\n}\n\nfunc (l *ZapLogger) Warn(ctx context.Context, msg string, fields ...logger.Field) {\n\tl.Logger.Warn(msg, l.extractFields(ctx, fields...)...)\n}\n\nfunc (l *ZapLogger) Error(ctx context.Context, msg string, fields ...logger.Field) {\n\tl.Logger.Error(msg, l.extractFields(ctx, fields...)...)\n}\n\nfunc (l *ZapLogger) Fatal(ctx context.Context, msg string, fields ...logger.Field) {\n\tl.Logger.Fatal(msg, l.extractFields(ctx, fields...)...)\n}\n\n// extractFields extract context field and keep key unique, save fields\nfunc (l *ZapLogger) extractFields(ctx context.Context, fields ...logger.Field) []zap.Field {\n\tctxFields := logger.ValueFields(ctx)\n\ttarget := map[string]zap.Field{}\n\tfor _, f := range ctxFields {\n\t\ttarget[f.Key()] = zap.Reflect(f.Key(), f.Value())\n\t}\n\n\tfor _, f := range fields {\n\t\ttarget[f.Key()] = zap.Reflect(f.Key(), f.Value())\n\t}\n\n\tnew := make([]zap.Field, 0)\n\tfor _, f := range target {\n\t\tnew = append(new, f)\n\t}\n\n\treturn new\n}\n\nfunc (l *ZapLogger) Close() error {\n\treturn l.Sync()\n}\n"
  },
  {
    "path": "library/orm/orm.go",
    "content": "package orm\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/pkg/errors\"\n\t\"gorm.io/driver/mysql\"\n\t\"gorm.io/gorm\"\n\t\"gorm.io/gorm/logger\"\n\t\"gorm.io/plugin/dbresolver\"\n)\n\ntype Config struct {\n\tServiceName string\n\tMaster      *instanceConfig\n\tSlave       *instanceConfig\n}\n\ntype instanceConfig struct {\n\tHost     string\n\tPort     string\n\tUser     string\n\tPassword string\n\tDB       string\n\tCharset  string\n\tMaxOpen  int\n\tMaxIdle  int\n}\n\ntype Orm struct {\n\t*gorm.DB\n\tconfig *gorm.Config\n\ttracer gorm.Plugin\n}\n\ntype Option func(orm *Orm)\n\nfunc WithTrace(tracer gorm.Plugin) Option {\n\treturn func(orm *Orm) {\n\t\torm.tracer = tracer\n\t}\n}\n\nfunc WithLogger(logger logger.Interface) Option {\n\treturn func(orm *Orm) {\n\t\torm.config.Logger = logger\n\t}\n}\n\nfunc NewOrm(cfg *Config, opts ...Option) (orm *Orm, err error) {\n\torm = &Orm{\n\t\tconfig: &gorm.Config{\n\t\t\tSkipDefaultTransaction: true,\n\t\t},\n\t}\n\n\tfor _, o := range opts {\n\t\to(orm)\n\t}\n\n\tmaster := mysql.Open(getDSN(cfg.Master))\n\tslave := mysql.Open(getDSN(cfg.Slave))\n\n\t_orm, err := gorm.Open(master, orm.config)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"open mysql conn error：\")\n\t\treturn nil, err\n\t}\n\n\terr = _orm.Use(orm.tracer)\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = _orm.Use(dbresolver.Register(dbresolver.Config{\n\t\tSources:  []gorm.Dialector{master},\n\t\tReplicas: []gorm.Dialector{slave},\n\t\tPolicy:   dbresolver.RandomPolicy{},\n\t}).SetMaxOpenConns(cfg.Master.MaxOpen).SetMaxIdleConns(cfg.Master.MaxIdle))\n\tif err != nil {\n\t\treturn\n\t}\n\n\torm.DB = _orm\n\n\treturn\n}\n\nfunc (orm *Orm) UseWrite() *gorm.DB {\n\treturn orm.Clauses(dbresolver.Write)\n}\n\nfunc (orm *Orm) UseRead() *gorm.DB {\n\treturn orm.Clauses(dbresolver.Read)\n}\n\nfunc getDSN(cfg *instanceConfig) string {\n\treturn fmt.Sprintf(\"%s:%s@tcp(%s:%s)/%s?charset=%s&parseTime=true\",\n\t\tcfg.User,\n\t\tcfg.Password,\n\t\tcfg.Host,\n\t\tcfg.Port,\n\t\tcfg.DB,\n\t\tcfg.Charset)\n}\n"
  },
  {
    "path": "library/queue/queue.go",
    "content": "package queue\n\nimport (\n\t\"context\"\n)\n\ntype ProduceOption struct{}\n\ntype ProduceOptionFunc func(o *ProduceOption)\n\ntype ConsumeOption struct{}\n\ntype ConsumeOptionFunc func(o *ConsumeOption)\n\ntype Consumer func(context.Context, interface{}) (retry bool, err error)\n\ntype Queue interface {\n\tProduce(ctx context.Context, msg interface{}, opts ...ProduceOptionFunc) error\n\tConsume(consumer Consumer)\n\tShutdown() error\n}\n"
  },
  {
    "path": "library/queue/rabbitmq/rabbitmq.go",
    "content": "package rabbitmq\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/pkg/errors\"\n\t\"github.com/streadway/amqp\"\n\t\"github.com/why444216978/gin-api/library/queue\"\n)\n\nconst (\n\tExchangeTypeDirect  = \"direct\"\n\tExchangeTypeFanout  = \"fanout\"\n\tExchangeTypeTopic   = \"topic\"\n\tExchangeTypeHeaders = \"headers\"\n)\n\ntype Config struct {\n\tServiceName  string\n\tHost         string\n\tPort         int\n\tVirtual      string\n\tUser         string\n\tPass         string\n\tExchangeType string\n\tExchangeName string\n\tQueueName    string\n\tRouteName    string\n}\n\ntype Option struct {\n\tdeclareExchange bool\n\tdeclareQueue    bool\n\tbindQueue       bool\n\tqos             int\n}\n\ntype OptionFunc func(*Option)\n\nfunc defaultOption() *Option {\n\treturn &Option{\n\t\tdeclareExchange: false,\n\t\tdeclareQueue:    false,\n\t\tbindQueue:       false,\n\t\tqos:             10,\n\t}\n}\n\nfunc WithDeclareExchange(turn bool) OptionFunc {\n\treturn func(o *Option) { o.declareExchange = turn }\n}\n\nfunc WithDeclareQueue(turn bool) OptionFunc {\n\treturn func(o *Option) { o.declareQueue = turn }\n}\n\nfunc WithBindQueue(turn bool) OptionFunc {\n\treturn func(o *Option) { o.bindQueue = turn }\n}\n\nfunc WithQos(qos int) OptionFunc {\n\treturn func(o *Option) { o.qos = qos }\n}\n\ntype RabbitMQ struct {\n\topts         *Option\n\tconnection   *amqp.Connection\n\tchannel      *amqp.Channel\n\tname         string\n\turl          string\n\texchangeName string\n\texchangeType string\n\tqueueName    string\n\trouteName    string\n}\n\nfunc New(cfg *Config, opts ...OptionFunc) (*RabbitMQ, error) {\n\tif cfg == nil {\n\t\treturn nil, errors.New(\"cfg is nil\")\n\t}\n\n\topt := defaultOption()\n\tfor _, o := range opts {\n\t\to(opt)\n\t}\n\n\treturn &RabbitMQ{\n\t\topts:         opt,\n\t\tname:         cfg.ServiceName,\n\t\turl:          fmt.Sprintf(\"amqp://%s:%s@%s:%d/%s\", cfg.User, cfg.Pass, cfg.Host, cfg.Port, cfg.Virtual),\n\t\texchangeName: cfg.ExchangeName,\n\t\texchangeType: cfg.ExchangeType,\n\t\tqueueName:    cfg.QueueName,\n\t\trouteName:    cfg.RouteName,\n\t}, nil\n}\n\nfunc (q *RabbitMQ) Produce(ctx context.Context, msg interface{}, opts ...queue.ProduceOptionFunc) (err error) {\n\tm, ok := msg.([]byte)\n\tif !ok {\n\t\treturn errors.New(\"RabbitMQ msg not []byte\")\n\t}\n\n\tif err = q.connect(); err != nil {\n\t\treturn\n\t}\n\n\terr = q.channel.Publish(\n\t\tq.exchangeName, // exchange\n\t\tq.routeName,    // routing key\n\t\ttrue,           // set true, when no queue match Basic.Return\n\t\tfalse,          // set false, not dependent consumers\n\t\tamqp.Publishing{\n\t\t\tDeliveryMode: amqp.Persistent,\n\t\t\tContentType:  \"text/plain\",\n\t\t\tBody:         m,\n\t\t})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"channel.Publish fail\")\n\t}\n\n\treturn\n}\n\nfunc (q *RabbitMQ) Consume(consumer queue.Consumer) {\n\terr := q.connect()\n\tif err != nil {\n\t\t// TODO 集成log\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\tdeliveries, err := q.channel.Consume(\n\t\tq.queueName, // queu name\n\t\tq.name,      // name,\n\t\tfalse,       // no autoAck\n\t\tfalse,       // exclusive\n\t\tfalse,       // noLocal\n\t\tfalse,       // noWait\n\t\tnil,         // arguments\n\t)\n\tif err != nil {\n\t\t// TODO 集成log\n\t\tlog.Printf(\"Queue Consume: %s\", err)\n\t\treturn\n\t}\n\n\tfor d := range deliveries {\n\t\tgo func(d amqp.Delivery) {\n\t\t\tdefer func() {\n\t\t\t\tif err := recover(); err != nil {\n\t\t\t\t\t// TODO 集成log\n\t\t\t\t\tlog.Printf(\"%s\", err)\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\tretry, err := consumer(context.TODO(), d.Body)\n\t\t\tif err != nil {\n\t\t\t\t// TODO 集成log\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\n\t\t\tif !retry {\n\t\t\t\tif err = d.Ack(true); err != nil {\n\t\t\t\t\t// TODO 集成log\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}(d)\n\t}\n}\n\nfunc (q *RabbitMQ) Shutdown() (err error) {\n\tif err = q.channel.Cancel(q.name, true); err != nil {\n\t\treturn errors.Wrap(err, \"channel cancel failed\")\n\t}\n\n\tif err = q.connection.Close(); err != nil {\n\t\treturn errors.Wrap(err, \"connection close error\")\n\t}\n\n\treturn\n}\n\nfunc (q *RabbitMQ) connect() (err error) {\n\tq.connection, err = amqp.Dial(q.url)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"amqp.Dial fail\")\n\t}\n\n\tselect {\n\tcase r := <-q.connection.NotifyClose(make(chan *amqp.Error)):\n\t\tb, _ := json.Marshal(r)\n\t\t// TODO log\n\t\tlog.Println(\"q.connection.NotifyClose:\" + string(b))\n\tdefault:\n\t}\n\n\tq.channel, err = q.connection.Channel()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"connection.Channel fail\")\n\t}\n\n\tif err = q.channel.Qos(q.opts.qos, 0, false); err != nil {\n\t\treturn errors.Wrap(err, \"channel.Qos fail\")\n\t}\n\n\tselect {\n\tcase r := <-q.channel.NotifyClose(make(chan *amqp.Error)):\n\t\tb, _ := json.Marshal(r)\n\t\t// TODO log\n\t\tlog.Println(\"q.channel.NotifyClose:\" + string(b))\n\tcase r := <-q.channel.NotifyCancel(make(chan string)):\n\t\t// TODO log\n\t\tlog.Println(\"q.channel.NotifyCancel:\" + r)\n\tcase r := <-q.channel.NotifyReturn(make(chan amqp.Return)):\n\t\tb, _ := json.Marshal(r)\n\t\t// TODO log\n\t\tlog.Println(\"q.channel.NotifyReturn:\" + string(b))\n\tdefault:\n\t}\n\n\tif q.opts.declareExchange {\n\t\tif err = q.channel.ExchangeDeclare(q.exchangeName, q.exchangeType, true, false, false, false, nil); err != nil {\n\t\t\treturn errors.Wrap(err, \"channel.ExchangeDeclare fail\")\n\t\t}\n\t}\n\n\tif q.opts.declareQueue {\n\t\tif _, err = q.channel.QueueDeclare(\n\t\t\tq.queueName, // routing_key\n\t\t\ttrue,        // durable\n\t\t\tfalse,       // delete when unused\n\t\t\tfalse,       // exclusive\n\t\t\tfalse,       // no-wait\n\t\t\tnil,         // arguments\n\t\t); err != nil {\n\t\t\treturn errors.Wrap(err, \"channel.QueueDeclare fail\")\n\t\t}\n\t}\n\n\tif q.opts.bindQueue {\n\t\tif err = q.channel.QueueBind(q.queueName, q.routeName, q.exchangeName, false, nil); err != nil {\n\t\t\treturn errors.Wrap(err, \"channel.QueueBind fail\")\n\t\t}\n\t}\n\n\treturn\n}\n"
  },
  {
    "path": "library/redis/conn.go",
    "content": "package redis\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/go-redis/redis/v8\"\n)\n\ntype Config struct {\n\tServiceName    string\n\tHost           string\n\tPort           int\n\tAuth           string\n\tDB             int\n\tConnectTimeout int\n\tReadTimeout    int\n\tWriteTimeout   int\n\tMaxActive      int\n\tMaxIdle        int\n\tIsLog          bool\n\tExecTimeout    int64\n}\n\nfunc NewClient(cfg *Config) *redis.Client {\n\treturn redis.NewClient(&redis.Options{\n\t\tAddr: fmt.Sprintf(\"%s:%d\", cfg.Host, cfg.Port),\n\t})\n}\n"
  },
  {
    "path": "library/registry/etcd/discovery.go",
    "content": "package etcd\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"log\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/why444216978/gin-api/library/registry\"\n\n\t\"go.etcd.io/etcd/api/v3/mvccpb\"\n\tclientv3 \"go.etcd.io/etcd/client/v3\"\n)\n\nconst defaultRefreshDuration = time.Second * 10\n\n// EtcdDiscovery 服务发现\ntype EtcdDiscovery struct {\n\tcli             *clientv3.Client\n\tnodeList        map[string]*registry.Node\n\tlock            sync.RWMutex\n\tcmdTimeout      time.Duration\n\tupdateTime      time.Time\n\tdecode          registry.Decode\n\tticker          *time.Ticker\n\trefreshDuration time.Duration\n\tserviceName     string\n}\n\nvar _ registry.Discovery = (*EtcdDiscovery)(nil)\n\ntype DiscoverOption func(*EtcdDiscovery)\n\nfunc WithServierName(serviceName string) DiscoverOption {\n\treturn func(ed *EtcdDiscovery) { ed.serviceName = serviceName }\n}\n\nfunc WithDiscoverClient(cli *clientv3.Client) DiscoverOption {\n\treturn func(ed *EtcdDiscovery) { ed.cli = cli }\n}\n\nfunc WithRefreshDuration(d int) DiscoverOption {\n\treturn func(ed *EtcdDiscovery) { ed.refreshDuration = time.Duration(d) * time.Second }\n}\n\nfunc WithCmdTimeOut(t time.Duration) DiscoverOption {\n\treturn func(ed *EtcdDiscovery) { ed.cmdTimeout = t }\n}\n\n// NewDiscovery\nfunc NewDiscovery(opts ...DiscoverOption) (registry.Discovery, error) {\n\ted := &EtcdDiscovery{\n\t\tnodeList: make(map[string]*registry.Node),\n\t\tdecode:   JSONDecode,\n\t}\n\n\tfor _, o := range opts {\n\t\to(ed)\n\t}\n\n\tif ed.serviceName == \"\" {\n\t\treturn nil, errors.New(\"serviceName is nil\")\n\t}\n\n\tif ed.cli == nil {\n\t\treturn nil, errors.New(\"cli is nil\")\n\t}\n\n\tif ed.cmdTimeout == 0 {\n\t\ted.cmdTimeout = time.Second * 3\n\t}\n\n\tif err := ed.init(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ed, nil\n}\n\n// GetNodes\nfunc (s *EtcdDiscovery) GetNodes() []*registry.Node {\n\ts.lock.RLock()\n\tdefer s.lock.RUnlock()\n\tnodes := make([]*registry.Node, 0)\n\n\tfor _, node := range s.nodeList {\n\t\tnodes = append(nodes, node)\n\t}\n\treturn nodes\n}\n\n// GetUpdateTime\nfunc (s *EtcdDiscovery) GetUpdateTime() time.Time {\n\treturn s.updateTime\n}\n\n// Close\nfunc (s *EtcdDiscovery) Close() error {\n\tif s.ticker != nil {\n\t\ts.ticker.Stop()\n\t}\n\tif s.cli != nil {\n\t\ts.cli.Close()\n\t}\n\treturn nil\n}\n\n// WatchService\nfunc (s *EtcdDiscovery) init() error {\n\t// set all nodes\n\ts.setNodes()\n\n\t// start etcd watcher\n\tgo s.watcher()\n\n\t// start refresh ticker\n\tgo s.refresh()\n\n\treturn nil\n}\n\n// loadKVs\nfunc (s *EtcdDiscovery) loadKVs() (kvs []*mvccpb.KeyValue) {\n\tctx, cancel := s.context()\n\tdefer cancel()\n\n\tresp, err := s.cli.Get(ctx, s.serviceName, clientv3.WithPrefix())\n\tif err != nil {\n\t\ts.logErr(\"get by prefix\", s.serviceName, \"\", err)\n\t\treturn\n\t}\n\tkvs = resp.Kvs\n\treturn\n}\n\n// watcher\nfunc (s *EtcdDiscovery) watcher() {\n\tctx, cancel := s.context()\n\tdefer cancel()\n\n\trch := s.cli.Watch(ctx, s.serviceName, clientv3.WithPrefix())\n\ts.log(\"Watch\", \"\")\n\tfor wresp := range rch {\n\t\tfor _, ev := range wresp.Events {\n\t\t\tkey := string(ev.Kv.Key)\n\t\t\tval := string(ev.Kv.Value)\n\n\t\t\tswitch ev.Type {\n\t\t\tcase mvccpb.PUT:\n\t\t\t\tnode, err := s.decode(val)\n\t\t\t\tif err != nil {\n\t\t\t\t\ts.logErr(\"decode val\", key, val, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\ts.setNode(key, node)\n\t\t\t\ts.log(\"mvccpb.PUT\", key)\n\t\t\tcase mvccpb.DELETE:\n\t\t\t\ts.delNode(key)\n\t\t\t\ts.log(\"mvccpb.DELETE\", key)\n\t\t\t}\n\t\t}\n\t}\n}\n\n// refresh\nfunc (s *EtcdDiscovery) refresh() {\n\tif s.refreshDuration == -1 {\n\t\treturn\n\t}\n\n\tif s.refreshDuration == 0 {\n\t\ts.refreshDuration = defaultRefreshDuration\n\t}\n\n\ts.ticker = time.NewTicker(s.refreshDuration)\n\tfor range s.ticker.C {\n\t\ts.setNodes()\n\t\ts.log(\"refresh\", \"all\")\n\t}\n}\n\n// setNodes\nfunc (s *EtcdDiscovery) setNodes() {\n\tnodeList := make(map[string]*registry.Node)\n\tkvs := s.loadKVs()\n\tfor _, kv := range kvs {\n\t\tkey := string(kv.Key)\n\t\tval := string(kv.Value)\n\n\t\tnode, err := s.decode(val)\n\t\tif err != nil {\n\t\t\ts.logErr(\"decode val\", key, val, err)\n\t\t\tcontinue\n\t\t}\n\t\tnodeList[key] = node\n\t}\n\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\ts.nodeList = nodeList\n\ts.updateTime = time.Now()\n}\n\n// setNode\nfunc (s *EtcdDiscovery) setNode(key string, node *registry.Node) {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\ts.nodeList[key] = node\n\ts.updateTime = time.Now()\n}\n\n// delNode\nfunc (s *EtcdDiscovery) delNode(key string) {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\tdelete(s.nodeList, key)\n\ts.updateTime = time.Now()\n}\n\nfunc (s *EtcdDiscovery) logErr(action, key, val string, err error) {\n\tlog.Printf(\"[%s]: action:%s, err:%s, service:%s, key:%s, val:%s\\n\", time.Now().Format(\"2006-01-02 15:04:05\"), action, s.serviceName, key, val, err.Error())\n}\n\nfunc (s *EtcdDiscovery) log(action, key string) {\n\tlog.Printf(\"[%s]: [action:%s, service:%s, key:%s]\\n\", time.Now().Format(\"2006-01-02 15:04:05\"), action, s.serviceName, key)\n}\n\nfunc (s *EtcdDiscovery) context() (context.Context, context.CancelFunc) {\n\treturn context.WithTimeout(context.Background(), s.cmdTimeout)\n}\n\nfunc JSONDecode(val string) (*registry.Node, error) {\n\tnode := &registry.Node{}\n\terr := json.Unmarshal([]byte(val), node)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Unmarshal val \" + err.Error())\n\t}\n\n\treturn node, nil\n}\n"
  },
  {
    "path": "library/registry/etcd/registrar.go",
    "content": "package etcd\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\n\t\"github.com/why444216978/gin-api/library/registry\"\n\n\tclientv3 \"go.etcd.io/etcd/client/v3\"\n)\n\n// EtcdRegistrar\ntype EtcdRegistrar struct {\n\tserviceName   string\n\thost          string\n\tport          int\n\tcli           *clientv3.Client\n\tleaseID       clientv3.LeaseID\n\tkeepAliveChan <-chan *clientv3.LeaseKeepAliveResponse\n\tkey           string\n\tval           string\n\tlease         int64\n\tencode        registry.Encode\n}\n\nvar _ registry.Registrar = (*EtcdRegistrar)(nil)\n\ntype RegistrarOption func(*EtcdRegistrar)\n\nfunc WithRegistrarClient(cli *clientv3.Client) RegistrarOption {\n\treturn func(er *EtcdRegistrar) { er.cli = cli }\n}\n\nfunc WithRegistrarServiceName(serviceName string) RegistrarOption {\n\treturn func(er *EtcdRegistrar) { er.serviceName = serviceName }\n}\n\nfunc WithRegistarHost(host string) RegistrarOption {\n\treturn func(er *EtcdRegistrar) { er.host = host }\n}\n\nfunc WithRegistarPort(port int) RegistrarOption {\n\treturn func(er *EtcdRegistrar) { er.port = port }\n}\n\nfunc WithRegistrarLease(lease int64) RegistrarOption {\n\treturn func(er *EtcdRegistrar) { er.lease = lease }\n}\n\n// NewRegistry\nfunc NewRegistry(opts ...RegistrarOption) (*EtcdRegistrar, error) {\n\tvar err error\n\n\tr := &EtcdRegistrar{\n\t\tencode: JSONEncode,\n\t}\n\n\tfor _, o := range opts {\n\t\to(r)\n\t}\n\n\tr.key = fmt.Sprintf(\"%s.%s.%d\", r.serviceName, r.host, r.port)\n\n\tif r.val, err = r.encode(&registry.Node{\n\t\tHost: r.host,\n\t\tPort: r.port,\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r, nil\n}\n\nfunc (s *EtcdRegistrar) Register(ctx context.Context) error {\n\tif s.cli == nil {\n\t\treturn errors.New(\"cli is nil\")\n\t}\n\n\t// 申请租约设置时间keepalive\n\tif err := s.putKeyWithRegistrarLease(ctx, s.lease); err != nil {\n\t\treturn err\n\t}\n\n\t// 监听续租相应chan\n\tgo s.listenLeaseRespChan()\n\n\treturn nil\n}\n\n// putKeyWithRegistrarLease\nfunc (s *EtcdRegistrar) putKeyWithRegistrarLease(ctx context.Context, lease int64) error {\n\t// 设置租约时间\n\tresp, err := s.cli.Grant(ctx, lease)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// 注册服务并绑定租约\n\t_, err = s.cli.Put(ctx, s.key, s.val, clientv3.WithLease(resp.ID))\n\tif err != nil {\n\t\treturn err\n\t}\n\t// 设置续租 定期发送需求请求\n\tleaseRespChan, err := s.cli.KeepAlive(context.Background(), resp.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.leaseID = resp.ID\n\ts.keepAliveChan = leaseRespChan\n\treturn nil\n}\n\n// listenLeaseRespChan\nfunc (s *EtcdRegistrar) listenLeaseRespChan() {\n\tfor leaseKeepResp := range s.keepAliveChan {\n\t\t_ = leaseKeepResp\n\t\t// log.Println(\"续租：\", leaseKeepResp)\n\t}\n}\n\n// Close\nfunc (s *EtcdRegistrar) DeRegister(ctx context.Context) error {\n\t// 撤销租约\n\tif _, err := s.cli.Revoke(ctx, s.leaseID); err != nil {\n\t\treturn err\n\t}\n\treturn s.cli.Close()\n}\n\nfunc JSONEncode(node *registry.Node) (string, error) {\n\tval, err := json.Marshal(node)\n\tif err != nil {\n\t\treturn \"\", errors.New(\"marshal node \" + err.Error())\n\t}\n\n\treturn string(val), nil\n}\n"
  },
  {
    "path": "library/registry/registry.go",
    "content": "package registry\n\nimport (\n\t\"context\"\n\t\"time\"\n)\n\ntype Node struct {\n\tHost   string\n\tPort   int\n\tWeight int //TODO support service weight\n}\n\ntype RegistryConfig struct {\n\tLease int64\n}\n\n// Registrar is service registrar\ntype Registrar interface {\n\tRegister(ctx context.Context) error\n\tDeRegister(ctx context.Context) error\n}\n\n// Discovery is service discovery\ntype Discovery interface {\n\tGetNodes() []*Node\n\tGetUpdateTime() time.Time\n\tClose() error\n}\n\n// Encode func is encode service node info\ntype Encode func(node *Node) (string, error)\n\n// Decode func is decode service node info\ntype Decode func(val string) (*Node, error)\n\nvar Services = make(map[string]Discovery)\n"
  },
  {
    "path": "library/reliablequeue/reliablequeue.go",
    "content": "package reliablequeue\n\nimport (\n\t\"context\"\n\t\"math\"\n\t\"time\"\n\n\t\"github.com/pkg/errors\"\n\t\"golang.org/x/sync/errgroup\"\n\t\"gorm.io/gorm\"\n\n\t\"github.com/why444216978/go-util/assert\"\n\t\"github.com/why444216978/go-util/conversion\"\n\t\"github.com/why444216978/go-util/orm\"\n\t\"github.com/why444216978/go-util/snowflake\"\n\n\t\"github.com/why444216978/gin-api/library/queue\"\n)\n\nvar (\n\tdefaultFirstDelaySecond         time.Duration = 10\n\tdefaultRetryDelaySecondMultiple int64         = 2\n)\n\ntype ReliableQueue struct {\n\topt   *Option\n\tqueue queue.Queue\n}\n\ntype Option struct {\n\tFirstDelaySecond         time.Duration // 发布时退避秒数\n\tRetryDelaySecondMultiple int64         // 重试退避倍数\n}\n\ntype ReliableQueueOption func(*Option)\n\nfunc defaultOption() *Option {\n\treturn &Option{\n\t\tFirstDelaySecond:         defaultFirstDelaySecond,\n\t\tRetryDelaySecondMultiple: defaultRetryDelaySecondMultiple,\n\t}\n}\n\nfunc WithFirstDelaySecond(t time.Duration) ReliableQueueOption {\n\treturn func(o *Option) {\n\t\to.FirstDelaySecond = t\n\t}\n}\n\nfunc WithRetryDelaySecondMultiple(i int64) ReliableQueueOption {\n\treturn func(o *Option) {\n\t\to.RetryDelaySecondMultiple = i\n\t}\n}\n\nfunc NewReliableQueue(q queue.Queue, opts ...ReliableQueueOption) (*ReliableQueue, error) {\n\tif assert.IsNil(q) {\n\t\treturn nil, errors.New(\"Queue is nil\")\n\t}\n\n\topt := defaultOption()\n\tfor _, o := range opts {\n\t\to(opt)\n\t}\n\n\trq := &ReliableQueue{\n\t\tqueue: q,\n\t\topt:   opt,\n\t}\n\n\treturn rq, nil\n}\n\n// PublishParams 发布消息方法参数\ntype PublishParams struct {\n\tLogID string\n\tScene string\n\tData  map[string]interface{}\n}\n\n// Publish 发布消息，注意此方法在本地事务最后一步调用，会自动提交事务\nfunc (rq *ReliableQueue) Publish(ctx context.Context, tx *gorm.DB, msg PublishParams) (err error) {\n\tif tx == nil {\n\t\treturn errors.New(\"tx is nil\")\n\t}\n\n\t// 根据scene获取对应分发列表\n\tdistributeList, err := rq.getDistributeList(ctx, tx, msg)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// 生成消息\n\trecord := ReliableMqMessageRecord{}\n\trecords := []ReliableMqMessageRecord{}\n\tfor _, v := range distributeList {\n\t\trecord, err = rq.generateMessage(ctx, tx, v, msg)\n\t\tif err != nil {\n\t\t\ttx.Rollback()\n\t\t\treturn\n\t\t}\n\t\trecords = append(records, record)\n\t}\n\n\t// 本地事务提交\n\tif err = tx.Commit().Error; err != nil {\n\t\terr = errors.Wrap(err, \"reliablequeue Publish tx.Commit err\")\n\t\treturn\n\t}\n\n\t// 并行分发消息\n\treturn rq.publish(ctx, records)\n}\n\n// generateMessage 生成消息表记录\nfunc (rq *ReliableQueue) generateMessage(ctx context.Context, tx *gorm.DB, messageDistribute ReliableMqMessageDistribute, msg PublishParams) (record ReliableMqMessageRecord, err error) {\n\tuuid := snowflake.Generate().String()\n\n\tmsg.Data[\"uuid\"] = uuid\n\tb, err := conversion.JsonEncode(msg.Data)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"reliablequeue generateMessage conversion.JsonEncode err\")\n\t\treturn\n\t}\n\n\trecord = ReliableMqMessageRecord{\n\t\tMessageId:           messageDistribute.MessageId,\n\t\tMessageDistributeId: messageDistribute.Id,\n\t\tLogId:               msg.LogID,\n\t\tUuid:                uuid,\n\t\tServiceName:         messageDistribute.ServiceName,\n\t\tUri:                 messageDistribute.Uri,\n\t\tMethod:              messageDistribute.Method,\n\t\tBody:                string(b),\n\t\tNextTime:            time.Now().Add(time.Second * rq.opt.FirstDelaySecond),\n\t}\n\tif _, err = orm.Insert(ctx, tx, &record); err != nil {\n\t\terr = errors.Wrap(err, \"reliablequeue generateMessage orm.Insert err\")\n\t\treturn\n\t}\n\n\treturn\n}\n\n// getDistributeList 获得分发列表\nfunc (rq *ReliableQueue) getDistributeList(ctx context.Context, tx *gorm.DB, msg PublishParams) (distributeList []ReliableMqMessageDistribute, err error) {\n\twhere := map[string]interface{}{\"scene\": msg.Scene}\n\ttx = tx.WithContext(ctx).Select(\"*\")\n\tif err = orm.WithWhere(ctx, tx, where).Find(&distributeList).Error; err != nil {\n\t\terr = errors.Wrap(err, \"reliablequeue getDistributeList err\")\n\t\treturn\n\t}\n\treturn\n}\n\n// Retry 消费失败退避重试\nfunc (rq *ReliableQueue) Retry(ctx context.Context, tx *gorm.DB, record ReliableMqMessageRecord) (err error) {\n\tdelay := record.Delay * rq.opt.RetryDelaySecondMultiple\n\tif delay >= math.MaxInt64 || delay < 1 {\n\t\tdelay = math.MaxInt64\n\t}\n\n\tt := time.Now()\n\twhere := map[string]interface{}{\"uuid\": record.Uuid}\n\tupdate := map[string]interface{}{\n\t\t\"delay\":       delay,\n\t\t\"retry_time\":  t,\n\t\t\"next_time\":   t.Add(time.Second * time.Duration(delay)),\n\t\t\"update_time\": t,\n\t}\n\tif _, err = orm.Update(ctx, tx, &ReliableMqMessageRecord{}, where, update); err != nil {\n\t\terr = errors.Wrap(err, \"reliablequeue Retry orm.Update err\")\n\t\treturn\n\t}\n\n\treturn\n}\n\n// Republish 重新发布，一般用离线任务调用\nfunc (rq *ReliableQueue) Republish(ctx context.Context, tx *gorm.DB) (err error) {\n\trecords, err := rq.getUnsuccessRecords(ctx, tx)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn rq.publish(ctx, records)\n}\n\n// getUnsuccessRecords 获得未成功的记录列表\nfunc (rq *ReliableQueue) getUnsuccessRecords(ctx context.Context, tx *gorm.DB) (records []ReliableMqMessageRecord, err error) {\n\twhere := map[string]interface{}{\n\t\torm.FormatEq(\"is_success\"): RecordStatusUnsuccess,\n\t\torm.FormatLt(\"next_time\"):  time.Now(),\n\t}\n\ttx = tx.WithContext(ctx).Select(\"*\")\n\tif err = orm.WithWhere(ctx, tx, where).Find(&records).Error; err != nil {\n\t\terr = errors.Wrap(err, \"reliablequeue getUnsuccessRecords err\")\n\t\treturn\n\t}\n\treturn\n}\n\n// publish 分发消息\nfunc (rq *ReliableQueue) publish(ctx context.Context, records []ReliableMqMessageRecord) error {\n\tg, _ := errgroup.WithContext(ctx)\n\tfor _, v := range records {\n\t\trecord := v\n\t\tg.Go(func() (err error) {\n\t\t\treturn rq.queue.Produce(ctx, record)\n\t\t})\n\t}\n\treturn g.Wait()\n}\n\n// SetSuccess 消费完成后标记成功\nfunc (rq *ReliableQueue) SetSuccess(ctx context.Context, tx *gorm.DB, record ReliableMqMessageRecord) (err error) {\n\twhere := map[string]interface{}{\"uuid\": record.Uuid}\n\tupdate := map[string]interface{}{\"is_success\": RecordStatusSuccess}\n\tif _, err = orm.Update(ctx, tx, &ReliableMqMessageRecord{}, where, update); err != nil {\n\t\terr = errors.Wrap(err, \"reliablequeue SetSuccess orm.Update err\")\n\t\treturn\n\t}\n\n\treturn\n}\n"
  },
  {
    "path": "library/reliablequeue/reliablequeue_test.go",
    "content": "package reliablequeue\n\nimport (\n\t\"context\"\n\t\"math\"\n\t\"testing\"\n\t\"time\"\n\n\t. \"github.com/smartystreets/goconvey/convey\"\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/why444216978/go-util/orm\"\n\t\"gorm.io/gorm\"\n\n\t\"github.com/why444216978/gin-api/library/queue\"\n)\n\ntype Queue struct{}\n\nfunc (*Queue) Produce(ctx context.Context, msg interface{}, opts ...queue.ProduceOptionFunc) error {\n\treturn nil\n}\n\nfunc (*Queue) Consume(consumer queue.Consumer) {}\n\nfunc (*Queue) Shutdown() error { return nil }\n\nfunc createTable() (db *gorm.DB, err error) {\n\tdb = orm.NewMemoryDB()\n\tif err = db.Migrator().CreateTable(&ReliableMqMessage{}); err != nil {\n\t\treturn\n\t}\n\tif err = db.Migrator().CreateTable(&ReliableMqMessageDistribute{}); err != nil {\n\t\treturn\n\t}\n\tif err = db.Migrator().CreateTable(&ReliableMqMessageRecord{}); err != nil {\n\t\treturn\n\t}\n\treturn\n}\n\nfunc Test_defaultOption(t *testing.T) {\n\tConvey(\"Test_defaultOption\", t, func() {\n\t\tConvey(\"success\", func() {\n\t\t\topt := defaultOption()\n\t\t\tassert.Equal(t, opt.FirstDelaySecond, defaultFirstDelaySecond)\n\t\t\tassert.Equal(t, opt.RetryDelaySecondMultiple, defaultRetryDelaySecondMultiple)\n\t\t})\n\t})\n}\n\nfunc TestNewReliableQueue(t *testing.T) {\n\tConvey(\"TestNewReliableQueue\", t, func() {\n\t\tConvey(\"success\", func() {\n\t\t\trq, err := NewReliableQueue(&Queue{}, WithFirstDelaySecond(time.Second*10), WithRetryDelaySecondMultiple(int64(10)))\n\t\t\tassert.Nil(t, err)\n\t\t\tassert.NotNil(t, rq)\n\t\t})\n\t\tConvey(\"Queue is nil\", func() {\n\t\t\trq, err := NewReliableQueue(nil)\n\t\t\tassert.Nil(t, rq)\n\t\t\tassert.Equal(t, err.Error(), \"Queue is nil\")\n\t\t})\n\t})\n}\n\nfunc TestReliableQueue_Publish(t *testing.T) {\n\tConvey(\"TestReliableQueue_Publish\", t, func() {\n\t\tConvey(\"success\", func() {\n\t\t\tdb, err := createTable()\n\t\t\tassert.Equal(t, err, nil)\n\t\t\tdefer orm.CloseMemoryDB(db)\n\n\t\t\tdistrubute := &ReliableMqMessageDistribute{\n\t\t\t\tScene:       \"test\",\n\t\t\t\tMessageId:   1,\n\t\t\t\tServiceName: \"test\",\n\t\t\t\tUri:         \"/test\",\n\t\t\t\tMethod:      \"POST\",\n\t\t\t}\n\t\t\terr = db.Create(distrubute).Error\n\t\t\tassert.Nil(t, err)\n\n\t\t\trq, err := NewReliableQueue(&Queue{})\n\t\t\tassert.Nil(t, err)\n\n\t\t\tmsg := PublishParams{\n\t\t\t\tLogID: \"logId\",\n\t\t\t\tScene: \"test\",\n\t\t\t\tData:  map[string]interface{}{\"a\": \"a\"},\n\t\t\t}\n\t\t\terr = rq.Publish(context.Background(), db.Begin(), msg)\n\t\t\tassert.Nil(t, err)\n\n\t\t\trecords := []ReliableMqMessageRecord{}\n\t\t\terr = db.Select(\"*\").Where(\"message_distribute_id\", distrubute.Id).Find(&records).Error\n\t\t\tassert.Nil(t, err)\n\t\t\tassert.Equal(t, len(records), 1)\n\t\t})\n\t\tConvey(\"tx is nil\", func() {\n\t\t\trq, err := NewReliableQueue(&Queue{})\n\t\t\tassert.Equal(t, err, nil)\n\n\t\t\tmsg := PublishParams{\n\t\t\t\tLogID: \"logId\",\n\t\t\t\tScene: \"test\",\n\t\t\t\tData:  map[string]interface{}{\"a\": \"a\"},\n\t\t\t}\n\t\t\terr = rq.Publish(context.Background(), nil, msg)\n\t\t\tassert.Equal(t, err.Error(), \"tx is nil\")\n\t\t})\n\t})\n}\n\nfunc TestReliableQueue_generateMessage(t *testing.T) {\n\tConvey(\"TestReliableQueue_generateMessage\", t, func() {\n\t\tConvey(\"success\", func() {\n\t\t\tdb, err := createTable()\n\t\t\tassert.Nil(t, err)\n\t\t\tdefer orm.CloseMemoryDB(db)\n\n\t\t\trq, err := NewReliableQueue(&Queue{})\n\t\t\tassert.Nil(t, err)\n\n\t\t\tdistrubute := ReliableMqMessageDistribute{\n\t\t\t\tScene:       \"test\",\n\t\t\t\tMessageId:   1,\n\t\t\t\tServiceName: \"test\",\n\t\t\t\tUri:         \"/test\",\n\t\t\t\tMethod:      \"POST\",\n\t\t\t}\n\t\t\tmsg := PublishParams{\n\t\t\t\tLogID: \"logId\",\n\t\t\t\tScene: \"test\",\n\t\t\t\tData:  map[string]interface{}{\"a\": \"a\"},\n\t\t\t}\n\t\t\trecord, err := rq.generateMessage(context.Background(), db, distrubute, msg)\n\t\t\tassert.Nil(t, err)\n\t\t\tassert.Equal(t, record.MessageId, distrubute.MessageId)\n\t\t\tassert.Equal(t, record.MessageDistributeId, distrubute.Id)\n\t\t\tassert.Equal(t, record.LogId, msg.LogID)\n\t\t\tassert.Equal(t, record.ServiceName, distrubute.ServiceName)\n\t\t\tassert.Equal(t, record.Uri, distrubute.Uri)\n\t\t\tassert.Equal(t, record.Method, distrubute.Method)\n\t\t})\n\t})\n}\n\nfunc TestReliableQueue_getDistributeList(t *testing.T) {\n\tConvey(\"TestReliableQueue_getDistributeList\", t, func() {\n\t\tConvey(\"success\", func() {\n\t\t\tdb, err := createTable()\n\t\t\tassert.Equal(t, err, nil)\n\t\t\tdefer orm.CloseMemoryDB(db)\n\n\t\t\tdistrubute := &ReliableMqMessageDistribute{\n\t\t\t\tScene:       \"test\",\n\t\t\t\tMessageId:   1,\n\t\t\t\tServiceName: \"test\",\n\t\t\t\tUri:         \"/test\",\n\t\t\t\tMethod:      \"POST\",\n\t\t\t}\n\t\t\terr = db.Create(distrubute).Error\n\t\t\tassert.Nil(t, err)\n\n\t\t\trq, err := NewReliableQueue(&Queue{})\n\t\t\tassert.Nil(t, err)\n\n\t\t\tmsg := PublishParams{\n\t\t\t\tLogID: \"logId\",\n\t\t\t\tScene: \"test\",\n\t\t\t\tData:  map[string]interface{}{\"a\": \"a\"},\n\t\t\t}\n\t\t\tdistributeList, err := rq.getDistributeList(context.Background(), db, msg)\n\t\t\tassert.Nil(t, err)\n\t\t\tassert.Equal(t, len(distributeList), 1)\n\t\t\tfor _, v := range distributeList {\n\t\t\t\tassert.Equal(t, v.Scene, distrubute.Scene)\n\t\t\t}\n\t\t})\n\t})\n}\n\nfunc TestReliableQueue_Retry(t *testing.T) {\n\tConvey(\"TestReliableQueue_Retry\", t, func() {\n\t\tConvey(\"success\", func() {\n\t\t\tdb, err := createTable()\n\t\t\tassert.Nil(t, err)\n\t\t\tdefer orm.CloseMemoryDB(db)\n\n\t\t\trecord := &ReliableMqMessageRecord{\n\t\t\t\tUuid:  \"uuid\",\n\t\t\t\tDelay: 60,\n\t\t\t}\n\t\t\terr = db.Create(record).Error\n\t\t\tassert.Nil(t, err)\n\n\t\t\trq, err := NewReliableQueue(&Queue{})\n\t\t\tassert.Nil(t, err)\n\n\t\t\terr = rq.Retry(context.Background(), db, *record)\n\t\t\tassert.Nil(t, err)\n\n\t\t\ttarget := &ReliableMqMessageRecord{}\n\t\t\terr = db.Select(\"*\").Where(\"uuid\", record.Uuid).First(target).Error\n\t\t\tassert.Equal(t, err, nil)\n\t\t\tassert.Equal(t, target.Delay, record.Delay*rq.opt.RetryDelaySecondMultiple)\n\t\t})\n\t\tConvey(\"delay >= math.MaxUint64\", func() {\n\t\t\tdb, err := createTable()\n\t\t\tassert.Nil(t, err)\n\t\t\tdefer orm.CloseMemoryDB(db)\n\n\t\t\trecord := &ReliableMqMessageRecord{\n\t\t\t\tUuid:  \"uuid\",\n\t\t\t\tDelay: math.MaxInt64,\n\t\t\t}\n\t\t\terr = db.Create(record).Error\n\t\t\tassert.Nil(t, err)\n\n\t\t\trq, err := NewReliableQueue(&Queue{})\n\t\t\tassert.Nil(t, err)\n\n\t\t\terr = rq.Retry(context.Background(), db, *record)\n\t\t\tassert.Nil(t, err)\n\n\t\t\ttarget := &ReliableMqMessageRecord{}\n\t\t\terr = db.Select(\"*\").Where(\"uuid\", record.Uuid).First(target).Error\n\t\t\tassert.Nil(t, err)\n\t\t\tassert.Equal(t, target.Delay, int64(math.MaxInt64))\n\t\t})\n\t})\n}\n\nfunc TestReliableQueue_Republish(t *testing.T) {\n\tConvey(\"TestReliableQueue_Republish\", t, func() {\n\t\tConvey(\"success\", func() {\n\t\t\tdb, err := createTable()\n\t\t\tassert.Nil(t, err)\n\t\t\tdefer orm.CloseMemoryDB(db)\n\n\t\t\trecord := &ReliableMqMessageRecord{\n\t\t\t\tUuid:      \"uuid\",\n\t\t\t\tDelay:     60,\n\t\t\t\tNextTime:  time.Now().Add(-time.Minute),\n\t\t\t\tIsSuccess: RecordStatusUnsuccess,\n\t\t\t}\n\t\t\terr = db.Create(record).Error\n\t\t\tassert.Nil(t, err)\n\n\t\t\trq, err := NewReliableQueue(&Queue{})\n\t\t\tassert.Nil(t, err)\n\n\t\t\terr = rq.Republish(context.Background(), db)\n\t\t\tassert.Nil(t, err)\n\t\t})\n\t})\n}\n\nfunc TestReliableQueue_getUnsuccessRecords(t *testing.T) {\n\tConvey(\"TestReliableQueue_getUnsuccessRecords\", t, func() {\n\t\tConvey(\"success\", func() {\n\t\t\tdb, err := createTable()\n\t\t\tassert.Nil(t, err)\n\t\t\tdefer orm.CloseMemoryDB(db)\n\n\t\t\trecord := &ReliableMqMessageRecord{\n\t\t\t\tUuid:      \"uuid\",\n\t\t\t\tNextTime:  time.Now().Add(-time.Minute),\n\t\t\t\tIsSuccess: RecordStatusUnsuccess,\n\t\t\t}\n\t\t\terr = db.Create(record).Error\n\t\t\tassert.Nil(t, err)\n\n\t\t\trq, err := NewReliableQueue(&Queue{})\n\t\t\tassert.Nil(t, err)\n\n\t\t\trecords, err := rq.getUnsuccessRecords(context.Background(), db)\n\t\t\tassert.Nil(t, err)\n\n\t\t\tfor _, v := range records {\n\t\t\t\tassert.Equal(t, v.IsSuccess, RecordStatusUnsuccess)\n\t\t\t}\n\t\t})\n\t})\n}\n\nfunc TestReliableQueue_publish(t *testing.T) {\n\tConvey(\"TestReliableQueue_publish\", t, func() {\n\t\tConvey(\"success\", func() {\n\t\t\tdb, err := createTable()\n\t\t\tassert.Nil(t, err)\n\t\t\tdefer orm.CloseMemoryDB(db)\n\n\t\t\trq, err := NewReliableQueue(&Queue{})\n\t\t\tassert.Nil(t, err)\n\n\t\t\trecords := []ReliableMqMessageRecord{\n\t\t\t\t{\n\t\t\t\t\tUuid:      \"uuid\",\n\t\t\t\t\tDelay:     60,\n\t\t\t\t\tIsSuccess: RecordStatusUnsuccess,\n\t\t\t\t},\n\t\t\t}\n\t\t\terr = rq.publish(context.Background(), records)\n\t\t\tassert.Nil(t, err)\n\t\t})\n\t})\n}\n\nfunc TestReliableQueue_SetSuccess(t *testing.T) {\n\tConvey(\"TestReliableQueue_SetSuccess\", t, func() {\n\t\tConvey(\"success\", func() {\n\t\t\tdb, err := createTable()\n\t\t\tassert.Nil(t, err)\n\t\t\tdefer orm.CloseMemoryDB(db)\n\n\t\t\trecord := &ReliableMqMessageRecord{\n\t\t\t\tUuid:      \"uuid\",\n\t\t\t\tIsSuccess: RecordStatusUnsuccess,\n\t\t\t}\n\t\t\terr = db.Create(record).Error\n\t\t\tassert.Nil(t, err)\n\n\t\t\trq, err := NewReliableQueue(&Queue{})\n\t\t\tassert.Nil(t, err)\n\n\t\t\terr = rq.SetSuccess(context.Background(), db, *record)\n\t\t\tassert.Nil(t, err)\n\n\t\t\ttarget := &ReliableMqMessageRecord{}\n\t\t\terr = db.Select(\"*\").Where(\"uuid\", record.Uuid).First(target).Error\n\t\t\tassert.Nil(t, err)\n\t\t\tassert.Equal(t, target.IsSuccess, RecordStatusSuccess)\n\t\t})\n\t})\n}\n"
  },
  {
    "path": "library/reliablequeue/table.go",
    "content": "package reliablequeue\n\nimport \"time\"\n\nconst (\n\tRecordStatusUnsuccess uint8 = 0\n\tRecordStatusSuccess   uint8 = 1\n)\n\n// ReliableMqMessage 消息实体表\ntype ReliableMqMessage struct {\n\tId         uint64    `gorm:\"column:id\" json:\"id\"`                   // 主键id\n\tCreateUser string    `gorm:\"column:create_user\" json:\"create_user\"` // 创建方标识\n\tCreateTime time.Time `gorm:\"column:create_time\" json:\"create_time\"` // 创建时间\n\tUpdateUser string    `gorm:\"column:update_user\" json:\"update_user\"` // 更新方标识\n\tUpdateTime time.Time `gorm:\"column:update_time\" json:\"update_time\"` // 更新时间\n\tVersion    uint      `gorm:\"column:version\" json:\"version\"`         // 版本号\n\tIsDel      uint8     `gorm:\"column:is_del\" json:\"is_del\"`           // 0-未删除，1-已删除\n\tScene      string    `gorm:\"column:scene\" json:\"scene\"`             // 唯一消息scene\n\tSceneDesc  string    `gorm:\"column:scene_desc\" json:\"scene_desc\"`   // 描述信息\n}\n\nfunc (ReliableMqMessage) TableName() string {\n\treturn \"reliable_mq_message\"\n}\n\n// ReliableMqMessageDistribute 消息分发关联表\ntype ReliableMqMessageDistribute struct {\n\tId          uint64    `gorm:\"column:id\" json:\"id\"`                     // 主键id\n\tCreateUser  string    `gorm:\"column:create_user\" json:\"create_user\"`   // 创建方标识\n\tCreateTime  time.Time `gorm:\"column:create_time\" json:\"create_time\"`   // 创建时间\n\tUpdateUser  string    `gorm:\"column:update_user\" json:\"update_user\"`   // 更新方标识\n\tUpdateTime  time.Time `gorm:\"column:update_time\" json:\"update_time\"`   // 更新时间\n\tVersion     uint      `gorm:\"column:version\" json:\"version\"`           // 版本号\n\tIsDel       uint8     `gorm:\"column:is_del\" json:\"is_del\"`             // 0-未删除，1-已删除\n\tMessageId   uint64    `gorm:\"column:message_id\" json:\"message_id\"`     // 关联message表主键id\n\tScene       string    `gorm:\"column:scene\" json:\"scene\"`               // 关联message表scene\n\tServiceName string    `gorm:\"column:service_name\" json:\"service_name\"` // service_name\n\tUri         string    `gorm:\"column:uri\" json:\"uri\"`                   // uri\n\tMethod      string    `gorm:\"column:method\" json:\"method\"`             // http method\n}\n\nfunc (ReliableMqMessageDistribute) TableName() string {\n\treturn \"reliable_mq_message_distribute\"\n}\n\n// ReliableMqMessageRecord 业务侧可靠消息表\ntype ReliableMqMessageRecord struct {\n\tId                  uint64    `gorm:\"column:id\" json:\"id\"`                                       // 主键id\n\tCreateUser          string    `gorm:\"column:create_user\" json:\"create_user\"`                     // 创建方标识\n\tCreateTime          time.Time `gorm:\"column:create_time\" json:\"create_time\"`                     // 创建时间\n\tUpdateUser          string    `gorm:\"column:update_user\" json:\"update_user\"`                     // 更新方标识\n\tUpdateTime          time.Time `gorm:\"column:update_time\" json:\"update_time\"`                     // 更新时间\n\tVersion             uint      `gorm:\"column:version\" json:\"version\"`                             // 版本号\n\tIsDel               uint8     `gorm:\"column:is_del\" json:\"is_del\"`                               // 0-未删除，1-已删除\n\tMessageId           uint64    `gorm:\"column:message_id\" json:\"message_id\"`                       // 关联message表主键id\n\tMessageDistributeId uint64    `gorm:\"column:message_distribute_id\" json:\"message_distribute_id\"` // 关联reliable_mq_message_distribute表主键id\n\tLogId               string    `gorm:\"column:log_id\" json:\"log_id\"`                               // 消息产生的log_id\n\tUuid                string    `gorm:\"column:uuid\" json:\"uuid\"`                                   // 消息唯一id\n\tServiceName         string    `gorm:\"column:service_name\" json:\"service_name\"`                   // service_name\n\tUri                 string    `gorm:\"column:uri\" json:\"uri\"`                                     // uri\n\tMethod              string    `gorm:\"column:method\" json:\"method\"`                               // http method\n\tBody                string    `gorm:\"column:body\" json:\"body\"`                                   // 请求body\n\tDelay               int64     `gorm:\"column:delay\" json:\"delay\"`                                 // 重试间隔\n\tRetryTime           time.Time `gorm:\"column:retry_time\" json:\"retry_time\"`                       // 最后一次重试时间\n\tNextTime            time.Time `gorm:\"column:next_time\" json:\"next_time\"`                         // 下次重试时间\n\tIsSuccess           uint8     `gorm:\"column:is_success\" json:\"is_success\"`                       // 是否消费成功\n}\n\nfunc (ReliableMqMessageRecord) TableName() string {\n\treturn \"reliable_mq_message_record\"\n}\n"
  },
  {
    "path": "library/reliablequeue/table.sql",
    "content": "CREATE TABLE `reliable_mq_message` (\n  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',\n  `create_user` varchar(64) NOT NULL DEFAULT '' COMMENT '创建方标识',\n  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',\n  `update_user` varchar(64) NOT NULL DEFAULT '' COMMENT '更新方标识',\n  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',\n  `version` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '版本号',\n  `is_del` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0-未删除，1-已删除',\n  `scene` varchar(255) NOT NULL COMMENT '唯一消息scene',\n  `scene_desc` varchar(255) NOT NULL COMMENT '描述信息',\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `idx_scene` (`scene`) USING BTREE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='消息实体表';\n\nCREATE TABLE `reliable_mq_message_distribute` (\n  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',\n  `create_user` varchar(64) NOT NULL DEFAULT '' COMMENT '创建方标识',\n  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',\n  `update_user` varchar(64) NOT NULL DEFAULT '' COMMENT '更新方标识',\n  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',\n  `version` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '版本号',\n  `is_del` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0-未删除，1-已删除',\n\n  `message_id` bigint(20) unsigned  NOT NULL COMMENT '关联message表主键id',\n  `scene` varchar(255) NOT NULL COMMENT '唯一消息scene',\n  `bns` varchar(64) NOT NULL COMMENT 'bns',\n  `uri` varchar(255) NOT NULL COMMENT 'uri',\n  `method` varchar(32) NOT NULL COMMENT 'http method',\n  PRIMARY KEY (`id`),\n  KEY `idx_message_id` (`message_id`) USING BTREE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='消息分发关联表';\n\nCREATE TABLE `reliable_mq_message_record` (\n  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',\n  `create_user` varchar(64) NOT NULL DEFAULT '' COMMENT '创建方标识',\n  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',\n  `update_user` varchar(64) NOT NULL DEFAULT '' COMMENT '更新方标识',\n  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',\n  `version` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '版本号',\n  `is_del` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0-未删除，1-已删除',\n\n  `message_id` bigint(20) unsigned NOT NULL COMMENT '关联message表主键id',\n  `message_distribute_id` bigint(20) unsigned NOT NULL COMMENT '关联reliable_mq_message_distribute表主键id',\n\n  `log_id` varchar(64) NOT NULL COMMENT '消息产生的log_id',\n  `uuid` varchar(64) NOT NULL COMMENT '消息唯一id',\n  `bns` varchar(64) NOT NULL COMMENT 'bns',\n  `uri` varchar(255) NOT NULL COMMENT 'uri',\n  `method` varchar(32) NOT NULL COMMENT 'http method',\n  `body` text NOT NULL COMMENT '请求body',\n\n  `delay` bigint(20) unsigned NOT NULL DEFAULT '1' COMMENT '重试间隔',\n  `retry_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后一次重试时间',\n  `next_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '下次重试时间',\n\n  `is_success` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否消费成功',\n  PRIMARY KEY (`id`),\n  KEY `idx_is_success` (`is_success`) USING BTREE,\n  UNIQUE KEY `idx_uuid` (`uuid`) USING BTREE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='业务侧可靠消息表';"
  },
  {
    "path": "library/selector/dwrr/cwrr.go",
    "content": "// dwrr is Dynamic Weighted Round Robin\npackage dwrr\n\n// import (\n// \t\"math\"\n// \t\"sync\"\n\n// \t\"github.com/why444216978/gin-api/library/selector\"\n// )\n\n// const defaultStep float64 = 0.1\n\n// type Node struct {\n// \tlock          sync.RWMutex\n// \taddress       string\n// \tweight        float64\n// \tcurrentWeight float64\n// \tmeta          selector.Meta\n// \tstatistics    selector.Statistics\n// }\n\n// var _ selector.Node = (*Node)(nil)\n\n// func (n *Node) Address() string {\n// \treturn n.address\n// }\n\n// func (n *Node) Meta() selector.Meta {\n// \treturn n.meta\n// }\n\n// func (n *Node) Statistics() selector.Statistics {\n// \tn.lock.RLock()\n// \tdefer n.lock.RUnlock()\n// \treturn n.statistics\n// }\n\n// func (n *Node) Weight() float64 {\n// \treturn n.weight\n// }\n\n// type Selector struct {\n// \tlock        sync.RWMutex\n// \tnodeCount   int\n// \tnodes       map[string]*Node\n// \tlist        []*Node\n// \tstep        float64\n// \tserviceName string\n// }\n\n// var _ selector.Selector = (*Selector)(nil)\n\n// type SelectorOption func(*Selector)\n\n// func WithServiceName(name string) SelectorOption {\n// \treturn func(s *Selector) { s.serviceName = name }\n// }\n\n// func WithStep(step float64) SelectorOption {\n// \treturn func(s *Selector) { s.step = step }\n// }\n\n// func NewSelector(opts ...SelectorOption) *Selector {\n// \ts := &Selector{\n// \t\tnodes: make(map[string]*Node),\n// \t\tlist:  make([]*Node, 0),\n// \t}\n\n// \tfor _, o := range opts {\n// \t\to(s)\n// \t}\n\n// \tif s.step <= 0 {\n// \t\ts.step = defaultStep\n// \t}\n\n// \treturn s\n// }\n\n// func (s *Selector) incrWeight(n *Node) {\n// \tn.lock.Lock()\n// \tdefer n.lock.Unlock()\n\n// \tn.currentWeight = math.Trunc(n.currentWeight*(1+s.step)*1e2+0.5) * 1e-2\n\n// \tif n.currentWeight > n.weight {\n// \t\tn.currentWeight = n.weight\n// \t}\n\n// \treturn\n// }\n\n// func (s *Selector) decreaseWeight(n *Node) {\n// \tn.lock.Lock()\n// \tdefer n.lock.Unlock()\n\n// \tn.currentWeight = math.Trunc(n.currentWeight*(1-s.step)*1e2+0.5) * 1e-2\n\n// \treturn\n// }\n"
  },
  {
    "path": "library/selector/icmp/icmp.go",
    "content": "// icmp is load balance by ping rtt\npackage icmp\n"
  },
  {
    "path": "library/selector/p2c/p2c.go",
    "content": "// p2c is reference https://exceting.github.io/2020/08/13/%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1-P2C%E7%AE%97%E6%B3%95/\npackage p2c\n"
  },
  {
    "path": "library/selector/selector.go",
    "content": "package selector\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\t\"strings\"\n)\n\nconst (\n\tTypeWR   = \"wr\"\n\tTypeWrr  = \"wrr\"\n\tTypeDwrr = \"dwrr\"\n\tTypeP2C  = \"p2c\"\n\tTypeICMP = \"icmp\"\n)\n\ntype Statistics struct {\n\tSuccess uint64\n\tFail    uint64\n}\n\ntype Meta struct{}\n\ntype Node interface {\n\tAddress() string\n\tWeight() int\n\tMeta() Meta\n\tStatistics() Statistics\n}\n\ntype NewNodeFunc func(host string, port, weight int, meta Meta) Node\n\ntype HandleInfo struct {\n\tNode Node\n\tErr  error\n}\n\ntype Selector interface {\n\tServiceName() string\n\tAddNode(node Node) (err error)\n\tDeleteNode(host string, port int) (err error)\n\tGetNodes() (nodes []Node, err error)\n\tGetNode(host string, port int) (node Node, ok bool)\n\tSelect() (node Node, err error)\n\tAfterHandle(address string, err error)\n}\n\nfunc GenerateAddress(host string, port int) string {\n\treturn fmt.Sprintf(\"%s:%d\", host, port)\n}\n\nfunc ExtractAddress(address string) (string, int) {\n\tarr := strings.Split(address, \":\")\n\tif len(arr) != 2 {\n\t\treturn \"\", 0\n\t}\n\n\tport, _ := strconv.Atoi(arr[1])\n\treturn arr[0], port\n}\n"
  },
  {
    "path": "library/selector/wr/wr.go",
    "content": "// wr is Weighted random\npackage wr\n\nimport (\n\t\"errors\"\n\t\"math/rand\"\n\t\"sort\"\n\t\"sync\"\n\n\t\"github.com/why444216978/gin-api/library/selector\"\n)\n\ntype Node struct {\n\tlock       sync.RWMutex\n\taddress    string\n\tweight     int\n\tmeta       selector.Meta\n\tstatistics selector.Statistics\n}\n\nvar (\n\t_ selector.Node        = (*Node)(nil)\n\t_ selector.NewNodeFunc = NewNode\n)\n\nfunc NewNode(host string, port, weight int, meta selector.Meta) selector.Node {\n\treturn &Node{\n\t\taddress:    selector.GenerateAddress(host, port),\n\t\tweight:     weight,\n\t\tmeta:       meta,\n\t\tstatistics: selector.Statistics{},\n\t}\n}\n\nfunc (n *Node) Address() string {\n\treturn n.address\n}\n\nfunc (n *Node) Meta() selector.Meta {\n\treturn n.meta\n}\n\nfunc (n *Node) Statistics() selector.Statistics {\n\tn.lock.RLock()\n\tdefer n.lock.RUnlock()\n\treturn n.statistics\n}\n\nfunc (n *Node) Weight() int {\n\treturn n.weight\n}\n\nfunc (n *Node) incrSuccess() {\n\tn.lock.Lock()\n\tdefer n.lock.Unlock()\n\tn.statistics.Success = n.statistics.Success + 1\n}\n\nfunc (n *Node) incrFail() {\n\tn.lock.Lock()\n\tdefer n.lock.Unlock()\n\tn.statistics.Fail = n.statistics.Fail + 1\n}\n\ntype nodeOffset struct {\n\tAddress     string\n\tWeight      int\n\tOffsetStart int\n\tOffsetEnd   int\n}\n\ntype Selector struct {\n\tlock        sync.RWMutex\n\tnodeCount   int\n\tnodes       map[string]*Node\n\tlist        []*Node\n\toffsetList  []nodeOffset\n\tsameWeight  bool\n\ttotalWeight int\n\tserviceName string\n}\n\nvar _ selector.Selector = (*Selector)(nil)\n\ntype SelectorOption func(*Selector)\n\nfunc WithServiceName(name string) SelectorOption {\n\treturn func(s *Selector) { s.serviceName = name }\n}\n\nfunc NewSelector(opts ...SelectorOption) *Selector {\n\ts := &Selector{\n\t\tnodes:      make(map[string]*Node),\n\t\tlist:       make([]*Node, 0),\n\t\toffsetList: make([]nodeOffset, 0),\n\t}\n\n\tfor _, o := range opts {\n\t\to(s)\n\t}\n\n\treturn s\n}\n\nfunc (s *Selector) ServiceName() string {\n\treturn s.serviceName\n}\n\nfunc (s *Selector) AddNode(node selector.Node) (err error) {\n\taddress := node.Address()\n\tif _, ok := s.nodes[address]; ok {\n\t\treturn\n\t}\n\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\tvar (\n\t\tweight      = node.Weight()\n\t\toffsetStart = 0\n\t\toffsetEnd   = s.totalWeight + weight\n\t)\n\tif s.nodeCount > 0 {\n\t\toffsetStart = s.totalWeight + 1\n\t}\n\n\toffset := nodeOffset{\n\t\tAddress:     address,\n\t\tWeight:      weight,\n\t\tOffsetStart: offsetStart,\n\t\tOffsetEnd:   offsetEnd,\n\t}\n\n\twrNode := s.node2WRNode(node)\n\n\ts.totalWeight = offsetEnd\n\ts.nodes[node.Address()] = wrNode\n\ts.list = append(s.list, wrNode)\n\ts.offsetList = append(s.offsetList, offset)\n\ts.nodeCount = s.nodeCount + 1\n\n\ts.sortOffset()\n\ts.checkSameWeight()\n\n\treturn\n}\n\nfunc (s *Selector) DeleteNode(host string, port int) (err error) {\n\taddress := selector.GenerateAddress(host, port)\n\tnode, ok := s.nodes[address]\n\tif !ok {\n\t\treturn\n\t}\n\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\n\ts.nodeCount = s.nodeCount - 1\n\n\tdelete(s.nodes, address)\n\n\tfor idx, n := range s.list {\n\t\tif n.Address() != address {\n\t\t\tcontinue\n\t\t}\n\t\tnew := make([]*Node, len(s.list)-1)\n\t\tnew = append(s.list[:idx], s.list[idx+1:]...)\n\t\ts.list = new\n\t}\n\n\tfor idx, n := range s.offsetList {\n\t\tif n.Address != address {\n\t\t\tcontinue\n\t\t}\n\t\ts.totalWeight = s.totalWeight - node.Weight()\n\t\tnew := make([]nodeOffset, len(s.offsetList)-1)\n\t\tnew = append(s.offsetList[:idx], s.offsetList[idx+1:]...)\n\t\ts.offsetList = new\n\t}\n\n\ts.sortOffset()\n\ts.checkSameWeight()\n\n\treturn\n}\n\nfunc (s *Selector) GetNodes() (nodes []selector.Node, err error) {\n\ts.lock.RLock()\n\tdefer s.lock.RUnlock()\n\n\tnodes = make([]selector.Node, 0)\n\tfor _, n := range s.list {\n\t\tnodes = append(nodes, n)\n\t}\n\treturn\n}\n\nfunc (s *Selector) GetNode(host string, port int) (node selector.Node, ok bool) {\n\ts.lock.RLock()\n\tdefer s.lock.RUnlock()\n\n\tnode, ok = s.nodes[selector.GenerateAddress(host, port)]\n\treturn\n}\n\nfunc (s *Selector) Select() (node selector.Node, err error) {\n\ts.lock.RLock()\n\tdefer s.lock.RUnlock()\n\n\tdefer func() {\n\t\tif node != nil {\n\t\t\treturn\n\t\t}\n\t\terr = errors.New(\"node is nil\")\n\t}()\n\n\tif s.sameWeight {\n\t\tidx := rand.Intn(s.nodeCount)\n\t\tnode = s.list[idx]\n\t\treturn\n\t}\n\n\tidx := rand.Intn(s.totalWeight + 1)\n\tfor _, n := range s.offsetList {\n\t\tif idx >= n.OffsetStart && idx <= n.OffsetEnd {\n\t\t\tnode = s.nodes[n.Address]\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn\n}\n\nfunc (s *Selector) AfterHandle(address string, err error) {\n\ts.lock.RLock()\n\tdefer s.lock.RUnlock()\n\n\tnode := s.nodes[address]\n\tif node == nil {\n\t\treturn\n\t}\n\n\tif err != nil {\n\t\tnode.incrFail()\n\t\treturn\n\t}\n\tnode.incrSuccess()\n\n\treturn\n}\n\nfunc (s *Selector) checkSameWeight() {\n\ts.sameWeight = true\n\n\tvar last int\n\tfor _, n := range s.list {\n\t\tcur := int(n.weight)\n\t\tif last == 0 {\n\t\t\tlast = cur\n\t\t\tcontinue\n\t\t}\n\t\tif last == cur {\n\t\t\tlast = cur\n\t\t\tcontinue\n\t\t}\n\t\ts.sameWeight = false\n\t\treturn\n\t}\n}\n\nfunc (s *Selector) sortOffset() {\n\tsort.Slice(s.offsetList, func(i, j int) bool {\n\t\treturn s.offsetList[i].Weight > s.offsetList[j].Weight\n\t})\n}\n\nfunc (s *Selector) node2WRNode(node selector.Node) *Node {\n\treturn &Node{\n\t\taddress:    node.Address(),\n\t\tweight:     node.Weight(),\n\t\tmeta:       node.Meta(),\n\t\tstatistics: node.Statistics(),\n\t}\n}\n"
  },
  {
    "path": "library/selector/wr/wr_test.go",
    "content": "// wr is Weighted random\npackage wr\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"math/rand\"\n\t\"testing\"\n\n\t\"github.com/smartystreets/goconvey/convey\"\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/why444216978/gin-api/library/selector\"\n)\n\nfunc TestNewNode(t *testing.T) {\n\tconvey.Convey(\"TestNewNode\", t, func() {\n\t\tconvey.Convey(\"success\", func() {\n\t\t\tip := \"127.0.0.1\"\n\t\t\tport := 80\n\t\t\tweight := 10\n\t\t\tmeta := selector.Meta{}\n\t\t\tnode := NewNode(ip, port, weight, meta)\n\t\t\tassert.Equal(t, node.Address(), selector.GenerateAddress(ip, port))\n\t\t\tassert.Equal(t, node.Weight(), weight)\n\t\t\tassert.Equal(t, node.Meta(), meta)\n\t\t})\n\t})\n}\n\nfunc TestNode_Address(t *testing.T) {\n}\n\nfunc TestNode_Meta(t *testing.T) {\n}\n\nfunc TestNode_Statistics(t *testing.T) {\n}\n\nfunc TestNode_Weight(t *testing.T) {\n}\n\nfunc TestNode_incrSuccess(t *testing.T) {\n}\n\nfunc TestNode_incrFail(t *testing.T) {\n}\n\nfunc TestWithServiceName(t *testing.T) {\n}\n\nfunc TestNewSelector(t *testing.T) {\n}\n\nfunc TestSelector_ServiceName(t *testing.T) {\n\tconvey.Convey(\"TestSelector_ServiceName\", t, func() {\n\t\tconvey.Convey(\"success\", func() {\n\t\t\ts := NewSelector(WithServiceName(\"test_service\"))\n\t\t\tserviceName := s.ServiceName()\n\t\t\tassert.Equal(t, serviceName, \"test_service\")\n\t\t})\n\t})\n}\n\nfunc TestSelector_AddNode(t *testing.T) {\n}\n\nfunc TestSelector_DeleteNode(t *testing.T) {\n}\n\nfunc TestSelector_GetNodes(t *testing.T) {\n}\n\nfunc TestSelector_Select(t *testing.T) {\n}\n\nfunc TestSelector_AfterHandle(t *testing.T) {\n}\n\nfunc TestSelector_checkSameWeight(t *testing.T) {\n}\n\nfunc TestSelector_sortOffset(t *testing.T) {\n}\n\nfunc TestSelector_node2WRNode(t *testing.T) {\n}\n\nfunc TestWR(t *testing.T) {\n\tconvey.Convey(\"TestWR\", t, func() {\n\t\tconvey.Convey(\"testNoDeleteHandle same weight\", func() {\n\t\t\tnodes := []*Node{\n\t\t\t\t{\n\t\t\t\t\taddress: \"127.0.0.1:80\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\taddress: \"127.0.0.2:80\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\taddress: \"127.0.0.3:80\",\n\t\t\t\t},\n\t\t\t}\n\t\t\tres := testNoDeleteHandle(t, nodes)\n\t\t\tfmt.Println(\"\\ntestNoDeleteHandle same weight\")\n\t\t\tfor _, n := range res {\n\t\t\t\tfmt.Println(n.Address(), \":\", n.Statistics())\n\t\t\t}\n\t\t})\n\t\tconvey.Convey(\"testNoDeleteHandle diff weight\", func() {\n\t\t\tnodes := []*Node{\n\t\t\t\t{\n\t\t\t\t\taddress: \"127.0.0.1:80\",\n\t\t\t\t\tweight:  2,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\taddress: \"127.0.0.2:80\",\n\t\t\t\t\tweight:  2,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\taddress: \"127.0.0.3:80\",\n\t\t\t\t\tweight:  1,\n\t\t\t\t},\n\t\t\t}\n\t\t\tres := testNoDeleteHandle(t, nodes)\n\t\t\tfmt.Println(\"\\ntestNoDeleteHandle diff weight\")\n\t\t\tfor _, n := range res {\n\t\t\t\tfmt.Println(n.Address(), \":\", n.Statistics())\n\t\t\t}\n\t\t})\n\t\tconvey.Convey(\"testDeleteHandle same weight\", func() {\n\t\t\tnodes := []*Node{\n\t\t\t\t{\n\t\t\t\t\taddress: \"127.0.0.1:80\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\taddress: \"127.0.0.2:80\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\taddress: \"127.0.0.3:80\",\n\t\t\t\t},\n\t\t\t}\n\t\t\tres := testDeleteHandle(t, nodes)\n\t\t\tfmt.Println(\"\\ntestDeleteHandle same weight\")\n\t\t\tfor _, n := range res {\n\t\t\t\tfmt.Println(n.Address(), \":\", n.Statistics())\n\t\t\t}\n\t\t})\n\t\tconvey.Convey(\"testDeleteHandle diff weight\", func() {\n\t\t\tnodes := []*Node{\n\t\t\t\t{\n\t\t\t\t\taddress: \"127.0.0.1:80\",\n\t\t\t\t\tweight:  2,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\taddress: \"127.0.0.2:80\",\n\t\t\t\t\tweight:  2,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\taddress: \"127.0.0.3:80\",\n\t\t\t\t\tweight:  1,\n\t\t\t\t},\n\t\t\t}\n\t\t\tres := testDeleteHandle(t, nodes)\n\t\t\tfmt.Println(\"\\ntestDeleteHandle diff weight\")\n\t\t\tfor _, n := range res {\n\t\t\t\tfmt.Println(n.Address(), \":\", n.Statistics())\n\t\t\t}\n\t\t})\n\t})\n}\n\nfunc testNoDeleteHandle(t *testing.T, nodes []*Node) []selector.Node {\n\ts := NewSelector(WithServiceName(\"test_service\"))\n\n\tfor _, node := range nodes {\n\t\ts.AddNode(node)\n\t}\n\n\ti := 1\n\tfor {\n\t\tif i > 10000 {\n\t\t\tbreak\n\t\t}\n\t\tnode, _ := s.Select()\n\n\t\trandom := rand.Intn(100)\n\t\terr := errors.New(\"error\")\n\t\tif random != 0 {\n\t\t\terr = nil\n\t\t}\n\t\ts.AfterHandle(node.Address(), err)\n\t\ti++\n\t}\n\n\tres, _ := s.GetNodes()\n\treturn res\n}\n\nfunc testDeleteHandle(t *testing.T, nodes []*Node) []selector.Node {\n\ts := NewSelector(WithServiceName(\"test_service\"))\n\n\tfor _, node := range nodes {\n\t\ts.AddNode(node)\n\t}\n\n\ti := 1\n\tfor {\n\t\tif i > 9000 {\n\t\t\tbreak\n\t\t}\n\t\tnode, _ := s.Select()\n\n\t\trandom := rand.Intn(100)\n\t\terr := errors.New(\"error\")\n\t\tif random != 0 {\n\t\t\terr = nil\n\t\t}\n\n\t\ts.AfterHandle(node.Address(), err)\n\t\ti++\n\t}\n\n\tdel := nodes[2]\n\thost, port := selector.ExtractAddress(del.address)\n\t_ = s.DeleteNode(host, port)\n\ti = 1\n\tfor {\n\t\tif i > 1000 {\n\t\t\tbreak\n\t\t}\n\t\tnode, _ := s.Select()\n\n\t\trandom := rand.Intn(10)\n\t\terr := errors.New(\"error\")\n\t\tif random != 0 {\n\t\t\terr = nil\n\t\t}\n\n\t\tassert.Equal(t, node.Address() != del.address, true)\n\t\ts.AfterHandle(node.Address(), err)\n\t\ti++\n\t}\n\n\tres, _ := s.GetNodes()\n\treturn res\n}\n"
  },
  {
    "path": "library/selector/wrr/wrr.go",
    "content": "// wrr is Weighted Round Robin\n// reference Nginx https://blog.csdn.net/zhangskd/article/details/50194069\npackage wrr\n"
  },
  {
    "path": "library/servicer/service/service.go",
    "content": "package service\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"net\"\n\t\"path/filepath\"\n\t\"sync\"\n\t\"sync/atomic\"\n\t\"time\"\n\n\t\"github.com/why444216978/go-util/assert\"\n\tutilDir \"github.com/why444216978/go-util/dir\"\n\t\"github.com/why444216978/go-util/validate\"\n\n\t\"github.com/why444216978/gin-api/library/config\"\n\t\"github.com/why444216978/gin-api/library/etcd\"\n\t\"github.com/why444216978/gin-api/library/registry\"\n\tregistryEtcd \"github.com/why444216978/gin-api/library/registry/etcd\"\n\t\"github.com/why444216978/gin-api/library/selector\"\n\t\"github.com/why444216978/gin-api/library/selector/wr\"\n\t\"github.com/why444216978/gin-api/library/servicer\"\n)\n\nfunc LoadGlobPattern(path, suffix string, etcd *etcd.Etcd) (err error) {\n\tvar (\n\t\tdir   string\n\t\tfiles []string\n\t)\n\n\tif dir, err = config.Dir(); err != nil {\n\t\treturn\n\t}\n\n\tif files, err = filepath.Glob(filepath.Join(dir, path, \"*.\"+suffix)); err != nil {\n\t\treturn\n\t}\n\n\tvar discover registry.Discovery\n\tinfo := utilDir.FileInfo{}\n\tcfg := &Config{}\n\tfor _, f := range files {\n\t\tif info, err = utilDir.GetPathInfo(f); err != nil {\n\t\t\treturn\n\t\t}\n\t\tif err = config.ReadConfig(filepath.Join(\"services\", info.BaseNoExt), info.ExtNoSpot, cfg); err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tif cfg.Type == servicer.TypeRegistry {\n\t\t\tif assert.IsNil(etcd) {\n\t\t\t\treturn errors.New(\"LoadGlobPattern etcd nil\")\n\t\t\t}\n\t\t\topts := []registryEtcd.DiscoverOption{\n\t\t\t\tregistryEtcd.WithServierName(cfg.ServiceName),\n\t\t\t\tregistryEtcd.WithRefreshDuration(cfg.RefreshSecond),\n\t\t\t\tregistryEtcd.WithDiscoverClient(etcd.Client),\n\t\t\t}\n\t\t\tif discover, err = registryEtcd.NewDiscovery(opts...); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif err = LoadService(cfg, WithDiscovery(discover)); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}\n\nfunc LoadService(config *Config, opts ...Option) (err error) {\n\ts, err := NewService(config, opts...)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tservicer.SetServicer(s)\n\n\treturn nil\n}\n\ntype Config struct {\n\tServiceName   string `validate:\"required\"`\n\tType          uint8  `validate:\"required,oneof=1 2\"`\n\tHost          string `validate:\"required\"`\n\tPort          int    `validate:\"required\"`\n\tSelector      string `validate:\"required,oneof=wr\"` // TODO 后续支持其它\n\tCaCrt         string\n\tClientPem     string\n\tClientKey     string\n\tRefreshSecond int\n}\n\ntype Service struct {\n\tsync.RWMutex\n\tselector        selector.Selector\n\tselectorNewNode selector.NewNodeFunc\n\tadjusting       int32\n\tupdateTime      time.Time\n\tdiscovery       registry.Discovery\n\tcaCrt           []byte\n\tclientPem       []byte\n\tclientKey       []byte\n\tconfig          *Config\n}\n\ntype Option func(*Service)\n\nfunc WithDiscovery(discovery registry.Discovery) Option {\n\treturn func(s *Service) { s.discovery = discovery }\n}\n\nfunc NewService(config *Config, opts ...Option) (*Service, error) {\n\ts := &Service{\n\t\tadjusting: 0,\n\t\tconfig:    config,\n\t\tcaCrt:     []byte(config.CaCrt),\n\t\tclientPem: []byte(config.ClientPem),\n\t\tclientKey: []byte(config.ClientKey),\n\t}\n\n\tfor _, o := range opts {\n\t\to(s)\n\t}\n\n\tif err := validate.ValidateCamel(config); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := s.initSelector(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn s, nil\n}\n\nfunc (s *Service) Name() string {\n\treturn s.config.ServiceName\n}\n\nfunc (s *Service) Pick(ctx context.Context) (node *servicer.Node, err error) {\n\tnode = &servicer.Node{\n\t\tPort: s.config.Port,\n\t}\n\n\tif s.config.Type == servicer.TypeIPPort {\n\t\tnode.Host = s.config.Host\n\t\treturn\n\t}\n\n\tif s.config.Type == servicer.TypeDomain {\n\t\tvar host *net.IPAddr\n\t\thost, err = net.ResolveIPAddr(\"ip\", s.config.Host)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tnode.Host = host.IP.String()\n\t\treturn\n\t}\n\n\ts.adjustSelectorNode()\n\n\ttarget, err := s.selector.Select()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tnode.Host, node.Port = selector.ExtractAddress(target.Address())\n\n\treturn\n}\n\nfunc (s *Service) initSelector() (err error) {\n\tif s.config.Type != servicer.TypeRegistry {\n\t\treturn nil\n\t}\n\n\tif assert.IsNil(s.discovery) {\n\t\treturn errors.New(\"discovery is nil\")\n\t}\n\n\tswitch s.config.Selector {\n\tcase selector.TypeWR:\n\t\ts.selector = wr.NewSelector(wr.WithServiceName(s.config.ServiceName))\n\t\ts.selectorNewNode = wr.NewNode\n\t}\n\n\ts.adjustSelectorNode()\n\n\treturn nil\n}\n\nfunc (s *Service) adjustSelectorNode() {\n\tif s.discovery.GetUpdateTime().Before(s.updateTime) {\n\t\treturn\n\t}\n\n\tif !atomic.CompareAndSwapInt32(&s.adjusting, 0, 1) {\n\t\treturn\n\t}\n\n\ts.Lock()\n\tdefer s.Unlock()\n\n\tvar (\n\t\taddress     string\n\t\thost        string\n\t\tport        int\n\t\tnowNodes    = s.discovery.GetNodes()\n\t\tnowMap      = make(map[string]struct{})\n\t\tselectorMap = make(map[string]selector.Node)\n\t)\n\n\t// selector add new nodes\n\tfor _, n := range nowNodes {\n\t\thost = n.Host\n\t\tport = n.Port\n\t\taddress = selector.GenerateAddress(host, port)\n\t\tnode := s.selectorNewNode(host, port, n.Weight, selector.Meta{})\n\n\t\tnowMap[address] = struct{}{}\n\t\tselectorMap[address] = node\n\n\t\t_ = s.selector.AddNode(node)\n\t}\n\n\t// selector delete non-existent nodes\n\tselectorNodes, _ := s.selector.GetNodes()\n\tfor _, n := range selectorNodes {\n\t\tif _, ok := nowMap[n.Address()]; ok {\n\t\t\tcontinue\n\t\t}\n\t\thost, port = selector.ExtractAddress(n.Address())\n\t\t_ = s.selector.DeleteNode(host, port)\n\t}\n\n\ts.updateTime = time.Now()\n\tatomic.StoreInt32(&s.adjusting, 0)\n}\n\nfunc (s *Service) Done(ctx context.Context, node *servicer.Node, err error) error {\n\tif assert.IsNil(s.selector) {\n\t\treturn errors.New(\"selector is nil\")\n\t}\n\ts.selector.AfterHandle(selector.GenerateAddress(node.Host, node.Port), err)\n\treturn nil\n}\n\nfunc (s *Service) GetCaCrt() []byte {\n\treturn s.caCrt\n}\n\nfunc (s *Service) GetClientPem() []byte {\n\treturn s.clientPem\n}\n\nfunc (s *Service) GetClientKey() []byte {\n\treturn s.clientKey\n}\n"
  },
  {
    "path": "library/servicer/servicer.go",
    "content": "package servicer\n\nimport (\n\t\"context\"\n\t\"sync\"\n)\n\nconst (\n\tTypeRegistry uint8 = 1\n\tTypeIPPort   uint8 = 2\n\tTypeDomain   uint8 = 3\n)\n\ntype Node struct {\n\tHost string\n\tPort int\n}\n\ntype DoneInfo struct {\n\tNode *Node\n\tErr  error\n}\n\nvar (\n\tlock      sync.RWMutex\n\tServicers = make(map[string]Servicer)\n)\n\nfunc SetServicer(s Servicer) {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\tServicers[s.Name()] = s\n}\n\nfunc DelServicer(s Servicer) {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\tdelete(Servicers, s.Name())\n}\n\nfunc GetServicer(serviceName string) (Servicer, bool) {\n\ts, has := Servicers[serviceName]\n\treturn s, has\n}\n\ntype Servicer interface {\n\tName() string\n\tPick(ctx context.Context) (*Node, error)\n\tDone(ctx context.Context, node *Node, err error) error\n\tGetCaCrt() []byte\n\tGetClientPem() []byte\n\tGetClientKey() []byte\n}\n"
  },
  {
    "path": "server/grpc/cmux/cmux.go",
    "content": "package cmux\n\nimport (\n\t\"context\"\n\t\"net\"\n\t\"net/http\"\n\n\t\"github.com/grpc-ecosystem/grpc-gateway/v2/runtime\"\n\t\"github.com/soheilhy/cmux\"\n\t\"github.com/why444216978/go-util/assert\"\n\t\"google.golang.org/grpc\"\n\t\"google.golang.org/protobuf/encoding/protojson\"\n\n\t\"github.com/why444216978/gin-api/library/logger\"\n\t\"github.com/why444216978/gin-api/server\"\n\tserverGRPC \"github.com/why444216978/gin-api/server/grpc\"\n)\n\ntype (\n\tRegisterHTTP func(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error\n)\n\ntype Option struct {\n\tlogger       logger.Logger\n\tregisterHTTP RegisterHTTP\n\thttpServer   *http.Server\n}\n\ntype OptionFunc func(*Option)\n\nfunc WithHTTP(httpServer *http.Server, registerHTTP RegisterHTTP) OptionFunc {\n\treturn func(s *Option) {\n\t\ts.httpServer = httpServer\n\t\ts.registerHTTP = registerHTTP\n\t}\n}\n\ntype CMUXServer struct {\n\t*Option\n\tctx       context.Context\n\tendpoint  string\n\tregisters []serverGRPC.Register\n\ttcpMux    cmux.CMux\n}\n\nvar _ server.Server = (*CMUXServer)(nil)\n\nfunc NewCMUX(endpoint string, registers []serverGRPC.Register, opts ...OptionFunc) *CMUXServer {\n\tif len(registers) < 1 {\n\t\tpanic(\"len(registers) < 1\")\n\t}\n\n\toption := &Option{}\n\tfor _, o := range opts {\n\t\to(option)\n\t}\n\n\ts := &CMUXServer{\n\t\tOption:    option,\n\t\tctx:       context.Background(),\n\t\tregisters: registers,\n\t\tendpoint:  endpoint,\n\t}\n\n\treturn s\n}\n\nfunc (s *CMUXServer) Start() (err error) {\n\tlistener, err := net.Listen(\"tcp\", s.endpoint)\n\tif err != nil {\n\t\treturn\n\t}\n\ts.tcpMux = cmux.New(listener)\n\n\tgo s.startGRPC()\n\tgo s.startHTTP()\n\n\treturn s.tcpMux.Serve()\n}\n\nfunc (s *CMUXServer) startGRPC() {\n\tgrpcServer := grpc.NewServer(serverGRPC.NewServerOption(serverGRPC.ServerOptionLogger(s.logger))...)\n\n\tfor _, r := range s.registers {\n\t\tif r.RegisterGRPC == nil {\n\t\t\tpanic(\"r.RegisterGRPC == nil\")\n\t\t}\n\t\tr.RegisterGRPC(grpcServer)\n\t}\n\n\tserverGRPC.RegisterTools(grpcServer)\n\n\tlistener := s.tcpMux.MatchWithWriters(cmux.HTTP2MatchHeaderFieldPrefixSendSettings(\"content-type\", \"application/grpc\"))\n\tif err := grpcServer.Serve(listener); err != nil {\n\t\tpanic(err)\n\t}\n}\n\nfunc (s *CMUXServer) startHTTP() (err error) {\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}()\n\n\tif assert.IsNil(s.registerHTTP) {\n\t\treturn\n\t}\n\n\tif assert.IsNil(s.httpServer) {\n\t\tpanic(\"httpServer is nil\")\n\t}\n\n\tgrpcConn, err := grpc.DialContext(s.ctx, s.endpoint, serverGRPC.NewDialOption()...)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tmux := runtime.NewServeMux(\n\t\truntime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{\n\t\t\tMarshalOptions: protojson.MarshalOptions{\n\t\t\t\tUseProtoNames:  true,\n\t\t\t\tUseEnumNumbers: true,\n\t\t\t},\n\t\t}),\n\t\truntime.WithErrorHandler(runtime.DefaultHTTPErrorHandler),\n\t)\n\tif err = s.registerHTTP(s.ctx, mux, grpcConn); err != nil {\n\t\treturn\n\t}\n\n\trouter := http.NewServeMux()\n\trouter.Handle(\"/\", mux)\n\ts.httpServer.Addr = s.endpoint\n\ts.httpServer.Handler = router\n\tlistener := s.tcpMux.Match(cmux.HTTP1Fast())\n\tif err = s.httpServer.Serve(listener); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}\n\nfunc (s *CMUXServer) Close() (err error) {\n\ts.tcpMux.Close()\n\treturn\n}\n"
  },
  {
    "path": "server/grpc/h2c/h2c.go",
    "content": "package h2c\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"net/http\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/grpc-ecosystem/grpc-gateway/v2/runtime\"\n\t\"golang.org/x/net/http2\"\n\t\"golang.org/x/net/http2/h2c\"\n\t\"google.golang.org/grpc\"\n\n\t\"github.com/why444216978/gin-api/library/logger\"\n\t\"github.com/why444216978/gin-api/server\"\n\tserverGRPC \"github.com/why444216978/gin-api/server/grpc\"\n)\n\ntype Option struct {\n\tlogger logger.Logger\n}\n\ntype OptionFunc func(*Option)\n\nfunc WithLogger(l logger.Logger) OptionFunc {\n\treturn func(s *Option) { s.logger = l }\n}\n\ntype H2CServer struct {\n\t*Option\n\t*grpc.Server\n\tctx        context.Context\n\tendpoint   string\n\tregisters  []serverGRPC.Register\n\thttpServer *http.Server\n}\n\nvar _ server.Server = (*H2CServer)(nil)\n\nfunc NewH2C(endpoint string, registers []serverGRPC.Register, opts ...OptionFunc) *H2CServer {\n\tif len(registers) < 1 {\n\t\tpanic(\"len(registers) < 1\")\n\t}\n\n\toption := &Option{}\n\tfor _, o := range opts {\n\t\to(option)\n\t}\n\n\ts := &H2CServer{\n\t\tOption:    option,\n\t\tctx:       context.Background(),\n\t\tendpoint:  endpoint,\n\t\tregisters: registers,\n\t}\n\n\treturn s\n}\n\nfunc (s *H2CServer) Start() (err error) {\n\tgrpcServer := grpc.NewServer(serverGRPC.NewServerOption(serverGRPC.ServerOptionLogger(s.logger))...)\n\n\tmux := http.NewServeMux()\n\tgwmux := runtime.NewServeMux()\n\tmux.Handle(\"/\", gwmux)\n\n\tfor _, r := range s.registers {\n\t\tif r.RegisterGRPC == nil {\n\t\t\treturn errors.New(\"r.RegisterGRPC nil\")\n\t\t}\n\n\t\tr.RegisterGRPC(grpcServer)\n\t\tif err = r.RegisterMux(s.ctx, gwmux, s.endpoint, serverGRPC.NewDialOption()); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\tserverGRPC.RegisterTools(grpcServer)\n\n\ts.Server = grpcServer\n\n\ts.httpServer = &http.Server{\n\t\tAddr: s.endpoint,\n\t\tHandler: h2c.NewHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\tif r.ProtoMajor == 2 && strings.Contains(r.Header.Get(\"Content-Type\"), \"application/grpc\") {\n\t\t\t\tgrpcServer.ServeHTTP(w, r)\n\t\t\t} else {\n\t\t\t\tmux.ServeHTTP(w, r)\n\t\t\t}\n\t\t}), &http2.Server{}),\n\t}\n\n\treturn s.httpServer.ListenAndServe()\n}\n\nfunc (s *H2CServer) Close() (err error) {\n\ts.GracefulStop()\n\tctx, _ := context.WithTimeout(context.Background(), 3*time.Second)\n\treturn s.httpServer.Shutdown(ctx)\n}\n"
  },
  {
    "path": "server/grpc/middleware/log/log.go",
    "content": "package log\n\nimport (\n\t\"context\"\n\t\"net\"\n\t\"time\"\n\n\t\"github.com/why444216978/go-util/snowflake\"\n\t\"google.golang.org/grpc\"\n\t\"google.golang.org/grpc/metadata\"\n\t\"google.golang.org/grpc/peer\"\n\n\t\"github.com/why444216978/gin-api/library/logger\"\n)\n\nfunc LogIDFromMD(md metadata.MD) string {\n\tlogIDs := md.Get(logger.LogID)\n\tif len(logIDs) > 0 && logIDs[0] != \"\" {\n\t\treturn logIDs[0]\n\t}\n\n\treturn snowflake.Generate().String()\n}\n\nfunc GetPeerAddr(ctx context.Context) string {\n\tvar addr string\n\tif pr, ok := peer.FromContext(ctx); ok {\n\t\tif tcpAddr, ok := pr.Addr.(*net.TCPAddr); ok {\n\t\t\taddr = tcpAddr.IP.String()\n\t\t} else {\n\t\t\taddr = pr.Addr.String()\n\t\t}\n\t}\n\treturn addr\n}\n\nfunc UnaryServerInterceptor(l logger.Logger) grpc.UnaryServerInterceptor {\n\treturn func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {\n\t\tstart := time.Now()\n\t\tresp, err = handler(ctx, req)\n\t\tif l == nil {\n\t\t\treturn\n\t\t}\n\n\t\tmd, has := metadata.FromIncomingContext(ctx)\n\t\tif !has {\n\t\t\tmd = metadata.MD{}\n\t\t}\n\t\tlogID := LogIDFromMD(md)\n\n\t\tgrpc.SetTrailer(ctx, metadata.MD{\n\t\t\tlogger.LogID: []string{logID},\n\t\t})\n\n\t\t// TODO full fields\n\t\tfields := []logger.Field{\n\t\t\tlogger.Reflect(logger.LogID, logID),\n\t\t\tlogger.Reflect(logger.Cost, time.Since(start).Milliseconds()),\n\t\t}\n\t\tctx = logger.WithFields(ctx, fields)\n\t\tif err != nil {\n\t\t\tl.Error(ctx, \"grpc err\", logger.Error(err))\n\t\t} else {\n\t\t\tl.Info(ctx, \"grpc info\")\n\t\t}\n\n\t\treturn\n\t}\n}\n\nfunc UnaryClientInterceptor() grpc.UnaryClientInterceptor {\n\treturn func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) (err error) {\n\t\t// TODO\n\t\treturn invoker(ctx, method, req, reply, cc, opts...)\n\t}\n}\n"
  },
  {
    "path": "server/grpc/option.go",
    "content": "package grpc\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"time\"\n\n\tgrpc_recovery \"github.com/grpc-ecosystem/go-grpc-middleware/recovery\"\n\t\"github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc\"\n\t\"github.com/opentracing/opentracing-go\"\n\topentracingLog \"github.com/opentracing/opentracing-go/log\"\n\t\"github.com/pkg/errors\"\n\t\"github.com/why444216978/go-util/assert\"\n\t\"google.golang.org/grpc\"\n\t\"google.golang.org/grpc/codes\"\n\t\"google.golang.org/grpc/keepalive\"\n\t\"google.golang.org/grpc/status\"\n\n\t\"github.com/why444216978/gin-api/library/jaeger\"\n\t\"github.com/why444216978/gin-api/library/logger\"\n\t\"github.com/why444216978/gin-api/server/grpc/middleware/log\"\n)\n\nvar kaep = keepalive.EnforcementPolicy{\n\tMinTime:             5 * time.Second, // If a client pings more than once every 5 seconds, terminate the connection\n\tPermitWithoutStream: true,            // Allow pings even when there are no active streams\n}\n\nvar kasp = keepalive.ServerParameters{\n\tMaxConnectionIdle:     15 * time.Second, // If a client is idle for 15 seconds, send a GOAWAY\n\tMaxConnectionAge:      30 * time.Second, // If any connection is alive for more than 30 seconds, send a GOAWAY\n\tMaxConnectionAgeGrace: 5 * time.Second,  // Allow 5 seconds for pending RPCs to complete before forcibly closing connections\n\tTime:                  5 * time.Second,  // Ping the client if it is idle for 5 seconds to ensure the connection is still active\n\tTimeout:               1 * time.Second,  // Wait 1 second for the ping ack before assuming the connection is dead\n}\n\nvar kacp = keepalive.ClientParameters{\n\tTime:                10 * time.Second, // send pings every 10 seconds if there is no activity\n\tTimeout:             time.Second,      // wait 1 second for ping ack before considering the connection dead\n\tPermitWithoutStream: true,             // send pings even without active streams\n}\n\ntype DialOption struct{}\n\ntype DialOptionFunc func(*DialOption)\n\nfunc NewDialOption(opts ...DialOptionFunc) []grpc.DialOption {\n\treturn []grpc.DialOption{\n\t\t// TODO\n\t\t// grpc.WithResolvers(resolver),\n\t\tgrpc.WithTimeout(10 * time.Second),\n\t\tgrpc.WithInsecure(),\n\t\tgrpc.WithKeepaliveParams(kacp),\n\t\tgrpc.WithChainUnaryInterceptor(\n\t\t\tlog.UnaryClientInterceptor(),\n\t\t\totgrpc.OpenTracingClientInterceptor(\n\t\t\t\topentracing.GlobalTracer(),\n\t\t\t\totgrpc.SpanDecorator(func(span opentracing.Span, method string, req, resp interface{}, err error) {\n\t\t\t\t\tif assert.IsNil(span) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tbs, _ := json.Marshal(req)\n\t\t\t\t\tjaeger.SetRequest(span, string(bs))\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tspan.LogFields(opentracingLog.Error(err))\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t),\n\t\t),\n\t}\n}\n\ntype ServerOption struct {\n\tlogger logger.Logger\n}\n\ntype ServerOptionFunc func(*ServerOption)\n\nfunc ServerOptionLogger(l logger.Logger) ServerOptionFunc {\n\treturn func(o *ServerOption) { o.logger = l }\n}\n\nfunc NewServerOption(opts ...ServerOptionFunc) []grpc.ServerOption {\n\topt := &ServerOption{}\n\tfor _, o := range opts {\n\t\to(opt)\n\t}\n\n\tinterceptors := []grpc.UnaryServerInterceptor{\n\t\totgrpc.OpenTracingServerInterceptor(\n\t\t\topentracing.GlobalTracer(),\n\t\t\totgrpc.SpanDecorator(func(span opentracing.Span, method string, req, resp interface{}, err error) {\n\t\t\t\tif assert.IsNil(span) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tbs, _ := json.Marshal(resp)\n\t\t\t\tjaeger.SetResponse(span, string(bs))\n\n\t\t\t\tif err != nil {\n\t\t\t\t\tspan.LogFields(opentracingLog.Error(err))\n\t\t\t\t}\n\t\t\t})),\n\t\tgrpc_recovery.UnaryServerInterceptor(\n\t\t\tgrpc_recovery.WithRecoveryHandlerContext(func(ctx context.Context, p interface{}) (err error) {\n\t\t\t\terr = errors.WithStack(fmt.Errorf(\"%v\", p))\n\t\t\t\treturn status.Errorf(codes.Internal, \"%+v\", err)\n\t\t\t})),\n\t}\n\tif !assert.IsNil(opt.logger) {\n\t\tinterceptors = append(interceptors, log.UnaryServerInterceptor(opt.logger))\n\t}\n\n\treturn []grpc.ServerOption{\n\t\tgrpc.KeepaliveEnforcementPolicy(kaep),\n\t\tgrpc.KeepaliveParams(kasp),\n\t\tgrpc.ChainUnaryInterceptor(interceptors...),\n\t}\n}\n\ntype CallOption struct{}\n\ntype CallOptionFunc func(*CallOption)\n\nfunc NewCallOption(opts ...CallOption) []grpc.CallOption {\n\treturn []grpc.CallOption{}\n}\n"
  },
  {
    "path": "server/grpc/server.go",
    "content": "package grpc\n\nimport (\n\t\"context\"\n\n\t\"github.com/grpc-ecosystem/grpc-gateway/v2/runtime\"\n\t\"google.golang.org/grpc\"\n\t\"google.golang.org/grpc/channelz/service\"\n\t\"google.golang.org/grpc/reflection\"\n)\n\ntype (\n\tRegisterGRPC func(s *grpc.Server)\n\tRegisterMux  func(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) error\n)\n\ntype Register struct {\n\tRegisterGRPC RegisterGRPC\n\tRegisterMux  RegisterMux\n}\n\nfunc NewRegister(registerGRPC RegisterGRPC, registerMux RegisterMux) Register {\n\treturn Register{\n\t\tRegisterGRPC: registerGRPC,\n\t\tRegisterMux:  registerMux,\n\t}\n}\n\nfunc RegisterTools(s *grpc.Server) {\n\treflection.Register(s)\n\tservice.RegisterChannelzServiceToServer(s)\n}\n"
  },
  {
    "path": "server/http/middleware/cors/cors.go",
    "content": "package cors\n\nimport (\n\t\"github.com/gin-contrib/cors\"\n\t\"github.com/gin-gonic/gin\"\n)\n\n// CORS middleware\n// router.Use(cors.New(cors.Config{\n//     AllowOrigins:     []string{\"https://foo.com\"},\n//     AllowMethods:     []string{\"PUT\", \"PATCH\"},\n//     AllowHeaders:     []string{\"Origin\"},\n//     ExposeHeaders:    []string{\"Content-Length\"},\n//     AllowCredentials: true,\n//     AllowOriginFunc: func(origin string) bool {\n//       return origin == \"https://github.com\"\n//     },\n//     MaxAge: 12 * time.Hour,\n// }))\nfunc CORS(c cors.Config) gin.HandlerFunc {\n\treturn cors.New(c)\n}\n"
  },
  {
    "path": "server/http/middleware/csrf/csrf.go",
    "content": "package csrf\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/gorilla/csrf\"\n\twraphh \"github.com/turtlemonvh/gin-wraphh\"\n)\n\nfunc CSRF(authKey []byte, domain string) gin.HandlerFunc {\n\tf := csrf.Protect(authKey,\n\t\tcsrf.Secure(false),\n\t\tcsrf.HttpOnly(true),\n\t\tcsrf.Domain(domain),\n\t\tcsrf.ErrorHandler(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {\n\t\t\trw.WriteHeader(http.StatusForbidden)\n\t\t\t_, _ = rw.Write([]byte(`{\"message\": \"CSRF token invalid\"}`))\n\t\t})),\n\t)\n\treturn wraphh.WrapHH(f)\n}\n"
  },
  {
    "path": "server/http/middleware/limiter/limiter.go",
    "content": "package limiter\n\nimport (\n\t\"net/http\"\n\t\"time\"\n\n\t\"github.com/gin-gonic/gin\"\n\t\"golang.org/x/time/rate\"\n\n\t\"github.com/why444216978/gin-api/library/logger\"\n\t\"github.com/why444216978/gin-api/server/http/response\"\n)\n\nfunc Limiter(maxBurstSize int, l logger.Logger) gin.HandlerFunc {\n\tlimiter := rate.NewLimiter(rate.Every(time.Second*1), maxBurstSize)\n\treturn func(c *gin.Context) {\n\t\tif limiter.Allow() {\n\t\t\tc.Next()\n\t\t\treturn\n\t\t}\n\n\t\tctx := c.Request.Context()\n\n\t\tfields := logger.ValueFields(ctx)\n\t\tctx = logger.AddField(ctx,\n\t\t\tlogger.Reflect(logger.Code, http.StatusInternalServerError),\n\t\t\tlogger.Reflect(logger.Response, map[string]interface{}{\n\t\t\t\t\"code\":   http.StatusServiceUnavailable,\n\t\t\t\t\"toast\":  \"服务暂时不可用\",\n\t\t\t\t\"data\":   \"\",\n\t\t\t\t\"errmsg\": \"服务暂时不可用\",\n\t\t\t}),\n\t\t)\n\t\tctx = logger.WithFields(c.Request.Context(), fields)\n\t\tc.Request = c.Request.WithContext(ctx)\n\n\t\tl.Error(ctx, \"limiter\") // 这里不能打Fatal和Panic，否则程序会退出\n\t\tresponse.ResponseJSON(c, http.StatusServiceUnavailable, nil, response.WrapToast(nil, http.StatusText(http.StatusServiceUnavailable)))\n\t\tc.AbortWithStatus(http.StatusInternalServerError)\n\t}\n}\n"
  },
  {
    "path": "server/http/middleware/log/log.go",
    "content": "package log\n\nimport (\n\t\"bytes\"\n\t\"encoding/base64\"\n\t\"net/http/httputil\"\n\t\"sync/atomic\"\n\t\"time\"\n\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/why444216978/go-util/assert\"\n\t\"github.com/why444216978/go-util/conversion\"\n\t\"github.com/why444216978/go-util/sys\"\n\n\t\"github.com/why444216978/gin-api/library/app\"\n\tjaegerHTTP \"github.com/why444216978/gin-api/library/jaeger/http\"\n\t\"github.com/why444216978/gin-api/library/logger\"\n\t\"github.com/why444216978/gin-api/server/http/util\"\n)\n\nfunc LoggerMiddleware(l logger.Logger) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tctx := c.Request.Context()\n\n\t\tdefer func() {\n\t\t\tc.Request = c.Request.WithContext(ctx)\n\t\t}()\n\n\t\tstart := time.Now()\n\n\t\tserverIP, _ := sys.LocalIP()\n\n\t\tlogID := logger.ExtractLogID(c.Request)\n\t\tctx = logger.WithLogID(ctx, logID)\n\n\t\t// req := logger.GetRequestBody(c.Request)\n\t\treq, _ := httputil.DumpRequest(c.Request, true)\n\n\t\tresponseWriter := &util.BodyWriter{Body: bytes.NewBuffer(nil), ResponseWriter: c.Writer}\n\t\tc.Writer = responseWriter\n\n\t\tctx, span, traceID := jaegerHTTP.ExtractHTTP(ctx, c.Request, logger.ValueLogID(ctx))\n\t\tif !assert.IsNil(span) {\n\t\t\tdefer span.Finish()\n\t\t}\n\t\tctx = logger.WithTraceID(ctx, traceID)\n\n\t\tfields := []logger.Field{\n\t\t\tlogger.Reflect(logger.LogID, logID),\n\t\t\tlogger.Reflect(logger.TraceID, traceID),\n\t\t\tlogger.Reflect(logger.Header, c.Request.Header),\n\t\t\tlogger.Reflect(logger.Method, c.Request.Method),\n\t\t\tlogger.Reflect(logger.Request, base64.StdEncoding.EncodeToString(req)),\n\t\t\tlogger.Reflect(logger.Response, make(map[string]interface{})),\n\t\t\tlogger.Reflect(logger.ClientIP, c.ClientIP()),\n\t\t\tlogger.Reflect(logger.ClientPort, 0),\n\t\t\tlogger.Reflect(logger.ServerIP, serverIP),\n\t\t\tlogger.Reflect(logger.ServerPort, app.Port()),\n\t\t\tlogger.Reflect(logger.API, c.Request.RequestURI),\n\t\t}\n\t\t// Next之前这里需要写入ctx，否则会丢失log、断开trace\n\t\tctx = logger.WithFields(ctx, fields)\n\t\tc.Request = c.Request.WithContext(ctx)\n\n\t\tvar doneFlag int32\n\t\tdone := make(chan struct{}, 1)\n\t\tdefer func() {\n\t\t\tdone <- struct{}{}\n\t\t\tatomic.StoreInt32(&doneFlag, 1)\n\n\t\t\tresp := responseWriter.Body.Bytes()\n\t\t\trespString := string(resp)\n\t\t\tif responseWriter.Body.Len() > 0 {\n\t\t\t\tlogResponse, _ := conversion.JsonToMap(respString)\n\t\t\t\tctx = logger.AddField(ctx, logger.Reflect(logger.Response, logResponse))\n\t\t\t}\n\n\t\t\treqString, _ := conversion.JsonEncode(req)\n\t\t\tjaegerHTTP.SetHTTPLog(span, reqString, respString)\n\n\t\t\tctx = logger.AddField(ctx,\n\t\t\t\tlogger.Reflect(logger.Code, c.Writer.Status()),\n\t\t\t\tlogger.Reflect(logger.Cost, time.Since(start).Milliseconds()),\n\t\t\t)\n\t\t\tl.Info(ctx, \"request info\")\n\t\t}()\n\n\t\tgo func() {\n\t\t\tselect {\n\t\t\tcase <-done:\n\t\t\tcase <-ctx.Done():\n\t\t\t\tif atomic.LoadInt32(&doneFlag) == 1 {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tctx = logger.AddField(ctx,\n\t\t\t\t\tlogger.Reflect(logger.Code, 499),\n\t\t\t\t\tlogger.Reflect(logger.Cost, time.Since(start).Milliseconds()),\n\t\t\t\t)\n\t\t\t\tl.Warn(ctx, \"client canceled\")\n\t\t\t}\n\t\t}()\n\n\t\tc.Next()\n\t}\n}\n"
  },
  {
    "path": "server/http/middleware/panic/mail_template.go",
    "content": "package panic\n\nvar MailTemplate = `<html>\n <head>\n  <meta charset=\"utf-8\" />\n </head>\n <body>\n  <div class=\"content-wrap\" style=\"margin: 0px auto; overflow: hidden; padding-top: 15px; background-color: rgb(255, 255, 255); width: 600px;\">\n   <!---->\n   <div>\n    <div style=\"margin: 0px auto; max-width: 600px;\">\n     <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"background-color: rgb(62, 207, 88); background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 1% 50%;\">\n      <tbody>\n       <tr>\n        <td style=\"direction: ltr; font-size: 0px; text-align: center; vertical-align: top; width: 600px;\">\n         <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n          <tbody>\n           <tr>\n            <td style=\"width: 100%; max-width: 100%; min-height: 1px; font-size: 13px; text-align: left; direction: ltr; vertical-align: top; padding: 0px;\">\n             <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"vertical-align: top;\">\n              <tbody>\n               <tr>\n                <td align=\"center\" style=\"font-size: 0px; word-break: break-word;\">\n                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-spacing: 0px; width: 100%;\">\n                  <tbody>\n                   <tr>\n                    <td>\n                     <div class=\"full\">\n                      <div style=\"margin: 0px auto; max-width: 600px;\">\n                       <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 600px;\">\n                        <tbody>\n                         <tr>\n                          <td style=\"direction: ltr; width: 600px; font-size: 0px; padding-bottom: 0px; text-align: center; vertical-align: top; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 10% 50%;\">\n                           <div style=\"font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n                            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n                             <tbody>\n                              <tr>\n                               <td align=\"left\" style=\"font-size: 0px; padding: 20px; word-break: break-word;\">\n                                <div class=\"text\" style=\"margin: 0px; text-align: center; color: rgb(255, 255, 255); font-size: 16px;\">\n                                 <div>\n                                  <p style=\"line-height: 20px; margin: 0px;\">系统告警</p>\n                                 </div>\n                                </div></td>\n                              </tr>\n                             </tbody>\n                            </table>\n                           </div></td>\n                         </tr>\n                        </tbody>\n                       </table>\n                      </div>\n                     </div></td>\n                   </tr>\n                  </tbody>\n                 </table></td>\n               </tr>\n              </tbody>\n             </table></td>\n           </tr>\n          </tbody>\n         </table></td>\n       </tr>\n      </tbody>\n     </table>\n    </div>\n   </div>\n   <div class=\"full\">\n    <div style=\"margin: 0px auto; max-width: 600px;\">\n     <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 600px;\">\n      <tbody>\n       <tr>\n        <td style=\"direction: ltr; font-size: 0px; padding-top: 0px; text-align: center; vertical-align: top;\">\n         <div class=\"outlook-group-fix\" style=\"font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n          <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n           <tbody>\n            <tr>\n             <td align=\"center\" vertical-align=\"middle\" style=\"padding-top: 40px; width: 600px; background-image: url(&quot;&quot;); background-size: 100px; background-position: 10% 50%; background-repeat: no-repeat;\"></td>\n            </tr>\n           </tbody>\n          </table>\n         </div></td>\n       </tr>\n      </tbody>\n     </table>\n    </div>\n   </div>\n   <div>\n    <div style=\"margin: 0px auto; max-width: 600px;\">\n     <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"background-color: rgb(255, 255, 255); background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 1% 50%;\">\n      <tbody>\n       <tr>\n        <td style=\"direction: ltr; font-size: 0px; text-align: center; vertical-align: top; width: 600px;\">\n         <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n          <tbody>\n           <tr>\n            <td style=\"width: 40%; max-width: 40%; min-height: 1px; font-size: 13px; text-align: left; direction: ltr; vertical-align: top; padding: 0px;\">\n             <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"vertical-align: top;\">\n              <tbody>\n               <tr>\n                <td align=\"center\" style=\"font-size: 0px; word-break: break-word;\">\n                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-spacing: 0px; width: 100%;\">\n                  <tbody>\n                   <tr>\n                    <td>\n                     <div class=\"full\">\n                      <div style=\"margin: 0px auto; max-width: 600px; line-height: 0px;\">\n                       <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 240px;\">\n                        <tbody>\n                         <tr>\n                          <td style=\"direction: ltr; font-size: 0px; padding: 0px; text-align: center; vertical-align: top;\">\n                           <div class=\"outlook-group-fix\" style=\"line-height: 0px; font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n                            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n                             <tbody>\n                              <tr>\n                               <td align=\"center\" style=\"font-size: 0px; padding: 25px 0px; word-break: break-word; width: 240px; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 10% 50%;\">\n                                <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse: collapse; border-spacing: 0px;\">\n                                 <tbody>\n                                  <tr>\n                                   <td style=\"width: 375px; border-top: 1px solid rgb(204, 204, 204);\"></td>\n                                  </tr>\n                                 </tbody>\n                                </table></td>\n                              </tr>\n                             </tbody>\n                            </table>\n                           </div></td>\n                         </tr>\n                        </tbody>\n                       </table>\n                      </div>\n                     </div></td>\n                   </tr>\n                  </tbody>\n                 </table></td>\n               </tr>\n              </tbody>\n             </table></td>\n            <td style=\"width: 20%; max-width: 20%; min-height: 1px; font-size: 13px; text-align: left; direction: ltr; vertical-align: top; padding: 0px;\">\n             <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"vertical-align: top;\">\n              <tbody>\n               <tr>\n                <td align=\"center\" style=\"font-size: 0px; word-break: break-word;\">\n                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-spacing: 0px; width: 100%;\">\n                  <tbody>\n                   <tr>\n                    <td>\n                     <div class=\"full\">\n                      <div style=\"margin: 0px auto; max-width: 600px;\">\n                       <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 120px;\">\n                        <tbody>\n                         <tr>\n                          <td style=\"direction: ltr; width: 120px; font-size: 0px; padding-bottom: 0px; text-align: center; vertical-align: top; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 10% 50%;\">\n                           <div style=\"font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n                            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n                             <tbody>\n                              <tr>\n                               <td align=\"left\" style=\"font-size: 0px; padding: 13px 20px; word-break: break-word;\">\n                                <div class=\"text\" style=\"margin: 0px; text-align: center; color: rgb(51, 51, 51); font-size: 16px;\">\n                                 <div>\n                                  <p style=\"line-height: 20px; margin: 0px;\">告警</p>\n                                 </div>\n                                </div></td>\n                              </tr>\n                             </tbody>\n                            </table>\n                           </div></td>\n                         </tr>\n                        </tbody>\n                       </table>\n                      </div>\n                     </div></td>\n                   </tr>\n                  </tbody>\n                 </table></td>\n               </tr>\n              </tbody>\n             </table></td>\n            <td style=\"width: 40%; max-width: 40%; min-height: 1px; font-size: 13px; text-align: left; direction: ltr; vertical-align: top; padding: 0px;\">\n             <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"vertical-align: top;\">\n              <tbody>\n               <tr>\n                <td align=\"center\" style=\"font-size: 0px; word-break: break-word;\">\n                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-spacing: 0px; width: 100%;\">\n                  <tbody>\n                   <tr>\n                    <td>\n                     <div class=\"full\">\n                      <div style=\"margin: 0px auto; max-width: 600px; line-height: 0px;\">\n                       <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 240px;\">\n                        <tbody>\n                         <tr>\n                          <td style=\"direction: ltr; font-size: 0px; padding: 0px; text-align: center; vertical-align: top;\">\n                           <div class=\"outlook-group-fix\" style=\"line-height: 0px; font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n                            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n                             <tbody>\n                              <tr>\n                               <td align=\"center\" style=\"font-size: 0px; padding: 25px 0px; word-break: break-word; width: 240px; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 10% 50%;\">\n                                <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse: collapse; border-spacing: 0px;\">\n                                 <tbody>\n                                  <tr>\n                                   <td style=\"width: 375px; border-top: 1px solid rgb(204, 204, 204);\"></td>\n                                  </tr>\n                                 </tbody>\n                                </table></td>\n                              </tr>\n                             </tbody>\n                            </table>\n                           </div></td>\n                         </tr>\n                        </tbody>\n                       </table>\n                      </div>\n                     </div></td>\n                   </tr>\n                  </tbody>\n                 </table></td>\n               </tr>\n              </tbody>\n             </table></td>\n           </tr>\n          </tbody>\n         </table></td>\n       </tr>\n      </tbody>\n     </table>\n    </div>\n   </div>\n   <div class=\"full\">\n    <div style=\"margin: 0px auto; max-width: 600px;\">\n     <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 600px;\">\n      <tbody>\n       <tr>\n        <td style=\"direction: ltr; width: 600px; font-size: 0px; padding-bottom: 0px; text-align: center; vertical-align: top; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 10% 50%;\">\n         <div style=\"font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n          <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n           <tbody>\n            <tr>\n             <td align=\"left\" style=\"font-size: 0px; padding: 6px 20px; word-break: break-word;\">\n              <div class=\"text\" style=\"margin: 0px; text-align: left; color: rgb(188, 12, 39); font-size: 21px;\">\n               <div>\n                <p style=\"line-height: 20px; margin: 0px;\">{ErrorMsg}</p>\n               </div>\n              </div></td>\n            </tr>\n           </tbody>\n          </table>\n         </div></td>\n       </tr>\n      </tbody>\n     </table>\n    </div>\n   </div>\n   <div class=\"full\">\n    <div style=\"margin: 0px auto; max-width: 600px;\">\n     <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 600px;\">\n      <tbody>\n       <tr>\n        <td style=\"direction: ltr; font-size: 0px; padding-top: 0px; text-align: center; vertical-align: top;\">\n         <div class=\"outlook-group-fix\" style=\"font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n          <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n           <tbody>\n            <tr>\n             <td align=\"center\" vertical-align=\"middle\" style=\"padding-top: 15px; width: 600px; background-image: url(&quot;&quot;); background-size: 100px; background-position: 10% 50%; background-repeat: no-repeat;\"></td>\n            </tr>\n           </tbody>\n          </table>\n         </div></td>\n       </tr>\n      </tbody>\n     </table>\n    </div>\n   </div>\n   <div>\n    <div style=\"margin: 0px auto; max-width: 600px;\">\n     <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"background-color: rgb(255, 255, 255); background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 1% 50%;\">\n      <tbody>\n       <tr>\n        <td style=\"direction: ltr; font-size: 0px; text-align: center; vertical-align: top; width: 600px;\">\n         <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n          <tbody>\n           <tr>\n            <td style=\"width: 40%; max-width: 40%; min-height: 1px; font-size: 13px; text-align: left; direction: ltr; vertical-align: top; padding: 0px;\">\n             <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"vertical-align: top;\">\n              <tbody>\n               <tr>\n                <td align=\"center\" style=\"font-size: 0px; word-break: break-word;\">\n                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-spacing: 0px; width: 100%;\">\n                  <tbody>\n                   <tr>\n                    <td>\n                     <div class=\"full\">\n                      <div style=\"margin: 0px auto; max-width: 600px; line-height: 0px;\">\n                       <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 240px;\">\n                        <tbody>\n                         <tr>\n                          <td style=\"direction: ltr; font-size: 0px; padding: 0px; text-align: center; vertical-align: top;\">\n                           <div class=\"outlook-group-fix\" style=\"line-height: 0px; font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n                            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n                             <tbody>\n                              <tr>\n                               <td align=\"center\" style=\"font-size: 0px; padding: 25px 0px; word-break: break-word; width: 240px; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 10% 50%;\">\n                                <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse: collapse; border-spacing: 0px;\">\n                                 <tbody>\n                                  <tr>\n                                   <td style=\"width: 375px; border-top: 1px solid rgb(204, 204, 204);\"></td>\n                                  </tr>\n                                 </tbody>\n                                </table></td>\n                              </tr>\n                             </tbody>\n                            </table>\n                           </div></td>\n                         </tr>\n                        </tbody>\n                       </table>\n                      </div>\n                     </div></td>\n                   </tr>\n                  </tbody>\n                 </table></td>\n               </tr>\n              </tbody>\n             </table></td>\n            <td style=\"width: 20%; max-width: 20%; min-height: 1px; font-size: 13px; text-align: left; direction: ltr; vertical-align: top; padding: 0px;\">\n             <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"vertical-align: top;\">\n              <tbody>\n               <tr>\n                <td align=\"center\" style=\"font-size: 0px; word-break: break-word;\">\n                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-spacing: 0px; width: 100%;\">\n                  <tbody>\n                   <tr>\n                    <td>\n                     <div class=\"full\">\n                      <div style=\"margin: 0px auto; max-width: 600px;\">\n                       <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 120px;\">\n                        <tbody>\n                         <tr>\n                          <td style=\"direction: ltr; width: 120px; font-size: 0px; padding-bottom: 0px; text-align: center; vertical-align: top; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 10% 50%;\">\n                           <div style=\"font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n                            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n                             <tbody>\n                              <tr>\n                               <td align=\"left\" style=\"font-size: 0px; padding: 13px 20px; word-break: break-word;\">\n                                <div class=\"text\" style=\"margin: 0px; text-align: center; color: rgb(51, 51, 51); font-size: 16px;\">\n                                 <div>\n                                  <p style=\"line-height: 20px; margin: 0px;\">详情</p>\n                                 </div>\n                                </div></td>\n                              </tr>\n                             </tbody>\n                            </table>\n                           </div></td>\n                         </tr>\n                        </tbody>\n                       </table>\n                      </div>\n                     </div></td>\n                   </tr>\n                  </tbody>\n                 </table></td>\n               </tr>\n              </tbody>\n             </table></td>\n            <td style=\"width: 40%; max-width: 40%; min-height: 1px; font-size: 13px; text-align: left; direction: ltr; vertical-align: top; padding: 0px;\">\n             <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"vertical-align: top;\">\n              <tbody>\n               <tr>\n                <td align=\"center\" style=\"font-size: 0px; word-break: break-word;\">\n                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-spacing: 0px; width: 100%;\">\n                  <tbody>\n                   <tr>\n                    <td>\n                     <div class=\"full\">\n                      <div style=\"margin: 0px auto; max-width: 600px; line-height: 0px;\">\n                       <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 240px;\">\n                        <tbody>\n                         <tr>\n                          <td style=\"direction: ltr; font-size: 0px; padding: 0px; text-align: center; vertical-align: top;\">\n                           <div class=\"outlook-group-fix\" style=\"line-height: 0px; font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n                            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n                             <tbody>\n                              <tr>\n                               <td align=\"center\" style=\"font-size: 0px; padding: 25px 0px; word-break: break-word; width: 240px; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 10% 50%;\">\n                                <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse: collapse; border-spacing: 0px;\">\n                                 <tbody>\n                                  <tr>\n                                   <td style=\"width: 375px; border-top: 1px solid rgb(204, 204, 204);\"></td>\n                                  </tr>\n                                 </tbody>\n                                </table></td>\n                              </tr>\n                             </tbody>\n                            </table>\n                           </div></td>\n                         </tr>\n                        </tbody>\n                       </table>\n                      </div>\n                     </div></td>\n                   </tr>\n                  </tbody>\n                 </table></td>\n               </tr>\n              </tbody>\n             </table></td>\n           </tr>\n          </tbody>\n         </table></td>\n       </tr>\n      </tbody>\n     </table>\n    </div>\n   </div>\n   <div>\n    <div style=\"margin: 0px auto; max-width: 600px;\">\n     <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"background-color: rgb(241, 245, 240); background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 1% 50%;\">\n      <tbody>\n       <tr>\n        <td style=\"direction: ltr; font-size: 0px; text-align: center; vertical-align: top; width: 600px;\">\n         <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n          <tbody>\n           <tr>\n            <td style=\"width: 100%; max-width: 100%; min-height: 1px; font-size: 13px; text-align: left; direction: ltr; vertical-align: top; padding: 0px;\">\n             <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"vertical-align: top;\">\n              <tbody>\n               <tr>\n                <td align=\"center\" style=\"font-size: 0px; word-break: break-word;\">\n                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-spacing: 0px; width: 100%;\">\n                  <tbody>\n                   <tr>\n                    <td>\n                     <div columnnumber=\"3\">\n                      <div>\n                       <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width: 100%;\">\n                        <tbody>\n                         <tr>\n                          <td style=\"direction: ltr; font-size: 0px; text-align: center; vertical-align: top; border: 0px;\"><a target=\"_blank\" href=\"javascript:;\" style=\"cursor: default;\">\n                            <div class=\"mj-column-per-25\" style=\"width: 100%; max-width: 100%; font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top;\">\n                             <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"vertical-align: top;\">\n                              <tbody>\n                               <tr>\n                                <td align=\"center\" border=\"0\" style=\"font-size: 0px; word-break: break-word;\">\n                                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-spacing: 0px; width: 100%;\">\n                                  <tbody>\n                                   <tr>\n                                    <td border=\"0\">\n                                     <div class=\"full\">\n                                      <div style=\"margin: 0px auto; max-width: 600px;\">\n                                       <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 600px;\">\n                                        <tbody>\n                                         <tr>\n                                          <td style=\"direction: ltr; width: 600px; font-size: 0px; padding-bottom: 0px; text-align: center; vertical-align: top; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 10% 50%;\">\n                                           <div style=\"font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n                                            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n                                             <tbody>\n                                              <tr>\n                                               <td align=\"left\" style=\"font-size: 0px; padding: 10px 20px; word-break: break-word;\">\n                                                <div class=\"text\" style=\"margin: 0px; text-align: left; color: rgb(102, 102, 102); font-size: 12px;\">\n                                                 <div>\n                                                  <p style=\"line-height: 20px; margin: 0px;\">请求时间：</p>\n                                                 </div>\n                                                </div></td>\n                                              </tr>\n                                             </tbody>\n                                            </table>\n                                           </div></td>\n                                         </tr>\n                                        </tbody>\n                                       </table>\n                                      </div>\n                                     </div></td>\n                                   </tr>\n                                  </tbody>\n                                 </table></td>\n                               </tr>\n                              </tbody>\n                             </table>\n                            </div>\n                            <div class=\"mj-column-per-25\" style=\"width: 100%; max-width: 100%; font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top;\">\n                             <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"vertical-align: top;\">\n                              <tbody>\n                               <tr>\n                                <td align=\"center\" border=\"0\" style=\"font-size: 0px; word-break: break-word;\">\n                                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-spacing: 0px; width: 100%;\">\n                                  <tbody>\n                                   <tr>\n                                    <td border=\"0\">\n                                     <div class=\"full\">\n                                      <div style=\"margin: 0px auto; max-width: 600px;\">\n                                       <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 600px;\">\n                                        <tbody>\n                                         <tr>\n                                          <td style=\"direction: ltr; width: 600px; font-size: 0px; padding-bottom: 0px; text-align: center; vertical-align: top; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 10% 50%;\">\n                                           <div style=\"font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n                                            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n                                             <tbody>\n                                              <tr>\n                                               <td align=\"left\" style=\"font-size: 0px; padding: 0px 20px; word-break: break-word;\">\n                                                <div class=\"text\" style=\"margin: 0px; text-align: left; color: rgb(102, 102, 102); font-size: 12px;\">\n                                                 <div>\n                                                  <p style=\"line-height: 20px; margin: 0px;\">{RequestTime}</p>\n                                                 </div>\n                                                </div></td>\n                                              </tr>\n                                             </tbody>\n                                            </table>\n                                           </div></td>\n                                         </tr>\n                                        </tbody>\n                                       </table>\n                                      </div>\n                                     </div></td>\n                                   </tr>\n                                  </tbody>\n                                 </table></td>\n                               </tr>\n                              </tbody>\n                             </table>\n                            </div>\n                            <div class=\"mj-column-per-25\" style=\"width: 100%; max-width: 100%; font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top;\">\n                             <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"vertical-align: top;\">\n                              <tbody>\n                               <tr>\n                                <td align=\"center\" border=\"0\" style=\"font-size: 0px; word-break: break-word;\">\n                                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-spacing: 0px; width: 100%;\">\n                                  <tbody>\n                                   <tr>\n                                    <td border=\"0\">\n                                     <div class=\"full\">\n                                      <div style=\"margin: 0px auto; max-width: 600px;\">\n                                       <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 600px;\">\n                                        <tbody>\n                                         <tr>\n                                          <td style=\"direction: ltr; width: 600px; font-size: 0px; padding-bottom: 0px; text-align: center; vertical-align: top; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 10% 50%;\">\n                                           <div style=\"font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n                                            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n                                             <tbody>\n                                              <tr>\n                                               <td align=\"left\" style=\"font-size: 0px; padding: 10px 20px; word-break: break-word;\">\n                                                <div class=\"text\" style=\"margin: 0px; text-align: left; color: rgb(102, 102, 102); font-size: 12px;\">\n                                                 <div>\n                                                  <p style=\"line-height: 20px; margin: 0px;\">请求地址：</p>\n                                                 </div>\n                                                </div></td>\n                                              </tr>\n                                             </tbody>\n                                            </table>\n                                           </div></td>\n                                         </tr>\n                                        </tbody>\n                                       </table>\n                                      </div>\n                                     </div></td>\n                                   </tr>\n                                  </tbody>\n                                 </table></td>\n                               </tr>\n                              </tbody>\n                             </table>\n                            </div>\n                            <div class=\"mj-column-per-25\" style=\"width: 100%; max-width: 100%; font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top;\">\n                             <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"vertical-align: top;\">\n                              <tbody>\n                               <tr>\n                                <td align=\"center\" border=\"0\" style=\"font-size: 0px; word-break: break-word;\">\n                                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-spacing: 0px; width: 100%;\">\n                                  <tbody>\n                                   <tr>\n                                    <td border=\"0\">\n                                     <div class=\"full\">\n                                      <div style=\"margin: 0px auto; max-width: 600px;\">\n                                       <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 600px;\">\n                                        <tbody>\n                                         <tr>\n                                          <td style=\"direction: ltr; width: 600px; font-size: 0px; padding-bottom: 0px; text-align: center; vertical-align: top; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 10% 50%;\">\n                                           <div style=\"font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n                                            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n                                             <tbody>\n                                              <tr>\n                                               <td align=\"left\" style=\"font-size: 0px; padding: 0px 20px; word-break: break-word;\">\n                                                <div class=\"text\" style=\"margin: 0px; text-align: left; color: rgb(102, 102, 102); font-size: 12px;\">\n                                                 <div>\n                                                  <p style=\"line-height: 20px; margin: 0px;\">{RequestURL}</p>\n                                                 </div>\n                                                </div></td>\n                                              </tr>\n                                             </tbody>\n                                            </table>\n                                           </div></td>\n                                         </tr>\n                                        </tbody>\n                                       </table>\n                                      </div>\n                                     </div></td>\n                                   </tr>\n                                  </tbody>\n                                 </table></td>\n                               </tr>\n                              </tbody>\n                             </table>\n                            </div>\n                            <div class=\"mj-column-per-25\" style=\"width: 100%; max-width: 100%; font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top;\">\n                             <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"vertical-align: top;\">\n                              <tbody>\n                               <tr>\n                                <td align=\"center\" border=\"0\" style=\"font-size: 0px; word-break: break-word;\">\n                                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-spacing: 0px; width: 100%;\">\n                                  <tbody>\n                                   <tr>\n                                    <td border=\"0\">\n                                     <div class=\"full\">\n                                      <div style=\"margin: 0px auto; max-width: 600px;\">\n                                       <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 600px;\">\n                                        <tbody>\n                                         <tr>\n                                          <td style=\"direction: ltr; width: 600px; font-size: 0px; padding-bottom: 0px; text-align: center; vertical-align: top; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 10% 50%;\">\n                                           <div style=\"font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n                                            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n                                             <tbody>\n                                              <tr>\n                                               <td align=\"left\" style=\"font-size: 0px; padding: 10px 20px; word-break: break-word;\">\n                                                <div class=\"text\" style=\"margin: 0px; text-align: left; color: rgb(102, 102, 102); font-size: 12px;\">\n                                                 <div>\n                                                  <p style=\"line-height: 20px; margin: 0px;\">请求 UA：</p>\n                                                 </div>\n                                                </div></td>\n                                              </tr>\n                                             </tbody>\n                                            </table>\n                                           </div></td>\n                                         </tr>\n                                        </tbody>\n                                       </table>\n                                      </div>\n                                     </div></td>\n                                   </tr>\n                                  </tbody>\n                                 </table></td>\n                               </tr>\n                              </tbody>\n                             </table>\n                            </div>\n                            <div class=\"mj-column-per-25\" style=\"width: 100%; max-width: 100%; font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top;\">\n                             <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"vertical-align: top;\">\n                              <tbody>\n                               <tr>\n                                <td align=\"center\" border=\"0\" style=\"font-size: 0px; word-break: break-word;\">\n                                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-spacing: 0px; width: 100%;\">\n                                  <tbody>\n                                   <tr>\n                                    <td border=\"0\">\n                                     <div class=\"full\">\n                                      <div style=\"margin: 0px auto; max-width: 600px;\">\n                                       <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 600px;\">\n                                        <tbody>\n                                         <tr>\n                                          <td style=\"direction: ltr; width: 600px; font-size: 0px; padding-bottom: 0px; text-align: center; vertical-align: top; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 10% 50%;\">\n                                           <div style=\"font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n                                            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n                                             <tbody>\n                                              <tr>\n                                               <td align=\"left\" style=\"font-size: 0px; padding: 0px 20px; word-break: break-word;\">\n                                                <div class=\"text\" style=\"margin: 0px; text-align: left; color: rgb(102, 102, 102); font-size: 12px;\">\n                                                 <div>\n                                                  <p style=\"line-height: 20px; margin: 0px;\">{RequestUA}</p>\n                                                 </div>\n                                                </div></td>\n                                              </tr>\n                                             </tbody>\n                                            </table>\n                                           </div></td>\n                                         </tr>\n                                        </tbody>\n                                       </table>\n                                      </div>\n                                     </div></td>\n                                   </tr>\n                                  </tbody>\n                                 </table></td>\n                               </tr>\n                              </tbody>\n                             </table>\n                            </div>\n                            <div class=\"mj-column-per-25\" style=\"width: 100%; max-width: 100%; font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top;\">\n                             <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"vertical-align: top;\">\n                              <tbody>\n                               <tr>\n                                <td align=\"center\" border=\"0\" style=\"font-size: 0px; word-break: break-word;\">\n                                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-spacing: 0px; width: 100%;\">\n                                  <tbody>\n                                   <tr>\n                                    <td border=\"0\">\n                                     <div class=\"full\">\n                                      <div style=\"margin: 0px auto; max-width: 600px;\">\n                                       <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 600px;\">\n                                        <tbody>\n                                         <tr>\n                                          <td style=\"direction: ltr; width: 600px; font-size: 0px; padding-bottom: 0px; text-align: center; vertical-align: top; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 10% 50%;\">\n                                           <div style=\"font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n                                            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n                                             <tbody>\n                                              <tr>\n                                               <td align=\"left\" style=\"font-size: 0px; padding: 10px 20px; word-break: break-word;\">\n                                                <div class=\"text\" style=\"margin: 0px; text-align: left; color: rgb(102, 102, 102); font-size: 12px;\">\n                                                 <div>\n                                                  <p style=\"line-height: 20px; margin: 0px;\">请求 IP：</p>\n                                                 </div>\n                                                </div></td>\n                                              </tr>\n                                             </tbody>\n                                            </table>\n                                           </div></td>\n                                         </tr>\n                                        </tbody>\n                                       </table>\n                                      </div>\n                                     </div></td>\n                                   </tr>\n                                  </tbody>\n                                 </table></td>\n                               </tr>\n                              </tbody>\n                             </table>\n                            </div>\n                            <div class=\"mj-column-per-25\" style=\"width: 100%; max-width: 100%; font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top;\">\n                             <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"vertical-align: top;\">\n                              <tbody>\n                               <tr>\n                                <td align=\"center\" border=\"0\" style=\"font-size: 0px; word-break: break-word;\">\n                                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-spacing: 0px; width: 100%;\">\n                                  <tbody>\n                                   <tr>\n                                    <td border=\"0\">\n                                     <div class=\"full\">\n                                      <div style=\"margin: 0px auto; max-width: 600px;\">\n                                       <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 600px;\">\n                                        <tbody>\n                                         <tr>\n                                          <td style=\"direction: ltr; width: 600px; font-size: 0px; padding-bottom: 0px; text-align: center; vertical-align: top; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 10% 50%;\">\n                                           <div style=\"font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n                                            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n                                             <tbody>\n                                              <tr>\n                                               <td align=\"left\" style=\"font-size: 0px; padding: 0px 20px; word-break: break-word;\">\n                                                <div class=\"text\" style=\"margin: 0px; text-align: left; color: rgb(102, 102, 102); font-size: 12px;\">\n                                                 <div>\n                                                  <p style=\"line-height: 20px; margin: 0px;\">{RequestIP}</p>\n                                                 </div>\n                                                </div></td>\n                                              </tr>\n                                             </tbody>\n                                            </table>\n                                           </div></td>\n                                         </tr>\n                                        </tbody>\n                                       </table>\n                                      </div>\n                                     </div></td>\n                                   </tr>\n                                  </tbody>\n                                 </table></td>\n                               </tr>\n                              </tbody>\n                             </table>\n                            </div>\n                            <div class=\"mj-column-per-25\" style=\"width: 100%; max-width: 100%; font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top;\">\n                             <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"vertical-align: top;\">\n                              <tbody>\n                               <tr>\n                                <td align=\"center\" border=\"0\" style=\"font-size: 0px; word-break: break-word;\">\n                                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-spacing: 0px; width: 100%;\">\n                                  <tbody>\n                                   <tr>\n                                    <td border=\"0\">\n                                     <div class=\"full\">\n                                      <div style=\"margin: 0px auto; max-width: 600px;\">\n                                       <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 600px;\">\n                                        <tbody>\n                                         <tr>\n                                          <td style=\"direction: ltr; width: 600px; font-size: 0px; padding-bottom: 0px; text-align: center; vertical-align: top; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 10% 50%;\">\n                                           <div style=\"font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n                                            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n                                             <tbody>\n                                              <tr>\n                                               <td align=\"left\" style=\"font-size: 0px; padding: 10px 20px; word-break: break-word;\">\n                                                <div class=\"text\" style=\"margin: 0px; text-align: left; color: rgb(102, 102, 102); font-size: 12px;\">\n                                                 <div>\n                                                  <p style=\"line-height: 20px; margin: 0px;\">DebugStack：</p>\n                                                 </div>\n                                                </div></td>\n                                              </tr>\n                                             </tbody>\n                                            </table>\n                                           </div></td>\n                                         </tr>\n                                        </tbody>\n                                       </table>\n                                      </div>\n                                     </div></td>\n                                   </tr>\n                                  </tbody>\n                                 </table></td>\n                               </tr>\n                              </tbody>\n                             </table>\n                            </div>\n                            <div class=\"mj-column-per-25\" style=\"width: 100%; max-width: 100%; font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top;\">\n                             <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"vertical-align: top;\">\n                              <tbody>\n                               <tr>\n                                <td align=\"center\" border=\"0\" style=\"font-size: 0px; word-break: break-word;\">\n                                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-spacing: 0px; width: 100%;\">\n                                  <tbody>\n                                   <tr>\n                                    <td border=\"0\">\n                                     <div class=\"full\">\n                                      <div style=\"margin: 0px auto; max-width: 600px;\">\n                                       <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 600px;\">\n                                        <tbody>\n                                         <tr>\n                                          <td style=\"direction: ltr; width: 600px; font-size: 0px; padding-bottom: 0px; text-align: center; vertical-align: top; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 10% 50%;\">\n                                           <div style=\"font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n                                            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n                                             <tbody>\n                                              <tr>\n                                               <td align=\"left\" style=\"font-size: 0px; padding: 0px 20px; word-break: break-word;\">\n                                                <div class=\"text\" style=\"margin: 0px; text-align: left; color: rgb(102, 102, 102); font-size: 12px;\">\n                                                 <div>\n                                                  <p style=\"line-height: 20px; margin: 0px;\">{DebugStack}</p>\n                                                 </div>\n                                                </div></td>\n                                              </tr>\n                                             </tbody>\n                                            </table>\n                                           </div></td>\n                                         </tr>\n                                        </tbody>\n                                       </table>\n                                      </div>\n                                     </div></td>\n                                   </tr>\n                                  </tbody>\n                                 </table></td>\n                               </tr>\n                              </tbody>\n                             </table>\n                            </div></a></td>\n                         </tr>\n                        </tbody>\n                       </table>\n                      </div>\n                     </div></td>\n                   </tr>\n                  </tbody>\n                 </table></td>\n               </tr>\n              </tbody>\n             </table></td>\n           </tr>\n          </tbody>\n         </table></td>\n       </tr>\n      </tbody>\n     </table>\n    </div>\n   </div>\n   <div class=\"full\">\n    <div style=\"margin: 0px auto; max-width: 600px;\">\n     <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 600px;\">\n      <tbody>\n       <tr>\n        <td style=\"direction: ltr; font-size: 0px; padding-top: 0px; text-align: center; vertical-align: top;\">\n         <div class=\"outlook-group-fix\" style=\"font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n          <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n           <tbody>\n            <tr>\n             <td align=\"center\" vertical-align=\"middle\" style=\"padding-top: 15px; width: 600px; background-image: url(&quot;&quot;); background-size: 100px; background-position: 10% 50%; background-repeat: no-repeat;\"></td>\n            </tr>\n           </tbody>\n          </table>\n         </div></td>\n       </tr>\n      </tbody>\n     </table>\n    </div>\n   </div>\n   <div>\n    <div style=\"margin: 0px auto; max-width: 600px;\">\n     <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"background-color: rgb(65, 207, 88); background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 1% 50%;\">\n      <tbody>\n       <tr>\n        <td style=\"direction: ltr; font-size: 0px; text-align: center; vertical-align: top; width: 600px;\">\n         <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n          <tbody>\n           <tr>\n            <td style=\"width: 100%; max-width: 100%; min-height: 1px; font-size: 13px; text-align: left; direction: ltr; vertical-align: top; padding: 0px;\">\n             <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"vertical-align: top;\">\n              <tbody>\n               <tr>\n                <td align=\"center\" style=\"font-size: 0px; word-break: break-word;\">\n                 <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-spacing: 0px; width: 100%;\">\n                  <tbody>\n                   <tr>\n                    <td>\n                     <div class=\"full\">\n                      <div style=\"margin: 0px auto; max-width: 600px;\">\n                       <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 600px;\">\n                        <tbody>\n                         <tr>\n                          <td style=\"direction: ltr; width: 600px; font-size: 0px; padding-bottom: 0px; text-align: center; vertical-align: top; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-size: 100px; background-position: 10% 50%;\">\n                           <div style=\"font-size: 13px; text-align: left; direction: ltr; display: inline-block; vertical-align: top; width: 100%;\">\n                            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\" style=\"vertical-align: top;\">\n                             <tbody>\n                              <tr>\n                               <td align=\"left\" style=\"font-size: 0px; padding: 20px 10px; word-break: break-word;\">\n                                <div class=\"text\" style=\"margin: 0px; text-align: left; color: rgb(255, 255, 255); font-size: 12px;\">\n                                 <div>\n                                  <p style=\"line-height: 20px; margin: 0px;\">请注意，该邮件地址不接收回复邮件。</p>\n                                 </div>\n                                </div></td>\n                              </tr>\n                             </tbody>\n                            </table>\n                           </div></td>\n                         </tr>\n                        </tbody>\n                       </table>\n                      </div>\n                     </div></td>\n                   </tr>\n                  </tbody>\n                 </table></td>\n               </tr>\n              </tbody>\n             </table></td>\n           </tr>\n          </tbody>\n         </table></td>\n       </tr>\n      </tbody>\n     </table>\n    </div>\n   </div>\n  </div>\n </body>\n</html>`\n"
  },
  {
    "path": "server/http/middleware/panic/panic.go",
    "content": "package panic\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\n\t\"github.com/why444216978/gin-api/library/logger\"\n\t\"github.com/why444216978/gin-api/server/http/response\"\n)\n\nfunc ThrowPanic(l logger.Logger) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tdefer func(c *gin.Context) {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\t// mailDebugStack := \"\"\n\t\t\t\t// debugStack := make(map[int]interface{})\n\t\t\t\t// for k, v := range strings.Split(string(debug.Stack()), \"\\n\") {\n\t\t\t\t// \t//fmt.Println(v)\n\t\t\t\t// \tmailDebugStack += v + \"<br>\"\n\t\t\t\t// \tdebugStack[k] = v\n\t\t\t\t// }\n\n\t\t\t\tctx := c.Request.Context()\n\n\t\t\t\tfields := logger.ValueFields(ctx)\n\t\t\t\tctx = logger.AddField(ctx,\n\t\t\t\t\tlogger.Reflect(logger.Code, http.StatusInternalServerError),\n\t\t\t\t\tlogger.Reflect(logger.Response, map[string]interface{}{\n\t\t\t\t\t\t\"code\":   http.StatusInternalServerError,\n\t\t\t\t\t\t\"toast\":  \"服务器错误\",\n\t\t\t\t\t\t\"data\":   \"\",\n\t\t\t\t\t\t\"errmsg\": \"服务器错误\",\n\t\t\t\t\t}),\n\t\t\t\t\t// logger.Reflect(logger.Trace, debugStack),\n\t\t\t\t)\n\t\t\t\tctx = logger.WithFields(c.Request.Context(), fields)\n\t\t\t\tc.Request = c.Request.WithContext(ctx)\n\n\t\t\t\tl.Error(ctx, fmt.Sprintf(\"%s\", err)) // 这里不能打Fatal和Panic，否则程序会退出\n\t\t\t\tresponse.ResponseJSON(c, http.StatusInternalServerError, nil, response.WrapToast(nil, http.StatusText(http.StatusInternalServerError)))\n\t\t\t\tc.AbortWithStatus(http.StatusInternalServerError)\n\n\t\t\t\t//subject := fmt.Sprintf(\"【重要错误】%s 项目出错了！\", \"go-gin\")\n\t\t\t\t//\n\t\t\t\t//body := strings.ReplaceAll(MailTemplate, \"{ErrorMsg}\", fmt.Sprintf(\"%s\", err))\n\t\t\t\t//body = strings.ReplaceAll(body, \"{RequestTime}\", util_time.GetCurrentDate())\n\t\t\t\t//body = strings.ReplaceAll(body, \"{RequestURL}\", c.Request.Method+\"  \"+c.Request.Host+c.Request.RequestURI)\n\t\t\t\t//body = strings.ReplaceAll(body, \"{RequestUA}\", c.Request.UserAgent())\n\t\t\t\t//body = strings.ReplaceAll(body, \"{RequestIP}\", c.ClientIP())\n\t\t\t\t//body = strings.ReplaceAll(body, \"{DebugStack}\", mailDebugStack)\n\t\t\t\t//\n\t\t\t\t//options := &mail.Options{\n\t\t\t\t//\tMailHost: \"smtp.163.com\",\n\t\t\t\t//\tMailPort: 465,\n\t\t\t\t//\tMailUser: \"weihaoyu@163.com\",\n\t\t\t\t//\tMailPass: \"\",\n\t\t\t\t//\tMailTo:   \"weihaoyu@163.com\",\n\t\t\t\t//\tSubject:  subject,\n\t\t\t\t//\tBody:     body,\n\t\t\t\t//}\n\t\t\t\t//_ = mail.Send(options)\n\t\t\t}\n\t\t}(c)\n\t\tc.Next()\n\t}\n}\n"
  },
  {
    "path": "server/http/middleware/timeout/timeout.go",
    "content": "package timeout\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"strconv\"\n\t\"time\"\n\n\t\"github.com/gin-gonic/gin\"\n)\n\nconst (\n\tTimeoutKey = \"Timeout-Millisecond\"\n\tstartKey   = \"Timeout-StartAt\"\n)\n\n// TimeoutMiddleware  超时控制中间件\nfunc TimeoutMiddleware(timeout time.Duration) func(c *gin.Context) {\n\treturn func(c *gin.Context) {\n\t\tremain := timeout\n\t\theaderTimeout := c.Request.Header.Get(TimeoutKey)\n\t\tif headerTimeout != \"\" {\n\t\t\tt, _ := strconv.ParseInt(headerTimeout, 10, 64)\n\t\t\tremain = time.Duration(t) * time.Millisecond\n\t\t}\n\n\t\tctx, cancel := context.WithTimeout(c.Request.Context(), remain)\n\t\t_ = cancel\n\n\t\tctx = SetStart(ctx, remain.Milliseconds())\n\n\t\tc.Request = c.Request.WithContext(ctx)\n\n\t\tc.Next()\n\t}\n}\n\nfunc SetStart(ctx context.Context, timeout int64) context.Context {\n\tctx = context.WithValue(ctx, TimeoutKey, timeout)\n\treturn context.WithValue(ctx, startKey, nowMillisecond())\n}\n\nfunc CalcRemainTimeout(ctx context.Context) (int64, error) {\n\ttimeout, ok := ctx.Value(TimeoutKey).(int64)\n\tif !ok {\n\t\treturn 0, nil\n\t}\n\n\tstartAt, ok := ctx.Value(startKey).(int64)\n\tif !ok {\n\t\treturn 0, errors.New(\"miss startAt\")\n\t}\n\n\tremain := timeout - (nowMillisecond() - startAt)\n\tif remain < 0 {\n\t\treturn 0, errors.New(\"timeout < diff, context deadline exceeded\")\n\t}\n\n\treturn remain, nil\n}\n\nfunc nowMillisecond() int64 {\n\treturn time.Now().UnixNano() / 1e6\n}\n"
  },
  {
    "path": "server/http/response/error.go",
    "content": "package response\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/pkg/errors\"\n)\n\ntype ResponseError struct {\n\ttoast string\n\terr   error\n}\n\n// Toast\nfunc (r *ResponseError) Toast() string { return r.toast }\n\n// SetToast\nfunc (r *ResponseError) SetToast(toast string) { r.toast = toast }\n\n// Error\nfunc (r *ResponseError) Error() string { return r.err.Error() }\n\n// SetError\nfunc (r *ResponseError) SetError(err error) { r.err = err }\n\n// Unwrap\nfunc (r *ResponseError) Unwrap() error { return r.err }\n\n// Cause\nfunc (r *ResponseError) Cause() error { return r.err }\n\n// WrapToast return a new ResponseError\nfunc WrapToast(err error, toast string) *ResponseError {\n\tif err == nil {\n\t\treturn &ResponseError{\n\t\t\terr:   errors.New(toast),\n\t\t\ttoast: toast,\n\t\t}\n\t}\n\n\treturn &ResponseError{\n\t\terr:   errors.Wrap(err, toast),\n\t\ttoast: toast,\n\t}\n}\n\n// WrapToastf return a new format ResponseError\nfunc WrapToastf(err error, toast string, args ...interface{}) *ResponseError {\n\tif err == nil {\n\t\treturn &ResponseError{\n\t\t\terr:   errors.Errorf(toast, args...),\n\t\t\ttoast: fmt.Sprintf(toast, args...),\n\t\t}\n\t}\n\n\treturn &ResponseError{\n\t\terr:   errors.Wrapf(err, toast, args...),\n\t\ttoast: fmt.Sprintf(toast, args...),\n\t}\n}\n"
  },
  {
    "path": "server/http/response/response.go",
    "content": "package response\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/gin-gonic/gin\"\n\t\"github.com/why444216978/go-util/assert\"\n\n\t\"github.com/why444216978/gin-api/library/logger\"\n)\n\ntype Code int\n\ntype response struct {\n\tCode    Code        `json:\"code\"`\n\tToast   string      `json:\"toast\"`\n\tData    interface{} `json:\"data\"`\n\tErrMsg  string      `json:\"errmsg\"`\n\tTraceID string      `json:\"trace_id\"`\n}\n\nfunc ResponseJSON(c *gin.Context, code Code, data interface{}, err *ResponseError) {\n\tif assert.IsNil(data) {\n\t\tdata = make(map[string]interface{})\n\t}\n\n\t// prevent panic\n\tif err == nil {\n\t\terr = WrapToast(nil, \"toast\")\n\t}\n\n\tc.JSON(http.StatusOK, response{\n\t\tCode:    code,\n\t\tToast:   err.Toast(),\n\t\tData:    data,\n\t\tErrMsg:  err.Error(),\n\t\tTraceID: logger.ValueTraceID(c.Request.Context()),\n\t})\n\tc.Abort()\n}\n"
  },
  {
    "path": "server/http/server.go",
    "content": "package http\n\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"runtime\"\n\t\"time\"\n\n\t\"github.com/gin-contrib/pprof\"\n\t\"github.com/gin-gonic/gin\"\n\n\t\"github.com/why444216978/gin-api/server\"\n\t\"github.com/why444216978/gin-api/server/http/response\"\n)\n\ntype Server struct {\n\t*http.Server\n\tmiddlewares        []gin.HandlerFunc\n\tregisterRouterFunc RegisterRouter\n\tpprofTurn          bool\n\tisDebug            bool\n\tonShutdown         []func()\n}\n\nvar _ server.Server = (*Server)(nil)\n\ntype RegisterRouter func(server *gin.Engine)\n\ntype Option func(s *Server)\n\nfunc WithReadTimeout(timeout time.Duration) Option {\n\treturn func(s *Server) { s.Server.ReadTimeout = timeout }\n}\n\nfunc WithWriteTimeout(timeout time.Duration) Option {\n\treturn func(s *Server) { s.Server.WriteTimeout = timeout }\n}\n\nfunc WithMiddlewares(middlewares ...gin.HandlerFunc) Option {\n\treturn func(s *Server) { s.middlewares = middlewares }\n}\n\nfunc WithRegisterRouter(r RegisterRouter) Option {\n\treturn func(s *Server) { s.registerRouterFunc = r }\n}\n\nfunc WithPprof(pprofTurn bool) Option {\n\treturn func(s *Server) { s.pprofTurn = pprofTurn }\n}\n\nfunc WithDebug(isDebug bool) Option {\n\treturn func(s *Server) { s.isDebug = isDebug }\n}\n\nfunc WithOnShutDown(onShutdown []func()) Option {\n\treturn func(s *Server) { s.onShutdown = onShutdown }\n}\n\nfunc New(addr string, opts ...Option) *Server {\n\ts := &Server{\n\t\tServer: &http.Server{\n\t\t\tAddr: addr,\n\t\t},\n\t}\n\n\tfor _, o := range opts {\n\t\to(s)\n\t}\n\n\tfor _, f := range s.onShutdown {\n\t\ts.Server.RegisterOnShutdown(f)\n\t}\n\n\ts.Handler = s.initHandler()\n\n\treturn s\n}\n\nfunc (s *Server) Start() (err error) {\n\terr = s.Server.ListenAndServe()\n\tif err == http.ErrServerClosed {\n\t\treturn nil\n\t}\n\treturn\n}\n\nfunc (s *Server) Close() (err error) {\n\tctx, _ := context.WithTimeout(context.Background(), time.Second*3)\n\treturn s.Server.Shutdown(ctx)\n}\n\nfunc (s *Server) initHandler() *gin.Engine {\n\tserver := gin.New()\n\n\tif !s.isDebug {\n\t\tgin.SetMode(gin.ReleaseMode)\n\t}\n\n\ts.startPprof(server)\n\n\tserver.Use(s.middlewares...)\n\n\tif s.registerRouterFunc != nil {\n\t\ts.registerRouterFunc(server)\n\t}\n\n\tserver.NoRoute(func(c *gin.Context) {\n\t\tresponse.ResponseJSON(c, http.StatusNotFound, nil, response.WrapToast(nil, http.StatusText(http.StatusNotFound)))\n\t\tc.AbortWithStatus(http.StatusNotFound)\n\t})\n\n\treturn server\n}\n\nfunc (s *Server) startPprof(server *gin.Engine) {\n\tif !s.pprofTurn {\n\t\treturn\n\t}\n\n\truntime.SetBlockProfileRate(1)\n\truntime.SetMutexProfileFraction(1)\n\tpprof.Register(server)\n}\n"
  },
  {
    "path": "server/http/util/util.go",
    "content": "package util\n\nimport (\n\t\"bytes\"\n\n\t\"github.com/gin-gonic/gin\"\n)\n\n//定义新的struck，继承gin的ResponseWriter\n//添加body字段，用于将response暴露给日志\ntype BodyWriter struct {\n\tgin.ResponseWriter\n\tBody *bytes.Buffer\n}\n\n//gin的ResponseWriter继承的底层http server\n//实现http的Write方法，额外添加一个body字段，用于获取response body\nfunc (w BodyWriter) Write(b []byte) (int, error) {\n\tw.Body.Write(b)\n\treturn w.ResponseWriter.Write(b)\n}\n"
  },
  {
    "path": "server/server.go",
    "content": "package server\n\nimport (\n\t\"context\"\n\t\"errors\"\n)\n\ntype Server interface {\n\tStart() error\n\tClose() error\n}\n\n// CloseFunc 资源回收方法列表\nvar CloseFunc = make([]func(ctx context.Context) error, 0)\n\n// RegisterCloseFunc 注册资源回收方法\nfunc RegisterCloseFunc(cf interface{}) error {\n\tf, ok := cf.(func(ctx context.Context) error)\n\tif !ok {\n\t\treturn errors.New(\"func type error\")\n\t}\n\n\tCloseFunc = append(CloseFunc, f)\n\treturn nil\n}\n"
  }
]