songxiaohang пре 2 година
родитељ
комит
c254df49c2
100 измењених фајлова са 6936 додато и 9 уклоњено
  1. 2 2
      .idea/GtDataStore.iml
  2. 34 0
      app/cmd/api/datacenter.go
  3. 31 0
      app/cmd/api/desc/datacenter.api
  4. 146 0
      app/cmd/api/desc/datacenter/datacenter.api
  5. 25 0
      app/cmd/api/etc/datacenter.yaml
  6. 15 0
      app/cmd/api/internal/config/config.go
  7. 24 0
      app/cmd/api/internal/handler/datacenter/workingChestHandler.go
  8. 24 0
      app/cmd/api/internal/handler/datacenter/workingPumpHandler.go
  9. 25 0
      app/cmd/api/internal/handler/datacenter/workingRoHandler.go
  10. 25 0
      app/cmd/api/internal/handler/datacenter/workingUfHandler.go
  11. 25 0
      app/cmd/api/internal/handler/datacenter/workingValveHandler.go
  12. 44 0
      app/cmd/api/internal/handler/routes.go
  13. 30 0
      app/cmd/api/internal/logic/datacenter/workingChestLogic.go
  14. 30 0
      app/cmd/api/internal/logic/datacenter/workingPumpLogic.go
  15. 42 0
      app/cmd/api/internal/logic/datacenter/workingRoLogic.go
  16. 41 0
      app/cmd/api/internal/logic/datacenter/workingUfLogic.go
  17. 30 0
      app/cmd/api/internal/logic/datacenter/workingValveLogic.go
  18. 19 0
      app/cmd/api/internal/svc/serviceContext.go
  19. 150 0
      app/cmd/api/internal/types/types.go
  20. 1 1
      app/cmd/organization/etc/organization.yaml
  21. 1 1
      app/model/dcWorkingChestModel.go
  22. 1 1
      app/model/dcWorkingPumpModel.go
  23. 1 1
      app/model/dcWorkingRoModel.go
  24. 1 1
      app/model/dcWorkingUfModel.go
  25. 1 1
      app/model/dcWorkingValveModel.go
  26. 86 0
      common/result/httpResult.go
  27. 44 0
      common/result/jobResult.go
  28. 21 0
      common/result/responseBean.go
  29. 35 0
      common/xerr/errCode.go
  30. 48 0
      common/xerr/errMsg.go
  31. 39 0
      common/xerr/errors.go
  32. 3 1
      go.mod
  33. 3 0
      go.sum
  34. 4 0
      vendor/github.com/golang-jwt/jwt/v4/.gitignore
  35. 9 0
      vendor/github.com/golang-jwt/jwt/v4/LICENSE
  36. 22 0
      vendor/github.com/golang-jwt/jwt/v4/MIGRATION_GUIDE.md
  37. 138 0
      vendor/github.com/golang-jwt/jwt/v4/README.md
  38. 19 0
      vendor/github.com/golang-jwt/jwt/v4/SECURITY.md
  39. 135 0
      vendor/github.com/golang-jwt/jwt/v4/VERSION_HISTORY.md
  40. 269 0
      vendor/github.com/golang-jwt/jwt/v4/claims.go
  41. 4 0
      vendor/github.com/golang-jwt/jwt/v4/doc.go
  42. 142 0
      vendor/github.com/golang-jwt/jwt/v4/ecdsa.go
  43. 69 0
      vendor/github.com/golang-jwt/jwt/v4/ecdsa_utils.go
  44. 85 0
      vendor/github.com/golang-jwt/jwt/v4/ed25519.go
  45. 64 0
      vendor/github.com/golang-jwt/jwt/v4/ed25519_utils.go
  46. 112 0
      vendor/github.com/golang-jwt/jwt/v4/errors.go
  47. 95 0
      vendor/github.com/golang-jwt/jwt/v4/hmac.go
  48. 151 0
      vendor/github.com/golang-jwt/jwt/v4/map_claims.go
  49. 52 0
      vendor/github.com/golang-jwt/jwt/v4/none.go
  50. 177 0
      vendor/github.com/golang-jwt/jwt/v4/parser.go
  51. 29 0
      vendor/github.com/golang-jwt/jwt/v4/parser_option.go
  52. 7 0
      vendor/github.com/golang-jwt/jwt/v4/request/doc.go
  53. 97 0
      vendor/github.com/golang-jwt/jwt/v4/request/extractor.go
  54. 28 0
      vendor/github.com/golang-jwt/jwt/v4/request/oauth2.go
  55. 70 0
      vendor/github.com/golang-jwt/jwt/v4/request/request.go
  56. 101 0
      vendor/github.com/golang-jwt/jwt/v4/rsa.go
  57. 143 0
      vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go
  58. 105 0
      vendor/github.com/golang-jwt/jwt/v4/rsa_utils.go
  59. 46 0
      vendor/github.com/golang-jwt/jwt/v4/signing_method.go
  60. 1 0
      vendor/github.com/golang-jwt/jwt/v4/staticcheck.conf
  61. 143 0
      vendor/github.com/golang-jwt/jwt/v4/token.go
  62. 145 0
      vendor/github.com/golang-jwt/jwt/v4/types.go
  63. 24 0
      vendor/github.com/pkg/errors/.gitignore
  64. 10 0
      vendor/github.com/pkg/errors/.travis.yml
  65. 23 0
      vendor/github.com/pkg/errors/LICENSE
  66. 44 0
      vendor/github.com/pkg/errors/Makefile
  67. 59 0
      vendor/github.com/pkg/errors/README.md
  68. 32 0
      vendor/github.com/pkg/errors/appveyor.yml
  69. 288 0
      vendor/github.com/pkg/errors/errors.go
  70. 38 0
      vendor/github.com/pkg/errors/go113.go
  71. 177 0
      vendor/github.com/pkg/errors/stack.go
  72. 188 0
      vendor/github.com/zeromicro/go-zero/core/codec/aesecb.go
  73. 96 0
      vendor/github.com/zeromicro/go-zero/core/codec/dh.go
  74. 36 0
      vendor/github.com/zeromicro/go-zero/core/codec/gzip.go
  75. 20 0
      vendor/github.com/zeromicro/go-zero/core/codec/hmac.go
  76. 156 0
      vendor/github.com/zeromicro/go-zero/core/codec/rsa.go
  77. 239 0
      vendor/github.com/zeromicro/go-zero/core/search/tree.go
  78. 32 0
      vendor/github.com/zeromicro/go-zero/core/search/tree_debug.go
  79. 45 0
      vendor/github.com/zeromicro/go-zero/core/utils/times.go
  80. 8 0
      vendor/github.com/zeromicro/go-zero/core/utils/uuid.go
  81. 75 0
      vendor/github.com/zeromicro/go-zero/core/utils/version.go
  82. 7 0
      vendor/github.com/zeromicro/go-zero/core/validation/validator.go
  83. 116 0
      vendor/github.com/zeromicro/go-zero/rest/chain/chain.go
  84. 63 0
      vendor/github.com/zeromicro/go-zero/rest/config.go
  85. 353 0
      vendor/github.com/zeromicro/go-zero/rest/engine.go
  86. 122 0
      vendor/github.com/zeromicro/go-zero/rest/handler/authhandler.go
  87. 42 0
      vendor/github.com/zeromicro/go-zero/rest/handler/breakerhandler.go
  88. 69 0
      vendor/github.com/zeromicro/go-zero/rest/handler/contentsecurityhandler.go
  89. 138 0
      vendor/github.com/zeromicro/go-zero/rest/handler/cryptionhandler.go
  90. 28 0
      vendor/github.com/zeromicro/go-zero/rest/handler/gunziphandler.go
  91. 223 0
      vendor/github.com/zeromicro/go-zero/rest/handler/loghandler.go
  92. 28 0
      vendor/github.com/zeromicro/go-zero/rest/handler/maxbyteshandler.go
  93. 38 0
      vendor/github.com/zeromicro/go-zero/rest/handler/maxconnshandler.go
  94. 24 0
      vendor/github.com/zeromicro/go-zero/rest/handler/metrichandler.go
  95. 47 0
      vendor/github.com/zeromicro/go-zero/rest/handler/prometheushandler.go
  96. 23 0
      vendor/github.com/zeromicro/go-zero/rest/handler/recoverhandler.go
  97. 64 0
      vendor/github.com/zeromicro/go-zero/rest/handler/sheddinghandler.go
  98. 242 0
      vendor/github.com/zeromicro/go-zero/rest/handler/timeouthandler.go
  99. 78 0
      vendor/github.com/zeromicro/go-zero/rest/handler/tracehandler.go
  100. 132 0
      vendor/github.com/zeromicro/go-zero/rest/httpx/requests.go

+ 2 - 2
.idea/GtDataStore.iml

@@ -2,7 +2,7 @@
 <module type="WEB_MODULE" version="4">
   <component name="FacetManager">
     <facet type="Python" name="Python facet">
-      <configuration sdkName="Python 3.9 (GtDataStore)" />
+      <configuration sdkName="Python 3.7" />
     </facet>
   </component>
   <component name="Go" enabled="true" />
@@ -12,6 +12,6 @@
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="library" name="Python 3.9 (GtDataStore) interpreter library" level="application" />
+    <orderEntry type="library" name="Python 3.7 interpreter library" level="application" />
   </component>
 </module>

+ 34 - 0
app/cmd/api/datacenter.go

@@ -0,0 +1,34 @@
+package main
+
+import (
+	"GtDataStore/app/cmd/api/internal/config"
+	"GtDataStore/app/cmd/api/internal/handler"
+	"GtDataStore/app/cmd/api/internal/svc"
+	"flag"
+	"fmt"
+	"github.com/zeromicro/go-zero/core/logx"
+
+	"github.com/zeromicro/go-zero/core/conf"
+	"github.com/zeromicro/go-zero/rest"
+)
+
+var configFile = flag.String("f", "etc/datacenter.yaml", "the config file")
+
+func main() {
+	flag.Parse()
+
+	var c config.Config
+	conf.MustLoad(*configFile, &c)
+
+	server := rest.MustNewServer(c.RestConf)
+	defer server.Stop()
+
+	ctx := svc.NewServiceContext(c)
+	handler.RegisterHandlers(server, ctx)
+
+	logx.DisableStat()
+
+	fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
+	server.Start()
+
+}

+ 31 - 0
app/cmd/api/desc/datacenter.api

@@ -0,0 +1,31 @@
+syntax = "v1"
+
+import (
+	"datacenter/datacenter.api"
+)
+
+@server(
+	prefix: api/datacenter/v1
+	group: datacenter
+)
+service datacenter {
+	@doc "查询working uf信息"
+	@handler WorkingUf
+	get /working-uf/info (DcWorkingReq) returns (WorkingUfResp)
+	
+	@doc "查询working ro信息"
+	@handler WorkingRo
+	get /working-ro/info (DcWorkingReq) returns (WorkingRoResp)
+	
+	@doc "查询working chest信息"
+	@handler WorkingChest
+	get /working-chest/info (DcWorkingReq) returns (WorkingChestResp)
+	
+	@doc "查询working pump信息"
+	@handler WorkingPump
+	get /working-pump/info (DcWorkingReq) returns (WorkingPumpResp)
+	
+	@doc "查询working valve信息"
+	@handler WorkingValve
+	get /working-valve/info (DcWorkingReq) returns (WorkingValveResp)
+}

+ 146 - 0
app/cmd/api/desc/datacenter/datacenter.api

@@ -0,0 +1,146 @@
+syntax = "v1"
+
+type DcWorkingUf{
+    Id               int64         `json:"id"`
+    ProjectId        int64         `json:"project_id"`
+    DeviceCode       string        `json:"device_code"`
+    WaterTemperature float64       `json:"water_temperature"` // 水温 摄氏度
+    FeedFlow         float64       `json:"feed_flow"`         // 进水流量
+    ConFlow          float64       `json:"con_flow"`          // 浓水流量
+    ProductFlow      float64       `json:"product_flow"`      // 产水流量
+    FeedPressure     float64       `json:"feed_pressure"`     // 进水压力
+    ConPressure      float64       `json:"con_pressure"`      // 浓水压力
+    ProductPressure  float64       `json:"product_pressure"`  // 产水压力
+    Tmp              float64       `json:"tmp"`               // 跨膜压差
+    Flux             float64       `json:"flux"`              // 膜通量
+    FeedWqTurbidity  float64       `json:"feed_wq_turbidity"` // 进水浊度
+    FeedWqPh         int64         `json:"feed_wq_ph"`        // 进水 PH 值
+    ProductWqPh      int64         `json:"product_wq_ph"`     // 产水 PH 值
+    FeedWqAl         float64       `json:"feed_wq_al"`        // 进水水质:铝
+    ProductWqAl      float64       `json:"product_wq_al"`     // 产水水质:铝
+    FeedWqFe         float64       `json:"feed_wq_fe"`        // 进水水质:铁
+    ProductWqFe      float64       `json:"product_wq_fe"`     // 产水水质:铁
+    FeedWqMn         float64       `json:"feed_wq_mn"`        // 进水水质:锰
+    ProductWqMn      float64       `json:"product_wq_mn"`     // 产水水质:锰
+    FeedWqSio2       float64       `json:"feed_wq_sio2"`      // 进水水质:二氧化硅
+    ProductWqSio2    float64       `json:"product_wq_sio2"`   // 产水水质:二氧化硅
+    FeedWqCod        float64       `json:"feed_wq_cod"`       // 进水水质:COD
+    ProductWqCod     float64       `json:"product_wq_cod"`    // 产水水质:COD
+    FeedWqP          float64       `json:"feed_wq_p"`         // 进水水质:磷
+    ProductWqP       float64       `json:"product_wq_p"`      // 产水水质:磷
+    Step             int64         `json:"step"`              // 设备当前步序值
+    CTime            string        `json:"c_time"`
+}
+
+type DcWorkingRo{
+    Id                 int64         `json:"id"`
+    ProjectId          int64         `json:"project_id"`
+    DeviceCode         string        `json:"device_code"`
+    WaterTemperature   float64       `json:"water_temperature"`    // 水温 摄氏度
+    FeedFlow1St        float64       `json:"feed_flow_1st"`        // 一段进水流量
+    ConFlow1St         float64       `json:"con_flow_1st"`         // 一段浓水流量
+    ProductFlow1St     float64       `json:"product_flow_1st"`     // 一段产水流量
+    FeedPressure1St    float64       `json:"feed_pressure_1st"`    // 一段进水压力
+    ConPressure1St     float64       `json:"con_pressure_1st"`     // 一段浓水压力
+    ProductPressure1St float64       `json:"product_pressure_1st"` // 一段产水压力
+    Tmp1St             float64       `json:"tmp_1st"`              // 一段跨膜压差
+    Flux1St            float64       `json:"flux_1st"`             // 一段膜通量
+    Permeability1St    float64       `json:"permeability_1st"`     // 一段渗透率
+    FeedFlow2Nd        float64       `json:"feed_flow_2nd"`        // 二段进水流量
+    ConFlow2Nd         float64       `json:"con_flow_2nd"`         // 二段浓水流量
+    ProductFlow2Nd     float64       `json:"product_flow_2nd"`     // 二段产水流量
+    FeedPressure2Nd    float64       `json:"feed_pressure_2nd"`    // 二段进水压力
+    ConPressure2Nd     float64       `json:"con_pressure_2nd"`     // 二段浓水压力
+    ProductPressure2Nd float64       `json:"product_pressure_2nd"` // 二段产水压力
+    Tmp2Nd             float64       `json:"tmp_2nd"`              // 二段压差
+    Flux2Nd            float64       `json:"flux_2nd"`             // 二段通量
+    Permeability2Nd    float64       `json:"permeability_2nd"`     // 二段渗透率
+    FeedFlow3Th        float64       `json:"feed_flow_3th"`        // 三段进水流量
+    ConFlow3Th         float64       `json:"con_flow_3th"`         // 三段浓水流量
+    ProductFlow3Th     float64       `json:"product_flow_3th"`     // 三段产水流量
+    FeedPressure3Th    float64       `json:"feed_pressure_3th"`    // 三段进水压力
+    ConPressure3Th     float64       `json:"con_pressure_3th"`     // 三段浓水压力
+    ProductPressure3Th float64       `json:"product_pressure_3th"` // 三段产水压力
+    Tmp3Th             float64       `json:"tmp_3th"`              // 三段压差
+    Flux3Th            float64       `json:"flux_3th"`             // 三段通量
+    Permeability3Th    float64       `json:"permeability_3th"`     // 三段渗透率
+    FeedWqTurbidity    float64       `json:"feed_wq_turbidity"`    // 进水浊度
+    FeedWqPh           int64         `json:"feed_wq_ph"`           // 进水 PH 值
+    ProductWqPh        int64         `json:"product_wq_ph"`        // 产水 PH 值
+    FeedWqAl           float64       `json:"feed_wq_al"`           // 进水水质:铝
+    ProductWqAl        float64       `json:"product_wq_al"`        // 产水水质:铝
+    FeedWqFe           float64       `json:"feed_wq_fe"`           // 进水水质:铁
+    ProductWqFe        float64       `json:"product_wq_fe"`        // 产水水质:铁
+    FeedWqMn           float64       `json:"feed_wq_mn"`           // 进水水质:锰
+    ProductWqMn        float64       `json:"product_wq_mn"`        // 产水水质:锰
+    FeedWqSio2         float64       `json:"feed_wq_sio2"`         // 进水水质:二氧化硅
+    ProductWqSio2      float64       `json:"product_wq_sio2"`      // 产水水质:二氧化硅
+    FeedWqCod          float64       `json:"feed_wq_cod"`          // 进水水质:COD
+    ProductWqCod       float64       `json:"product_wq_cod"`       // 产水水质:COD
+    FeedWqP            float64       `json:"feed_wq_p"`            // 进水水质:磷
+    ProductWqP         float64       `json:"product_wq_p"`         // 产水水质:磷
+    Step               int64         `json:"step"`                 // 设备当前步序值
+    CTime              string        `json:"c_time"`
+}
+
+type DcWorkingChest {
+    Id                  int64     `json:"id"`
+    ProjectId           int64     `json:"project_id"`
+    DeviceCode          string    `json:"device_code"`
+    Switch              int64     `json:"switch"`                // 药箱液位开关 0: 关 1: 开
+    Level               float64   `json:"level"`                 // 液位高度
+    AgitatorStatus      int64     `json:"agitator_status"`       // 搅拌器运行状态 0: 未运行 1:运行中
+    AgitatorDuration    int64     `json:"agitator_duration"`     // 搅拌器运行时长
+    AgitatorFaultStatus int64     `json:"agitator_fault_status"` // 搅拌器故障状态 0:正常 1:故障
+    CTime               string    `json:"c_time"`
+}
+
+type DcWorkingPump {
+    Id           int64     `json:"id"`
+    ProjectId    int64     `json:"project_id"`
+    DeviceCode   string    `json:"device_code"`
+    FeedPressure float64   `json:"feed_pressure"` // 进水压力
+    OutPressure  float64   `json:"out_pressure"`  // 出水压力
+    Duration     int64     `json:"duration"`      // 运行时长 单位 s
+    Current      float64   `json:"current"`       // 运行电流
+    Frequency    float64   `json:"frequency"`     // 运行频率
+    Lift         float64   `json:"lift"`          // 工作扬程
+    Efficiency   float64   `json:"efficiency"`    // 运行效率
+    RunStatus    int64     `json:"run_status"`    // 运行状态 0: 停机 1: 运行正常
+    FaultStatus  int64     `json:"fault_status"`  // 故障状态 0: 正常 1: 故障
+    CTime        string    `json:"c_time"`
+}
+
+type DcWorkingValve {
+    Id          int64     `json:"id"`
+    ProjectId   int64     `json:"project_id"`
+    DeviceCode  string    `json:"device_code"`
+    Adjust      int64     `json:"adjust"`       // 是否为调节阀门 0: 否 1: 是
+    Opening     float64   `json:"opening"`      // 当前阀门的开度
+    Closed      int64     `json:"closed"`       // 关到位 全关  0: 否 1: 是
+    Opened      int64     `json:"opened"`       // 开到位 开到 设置的开度 0: 否 1: 是
+    FaultStatus int64     `json:"fault_status"` // 是否故障 0: 否 1: 是
+    CTime       string    `json:"c_time"`
+}
+
+type (
+    DcWorkingReq{
+        ProjectId           int64       `form:"project_id"`
+        DeviceCode          string      `form:"device_code"`
+    }
+    WorkingUfResp{
+        Info    *DcWorkingUf    `json:"info"`
+    }
+    WorkingRoResp{
+        Info    *DcWorkingRo    `json:"info"`
+    }
+    WorkingChestResp{
+        Info    *DcWorkingChest    `json:"info"`
+    }
+    WorkingValveResp{
+        Info    *DcWorkingValve    `json:"info"`
+    }
+    WorkingPumpResp{
+        Info    *DcWorkingPump    `json:"info"`
+    }
+)

+ 25 - 0
app/cmd/api/etc/datacenter.yaml

@@ -0,0 +1,25 @@
+Name: datacenter-api
+Host: 0.0.0.0
+Port: 1001
+Mode: dev
+Timeout: 0
+#100MB
+MaxBytes: 104857600
+
+#jwtAuth
+JwtAuth:
+  AccessSecret: ae0536f9-6450-4606-8e13-5a19ed505da0
+  AccessExpire: 31536000
+
+#日志配置
+Log:
+  ServiceName: datacenter-api
+  Mode: console
+  Level: error
+
+#rpc service
+OrganizationRpcConf:
+  Endpoints:
+    - 127.0.0.1:1111
+  NonBlock: true
+  Timeout: 0

+ 15 - 0
app/cmd/api/internal/config/config.go

@@ -0,0 +1,15 @@
+package config
+
+import (
+	"github.com/zeromicro/go-zero/rest"
+	"github.com/zeromicro/go-zero/zrpc"
+)
+
+type Config struct {
+	rest.RestConf
+	JwtAuth struct {
+		AccessSecret string
+		AccessExpire int64
+	}
+	OrganizationRpcConf zrpc.RpcClientConf
+}

+ 24 - 0
app/cmd/api/internal/handler/datacenter/workingChestHandler.go

@@ -0,0 +1,24 @@
+package datacenter
+
+import (
+	"GtDataStore/app/cmd/api/internal/logic/datacenter"
+	"GtDataStore/app/cmd/api/internal/svc"
+	"GtDataStore/app/cmd/api/internal/types"
+	"GtDataStore/common/result"
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"net/http"
+)
+
+func WorkingChestHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.DcWorkingReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.Error(w, err)
+			return
+		}
+
+		l := datacenter.NewWorkingChestLogic(r.Context(), svcCtx)
+		resp, err := l.WorkingChest(&req)
+		result.HttpResult(r, w, resp, err)
+	}
+}

+ 24 - 0
app/cmd/api/internal/handler/datacenter/workingPumpHandler.go

@@ -0,0 +1,24 @@
+package datacenter
+
+import (
+	"GtDataStore/app/cmd/api/internal/logic/datacenter"
+	"GtDataStore/app/cmd/api/internal/svc"
+	"GtDataStore/app/cmd/api/internal/types"
+	"GtDataStore/common/result"
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"net/http"
+)
+
+func WorkingPumpHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.DcWorkingReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.Error(w, err)
+			return
+		}
+
+		l := datacenter.NewWorkingPumpLogic(r.Context(), svcCtx)
+		resp, err := l.WorkingPump(&req)
+		result.HttpResult(r, w, resp, err)
+	}
+}

+ 25 - 0
app/cmd/api/internal/handler/datacenter/workingRoHandler.go

@@ -0,0 +1,25 @@
+package datacenter
+
+import (
+	"net/http"
+
+	"GtDataStore/app/cmd/api/internal/logic/datacenter"
+	"GtDataStore/app/cmd/api/internal/svc"
+	"GtDataStore/app/cmd/api/internal/types"
+	"GtDataStore/common/result"
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func WorkingRoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.DcWorkingReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.Error(w, err)
+			return
+		}
+
+		l := datacenter.NewWorkingRoLogic(r.Context(), svcCtx)
+		resp, err := l.WorkingRo(&req)
+		result.HttpResult(r, w, resp, err)
+	}
+}

+ 25 - 0
app/cmd/api/internal/handler/datacenter/workingUfHandler.go

@@ -0,0 +1,25 @@
+package datacenter
+
+import (
+	"net/http"
+
+	"GtDataStore/app/cmd/api/internal/logic/datacenter"
+	"GtDataStore/app/cmd/api/internal/svc"
+	"GtDataStore/app/cmd/api/internal/types"
+	"GtDataStore/common/result"
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func WorkingUfHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.DcWorkingReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.Error(w, err)
+			return
+		}
+
+		l := datacenter.NewWorkingUfLogic(r.Context(), svcCtx)
+		resp, err := l.WorkingUf(&req)
+		result.HttpResult(r, w, resp, err)
+	}
+}

+ 25 - 0
app/cmd/api/internal/handler/datacenter/workingValveHandler.go

@@ -0,0 +1,25 @@
+package datacenter
+
+import (
+	"net/http"
+
+	"GtDataStore/app/cmd/api/internal/logic/datacenter"
+	"GtDataStore/app/cmd/api/internal/svc"
+	"GtDataStore/app/cmd/api/internal/types"
+	"GtDataStore/common/result"
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func WorkingValveHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.DcWorkingReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.Error(w, err)
+			return
+		}
+
+		l := datacenter.NewWorkingValveLogic(r.Context(), svcCtx)
+		resp, err := l.WorkingValve(&req)
+		result.HttpResult(r, w, resp, err)
+	}
+}

+ 44 - 0
app/cmd/api/internal/handler/routes.go

@@ -0,0 +1,44 @@
+// Code generated by goctl. DO NOT EDIT.
+package handler
+
+import (
+	"net/http"
+
+	datacenter "GtDataStore/app/cmd/api/internal/handler/datacenter"
+	"GtDataStore/app/cmd/api/internal/svc"
+
+	"github.com/zeromicro/go-zero/rest"
+)
+
+func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
+	server.AddRoutes(
+		[]rest.Route{
+			{
+				Method:  http.MethodGet,
+				Path:    "/working-uf/info",
+				Handler: datacenter.WorkingUfHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodGet,
+				Path:    "/working-ro/info",
+				Handler: datacenter.WorkingRoHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodGet,
+				Path:    "/working-chest/info",
+				Handler: datacenter.WorkingChestHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodGet,
+				Path:    "/working-pump/info",
+				Handler: datacenter.WorkingPumpHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodGet,
+				Path:    "/working-valve/info",
+				Handler: datacenter.WorkingValveHandler(serverCtx),
+			},
+		},
+		rest.WithPrefix("/api/datacenter/v1"),
+	)
+}

+ 30 - 0
app/cmd/api/internal/logic/datacenter/workingChestLogic.go

@@ -0,0 +1,30 @@
+package datacenter
+
+import (
+	"context"
+
+	"GtDataStore/app/cmd/api/internal/svc"
+	"GtDataStore/app/cmd/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type WorkingChestLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewWorkingChestLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WorkingChestLogic {
+	return &WorkingChestLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *WorkingChestLogic) WorkingChest(req *types.DcWorkingReq) (resp *types.WorkingChestResp, err error) {
+	// todo: add your logic here and delete this line
+
+	return
+}

+ 30 - 0
app/cmd/api/internal/logic/datacenter/workingPumpLogic.go

@@ -0,0 +1,30 @@
+package datacenter
+
+import (
+	"context"
+
+	"GtDataStore/app/cmd/api/internal/svc"
+	"GtDataStore/app/cmd/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type WorkingPumpLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewWorkingPumpLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WorkingPumpLogic {
+	return &WorkingPumpLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *WorkingPumpLogic) WorkingPump(req *types.DcWorkingReq) (resp *types.WorkingPumpResp, err error) {
+	// todo: add your logic here and delete this line
+
+	return
+}

+ 42 - 0
app/cmd/api/internal/logic/datacenter/workingRoLogic.go

@@ -0,0 +1,42 @@
+package datacenter
+
+import (
+	"GtDataStore/app/cmd/organization/pb"
+	"GtDataStore/common/xerr"
+	"context"
+	"github.com/jinzhu/copier"
+
+	"GtDataStore/app/cmd/api/internal/svc"
+	"GtDataStore/app/cmd/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type WorkingRoLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewWorkingRoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WorkingRoLogic {
+	return &WorkingRoLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *WorkingRoLogic) WorkingRo(req *types.DcWorkingReq) (resp *types.WorkingRoResp, err error) {
+	rpcResp, err := l.svcCtx.OrganizationRpc.GetWorkingUfByCode(l.ctx, &pb.DcWorkingReq{
+		ProjectId:  req.ProjectId,
+		DeviceCode: req.DeviceCode,
+	})
+	if err != nil {
+		return nil, xerr.NewErrMsg("获取数据失败")
+	}
+
+	result := &types.DcWorkingRo{}
+	_ = copier.Copy(result, rpcResp)
+
+	return &types.WorkingRoResp{Info: result}, err
+}

+ 41 - 0
app/cmd/api/internal/logic/datacenter/workingUfLogic.go

@@ -0,0 +1,41 @@
+package datacenter
+
+import (
+	"GtDataStore/app/cmd/api/internal/svc"
+	"GtDataStore/app/cmd/api/internal/types"
+	"GtDataStore/app/cmd/organization/pb"
+	"GtDataStore/common/xerr"
+	"context"
+	"github.com/jinzhu/copier"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type WorkingUfLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewWorkingUfLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WorkingUfLogic {
+	return &WorkingUfLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *WorkingUfLogic) WorkingUf(req *types.DcWorkingReq) (resp *types.WorkingUfResp, err error) {
+	rpcResp, err := l.svcCtx.OrganizationRpc.GetWorkingUfByCode(l.ctx, &pb.DcWorkingReq{
+		ProjectId:  req.ProjectId,
+		DeviceCode: req.DeviceCode,
+	})
+	if err != nil {
+		return nil, xerr.NewErrMsg("获取数据失败")
+	}
+
+	result := &types.DcWorkingUf{}
+	_ = copier.Copy(result, rpcResp)
+
+	return &types.WorkingUfResp{Info: result}, err
+}

+ 30 - 0
app/cmd/api/internal/logic/datacenter/workingValveLogic.go

@@ -0,0 +1,30 @@
+package datacenter
+
+import (
+	"context"
+
+	"GtDataStore/app/cmd/api/internal/svc"
+	"GtDataStore/app/cmd/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type WorkingValveLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewWorkingValveLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WorkingValveLogic {
+	return &WorkingValveLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *WorkingValveLogic) WorkingValve(req *types.DcWorkingReq) (resp *types.WorkingValveResp, err error) {
+	// todo: add your logic here and delete this line
+
+	return
+}

+ 19 - 0
app/cmd/api/internal/svc/serviceContext.go

@@ -0,0 +1,19 @@
+package svc
+
+import (
+	"GtDataStore/app/cmd/api/internal/config"
+	"GtDataStore/app/cmd/organization/organization"
+	"github.com/zeromicro/go-zero/zrpc"
+)
+
+type ServiceContext struct {
+	Config          config.Config
+	OrganizationRpc organization.Organization
+}
+
+func NewServiceContext(c config.Config) *ServiceContext {
+	return &ServiceContext{
+		Config:          c,
+		OrganizationRpc: organization.NewOrganization(zrpc.MustNewClient(c.OrganizationRpcConf)),
+	}
+}

+ 150 - 0
app/cmd/api/internal/types/types.go

@@ -0,0 +1,150 @@
+// Code generated by goctl. DO NOT EDIT.
+package types
+
+type DcWorkingUf struct {
+	Id               int64   `json:"id"`
+	ProjectId        int64   `json:"project_id"`
+	DeviceCode       string  `json:"device_code"`
+	WaterTemperature float64 `json:"water_temperature"` // 水温 摄氏度
+	FeedFlow         float64 `json:"feed_flow"`         // 进水流量
+	ConFlow          float64 `json:"con_flow"`          // 浓水流量
+	ProductFlow      float64 `json:"product_flow"`      // 产水流量
+	FeedPressure     float64 `json:"feed_pressure"`     // 进水压力
+	ConPressure      float64 `json:"con_pressure"`      // 浓水压力
+	ProductPressure  float64 `json:"product_pressure"`  // 产水压力
+	Tmp              float64 `json:"tmp"`               // 跨膜压差
+	Flux             float64 `json:"flux"`              // 膜通量
+	FeedWqTurbidity  float64 `json:"feed_wq_turbidity"` // 进水浊度
+	FeedWqPh         int64   `json:"feed_wq_ph"`        // 进水 PH 值
+	ProductWqPh      int64   `json:"product_wq_ph"`     // 产水 PH 值
+	FeedWqAl         float64 `json:"feed_wq_al"`        // 进水水质:铝
+	ProductWqAl      float64 `json:"product_wq_al"`     // 产水水质:铝
+	FeedWqFe         float64 `json:"feed_wq_fe"`        // 进水水质:铁
+	ProductWqFe      float64 `json:"product_wq_fe"`     // 产水水质:铁
+	FeedWqMn         float64 `json:"feed_wq_mn"`        // 进水水质:锰
+	ProductWqMn      float64 `json:"product_wq_mn"`     // 产水水质:锰
+	FeedWqSio2       float64 `json:"feed_wq_sio2"`      // 进水水质:二氧化硅
+	ProductWqSio2    float64 `json:"product_wq_sio2"`   // 产水水质:二氧化硅
+	FeedWqCod        float64 `json:"feed_wq_cod"`       // 进水水质:COD
+	ProductWqCod     float64 `json:"product_wq_cod"`    // 产水水质:COD
+	FeedWqP          float64 `json:"feed_wq_p"`         // 进水水质:磷
+	ProductWqP       float64 `json:"product_wq_p"`      // 产水水质:磷
+	Step             int64   `json:"step"`              // 设备当前步序值
+	CTime            string  `json:"c_time"`
+}
+
+type DcWorkingRo struct {
+	Id                 int64   `json:"id"`
+	ProjectId          int64   `json:"project_id"`
+	DeviceCode         string  `json:"device_code"`
+	WaterTemperature   float64 `json:"water_temperature"`    // 水温 摄氏度
+	FeedFlow1St        float64 `json:"feed_flow_1st"`        // 一段进水流量
+	ConFlow1St         float64 `json:"con_flow_1st"`         // 一段浓水流量
+	ProductFlow1St     float64 `json:"product_flow_1st"`     // 一段产水流量
+	FeedPressure1St    float64 `json:"feed_pressure_1st"`    // 一段进水压力
+	ConPressure1St     float64 `json:"con_pressure_1st"`     // 一段浓水压力
+	ProductPressure1St float64 `json:"product_pressure_1st"` // 一段产水压力
+	Tmp1St             float64 `json:"tmp_1st"`              // 一段跨膜压差
+	Flux1St            float64 `json:"flux_1st"`             // 一段膜通量
+	Permeability1St    float64 `json:"permeability_1st"`     // 一段渗透率
+	FeedFlow2Nd        float64 `json:"feed_flow_2nd"`        // 二段进水流量
+	ConFlow2Nd         float64 `json:"con_flow_2nd"`         // 二段浓水流量
+	ProductFlow2Nd     float64 `json:"product_flow_2nd"`     // 二段产水流量
+	FeedPressure2Nd    float64 `json:"feed_pressure_2nd"`    // 二段进水压力
+	ConPressure2Nd     float64 `json:"con_pressure_2nd"`     // 二段浓水压力
+	ProductPressure2Nd float64 `json:"product_pressure_2nd"` // 二段产水压力
+	Tmp2Nd             float64 `json:"tmp_2nd"`              // 二段压差
+	Flux2Nd            float64 `json:"flux_2nd"`             // 二段通量
+	Permeability2Nd    float64 `json:"permeability_2nd"`     // 二段渗透率
+	FeedFlow3Th        float64 `json:"feed_flow_3th"`        // 三段进水流量
+	ConFlow3Th         float64 `json:"con_flow_3th"`         // 三段浓水流量
+	ProductFlow3Th     float64 `json:"product_flow_3th"`     // 三段产水流量
+	FeedPressure3Th    float64 `json:"feed_pressure_3th"`    // 三段进水压力
+	ConPressure3Th     float64 `json:"con_pressure_3th"`     // 三段浓水压力
+	ProductPressure3Th float64 `json:"product_pressure_3th"` // 三段产水压力
+	Tmp3Th             float64 `json:"tmp_3th"`              // 三段压差
+	Flux3Th            float64 `json:"flux_3th"`             // 三段通量
+	Permeability3Th    float64 `json:"permeability_3th"`     // 三段渗透率
+	FeedWqTurbidity    float64 `json:"feed_wq_turbidity"`    // 进水浊度
+	FeedWqPh           int64   `json:"feed_wq_ph"`           // 进水 PH 值
+	ProductWqPh        int64   `json:"product_wq_ph"`        // 产水 PH 值
+	FeedWqAl           float64 `json:"feed_wq_al"`           // 进水水质:铝
+	ProductWqAl        float64 `json:"product_wq_al"`        // 产水水质:铝
+	FeedWqFe           float64 `json:"feed_wq_fe"`           // 进水水质:铁
+	ProductWqFe        float64 `json:"product_wq_fe"`        // 产水水质:铁
+	FeedWqMn           float64 `json:"feed_wq_mn"`           // 进水水质:锰
+	ProductWqMn        float64 `json:"product_wq_mn"`        // 产水水质:锰
+	FeedWqSio2         float64 `json:"feed_wq_sio2"`         // 进水水质:二氧化硅
+	ProductWqSio2      float64 `json:"product_wq_sio2"`      // 产水水质:二氧化硅
+	FeedWqCod          float64 `json:"feed_wq_cod"`          // 进水水质:COD
+	ProductWqCod       float64 `json:"product_wq_cod"`       // 产水水质:COD
+	FeedWqP            float64 `json:"feed_wq_p"`            // 进水水质:磷
+	ProductWqP         float64 `json:"product_wq_p"`         // 产水水质:磷
+	Step               int64   `json:"step"`                 // 设备当前步序值
+	CTime              string  `json:"c_time"`
+}
+
+type DcWorkingChest struct {
+	Id                  int64   `json:"id"`
+	ProjectId           int64   `json:"project_id"`
+	DeviceCode          string  `json:"device_code"`
+	Switch              int64   `json:"switch"`                // 药箱液位开关 0: 关 1: 开
+	Level               float64 `json:"level"`                 // 液位高度
+	AgitatorStatus      int64   `json:"agitator_status"`       // 搅拌器运行状态 0: 未运行 1:运行中
+	AgitatorDuration    int64   `json:"agitator_duration"`     // 搅拌器运行时长
+	AgitatorFaultStatus int64   `json:"agitator_fault_status"` // 搅拌器故障状态 0:正常 1:故障
+	CTime               string  `json:"c_time"`
+}
+
+type DcWorkingPump struct {
+	Id           int64   `json:"id"`
+	ProjectId    int64   `json:"project_id"`
+	DeviceCode   string  `json:"device_code"`
+	FeedPressure float64 `json:"feed_pressure"` // 进水压力
+	OutPressure  float64 `json:"out_pressure"`  // 出水压力
+	Duration     int64   `json:"duration"`      // 运行时长 单位 s
+	Current      float64 `json:"current"`       // 运行电流
+	Frequency    float64 `json:"frequency"`     // 运行频率
+	Lift         float64 `json:"lift"`          // 工作扬程
+	Efficiency   float64 `json:"efficiency"`    // 运行效率
+	RunStatus    int64   `json:"run_status"`    // 运行状态 0: 停机 1: 运行正常
+	FaultStatus  int64   `json:"fault_status"`  // 故障状态 0: 正常 1: 故障
+	CTime        string  `json:"c_time"`
+}
+
+type DcWorkingValve struct {
+	Id          int64   `json:"id"`
+	ProjectId   int64   `json:"project_id"`
+	DeviceCode  string  `json:"device_code"`
+	Adjust      int64   `json:"adjust"`       // 是否为调节阀门 0: 否 1: 是
+	Opening     float64 `json:"opening"`      // 当前阀门的开度
+	Closed      int64   `json:"closed"`       // 关到位 全关  0: 否 1: 是
+	Opened      int64   `json:"opened"`       // 开到位 开到 设置的开度 0: 否 1: 是
+	FaultStatus int64   `json:"fault_status"` // 是否故障 0: 否 1: 是
+	CTime       string  `json:"c_time"`
+}
+
+type DcWorkingReq struct {
+	ProjectId  int64  `form:"project_id"`
+	DeviceCode string `form:"device_code"`
+}
+
+type WorkingUfResp struct {
+	Info *DcWorkingUf `json:"info"`
+}
+
+type WorkingRoResp struct {
+	Info *DcWorkingRo `json:"info"`
+}
+
+type WorkingChestResp struct {
+	Info *DcWorkingChest `json:"info"`
+}
+
+type WorkingValveResp struct {
+	Info *DcWorkingValve `json:"info"`
+}
+
+type WorkingPumpResp struct {
+	Info *DcWorkingPump `json:"info"`
+}

+ 1 - 1
app/cmd/organization/etc/organization.yaml

@@ -1,5 +1,5 @@
 Name: organization.rpc
-ListenOn: 0.0.0.0:8080
+ListenOn: 0.0.0.0:1111
 
 Timeout: 0
 Mode: test

+ 1 - 1
app/model/dcWorkingChestModel.go

@@ -31,7 +31,7 @@ func NewDcWorkingChestModel(conn sqlx.SqlConn) DcWorkingChestModel {
 
 func (m *defaultDcWorkingChestModel) FindOneByCode(ctx context.Context, projectId int64, deviceCode string) (*DcWorkingChest, error) {
 	var resp DcWorkingChest
-	query := fmt.Sprintf("select %s from %s where `project_id` = ? and `device_code` = ? order by c_time desc limit 1", dcProjectConfigRows, m.table)
+	query := fmt.Sprintf("select %s from %s where `project_id` = ? and `device_code` = ? order by c_time desc limit 1", dcWorkingChestRows, m.table)
 	err := m.conn.QueryRowCtx(ctx, &resp, query, projectId, deviceCode)
 	switch err {
 	case nil:

+ 1 - 1
app/model/dcWorkingPumpModel.go

@@ -31,7 +31,7 @@ func NewDcWorkingPumpModel(conn sqlx.SqlConn) DcWorkingPumpModel {
 
 func (m *defaultDcWorkingPumpModel) FindOneByCode(ctx context.Context, projectId int64, deviceCode string) (*DcWorkingPump, error) {
 	var resp DcWorkingPump
-	query := fmt.Sprintf("select %s from %s where `project_id` = ? and `device_code` = ? order by c_time desc limit 1", dcProjectConfigRows, m.table)
+	query := fmt.Sprintf("select %s from %s where `project_id` = ? and `device_code` = ? order by c_time desc limit 1", dcWorkingPumpRows, m.table)
 	err := m.conn.QueryRowCtx(ctx, &resp, query, projectId, deviceCode)
 	switch err {
 	case nil:

+ 1 - 1
app/model/dcWorkingRoModel.go

@@ -31,7 +31,7 @@ func NewDcWorkingRoModel(conn sqlx.SqlConn) DcWorkingRoModel {
 
 func (m *defaultDcWorkingRoModel) FindOneByCode(ctx context.Context, projectId int64, deviceCode string) (*DcWorkingRo, error) {
 	var resp DcWorkingRo
-	query := fmt.Sprintf("select %s from %s where `project_id` = ? and `device_code` = ? order by c_time desc limit 1", dcProjectConfigRows, m.table)
+	query := fmt.Sprintf("select %s from %s where `project_id` = ? and `device_code` = ? order by c_time desc limit 1", dcWorkingRoRows, m.table)
 	err := m.conn.QueryRowCtx(ctx, &resp, query, projectId, deviceCode)
 	switch err {
 	case nil:

+ 1 - 1
app/model/dcWorkingUfModel.go

@@ -31,7 +31,7 @@ func NewDcWorkingUfModel(conn sqlx.SqlConn) DcWorkingUfModel {
 
 func (m *defaultDcWorkingUfModel) FindOneByCode(ctx context.Context, projectId int64, deviceCode string) (*DcWorkingUf, error) {
 	var resp DcWorkingUf
-	query := fmt.Sprintf("select %s from %s where `project_id` = ? and `device_code` = ? order by c_time desc limit 1", dcProjectConfigRows, m.table)
+	query := fmt.Sprintf("select %s from %s where `project_id` = ? and `device_code` = ? order by c_time desc limit 1", dcWorkingUfRows, m.table)
 	err := m.conn.QueryRowCtx(ctx, &resp, query, projectId, deviceCode)
 	switch err {
 	case nil:

+ 1 - 1
app/model/dcWorkingValveModel.go

@@ -30,7 +30,7 @@ func NewDcWorkingValveModel(conn sqlx.SqlConn) DcWorkingValveModel {
 }
 func (m *defaultDcWorkingValveModel) FindOneByCode(ctx context.Context, projectId int64, deviceCode string) (*DcWorkingValve, error) {
 	var resp DcWorkingValve
-	query := fmt.Sprintf("select %s from %s where `project_id` = ? and `device_code` = ? order by c_time desc limit 1", dcProjectConfigRows, m.table)
+	query := fmt.Sprintf("select %s from %s where `project_id` = ? and `device_code` = ? order by c_time desc limit 1", dcWorkingValveRows, m.table)
 	err := m.conn.QueryRowCtx(ctx, &resp, query, projectId, deviceCode)
 	switch err {
 	case nil:

+ 86 - 0
common/result/httpResult.go

@@ -0,0 +1,86 @@
+package result
+
+import (
+	"fmt"
+	"net/http"
+
+	"GtDataStore/common/xerr"
+
+	"github.com/pkg/errors"
+	"github.com/zeromicro/go-zero/core/logx"
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"google.golang.org/grpc/status"
+)
+
+// http返回
+func HttpResult(r *http.Request, w http.ResponseWriter, resp interface{}, err error) {
+
+	if err == nil {
+		//成功返回
+		r := Success(resp)
+		httpx.WriteJson(w, http.StatusOK, r)
+	} else {
+		//错误返回
+		errcode := xerr.SERVER_COMMON_ERROR
+		errmsg := "服务器开小差啦,稍后再来试一试"
+
+		causeErr := errors.Cause(err) // err类型
+		//logx.Infof("【HttpResult】------------:%v", causeErr)
+		if e, ok := causeErr.(*xerr.CodeError); ok { //自定义错误类型
+			//自定义CodeError
+			errcode = e.GetErrCode()
+			errmsg = e.GetErrMsg()
+		} else {
+			if gstatus, ok := status.FromError(causeErr); ok { // grpc err错误
+				grpcCode := uint32(gstatus.Code())
+				if xerr.IsCodeErr(grpcCode) { //区分自定义错误跟系统底层、db等错误,底层、db错误不能返回给前端
+					errcode = grpcCode
+					errmsg = gstatus.Message()
+				}
+			}
+		}
+
+		//logx.WithContext(r.Context()).Errorf("【API-ERR】 : %+v ", err)
+
+		httpx.WriteJson(w, http.StatusBadRequest, Error(errcode, errmsg))
+	}
+}
+
+// 授权的http方法
+func AuthHttpResult(r *http.Request, w http.ResponseWriter, resp interface{}, err error) {
+
+	if err == nil {
+		//成功返回
+		r := Success(resp)
+		httpx.WriteJson(w, http.StatusOK, r)
+	} else {
+		//错误返回
+		errcode := xerr.SERVER_COMMON_ERROR
+		errmsg := "服务器开小差啦,稍后再来试一试"
+
+		causeErr := errors.Cause(err)                // err类型
+		if e, ok := causeErr.(*xerr.CodeError); ok { //自定义错误类型
+			//自定义CodeError
+			errcode = e.GetErrCode()
+			errmsg = e.GetErrMsg()
+		} else {
+			if gstatus, ok := status.FromError(causeErr); ok { // grpc err错误
+				grpcCode := uint32(gstatus.Code())
+				if xerr.IsCodeErr(grpcCode) { //区分自定义错误跟系统底层、db等错误,底层、db错误不能返回给前端
+					errcode = grpcCode
+					errmsg = gstatus.Message()
+				}
+			}
+		}
+
+		logx.WithContext(r.Context()).Errorf("【GATEWAY-ERR】 : %+v ", err)
+
+		httpx.WriteJson(w, http.StatusUnauthorized, Error(errcode, errmsg))
+	}
+}
+
+// http 参数错误返回
+func ParamErrorResult(r *http.Request, w http.ResponseWriter, err error) {
+	errMsg := fmt.Sprintf("%s ,%s", xerr.MapErrMsg(xerr.REUQEST_PARAM_ERROR), err.Error())
+	httpx.WriteJson(w, http.StatusBadRequest, Error(xerr.REUQEST_PARAM_ERROR, errMsg))
+}

+ 44 - 0
common/result/jobResult.go

@@ -0,0 +1,44 @@
+package result
+
+import (
+	"context"
+
+	"GtDataStore/common/xerr"
+
+	"github.com/pkg/errors"
+	"github.com/zeromicro/go-zero/core/logx"
+	"google.golang.org/grpc/status"
+)
+
+// job返回
+func JobResult(ctx context.Context, resp interface{}, err error) {
+	if err == nil {
+		// 成功返回 ,只有dev环境下才会打印info,线上不显示
+		if resp != nil {
+			logx.Infof("resp: %+v", resp)
+		}
+		return
+	} else {
+		errCode := xerr.SERVER_COMMON_ERROR
+		errMsg := "服务器开小差啦,稍后再来试一试"
+
+		// 错误返回
+		causeErr := errors.Cause(err)                // err类型
+		if e, ok := causeErr.(*xerr.CodeError); ok { // 自定义错误类型
+			// 自定义CodeError
+			errCode = e.GetErrCode()
+			errMsg = e.GetErrMsg()
+		} else {
+			if gstatus, ok := status.FromError(causeErr); ok { // grpc err错误
+				grpcCode := uint32(gstatus.Code())
+				if xerr.IsCodeErr(grpcCode) { // 区分自定义错误跟系统底层、db等错误,底层、db错误不能返回给前端
+					errCode = grpcCode
+					errMsg = gstatus.Message()
+				}
+			}
+		}
+
+		logx.WithContext(ctx).Errorf("【JOB-ERR】 : %+v ,errCode:%d , errMsg:%s ", err, errCode, errMsg)
+		return
+	}
+}

+ 21 - 0
common/result/responseBean.go

@@ -0,0 +1,21 @@
+package result
+
+type ResponseSuccessBean struct {
+	Code uint32      `json:"code"`
+	Msg  string      `json:"msg"`
+	Data interface{} `json:"data"`
+}
+type NullJson struct{}
+
+func Success(data interface{}) *ResponseSuccessBean {
+	return &ResponseSuccessBean{200, "OK", data}
+}
+
+type ResponseErrorBean struct {
+	Code uint32 `json:"code"`
+	Msg  string `json:"msg"`
+}
+
+func Error(errCode uint32, errMsg string) *ResponseErrorBean {
+	return &ResponseErrorBean{errCode, errMsg}
+}

+ 35 - 0
common/xerr/errCode.go

@@ -0,0 +1,35 @@
+package xerr
+
+//成功返回
+const OK uint32 = 200
+
+/**(前3位代表业务,后三位代表具体功能)**/
+
+//全局错误码
+const SERVER_COMMON_ERROR uint32 = 100001
+const REUQEST_PARAM_ERROR uint32 = 100002
+const TOKEN_EXPIRE_ERROR uint32 = 100003
+const TOKEN_GENERATE_ERROR uint32 = 100004
+const DB_ERROR uint32 = 100005
+const DB_UPDATE_AFFECTED_ZERO_ERROR uint32 = 100006
+
+//备品备件模块
+const OUT_AMOUNT_OVER_ON_AMOUNT_ERROR uint32 = 100101
+const CATEGORY_NOT_EXIST_ERROR uint32 = 100102
+const RECORD_NOT_EXIST_ERROR uint32 = 100103
+const NOT_IN_AMOUNT_ERROR uint32 = 100104
+const NOT_DEL_ERROR uint32 = 100105
+const NOT_IN_AMOUNT_OUT_ERROR uint32 = 100106
+const NOT_ON_AMOUNT_OVER_SCRAP_ERROR uint32 = 100107
+const TIME_ERROR uint32 = 100108
+const OPEN_FILE_ERROR uint32 = 100109
+const EXCEL_NULL_ERROR uint32 = 1000110
+const READ_EXCEL_ERROR uint32 = 1000111
+const NOT_PER_ERROR uint32 = 100112
+const IN_STORE_RECORD_NOT_EXIST_ERROR uint32 = 100113
+const STORE_INVENTORY_ERROR uint32 = 100114
+const STORE_INVENTORY_MONTH_ERROR uint32 = 100115
+const STORE_UPDATE_ONCE_DAY_ERROR uint32 = 100116
+
+// 物联网
+const NOT_DATA_ERROR uint32 = 100201

+ 48 - 0
common/xerr/errMsg.go

@@ -0,0 +1,48 @@
+package xerr
+
+var message map[uint32]string
+
+func init() {
+	message = make(map[uint32]string)
+	message[OK] = "SUCCESS"
+	message[SERVER_COMMON_ERROR] = "服务器开小差啦,稍后再来试一试"
+	message[REUQEST_PARAM_ERROR] = "参数错误"
+	message[TOKEN_EXPIRE_ERROR] = "token失效,请重新登陆"
+	message[TOKEN_GENERATE_ERROR] = "生成token失败"
+	message[DB_ERROR] = "数据库繁忙,请稍后再试"
+	message[DB_UPDATE_AFFECTED_ZERO_ERROR] = "更新数据影响行数为0"
+	message[OUT_AMOUNT_OVER_ON_AMOUNT_ERROR] = "出库数量大于库存"
+	message[CATEGORY_NOT_EXIST_ERROR] = "分类不存在"
+	message[RECORD_NOT_EXIST_ERROR] = "数据记录不存在"
+	message[NOT_IN_AMOUNT_ERROR] = "没有入库记录,暂不能出库"
+	message[NOT_IN_AMOUNT_OUT_ERROR] = "没有入库记录,暂不能报废"
+	message[NOT_DEL_ERROR] = "有出库或报废记录,暂不能删除"
+	message[NOT_ON_AMOUNT_OVER_SCRAP_ERROR] = "报废数量不能大于在库数量"
+	message[TIME_ERROR] = "时间格式错误"
+	message[OPEN_FILE_ERROR] = "打开文件失败"
+	message[EXCEL_NULL_ERROR] = "空excl"
+	message[READ_EXCEL_ERROR] = "读取excl错误"
+	message[NOT_PER_ERROR] = "没有权限操作"
+	message[IN_STORE_RECORD_NOT_EXIST_ERROR] = "入库记录不存在"
+	message[STORE_INVENTORY_ERROR] = "修正库存后,库存不能为负"
+	message[STORE_INVENTORY_MONTH_ERROR] = "修正库存后,月库存不能为负"
+	message[NOT_DATA_ERROR] = "暂未获取到记录"
+	message[STORE_UPDATE_ONCE_DAY_ERROR] = "每种配件一天只能调库一次"
+
+}
+
+func MapErrMsg(errcode uint32) string {
+	if msg, ok := message[errcode]; ok {
+		return msg
+	} else {
+		return "服务器开小差啦,稍后再来试一试"
+	}
+}
+
+func IsCodeErr(errcode uint32) bool {
+	if _, ok := message[errcode]; ok {
+		return true
+	} else {
+		return false
+	}
+}

+ 39 - 0
common/xerr/errors.go

@@ -0,0 +1,39 @@
+package xerr
+
+import (
+	"fmt"
+)
+
+/**
+常用通用固定错误
+*/
+
+type CodeError struct {
+	errCode uint32
+	errMsg  string
+}
+
+//返回给前端的错误码
+func (e *CodeError) GetErrCode() uint32 {
+	return e.errCode
+}
+
+//返回给前端显示端错误信息
+func (e *CodeError) GetErrMsg() string {
+	return e.errMsg
+}
+
+func (e *CodeError) Error() string {
+	return fmt.Sprintf("ErrCode:%d,ErrMsg:%s", e.errCode, e.errMsg)
+}
+
+func NewErrCodeMsg(errCode uint32, errMsg string) *CodeError {
+	return &CodeError{errCode: errCode, errMsg: errMsg}
+}
+func NewErrCode(errCode uint32) *CodeError {
+	return &CodeError{errCode: errCode, errMsg: MapErrMsg(errCode)}
+}
+
+func NewErrMsg(errMsg string) *CodeError {
+	return &CodeError{errCode: SERVER_COMMON_ERROR, errMsg: errMsg}
+}

+ 3 - 1
go.mod

@@ -4,6 +4,8 @@ go 1.19
 
 require (
 	github.com/go-redis/redis/v8 v8.11.5
+	github.com/jinzhu/copier v0.4.0
+	github.com/pkg/errors v0.9.1
 	github.com/zeromicro/go-zero v1.6.0
 	google.golang.org/grpc v1.59.0
 	google.golang.org/protobuf v1.31.0
@@ -26,6 +28,7 @@ require (
 	github.com/go-openapi/swag v0.22.4 // indirect
 	github.com/go-sql-driver/mysql v1.7.1 // indirect
 	github.com/gogo/protobuf v1.3.2 // indirect
+	github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
 	github.com/golang/mock v1.6.0 // indirect
 	github.com/golang/protobuf v1.5.3 // indirect
 	github.com/google/gnostic-models v0.6.8 // indirect
@@ -33,7 +36,6 @@ require (
 	github.com/google/gofuzz v1.2.0 // indirect
 	github.com/google/uuid v1.4.0 // indirect
 	github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 // indirect
-	github.com/jinzhu/copier v0.4.0 // indirect
 	github.com/josharian/intern v1.0.0 // indirect
 	github.com/json-iterator/go v1.1.12 // indirect
 	github.com/mailru/easyjson v0.7.7 // indirect

+ 3 - 0
go.sum

@@ -44,6 +44,8 @@ github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEe
 github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
 github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
 github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
+github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
+github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
 github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo=
 github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
 github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
@@ -105,6 +107,7 @@ github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hP
 github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
 github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
 github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
+github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=

+ 4 - 0
vendor/github.com/golang-jwt/jwt/v4/.gitignore

@@ -0,0 +1,4 @@
+.DS_Store
+bin
+.idea/
+

+ 9 - 0
vendor/github.com/golang-jwt/jwt/v4/LICENSE

@@ -0,0 +1,9 @@
+Copyright (c) 2012 Dave Grijalva
+Copyright (c) 2021 golang-jwt maintainers
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+

+ 22 - 0
vendor/github.com/golang-jwt/jwt/v4/MIGRATION_GUIDE.md

@@ -0,0 +1,22 @@
+## Migration Guide (v4.0.0)
+
+Starting from [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0), the import path will be:
+
+    "github.com/golang-jwt/jwt/v4"
+
+The `/v4` version will be backwards compatible with existing `v3.x.y` tags in this repo, as well as 
+`github.com/dgrijalva/jwt-go`. For most users this should be a drop-in replacement, if you're having 
+troubles migrating, please open an issue.
+
+You can replace all occurrences of `github.com/dgrijalva/jwt-go` or `github.com/golang-jwt/jwt` with `github.com/golang-jwt/jwt/v4`, either manually or by using tools such as `sed` or `gofmt`.
+
+And then you'd typically run:
+
+```
+go get github.com/golang-jwt/jwt/v4
+go mod tidy
+```
+
+## Older releases (before v3.2.0)
+
+The original migration guide for older releases can be found at https://github.com/dgrijalva/jwt-go/blob/master/MIGRATION_GUIDE.md.

+ 138 - 0
vendor/github.com/golang-jwt/jwt/v4/README.md

@@ -0,0 +1,138 @@
+# jwt-go
+
+[![build](https://github.com/golang-jwt/jwt/actions/workflows/build.yml/badge.svg)](https://github.com/golang-jwt/jwt/actions/workflows/build.yml)
+[![Go Reference](https://pkg.go.dev/badge/github.com/golang-jwt/jwt/v4.svg)](https://pkg.go.dev/github.com/golang-jwt/jwt/v4)
+
+A [go](http://www.golang.org) (or 'golang' for search engine friendliness) implementation of [JSON Web Tokens](https://datatracker.ietf.org/doc/html/rfc7519).
+
+Starting with [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0) this project adds Go module support, but maintains backwards compatibility with older `v3.x.y` tags and upstream `github.com/dgrijalva/jwt-go`.
+See the [`MIGRATION_GUIDE.md`](./MIGRATION_GUIDE.md) for more information.
+
+> After the original author of the library suggested migrating the maintenance of `jwt-go`, a dedicated team of open source maintainers decided to clone the existing library into this repository. See [dgrijalva/jwt-go#462](https://github.com/dgrijalva/jwt-go/issues/462) for a detailed discussion on this topic.
+
+
+**SECURITY NOTICE:** Some older versions of Go have a security issue in the crypto/elliptic. Recommendation is to upgrade to at least 1.15 See issue [dgrijalva/jwt-go#216](https://github.com/dgrijalva/jwt-go/issues/216) for more detail.
+
+**SECURITY NOTICE:** It's important that you [validate the `alg` presented is what you expect](https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/). This library attempts to make it easy to do the right thing by requiring key types match the expected alg, but you should take the extra step to verify it in your usage.  See the examples provided.
+
+### Supported Go versions
+
+Our support of Go versions is aligned with Go's [version release policy](https://golang.org/doc/devel/release#policy).
+So we will support a major version of Go until there are two newer major releases.
+We no longer support building jwt-go with unsupported Go versions, as these contain security vulnerabilities
+which will not be fixed.
+
+## What the heck is a JWT?
+
+JWT.io has [a great introduction](https://jwt.io/introduction) to JSON Web Tokens.
+
+In short, it's a signed JSON object that does something useful (for example, authentication).  It's commonly used for `Bearer` tokens in Oauth 2.  A token is made of three parts, separated by `.`'s.  The first two parts are JSON objects, that have been [base64url](https://datatracker.ietf.org/doc/html/rfc4648) encoded.  The last part is the signature, encoded the same way.
+
+The first part is called the header.  It contains the necessary information for verifying the last part, the signature.  For example, which encryption method was used for signing and what key was used.
+
+The part in the middle is the interesting bit.  It's called the Claims and contains the actual stuff you care about.  Refer to [RFC 7519](https://datatracker.ietf.org/doc/html/rfc7519) for information about reserved keys and the proper way to add your own.
+
+## What's in the box?
+
+This library supports the parsing and verification as well as the generation and signing of JWTs.  Current supported signing algorithms are HMAC SHA, RSA, RSA-PSS, and ECDSA, though hooks are present for adding your own.
+
+## Installation Guidelines
+
+1. To install the jwt package, you first need to have [Go](https://go.dev/doc/install) installed, then you can use the command below to add `jwt-go` as a dependency in your Go program.
+
+```sh
+go get -u github.com/golang-jwt/jwt/v4
+```
+
+2. Import it in your code:
+
+```go
+import "github.com/golang-jwt/jwt/v4"
+```
+
+## Examples
+
+See [the project documentation](https://pkg.go.dev/github.com/golang-jwt/jwt/v4) for examples of usage:
+
+* [Simple example of parsing and validating a token](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#example-Parse-Hmac)
+* [Simple example of building and signing a token](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#example-New-Hmac)
+* [Directory of Examples](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#pkg-examples)
+
+## Extensions
+
+This library publishes all the necessary components for adding your own signing methods or key functions.  Simply implement the `SigningMethod` interface and register a factory method using `RegisterSigningMethod` or provide a `jwt.Keyfunc`.
+
+A common use case would be integrating with different 3rd party signature providers, like key management services from various cloud providers or Hardware Security Modules (HSMs) or to implement additional standards.
+
+| Extension | Purpose                                                                                                  | Repo                                       |
+| --------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
+| GCP       | Integrates with multiple Google Cloud Platform signing tools (AppEngine, IAM API, Cloud KMS)             | https://github.com/someone1/gcp-jwt-go     |
+| AWS       | Integrates with AWS Key Management Service, KMS                                                          | https://github.com/matelang/jwt-go-aws-kms |
+| JWKS      | Provides support for JWKS ([RFC 7517](https://datatracker.ietf.org/doc/html/rfc7517)) as a `jwt.Keyfunc` | https://github.com/MicahParks/keyfunc       |
+
+*Disclaimer*: Unless otherwise specified, these integrations are maintained by third parties and should not be considered as a primary offer by any of the mentioned cloud providers
+
+## Compliance
+
+This library was last reviewed to comply with [RFC 7519](https://datatracker.ietf.org/doc/html/rfc7519) dated May 2015 with a few notable differences:
+
+* In order to protect against accidental use of [Unsecured JWTs](https://datatracker.ietf.org/doc/html/rfc7519#section-6), tokens using `alg=none` will only be accepted if the constant `jwt.UnsafeAllowNoneSignatureType` is provided as the key.
+
+## Project Status & Versioning
+
+This library is considered production ready.  Feedback and feature requests are appreciated.  The API should be considered stable.  There should be very few backwards-incompatible changes outside of major version updates (and only with good reason).
+
+This project uses [Semantic Versioning 2.0.0](http://semver.org).  Accepted pull requests will land on `main`.  Periodically, versions will be tagged from `main`.  You can find all the releases on [the project releases page](https://github.com/golang-jwt/jwt/releases).
+
+**BREAKING CHANGES:*** 
+A full list of breaking changes is available in `VERSION_HISTORY.md`.  See `MIGRATION_GUIDE.md` for more information on updating your code.
+
+## Usage Tips
+
+### Signing vs Encryption
+
+A token is simply a JSON object that is signed by its author. this tells you exactly two things about the data:
+
+* The author of the token was in the possession of the signing secret
+* The data has not been modified since it was signed
+
+It's important to know that JWT does not provide encryption, which means anyone who has access to the token can read its contents. If you need to protect (encrypt) the data, there is a companion spec, `JWE`, that provides this functionality. The companion project https://github.com/golang-jwt/jwe aims at a (very) experimental implementation of the JWE standard.
+
+### Choosing a Signing Method
+
+There are several signing methods available, and you should probably take the time to learn about the various options before choosing one.  The principal design decision is most likely going to be symmetric vs asymmetric.
+
+Symmetric signing methods, such as HSA, use only a single secret. This is probably the simplest signing method to use since any `[]byte` can be used as a valid secret. They are also slightly computationally faster to use, though this rarely is enough to matter. Symmetric signing methods work the best when both producers and consumers of tokens are trusted, or even the same system. Since the same secret is used to both sign and validate tokens, you can't easily distribute the key for validation.
+
+Asymmetric signing methods, such as RSA, use different keys for signing and verifying tokens. This makes it possible to produce tokens with a private key, and allow any consumer to access the public key for verification.
+
+### Signing Methods and Key Types
+
+Each signing method expects a different object type for its signing keys. See the package documentation for details. Here are the most common ones:
+
+* The [HMAC signing method](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#SigningMethodHMAC) (`HS256`,`HS384`,`HS512`) expect `[]byte` values for signing and validation
+* The [RSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#SigningMethodRSA) (`RS256`,`RS384`,`RS512`) expect `*rsa.PrivateKey` for signing and `*rsa.PublicKey` for validation
+* The [ECDSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#SigningMethodECDSA) (`ES256`,`ES384`,`ES512`) expect `*ecdsa.PrivateKey` for signing and `*ecdsa.PublicKey` for validation
+* The [EdDSA signing method](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#SigningMethodEd25519) (`Ed25519`) expect `ed25519.PrivateKey` for signing and `ed25519.PublicKey` for validation
+
+### JWT and OAuth
+
+It's worth mentioning that OAuth and JWT are not the same thing. A JWT token is simply a signed JSON object. It can be used anywhere such a thing is useful. There is some confusion, though, as JWT is the most common type of bearer token used in OAuth2 authentication.
+
+Without going too far down the rabbit hole, here's a description of the interaction of these technologies:
+
+* OAuth is a protocol for allowing an identity provider to be separate from the service a user is logging in to. For example, whenever you use Facebook to log into a different service (Yelp, Spotify, etc), you are using OAuth.
+* OAuth defines several options for passing around authentication data. One popular method is called a "bearer token". A bearer token is simply a string that _should_ only be held by an authenticated user. Thus, simply presenting this token proves your identity. You can probably derive from here why a JWT might make a good bearer token.
+* Because bearer tokens are used for authentication, it's important they're kept secret. This is why transactions that use bearer tokens typically happen over SSL.
+
+### Troubleshooting
+
+This library uses descriptive error messages whenever possible. If you are not getting the expected result, have a look at the errors. The most common place people get stuck is providing the correct type of key to the parser. See the above section on signing methods and key types.
+
+## More
+
+Documentation can be found [on pkg.go.dev](https://pkg.go.dev/github.com/golang-jwt/jwt/v4).
+
+The command line utility included in this project (cmd/jwt) provides a straightforward example of token creation and parsing as well as a useful tool for debugging your own integration. You'll also find several implementation examples in the documentation.
+
+[golang-jwt](https://github.com/orgs/golang-jwt) incorporates a modified version of the JWT logo, which is distributed under the terms of the [MIT License](https://github.com/jsonwebtoken/jsonwebtoken.github.io/blob/master/LICENSE.txt).

+ 19 - 0
vendor/github.com/golang-jwt/jwt/v4/SECURITY.md

@@ -0,0 +1,19 @@
+# Security Policy
+
+## Supported Versions
+
+As of February 2022 (and until this document is updated), the latest version `v4` is supported.
+
+## Reporting a Vulnerability
+
+If you think you found a vulnerability, and even if you are not sure, please report it to jwt-go-security@googlegroups.com or one of the other [golang-jwt maintainers](https://github.com/orgs/golang-jwt/people). Please try be explicit, describe steps to reproduce the security issue with code example(s).
+
+You will receive a response within a timely manner. If the issue is confirmed, we will do our best to release a patch as soon as possible given the complexity of the problem.
+
+## Public Discussions
+
+Please avoid publicly discussing a potential security vulnerability.
+
+Let's take this offline and find a solution first, this limits the potential impact as much as possible.
+
+We appreciate your help!

+ 135 - 0
vendor/github.com/golang-jwt/jwt/v4/VERSION_HISTORY.md

@@ -0,0 +1,135 @@
+## `jwt-go` Version History
+
+#### 4.0.0
+
+* Introduces support for Go modules. The `v4` version will be backwards compatible with `v3.x.y`.
+
+#### 3.2.2
+
+* Starting from this release, we are adopting the policy to support the most 2 recent versions of Go currently available. By the time of this release, this is Go 1.15 and 1.16 ([#28](https://github.com/golang-jwt/jwt/pull/28)).
+* Fixed a potential issue that could occur when the verification of `exp`, `iat` or `nbf` was not required and contained invalid contents, i.e. non-numeric/date. Thanks for @thaJeztah for making us aware of that and @giorgos-f3 for originally reporting it to the formtech fork ([#40](https://github.com/golang-jwt/jwt/pull/40)).
+* Added support for EdDSA / ED25519 ([#36](https://github.com/golang-jwt/jwt/pull/36)).
+* Optimized allocations ([#33](https://github.com/golang-jwt/jwt/pull/33)).
+
+#### 3.2.1
+
+* **Import Path Change**: See MIGRATION_GUIDE.md for tips on updating your code
+	* Changed the import path from `github.com/dgrijalva/jwt-go` to `github.com/golang-jwt/jwt`
+* Fixed type confusing issue between `string` and `[]string` in `VerifyAudience` ([#12](https://github.com/golang-jwt/jwt/pull/12)). This fixes CVE-2020-26160 
+
+#### 3.2.0
+
+* Added method `ParseUnverified` to allow users to split up the tasks of parsing and validation
+* HMAC signing method returns `ErrInvalidKeyType` instead of `ErrInvalidKey` where appropriate
+* Added options to `request.ParseFromRequest`, which allows for an arbitrary list of modifiers to parsing behavior. Initial set include `WithClaims` and `WithParser`. Existing usage of this function will continue to work as before.
+* Deprecated `ParseFromRequestWithClaims` to simplify API in the future.
+
+#### 3.1.0
+
+* Improvements to `jwt` command line tool
+* Added `SkipClaimsValidation` option to `Parser`
+* Documentation updates
+
+#### 3.0.0
+
+* **Compatibility Breaking Changes**: See MIGRATION_GUIDE.md for tips on updating your code
+	* Dropped support for `[]byte` keys when using RSA signing methods.  This convenience feature could contribute to security vulnerabilities involving mismatched key types with signing methods.
+	* `ParseFromRequest` has been moved to `request` subpackage and usage has changed
+	* The `Claims` property on `Token` is now type `Claims` instead of `map[string]interface{}`.  The default value is type `MapClaims`, which is an alias to `map[string]interface{}`.  This makes it possible to use a custom type when decoding claims.
+* Other Additions and Changes
+	* Added `Claims` interface type to allow users to decode the claims into a custom type
+	* Added `ParseWithClaims`, which takes a third argument of type `Claims`.  Use this function instead of `Parse` if you have a custom type you'd like to decode into.
+	* Dramatically improved the functionality and flexibility of `ParseFromRequest`, which is now in the `request` subpackage
+	* Added `ParseFromRequestWithClaims` which is the `FromRequest` equivalent of `ParseWithClaims`
+	* Added new interface type `Extractor`, which is used for extracting JWT strings from http requests.  Used with `ParseFromRequest` and `ParseFromRequestWithClaims`.
+	* Added several new, more specific, validation errors to error type bitmask
+	* Moved examples from README to executable example files
+	* Signing method registry is now thread safe
+	* Added new property to `ValidationError`, which contains the raw error returned by calls made by parse/verify (such as those returned by keyfunc or json parser)
+
+#### 2.7.0
+
+This will likely be the last backwards compatible release before 3.0.0, excluding essential bug fixes.
+
+* Added new option `-show` to the `jwt` command that will just output the decoded token without verifying
+* Error text for expired tokens includes how long it's been expired
+* Fixed incorrect error returned from `ParseRSAPublicKeyFromPEM`
+* Documentation updates
+
+#### 2.6.0
+
+* Exposed inner error within ValidationError
+* Fixed validation errors when using UseJSONNumber flag
+* Added several unit tests
+
+#### 2.5.0
+
+* Added support for signing method none.  You shouldn't use this.  The API tries to make this clear.
+* Updated/fixed some documentation
+* Added more helpful error message when trying to parse tokens that begin with `BEARER `
+
+#### 2.4.0
+
+* Added new type, Parser, to allow for configuration of various parsing parameters
+	* You can now specify a list of valid signing methods.  Anything outside this set will be rejected.
+	* You can now opt to use the `json.Number` type instead of `float64` when parsing token JSON
+* Added support for [Travis CI](https://travis-ci.org/dgrijalva/jwt-go)
+* Fixed some bugs with ECDSA parsing
+
+#### 2.3.0
+
+* Added support for ECDSA signing methods
+* Added support for RSA PSS signing methods (requires go v1.4)
+
+#### 2.2.0
+
+* Gracefully handle a `nil` `Keyfunc` being passed to `Parse`.  Result will now be the parsed token and an error, instead of a panic.
+
+#### 2.1.0
+
+Backwards compatible API change that was missed in 2.0.0.
+
+* The `SignedString` method on `Token` now takes `interface{}` instead of `[]byte`
+
+#### 2.0.0
+
+There were two major reasons for breaking backwards compatibility with this update.  The first was a refactor required to expand the width of the RSA and HMAC-SHA signing implementations.  There will likely be no required code changes to support this change.
+
+The second update, while unfortunately requiring a small change in integration, is required to open up this library to other signing methods.  Not all keys used for all signing methods have a single standard on-disk representation.  Requiring `[]byte` as the type for all keys proved too limiting.  Additionally, this implementation allows for pre-parsed tokens to be reused, which might matter in an application that parses a high volume of tokens with a small set of keys.  Backwards compatibilty has been maintained for passing `[]byte` to the RSA signing methods, but they will also accept `*rsa.PublicKey` and `*rsa.PrivateKey`.
+
+It is likely the only integration change required here will be to change `func(t *jwt.Token) ([]byte, error)` to `func(t *jwt.Token) (interface{}, error)` when calling `Parse`.
+
+* **Compatibility Breaking Changes**
+	* `SigningMethodHS256` is now `*SigningMethodHMAC` instead of `type struct`
+	* `SigningMethodRS256` is now `*SigningMethodRSA` instead of `type struct`
+	* `KeyFunc` now returns `interface{}` instead of `[]byte`
+	* `SigningMethod.Sign` now takes `interface{}` instead of `[]byte` for the key
+	* `SigningMethod.Verify` now takes `interface{}` instead of `[]byte` for the key
+* Renamed type `SigningMethodHS256` to `SigningMethodHMAC`.  Specific sizes are now just instances of this type.
+    * Added public package global `SigningMethodHS256`
+    * Added public package global `SigningMethodHS384`
+    * Added public package global `SigningMethodHS512`
+* Renamed type `SigningMethodRS256` to `SigningMethodRSA`.  Specific sizes are now just instances of this type.
+    * Added public package global `SigningMethodRS256`
+    * Added public package global `SigningMethodRS384`
+    * Added public package global `SigningMethodRS512`
+* Moved sample private key for HMAC tests from an inline value to a file on disk.  Value is unchanged.
+* Refactored the RSA implementation to be easier to read
+* Exposed helper methods `ParseRSAPrivateKeyFromPEM` and `ParseRSAPublicKeyFromPEM`
+
+#### 1.0.2
+
+* Fixed bug in parsing public keys from certificates
+* Added more tests around the parsing of keys for RS256
+* Code refactoring in RS256 implementation.  No functional changes
+
+#### 1.0.1
+
+* Fixed panic if RS256 signing method was passed an invalid key
+
+#### 1.0.0
+
+* First versioned release
+* API stabilized
+* Supports creating, signing, parsing, and validating JWT tokens
+* Supports RS256 and HS256 signing methods

+ 269 - 0
vendor/github.com/golang-jwt/jwt/v4/claims.go

@@ -0,0 +1,269 @@
+package jwt
+
+import (
+	"crypto/subtle"
+	"fmt"
+	"time"
+)
+
+// Claims must just have a Valid method that determines
+// if the token is invalid for any supported reason
+type Claims interface {
+	Valid() error
+}
+
+// RegisteredClaims are a structured version of the JWT Claims Set,
+// restricted to Registered Claim Names, as referenced at
+// https://datatracker.ietf.org/doc/html/rfc7519#section-4.1
+//
+// This type can be used on its own, but then additional private and
+// public claims embedded in the JWT will not be parsed. The typical usecase
+// therefore is to embedded this in a user-defined claim type.
+//
+// See examples for how to use this with your own claim types.
+type RegisteredClaims struct {
+	// the `iss` (Issuer) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.1
+	Issuer string `json:"iss,omitempty"`
+
+	// the `sub` (Subject) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.2
+	Subject string `json:"sub,omitempty"`
+
+	// the `aud` (Audience) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3
+	Audience ClaimStrings `json:"aud,omitempty"`
+
+	// the `exp` (Expiration Time) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.4
+	ExpiresAt *NumericDate `json:"exp,omitempty"`
+
+	// the `nbf` (Not Before) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.5
+	NotBefore *NumericDate `json:"nbf,omitempty"`
+
+	// the `iat` (Issued At) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.6
+	IssuedAt *NumericDate `json:"iat,omitempty"`
+
+	// the `jti` (JWT ID) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.7
+	ID string `json:"jti,omitempty"`
+}
+
+// Valid validates time based claims "exp, iat, nbf".
+// There is no accounting for clock skew.
+// As well, if any of the above claims are not in the token, it will still
+// be considered a valid claim.
+func (c RegisteredClaims) Valid() error {
+	vErr := new(ValidationError)
+	now := TimeFunc()
+
+	// The claims below are optional, by default, so if they are set to the
+	// default value in Go, let's not fail the verification for them.
+	if !c.VerifyExpiresAt(now, false) {
+		delta := now.Sub(c.ExpiresAt.Time)
+		vErr.Inner = fmt.Errorf("%s by %s", ErrTokenExpired, delta)
+		vErr.Errors |= ValidationErrorExpired
+	}
+
+	if !c.VerifyIssuedAt(now, false) {
+		vErr.Inner = ErrTokenUsedBeforeIssued
+		vErr.Errors |= ValidationErrorIssuedAt
+	}
+
+	if !c.VerifyNotBefore(now, false) {
+		vErr.Inner = ErrTokenNotValidYet
+		vErr.Errors |= ValidationErrorNotValidYet
+	}
+
+	if vErr.valid() {
+		return nil
+	}
+
+	return vErr
+}
+
+// VerifyAudience compares the aud claim against cmp.
+// If required is false, this method will return true if the value matches or is unset
+func (c *RegisteredClaims) VerifyAudience(cmp string, req bool) bool {
+	return verifyAud(c.Audience, cmp, req)
+}
+
+// VerifyExpiresAt compares the exp claim against cmp (cmp < exp).
+// If req is false, it will return true, if exp is unset.
+func (c *RegisteredClaims) VerifyExpiresAt(cmp time.Time, req bool) bool {
+	if c.ExpiresAt == nil {
+		return verifyExp(nil, cmp, req)
+	}
+
+	return verifyExp(&c.ExpiresAt.Time, cmp, req)
+}
+
+// VerifyIssuedAt compares the iat claim against cmp (cmp >= iat).
+// If req is false, it will return true, if iat is unset.
+func (c *RegisteredClaims) VerifyIssuedAt(cmp time.Time, req bool) bool {
+	if c.IssuedAt == nil {
+		return verifyIat(nil, cmp, req)
+	}
+
+	return verifyIat(&c.IssuedAt.Time, cmp, req)
+}
+
+// VerifyNotBefore compares the nbf claim against cmp (cmp >= nbf).
+// If req is false, it will return true, if nbf is unset.
+func (c *RegisteredClaims) VerifyNotBefore(cmp time.Time, req bool) bool {
+	if c.NotBefore == nil {
+		return verifyNbf(nil, cmp, req)
+	}
+
+	return verifyNbf(&c.NotBefore.Time, cmp, req)
+}
+
+// VerifyIssuer compares the iss claim against cmp.
+// If required is false, this method will return true if the value matches or is unset
+func (c *RegisteredClaims) VerifyIssuer(cmp string, req bool) bool {
+	return verifyIss(c.Issuer, cmp, req)
+}
+
+// StandardClaims are a structured version of the JWT Claims Set, as referenced at
+// https://datatracker.ietf.org/doc/html/rfc7519#section-4. They do not follow the
+// specification exactly, since they were based on an earlier draft of the
+// specification and not updated. The main difference is that they only
+// support integer-based date fields and singular audiences. This might lead to
+// incompatibilities with other JWT implementations. The use of this is discouraged, instead
+// the newer RegisteredClaims struct should be used.
+//
+// Deprecated: Use RegisteredClaims instead for a forward-compatible way to access registered claims in a struct.
+type StandardClaims struct {
+	Audience  string `json:"aud,omitempty"`
+	ExpiresAt int64  `json:"exp,omitempty"`
+	Id        string `json:"jti,omitempty"`
+	IssuedAt  int64  `json:"iat,omitempty"`
+	Issuer    string `json:"iss,omitempty"`
+	NotBefore int64  `json:"nbf,omitempty"`
+	Subject   string `json:"sub,omitempty"`
+}
+
+// Valid validates time based claims "exp, iat, nbf". There is no accounting for clock skew.
+// As well, if any of the above claims are not in the token, it will still
+// be considered a valid claim.
+func (c StandardClaims) Valid() error {
+	vErr := new(ValidationError)
+	now := TimeFunc().Unix()
+
+	// The claims below are optional, by default, so if they are set to the
+	// default value in Go, let's not fail the verification for them.
+	if !c.VerifyExpiresAt(now, false) {
+		delta := time.Unix(now, 0).Sub(time.Unix(c.ExpiresAt, 0))
+		vErr.Inner = fmt.Errorf("%s by %s", ErrTokenExpired, delta)
+		vErr.Errors |= ValidationErrorExpired
+	}
+
+	if !c.VerifyIssuedAt(now, false) {
+		vErr.Inner = ErrTokenUsedBeforeIssued
+		vErr.Errors |= ValidationErrorIssuedAt
+	}
+
+	if !c.VerifyNotBefore(now, false) {
+		vErr.Inner = ErrTokenNotValidYet
+		vErr.Errors |= ValidationErrorNotValidYet
+	}
+
+	if vErr.valid() {
+		return nil
+	}
+
+	return vErr
+}
+
+// VerifyAudience compares the aud claim against cmp.
+// If required is false, this method will return true if the value matches or is unset
+func (c *StandardClaims) VerifyAudience(cmp string, req bool) bool {
+	return verifyAud([]string{c.Audience}, cmp, req)
+}
+
+// VerifyExpiresAt compares the exp claim against cmp (cmp < exp).
+// If req is false, it will return true, if exp is unset.
+func (c *StandardClaims) VerifyExpiresAt(cmp int64, req bool) bool {
+	if c.ExpiresAt == 0 {
+		return verifyExp(nil, time.Unix(cmp, 0), req)
+	}
+
+	t := time.Unix(c.ExpiresAt, 0)
+	return verifyExp(&t, time.Unix(cmp, 0), req)
+}
+
+// VerifyIssuedAt compares the iat claim against cmp (cmp >= iat).
+// If req is false, it will return true, if iat is unset.
+func (c *StandardClaims) VerifyIssuedAt(cmp int64, req bool) bool {
+	if c.IssuedAt == 0 {
+		return verifyIat(nil, time.Unix(cmp, 0), req)
+	}
+
+	t := time.Unix(c.IssuedAt, 0)
+	return verifyIat(&t, time.Unix(cmp, 0), req)
+}
+
+// VerifyNotBefore compares the nbf claim against cmp (cmp >= nbf).
+// If req is false, it will return true, if nbf is unset.
+func (c *StandardClaims) VerifyNotBefore(cmp int64, req bool) bool {
+	if c.NotBefore == 0 {
+		return verifyNbf(nil, time.Unix(cmp, 0), req)
+	}
+
+	t := time.Unix(c.NotBefore, 0)
+	return verifyNbf(&t, time.Unix(cmp, 0), req)
+}
+
+// VerifyIssuer compares the iss claim against cmp.
+// If required is false, this method will return true if the value matches or is unset
+func (c *StandardClaims) VerifyIssuer(cmp string, req bool) bool {
+	return verifyIss(c.Issuer, cmp, req)
+}
+
+// ----- helpers
+
+func verifyAud(aud []string, cmp string, required bool) bool {
+	if len(aud) == 0 {
+		return !required
+	}
+	// use a var here to keep constant time compare when looping over a number of claims
+	result := false
+
+	var stringClaims string
+	for _, a := range aud {
+		if subtle.ConstantTimeCompare([]byte(a), []byte(cmp)) != 0 {
+			result = true
+		}
+		stringClaims = stringClaims + a
+	}
+
+	// case where "" is sent in one or many aud claims
+	if len(stringClaims) == 0 {
+		return !required
+	}
+
+	return result
+}
+
+func verifyExp(exp *time.Time, now time.Time, required bool) bool {
+	if exp == nil {
+		return !required
+	}
+	return now.Before(*exp)
+}
+
+func verifyIat(iat *time.Time, now time.Time, required bool) bool {
+	if iat == nil {
+		return !required
+	}
+	return now.After(*iat) || now.Equal(*iat)
+}
+
+func verifyNbf(nbf *time.Time, now time.Time, required bool) bool {
+	if nbf == nil {
+		return !required
+	}
+	return now.After(*nbf) || now.Equal(*nbf)
+}
+
+func verifyIss(iss string, cmp string, required bool) bool {
+	if iss == "" {
+		return !required
+	}
+	return subtle.ConstantTimeCompare([]byte(iss), []byte(cmp)) != 0
+}

+ 4 - 0
vendor/github.com/golang-jwt/jwt/v4/doc.go

@@ -0,0 +1,4 @@
+// Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html
+//
+// See README.md for more info.
+package jwt

+ 142 - 0
vendor/github.com/golang-jwt/jwt/v4/ecdsa.go

@@ -0,0 +1,142 @@
+package jwt
+
+import (
+	"crypto"
+	"crypto/ecdsa"
+	"crypto/rand"
+	"errors"
+	"math/big"
+)
+
+var (
+	// Sadly this is missing from crypto/ecdsa compared to crypto/rsa
+	ErrECDSAVerification = errors.New("crypto/ecdsa: verification error")
+)
+
+// SigningMethodECDSA implements the ECDSA family of signing methods.
+// Expects *ecdsa.PrivateKey for signing and *ecdsa.PublicKey for verification
+type SigningMethodECDSA struct {
+	Name      string
+	Hash      crypto.Hash
+	KeySize   int
+	CurveBits int
+}
+
+// Specific instances for EC256 and company
+var (
+	SigningMethodES256 *SigningMethodECDSA
+	SigningMethodES384 *SigningMethodECDSA
+	SigningMethodES512 *SigningMethodECDSA
+)
+
+func init() {
+	// ES256
+	SigningMethodES256 = &SigningMethodECDSA{"ES256", crypto.SHA256, 32, 256}
+	RegisterSigningMethod(SigningMethodES256.Alg(), func() SigningMethod {
+		return SigningMethodES256
+	})
+
+	// ES384
+	SigningMethodES384 = &SigningMethodECDSA{"ES384", crypto.SHA384, 48, 384}
+	RegisterSigningMethod(SigningMethodES384.Alg(), func() SigningMethod {
+		return SigningMethodES384
+	})
+
+	// ES512
+	SigningMethodES512 = &SigningMethodECDSA{"ES512", crypto.SHA512, 66, 521}
+	RegisterSigningMethod(SigningMethodES512.Alg(), func() SigningMethod {
+		return SigningMethodES512
+	})
+}
+
+func (m *SigningMethodECDSA) Alg() string {
+	return m.Name
+}
+
+// Verify implements token verification for the SigningMethod.
+// For this verify method, key must be an ecdsa.PublicKey struct
+func (m *SigningMethodECDSA) Verify(signingString, signature string, key interface{}) error {
+	var err error
+
+	// Decode the signature
+	var sig []byte
+	if sig, err = DecodeSegment(signature); err != nil {
+		return err
+	}
+
+	// Get the key
+	var ecdsaKey *ecdsa.PublicKey
+	switch k := key.(type) {
+	case *ecdsa.PublicKey:
+		ecdsaKey = k
+	default:
+		return ErrInvalidKeyType
+	}
+
+	if len(sig) != 2*m.KeySize {
+		return ErrECDSAVerification
+	}
+
+	r := big.NewInt(0).SetBytes(sig[:m.KeySize])
+	s := big.NewInt(0).SetBytes(sig[m.KeySize:])
+
+	// Create hasher
+	if !m.Hash.Available() {
+		return ErrHashUnavailable
+	}
+	hasher := m.Hash.New()
+	hasher.Write([]byte(signingString))
+
+	// Verify the signature
+	if verifystatus := ecdsa.Verify(ecdsaKey, hasher.Sum(nil), r, s); verifystatus {
+		return nil
+	}
+
+	return ErrECDSAVerification
+}
+
+// Sign implements token signing for the SigningMethod.
+// For this signing method, key must be an ecdsa.PrivateKey struct
+func (m *SigningMethodECDSA) Sign(signingString string, key interface{}) (string, error) {
+	// Get the key
+	var ecdsaKey *ecdsa.PrivateKey
+	switch k := key.(type) {
+	case *ecdsa.PrivateKey:
+		ecdsaKey = k
+	default:
+		return "", ErrInvalidKeyType
+	}
+
+	// Create the hasher
+	if !m.Hash.Available() {
+		return "", ErrHashUnavailable
+	}
+
+	hasher := m.Hash.New()
+	hasher.Write([]byte(signingString))
+
+	// Sign the string and return r, s
+	if r, s, err := ecdsa.Sign(rand.Reader, ecdsaKey, hasher.Sum(nil)); err == nil {
+		curveBits := ecdsaKey.Curve.Params().BitSize
+
+		if m.CurveBits != curveBits {
+			return "", ErrInvalidKey
+		}
+
+		keyBytes := curveBits / 8
+		if curveBits%8 > 0 {
+			keyBytes += 1
+		}
+
+		// We serialize the outputs (r and s) into big-endian byte arrays
+		// padded with zeros on the left to make sure the sizes work out.
+		// Output must be 2*keyBytes long.
+		out := make([]byte, 2*keyBytes)
+		r.FillBytes(out[0:keyBytes]) // r is assigned to the first half of output.
+		s.FillBytes(out[keyBytes:])  // s is assigned to the second half of output.
+
+		return EncodeSegment(out), nil
+	} else {
+		return "", err
+	}
+}

+ 69 - 0
vendor/github.com/golang-jwt/jwt/v4/ecdsa_utils.go

@@ -0,0 +1,69 @@
+package jwt
+
+import (
+	"crypto/ecdsa"
+	"crypto/x509"
+	"encoding/pem"
+	"errors"
+)
+
+var (
+	ErrNotECPublicKey  = errors.New("key is not a valid ECDSA public key")
+	ErrNotECPrivateKey = errors.New("key is not a valid ECDSA private key")
+)
+
+// ParseECPrivateKeyFromPEM parses a PEM encoded Elliptic Curve Private Key Structure
+func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) {
+	var err error
+
+	// Parse PEM block
+	var block *pem.Block
+	if block, _ = pem.Decode(key); block == nil {
+		return nil, ErrKeyMustBePEMEncoded
+	}
+
+	// Parse the key
+	var parsedKey interface{}
+	if parsedKey, err = x509.ParseECPrivateKey(block.Bytes); err != nil {
+		if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
+			return nil, err
+		}
+	}
+
+	var pkey *ecdsa.PrivateKey
+	var ok bool
+	if pkey, ok = parsedKey.(*ecdsa.PrivateKey); !ok {
+		return nil, ErrNotECPrivateKey
+	}
+
+	return pkey, nil
+}
+
+// ParseECPublicKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 public key
+func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error) {
+	var err error
+
+	// Parse PEM block
+	var block *pem.Block
+	if block, _ = pem.Decode(key); block == nil {
+		return nil, ErrKeyMustBePEMEncoded
+	}
+
+	// Parse the key
+	var parsedKey interface{}
+	if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
+		if cert, err := x509.ParseCertificate(block.Bytes); err == nil {
+			parsedKey = cert.PublicKey
+		} else {
+			return nil, err
+		}
+	}
+
+	var pkey *ecdsa.PublicKey
+	var ok bool
+	if pkey, ok = parsedKey.(*ecdsa.PublicKey); !ok {
+		return nil, ErrNotECPublicKey
+	}
+
+	return pkey, nil
+}

+ 85 - 0
vendor/github.com/golang-jwt/jwt/v4/ed25519.go

@@ -0,0 +1,85 @@
+package jwt
+
+import (
+	"errors"
+
+	"crypto"
+	"crypto/ed25519"
+	"crypto/rand"
+)
+
+var (
+	ErrEd25519Verification = errors.New("ed25519: verification error")
+)
+
+// SigningMethodEd25519 implements the EdDSA family.
+// Expects ed25519.PrivateKey for signing and ed25519.PublicKey for verification
+type SigningMethodEd25519 struct{}
+
+// Specific instance for EdDSA
+var (
+	SigningMethodEdDSA *SigningMethodEd25519
+)
+
+func init() {
+	SigningMethodEdDSA = &SigningMethodEd25519{}
+	RegisterSigningMethod(SigningMethodEdDSA.Alg(), func() SigningMethod {
+		return SigningMethodEdDSA
+	})
+}
+
+func (m *SigningMethodEd25519) Alg() string {
+	return "EdDSA"
+}
+
+// Verify implements token verification for the SigningMethod.
+// For this verify method, key must be an ed25519.PublicKey
+func (m *SigningMethodEd25519) Verify(signingString, signature string, key interface{}) error {
+	var err error
+	var ed25519Key ed25519.PublicKey
+	var ok bool
+
+	if ed25519Key, ok = key.(ed25519.PublicKey); !ok {
+		return ErrInvalidKeyType
+	}
+
+	if len(ed25519Key) != ed25519.PublicKeySize {
+		return ErrInvalidKey
+	}
+
+	// Decode the signature
+	var sig []byte
+	if sig, err = DecodeSegment(signature); err != nil {
+		return err
+	}
+
+	// Verify the signature
+	if !ed25519.Verify(ed25519Key, []byte(signingString), sig) {
+		return ErrEd25519Verification
+	}
+
+	return nil
+}
+
+// Sign implements token signing for the SigningMethod.
+// For this signing method, key must be an ed25519.PrivateKey
+func (m *SigningMethodEd25519) Sign(signingString string, key interface{}) (string, error) {
+	var ed25519Key crypto.Signer
+	var ok bool
+
+	if ed25519Key, ok = key.(crypto.Signer); !ok {
+		return "", ErrInvalidKeyType
+	}
+
+	if _, ok := ed25519Key.Public().(ed25519.PublicKey); !ok {
+		return "", ErrInvalidKey
+	}
+
+	// Sign the string and return the encoded result
+	// ed25519 performs a two-pass hash as part of its algorithm. Therefore, we need to pass a non-prehashed message into the Sign function, as indicated by crypto.Hash(0)
+	sig, err := ed25519Key.Sign(rand.Reader, []byte(signingString), crypto.Hash(0))
+	if err != nil {
+		return "", err
+	}
+	return EncodeSegment(sig), nil
+}

+ 64 - 0
vendor/github.com/golang-jwt/jwt/v4/ed25519_utils.go

@@ -0,0 +1,64 @@
+package jwt
+
+import (
+	"crypto"
+	"crypto/ed25519"
+	"crypto/x509"
+	"encoding/pem"
+	"errors"
+)
+
+var (
+	ErrNotEdPrivateKey = errors.New("key is not a valid Ed25519 private key")
+	ErrNotEdPublicKey  = errors.New("key is not a valid Ed25519 public key")
+)
+
+// ParseEdPrivateKeyFromPEM parses a PEM-encoded Edwards curve private key
+func ParseEdPrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error) {
+	var err error
+
+	// Parse PEM block
+	var block *pem.Block
+	if block, _ = pem.Decode(key); block == nil {
+		return nil, ErrKeyMustBePEMEncoded
+	}
+
+	// Parse the key
+	var parsedKey interface{}
+	if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
+		return nil, err
+	}
+
+	var pkey ed25519.PrivateKey
+	var ok bool
+	if pkey, ok = parsedKey.(ed25519.PrivateKey); !ok {
+		return nil, ErrNotEdPrivateKey
+	}
+
+	return pkey, nil
+}
+
+// ParseEdPublicKeyFromPEM parses a PEM-encoded Edwards curve public key
+func ParseEdPublicKeyFromPEM(key []byte) (crypto.PublicKey, error) {
+	var err error
+
+	// Parse PEM block
+	var block *pem.Block
+	if block, _ = pem.Decode(key); block == nil {
+		return nil, ErrKeyMustBePEMEncoded
+	}
+
+	// Parse the key
+	var parsedKey interface{}
+	if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
+		return nil, err
+	}
+
+	var pkey ed25519.PublicKey
+	var ok bool
+	if pkey, ok = parsedKey.(ed25519.PublicKey); !ok {
+		return nil, ErrNotEdPublicKey
+	}
+
+	return pkey, nil
+}

+ 112 - 0
vendor/github.com/golang-jwt/jwt/v4/errors.go

@@ -0,0 +1,112 @@
+package jwt
+
+import (
+	"errors"
+)
+
+// Error constants
+var (
+	ErrInvalidKey      = errors.New("key is invalid")
+	ErrInvalidKeyType  = errors.New("key is of invalid type")
+	ErrHashUnavailable = errors.New("the requested hash function is unavailable")
+
+	ErrTokenMalformed        = errors.New("token is malformed")
+	ErrTokenUnverifiable     = errors.New("token is unverifiable")
+	ErrTokenSignatureInvalid = errors.New("token signature is invalid")
+
+	ErrTokenInvalidAudience  = errors.New("token has invalid audience")
+	ErrTokenExpired          = errors.New("token is expired")
+	ErrTokenUsedBeforeIssued = errors.New("token used before issued")
+	ErrTokenInvalidIssuer    = errors.New("token has invalid issuer")
+	ErrTokenNotValidYet      = errors.New("token is not valid yet")
+	ErrTokenInvalidId        = errors.New("token has invalid id")
+	ErrTokenInvalidClaims    = errors.New("token has invalid claims")
+)
+
+// The errors that might occur when parsing and validating a token
+const (
+	ValidationErrorMalformed        uint32 = 1 << iota // Token is malformed
+	ValidationErrorUnverifiable                        // Token could not be verified because of signing problems
+	ValidationErrorSignatureInvalid                    // Signature validation failed
+
+	// Standard Claim validation errors
+	ValidationErrorAudience      // AUD validation failed
+	ValidationErrorExpired       // EXP validation failed
+	ValidationErrorIssuedAt      // IAT validation failed
+	ValidationErrorIssuer        // ISS validation failed
+	ValidationErrorNotValidYet   // NBF validation failed
+	ValidationErrorId            // JTI validation failed
+	ValidationErrorClaimsInvalid // Generic claims validation error
+)
+
+// NewValidationError is a helper for constructing a ValidationError with a string error message
+func NewValidationError(errorText string, errorFlags uint32) *ValidationError {
+	return &ValidationError{
+		text:   errorText,
+		Errors: errorFlags,
+	}
+}
+
+// ValidationError represents an error from Parse if token is not valid
+type ValidationError struct {
+	Inner  error  // stores the error returned by external dependencies, i.e.: KeyFunc
+	Errors uint32 // bitfield.  see ValidationError... constants
+	text   string // errors that do not have a valid error just have text
+}
+
+// Error is the implementation of the err interface.
+func (e ValidationError) Error() string {
+	if e.Inner != nil {
+		return e.Inner.Error()
+	} else if e.text != "" {
+		return e.text
+	} else {
+		return "token is invalid"
+	}
+}
+
+// Unwrap gives errors.Is and errors.As access to the inner error.
+func (e *ValidationError) Unwrap() error {
+	return e.Inner
+}
+
+// No errors
+func (e *ValidationError) valid() bool {
+	return e.Errors == 0
+}
+
+// Is checks if this ValidationError is of the supplied error. We are first checking for the exact error message
+// by comparing the inner error message. If that fails, we compare using the error flags. This way we can use
+// custom error messages (mainly for backwards compatability) and still leverage errors.Is using the global error variables.
+func (e *ValidationError) Is(err error) bool {
+	// Check, if our inner error is a direct match
+	if errors.Is(errors.Unwrap(e), err) {
+		return true
+	}
+
+	// Otherwise, we need to match using our error flags
+	switch err {
+	case ErrTokenMalformed:
+		return e.Errors&ValidationErrorMalformed != 0
+	case ErrTokenUnverifiable:
+		return e.Errors&ValidationErrorUnverifiable != 0
+	case ErrTokenSignatureInvalid:
+		return e.Errors&ValidationErrorSignatureInvalid != 0
+	case ErrTokenInvalidAudience:
+		return e.Errors&ValidationErrorAudience != 0
+	case ErrTokenExpired:
+		return e.Errors&ValidationErrorExpired != 0
+	case ErrTokenUsedBeforeIssued:
+		return e.Errors&ValidationErrorIssuedAt != 0
+	case ErrTokenInvalidIssuer:
+		return e.Errors&ValidationErrorIssuer != 0
+	case ErrTokenNotValidYet:
+		return e.Errors&ValidationErrorNotValidYet != 0
+	case ErrTokenInvalidId:
+		return e.Errors&ValidationErrorId != 0
+	case ErrTokenInvalidClaims:
+		return e.Errors&ValidationErrorClaimsInvalid != 0
+	}
+
+	return false
+}

+ 95 - 0
vendor/github.com/golang-jwt/jwt/v4/hmac.go

@@ -0,0 +1,95 @@
+package jwt
+
+import (
+	"crypto"
+	"crypto/hmac"
+	"errors"
+)
+
+// SigningMethodHMAC implements the HMAC-SHA family of signing methods.
+// Expects key type of []byte for both signing and validation
+type SigningMethodHMAC struct {
+	Name string
+	Hash crypto.Hash
+}
+
+// Specific instances for HS256 and company
+var (
+	SigningMethodHS256  *SigningMethodHMAC
+	SigningMethodHS384  *SigningMethodHMAC
+	SigningMethodHS512  *SigningMethodHMAC
+	ErrSignatureInvalid = errors.New("signature is invalid")
+)
+
+func init() {
+	// HS256
+	SigningMethodHS256 = &SigningMethodHMAC{"HS256", crypto.SHA256}
+	RegisterSigningMethod(SigningMethodHS256.Alg(), func() SigningMethod {
+		return SigningMethodHS256
+	})
+
+	// HS384
+	SigningMethodHS384 = &SigningMethodHMAC{"HS384", crypto.SHA384}
+	RegisterSigningMethod(SigningMethodHS384.Alg(), func() SigningMethod {
+		return SigningMethodHS384
+	})
+
+	// HS512
+	SigningMethodHS512 = &SigningMethodHMAC{"HS512", crypto.SHA512}
+	RegisterSigningMethod(SigningMethodHS512.Alg(), func() SigningMethod {
+		return SigningMethodHS512
+	})
+}
+
+func (m *SigningMethodHMAC) Alg() string {
+	return m.Name
+}
+
+// Verify implements token verification for the SigningMethod. Returns nil if the signature is valid.
+func (m *SigningMethodHMAC) Verify(signingString, signature string, key interface{}) error {
+	// Verify the key is the right type
+	keyBytes, ok := key.([]byte)
+	if !ok {
+		return ErrInvalidKeyType
+	}
+
+	// Decode signature, for comparison
+	sig, err := DecodeSegment(signature)
+	if err != nil {
+		return err
+	}
+
+	// Can we use the specified hashing method?
+	if !m.Hash.Available() {
+		return ErrHashUnavailable
+	}
+
+	// This signing method is symmetric, so we validate the signature
+	// by reproducing the signature from the signing string and key, then
+	// comparing that against the provided signature.
+	hasher := hmac.New(m.Hash.New, keyBytes)
+	hasher.Write([]byte(signingString))
+	if !hmac.Equal(sig, hasher.Sum(nil)) {
+		return ErrSignatureInvalid
+	}
+
+	// No validation errors.  Signature is good.
+	return nil
+}
+
+// Sign implements token signing for the SigningMethod.
+// Key must be []byte
+func (m *SigningMethodHMAC) Sign(signingString string, key interface{}) (string, error) {
+	if keyBytes, ok := key.([]byte); ok {
+		if !m.Hash.Available() {
+			return "", ErrHashUnavailable
+		}
+
+		hasher := hmac.New(m.Hash.New, keyBytes)
+		hasher.Write([]byte(signingString))
+
+		return EncodeSegment(hasher.Sum(nil)), nil
+	}
+
+	return "", ErrInvalidKeyType
+}

+ 151 - 0
vendor/github.com/golang-jwt/jwt/v4/map_claims.go

@@ -0,0 +1,151 @@
+package jwt
+
+import (
+	"encoding/json"
+	"errors"
+	"time"
+	// "fmt"
+)
+
+// MapClaims is a claims type that uses the map[string]interface{} for JSON decoding.
+// This is the default claims type if you don't supply one
+type MapClaims map[string]interface{}
+
+// VerifyAudience Compares the aud claim against cmp.
+// If required is false, this method will return true if the value matches or is unset
+func (m MapClaims) VerifyAudience(cmp string, req bool) bool {
+	var aud []string
+	switch v := m["aud"].(type) {
+	case string:
+		aud = append(aud, v)
+	case []string:
+		aud = v
+	case []interface{}:
+		for _, a := range v {
+			vs, ok := a.(string)
+			if !ok {
+				return false
+			}
+			aud = append(aud, vs)
+		}
+	}
+	return verifyAud(aud, cmp, req)
+}
+
+// VerifyExpiresAt compares the exp claim against cmp (cmp <= exp).
+// If req is false, it will return true, if exp is unset.
+func (m MapClaims) VerifyExpiresAt(cmp int64, req bool) bool {
+	cmpTime := time.Unix(cmp, 0)
+
+	v, ok := m["exp"]
+	if !ok {
+		return !req
+	}
+
+	switch exp := v.(type) {
+	case float64:
+		if exp == 0 {
+			return verifyExp(nil, cmpTime, req)
+		}
+
+		return verifyExp(&newNumericDateFromSeconds(exp).Time, cmpTime, req)
+	case json.Number:
+		v, _ := exp.Float64()
+
+		return verifyExp(&newNumericDateFromSeconds(v).Time, cmpTime, req)
+	}
+
+	return false
+}
+
+// VerifyIssuedAt compares the exp claim against cmp (cmp >= iat).
+// If req is false, it will return true, if iat is unset.
+func (m MapClaims) VerifyIssuedAt(cmp int64, req bool) bool {
+	cmpTime := time.Unix(cmp, 0)
+
+	v, ok := m["iat"]
+	if !ok {
+		return !req
+	}
+
+	switch iat := v.(type) {
+	case float64:
+		if iat == 0 {
+			return verifyIat(nil, cmpTime, req)
+		}
+
+		return verifyIat(&newNumericDateFromSeconds(iat).Time, cmpTime, req)
+	case json.Number:
+		v, _ := iat.Float64()
+
+		return verifyIat(&newNumericDateFromSeconds(v).Time, cmpTime, req)
+	}
+
+	return false
+}
+
+// VerifyNotBefore compares the nbf claim against cmp (cmp >= nbf).
+// If req is false, it will return true, if nbf is unset.
+func (m MapClaims) VerifyNotBefore(cmp int64, req bool) bool {
+	cmpTime := time.Unix(cmp, 0)
+
+	v, ok := m["nbf"]
+	if !ok {
+		return !req
+	}
+
+	switch nbf := v.(type) {
+	case float64:
+		if nbf == 0 {
+			return verifyNbf(nil, cmpTime, req)
+		}
+
+		return verifyNbf(&newNumericDateFromSeconds(nbf).Time, cmpTime, req)
+	case json.Number:
+		v, _ := nbf.Float64()
+
+		return verifyNbf(&newNumericDateFromSeconds(v).Time, cmpTime, req)
+	}
+
+	return false
+}
+
+// VerifyIssuer compares the iss claim against cmp.
+// If required is false, this method will return true if the value matches or is unset
+func (m MapClaims) VerifyIssuer(cmp string, req bool) bool {
+	iss, _ := m["iss"].(string)
+	return verifyIss(iss, cmp, req)
+}
+
+// Valid validates time based claims "exp, iat, nbf".
+// There is no accounting for clock skew.
+// As well, if any of the above claims are not in the token, it will still
+// be considered a valid claim.
+func (m MapClaims) Valid() error {
+	vErr := new(ValidationError)
+	now := TimeFunc().Unix()
+
+	if !m.VerifyExpiresAt(now, false) {
+		// TODO(oxisto): this should be replaced with ErrTokenExpired
+		vErr.Inner = errors.New("Token is expired")
+		vErr.Errors |= ValidationErrorExpired
+	}
+
+	if !m.VerifyIssuedAt(now, false) {
+		// TODO(oxisto): this should be replaced with ErrTokenUsedBeforeIssued
+		vErr.Inner = errors.New("Token used before issued")
+		vErr.Errors |= ValidationErrorIssuedAt
+	}
+
+	if !m.VerifyNotBefore(now, false) {
+		// TODO(oxisto): this should be replaced with ErrTokenNotValidYet
+		vErr.Inner = errors.New("Token is not valid yet")
+		vErr.Errors |= ValidationErrorNotValidYet
+	}
+
+	if vErr.valid() {
+		return nil
+	}
+
+	return vErr
+}

+ 52 - 0
vendor/github.com/golang-jwt/jwt/v4/none.go

@@ -0,0 +1,52 @@
+package jwt
+
+// SigningMethodNone implements the none signing method.  This is required by the spec
+// but you probably should never use it.
+var SigningMethodNone *signingMethodNone
+
+const UnsafeAllowNoneSignatureType unsafeNoneMagicConstant = "none signing method allowed"
+
+var NoneSignatureTypeDisallowedError error
+
+type signingMethodNone struct{}
+type unsafeNoneMagicConstant string
+
+func init() {
+	SigningMethodNone = &signingMethodNone{}
+	NoneSignatureTypeDisallowedError = NewValidationError("'none' signature type is not allowed", ValidationErrorSignatureInvalid)
+
+	RegisterSigningMethod(SigningMethodNone.Alg(), func() SigningMethod {
+		return SigningMethodNone
+	})
+}
+
+func (m *signingMethodNone) Alg() string {
+	return "none"
+}
+
+// Only allow 'none' alg type if UnsafeAllowNoneSignatureType is specified as the key
+func (m *signingMethodNone) Verify(signingString, signature string, key interface{}) (err error) {
+	// Key must be UnsafeAllowNoneSignatureType to prevent accidentally
+	// accepting 'none' signing method
+	if _, ok := key.(unsafeNoneMagicConstant); !ok {
+		return NoneSignatureTypeDisallowedError
+	}
+	// If signing method is none, signature must be an empty string
+	if signature != "" {
+		return NewValidationError(
+			"'none' signing method with non-empty signature",
+			ValidationErrorSignatureInvalid,
+		)
+	}
+
+	// Accept 'none' signing method.
+	return nil
+}
+
+// Only allow 'none' signing if UnsafeAllowNoneSignatureType is specified as the key
+func (m *signingMethodNone) Sign(signingString string, key interface{}) (string, error) {
+	if _, ok := key.(unsafeNoneMagicConstant); ok {
+		return "", nil
+	}
+	return "", NoneSignatureTypeDisallowedError
+}

+ 177 - 0
vendor/github.com/golang-jwt/jwt/v4/parser.go

@@ -0,0 +1,177 @@
+package jwt
+
+import (
+	"bytes"
+	"encoding/json"
+	"fmt"
+	"strings"
+)
+
+type Parser struct {
+	// If populated, only these methods will be considered valid.
+	//
+	// Deprecated: In future releases, this field will not be exported anymore and should be set with an option to NewParser instead.
+	ValidMethods []string
+
+	// Use JSON Number format in JSON decoder.
+	//
+	// Deprecated: In future releases, this field will not be exported anymore and should be set with an option to NewParser instead.
+	UseJSONNumber bool
+
+	// Skip claims validation during token parsing.
+	//
+	// Deprecated: In future releases, this field will not be exported anymore and should be set with an option to NewParser instead.
+	SkipClaimsValidation bool
+}
+
+// NewParser creates a new Parser with the specified options
+func NewParser(options ...ParserOption) *Parser {
+	p := &Parser{}
+
+	// loop through our parsing options and apply them
+	for _, option := range options {
+		option(p)
+	}
+
+	return p
+}
+
+// Parse parses, validates, verifies the signature and returns the parsed token.
+// keyFunc will receive the parsed token and should return the key for validating.
+func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) {
+	return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc)
+}
+
+// ParseWithClaims parses, validates, and verifies like Parse, but supplies a default object implementing the Claims
+// interface. This provides default values which can be overridden and allows a caller to use their own type, rather
+// than the default MapClaims implementation of Claims.
+//
+// Note: If you provide a custom claim implementation that embeds one of the standard claims (such as RegisteredClaims),
+// make sure that a) you either embed a non-pointer version of the claims or b) if you are using a pointer, allocate the
+// proper memory for it before passing in the overall claims, otherwise you might run into a panic.
+func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) {
+	token, parts, err := p.ParseUnverified(tokenString, claims)
+	if err != nil {
+		return token, err
+	}
+
+	// Verify signing method is in the required set
+	if p.ValidMethods != nil {
+		var signingMethodValid = false
+		var alg = token.Method.Alg()
+		for _, m := range p.ValidMethods {
+			if m == alg {
+				signingMethodValid = true
+				break
+			}
+		}
+		if !signingMethodValid {
+			// signing method is not in the listed set
+			return token, NewValidationError(fmt.Sprintf("signing method %v is invalid", alg), ValidationErrorSignatureInvalid)
+		}
+	}
+
+	// Lookup key
+	var key interface{}
+	if keyFunc == nil {
+		// keyFunc was not provided.  short circuiting validation
+		return token, NewValidationError("no Keyfunc was provided.", ValidationErrorUnverifiable)
+	}
+	if key, err = keyFunc(token); err != nil {
+		// keyFunc returned an error
+		if ve, ok := err.(*ValidationError); ok {
+			return token, ve
+		}
+		return token, &ValidationError{Inner: err, Errors: ValidationErrorUnverifiable}
+	}
+
+	vErr := &ValidationError{}
+
+	// Validate Claims
+	if !p.SkipClaimsValidation {
+		if err := token.Claims.Valid(); err != nil {
+
+			// If the Claims Valid returned an error, check if it is a validation error,
+			// If it was another error type, create a ValidationError with a generic ClaimsInvalid flag set
+			if e, ok := err.(*ValidationError); !ok {
+				vErr = &ValidationError{Inner: err, Errors: ValidationErrorClaimsInvalid}
+			} else {
+				vErr = e
+			}
+		}
+	}
+
+	// Perform validation
+	token.Signature = parts[2]
+	if err = token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil {
+		vErr.Inner = err
+		vErr.Errors |= ValidationErrorSignatureInvalid
+	}
+
+	if vErr.valid() {
+		token.Valid = true
+		return token, nil
+	}
+
+	return token, vErr
+}
+
+// ParseUnverified parses the token but doesn't validate the signature.
+//
+// WARNING: Don't use this method unless you know what you're doing.
+//
+// It's only ever useful in cases where you know the signature is valid (because it has
+// been checked previously in the stack) and you want to extract values from it.
+func (p *Parser) ParseUnverified(tokenString string, claims Claims) (token *Token, parts []string, err error) {
+	parts = strings.Split(tokenString, ".")
+	if len(parts) != 3 {
+		return nil, parts, NewValidationError("token contains an invalid number of segments", ValidationErrorMalformed)
+	}
+
+	token = &Token{Raw: tokenString}
+
+	// parse Header
+	var headerBytes []byte
+	if headerBytes, err = DecodeSegment(parts[0]); err != nil {
+		if strings.HasPrefix(strings.ToLower(tokenString), "bearer ") {
+			return token, parts, NewValidationError("tokenstring should not contain 'bearer '", ValidationErrorMalformed)
+		}
+		return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
+	}
+	if err = json.Unmarshal(headerBytes, &token.Header); err != nil {
+		return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
+	}
+
+	// parse Claims
+	var claimBytes []byte
+	token.Claims = claims
+
+	if claimBytes, err = DecodeSegment(parts[1]); err != nil {
+		return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
+	}
+	dec := json.NewDecoder(bytes.NewBuffer(claimBytes))
+	if p.UseJSONNumber {
+		dec.UseNumber()
+	}
+	// JSON Decode.  Special case for map type to avoid weird pointer behavior
+	if c, ok := token.Claims.(MapClaims); ok {
+		err = dec.Decode(&c)
+	} else {
+		err = dec.Decode(&claims)
+	}
+	// Handle decode error
+	if err != nil {
+		return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
+	}
+
+	// Lookup signature method
+	if method, ok := token.Header["alg"].(string); ok {
+		if token.Method = GetSigningMethod(method); token.Method == nil {
+			return token, parts, NewValidationError("signing method (alg) is unavailable.", ValidationErrorUnverifiable)
+		}
+	} else {
+		return token, parts, NewValidationError("signing method (alg) is unspecified.", ValidationErrorUnverifiable)
+	}
+
+	return token, parts, nil
+}

+ 29 - 0
vendor/github.com/golang-jwt/jwt/v4/parser_option.go

@@ -0,0 +1,29 @@
+package jwt
+
+// ParserOption is used to implement functional-style options that modify the behavior of the parser. To add
+// new options, just create a function (ideally beginning with With or Without) that returns an anonymous function that
+// takes a *Parser type as input and manipulates its configuration accordingly.
+type ParserOption func(*Parser)
+
+// WithValidMethods is an option to supply algorithm methods that the parser will check. Only those methods will be considered valid.
+// It is heavily encouraged to use this option in order to prevent attacks such as https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/.
+func WithValidMethods(methods []string) ParserOption {
+	return func(p *Parser) {
+		p.ValidMethods = methods
+	}
+}
+
+// WithJSONNumber is an option to configure the underlying JSON parser with UseNumber
+func WithJSONNumber() ParserOption {
+	return func(p *Parser) {
+		p.UseJSONNumber = true
+	}
+}
+
+// WithoutClaimsValidation is an option to disable claims validation. This option should only be used if you exactly know
+// what you are doing.
+func WithoutClaimsValidation() ParserOption {
+	return func(p *Parser) {
+		p.SkipClaimsValidation = true
+	}
+}

+ 7 - 0
vendor/github.com/golang-jwt/jwt/v4/request/doc.go

@@ -0,0 +1,7 @@
+// Utility package for extracting JWT tokens from
+// HTTP requests.
+//
+// The main function is ParseFromRequest and it's WithClaims variant.
+// See examples for how to use the various Extractor implementations
+// or roll your own.
+package request

+ 97 - 0
vendor/github.com/golang-jwt/jwt/v4/request/extractor.go

@@ -0,0 +1,97 @@
+package request
+
+import (
+	"errors"
+	"net/http"
+	"strings"
+)
+
+// Errors
+var (
+	ErrNoTokenInRequest = errors.New("no token present in request")
+)
+
+// Extractor is an interface for extracting a token from an HTTP request.
+// The ExtractToken method should return a token string or an error.
+// If no token is present, you must return ErrNoTokenInRequest.
+type Extractor interface {
+	ExtractToken(*http.Request) (string, error)
+}
+
+// HeaderExtractor is an extractor for finding a token in a header.
+// Looks at each specified header in order until there's a match
+type HeaderExtractor []string
+
+func (e HeaderExtractor) ExtractToken(req *http.Request) (string, error) {
+	// loop over header names and return the first one that contains data
+	for _, header := range e {
+		if ah := req.Header.Get(header); ah != "" {
+			return ah, nil
+		}
+	}
+	return "", ErrNoTokenInRequest
+}
+
+// ArgumentExtractor extracts a token from request arguments.  This includes a POSTed form or
+// GET URL arguments.  Argument names are tried in order until there's a match.
+// This extractor calls `ParseMultipartForm` on the request
+type ArgumentExtractor []string
+
+func (e ArgumentExtractor) ExtractToken(req *http.Request) (string, error) {
+	// Make sure form is parsed
+	req.ParseMultipartForm(10e6)
+
+	// loop over arg names and return the first one that contains data
+	for _, arg := range e {
+		if ah := req.Form.Get(arg); ah != "" {
+			return ah, nil
+		}
+	}
+
+	return "", ErrNoTokenInRequest
+}
+
+// MultiExtractor tries Extractors in order until one returns a token string or an error occurs
+type MultiExtractor []Extractor
+
+func (e MultiExtractor) ExtractToken(req *http.Request) (string, error) {
+	// loop over header names and return the first one that contains data
+	for _, extractor := range e {
+		if tok, err := extractor.ExtractToken(req); tok != "" {
+			return tok, nil
+		} else if !errors.Is(err, ErrNoTokenInRequest) {
+			return "", err
+		}
+	}
+	return "", ErrNoTokenInRequest
+}
+
+// PostExtractionFilter wraps an Extractor in this to post-process the value before it's handed off.
+// See AuthorizationHeaderExtractor for an example
+type PostExtractionFilter struct {
+	Extractor
+	Filter func(string) (string, error)
+}
+
+func (e *PostExtractionFilter) ExtractToken(req *http.Request) (string, error) {
+	if tok, err := e.Extractor.ExtractToken(req); tok != "" {
+		return e.Filter(tok)
+	} else {
+		return "", err
+	}
+}
+
+// BearerExtractor extracts a token from the Authorization header.
+// The header is expected to match the format "Bearer XX", where "XX" is the
+// JWT token.
+type BearerExtractor struct{}
+
+func (e BearerExtractor) ExtractToken(req *http.Request) (string, error) {
+	tokenHeader := req.Header.Get("Authorization")
+	// The usual convention is for "Bearer" to be title-cased. However, there's no
+	// strict rule around this, and it's best to follow the robustness principle here.
+	if tokenHeader == "" || !strings.HasPrefix(strings.ToLower(tokenHeader), "bearer ") {
+		return "", ErrNoTokenInRequest
+	}
+	return tokenHeader[7:], nil
+}

+ 28 - 0
vendor/github.com/golang-jwt/jwt/v4/request/oauth2.go

@@ -0,0 +1,28 @@
+package request
+
+import (
+	"strings"
+)
+
+// Strips 'Bearer ' prefix from bearer token string
+func stripBearerPrefixFromTokenString(tok string) (string, error) {
+	// Should be a bearer token
+	if len(tok) > 6 && strings.ToUpper(tok[0:7]) == "BEARER " {
+		return tok[7:], nil
+	}
+	return tok, nil
+}
+
+// AuthorizationHeaderExtractor extracts a bearer token from Authorization header
+// Uses PostExtractionFilter to strip "Bearer " prefix from header
+var AuthorizationHeaderExtractor = &PostExtractionFilter{
+	HeaderExtractor{"Authorization"},
+	stripBearerPrefixFromTokenString,
+}
+
+// OAuth2Extractor is an Extractor for OAuth2 access tokens.  Looks in 'Authorization'
+// header then 'access_token' argument for a token.
+var OAuth2Extractor = &MultiExtractor{
+	AuthorizationHeaderExtractor,
+	ArgumentExtractor{"access_token"},
+}

+ 70 - 0
vendor/github.com/golang-jwt/jwt/v4/request/request.go

@@ -0,0 +1,70 @@
+package request
+
+import (
+	"net/http"
+
+	"github.com/golang-jwt/jwt/v4"
+)
+
+// ParseFromRequest extracts and parses a JWT token from an HTTP request.
+// This behaves the same as Parse, but accepts a request and an extractor
+// instead of a token string.  The Extractor interface allows you to define
+// the logic for extracting a token.  Several useful implementations are provided.
+//
+// You can provide options to modify parsing behavior
+func ParseFromRequest(req *http.Request, extractor Extractor, keyFunc jwt.Keyfunc, options ...ParseFromRequestOption) (token *jwt.Token, err error) {
+	// Create basic parser struct
+	p := &fromRequestParser{req, extractor, nil, nil}
+
+	// Handle options
+	for _, option := range options {
+		option(p)
+	}
+
+	// Set defaults
+	if p.claims == nil {
+		p.claims = jwt.MapClaims{}
+	}
+	if p.parser == nil {
+		p.parser = &jwt.Parser{}
+	}
+
+	// perform extract
+	tokenString, err := p.extractor.ExtractToken(req)
+	if err != nil {
+		return nil, err
+	}
+
+	// perform parse
+	return p.parser.ParseWithClaims(tokenString, p.claims, keyFunc)
+}
+
+// ParseFromRequestWithClaims is an alias for ParseFromRequest but with custom Claims type.
+//
+// Deprecated: use ParseFromRequest and the WithClaims option
+func ParseFromRequestWithClaims(req *http.Request, extractor Extractor, claims jwt.Claims, keyFunc jwt.Keyfunc) (token *jwt.Token, err error) {
+	return ParseFromRequest(req, extractor, keyFunc, WithClaims(claims))
+}
+
+type fromRequestParser struct {
+	req       *http.Request
+	extractor Extractor
+	claims    jwt.Claims
+	parser    *jwt.Parser
+}
+
+type ParseFromRequestOption func(*fromRequestParser)
+
+// WithClaims parses with custom claims
+func WithClaims(claims jwt.Claims) ParseFromRequestOption {
+	return func(p *fromRequestParser) {
+		p.claims = claims
+	}
+}
+
+// WithParser parses using a custom parser
+func WithParser(parser *jwt.Parser) ParseFromRequestOption {
+	return func(p *fromRequestParser) {
+		p.parser = parser
+	}
+}

+ 101 - 0
vendor/github.com/golang-jwt/jwt/v4/rsa.go

@@ -0,0 +1,101 @@
+package jwt
+
+import (
+	"crypto"
+	"crypto/rand"
+	"crypto/rsa"
+)
+
+// SigningMethodRSA implements the RSA family of signing methods.
+// Expects *rsa.PrivateKey for signing and *rsa.PublicKey for validation
+type SigningMethodRSA struct {
+	Name string
+	Hash crypto.Hash
+}
+
+// Specific instances for RS256 and company
+var (
+	SigningMethodRS256 *SigningMethodRSA
+	SigningMethodRS384 *SigningMethodRSA
+	SigningMethodRS512 *SigningMethodRSA
+)
+
+func init() {
+	// RS256
+	SigningMethodRS256 = &SigningMethodRSA{"RS256", crypto.SHA256}
+	RegisterSigningMethod(SigningMethodRS256.Alg(), func() SigningMethod {
+		return SigningMethodRS256
+	})
+
+	// RS384
+	SigningMethodRS384 = &SigningMethodRSA{"RS384", crypto.SHA384}
+	RegisterSigningMethod(SigningMethodRS384.Alg(), func() SigningMethod {
+		return SigningMethodRS384
+	})
+
+	// RS512
+	SigningMethodRS512 = &SigningMethodRSA{"RS512", crypto.SHA512}
+	RegisterSigningMethod(SigningMethodRS512.Alg(), func() SigningMethod {
+		return SigningMethodRS512
+	})
+}
+
+func (m *SigningMethodRSA) Alg() string {
+	return m.Name
+}
+
+// Verify implements token verification for the SigningMethod
+// For this signing method, must be an *rsa.PublicKey structure.
+func (m *SigningMethodRSA) Verify(signingString, signature string, key interface{}) error {
+	var err error
+
+	// Decode the signature
+	var sig []byte
+	if sig, err = DecodeSegment(signature); err != nil {
+		return err
+	}
+
+	var rsaKey *rsa.PublicKey
+	var ok bool
+
+	if rsaKey, ok = key.(*rsa.PublicKey); !ok {
+		return ErrInvalidKeyType
+	}
+
+	// Create hasher
+	if !m.Hash.Available() {
+		return ErrHashUnavailable
+	}
+	hasher := m.Hash.New()
+	hasher.Write([]byte(signingString))
+
+	// Verify the signature
+	return rsa.VerifyPKCS1v15(rsaKey, m.Hash, hasher.Sum(nil), sig)
+}
+
+// Sign implements token signing for the SigningMethod
+// For this signing method, must be an *rsa.PrivateKey structure.
+func (m *SigningMethodRSA) Sign(signingString string, key interface{}) (string, error) {
+	var rsaKey *rsa.PrivateKey
+	var ok bool
+
+	// Validate type of key
+	if rsaKey, ok = key.(*rsa.PrivateKey); !ok {
+		return "", ErrInvalidKey
+	}
+
+	// Create the hasher
+	if !m.Hash.Available() {
+		return "", ErrHashUnavailable
+	}
+
+	hasher := m.Hash.New()
+	hasher.Write([]byte(signingString))
+
+	// Sign the string and return the encoded bytes
+	if sigBytes, err := rsa.SignPKCS1v15(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil)); err == nil {
+		return EncodeSegment(sigBytes), nil
+	} else {
+		return "", err
+	}
+}

+ 143 - 0
vendor/github.com/golang-jwt/jwt/v4/rsa_pss.go

@@ -0,0 +1,143 @@
+//go:build go1.4
+// +build go1.4
+
+package jwt
+
+import (
+	"crypto"
+	"crypto/rand"
+	"crypto/rsa"
+)
+
+// SigningMethodRSAPSS implements the RSAPSS family of signing methods signing methods
+type SigningMethodRSAPSS struct {
+	*SigningMethodRSA
+	Options *rsa.PSSOptions
+	// VerifyOptions is optional. If set overrides Options for rsa.VerifyPPS.
+	// Used to accept tokens signed with rsa.PSSSaltLengthAuto, what doesn't follow
+	// https://tools.ietf.org/html/rfc7518#section-3.5 but was used previously.
+	// See https://github.com/dgrijalva/jwt-go/issues/285#issuecomment-437451244 for details.
+	VerifyOptions *rsa.PSSOptions
+}
+
+// Specific instances for RS/PS and company.
+var (
+	SigningMethodPS256 *SigningMethodRSAPSS
+	SigningMethodPS384 *SigningMethodRSAPSS
+	SigningMethodPS512 *SigningMethodRSAPSS
+)
+
+func init() {
+	// PS256
+	SigningMethodPS256 = &SigningMethodRSAPSS{
+		SigningMethodRSA: &SigningMethodRSA{
+			Name: "PS256",
+			Hash: crypto.SHA256,
+		},
+		Options: &rsa.PSSOptions{
+			SaltLength: rsa.PSSSaltLengthEqualsHash,
+		},
+		VerifyOptions: &rsa.PSSOptions{
+			SaltLength: rsa.PSSSaltLengthAuto,
+		},
+	}
+	RegisterSigningMethod(SigningMethodPS256.Alg(), func() SigningMethod {
+		return SigningMethodPS256
+	})
+
+	// PS384
+	SigningMethodPS384 = &SigningMethodRSAPSS{
+		SigningMethodRSA: &SigningMethodRSA{
+			Name: "PS384",
+			Hash: crypto.SHA384,
+		},
+		Options: &rsa.PSSOptions{
+			SaltLength: rsa.PSSSaltLengthEqualsHash,
+		},
+		VerifyOptions: &rsa.PSSOptions{
+			SaltLength: rsa.PSSSaltLengthAuto,
+		},
+	}
+	RegisterSigningMethod(SigningMethodPS384.Alg(), func() SigningMethod {
+		return SigningMethodPS384
+	})
+
+	// PS512
+	SigningMethodPS512 = &SigningMethodRSAPSS{
+		SigningMethodRSA: &SigningMethodRSA{
+			Name: "PS512",
+			Hash: crypto.SHA512,
+		},
+		Options: &rsa.PSSOptions{
+			SaltLength: rsa.PSSSaltLengthEqualsHash,
+		},
+		VerifyOptions: &rsa.PSSOptions{
+			SaltLength: rsa.PSSSaltLengthAuto,
+		},
+	}
+	RegisterSigningMethod(SigningMethodPS512.Alg(), func() SigningMethod {
+		return SigningMethodPS512
+	})
+}
+
+// Verify implements token verification for the SigningMethod.
+// For this verify method, key must be an rsa.PublicKey struct
+func (m *SigningMethodRSAPSS) Verify(signingString, signature string, key interface{}) error {
+	var err error
+
+	// Decode the signature
+	var sig []byte
+	if sig, err = DecodeSegment(signature); err != nil {
+		return err
+	}
+
+	var rsaKey *rsa.PublicKey
+	switch k := key.(type) {
+	case *rsa.PublicKey:
+		rsaKey = k
+	default:
+		return ErrInvalidKey
+	}
+
+	// Create hasher
+	if !m.Hash.Available() {
+		return ErrHashUnavailable
+	}
+	hasher := m.Hash.New()
+	hasher.Write([]byte(signingString))
+
+	opts := m.Options
+	if m.VerifyOptions != nil {
+		opts = m.VerifyOptions
+	}
+
+	return rsa.VerifyPSS(rsaKey, m.Hash, hasher.Sum(nil), sig, opts)
+}
+
+// Sign implements token signing for the SigningMethod.
+// For this signing method, key must be an rsa.PrivateKey struct
+func (m *SigningMethodRSAPSS) Sign(signingString string, key interface{}) (string, error) {
+	var rsaKey *rsa.PrivateKey
+
+	switch k := key.(type) {
+	case *rsa.PrivateKey:
+		rsaKey = k
+	default:
+		return "", ErrInvalidKeyType
+	}
+
+	// Create the hasher
+	if !m.Hash.Available() {
+		return "", ErrHashUnavailable
+	}
+
+	hasher := m.Hash.New()
+	hasher.Write([]byte(signingString))
+
+	// Sign the string and return the encoded bytes
+	if sigBytes, err := rsa.SignPSS(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil), m.Options); err == nil {
+		return EncodeSegment(sigBytes), nil
+	} else {
+		return "", err
+	}
+}

+ 105 - 0
vendor/github.com/golang-jwt/jwt/v4/rsa_utils.go

@@ -0,0 +1,105 @@
+package jwt
+
+import (
+	"crypto/rsa"
+	"crypto/x509"
+	"encoding/pem"
+	"errors"
+)
+
+var (
+	ErrKeyMustBePEMEncoded = errors.New("invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key")
+	ErrNotRSAPrivateKey    = errors.New("key is not a valid RSA private key")
+	ErrNotRSAPublicKey     = errors.New("key is not a valid RSA public key")
+)
+
+// ParseRSAPrivateKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 private key
+func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) {
+	var err error
+
+	// Parse PEM block
+	var block *pem.Block
+	if block, _ = pem.Decode(key); block == nil {
+		return nil, ErrKeyMustBePEMEncoded
+	}
+
+	var parsedKey interface{}
+	if parsedKey, err = x509.ParsePKCS1PrivateKey(block.Bytes); err != nil {
+		if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil {
+			return nil, err
+		}
+	}
+
+	var pkey *rsa.PrivateKey
+	var ok bool
+	if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok {
+		return nil, ErrNotRSAPrivateKey
+	}
+
+	return pkey, nil
+}
+
+// ParseRSAPrivateKeyFromPEMWithPassword parses a PEM encoded PKCS1 or PKCS8 private key protected with password
+//
+// Deprecated: This function is deprecated and should not be used anymore. It uses the deprecated x509.DecryptPEMBlock
+// function, which was deprecated since RFC 1423 is regarded insecure by design. Unfortunately, there is no alternative
+// in the Go standard library for now. See https://github.com/golang/go/issues/8860.
+func ParseRSAPrivateKeyFromPEMWithPassword(key []byte, password string) (*rsa.PrivateKey, error) {
+	var err error
+
+	// Parse PEM block
+	var block *pem.Block
+	if block, _ = pem.Decode(key); block == nil {
+		return nil, ErrKeyMustBePEMEncoded
+	}
+
+	var parsedKey interface{}
+
+	var blockDecrypted []byte
+	if blockDecrypted, err = x509.DecryptPEMBlock(block, []byte(password)); err != nil {
+		return nil, err
+	}
+
+	if parsedKey, err = x509.ParsePKCS1PrivateKey(blockDecrypted); err != nil {
+		if parsedKey, err = x509.ParsePKCS8PrivateKey(blockDecrypted); err != nil {
+			return nil, err
+		}
+	}
+
+	var pkey *rsa.PrivateKey
+	var ok bool
+	if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok {
+		return nil, ErrNotRSAPrivateKey
+	}
+
+	return pkey, nil
+}
+
+// ParseRSAPublicKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 public key
+func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) {
+	var err error
+
+	// Parse PEM block
+	var block *pem.Block
+	if block, _ = pem.Decode(key); block == nil {
+		return nil, ErrKeyMustBePEMEncoded
+	}
+
+	// Parse the key
+	var parsedKey interface{}
+	if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil {
+		if cert, err := x509.ParseCertificate(block.Bytes); err == nil {
+			parsedKey = cert.PublicKey
+		} else {
+			return nil, err
+		}
+	}
+
+	var pkey *rsa.PublicKey
+	var ok bool
+	if pkey, ok = parsedKey.(*rsa.PublicKey); !ok {
+		return nil, ErrNotRSAPublicKey
+	}
+
+	return pkey, nil
+}

+ 46 - 0
vendor/github.com/golang-jwt/jwt/v4/signing_method.go

@@ -0,0 +1,46 @@
+package jwt
+
+import (
+	"sync"
+)
+
+var signingMethods = map[string]func() SigningMethod{}
+var signingMethodLock = new(sync.RWMutex)
+
+// SigningMethod can be used add new methods for signing or verifying tokens.
+type SigningMethod interface {
+	Verify(signingString, signature string, key interface{}) error // Returns nil if signature is valid
+	Sign(signingString string, key interface{}) (string, error)    // Returns encoded signature or error
+	Alg() string                                                   // returns the alg identifier for this method (example: 'HS256')
+}
+
+// RegisterSigningMethod registers the "alg" name and a factory function for signing method.
+// This is typically done during init() in the method's implementation
+func RegisterSigningMethod(alg string, f func() SigningMethod) {
+	signingMethodLock.Lock()
+	defer signingMethodLock.Unlock()
+
+	signingMethods[alg] = f
+}
+
+// GetSigningMethod retrieves a signing method from an "alg" string
+func GetSigningMethod(alg string) (method SigningMethod) {
+	signingMethodLock.RLock()
+	defer signingMethodLock.RUnlock()
+
+	if methodF, ok := signingMethods[alg]; ok {
+		method = methodF()
+	}
+	return
+}
+
+// GetAlgorithms returns a list of registered "alg" names
+func GetAlgorithms() (algs []string) {
+	signingMethodLock.RLock()
+	defer signingMethodLock.RUnlock()
+
+	for alg := range signingMethods {
+		algs = append(algs, alg)
+	}
+	return
+}

+ 1 - 0
vendor/github.com/golang-jwt/jwt/v4/staticcheck.conf

@@ -0,0 +1 @@
+checks = ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1023"]

+ 143 - 0
vendor/github.com/golang-jwt/jwt/v4/token.go

@@ -0,0 +1,143 @@
+package jwt
+
+import (
+	"encoding/base64"
+	"encoding/json"
+	"strings"
+	"time"
+)
+
+// DecodePaddingAllowed will switch the codec used for decoding JWTs respectively. Note that the JWS RFC7515
+// states that the tokens will utilize a Base64url encoding with no padding. Unfortunately, some implementations
+// of JWT are producing non-standard tokens, and thus require support for decoding. Note that this is a global
+// variable, and updating it will change the behavior on a package level, and is also NOT go-routine safe.
+// To use the non-recommended decoding, set this boolean to `true` prior to using this package.
+var DecodePaddingAllowed bool
+
+// DecodeStrict will switch the codec used for decoding JWTs into strict mode.
+// In this mode, the decoder requires that trailing padding bits are zero, as described in RFC 4648 section 3.5.
+// Note that this is a global variable, and updating it will change the behavior on a package level, and is also NOT go-routine safe.
+// To use strict decoding, set this boolean to `true` prior to using this package.
+var DecodeStrict bool
+
+// TimeFunc provides the current time when parsing token to validate "exp" claim (expiration time).
+// You can override it to use another time value.  This is useful for testing or if your
+// server uses a different time zone than your tokens.
+var TimeFunc = time.Now
+
+// Keyfunc will be used by the Parse methods as a callback function to supply
+// the key for verification.  The function receives the parsed,
+// but unverified Token.  This allows you to use properties in the
+// Header of the token (such as `kid`) to identify which key to use.
+type Keyfunc func(*Token) (interface{}, error)
+
+// Token represents a JWT Token.  Different fields will be used depending on whether you're
+// creating or parsing/verifying a token.
+type Token struct {
+	Raw       string                 // The raw token.  Populated when you Parse a token
+	Method    SigningMethod          // The signing method used or to be used
+	Header    map[string]interface{} // The first segment of the token
+	Claims    Claims                 // The second segment of the token
+	Signature string                 // The third segment of the token.  Populated when you Parse a token
+	Valid     bool                   // Is the token valid?  Populated when you Parse/Verify a token
+}
+
+// New creates a new Token with the specified signing method and an empty map of claims.
+func New(method SigningMethod) *Token {
+	return NewWithClaims(method, MapClaims{})
+}
+
+// NewWithClaims creates a new Token with the specified signing method and claims.
+func NewWithClaims(method SigningMethod, claims Claims) *Token {
+	return &Token{
+		Header: map[string]interface{}{
+			"typ": "JWT",
+			"alg": method.Alg(),
+		},
+		Claims: claims,
+		Method: method,
+	}
+}
+
+// SignedString creates and returns a complete, signed JWT.
+// The token is signed using the SigningMethod specified in the token.
+func (t *Token) SignedString(key interface{}) (string, error) {
+	var sig, sstr string
+	var err error
+	if sstr, err = t.SigningString(); err != nil {
+		return "", err
+	}
+	if sig, err = t.Method.Sign(sstr, key); err != nil {
+		return "", err
+	}
+	return strings.Join([]string{sstr, sig}, "."), nil
+}
+
+// SigningString generates the signing string.  This is the
+// most expensive part of the whole deal.  Unless you
+// need this for something special, just go straight for
+// the SignedString.
+func (t *Token) SigningString() (string, error) {
+	var err error
+	var jsonValue []byte
+
+	if jsonValue, err = json.Marshal(t.Header); err != nil {
+		return "", err
+	}
+	header := EncodeSegment(jsonValue)
+
+	if jsonValue, err = json.Marshal(t.Claims); err != nil {
+		return "", err
+	}
+	claim := EncodeSegment(jsonValue)
+
+	return strings.Join([]string{header, claim}, "."), nil
+}
+
+// Parse parses, validates, verifies the signature and returns the parsed token.
+// keyFunc will receive the parsed token and should return the cryptographic key
+// for verifying the signature.
+// The caller is strongly encouraged to set the WithValidMethods option to
+// validate the 'alg' claim in the token matches the expected algorithm.
+// For more details about the importance of validating the 'alg' claim,
+// see https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/
+func Parse(tokenString string, keyFunc Keyfunc, options ...ParserOption) (*Token, error) {
+	return NewParser(options...).Parse(tokenString, keyFunc)
+}
+
+// ParseWithClaims is a shortcut for NewParser().ParseWithClaims().
+//
+// Note: If you provide a custom claim implementation that embeds one of the standard claims (such as RegisteredClaims),
+// make sure that a) you either embed a non-pointer version of the claims or b) if you are using a pointer, allocate the
+// proper memory for it before passing in the overall claims, otherwise you might run into a panic.
+func ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc, options ...ParserOption) (*Token, error) {
+	return NewParser(options...).ParseWithClaims(tokenString, claims, keyFunc)
+}
+
+// EncodeSegment encodes a JWT specific base64url encoding with padding stripped
+//
+// Deprecated: In a future release, we will demote this function to a non-exported function, since it
+// should only be used internally
+func EncodeSegment(seg []byte) string {
+	return base64.RawURLEncoding.EncodeToString(seg)
+}
+
+// DecodeSegment decodes a JWT specific base64url encoding with padding stripped
+//
+// Deprecated: In a future release, we will demote this function to a non-exported function, since it
+// should only be used internally
+func DecodeSegment(seg string) ([]byte, error) {
+	encoding := base64.RawURLEncoding
+
+	if DecodePaddingAllowed {
+		if l := len(seg) % 4; l > 0 {
+			seg += strings.Repeat("=", 4-l)
+		}
+		encoding = base64.URLEncoding
+	}
+
+	if DecodeStrict {
+		encoding = encoding.Strict()
+	}
+	return encoding.DecodeString(seg)
+}

+ 145 - 0
vendor/github.com/golang-jwt/jwt/v4/types.go

@@ -0,0 +1,145 @@
+package jwt
+
+import (
+	"encoding/json"
+	"fmt"
+	"math"
+	"reflect"
+	"strconv"
+	"time"
+)
+
+// TimePrecision sets the precision of times and dates within this library.
+// This has an influence on the precision of times when comparing expiry or
+// other related time fields. Furthermore, it is also the precision of times
+// when serializing.
+//
+// For backwards compatibility the default precision is set to seconds, so that
+// no fractional timestamps are generated.
+var TimePrecision = time.Second
+
+// MarshalSingleStringAsArray modifies the behaviour of the ClaimStrings type, especially
+// its MarshalJSON function.
+//
+// If it is set to true (the default), it will always serialize the type as an
+// array of strings, even if it just contains one element, defaulting to the behaviour
+// of the underlying []string. If it is set to false, it will serialize to a single
+// string, if it contains one element. Otherwise, it will serialize to an array of strings.
+var MarshalSingleStringAsArray = true
+
+// NumericDate represents a JSON numeric date value, as referenced at
+// https://datatracker.ietf.org/doc/html/rfc7519#section-2.
+type NumericDate struct {
+	time.Time
+}
+
+// NewNumericDate constructs a new *NumericDate from a standard library time.Time struct.
+// It will truncate the timestamp according to the precision specified in TimePrecision.
+func NewNumericDate(t time.Time) *NumericDate {
+	return &NumericDate{t.Truncate(TimePrecision)}
+}
+
+// newNumericDateFromSeconds creates a new *NumericDate out of a float64 representing a
+// UNIX epoch with the float fraction representing non-integer seconds.
+func newNumericDateFromSeconds(f float64) *NumericDate {
+	round, frac := math.Modf(f)
+	return NewNumericDate(time.Unix(int64(round), int64(frac*1e9)))
+}
+
+// MarshalJSON is an implementation of the json.RawMessage interface and serializes the UNIX epoch
+// represented in NumericDate to a byte array, using the precision specified in TimePrecision.
+func (date NumericDate) MarshalJSON() (b []byte, err error) {
+	var prec int
+	if TimePrecision < time.Second {
+		prec = int(math.Log10(float64(time.Second) / float64(TimePrecision)))
+	}
+	truncatedDate := date.Truncate(TimePrecision)
+
+	// For very large timestamps, UnixNano would overflow an int64, but this
+	// function requires nanosecond level precision, so we have to use the
+	// following technique to get round the issue:
+	// 1. Take the normal unix timestamp to form the whole number part of the
+	//    output,
+	// 2. Take the result of the Nanosecond function, which retuns the offset
+	//    within the second of the particular unix time instance, to form the
+	//    decimal part of the output
+	// 3. Concatenate them to produce the final result
+	seconds := strconv.FormatInt(truncatedDate.Unix(), 10)
+	nanosecondsOffset := strconv.FormatFloat(float64(truncatedDate.Nanosecond())/float64(time.Second), 'f', prec, 64)
+
+	output := append([]byte(seconds), []byte(nanosecondsOffset)[1:]...)
+
+	return output, nil
+}
+
+// UnmarshalJSON is an implementation of the json.RawMessage interface and deserializses a
+// NumericDate from a JSON representation, i.e. a json.Number. This number represents an UNIX epoch
+// with either integer or non-integer seconds.
+func (date *NumericDate) UnmarshalJSON(b []byte) (err error) {
+	var (
+		number json.Number
+		f      float64
+	)
+
+	if err = json.Unmarshal(b, &number); err != nil {
+		return fmt.Errorf("could not parse NumericData: %w", err)
+	}
+
+	if f, err = number.Float64(); err != nil {
+		return fmt.Errorf("could not convert json number value to float: %w", err)
+	}
+
+	n := newNumericDateFromSeconds(f)
+	*date = *n
+
+	return nil
+}
+
+// ClaimStrings is basically just a slice of strings, but it can be either serialized from a string array or just a string.
+// This type is necessary, since the "aud" claim can either be a single string or an array.
+type ClaimStrings []string
+
+func (s *ClaimStrings) UnmarshalJSON(data []byte) (err error) {
+	var value interface{}
+
+	if err = json.Unmarshal(data, &value); err != nil {
+		return err
+	}
+
+	var aud []string
+
+	switch v := value.(type) {
+	case string:
+		aud = append(aud, v)
+	case []string:
+		aud = ClaimStrings(v)
+	case []interface{}:
+		for _, vv := range v {
+			vs, ok := vv.(string)
+			if !ok {
+				return &json.UnsupportedTypeError{Type: reflect.TypeOf(vv)}
+			}
+			aud = append(aud, vs)
+		}
+	case nil:
+		return nil
+	default:
+		return &json.UnsupportedTypeError{Type: reflect.TypeOf(v)}
+	}
+
+	*s = aud
+
+	return
+}
+
+func (s ClaimStrings) MarshalJSON() (b []byte, err error) {
+	// This handles a special case in the JWT RFC. If the string array, e.g. used by the "aud" field,
+	// only contains one element, it MAY be serialized as a single string. This may or may not be
+	// desired based on the ecosystem of other JWT library used, so we make it configurable by the
+	// variable MarshalSingleStringAsArray.
+	if len(s) == 1 && !MarshalSingleStringAsArray {
+		return json.Marshal(s[0])
+	}
+
+	return json.Marshal([]string(s))
+}

+ 24 - 0
vendor/github.com/pkg/errors/.gitignore

@@ -0,0 +1,24 @@
+# Compiled Object files, Static and Dynamic libs (Shared Objects)
+*.o
+*.a
+*.so
+
+# Folders
+_obj
+_test
+
+# Architecture specific extensions/prefixes
+*.[568vq]
+[568vq].out
+
+*.cgo1.go
+*.cgo2.c
+_cgo_defun.c
+_cgo_gotypes.go
+_cgo_export.*
+
+_testmain.go
+
+*.exe
+*.test
+*.prof

+ 10 - 0
vendor/github.com/pkg/errors/.travis.yml

@@ -0,0 +1,10 @@
+language: go
+go_import_path: github.com/pkg/errors
+go:
+  - 1.11.x
+  - 1.12.x
+  - 1.13.x
+  - tip
+
+script:
+  - make check

+ 23 - 0
vendor/github.com/pkg/errors/LICENSE

@@ -0,0 +1,23 @@
+Copyright (c) 2015, Dave Cheney <dave@cheney.net>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 44 - 0
vendor/github.com/pkg/errors/Makefile

@@ -0,0 +1,44 @@
+PKGS := github.com/pkg/errors
+SRCDIRS := $(shell go list -f '{{.Dir}}' $(PKGS))
+GO := go
+
+check: test vet gofmt misspell unconvert staticcheck ineffassign unparam
+
+test: 
+	$(GO) test $(PKGS)
+
+vet: | test
+	$(GO) vet $(PKGS)
+
+staticcheck:
+	$(GO) get honnef.co/go/tools/cmd/staticcheck
+	staticcheck -checks all $(PKGS)
+
+misspell:
+	$(GO) get github.com/client9/misspell/cmd/misspell
+	misspell \
+		-locale GB \
+		-error \
+		*.md *.go
+
+unconvert:
+	$(GO) get github.com/mdempsky/unconvert
+	unconvert -v $(PKGS)
+
+ineffassign:
+	$(GO) get github.com/gordonklaus/ineffassign
+	find $(SRCDIRS) -name '*.go' | xargs ineffassign
+
+pedantic: check errcheck
+
+unparam:
+	$(GO) get mvdan.cc/unparam
+	unparam ./...
+
+errcheck:
+	$(GO) get github.com/kisielk/errcheck
+	errcheck $(PKGS)
+
+gofmt:  
+	@echo Checking code is gofmted
+	@test -z "$(shell gofmt -s -l -d -e $(SRCDIRS) | tee /dev/stderr)"

+ 59 - 0
vendor/github.com/pkg/errors/README.md

@@ -0,0 +1,59 @@
+# errors [![Travis-CI](https://travis-ci.org/pkg/errors.svg)](https://travis-ci.org/pkg/errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/b98mptawhudj53ep/branch/master?svg=true)](https://ci.appveyor.com/project/davecheney/errors/branch/master) [![GoDoc](https://godoc.org/github.com/pkg/errors?status.svg)](http://godoc.org/github.com/pkg/errors) [![Report card](https://goreportcard.com/badge/github.com/pkg/errors)](https://goreportcard.com/report/github.com/pkg/errors) [![Sourcegraph](https://sourcegraph.com/github.com/pkg/errors/-/badge.svg)](https://sourcegraph.com/github.com/pkg/errors?badge)
+
+Package errors provides simple error handling primitives.
+
+`go get github.com/pkg/errors`
+
+The traditional error handling idiom in Go is roughly akin to
+```go
+if err != nil {
+        return err
+}
+```
+which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error.
+
+## Adding context to an error
+
+The errors.Wrap function returns a new error that adds context to the original error. For example
+```go
+_, err := ioutil.ReadAll(r)
+if err != nil {
+        return errors.Wrap(err, "read failed")
+}
+```
+## Retrieving the cause of an error
+
+Using `errors.Wrap` constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by `errors.Cause`.
+```go
+type causer interface {
+        Cause() error
+}
+```
+`errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example:
+```go
+switch err := errors.Cause(err).(type) {
+case *MyError:
+        // handle specifically
+default:
+        // unknown error
+}
+```
+
+[Read the package documentation for more information](https://godoc.org/github.com/pkg/errors).
+
+## Roadmap
+
+With the upcoming [Go2 error proposals](https://go.googlesource.com/proposal/+/master/design/go2draft.md) this package is moving into maintenance mode. The roadmap for a 1.0 release is as follows:
+
+- 0.9. Remove pre Go 1.9 and Go 1.10 support, address outstanding pull requests (if possible)
+- 1.0. Final release.
+
+## Contributing
+
+Because of the Go2 errors changes, this package is not accepting proposals for new functionality. With that said, we welcome pull requests, bug fixes and issue reports. 
+
+Before sending a PR, please discuss your change by raising an issue.
+
+## License
+
+BSD-2-Clause

+ 32 - 0
vendor/github.com/pkg/errors/appveyor.yml

@@ -0,0 +1,32 @@
+version: build-{build}.{branch}
+
+clone_folder: C:\gopath\src\github.com\pkg\errors
+shallow_clone: true # for startup speed
+
+environment:
+  GOPATH: C:\gopath
+
+platform:
+  - x64
+
+# http://www.appveyor.com/docs/installed-software
+install:
+  # some helpful output for debugging builds
+  - go version
+  - go env
+  # pre-installed MinGW at C:\MinGW is 32bit only
+  # but MSYS2 at C:\msys64 has mingw64
+  - set PATH=C:\msys64\mingw64\bin;%PATH%
+  - gcc --version
+  - g++ --version
+
+build_script:
+  - go install -v ./...
+
+test_script:
+  - set PATH=C:\gopath\bin;%PATH%
+  - go test -v ./...
+
+#artifacts:
+#  - path: '%GOPATH%\bin\*.exe'
+deploy: off

+ 288 - 0
vendor/github.com/pkg/errors/errors.go

@@ -0,0 +1,288 @@
+// Package errors provides simple error handling primitives.
+//
+// The traditional error handling idiom in Go is roughly akin to
+//
+//     if err != nil {
+//             return err
+//     }
+//
+// which when applied recursively up the call stack results in error reports
+// without context or debugging information. The errors package allows
+// programmers to add context to the failure path in their code in a way
+// that does not destroy the original value of the error.
+//
+// Adding context to an error
+//
+// The errors.Wrap function returns a new error that adds context to the
+// original error by recording a stack trace at the point Wrap is called,
+// together with the supplied message. For example
+//
+//     _, err := ioutil.ReadAll(r)
+//     if err != nil {
+//             return errors.Wrap(err, "read failed")
+//     }
+//
+// If additional control is required, the errors.WithStack and
+// errors.WithMessage functions destructure errors.Wrap into its component
+// operations: annotating an error with a stack trace and with a message,
+// respectively.
+//
+// Retrieving the cause of an error
+//
+// Using errors.Wrap constructs a stack of errors, adding context to the
+// preceding error. Depending on the nature of the error it may be necessary
+// to reverse the operation of errors.Wrap to retrieve the original error
+// for inspection. Any error value which implements this interface
+//
+//     type causer interface {
+//             Cause() error
+//     }
+//
+// can be inspected by errors.Cause. errors.Cause will recursively retrieve
+// the topmost error that does not implement causer, which is assumed to be
+// the original cause. For example:
+//
+//     switch err := errors.Cause(err).(type) {
+//     case *MyError:
+//             // handle specifically
+//     default:
+//             // unknown error
+//     }
+//
+// Although the causer interface is not exported by this package, it is
+// considered a part of its stable public interface.
+//
+// Formatted printing of errors
+//
+// All error values returned from this package implement fmt.Formatter and can
+// be formatted by the fmt package. The following verbs are supported:
+//
+//     %s    print the error. If the error has a Cause it will be
+//           printed recursively.
+//     %v    see %s
+//     %+v   extended format. Each Frame of the error's StackTrace will
+//           be printed in detail.
+//
+// Retrieving the stack trace of an error or wrapper
+//
+// New, Errorf, Wrap, and Wrapf record a stack trace at the point they are
+// invoked. This information can be retrieved with the following interface:
+//
+//     type stackTracer interface {
+//             StackTrace() errors.StackTrace
+//     }
+//
+// The returned errors.StackTrace type is defined as
+//
+//     type StackTrace []Frame
+//
+// The Frame type represents a call site in the stack trace. Frame supports
+// the fmt.Formatter interface that can be used for printing information about
+// the stack trace of this error. For example:
+//
+//     if err, ok := err.(stackTracer); ok {
+//             for _, f := range err.StackTrace() {
+//                     fmt.Printf("%+s:%d\n", f, f)
+//             }
+//     }
+//
+// Although the stackTracer interface is not exported by this package, it is
+// considered a part of its stable public interface.
+//
+// See the documentation for Frame.Format for more details.
+package errors
+
+import (
+	"fmt"
+	"io"
+)
+
+// New returns an error with the supplied message.
+// New also records the stack trace at the point it was called.
+func New(message string) error {
+	return &fundamental{
+		msg:   message,
+		stack: callers(),
+	}
+}
+
+// Errorf formats according to a format specifier and returns the string
+// as a value that satisfies error.
+// Errorf also records the stack trace at the point it was called.
+func Errorf(format string, args ...interface{}) error {
+	return &fundamental{
+		msg:   fmt.Sprintf(format, args...),
+		stack: callers(),
+	}
+}
+
+// fundamental is an error that has a message and a stack, but no caller.
+type fundamental struct {
+	msg string
+	*stack
+}
+
+func (f *fundamental) Error() string { return f.msg }
+
+func (f *fundamental) Format(s fmt.State, verb rune) {
+	switch verb {
+	case 'v':
+		if s.Flag('+') {
+			io.WriteString(s, f.msg)
+			f.stack.Format(s, verb)
+			return
+		}
+		fallthrough
+	case 's':
+		io.WriteString(s, f.msg)
+	case 'q':
+		fmt.Fprintf(s, "%q", f.msg)
+	}
+}
+
+// WithStack annotates err with a stack trace at the point WithStack was called.
+// If err is nil, WithStack returns nil.
+func WithStack(err error) error {
+	if err == nil {
+		return nil
+	}
+	return &withStack{
+		err,
+		callers(),
+	}
+}
+
+type withStack struct {
+	error
+	*stack
+}
+
+func (w *withStack) Cause() error { return w.error }
+
+// Unwrap provides compatibility for Go 1.13 error chains.
+func (w *withStack) Unwrap() error { return w.error }
+
+func (w *withStack) Format(s fmt.State, verb rune) {
+	switch verb {
+	case 'v':
+		if s.Flag('+') {
+			fmt.Fprintf(s, "%+v", w.Cause())
+			w.stack.Format(s, verb)
+			return
+		}
+		fallthrough
+	case 's':
+		io.WriteString(s, w.Error())
+	case 'q':
+		fmt.Fprintf(s, "%q", w.Error())
+	}
+}
+
+// Wrap returns an error annotating err with a stack trace
+// at the point Wrap is called, and the supplied message.
+// If err is nil, Wrap returns nil.
+func Wrap(err error, message string) error {
+	if err == nil {
+		return nil
+	}
+	err = &withMessage{
+		cause: err,
+		msg:   message,
+	}
+	return &withStack{
+		err,
+		callers(),
+	}
+}
+
+// Wrapf returns an error annotating err with a stack trace
+// at the point Wrapf is called, and the format specifier.
+// If err is nil, Wrapf returns nil.
+func Wrapf(err error, format string, args ...interface{}) error {
+	if err == nil {
+		return nil
+	}
+	err = &withMessage{
+		cause: err,
+		msg:   fmt.Sprintf(format, args...),
+	}
+	return &withStack{
+		err,
+		callers(),
+	}
+}
+
+// WithMessage annotates err with a new message.
+// If err is nil, WithMessage returns nil.
+func WithMessage(err error, message string) error {
+	if err == nil {
+		return nil
+	}
+	return &withMessage{
+		cause: err,
+		msg:   message,
+	}
+}
+
+// WithMessagef annotates err with the format specifier.
+// If err is nil, WithMessagef returns nil.
+func WithMessagef(err error, format string, args ...interface{}) error {
+	if err == nil {
+		return nil
+	}
+	return &withMessage{
+		cause: err,
+		msg:   fmt.Sprintf(format, args...),
+	}
+}
+
+type withMessage struct {
+	cause error
+	msg   string
+}
+
+func (w *withMessage) Error() string { return w.msg + ": " + w.cause.Error() }
+func (w *withMessage) Cause() error  { return w.cause }
+
+// Unwrap provides compatibility for Go 1.13 error chains.
+func (w *withMessage) Unwrap() error { return w.cause }
+
+func (w *withMessage) Format(s fmt.State, verb rune) {
+	switch verb {
+	case 'v':
+		if s.Flag('+') {
+			fmt.Fprintf(s, "%+v\n", w.Cause())
+			io.WriteString(s, w.msg)
+			return
+		}
+		fallthrough
+	case 's', 'q':
+		io.WriteString(s, w.Error())
+	}
+}
+
+// Cause returns the underlying cause of the error, if possible.
+// An error value has a cause if it implements the following
+// interface:
+//
+//     type causer interface {
+//            Cause() error
+//     }
+//
+// If the error does not implement Cause, the original error will
+// be returned. If the error is nil, nil will be returned without further
+// investigation.
+func Cause(err error) error {
+	type causer interface {
+		Cause() error
+	}
+
+	for err != nil {
+		cause, ok := err.(causer)
+		if !ok {
+			break
+		}
+		err = cause.Cause()
+	}
+	return err
+}

+ 38 - 0
vendor/github.com/pkg/errors/go113.go

@@ -0,0 +1,38 @@
+// +build go1.13
+
+package errors
+
+import (
+	stderrors "errors"
+)
+
+// Is reports whether any error in err's chain matches target.
+//
+// The chain consists of err itself followed by the sequence of errors obtained by
+// repeatedly calling Unwrap.
+//
+// An error is considered to match a target if it is equal to that target or if
+// it implements a method Is(error) bool such that Is(target) returns true.
+func Is(err, target error) bool { return stderrors.Is(err, target) }
+
+// As finds the first error in err's chain that matches target, and if so, sets
+// target to that error value and returns true.
+//
+// The chain consists of err itself followed by the sequence of errors obtained by
+// repeatedly calling Unwrap.
+//
+// An error matches target if the error's concrete value is assignable to the value
+// pointed to by target, or if the error has a method As(interface{}) bool such that
+// As(target) returns true. In the latter case, the As method is responsible for
+// setting target.
+//
+// As will panic if target is not a non-nil pointer to either a type that implements
+// error, or to any interface type. As returns false if err is nil.
+func As(err error, target interface{}) bool { return stderrors.As(err, target) }
+
+// Unwrap returns the result of calling the Unwrap method on err, if err's
+// type contains an Unwrap method returning error.
+// Otherwise, Unwrap returns nil.
+func Unwrap(err error) error {
+	return stderrors.Unwrap(err)
+}

+ 177 - 0
vendor/github.com/pkg/errors/stack.go

@@ -0,0 +1,177 @@
+package errors
+
+import (
+	"fmt"
+	"io"
+	"path"
+	"runtime"
+	"strconv"
+	"strings"
+)
+
+// Frame represents a program counter inside a stack frame.
+// For historical reasons if Frame is interpreted as a uintptr
+// its value represents the program counter + 1.
+type Frame uintptr
+
+// pc returns the program counter for this frame;
+// multiple frames may have the same PC value.
+func (f Frame) pc() uintptr { return uintptr(f) - 1 }
+
+// file returns the full path to the file that contains the
+// function for this Frame's pc.
+func (f Frame) file() string {
+	fn := runtime.FuncForPC(f.pc())
+	if fn == nil {
+		return "unknown"
+	}
+	file, _ := fn.FileLine(f.pc())
+	return file
+}
+
+// line returns the line number of source code of the
+// function for this Frame's pc.
+func (f Frame) line() int {
+	fn := runtime.FuncForPC(f.pc())
+	if fn == nil {
+		return 0
+	}
+	_, line := fn.FileLine(f.pc())
+	return line
+}
+
+// name returns the name of this function, if known.
+func (f Frame) name() string {
+	fn := runtime.FuncForPC(f.pc())
+	if fn == nil {
+		return "unknown"
+	}
+	return fn.Name()
+}
+
+// Format formats the frame according to the fmt.Formatter interface.
+//
+//    %s    source file
+//    %d    source line
+//    %n    function name
+//    %v    equivalent to %s:%d
+//
+// Format accepts flags that alter the printing of some verbs, as follows:
+//
+//    %+s   function name and path of source file relative to the compile time
+//          GOPATH separated by \n\t (<funcname>\n\t<path>)
+//    %+v   equivalent to %+s:%d
+func (f Frame) Format(s fmt.State, verb rune) {
+	switch verb {
+	case 's':
+		switch {
+		case s.Flag('+'):
+			io.WriteString(s, f.name())
+			io.WriteString(s, "\n\t")
+			io.WriteString(s, f.file())
+		default:
+			io.WriteString(s, path.Base(f.file()))
+		}
+	case 'd':
+		io.WriteString(s, strconv.Itoa(f.line()))
+	case 'n':
+		io.WriteString(s, funcname(f.name()))
+	case 'v':
+		f.Format(s, 's')
+		io.WriteString(s, ":")
+		f.Format(s, 'd')
+	}
+}
+
+// MarshalText formats a stacktrace Frame as a text string. The output is the
+// same as that of fmt.Sprintf("%+v", f), but without newlines or tabs.
+func (f Frame) MarshalText() ([]byte, error) {
+	name := f.name()
+	if name == "unknown" {
+		return []byte(name), nil
+	}
+	return []byte(fmt.Sprintf("%s %s:%d", name, f.file(), f.line())), nil
+}
+
+// StackTrace is stack of Frames from innermost (newest) to outermost (oldest).
+type StackTrace []Frame
+
+// Format formats the stack of Frames according to the fmt.Formatter interface.
+//
+//    %s	lists source files for each Frame in the stack
+//    %v	lists the source file and line number for each Frame in the stack
+//
+// Format accepts flags that alter the printing of some verbs, as follows:
+//
+//    %+v   Prints filename, function, and line number for each Frame in the stack.
+func (st StackTrace) Format(s fmt.State, verb rune) {
+	switch verb {
+	case 'v':
+		switch {
+		case s.Flag('+'):
+			for _, f := range st {
+				io.WriteString(s, "\n")
+				f.Format(s, verb)
+			}
+		case s.Flag('#'):
+			fmt.Fprintf(s, "%#v", []Frame(st))
+		default:
+			st.formatSlice(s, verb)
+		}
+	case 's':
+		st.formatSlice(s, verb)
+	}
+}
+
+// formatSlice will format this StackTrace into the given buffer as a slice of
+// Frame, only valid when called with '%s' or '%v'.
+func (st StackTrace) formatSlice(s fmt.State, verb rune) {
+	io.WriteString(s, "[")
+	for i, f := range st {
+		if i > 0 {
+			io.WriteString(s, " ")
+		}
+		f.Format(s, verb)
+	}
+	io.WriteString(s, "]")
+}
+
+// stack represents a stack of program counters.
+type stack []uintptr
+
+func (s *stack) Format(st fmt.State, verb rune) {
+	switch verb {
+	case 'v':
+		switch {
+		case st.Flag('+'):
+			for _, pc := range *s {
+				f := Frame(pc)
+				fmt.Fprintf(st, "\n%+v", f)
+			}
+		}
+	}
+}
+
+func (s *stack) StackTrace() StackTrace {
+	f := make([]Frame, len(*s))
+	for i := 0; i < len(f); i++ {
+		f[i] = Frame((*s)[i])
+	}
+	return f
+}
+
+func callers() *stack {
+	const depth = 32
+	var pcs [depth]uintptr
+	n := runtime.Callers(3, pcs[:])
+	var st stack = pcs[0:n]
+	return &st
+}
+
+// funcname removes the path prefix component of a function's name reported by func.Name().
+func funcname(name string) string {
+	i := strings.LastIndex(name, "/")
+	name = name[i+1:]
+	i = strings.Index(name, ".")
+	return name[i+1:]
+}

+ 188 - 0
vendor/github.com/zeromicro/go-zero/core/codec/aesecb.go

@@ -0,0 +1,188 @@
+package codec
+
+import (
+	"bytes"
+	"crypto/aes"
+	"crypto/cipher"
+	"encoding/base64"
+	"errors"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+// ErrPaddingSize indicates bad padding size.
+var ErrPaddingSize = errors.New("padding size error")
+
+type ecb struct {
+	b         cipher.Block
+	blockSize int
+}
+
+func newECB(b cipher.Block) *ecb {
+	return &ecb{
+		b:         b,
+		blockSize: b.BlockSize(),
+	}
+}
+
+type ecbEncrypter ecb
+
+// NewECBEncrypter returns an ECB encrypter.
+func NewECBEncrypter(b cipher.Block) cipher.BlockMode {
+	return (*ecbEncrypter)(newECB(b))
+}
+
+// BlockSize returns the mode's block size.
+func (x *ecbEncrypter) BlockSize() int { return x.blockSize }
+
+// CryptBlocks encrypts a number of blocks. The length of src must be a multiple of
+// the block size. Dst and src must overlap entirely or not at all.
+func (x *ecbEncrypter) CryptBlocks(dst, src []byte) {
+	if len(src)%x.blockSize != 0 {
+		logx.Error("crypto/cipher: input not full blocks")
+		return
+	}
+	if len(dst) < len(src) {
+		logx.Error("crypto/cipher: output smaller than input")
+		return
+	}
+
+	for len(src) > 0 {
+		x.b.Encrypt(dst, src[:x.blockSize])
+		src = src[x.blockSize:]
+		dst = dst[x.blockSize:]
+	}
+}
+
+type ecbDecrypter ecb
+
+// NewECBDecrypter returns an ECB decrypter.
+func NewECBDecrypter(b cipher.Block) cipher.BlockMode {
+	return (*ecbDecrypter)(newECB(b))
+}
+
+// BlockSize returns the mode's block size.
+func (x *ecbDecrypter) BlockSize() int {
+	return x.blockSize
+}
+
+// CryptBlocks decrypts a number of blocks. The length of src must be a multiple of
+// the block size. Dst and src must overlap entirely or not at all.
+func (x *ecbDecrypter) CryptBlocks(dst, src []byte) {
+	if len(src)%x.blockSize != 0 {
+		logx.Error("crypto/cipher: input not full blocks")
+		return
+	}
+	if len(dst) < len(src) {
+		logx.Error("crypto/cipher: output smaller than input")
+		return
+	}
+
+	for len(src) > 0 {
+		x.b.Decrypt(dst, src[:x.blockSize])
+		src = src[x.blockSize:]
+		dst = dst[x.blockSize:]
+	}
+}
+
+// EcbDecrypt decrypts src with the given key.
+func EcbDecrypt(key, src []byte) ([]byte, error) {
+	block, err := aes.NewCipher(key)
+	if err != nil {
+		logx.Errorf("Decrypt key error: % x", key)
+		return nil, err
+	}
+
+	decrypter := NewECBDecrypter(block)
+	decrypted := make([]byte, len(src))
+	decrypter.CryptBlocks(decrypted, src)
+
+	return pkcs5Unpadding(decrypted, decrypter.BlockSize())
+}
+
+// EcbDecryptBase64 decrypts base64 encoded src with the given base64 encoded key.
+// The returned string is also base64 encoded.
+func EcbDecryptBase64(key, src string) (string, error) {
+	keyBytes, err := getKeyBytes(key)
+	if err != nil {
+		return "", err
+	}
+
+	encryptedBytes, err := base64.StdEncoding.DecodeString(src)
+	if err != nil {
+		return "", err
+	}
+
+	decryptedBytes, err := EcbDecrypt(keyBytes, encryptedBytes)
+	if err != nil {
+		return "", err
+	}
+
+	return base64.StdEncoding.EncodeToString(decryptedBytes), nil
+}
+
+// EcbEncrypt encrypts src with the given key.
+func EcbEncrypt(key, src []byte) ([]byte, error) {
+	block, err := aes.NewCipher(key)
+	if err != nil {
+		logx.Errorf("Encrypt key error: % x", key)
+		return nil, err
+	}
+
+	padded := pkcs5Padding(src, block.BlockSize())
+	crypted := make([]byte, len(padded))
+	encrypter := NewECBEncrypter(block)
+	encrypter.CryptBlocks(crypted, padded)
+
+	return crypted, nil
+}
+
+// EcbEncryptBase64 encrypts base64 encoded src with the given base64 encoded key.
+// The returned string is also base64 encoded.
+func EcbEncryptBase64(key, src string) (string, error) {
+	keyBytes, err := getKeyBytes(key)
+	if err != nil {
+		return "", err
+	}
+
+	srcBytes, err := base64.StdEncoding.DecodeString(src)
+	if err != nil {
+		return "", err
+	}
+
+	encryptedBytes, err := EcbEncrypt(keyBytes, srcBytes)
+	if err != nil {
+		return "", err
+	}
+
+	return base64.StdEncoding.EncodeToString(encryptedBytes), nil
+}
+
+func getKeyBytes(key string) ([]byte, error) {
+	if len(key) <= 32 {
+		return []byte(key), nil
+	}
+
+	keyBytes, err := base64.StdEncoding.DecodeString(key)
+	if err != nil {
+		return nil, err
+	}
+
+	return keyBytes, nil
+}
+
+func pkcs5Padding(ciphertext []byte, blockSize int) []byte {
+	padding := blockSize - len(ciphertext)%blockSize
+	padtext := bytes.Repeat([]byte{byte(padding)}, padding)
+	return append(ciphertext, padtext...)
+}
+
+func pkcs5Unpadding(src []byte, blockSize int) ([]byte, error) {
+	length := len(src)
+	unpadding := int(src[length-1])
+	if unpadding >= length || unpadding > blockSize {
+		return nil, ErrPaddingSize
+	}
+
+	return src[:length-unpadding], nil
+}

+ 96 - 0
vendor/github.com/zeromicro/go-zero/core/codec/dh.go

@@ -0,0 +1,96 @@
+package codec
+
+import (
+	"crypto/rand"
+	"errors"
+	"math/big"
+)
+
+// see https://www.zhihu.com/question/29383090/answer/70435297
+// see https://www.ietf.org/rfc/rfc3526.txt
+// 2048-bit MODP Group
+
+var (
+	// ErrInvalidPriKey indicates the invalid private key.
+	ErrInvalidPriKey = errors.New("invalid private key")
+	// ErrInvalidPubKey indicates the invalid public key.
+	ErrInvalidPubKey = errors.New("invalid public key")
+	// ErrPubKeyOutOfBound indicates the public key is out of bound.
+	ErrPubKeyOutOfBound = errors.New("public key out of bound")
+
+	p, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF", 16)
+	g, _ = new(big.Int).SetString("2", 16)
+	zero = big.NewInt(0)
+)
+
+// DhKey defines the Diffie Hellman key.
+type DhKey struct {
+	PriKey *big.Int
+	PubKey *big.Int
+}
+
+// ComputeKey returns a key from public key and private key.
+func ComputeKey(pubKey, priKey *big.Int) (*big.Int, error) {
+	if pubKey == nil {
+		return nil, ErrInvalidPubKey
+	}
+
+	if pubKey.Sign() <= 0 && p.Cmp(pubKey) <= 0 {
+		return nil, ErrPubKeyOutOfBound
+	}
+
+	if priKey == nil {
+		return nil, ErrInvalidPriKey
+	}
+
+	return new(big.Int).Exp(pubKey, priKey, p), nil
+}
+
+// GenerateKey returns a Diffie Hellman key.
+func GenerateKey() (*DhKey, error) {
+	var err error
+	var x *big.Int
+
+	for {
+		x, err = rand.Int(rand.Reader, p)
+		if err != nil {
+			return nil, err
+		}
+
+		if zero.Cmp(x) < 0 {
+			break
+		}
+	}
+
+	key := new(DhKey)
+	key.PriKey = x
+	key.PubKey = new(big.Int).Exp(g, x, p)
+
+	return key, nil
+}
+
+// NewPublicKey returns a public key from the given bytes.
+func NewPublicKey(bs []byte) *big.Int {
+	return new(big.Int).SetBytes(bs)
+}
+
+// Bytes returns public key bytes.
+func (k *DhKey) Bytes() []byte {
+	if k.PubKey == nil {
+		return nil
+	}
+
+	byteLen := (p.BitLen() + 7) >> 3
+	ret := make([]byte, byteLen)
+	copyWithLeftPad(ret, k.PubKey.Bytes())
+
+	return ret
+}
+
+func copyWithLeftPad(dst, src []byte) {
+	padBytes := len(dst) - len(src)
+	for i := 0; i < padBytes; i++ {
+		dst[i] = 0
+	}
+	copy(dst[padBytes:], src)
+}

+ 36 - 0
vendor/github.com/zeromicro/go-zero/core/codec/gzip.go

@@ -0,0 +1,36 @@
+package codec
+
+import (
+	"bytes"
+	"compress/gzip"
+	"io"
+)
+
+const unzipLimit = 100 * 1024 * 1024 // 100MB
+
+// Gzip compresses bs.
+func Gzip(bs []byte) []byte {
+	var b bytes.Buffer
+
+	w := gzip.NewWriter(&b)
+	w.Write(bs)
+	w.Close()
+
+	return b.Bytes()
+}
+
+// Gunzip uncompresses bs.
+func Gunzip(bs []byte) ([]byte, error) {
+	r, err := gzip.NewReader(bytes.NewBuffer(bs))
+	if err != nil {
+		return nil, err
+	}
+	defer r.Close()
+
+	var c bytes.Buffer
+	if _, err = io.Copy(&c, io.LimitReader(r, unzipLimit)); err != nil {
+		return nil, err
+	}
+
+	return c.Bytes(), nil
+}

+ 20 - 0
vendor/github.com/zeromicro/go-zero/core/codec/hmac.go

@@ -0,0 +1,20 @@
+package codec
+
+import (
+	"crypto/hmac"
+	"crypto/sha256"
+	"encoding/base64"
+	"io"
+)
+
+// Hmac returns HMAC bytes for body with the given key.
+func Hmac(key []byte, body string) []byte {
+	h := hmac.New(sha256.New, key)
+	io.WriteString(h, body)
+	return h.Sum(nil)
+}
+
+// HmacBase64 returns the base64 encoded string of HMAC for body with the given key.
+func HmacBase64(key []byte, body string) string {
+	return base64.StdEncoding.EncodeToString(Hmac(key, body))
+}

+ 156 - 0
vendor/github.com/zeromicro/go-zero/core/codec/rsa.go

@@ -0,0 +1,156 @@
+package codec
+
+import (
+	"crypto/rand"
+	"crypto/rsa"
+	"crypto/x509"
+	"encoding/base64"
+	"encoding/pem"
+	"errors"
+	"os"
+)
+
+var (
+	// ErrPrivateKey indicates the invalid private key.
+	ErrPrivateKey = errors.New("private key error")
+	// ErrPublicKey indicates the invalid public key.
+	ErrPublicKey = errors.New("failed to parse PEM block containing the public key")
+	// ErrNotRsaKey indicates the invalid RSA key.
+	ErrNotRsaKey = errors.New("key type is not RSA")
+)
+
+type (
+	// RsaDecrypter represents a RSA decrypter.
+	RsaDecrypter interface {
+		Decrypt(input []byte) ([]byte, error)
+		DecryptBase64(input string) ([]byte, error)
+	}
+
+	// RsaEncrypter represents a RSA encrypter.
+	RsaEncrypter interface {
+		Encrypt(input []byte) ([]byte, error)
+	}
+
+	rsaBase struct {
+		bytesLimit int
+	}
+
+	rsaDecrypter struct {
+		rsaBase
+		privateKey *rsa.PrivateKey
+	}
+
+	rsaEncrypter struct {
+		rsaBase
+		publicKey *rsa.PublicKey
+	}
+)
+
+// NewRsaDecrypter returns a RsaDecrypter with the given file.
+func NewRsaDecrypter(file string) (RsaDecrypter, error) {
+	content, err := os.ReadFile(file)
+	if err != nil {
+		return nil, err
+	}
+
+	block, _ := pem.Decode(content)
+	if block == nil {
+		return nil, ErrPrivateKey
+	}
+
+	privateKey, err := x509.ParsePKCS1PrivateKey(block.Bytes)
+	if err != nil {
+		return nil, err
+	}
+
+	return &rsaDecrypter{
+		rsaBase: rsaBase{
+			bytesLimit: privateKey.N.BitLen() >> 3,
+		},
+		privateKey: privateKey,
+	}, nil
+}
+
+func (r *rsaDecrypter) Decrypt(input []byte) ([]byte, error) {
+	return r.crypt(input, func(block []byte) ([]byte, error) {
+		return rsaDecryptBlock(r.privateKey, block)
+	})
+}
+
+func (r *rsaDecrypter) DecryptBase64(input string) ([]byte, error) {
+	if len(input) == 0 {
+		return nil, nil
+	}
+
+	base64Decoded, err := base64.StdEncoding.DecodeString(input)
+	if err != nil {
+		return nil, err
+	}
+
+	return r.Decrypt(base64Decoded)
+}
+
+// NewRsaEncrypter returns a RsaEncrypter with the given key.
+func NewRsaEncrypter(key []byte) (RsaEncrypter, error) {
+	block, _ := pem.Decode(key)
+	if block == nil {
+		return nil, ErrPublicKey
+	}
+
+	pub, err := x509.ParsePKIXPublicKey(block.Bytes)
+	if err != nil {
+		return nil, err
+	}
+
+	switch pubKey := pub.(type) {
+	case *rsa.PublicKey:
+		return &rsaEncrypter{
+			rsaBase: rsaBase{
+				// https://www.ietf.org/rfc/rfc2313.txt
+				// The length of the data D shall not be more than k-11 octets, which is
+				// positive since the length k of the modulus is at least 12 octets.
+				bytesLimit: (pubKey.N.BitLen() >> 3) - 11,
+			},
+			publicKey: pubKey,
+		}, nil
+	default:
+		return nil, ErrNotRsaKey
+	}
+}
+
+func (r *rsaEncrypter) Encrypt(input []byte) ([]byte, error) {
+	return r.crypt(input, func(block []byte) ([]byte, error) {
+		return rsaEncryptBlock(r.publicKey, block)
+	})
+}
+
+func (r *rsaBase) crypt(input []byte, cryptFn func([]byte) ([]byte, error)) ([]byte, error) {
+	var result []byte
+	inputLen := len(input)
+
+	for i := 0; i*r.bytesLimit < inputLen; i++ {
+		start := r.bytesLimit * i
+		var stop int
+		if r.bytesLimit*(i+1) > inputLen {
+			stop = inputLen
+		} else {
+			stop = r.bytesLimit * (i + 1)
+		}
+		bs, err := cryptFn(input[start:stop])
+		if err != nil {
+			return nil, err
+		}
+
+		result = append(result, bs...)
+	}
+
+	return result, nil
+}
+
+func rsaDecryptBlock(privateKey *rsa.PrivateKey, block []byte) ([]byte, error) {
+	return rsa.DecryptPKCS1v15(rand.Reader, privateKey, block)
+}
+
+func rsaEncryptBlock(publicKey *rsa.PublicKey, msg []byte) ([]byte, error) {
+	return rsa.EncryptPKCS1v15(rand.Reader, publicKey, msg)
+}

+ 239 - 0
vendor/github.com/zeromicro/go-zero/core/search/tree.go

@@ -0,0 +1,239 @@
+package search
+
+import (
+	"errors"
+	"fmt"
+)
+
+const (
+	colon = ':'
+	slash = '/'
+)
+
+var (
+	// errDupItem means adding duplicated item.
+	errDupItem = errors.New("duplicated item")
+	// errDupSlash means item is started with more than one slash.
+	errDupSlash = errors.New("duplicated slash")
+	// errEmptyItem means adding empty item.
+	errEmptyItem = errors.New("empty item")
+	// errInvalidState means search tree is in an invalid state.
+	errInvalidState = errors.New("search tree is in an invalid state")
+	// errNotFromRoot means path is not starting with slash.
+	errNotFromRoot = errors.New("path should start with /")
+
+	// NotFound is used to hold the not found result.
+	NotFound Result
+)
+
+type (
+	innerResult struct {
+		key   string
+		value string
+		named bool
+		found bool
+	}
+
+	node struct {
+		item     any
+		children [2]map[string]*node
+	}
+
+	// A Tree is a search tree.
+	Tree struct {
+		root *node
+	}
+
+	// A Result is a search result from tree.
+	Result struct {
+		Item   any
+		Params map[string]string
+	}
+)
+
+// NewTree returns a Tree.
+func NewTree() *Tree {
+	return &Tree{
+		root: newNode(nil),
+	}
+}
+
+// Add adds item to associate with route.
+func (t *Tree) Add(route string, item any) error {
+	if len(route) == 0 || route[0] != slash {
+		return errNotFromRoot
+	}
+
+	if item == nil {
+		return errEmptyItem
+	}
+
+	err := add(t.root, route[1:], item)
+	switch {
+	case errors.Is(err, errDupItem):
+		return duplicatedItem(route)
+	case errors.Is(err, errDupSlash):
+		return duplicatedSlash(route)
+	default:
+		return err
+	}
+}
+
+// Search searches item that associates with given route.
+func (t *Tree) Search(route string) (Result, bool) {
+	if len(route) == 0 || route[0] != slash {
+		return NotFound, false
+	}
+
+	var result Result
+	ok := t.next(t.root, route[1:], &result)
+	return result, ok
+}
+
+func (t *Tree) next(n *node, route string, result *Result) bool {
+	if len(route) == 0 && n.item != nil {
+		result.Item = n.item
+		return true
+	}
+
+	for i := range route {
+		if route[i] != slash {
+			continue
+		}
+
+		token := route[:i]
+		return n.forEach(func(k string, v *node) bool {
+			r := match(k, token)
+			if !r.found || !t.next(v, route[i+1:], result) {
+				return false
+			}
+			if r.named {
+				addParam(result, r.key, r.value)
+			}
+
+			return true
+		})
+	}
+
+	return n.forEach(func(k string, v *node) bool {
+		if r := match(k, route); r.found && v.item != nil {
+			result.Item = v.item
+			if r.named {
+				addParam(result, r.key, r.value)
+			}
+
+			return true
+		}
+
+		return false
+	})
+}
+
+func (nd *node) forEach(fn func(string, *node) bool) bool {
+	for _, children := range nd.children {
+		for k, v := range children {
+			if fn(k, v) {
+				return true
+			}
+		}
+	}
+
+	return false
+}
+
+func (nd *node) getChildren(route string) map[string]*node {
+	if len(route) > 0 && route[0] == colon {
+		return nd.children[1]
+	}
+
+	return nd.children[0]
+}
+
+func add(nd *node, route string, item any) error {
+	if len(route) == 0 {
+		if nd.item != nil {
+			return errDupItem
+		}
+
+		nd.item = item
+		return nil
+	}
+
+	if route[0] == slash {
+		return errDupSlash
+	}
+
+	for i := range route {
+		if route[i] != slash {
+			continue
+		}
+
+		token := route[:i]
+		children := nd.getChildren(token)
+		if child, ok := children[token]; ok {
+			if child == nil {
+				return errInvalidState
+			}
+
+			return add(child, route[i+1:], item)
+		}
+
+		child := newNode(nil)
+		children[token] = child
+		return add(child, route[i+1:], item)
+	}
+
+	children := nd.getChildren(route)
+	if child, ok := children[route]; ok {
+		if child.item != nil {
+			return errDupItem
+		}
+
+		child.item = item
+	} else {
+		children[route] = newNode(item)
+	}
+
+	return nil
+}
+
+func addParam(result *Result, k, v string) {
+	if result.Params == nil {
+		result.Params = make(map[string]string)
+	}
+
+	result.Params[k] = v
+}
+
+func duplicatedItem(item string) error {
+	return fmt.Errorf("duplicated item for %s", item)
+}
+
+func duplicatedSlash(item string) error {
+	return fmt.Errorf("duplicated slash for %s", item)
+}
+
+func match(pat, token string) innerResult {
+	if pat[0] == colon {
+		return innerResult{
+			key:   pat[1:],
+			value: token,
+			named: true,
+			found: true,
+		}
+	}
+
+	return innerResult{
+		found: pat == token,
+	}
+}
+
+func newNode(item any) *node {
+	return &node{
+		item: item,
+		children: [2]map[string]*node{
+			make(map[string]*node),
+			make(map[string]*node),
+		},
+	}
+}

+ 32 - 0
vendor/github.com/zeromicro/go-zero/core/search/tree_debug.go

@@ -0,0 +1,32 @@
+//go:build debug
+
+package search
+
+import "fmt"
+
+func (t *Tree) Print() {
+	if t.root.item == nil {
+		fmt.Println("/")
+	} else {
+		fmt.Printf("/:%#v\n", t.root.item)
+	}
+	printNode(t.root, 1)
+}
+
+func printNode(n *node, depth int) {
+	indent := make([]byte, depth)
+	for i := 0; i < len(indent); i++ {
+		indent[i] = '\t'
+	}
+
+	for _, children := range n.children {
+		for k, v := range children {
+			if v.item == nil {
+				fmt.Printf("%s%s\n", string(indent), k)
+			} else {
+				fmt.Printf("%s%s:%#v\n", string(indent), k, v.item)
+			}
+			printNode(v, depth+1)
+		}
+	}
+}

+ 45 - 0
vendor/github.com/zeromicro/go-zero/core/utils/times.go

@@ -0,0 +1,45 @@
+package utils
+
+import (
+	"fmt"
+	"time"
+
+	"github.com/zeromicro/go-zero/core/timex"
+)
+
+// An ElapsedTimer is a timer to track the elapsed time.
+type ElapsedTimer struct {
+	start time.Duration
+}
+
+// NewElapsedTimer returns an ElapsedTimer.
+func NewElapsedTimer() *ElapsedTimer {
+	return &ElapsedTimer{
+		start: timex.Now(),
+	}
+}
+
+// Duration returns the elapsed time.
+func (et *ElapsedTimer) Duration() time.Duration {
+	return timex.Since(et.start)
+}
+
+// Elapsed returns the string representation of elapsed time.
+func (et *ElapsedTimer) Elapsed() string {
+	return timex.Since(et.start).String()
+}
+
+// ElapsedMs returns the elapsed time of string on milliseconds.
+func (et *ElapsedTimer) ElapsedMs() string {
+	return fmt.Sprintf("%.1fms", float32(timex.Since(et.start))/float32(time.Millisecond))
+}
+
+// CurrentMicros returns the current microseconds.
+func CurrentMicros() int64 {
+	return time.Now().UnixNano() / int64(time.Microsecond)
+}
+
+// CurrentMillis returns the current milliseconds.
+func CurrentMillis() int64 {
+	return time.Now().UnixNano() / int64(time.Millisecond)
+}

+ 8 - 0
vendor/github.com/zeromicro/go-zero/core/utils/uuid.go

@@ -0,0 +1,8 @@
+package utils
+
+import "github.com/google/uuid"
+
+// NewUuid returns an uuid string.
+func NewUuid() string {
+	return uuid.New().String()
+}

+ 75 - 0
vendor/github.com/zeromicro/go-zero/core/utils/version.go

@@ -0,0 +1,75 @@
+package utils
+
+import (
+	"strconv"
+	"strings"
+
+	"github.com/zeromicro/go-zero/core/mathx"
+	"github.com/zeromicro/go-zero/core/stringx"
+)
+
+var replacer = stringx.NewReplacer(map[string]string{
+	"V": "",
+	"v": "",
+	"-": ".",
+})
+
+// CompareVersions returns true if the first field and the third field are equal, otherwise false.
+func CompareVersions(v1, op, v2 string) bool {
+	result := compare(v1, v2)
+	switch op {
+	case "=", "==":
+		return result == 0
+	case "<":
+		return result == -1
+	case ">":
+		return result == 1
+	case "<=":
+		return result == -1 || result == 0
+	case ">=":
+		return result == 0 || result == 1
+	}
+
+	return false
+}
+
+// return -1 if v1<v2, 0 if they are equal, and 1 if v1>v2
+func compare(v1, v2 string) int {
+	v1, v2 = replacer.Replace(v1), replacer.Replace(v2)
+	fields1, fields2 := strings.Split(v1, "."), strings.Split(v2, ".")
+	ver1, ver2 := strsToInts(fields1), strsToInts(fields2)
+	ver1len, ver2len := len(ver1), len(ver2)
+	shorter := mathx.MinInt(ver1len, ver2len)
+
+	for i := 0; i < shorter; i++ {
+		if ver1[i] == ver2[i] {
+			continue
+		} else if ver1[i] < ver2[i] {
+			return -1
+		} else {
+			return 1
+		}
+	}
+
+	if ver1len < ver2len {
+		return -1
+	} else if ver1len == ver2len {
+		return 0
+	} else {
+		return 1
+	}
+}
+
+func strsToInts(strs []string) []int64 {
+	if len(strs) == 0 {
+		return nil
+	}
+
+	ret := make([]int64, 0, len(strs))
+	for _, str := range strs {
+		i, _ := strconv.ParseInt(str, 10, 64)
+		ret = append(ret, i)
+	}
+
+	return ret
+}

+ 7 - 0
vendor/github.com/zeromicro/go-zero/core/validation/validator.go

@@ -0,0 +1,7 @@
+package validation
+
+// Validator represents a validator.
+type Validator interface {
+	// Validate validates the value.
+	Validate() error
+}

+ 116 - 0
vendor/github.com/zeromicro/go-zero/rest/chain/chain.go

@@ -0,0 +1,116 @@
+package chain
+
+// This is a modified version of https://github.com/justinas/alice
+// The original code is licensed under the MIT license.
+// It's modified for couple reasons:
+// - Added the Chain interface
+// - Added support for the Chain.Prepend(...) method
+
+import "net/http"
+
+type (
+	// Chain defines a chain of middleware.
+	Chain interface {
+		Append(middlewares ...Middleware) Chain
+		Prepend(middlewares ...Middleware) Chain
+		Then(h http.Handler) http.Handler
+		ThenFunc(fn http.HandlerFunc) http.Handler
+	}
+
+	// Middleware is an HTTP middleware.
+	Middleware func(http.Handler) http.Handler
+
+	// chain acts as a list of http.Handler middlewares.
+	// chain is effectively immutable:
+	// once created, it will always hold
+	// the same set of middlewares in the same order.
+	chain struct {
+		middlewares []Middleware
+	}
+)
+
+// New creates a new Chain, memorizing the given list of middleware middlewares.
+// New serves no other function, middlewares are only called upon a call to Then() or ThenFunc().
+func New(middlewares ...Middleware) Chain {
+	return chain{middlewares: append(([]Middleware)(nil), middlewares...)}
+}
+
+// Append extends a chain, adding the specified middlewares as the last ones in the request flow.
+//
+//	c := chain.New(m1, m2)
+//	c.Append(m3, m4)
+//	// requests in c go m1 -> m2 -> m3 -> m4
+func (c chain) Append(middlewares ...Middleware) Chain {
+	return chain{middlewares: join(c.middlewares, middlewares)}
+}
+
+// Prepend extends a chain by adding the specified chain as the first one in the request flow.
+//
+//	c := chain.New(m3, m4)
+//	c1 := chain.New(m1, m2)
+//	c.Prepend(c1)
+//	// requests in c go m1 -> m2 -> m3 -> m4
+func (c chain) Prepend(middlewares ...Middleware) Chain {
+	return chain{middlewares: join(middlewares, c.middlewares)}
+}
+
+// Then chains the middleware and returns the final http.Handler.
+//
+//	New(m1, m2, m3).Then(h)
+//
+// is equivalent to:
+//
+//	m1(m2(m3(h)))
+//
+// When the request comes in, it will be passed to m1, then m2, then m3
+// and finally, the given handler
+// (assuming every middleware calls the following one).
+//
+// A chain can be safely reused by calling Then() several times.
+//
+//	stdStack := chain.New(ratelimitHandler, csrfHandler)
+//	indexPipe = stdStack.Then(indexHandler)
+//	authPipe = stdStack.Then(authHandler)
+//
+// Note that middlewares are called on every call to Then() or ThenFunc()
+// and thus several instances of the same middleware will be created
+// when a chain is reused in this way.
+// For proper middleware, this should cause no problems.
+//
+// Then() treats nil as http.DefaultServeMux.
+func (c chain) Then(h http.Handler) http.Handler {
+	if h == nil {
+		h = http.DefaultServeMux
+	}
+
+	for i := range c.middlewares {
+		h = c.middlewares[len(c.middlewares)-1-i](h)
+	}
+
+	return h
+}
+
+// ThenFunc works identically to Then, but takes
+// a HandlerFunc instead of a Handler.
+//
+// The following two statements are equivalent:
+//
+//	c.Then(http.HandlerFunc(fn))
+//	c.ThenFunc(fn)
+//
+// ThenFunc provides all the guarantees of Then.
+func (c chain) ThenFunc(fn http.HandlerFunc) http.Handler {
+	// This nil check cannot be removed due to the "nil is not nil" common mistake in Go.
+	// Required due to: https://stackoverflow.com/questions/33426977/how-to-golang-check-a-variable-is-nil
+	if fn == nil {
+		return c.Then(nil)
+	}
+	return c.Then(fn)
+}
+
+func join(a, b []Middleware) []Middleware {
+	mids := make([]Middleware, 0, len(a)+len(b))
+	mids = append(mids, a...)
+	mids = append(mids, b...)
+	return mids
+}

+ 63 - 0
vendor/github.com/zeromicro/go-zero/rest/config.go

@@ -0,0 +1,63 @@
+package rest
+
+import (
+	"time"
+
+	"github.com/zeromicro/go-zero/core/service"
+)
+
+type (
+	// MiddlewaresConf is the config of middlewares.
+	MiddlewaresConf struct {
+		Trace      bool `json:",default=true"`
+		Log        bool `json:",default=true"`
+		Prometheus bool `json:",default=true"`
+		MaxConns   bool `json:",default=true"`
+		Breaker    bool `json:",default=true"`
+		Shedding   bool `json:",default=true"`
+		Timeout    bool `json:",default=true"`
+		Recover    bool `json:",default=true"`
+		Metrics    bool `json:",default=true"`
+		MaxBytes   bool `json:",default=true"`
+		Gunzip     bool `json:",default=true"`
+	}
+
+	// A PrivateKeyConf is a private key config.
+	PrivateKeyConf struct {
+		Fingerprint string
+		KeyFile     string
+	}
+
+	// A SignatureConf is a signature config.
+	SignatureConf struct {
+		Strict      bool          `json:",default=false"`
+		Expiry      time.Duration `json:",default=1h"`
+		PrivateKeys []PrivateKeyConf
+	}
+
+	// A RestConf is a http service config.
+	// Why not name it as Conf, because we need to consider usage like:
+	//  type Config struct {
+	//     zrpc.RpcConf
+	//     rest.RestConf
+	//  }
+	// if with the name Conf, there will be two Conf inside Config.
+	RestConf struct {
+		service.ServiceConf
+		Host     string `json:",default=0.0.0.0"`
+		Port     int
+		CertFile string `json:",optional"`
+		KeyFile  string `json:",optional"`
+		Verbose  bool   `json:",optional"`
+		MaxConns int    `json:",default=10000"`
+		MaxBytes int64  `json:",default=1048576"`
+		// milliseconds
+		Timeout      int64         `json:",default=3000"`
+		CpuThreshold int64         `json:",default=900,range=[0:1000]"`
+		Signature    SignatureConf `json:",optional"`
+		// There are default values for all the items in Middlewares.
+		Middlewares MiddlewaresConf
+		// TraceIgnorePaths is paths blacklist for trace middleware.
+		TraceIgnorePaths []string `json:",optional"`
+	}
+)

+ 353 - 0
vendor/github.com/zeromicro/go-zero/rest/engine.go

@@ -0,0 +1,353 @@
+package rest
+
+import (
+	"crypto/tls"
+	"errors"
+	"fmt"
+	"net/http"
+	"sort"
+	"time"
+
+	"github.com/zeromicro/go-zero/core/codec"
+	"github.com/zeromicro/go-zero/core/load"
+	"github.com/zeromicro/go-zero/core/stat"
+	"github.com/zeromicro/go-zero/rest/chain"
+	"github.com/zeromicro/go-zero/rest/handler"
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"github.com/zeromicro/go-zero/rest/internal"
+	"github.com/zeromicro/go-zero/rest/internal/response"
+)
+
+// use 1000m to represent 100%
+const topCpuUsage = 1000
+
+// ErrSignatureConfig is an error that indicates bad config for signature.
+var ErrSignatureConfig = errors.New("bad config for Signature")
+
+type engine struct {
+	conf   RestConf
+	routes []featuredRoutes
+	// timeout is the max timeout of all routes
+	timeout              time.Duration
+	unauthorizedCallback handler.UnauthorizedCallback
+	unsignedCallback     handler.UnsignedCallback
+	chain                chain.Chain
+	middlewares          []Middleware
+	shedder              load.Shedder
+	priorityShedder      load.Shedder
+	tlsConfig            *tls.Config
+}
+
+func newEngine(c RestConf) *engine {
+	svr := &engine{
+		conf:    c,
+		timeout: time.Duration(c.Timeout) * time.Millisecond,
+	}
+
+	if c.CpuThreshold > 0 {
+		svr.shedder = load.NewAdaptiveShedder(load.WithCpuThreshold(c.CpuThreshold))
+		svr.priorityShedder = load.NewAdaptiveShedder(load.WithCpuThreshold(
+			(c.CpuThreshold + topCpuUsage) >> 1))
+	}
+
+	return svr
+}
+
+func (ng *engine) addRoutes(r featuredRoutes) {
+	ng.routes = append(ng.routes, r)
+
+	// need to guarantee the timeout is the max of all routes
+	// otherwise impossible to set http.Server.ReadTimeout & WriteTimeout
+	if r.timeout > ng.timeout {
+		ng.timeout = r.timeout
+	}
+}
+
+func (ng *engine) appendAuthHandler(fr featuredRoutes, chn chain.Chain,
+	verifier func(chain.Chain) chain.Chain) chain.Chain {
+	if fr.jwt.enabled {
+		if len(fr.jwt.prevSecret) == 0 {
+			chn = chn.Append(handler.Authorize(fr.jwt.secret,
+				handler.WithUnauthorizedCallback(ng.unauthorizedCallback)))
+		} else {
+			chn = chn.Append(handler.Authorize(fr.jwt.secret,
+				handler.WithPrevSecret(fr.jwt.prevSecret),
+				handler.WithUnauthorizedCallback(ng.unauthorizedCallback)))
+		}
+	}
+
+	return verifier(chn)
+}
+
+func (ng *engine) bindFeaturedRoutes(router httpx.Router, fr featuredRoutes, metrics *stat.Metrics) error {
+	verifier, err := ng.signatureVerifier(fr.signature)
+	if err != nil {
+		return err
+	}
+
+	for _, route := range fr.routes {
+		if err := ng.bindRoute(fr, router, metrics, route, verifier); err != nil {
+			return err
+		}
+	}
+
+	return nil
+}
+
+func (ng *engine) bindRoute(fr featuredRoutes, router httpx.Router, metrics *stat.Metrics,
+	route Route, verifier func(chain.Chain) chain.Chain) error {
+	chn := ng.chain
+	if chn == nil {
+		chn = ng.buildChainWithNativeMiddlewares(fr, route, metrics)
+	}
+
+	chn = ng.appendAuthHandler(fr, chn, verifier)
+
+	for _, middleware := range ng.middlewares {
+		chn = chn.Append(convertMiddleware(middleware))
+	}
+	handle := chn.ThenFunc(route.Handler)
+
+	return router.Handle(route.Method, route.Path, handle)
+}
+
+func (ng *engine) bindRoutes(router httpx.Router) error {
+	metrics := ng.createMetrics()
+
+	for _, fr := range ng.routes {
+		if err := ng.bindFeaturedRoutes(router, fr, metrics); err != nil {
+			return err
+		}
+	}
+
+	return nil
+}
+
+func (ng *engine) buildChainWithNativeMiddlewares(fr featuredRoutes, route Route,
+	metrics *stat.Metrics) chain.Chain {
+	chn := chain.New()
+
+	if ng.conf.Middlewares.Trace {
+		chn = chn.Append(handler.TraceHandler(ng.conf.Name,
+			route.Path,
+			handler.WithTraceIgnorePaths(ng.conf.TraceIgnorePaths)))
+	}
+	if ng.conf.Middlewares.Log {
+		chn = chn.Append(ng.getLogHandler())
+	}
+	if ng.conf.Middlewares.Prometheus {
+		chn = chn.Append(handler.PrometheusHandler(route.Path, route.Method))
+	}
+	if ng.conf.Middlewares.MaxConns {
+		chn = chn.Append(handler.MaxConnsHandler(ng.conf.MaxConns))
+	}
+	if ng.conf.Middlewares.Breaker {
+		chn = chn.Append(handler.BreakerHandler(route.Method, route.Path, metrics))
+	}
+	if ng.conf.Middlewares.Shedding {
+		chn = chn.Append(handler.SheddingHandler(ng.getShedder(fr.priority), metrics))
+	}
+	if ng.conf.Middlewares.Timeout {
+		chn = chn.Append(handler.TimeoutHandler(ng.checkedTimeout(fr.timeout)))
+	}
+	if ng.conf.Middlewares.Recover {
+		chn = chn.Append(handler.RecoverHandler)
+	}
+	if ng.conf.Middlewares.Metrics {
+		chn = chn.Append(handler.MetricHandler(metrics))
+	}
+	if ng.conf.Middlewares.MaxBytes {
+		chn = chn.Append(handler.MaxBytesHandler(ng.checkedMaxBytes(fr.maxBytes)))
+	}
+	if ng.conf.Middlewares.Gunzip {
+		chn = chn.Append(handler.GunzipHandler)
+	}
+
+	return chn
+}
+
+func (ng *engine) checkedMaxBytes(bytes int64) int64 {
+	if bytes > 0 {
+		return bytes
+	}
+
+	return ng.conf.MaxBytes
+}
+
+func (ng *engine) checkedTimeout(timeout time.Duration) time.Duration {
+	if timeout > 0 {
+		return timeout
+	}
+
+	return time.Duration(ng.conf.Timeout) * time.Millisecond
+}
+
+func (ng *engine) createMetrics() *stat.Metrics {
+	var metrics *stat.Metrics
+
+	if len(ng.conf.Name) > 0 {
+		metrics = stat.NewMetrics(ng.conf.Name)
+	} else {
+		metrics = stat.NewMetrics(fmt.Sprintf("%s:%d", ng.conf.Host, ng.conf.Port))
+	}
+
+	return metrics
+}
+
+func (ng *engine) getLogHandler() func(http.Handler) http.Handler {
+	if ng.conf.Verbose {
+		return handler.DetailedLogHandler
+	}
+
+	return handler.LogHandler
+}
+
+func (ng *engine) getShedder(priority bool) load.Shedder {
+	if priority && ng.priorityShedder != nil {
+		return ng.priorityShedder
+	}
+
+	return ng.shedder
+}
+
+// notFoundHandler returns a middleware that handles 404 not found requests.
+func (ng *engine) notFoundHandler(next http.Handler) http.Handler {
+	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+		chn := chain.New(
+			handler.TraceHandler(ng.conf.Name,
+				"",
+				handler.WithTraceIgnorePaths(ng.conf.TraceIgnorePaths)),
+			ng.getLogHandler(),
+		)
+
+		var h http.Handler
+		if next != nil {
+			h = chn.Then(next)
+		} else {
+			h = chn.Then(http.NotFoundHandler())
+		}
+
+		cw := response.NewHeaderOnceResponseWriter(w)
+		h.ServeHTTP(cw, r)
+		cw.WriteHeader(http.StatusNotFound)
+	})
+}
+
+func (ng *engine) print() {
+	var routes []string
+
+	for _, fr := range ng.routes {
+		for _, route := range fr.routes {
+			routes = append(routes, fmt.Sprintf("%s %s", route.Method, route.Path))
+		}
+	}
+
+	sort.Strings(routes)
+
+	fmt.Println("Routes:")
+	for _, route := range routes {
+		fmt.Printf("  %s\n", route)
+	}
+}
+
+func (ng *engine) setTlsConfig(cfg *tls.Config) {
+	ng.tlsConfig = cfg
+}
+
+func (ng *engine) setUnauthorizedCallback(callback handler.UnauthorizedCallback) {
+	ng.unauthorizedCallback = callback
+}
+
+func (ng *engine) setUnsignedCallback(callback handler.UnsignedCallback) {
+	ng.unsignedCallback = callback
+}
+
+func (ng *engine) signatureVerifier(signature signatureSetting) (func(chain.Chain) chain.Chain, error) {
+	if !signature.enabled {
+		return func(chn chain.Chain) chain.Chain {
+			return chn
+		}, nil
+	}
+
+	if len(signature.PrivateKeys) == 0 {
+		if signature.Strict {
+			return nil, ErrSignatureConfig
+		}
+
+		return func(chn chain.Chain) chain.Chain {
+			return chn
+		}, nil
+	}
+
+	decrypters := make(map[string]codec.RsaDecrypter)
+	for _, key := range signature.PrivateKeys {
+		fingerprint := key.Fingerprint
+		file := key.KeyFile
+		decrypter, err := codec.NewRsaDecrypter(file)
+		if err != nil {
+			return nil, err
+		}
+
+		decrypters[fingerprint] = decrypter
+	}
+
+	return func(chn chain.Chain) chain.Chain {
+		if ng.unsignedCallback == nil {
+			return chn.Append(handler.LimitContentSecurityHandler(ng.conf.MaxBytes,
+				decrypters, signature.Expiry, signature.Strict))
+		}
+
+		return chn.Append(handler.LimitContentSecurityHandler(ng.conf.MaxBytes,
+			decrypters, signature.Expiry, signature.Strict, ng.unsignedCallback))
+	}, nil
+}
+
+func (ng *engine) start(router httpx.Router, opts ...StartOption) error {
+	if err := ng.bindRoutes(router); err != nil {
+		return err
+	}
+
+	// make sure user defined options overwrite default options
+	opts = append([]StartOption{ng.withTimeout()}, opts...)
+
+	if len(ng.conf.CertFile) == 0 && len(ng.conf.KeyFile) == 0 {
+		return internal.StartHttp(ng.conf.Host, ng.conf.Port, router, opts...)
+	}
+
+	// make sure user defined options overwrite default options
+	opts = append([]StartOption{
+		func(svr *http.Server) {
+			if ng.tlsConfig != nil {
+				svr.TLSConfig = ng.tlsConfig
+			}
+		},
+	}, opts...)
+
+	return internal.StartHttps(ng.conf.Host, ng.conf.Port, ng.conf.CertFile,
+		ng.conf.KeyFile, router, opts...)
+}
+
+func (ng *engine) use(middleware Middleware) {
+	ng.middlewares = append(ng.middlewares, middleware)
+}
+
+func (ng *engine) withTimeout() internal.StartOption {
+	return func(svr *http.Server) {
+		timeout := ng.timeout
+		if timeout > 0 {
+			// factor 0.8, to avoid clients send longer content-length than the actual content,
+			// without this timeout setting, the server will time out and respond 503 Service Unavailable,
+			// which triggers the circuit breaker.
+			svr.ReadTimeout = 4 * timeout / 5
+			// factor 1.1, to avoid servers don't have enough time to write responses.
+			// setting the factor less than 1.0 may lead clients not receiving the responses.
+			svr.WriteTimeout = 11 * timeout / 10
+		}
+	}
+}
+
+func convertMiddleware(ware Middleware) func(http.Handler) http.Handler {
+	return func(next http.Handler) http.Handler {
+		return ware(next.ServeHTTP)
+	}
+}

+ 122 - 0
vendor/github.com/zeromicro/go-zero/rest/handler/authhandler.go

@@ -0,0 +1,122 @@
+package handler
+
+import (
+	"context"
+	"errors"
+	"net/http"
+	"net/http/httputil"
+
+	"github.com/golang-jwt/jwt/v4"
+	"github.com/zeromicro/go-zero/core/logx"
+	"github.com/zeromicro/go-zero/rest/internal/response"
+	"github.com/zeromicro/go-zero/rest/token"
+)
+
+const (
+	jwtAudience    = "aud"
+	jwtExpire      = "exp"
+	jwtId          = "jti"
+	jwtIssueAt     = "iat"
+	jwtIssuer      = "iss"
+	jwtNotBefore   = "nbf"
+	jwtSubject     = "sub"
+	noDetailReason = "no detail reason"
+)
+
+var (
+	errInvalidToken = errors.New("invalid auth token")
+	errNoClaims     = errors.New("no auth params")
+)
+
+type (
+	// An AuthorizeOptions is authorize options.
+	AuthorizeOptions struct {
+		PrevSecret string
+		Callback   UnauthorizedCallback
+	}
+
+	// UnauthorizedCallback defines the method of unauthorized callback.
+	UnauthorizedCallback func(w http.ResponseWriter, r *http.Request, err error)
+	// AuthorizeOption defines the method to customize an AuthorizeOptions.
+	AuthorizeOption func(opts *AuthorizeOptions)
+)
+
+// Authorize returns an authorization middleware.
+func Authorize(secret string, opts ...AuthorizeOption) func(http.Handler) http.Handler {
+	var authOpts AuthorizeOptions
+	for _, opt := range opts {
+		opt(&authOpts)
+	}
+
+	parser := token.NewTokenParser()
+	return func(next http.Handler) http.Handler {
+		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+			tok, err := parser.ParseToken(r, secret, authOpts.PrevSecret)
+			if err != nil {
+				unauthorized(w, r, err, authOpts.Callback)
+				return
+			}
+
+			if !tok.Valid {
+				unauthorized(w, r, errInvalidToken, authOpts.Callback)
+				return
+			}
+
+			claims, ok := tok.Claims.(jwt.MapClaims)
+			if !ok {
+				unauthorized(w, r, errNoClaims, authOpts.Callback)
+				return
+			}
+
+			ctx := r.Context()
+			for k, v := range claims {
+				switch k {
+				case jwtAudience, jwtExpire, jwtId, jwtIssueAt, jwtIssuer, jwtNotBefore, jwtSubject:
+					// ignore the standard claims
+				default:
+					ctx = context.WithValue(ctx, k, v)
+				}
+			}
+
+			next.ServeHTTP(w, r.WithContext(ctx))
+		})
+	}
+}
+
+// WithPrevSecret returns an AuthorizeOption with setting previous secret.
+func WithPrevSecret(secret string) AuthorizeOption {
+	return func(opts *AuthorizeOptions) {
+		opts.PrevSecret = secret
+	}
+}
+
+// WithUnauthorizedCallback returns an AuthorizeOption with setting unauthorized callback.
+func WithUnauthorizedCallback(callback UnauthorizedCallback) AuthorizeOption {
+	return func(opts *AuthorizeOptions) {
+		opts.Callback = callback
+	}
+}
+
+func detailAuthLog(r *http.Request, reason string) {
+	// discard dump error, only for debug purpose
+	details, _ := httputil.DumpRequest(r, true)
+	logx.Errorf("authorize failed: %s\n=> %+v", reason, string(details))
+}
+
+func unauthorized(w http.ResponseWriter, r *http.Request, err error, callback UnauthorizedCallback) {
+	writer := response.NewHeaderOnceResponseWriter(w)
+
+	if err != nil {
+		detailAuthLog(r, err.Error())
+	} else {
+		detailAuthLog(r, noDetailReason)
+	}
+
+	// let callback go first, to make sure we respond with user-defined HTTP header
+	if callback != nil {
+		callback(writer, r, err)
+	}
+
+	// if user not setting HTTP header, we set header with 401
+	writer.WriteHeader(http.StatusUnauthorized)
+}

+ 42 - 0
vendor/github.com/zeromicro/go-zero/rest/handler/breakerhandler.go

@@ -0,0 +1,42 @@
+package handler
+
+import (
+	"fmt"
+	"net/http"
+	"strings"
+
+	"github.com/zeromicro/go-zero/core/breaker"
+	"github.com/zeromicro/go-zero/core/logx"
+	"github.com/zeromicro/go-zero/core/stat"
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"github.com/zeromicro/go-zero/rest/internal/response"
+)
+
+const breakerSeparator = "://"
+
+// BreakerHandler returns a break circuit middleware.
+func BreakerHandler(method, path string, metrics *stat.Metrics) func(http.Handler) http.Handler {
+	brk := breaker.NewBreaker(breaker.WithName(strings.Join([]string{method, path}, breakerSeparator)))
+	return func(next http.Handler) http.Handler {
+		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+			promise, err := brk.Allow()
+			if err != nil {
+				metrics.AddDrop()
+				logx.Errorf("[http] dropped, %s - %s - %s",
+					r.RequestURI, httpx.GetRemoteAddr(r), r.UserAgent())
+				w.WriteHeader(http.StatusServiceUnavailable)
+				return
+			}
+
+			cw := response.NewWithCodeResponseWriter(w)
+			defer func() {
+				if cw.Code < http.StatusInternalServerError {
+					promise.Accept()
+				} else {
+					promise.Reject(fmt.Sprintf("%d %s", cw.Code, http.StatusText(cw.Code)))
+				}
+			}()
+			next.ServeHTTP(cw, r)
+		})
+	}
+}

+ 69 - 0
vendor/github.com/zeromicro/go-zero/rest/handler/contentsecurityhandler.go

@@ -0,0 +1,69 @@
+package handler
+
+import (
+	"net/http"
+	"time"
+
+	"github.com/zeromicro/go-zero/core/codec"
+	"github.com/zeromicro/go-zero/core/logx"
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"github.com/zeromicro/go-zero/rest/internal/security"
+)
+
+const contentSecurity = "X-Content-Security"
+
+// UnsignedCallback defines the method of the unsigned callback.
+type UnsignedCallback func(w http.ResponseWriter, r *http.Request, next http.Handler, strict bool, code int)
+
+// ContentSecurityHandler returns a middleware to verify content security.
+func ContentSecurityHandler(decrypters map[string]codec.RsaDecrypter, tolerance time.Duration,
+	strict bool, callbacks ...UnsignedCallback) func(http.Handler) http.Handler {
+	return LimitContentSecurityHandler(maxBytes, decrypters, tolerance, strict, callbacks...)
+}
+
+// LimitContentSecurityHandler returns a middleware to verify content security.
+func LimitContentSecurityHandler(limitBytes int64, decrypters map[string]codec.RsaDecrypter,
+	tolerance time.Duration, strict bool, callbacks ...UnsignedCallback) func(http.Handler) http.Handler {
+	if len(callbacks) == 0 {
+		callbacks = append(callbacks, handleVerificationFailure)
+	}
+
+	return func(next http.Handler) http.Handler {
+		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+			switch r.Method {
+			case http.MethodDelete, http.MethodGet, http.MethodPost, http.MethodPut:
+				header, err := security.ParseContentSecurity(decrypters, r)
+				if err != nil {
+					logx.Errorf("Signature parse failed, X-Content-Security: %s, error: %s",
+						r.Header.Get(contentSecurity), err.Error())
+					executeCallbacks(w, r, next, strict, httpx.CodeSignatureInvalidHeader, callbacks)
+				} else if code := security.VerifySignature(r, header, tolerance); code != httpx.CodeSignaturePass {
+					logx.Errorf("Signature verification failed, X-Content-Security: %s",
+						r.Header.Get(contentSecurity))
+					executeCallbacks(w, r, next, strict, code, callbacks)
+				} else if r.ContentLength > 0 && header.Encrypted() {
+					LimitCryptionHandler(limitBytes, header.Key)(next).ServeHTTP(w, r)
+				} else {
+					next.ServeHTTP(w, r)
+				}
+			default:
+				next.ServeHTTP(w, r)
+			}
+		})
+	}
+}
+
+func executeCallbacks(w http.ResponseWriter, r *http.Request, next http.Handler, strict bool,
+	code int, callbacks []UnsignedCallback) {
+	for _, callback := range callbacks {
+		callback(w, r, next, strict, code)
+	}
+}
+
+func handleVerificationFailure(w http.ResponseWriter, r *http.Request, next http.Handler, strict bool, code int) {
+	if strict {
+		w.WriteHeader(http.StatusForbidden)
+	} else {
+		next.ServeHTTP(w, r)
+	}
+}

+ 138 - 0
vendor/github.com/zeromicro/go-zero/rest/handler/cryptionhandler.go

@@ -0,0 +1,138 @@
+package handler
+
+import (
+	"bufio"
+	"bytes"
+	"encoding/base64"
+	"errors"
+	"io"
+	"net"
+	"net/http"
+
+	"github.com/zeromicro/go-zero/core/codec"
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+const maxBytes = 1 << 20 // 1 MiB
+
+var errContentLengthExceeded = errors.New("content length exceeded")
+
+// CryptionHandler returns a middleware to handle cryption.
+func CryptionHandler(key []byte) func(http.Handler) http.Handler {
+	return LimitCryptionHandler(maxBytes, key)
+}
+
+// LimitCryptionHandler returns a middleware to handle cryption.
+func LimitCryptionHandler(limitBytes int64, key []byte) func(http.Handler) http.Handler {
+	return func(next http.Handler) http.Handler {
+		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+			cw := newCryptionResponseWriter(w)
+			defer cw.flush(key)
+
+			if r.ContentLength <= 0 {
+				next.ServeHTTP(cw, r)
+				return
+			}
+
+			if err := decryptBody(limitBytes, key, r); err != nil {
+				w.WriteHeader(http.StatusBadRequest)
+				return
+			}
+
+			next.ServeHTTP(cw, r)
+		})
+	}
+}
+
+func decryptBody(limitBytes int64, key []byte, r *http.Request) error {
+	if limitBytes > 0 && r.ContentLength > limitBytes {
+		return errContentLengthExceeded
+	}
+
+	var content []byte
+	var err error
+	if r.ContentLength > 0 {
+		content = make([]byte, r.ContentLength)
+		_, err = io.ReadFull(r.Body, content)
+	} else {
+		content, err = io.ReadAll(io.LimitReader(r.Body, maxBytes))
+	}
+	if err != nil {
+		return err
+	}
+
+	content, err = base64.StdEncoding.DecodeString(string(content))
+	if err != nil {
+		return err
+	}
+
+	output, err := codec.EcbDecrypt(key, content)
+	if err != nil {
+		return err
+	}
+
+	var buf bytes.Buffer
+	buf.Write(output)
+	r.Body = io.NopCloser(&buf)
+
+	return nil
+}
+
+type cryptionResponseWriter struct {
+	http.ResponseWriter
+	buf *bytes.Buffer
+}
+
+func newCryptionResponseWriter(w http.ResponseWriter) *cryptionResponseWriter {
+	return &cryptionResponseWriter{
+		ResponseWriter: w,
+		buf:            new(bytes.Buffer),
+	}
+}
+
+func (w *cryptionResponseWriter) Flush() {
+	if flusher, ok := w.ResponseWriter.(http.Flusher); ok {
+		flusher.Flush()
+	}
+}
+
+func (w *cryptionResponseWriter) Header() http.Header {
+	return w.ResponseWriter.Header()
+}
+
+// Hijack implements the http.Hijacker interface.
+// This expands the Response to fulfill http.Hijacker if the underlying http.ResponseWriter supports it.
+func (w *cryptionResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
+	if hijacked, ok := w.ResponseWriter.(http.Hijacker); ok {
+		return hijacked.Hijack()
+	}
+
+	return nil, nil, errors.New("server doesn't support hijacking")
+}
+
+func (w *cryptionResponseWriter) Write(p []byte) (int, error) {
+	return w.buf.Write(p)
+}
+
+func (w *cryptionResponseWriter) WriteHeader(statusCode int) {
+	w.ResponseWriter.WriteHeader(statusCode)
+}
+
+func (w *cryptionResponseWriter) flush(key []byte) {
+	if w.buf.Len() == 0 {
+		return
+	}
+
+	content, err := codec.EcbEncrypt(key, w.buf.Bytes())
+	if err != nil {
+		w.WriteHeader(http.StatusInternalServerError)
+		return
+	}
+
+	body := base64.StdEncoding.EncodeToString(content)
+	if n, err := io.WriteString(w.ResponseWriter, body); err != nil {
+		logx.Errorf("write response failed, error: %s", err)
+	} else if n < len(body) {
+		logx.Errorf("actual bytes: %d, written bytes: %d", len(body), n)
+	}
+}

+ 28 - 0
vendor/github.com/zeromicro/go-zero/rest/handler/gunziphandler.go

@@ -0,0 +1,28 @@
+package handler
+
+import (
+	"compress/gzip"
+	"net/http"
+	"strings"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+const gzipEncoding = "gzip"
+
+// GunzipHandler returns a middleware to gunzip http request body.
+func GunzipHandler(next http.Handler) http.Handler {
+	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+		if strings.Contains(r.Header.Get(httpx.ContentEncoding), gzipEncoding) {
+			reader, err := gzip.NewReader(r.Body)
+			if err != nil {
+				w.WriteHeader(http.StatusBadRequest)
+				return
+			}
+
+			r.Body = reader
+		}
+
+		next.ServeHTTP(w, r)
+	})
+}

+ 223 - 0
vendor/github.com/zeromicro/go-zero/rest/handler/loghandler.go

@@ -0,0 +1,223 @@
+package handler
+
+import (
+	"bufio"
+	"bytes"
+	"errors"
+	"fmt"
+	"io"
+	"net"
+	"net/http"
+	"net/http/httputil"
+	"strconv"
+	"time"
+
+	"github.com/zeromicro/go-zero/core/color"
+	"github.com/zeromicro/go-zero/core/iox"
+	"github.com/zeromicro/go-zero/core/logx"
+	"github.com/zeromicro/go-zero/core/syncx"
+	"github.com/zeromicro/go-zero/core/timex"
+	"github.com/zeromicro/go-zero/core/utils"
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"github.com/zeromicro/go-zero/rest/internal"
+	"github.com/zeromicro/go-zero/rest/internal/response"
+)
+
+const (
+	limitBodyBytes       = 1024
+	defaultSlowThreshold = time.Millisecond * 500
+)
+
+var slowThreshold = syncx.ForAtomicDuration(defaultSlowThreshold)
+
+// LogHandler returns a middleware that logs http request and response.
+func LogHandler(next http.Handler) http.Handler {
+	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+		timer := utils.NewElapsedTimer()
+		logs := new(internal.LogCollector)
+		lrw := response.NewWithCodeResponseWriter(w)
+
+		var dup io.ReadCloser
+		r.Body, dup = iox.LimitDupReadCloser(r.Body, limitBodyBytes)
+		next.ServeHTTP(lrw, r.WithContext(internal.WithLogCollector(r.Context(), logs)))
+		r.Body = dup
+		logBrief(r, lrw.Code, timer, logs)
+	})
+}
+
+type detailLoggedResponseWriter struct {
+	writer *response.WithCodeResponseWriter
+	buf    *bytes.Buffer
+}
+
+func newDetailLoggedResponseWriter(writer *response.WithCodeResponseWriter,
+	buf *bytes.Buffer) *detailLoggedResponseWriter {
+	return &detailLoggedResponseWriter{
+		writer: writer,
+		buf:    buf,
+	}
+}
+
+func (w *detailLoggedResponseWriter) Flush() {
+	w.writer.Flush()
+}
+
+func (w *detailLoggedResponseWriter) Header() http.Header {
+	return w.writer.Header()
+}
+
+// Hijack implements the http.Hijacker interface.
+// This expands the Response to fulfill http.Hijacker if the underlying http.ResponseWriter supports it.
+func (w *detailLoggedResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
+	if hijacked, ok := w.writer.Writer.(http.Hijacker); ok {
+		return hijacked.Hijack()
+	}
+
+	return nil, nil, errors.New("server doesn't support hijacking")
+}
+
+func (w *detailLoggedResponseWriter) Write(bs []byte) (int, error) {
+	w.buf.Write(bs)
+	return w.writer.Write(bs)
+}
+
+func (w *detailLoggedResponseWriter) WriteHeader(code int) {
+	w.writer.WriteHeader(code)
+}
+
+// DetailedLogHandler returns a middleware that logs http request and response in details.
+func DetailedLogHandler(next http.Handler) http.Handler {
+	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+		timer := utils.NewElapsedTimer()
+		var buf bytes.Buffer
+		rw := response.NewWithCodeResponseWriter(w)
+		lrw := newDetailLoggedResponseWriter(rw, &buf)
+
+		var dup io.ReadCloser
+		r.Body, dup = iox.DupReadCloser(r.Body)
+		logs := new(internal.LogCollector)
+		next.ServeHTTP(lrw, r.WithContext(internal.WithLogCollector(r.Context(), logs)))
+		r.Body = dup
+		logDetails(r, lrw, timer, logs)
+	})
+}
+
+// SetSlowThreshold sets the slow threshold.
+func SetSlowThreshold(threshold time.Duration) {
+	slowThreshold.Set(threshold)
+}
+
+func dumpRequest(r *http.Request) string {
+	reqContent, err := httputil.DumpRequest(r, true)
+	if err != nil {
+		return err.Error()
+	}
+
+	return string(reqContent)
+}
+
+func isOkResponse(code int) bool {
+	// not server error
+	return code < http.StatusInternalServerError
+}
+
+func logBrief(r *http.Request, code int, timer *utils.ElapsedTimer, logs *internal.LogCollector) {
+	var buf bytes.Buffer
+	duration := timer.Duration()
+	logger := logx.WithContext(r.Context()).WithDuration(duration)
+	buf.WriteString(fmt.Sprintf("[HTTP] %s - %s %s - %s - %s",
+		wrapStatusCode(code), wrapMethod(r.Method), r.RequestURI, httpx.GetRemoteAddr(r), r.UserAgent()))
+	if duration > slowThreshold.Load() {
+		logger.Slowf("[HTTP] %s - %s %s - %s - %s - slowcall(%s)",
+			wrapStatusCode(code), wrapMethod(r.Method), r.RequestURI, httpx.GetRemoteAddr(r), r.UserAgent(),
+			timex.ReprOfDuration(duration))
+	}
+
+	ok := isOkResponse(code)
+	if !ok {
+		buf.WriteString(fmt.Sprintf("\n%s", dumpRequest(r)))
+	}
+
+	body := logs.Flush()
+	if len(body) > 0 {
+		buf.WriteString(fmt.Sprintf("\n%s", body))
+	}
+
+	if ok {
+		logger.Info(buf.String())
+	} else {
+		logger.Error(buf.String())
+	}
+}
+
+func logDetails(r *http.Request, response *detailLoggedResponseWriter, timer *utils.ElapsedTimer,
+	logs *internal.LogCollector) {
+	var buf bytes.Buffer
+	duration := timer.Duration()
+	code := response.writer.Code
+	logger := logx.WithContext(r.Context())
+	buf.WriteString(fmt.Sprintf("[HTTP] %s - %d - %s - %s\n=> %s\n",
+		r.Method, code, r.RemoteAddr, timex.ReprOfDuration(duration), dumpRequest(r)))
+	if duration > defaultSlowThreshold {
+		logger.Slowf("[HTTP] %s - %d - %s - slowcall(%s)\n=> %s\n", r.Method, code, r.RemoteAddr,
+			fmt.Sprintf("slowcall(%s)", timex.ReprOfDuration(duration)), dumpRequest(r))
+	}
+
+	body := logs.Flush()
+	if len(body) > 0 {
+		buf.WriteString(fmt.Sprintf("%s\n", body))
+	}
+
+	respBuf := response.buf.Bytes()
+	if len(respBuf) > 0 {
+		buf.WriteString(fmt.Sprintf("<= %s", respBuf))
+	}
+
+	if isOkResponse(code) {
+		logger.Info(buf.String())
+	} else {
+		logger.Error(buf.String())
+	}
+}
+
+func wrapMethod(method string) string {
+	var colour color.Color
+	switch method {
+	case http.MethodGet:
+		colour = color.BgBlue
+	case http.MethodPost:
+		colour = color.BgCyan
+	case http.MethodPut:
+		colour = color.BgYellow
+	case http.MethodDelete:
+		colour = color.BgRed
+	case http.MethodPatch:
+		colour = color.BgGreen
+	case http.MethodHead:
+		colour = color.BgMagenta
+	case http.MethodOptions:
+		colour = color.BgWhite
+	}
+
+	if colour == color.NoColor {
+		return method
+	}
+
+	return logx.WithColorPadding(method, colour)
+}
+
+func wrapStatusCode(code int) string {
+	var colour color.Color
+	switch {
+	case code >= http.StatusOK && code < http.StatusMultipleChoices:
+		colour = color.BgGreen
+	case code >= http.StatusMultipleChoices && code < http.StatusBadRequest:
+		colour = color.BgBlue
+	case code >= http.StatusBadRequest && code < http.StatusInternalServerError:
+		colour = color.BgMagenta
+	default:
+		colour = color.BgYellow
+	}
+
+	return logx.WithColorPadding(strconv.Itoa(code), colour)
+}

+ 28 - 0
vendor/github.com/zeromicro/go-zero/rest/handler/maxbyteshandler.go

@@ -0,0 +1,28 @@
+package handler
+
+import (
+	"net/http"
+
+	"github.com/zeromicro/go-zero/rest/internal"
+)
+
+// MaxBytesHandler returns a middleware that limit reading of http request body.
+func MaxBytesHandler(n int64) func(http.Handler) http.Handler {
+	if n <= 0 {
+		return func(next http.Handler) http.Handler {
+			return next
+		}
+	}
+
+	return func(next http.Handler) http.Handler {
+		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+			if r.ContentLength > n {
+				internal.Errorf(r, "request entity too large, limit is %d, but got %d, rejected with code %d",
+					n, r.ContentLength, http.StatusRequestEntityTooLarge)
+				w.WriteHeader(http.StatusRequestEntityTooLarge)
+			} else {
+				next.ServeHTTP(w, r)
+			}
+		})
+	}
+}

+ 38 - 0
vendor/github.com/zeromicro/go-zero/rest/handler/maxconnshandler.go

@@ -0,0 +1,38 @@
+package handler
+
+import (
+	"net/http"
+
+	"github.com/zeromicro/go-zero/core/logx"
+	"github.com/zeromicro/go-zero/core/syncx"
+	"github.com/zeromicro/go-zero/rest/internal"
+)
+
+// MaxConnsHandler returns a middleware that limit the concurrent connections.
+func MaxConnsHandler(n int) func(http.Handler) http.Handler {
+	if n <= 0 {
+		return func(next http.Handler) http.Handler {
+			return next
+		}
+	}
+
+	return func(next http.Handler) http.Handler {
+		latch := syncx.NewLimit(n)
+
+		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+			if latch.TryBorrow() {
+				defer func() {
+					if err := latch.Return(); err != nil {
+						logx.Error(err)
+					}
+				}()
+
+				next.ServeHTTP(w, r)
+			} else {
+				internal.Errorf(r, "concurrent connections over %d, rejected with code %d",
+					n, http.StatusServiceUnavailable)
+				w.WriteHeader(http.StatusServiceUnavailable)
+			}
+		})
+	}
+}

+ 24 - 0
vendor/github.com/zeromicro/go-zero/rest/handler/metrichandler.go

@@ -0,0 +1,24 @@
+package handler
+
+import (
+	"net/http"
+
+	"github.com/zeromicro/go-zero/core/stat"
+	"github.com/zeromicro/go-zero/core/timex"
+)
+
+// MetricHandler returns a middleware that stat the metrics.
+func MetricHandler(metrics *stat.Metrics) func(http.Handler) http.Handler {
+	return func(next http.Handler) http.Handler {
+		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+			startTime := timex.Now()
+			defer func() {
+				metrics.Add(stat.Task{
+					Duration: timex.Since(startTime),
+				})
+			}()
+
+			next.ServeHTTP(w, r)
+		})
+	}
+}

+ 47 - 0
vendor/github.com/zeromicro/go-zero/rest/handler/prometheushandler.go

@@ -0,0 +1,47 @@
+package handler
+
+import (
+	"net/http"
+	"strconv"
+
+	"github.com/zeromicro/go-zero/core/metric"
+	"github.com/zeromicro/go-zero/core/timex"
+	"github.com/zeromicro/go-zero/rest/internal/response"
+)
+
+const serverNamespace = "http_server"
+
+var (
+	metricServerReqDur = metric.NewHistogramVec(&metric.HistogramVecOpts{
+		Namespace: serverNamespace,
+		Subsystem: "requests",
+		Name:      "duration_ms",
+		Help:      "http server requests duration(ms).",
+		Labels:    []string{"path", "method"},
+		Buckets:   []float64{5, 10, 25, 50, 100, 250, 500, 1000},
+	})
+
+	metricServerReqCodeTotal = metric.NewCounterVec(&metric.CounterVecOpts{
+		Namespace: serverNamespace,
+		Subsystem: "requests",
+		Name:      "code_total",
+		Help:      "http server requests error count.",
+		Labels:    []string{"path", "code", "method"},
+	})
+)
+
+// PrometheusHandler returns a middleware that reports stats to prometheus.
+func PrometheusHandler(path, method string) func(http.Handler) http.Handler {
+	return func(next http.Handler) http.Handler {
+		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+			startTime := timex.Now()
+			cw := response.NewWithCodeResponseWriter(w)
+			defer func() {
+				metricServerReqDur.Observe(timex.Since(startTime).Milliseconds(), path, method)
+				metricServerReqCodeTotal.Inc(path, strconv.Itoa(cw.Code), method)
+			}()
+
+			next.ServeHTTP(cw, r)
+		})
+	}
+}

+ 23 - 0
vendor/github.com/zeromicro/go-zero/rest/handler/recoverhandler.go

@@ -0,0 +1,23 @@
+package handler
+
+import (
+	"fmt"
+	"net/http"
+	"runtime/debug"
+
+	"github.com/zeromicro/go-zero/rest/internal"
+)
+
+// RecoverHandler returns a middleware that recovers if panic happens.
+func RecoverHandler(next http.Handler) http.Handler {
+	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+		defer func() {
+			if result := recover(); result != nil {
+				internal.Error(r, fmt.Sprintf("%v\n%s", result, debug.Stack()))
+				w.WriteHeader(http.StatusInternalServerError)
+			}
+		}()
+
+		next.ServeHTTP(w, r)
+	})
+}

+ 64 - 0
vendor/github.com/zeromicro/go-zero/rest/handler/sheddinghandler.go

@@ -0,0 +1,64 @@
+package handler
+
+import (
+	"net/http"
+	"sync"
+
+	"github.com/zeromicro/go-zero/core/load"
+	"github.com/zeromicro/go-zero/core/logx"
+	"github.com/zeromicro/go-zero/core/stat"
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"github.com/zeromicro/go-zero/rest/internal/response"
+)
+
+const serviceType = "api"
+
+var (
+	sheddingStat *load.SheddingStat
+	lock         sync.Mutex
+)
+
+// SheddingHandler returns a middleware that does load shedding.
+func SheddingHandler(shedder load.Shedder, metrics *stat.Metrics) func(http.Handler) http.Handler {
+	if shedder == nil {
+		return func(next http.Handler) http.Handler {
+			return next
+		}
+	}
+
+	ensureSheddingStat()
+
+	return func(next http.Handler) http.Handler {
+		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+			sheddingStat.IncrementTotal()
+			promise, err := shedder.Allow()
+			if err != nil {
+				metrics.AddDrop()
+				sheddingStat.IncrementDrop()
+				logx.Errorf("[http] dropped, %s - %s - %s",
+					r.RequestURI, httpx.GetRemoteAddr(r), r.UserAgent())
+				w.WriteHeader(http.StatusServiceUnavailable)
+				return
+			}
+
+			cw := response.NewWithCodeResponseWriter(w)
+			defer func() {
+				if cw.Code == http.StatusServiceUnavailable {
+					promise.Fail()
+				} else {
+					sheddingStat.IncrementPass()
+					promise.Pass()
+				}
+			}()
+			next.ServeHTTP(cw, r)
+		})
+	}
+}
+
+func ensureSheddingStat() {
+	lock.Lock()
+	if sheddingStat == nil {
+		sheddingStat = load.NewSheddingStat(serviceType)
+	}
+	lock.Unlock()
+}

+ 242 - 0
vendor/github.com/zeromicro/go-zero/rest/handler/timeouthandler.go

@@ -0,0 +1,242 @@
+package handler
+
+import (
+	"bufio"
+	"bytes"
+	"context"
+	"errors"
+	"fmt"
+	"io"
+	"net"
+	"net/http"
+	"path"
+	"runtime"
+	"strings"
+	"sync"
+	"time"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"github.com/zeromicro/go-zero/rest/internal"
+)
+
+const (
+	statusClientClosedRequest = 499
+	reason                    = "Request Timeout"
+	headerUpgrade             = "Upgrade"
+	valueWebsocket            = "websocket"
+)
+
+// TimeoutHandler returns the handler with given timeout.
+// If client closed request, code 499 will be logged.
+// Notice: even if canceled in server side, 499 will be logged as well.
+func TimeoutHandler(duration time.Duration) func(http.Handler) http.Handler {
+	return func(next http.Handler) http.Handler {
+		if duration <= 0 {
+			return next
+		}
+
+		return &timeoutHandler{
+			handler: next,
+			dt:      duration,
+		}
+	}
+}
+
+// timeoutHandler is the handler that controls the request timeout.
+// Why we implement it on our own, because the stdlib implementation
+// treats the ClientClosedRequest as http.StatusServiceUnavailable.
+// And we write the codes in logs as code 499, which is defined by nginx.
+type timeoutHandler struct {
+	handler http.Handler
+	dt      time.Duration
+}
+
+func (h *timeoutHandler) errorBody() string {
+	return reason
+}
+
+func (h *timeoutHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
+	if r.Header.Get(headerUpgrade) == valueWebsocket {
+		h.handler.ServeHTTP(w, r)
+		return
+	}
+
+	ctx, cancelCtx := context.WithTimeout(r.Context(), h.dt)
+	defer cancelCtx()
+
+	r = r.WithContext(ctx)
+	done := make(chan struct{})
+	tw := &timeoutWriter{
+		w:    w,
+		h:    make(http.Header),
+		req:  r,
+		code: http.StatusOK,
+	}
+	panicChan := make(chan any, 1)
+	go func() {
+		defer func() {
+			if p := recover(); p != nil {
+				panicChan <- p
+			}
+		}()
+		h.handler.ServeHTTP(tw, r)
+		close(done)
+	}()
+	select {
+	case p := <-panicChan:
+		panic(p)
+	case <-done:
+		tw.mu.Lock()
+		defer tw.mu.Unlock()
+		dst := w.Header()
+		for k, vv := range tw.h {
+			dst[k] = vv
+		}
+
+		// We don't need to write header 200, because it's written by default.
+		// If we write it again, it will cause a warning: `http: superfluous response.WriteHeader call`.
+		if tw.code != http.StatusOK {
+			w.WriteHeader(tw.code)
+		}
+		w.Write(tw.wbuf.Bytes())
+	case <-ctx.Done():
+		tw.mu.Lock()
+		defer tw.mu.Unlock()
+		// there isn't any user-defined middleware before TimoutHandler,
+		// so we can guarantee that cancelation in biz related code won't come here.
+		httpx.ErrorCtx(r.Context(), w, ctx.Err(), func(w http.ResponseWriter, err error) {
+			if errors.Is(err, context.Canceled) {
+				w.WriteHeader(statusClientClosedRequest)
+			} else {
+				w.WriteHeader(http.StatusServiceUnavailable)
+			}
+			io.WriteString(w, h.errorBody())
+		})
+		tw.timedOut = true
+	}
+}
+
+type timeoutWriter struct {
+	w    http.ResponseWriter
+	h    http.Header
+	wbuf bytes.Buffer
+	req  *http.Request
+
+	mu          sync.Mutex
+	timedOut    bool
+	wroteHeader bool
+	code        int
+}
+
+var _ http.Pusher = (*timeoutWriter)(nil)
+
+// Flush implements the Flusher interface.
+func (tw *timeoutWriter) Flush() {
+	flusher, ok := tw.w.(http.Flusher)
+	if !ok {
+		return
+	}
+
+	header := tw.w.Header()
+	for k, v := range tw.h {
+		header[k] = v
+	}
+
+	tw.w.Write(tw.wbuf.Bytes())
+	tw.wbuf.Reset()
+	flusher.Flush()
+}
+
+// Header returns the underline temporary http.Header.
+func (tw *timeoutWriter) Header() http.Header {
+	return tw.h
+}
+
+// Hijack implements the Hijacker interface.
+func (tw *timeoutWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
+	if hijacked, ok := tw.w.(http.Hijacker); ok {
+		return hijacked.Hijack()
+	}
+
+	return nil, nil, errors.New("server doesn't support hijacking")
+}
+
+// Push implements the Pusher interface.
+func (tw *timeoutWriter) Push(target string, opts *http.PushOptions) error {
+	if pusher, ok := tw.w.(http.Pusher); ok {
+		return pusher.Push(target, opts)
+	}
+
+	return http.ErrNotSupported
+}
+
+// Write writes the data to the connection as part of an HTTP reply.
+// Timeout and multiple header written are guarded.
+func (tw *timeoutWriter) Write(p []byte) (int, error) {
+	tw.mu.Lock()
+	defer tw.mu.Unlock()
+
+	if tw.timedOut {
+		return 0, http.ErrHandlerTimeout
+	}
+
+	if !tw.wroteHeader {
+		tw.writeHeaderLocked(http.StatusOK)
+	}
+
+	return tw.wbuf.Write(p)
+}
+
+func (tw *timeoutWriter) writeHeaderLocked(code int) {
+	checkWriteHeaderCode(code)
+
+	switch {
+	case tw.timedOut:
+		return
+	case tw.wroteHeader:
+		if tw.req != nil {
+			caller := relevantCaller()
+			internal.Errorf(tw.req, "http: superfluous response.WriteHeader call from %s (%s:%d)",
+				caller.Function, path.Base(caller.File), caller.Line)
+		}
+	default:
+		tw.wroteHeader = true
+		tw.code = code
+	}
+}
+
+func (tw *timeoutWriter) WriteHeader(code int) {
+	tw.mu.Lock()
+	defer tw.mu.Unlock()
+
+	if !tw.wroteHeader {
+		tw.writeHeaderLocked(code)
+	}
+}
+
+func checkWriteHeaderCode(code int) {
+	if code < 100 || code > 599 {
+		panic(fmt.Sprintf("invalid WriteHeader code %v", code))
+	}
+}
+
+// relevantCaller searches the call stack for the first function outside of net/http.
+// The purpose of this function is to provide more helpful error messages.
+func relevantCaller() runtime.Frame {
+	pc := make([]uintptr, 16)
+	n := runtime.Callers(1, pc)
+	frames := runtime.CallersFrames(pc[:n])
+	var frame runtime.Frame
+	for {
+		frame, more := frames.Next()
+		if !strings.HasPrefix(frame.Function, "net/http.") {
+			return frame
+		}
+
+		if !more {
+			break
+		}
+	}
+
+	return frame
+}

+ 78 - 0
vendor/github.com/zeromicro/go-zero/rest/handler/tracehandler.go

@@ -0,0 +1,78 @@
+package handler
+
+import (
+	"net/http"
+
+	"github.com/zeromicro/go-zero/core/collection"
+	"github.com/zeromicro/go-zero/core/trace"
+	"github.com/zeromicro/go-zero/rest/internal/response"
+	"go.opentelemetry.io/otel"
+	"go.opentelemetry.io/otel/propagation"
+	semconv "go.opentelemetry.io/otel/semconv/v1.4.0"
+	oteltrace "go.opentelemetry.io/otel/trace"
+)
+
+type (
+	// TraceOption defines the method to customize an traceOptions.
+	TraceOption func(options *traceOptions)
+
+	// traceOptions is TraceHandler options.
+	traceOptions struct {
+		traceIgnorePaths []string
+	}
+)
+
+// TraceHandler return a middleware that process the opentelemetry.
+func TraceHandler(serviceName, path string, opts ...TraceOption) func(http.Handler) http.Handler {
+	var options traceOptions
+	for _, opt := range opts {
+		opt(&options)
+	}
+
+	ignorePaths := collection.NewSet()
+	ignorePaths.AddStr(options.traceIgnorePaths...)
+
+	return func(next http.Handler) http.Handler {
+		tracer := otel.Tracer(trace.TraceName)
+		propagator := otel.GetTextMapPropagator()
+
+		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+			spanName := path
+			if len(spanName) == 0 {
+				spanName = r.URL.Path
+			}
+
+			if ignorePaths.Contains(spanName) {
+				next.ServeHTTP(w, r)
+				return
+			}
+
+			ctx := propagator.Extract(r.Context(), propagation.HeaderCarrier(r.Header))
+			spanCtx, span := tracer.Start(
+				ctx,
+				spanName,
+				oteltrace.WithSpanKind(oteltrace.SpanKindServer),
+				oteltrace.WithAttributes(semconv.HTTPServerAttributesFromHTTPRequest(
+					serviceName, spanName, r)...),
+			)
+			defer span.End()
+
+			// convenient for tracking error messages
+			propagator.Inject(spanCtx, propagation.HeaderCarrier(w.Header()))
+
+			trw := response.NewWithCodeResponseWriter(w)
+			next.ServeHTTP(trw, r.WithContext(spanCtx))
+
+			span.SetAttributes(semconv.HTTPAttributesFromHTTPStatusCode(trw.Code)...)
+			span.SetStatus(semconv.SpanStatusFromHTTPStatusCodeAndSpanKind(
+				trw.Code, oteltrace.SpanKindServer))
+		})
+	}
+}
+
+// WithTraceIgnorePaths specifies the traceIgnorePaths option for TraceHandler.
+func WithTraceIgnorePaths(traceIgnorePaths []string) TraceOption {
+	return func(options *traceOptions) {
+		options.traceIgnorePaths = append(options.traceIgnorePaths, traceIgnorePaths...)
+	}
+}

+ 132 - 0
vendor/github.com/zeromicro/go-zero/rest/httpx/requests.go

@@ -0,0 +1,132 @@
+package httpx
+
+import (
+	"io"
+	"net/http"
+	"strings"
+	"sync/atomic"
+
+	"github.com/zeromicro/go-zero/core/mapping"
+	"github.com/zeromicro/go-zero/core/validation"
+	"github.com/zeromicro/go-zero/rest/internal/encoding"
+	"github.com/zeromicro/go-zero/rest/internal/header"
+	"github.com/zeromicro/go-zero/rest/pathvar"
+)
+
+const (
+	formKey           = "form"
+	pathKey           = "path"
+	maxMemory         = 32 << 20 // 32MB
+	maxBodyLen        = 8 << 20  // 8MB
+	separator         = ";"
+	tokensInAttribute = 2
+)
+
+var (
+	formUnmarshaler = mapping.NewUnmarshaler(formKey, mapping.WithStringValues(), mapping.WithOpaqueKeys())
+	pathUnmarshaler = mapping.NewUnmarshaler(pathKey, mapping.WithStringValues(), mapping.WithOpaqueKeys())
+	validator       atomic.Value
+)
+
+// Validator defines the interface for validating the request.
+type Validator interface {
+	// Validate validates the request and parsed data.
+	Validate(r *http.Request, data any) error
+}
+
+// Parse parses the request.
+func Parse(r *http.Request, v any) error {
+	if err := ParsePath(r, v); err != nil {
+		return err
+	}
+
+	if err := ParseForm(r, v); err != nil {
+		return err
+	}
+
+	if err := ParseHeaders(r, v); err != nil {
+		return err
+	}
+
+	if err := ParseJsonBody(r, v); err != nil {
+		return err
+	}
+
+	if valid, ok := v.(validation.Validator); ok {
+		return valid.Validate()
+	} else if val := validator.Load(); val != nil {
+		return val.(Validator).Validate(r, v)
+	}
+
+	return nil
+}
+
+// ParseHeaders parses the headers request.
+func ParseHeaders(r *http.Request, v any) error {
+	return encoding.ParseHeaders(r.Header, v)
+}
+
+// ParseForm parses the form request.
+func ParseForm(r *http.Request, v any) error {
+	params, err := GetFormValues(r)
+	if err != nil {
+		return err
+	}
+
+	return formUnmarshaler.Unmarshal(params, v)
+}
+
+// ParseHeader parses the request header and returns a map.
+func ParseHeader(headerValue string) map[string]string {
+	ret := make(map[string]string)
+	fields := strings.Split(headerValue, separator)
+
+	for _, field := range fields {
+		field = strings.TrimSpace(field)
+		if len(field) == 0 {
+			continue
+		}
+
+		kv := strings.SplitN(field, "=", tokensInAttribute)
+		if len(kv) != tokensInAttribute {
+			continue
+		}
+
+		ret[kv[0]] = kv[1]
+	}
+
+	return ret
+}
+
+// ParseJsonBody parses the post request which contains json in body.
+func ParseJsonBody(r *http.Request, v any) error {
+	if withJsonBody(r) {
+		reader := io.LimitReader(r.Body, maxBodyLen)
+		return mapping.UnmarshalJsonReader(reader, v)
+	}
+
+	return mapping.UnmarshalJsonMap(nil, v)
+}
+
+// ParsePath parses the symbols reside in url path.
+// Like http://localhost/bag/:name
+func ParsePath(r *http.Request, v any) error {
+	vars := pathvar.Vars(r)
+	m := make(map[string]any, len(vars))
+	for k, v := range vars {
+		m[k] = v
+	}
+
+	return pathUnmarshaler.Unmarshal(m, v)
+}
+
+// SetValidator sets the validator.
+// The validator is used to validate the request, only called in Parse,
+// not in ParseHeaders, ParseForm, ParseHeader, ParseJsonBody, ParsePath.
+func SetValidator(val Validator) {
+	validator.Store(val)
+}
+
+func withJsonBody(r *http.Request) bool {
+	return r.ContentLength > 0 && strings.Contains(r.Header.Get(header.ContentType), header.ApplicationJson)
+}

Неке датотеке нису приказане због велике количине промена