build(deps): bump github.com/labstack/echo/v4 from 4.10.0 to 4.10.2
Bumps [github.com/labstack/echo/v4](https://github.com/labstack/echo) from 4.10.0 to 4.10.2. - [Release notes](https://github.com/labstack/echo/releases) - [Changelog](https://github.com/labstack/echo/blob/master/CHANGELOG.md) - [Commits](https://github.com/labstack/echo/compare/v4.10.0...v4.10.2) --- updated-dependencies: - dependency-name: github.com/labstack/echo/v4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
parent
f335096f66
commit
96067cf511
18 changed files with 258 additions and 106 deletions
6
go.mod
6
go.mod
|
|
@ -30,7 +30,7 @@ require (
|
||||||
github.com/jackc/pgx/v4 v4.17.2
|
github.com/jackc/pgx/v4 v4.17.2
|
||||||
github.com/julienschmidt/httprouter v1.3.0
|
github.com/julienschmidt/httprouter v1.3.0
|
||||||
github.com/kolo/xmlrpc v0.0.0-20201022064351-38db28db192b
|
github.com/kolo/xmlrpc v0.0.0-20201022064351-38db28db192b
|
||||||
github.com/labstack/echo/v4 v4.10.0
|
github.com/labstack/echo/v4 v4.10.2
|
||||||
github.com/labstack/gommon v0.4.0
|
github.com/labstack/gommon v0.4.0
|
||||||
github.com/opencontainers/go-digest v1.0.0
|
github.com/opencontainers/go-digest v1.0.0
|
||||||
github.com/opencontainers/image-spec v1.0.3-0.20220114050600-8b9d41f48198
|
github.com/opencontainers/image-spec v1.0.3-0.20220114050600-8b9d41f48198
|
||||||
|
|
@ -118,7 +118,7 @@ require (
|
||||||
github.com/letsencrypt/boulder v0.0.0-20220331220046-b23ab962616e // indirect
|
github.com/letsencrypt/boulder v0.0.0-20220331220046-b23ab962616e // indirect
|
||||||
github.com/mailru/easyjson v0.7.6 // indirect
|
github.com/mailru/easyjson v0.7.6 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.16 // indirect
|
github.com/mattn/go-isatty v0.0.17 // indirect
|
||||||
github.com/mattn/go-runewidth v0.0.13 // indirect
|
github.com/mattn/go-runewidth v0.0.13 // indirect
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
|
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
|
||||||
github.com/microcosm-cc/bluemonday v1.0.18 // indirect
|
github.com/microcosm-cc/bluemonday v1.0.18 // indirect
|
||||||
|
|
@ -156,7 +156,7 @@ require (
|
||||||
golang.org/x/net v0.10.0 // indirect
|
golang.org/x/net v0.10.0 // indirect
|
||||||
golang.org/x/term v0.8.0 // indirect
|
golang.org/x/term v0.8.0 // indirect
|
||||||
golang.org/x/text v0.9.0 // indirect
|
golang.org/x/text v0.9.0 // indirect
|
||||||
golang.org/x/time v0.2.0 // indirect
|
golang.org/x/time v0.3.0 // indirect
|
||||||
golang.org/x/tools v0.6.0 // indirect
|
golang.org/x/tools v0.6.0 // indirect
|
||||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
|
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
|
||||||
google.golang.org/appengine v1.6.7 // indirect
|
google.golang.org/appengine v1.6.7 // indirect
|
||||||
|
|
|
||||||
11
go.sum
11
go.sum
|
|
@ -884,8 +884,8 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
|
||||||
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||||
github.com/kyoh86/exportloopref v0.1.8/go.mod h1:1tUcJeiioIs7VWe5gcOObrux3lb66+sBqGZrRkMwPgg=
|
github.com/kyoh86/exportloopref v0.1.8/go.mod h1:1tUcJeiioIs7VWe5gcOObrux3lb66+sBqGZrRkMwPgg=
|
||||||
github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg=
|
github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg=
|
||||||
github.com/labstack/echo/v4 v4.10.0 h1:5CiyngihEO4HXsz3vVsJn7f8xAlWwRr3aY6Ih280ZKA=
|
github.com/labstack/echo/v4 v4.10.2 h1:n1jAhnq/elIFTHr1EYpiYtyKgx4RW9ccVgkqByZaN2M=
|
||||||
github.com/labstack/echo/v4 v4.10.0/go.mod h1:S/T/5fy/GigaXnHTkh0ZGe4LpkkQysvRjFMSUTkDRNQ=
|
github.com/labstack/echo/v4 v4.10.2/go.mod h1:OEyqf2//K1DFdE57vw2DRgWY0M7s65IVQO2FzvI4J5k=
|
||||||
github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
|
github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
|
||||||
github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8=
|
github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8=
|
||||||
github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
|
github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
|
||||||
|
|
@ -940,8 +940,9 @@ github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcME
|
||||||
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
|
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
|
||||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||||
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
|
|
||||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
|
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
|
||||||
|
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||||
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||||
github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||||
|
|
@ -1744,8 +1745,8 @@ golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxb
|
||||||
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/time v0.2.0 h1:52I/1L54xyEQAYdtcSuxtiT84KGYTBGXwayxmIpNJhE=
|
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
|
||||||
golang.org/x/time v0.2.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
|
|
||||||
21
vendor/github.com/labstack/echo/v4/.travis.yml
generated
vendored
21
vendor/github.com/labstack/echo/v4/.travis.yml
generated
vendored
|
|
@ -1,21 +0,0 @@
|
||||||
arch:
|
|
||||||
- amd64
|
|
||||||
- ppc64le
|
|
||||||
|
|
||||||
language: go
|
|
||||||
go:
|
|
||||||
- 1.14.x
|
|
||||||
- 1.15.x
|
|
||||||
- tip
|
|
||||||
env:
|
|
||||||
- GO111MODULE=on
|
|
||||||
install:
|
|
||||||
- go get -v golang.org/x/lint/golint
|
|
||||||
script:
|
|
||||||
- golint -set_exit_status ./...
|
|
||||||
- go test -race -coverprofile=coverage.txt -covermode=atomic ./...
|
|
||||||
after_success:
|
|
||||||
- bash <(curl -s https://codecov.io/bash)
|
|
||||||
matrix:
|
|
||||||
allow_failures:
|
|
||||||
- go: tip
|
|
||||||
27
vendor/github.com/labstack/echo/v4/CHANGELOG.md
generated
vendored
27
vendor/github.com/labstack/echo/v4/CHANGELOG.md
generated
vendored
|
|
@ -1,5 +1,32 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v4.10.2 - 2023-02-22
|
||||||
|
|
||||||
|
**Security**
|
||||||
|
|
||||||
|
* `filepath.Clean` behaviour has changed in Go 1.20 - adapt to it [#2406](https://github.com/labstack/echo/pull/2406)
|
||||||
|
* Add `middleware.CORSConfig.UnsafeWildcardOriginWithAllowCredentials` to make UNSAFE usages of wildcard origin + allow cretentials less likely [#2405](https://github.com/labstack/echo/pull/2405)
|
||||||
|
|
||||||
|
**Enhancements**
|
||||||
|
|
||||||
|
* Add more HTTP error values [#2277](https://github.com/labstack/echo/pull/2277)
|
||||||
|
|
||||||
|
|
||||||
|
## v4.10.1 - 2023-02-19
|
||||||
|
|
||||||
|
**Security**
|
||||||
|
|
||||||
|
* Upgrade deps due to the latest golang.org/x/net vulnerability [#2402](https://github.com/labstack/echo/pull/2402)
|
||||||
|
|
||||||
|
|
||||||
|
**Enhancements**
|
||||||
|
|
||||||
|
* Add new JWT repository to the README [#2377](https://github.com/labstack/echo/pull/2377)
|
||||||
|
* Return an empty string for ctx.path if there is no registered path [#2385](https://github.com/labstack/echo/pull/2385)
|
||||||
|
* Add context timeout middleware [#2380](https://github.com/labstack/echo/pull/2380)
|
||||||
|
* Update link to jaegertracing [#2394](https://github.com/labstack/echo/pull/2394)
|
||||||
|
|
||||||
|
|
||||||
## v4.10.0 - 2022-12-27
|
## v4.10.0 - 2022-12-27
|
||||||
|
|
||||||
**Security**
|
**Security**
|
||||||
|
|
|
||||||
37
vendor/github.com/labstack/echo/v4/README.md
generated
vendored
37
vendor/github.com/labstack/echo/v4/README.md
generated
vendored
|
|
@ -11,12 +11,12 @@
|
||||||
|
|
||||||
## Supported Go versions
|
## Supported Go versions
|
||||||
|
|
||||||
Latest version of Echo supports last four Go major [releases](https://go.dev/doc/devel/release) and might work with older versions.
|
Latest version of Echo supports last four Go major [releases](https://go.dev/doc/devel/release) and might work with
|
||||||
|
older versions.
|
||||||
|
|
||||||
As of version 4.0.0, Echo is available as a [Go module](https://github.com/golang/go/wiki/Modules).
|
As of version 4.0.0, Echo is available as a [Go module](https://github.com/golang/go/wiki/Modules).
|
||||||
Therefore a Go version capable of understanding /vN suffixed imports is required:
|
Therefore a Go version capable of understanding /vN suffixed imports is required:
|
||||||
|
|
||||||
|
|
||||||
Any of these versions will allow you to import Echo as `github.com/labstack/echo/v4` which is the recommended
|
Any of these versions will allow you to import Echo as `github.com/labstack/echo/v4` which is the recommended
|
||||||
way of using Echo going forward.
|
way of using Echo going forward.
|
||||||
|
|
||||||
|
|
@ -90,18 +90,29 @@ func hello(c echo.Context) error {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
# Third-party middlewares
|
# Official middleware repositories
|
||||||
|
|
||||||
| Repository | Description |
|
Following list of middleware is maintained by Echo team.
|
||||||
|------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
||||||
| [github.com/labstack/echo-contrib](https://github.com/labstack/echo-contrib) | (by Echo team) [casbin](https://github.com/casbin/casbin), [gorilla/sessions](https://github.com/gorilla/sessions), [jaegertracing](github.com/uber/jaeger-client-go), [prometheus](https://github.com/prometheus/client_golang/), [pprof](https://pkg.go.dev/net/http/pprof), [zipkin](https://github.com/openzipkin/zipkin-go) middlewares |
|
| Repository | Description |
|
||||||
| [deepmap/oapi-codegen](https://github.com/deepmap/oapi-codegen) | Automatically generate RESTful API documentation with [OpenAPI](https://swagger.io/specification/) Client and Server Code Generator |
|
|------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| [github.com/swaggo/echo-swagger](https://github.com/swaggo/echo-swagger) | Automatically generate RESTful API documentation with [Swagger](https://swagger.io/) 2.0. |
|
| [github.com/labstack/echo-jwt](https://github.com/labstack/echo-jwt) | [JWT](https://github.com/golang-jwt/jwt) middleware |
|
||||||
| [github.com/ziflex/lecho](https://github.com/ziflex/lecho) | [Zerolog](https://github.com/rs/zerolog) logging library wrapper for Echo logger interface. |
|
| [github.com/labstack/echo-contrib](https://github.com/labstack/echo-contrib) | [casbin](https://github.com/casbin/casbin), [gorilla/sessions](https://github.com/gorilla/sessions), [jaegertracing](https://github.com/uber/jaeger-client-go), [prometheus](https://github.com/prometheus/client_golang/), [pprof](https://pkg.go.dev/net/http/pprof), [zipkin](https://github.com/openzipkin/zipkin-go) middlewares |
|
||||||
| [github.com/brpaz/echozap](https://github.com/brpaz/echozap) | Uber´s [Zap](https://github.com/uber-go/zap) logging library wrapper for Echo logger interface. |
|
|
||||||
| [github.com/darkweak/souin/plugins/echo](https://github.com/darkweak/souin/tree/master/plugins/echo) | HTTP cache system based on [Souin](https://github.com/darkweak/souin) to automatically get your endpoints cached. It supports some distributed and non-distributed storage systems depending your needs. |
|
# Third-party middleware repositories
|
||||||
| [github.com/mikestefanello/pagoda](https://github.com/mikestefanello/pagoda) | Rapid, easy full-stack web development starter kit built with Echo. |
|
|
||||||
| [github.com/go-woo/protoc-gen-echo](https://github.com/go-woo/protoc-gen-echo) | ProtoBuf generate Echo server side code |
|
Be careful when adding 3rd party middleware. Echo teams does not have time or manpower to guarantee safety and quality
|
||||||
|
of middlewares in this list.
|
||||||
|
|
||||||
|
| Repository | Description |
|
||||||
|
|------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| [deepmap/oapi-codegen](https://github.com/deepmap/oapi-codegen) | Automatically generate RESTful API documentation with [OpenAPI](https://swagger.io/specification/) Client and Server Code Generator |
|
||||||
|
| [github.com/swaggo/echo-swagger](https://github.com/swaggo/echo-swagger) | Automatically generate RESTful API documentation with [Swagger](https://swagger.io/) 2.0. |
|
||||||
|
| [github.com/ziflex/lecho](https://github.com/ziflex/lecho) | [Zerolog](https://github.com/rs/zerolog) logging library wrapper for Echo logger interface. |
|
||||||
|
| [github.com/brpaz/echozap](https://github.com/brpaz/echozap) | Uber´s [Zap](https://github.com/uber-go/zap) logging library wrapper for Echo logger interface. |
|
||||||
|
| [github.com/darkweak/souin/plugins/echo](https://github.com/darkweak/souin/tree/master/plugins/echo) | HTTP cache system based on [Souin](https://github.com/darkweak/souin) to automatically get your endpoints cached. It supports some distributed and non-distributed storage systems depending your needs. |
|
||||||
|
| [github.com/mikestefanello/pagoda](https://github.com/mikestefanello/pagoda) | Rapid, easy full-stack web development starter kit built with Echo. |
|
||||||
|
| [github.com/go-woo/protoc-gen-echo](https://github.com/go-woo/protoc-gen-echo) | ProtoBuf generate Echo server side code |
|
||||||
|
|
||||||
Please send a PR to add your own library here.
|
Please send a PR to add your own library here.
|
||||||
|
|
||||||
|
|
|
||||||
67
vendor/github.com/labstack/echo/v4/echo.go
generated
vendored
67
vendor/github.com/labstack/echo/v4/echo.go
generated
vendored
|
|
@ -258,7 +258,7 @@ const (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Version of Echo
|
// Version of Echo
|
||||||
Version = "4.10.0"
|
Version = "4.10.2"
|
||||||
website = "https://echo.labstack.com"
|
website = "https://echo.labstack.com"
|
||||||
// http://patorjk.com/software/taag/#p=display&f=Small%20Slant&t=Echo
|
// http://patorjk.com/software/taag/#p=display&f=Small%20Slant&t=Echo
|
||||||
banner = `
|
banner = `
|
||||||
|
|
@ -291,24 +291,53 @@ var (
|
||||||
|
|
||||||
// Errors
|
// Errors
|
||||||
var (
|
var (
|
||||||
ErrUnsupportedMediaType = NewHTTPError(http.StatusUnsupportedMediaType)
|
ErrBadRequest = NewHTTPError(http.StatusBadRequest) // HTTP 400 Bad Request
|
||||||
ErrNotFound = NewHTTPError(http.StatusNotFound)
|
ErrUnauthorized = NewHTTPError(http.StatusUnauthorized) // HTTP 401 Unauthorized
|
||||||
ErrUnauthorized = NewHTTPError(http.StatusUnauthorized)
|
ErrPaymentRequired = NewHTTPError(http.StatusPaymentRequired) // HTTP 402 Payment Required
|
||||||
ErrForbidden = NewHTTPError(http.StatusForbidden)
|
ErrForbidden = NewHTTPError(http.StatusForbidden) // HTTP 403 Forbidden
|
||||||
ErrMethodNotAllowed = NewHTTPError(http.StatusMethodNotAllowed)
|
ErrNotFound = NewHTTPError(http.StatusNotFound) // HTTP 404 Not Found
|
||||||
ErrStatusRequestEntityTooLarge = NewHTTPError(http.StatusRequestEntityTooLarge)
|
ErrMethodNotAllowed = NewHTTPError(http.StatusMethodNotAllowed) // HTTP 405 Method Not Allowed
|
||||||
ErrTooManyRequests = NewHTTPError(http.StatusTooManyRequests)
|
ErrNotAcceptable = NewHTTPError(http.StatusNotAcceptable) // HTTP 406 Not Acceptable
|
||||||
ErrBadRequest = NewHTTPError(http.StatusBadRequest)
|
ErrProxyAuthRequired = NewHTTPError(http.StatusProxyAuthRequired) // HTTP 407 Proxy AuthRequired
|
||||||
ErrBadGateway = NewHTTPError(http.StatusBadGateway)
|
ErrRequestTimeout = NewHTTPError(http.StatusRequestTimeout) // HTTP 408 Request Timeout
|
||||||
ErrInternalServerError = NewHTTPError(http.StatusInternalServerError)
|
ErrConflict = NewHTTPError(http.StatusConflict) // HTTP 409 Conflict
|
||||||
ErrRequestTimeout = NewHTTPError(http.StatusRequestTimeout)
|
ErrGone = NewHTTPError(http.StatusGone) // HTTP 410 Gone
|
||||||
ErrServiceUnavailable = NewHTTPError(http.StatusServiceUnavailable)
|
ErrLengthRequired = NewHTTPError(http.StatusLengthRequired) // HTTP 411 Length Required
|
||||||
ErrValidatorNotRegistered = errors.New("validator not registered")
|
ErrPreconditionFailed = NewHTTPError(http.StatusPreconditionFailed) // HTTP 412 Precondition Failed
|
||||||
ErrRendererNotRegistered = errors.New("renderer not registered")
|
ErrStatusRequestEntityTooLarge = NewHTTPError(http.StatusRequestEntityTooLarge) // HTTP 413 Payload Too Large
|
||||||
ErrInvalidRedirectCode = errors.New("invalid redirect status code")
|
ErrRequestURITooLong = NewHTTPError(http.StatusRequestURITooLong) // HTTP 414 URI Too Long
|
||||||
ErrCookieNotFound = errors.New("cookie not found")
|
ErrUnsupportedMediaType = NewHTTPError(http.StatusUnsupportedMediaType) // HTTP 415 Unsupported Media Type
|
||||||
ErrInvalidCertOrKeyType = errors.New("invalid cert or key type, must be string or []byte")
|
ErrRequestedRangeNotSatisfiable = NewHTTPError(http.StatusRequestedRangeNotSatisfiable) // HTTP 416 Range Not Satisfiable
|
||||||
ErrInvalidListenerNetwork = errors.New("invalid listener network")
|
ErrExpectationFailed = NewHTTPError(http.StatusExpectationFailed) // HTTP 417 Expectation Failed
|
||||||
|
ErrTeapot = NewHTTPError(http.StatusTeapot) // HTTP 418 I'm a teapot
|
||||||
|
ErrMisdirectedRequest = NewHTTPError(http.StatusMisdirectedRequest) // HTTP 421 Misdirected Request
|
||||||
|
ErrUnprocessableEntity = NewHTTPError(http.StatusUnprocessableEntity) // HTTP 422 Unprocessable Entity
|
||||||
|
ErrLocked = NewHTTPError(http.StatusLocked) // HTTP 423 Locked
|
||||||
|
ErrFailedDependency = NewHTTPError(http.StatusFailedDependency) // HTTP 424 Failed Dependency
|
||||||
|
ErrTooEarly = NewHTTPError(http.StatusTooEarly) // HTTP 425 Too Early
|
||||||
|
ErrUpgradeRequired = NewHTTPError(http.StatusUpgradeRequired) // HTTP 426 Upgrade Required
|
||||||
|
ErrPreconditionRequired = NewHTTPError(http.StatusPreconditionRequired) // HTTP 428 Precondition Required
|
||||||
|
ErrTooManyRequests = NewHTTPError(http.StatusTooManyRequests) // HTTP 429 Too Many Requests
|
||||||
|
ErrRequestHeaderFieldsTooLarge = NewHTTPError(http.StatusRequestHeaderFieldsTooLarge) // HTTP 431 Request Header Fields Too Large
|
||||||
|
ErrUnavailableForLegalReasons = NewHTTPError(http.StatusUnavailableForLegalReasons) // HTTP 451 Unavailable For Legal Reasons
|
||||||
|
ErrInternalServerError = NewHTTPError(http.StatusInternalServerError) // HTTP 500 Internal Server Error
|
||||||
|
ErrNotImplemented = NewHTTPError(http.StatusNotImplemented) // HTTP 501 Not Implemented
|
||||||
|
ErrBadGateway = NewHTTPError(http.StatusBadGateway) // HTTP 502 Bad Gateway
|
||||||
|
ErrServiceUnavailable = NewHTTPError(http.StatusServiceUnavailable) // HTTP 503 Service Unavailable
|
||||||
|
ErrGatewayTimeout = NewHTTPError(http.StatusGatewayTimeout) // HTTP 504 Gateway Timeout
|
||||||
|
ErrHTTPVersionNotSupported = NewHTTPError(http.StatusHTTPVersionNotSupported) // HTTP 505 HTTP Version Not Supported
|
||||||
|
ErrVariantAlsoNegotiates = NewHTTPError(http.StatusVariantAlsoNegotiates) // HTTP 506 Variant Also Negotiates
|
||||||
|
ErrInsufficientStorage = NewHTTPError(http.StatusInsufficientStorage) // HTTP 507 Insufficient Storage
|
||||||
|
ErrLoopDetected = NewHTTPError(http.StatusLoopDetected) // HTTP 508 Loop Detected
|
||||||
|
ErrNotExtended = NewHTTPError(http.StatusNotExtended) // HTTP 510 Not Extended
|
||||||
|
ErrNetworkAuthenticationRequired = NewHTTPError(http.StatusNetworkAuthenticationRequired) // HTTP 511 Network Authentication Required
|
||||||
|
|
||||||
|
ErrValidatorNotRegistered = errors.New("validator not registered")
|
||||||
|
ErrRendererNotRegistered = errors.New("renderer not registered")
|
||||||
|
ErrInvalidRedirectCode = errors.New("invalid redirect status code")
|
||||||
|
ErrCookieNotFound = errors.New("cookie not found")
|
||||||
|
ErrInvalidCertOrKeyType = errors.New("invalid cert or key type, must be string or []byte")
|
||||||
|
ErrInvalidListenerNetwork = errors.New("invalid listener network")
|
||||||
)
|
)
|
||||||
|
|
||||||
// Error handlers
|
// Error handlers
|
||||||
|
|
|
||||||
72
vendor/github.com/labstack/echo/v4/middleware/context_timeout.go
generated
vendored
Normal file
72
vendor/github.com/labstack/echo/v4/middleware/context_timeout.go
generated
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
package middleware
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/labstack/echo/v4"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ContextTimeoutConfig defines the config for ContextTimeout middleware.
|
||||||
|
type ContextTimeoutConfig struct {
|
||||||
|
// Skipper defines a function to skip middleware.
|
||||||
|
Skipper Skipper
|
||||||
|
|
||||||
|
// ErrorHandler is a function when error aries in middeware execution.
|
||||||
|
ErrorHandler func(err error, c echo.Context) error
|
||||||
|
|
||||||
|
// Timeout configures a timeout for the middleware, defaults to 0 for no timeout
|
||||||
|
Timeout time.Duration
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextTimeout returns a middleware which returns error (503 Service Unavailable error) to client
|
||||||
|
// when underlying method returns context.DeadlineExceeded error.
|
||||||
|
func ContextTimeout(timeout time.Duration) echo.MiddlewareFunc {
|
||||||
|
return ContextTimeoutWithConfig(ContextTimeoutConfig{Timeout: timeout})
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContextTimeoutWithConfig returns a Timeout middleware with config.
|
||||||
|
func ContextTimeoutWithConfig(config ContextTimeoutConfig) echo.MiddlewareFunc {
|
||||||
|
mw, err := config.ToMiddleware()
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return mw
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToMiddleware converts Config to middleware.
|
||||||
|
func (config ContextTimeoutConfig) ToMiddleware() (echo.MiddlewareFunc, error) {
|
||||||
|
if config.Timeout == 0 {
|
||||||
|
return nil, errors.New("timeout must be set")
|
||||||
|
}
|
||||||
|
if config.Skipper == nil {
|
||||||
|
config.Skipper = DefaultSkipper
|
||||||
|
}
|
||||||
|
if config.ErrorHandler == nil {
|
||||||
|
config.ErrorHandler = func(err error, c echo.Context) error {
|
||||||
|
if err != nil && errors.Is(err, context.DeadlineExceeded) {
|
||||||
|
return echo.ErrServiceUnavailable.WithInternal(err)
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||||
|
return func(c echo.Context) error {
|
||||||
|
if config.Skipper(c) {
|
||||||
|
return next(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
timeoutContext, cancel := context.WithTimeout(c.Request().Context(), config.Timeout)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
c.SetRequest(c.Request().WithContext(timeoutContext))
|
||||||
|
|
||||||
|
if err := next(c); err != nil {
|
||||||
|
return config.ErrorHandler(err, c)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
11
vendor/github.com/labstack/echo/v4/middleware/cors.go
generated
vendored
11
vendor/github.com/labstack/echo/v4/middleware/cors.go
generated
vendored
|
|
@ -79,6 +79,15 @@ type (
|
||||||
// See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials
|
// See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials
|
||||||
AllowCredentials bool `yaml:"allow_credentials"`
|
AllowCredentials bool `yaml:"allow_credentials"`
|
||||||
|
|
||||||
|
// UnsafeWildcardOriginWithAllowCredentials UNSAFE/INSECURE: allows wildcard '*' origin to be used with AllowCredentials
|
||||||
|
// flag. In that case we consider any origin allowed and send it back to the client with `Access-Control-Allow-Origin` header.
|
||||||
|
//
|
||||||
|
// This is INSECURE and potentially leads to [cross-origin](https://portswigger.net/research/exploiting-cors-misconfigurations-for-bitcoins-and-bounties)
|
||||||
|
// attacks. See: https://github.com/labstack/echo/issues/2400 for discussion on the subject.
|
||||||
|
//
|
||||||
|
// Optional. Default value is false.
|
||||||
|
UnsafeWildcardOriginWithAllowCredentials bool `yaml:"unsafe_wildcard_origin_with_allow_credentials"`
|
||||||
|
|
||||||
// ExposeHeaders determines the value of Access-Control-Expose-Headers, which
|
// ExposeHeaders determines the value of Access-Control-Expose-Headers, which
|
||||||
// defines a list of headers that clients are allowed to access.
|
// defines a list of headers that clients are allowed to access.
|
||||||
//
|
//
|
||||||
|
|
@ -203,7 +212,7 @@ func CORSWithConfig(config CORSConfig) echo.MiddlewareFunc {
|
||||||
} else {
|
} else {
|
||||||
// Check allowed origins
|
// Check allowed origins
|
||||||
for _, o := range config.AllowOrigins {
|
for _, o := range config.AllowOrigins {
|
||||||
if o == "*" && config.AllowCredentials {
|
if o == "*" && config.AllowCredentials && config.UnsafeWildcardOriginWithAllowCredentials {
|
||||||
allowOrigin = origin
|
allowOrigin = origin
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
||||||
6
vendor/github.com/labstack/echo/v4/middleware/csrf.go
generated
vendored
6
vendor/github.com/labstack/echo/v4/middleware/csrf.go
generated
vendored
|
|
@ -119,9 +119,9 @@ func CSRFWithConfig(config CSRFConfig) echo.MiddlewareFunc {
|
||||||
config.CookieSecure = true
|
config.CookieSecure = true
|
||||||
}
|
}
|
||||||
|
|
||||||
extractors, err := CreateExtractors(config.TokenLookup)
|
extractors, cErr := CreateExtractors(config.TokenLookup)
|
||||||
if err != nil {
|
if cErr != nil {
|
||||||
panic(err)
|
panic(cErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||||
|
|
|
||||||
6
vendor/github.com/labstack/echo/v4/middleware/jwt.go
generated
vendored
6
vendor/github.com/labstack/echo/v4/middleware/jwt.go
generated
vendored
|
|
@ -196,9 +196,9 @@ func JWTWithConfig(config JWTConfig) echo.MiddlewareFunc {
|
||||||
config.ParseTokenFunc = config.defaultParseToken
|
config.ParseTokenFunc = config.defaultParseToken
|
||||||
}
|
}
|
||||||
|
|
||||||
extractors, err := createExtractors(config.TokenLookup, config.AuthScheme)
|
extractors, cErr := createExtractors(config.TokenLookup, config.AuthScheme)
|
||||||
if err != nil {
|
if cErr != nil {
|
||||||
panic(err)
|
panic(cErr)
|
||||||
}
|
}
|
||||||
if len(config.TokenLookupFuncs) > 0 {
|
if len(config.TokenLookupFuncs) > 0 {
|
||||||
extractors = append(config.TokenLookupFuncs, extractors...)
|
extractors = append(config.TokenLookupFuncs, extractors...)
|
||||||
|
|
|
||||||
6
vendor/github.com/labstack/echo/v4/middleware/key_auth.go
generated
vendored
6
vendor/github.com/labstack/echo/v4/middleware/key_auth.go
generated
vendored
|
|
@ -108,9 +108,9 @@ func KeyAuthWithConfig(config KeyAuthConfig) echo.MiddlewareFunc {
|
||||||
panic("echo: key-auth middleware requires a validator function")
|
panic("echo: key-auth middleware requires a validator function")
|
||||||
}
|
}
|
||||||
|
|
||||||
extractors, err := createExtractors(config.KeyLookup, config.AuthScheme)
|
extractors, cErr := createExtractors(config.KeyLookup, config.AuthScheme)
|
||||||
if err != nil {
|
if cErr != nil {
|
||||||
panic(err)
|
panic(cErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||||
|
|
|
||||||
28
vendor/github.com/labstack/echo/v4/middleware/static.go
generated
vendored
28
vendor/github.com/labstack/echo/v4/middleware/static.go
generated
vendored
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
|
|
@ -157,9 +156,9 @@ func StaticWithConfig(config StaticConfig) echo.MiddlewareFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Index template
|
// Index template
|
||||||
t, err := template.New("index").Parse(html)
|
t, tErr := template.New("index").Parse(html)
|
||||||
if err != nil {
|
if tErr != nil {
|
||||||
panic(fmt.Sprintf("echo: %v", err))
|
panic(fmt.Errorf("echo: %w", tErr))
|
||||||
}
|
}
|
||||||
|
|
||||||
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||||
|
|
@ -176,7 +175,7 @@ func StaticWithConfig(config StaticConfig) echo.MiddlewareFunc {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
name := filepath.Join(config.Root, filepath.Clean("/"+p)) // "/"+ for security
|
name := path.Join(config.Root, path.Clean("/"+p)) // "/"+ for security
|
||||||
|
|
||||||
if config.IgnoreBase {
|
if config.IgnoreBase {
|
||||||
routePath := path.Base(strings.TrimRight(c.Path(), "/*"))
|
routePath := path.Base(strings.TrimRight(c.Path(), "/*"))
|
||||||
|
|
@ -187,12 +186,14 @@ func StaticWithConfig(config StaticConfig) echo.MiddlewareFunc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file, err := openFile(config.Filesystem, name)
|
file, err := config.Filesystem.Open(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !os.IsNotExist(err) {
|
if !isIgnorableOpenFileError(err) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// file with that path did not exist, so we continue down in middleware/handler chain, hoping that we end up in
|
||||||
|
// handler that is meant to handle this request
|
||||||
if err = next(c); err == nil {
|
if err = next(c); err == nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -202,7 +203,7 @@ func StaticWithConfig(config StaticConfig) echo.MiddlewareFunc {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
file, err = openFile(config.Filesystem, filepath.Join(config.Root, config.Index))
|
file, err = config.Filesystem.Open(path.Join(config.Root, config.Index))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -216,15 +217,13 @@ func StaticWithConfig(config StaticConfig) echo.MiddlewareFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
if info.IsDir() {
|
if info.IsDir() {
|
||||||
index, err := openFile(config.Filesystem, filepath.Join(name, config.Index))
|
index, err := config.Filesystem.Open(path.Join(name, config.Index))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if config.Browse {
|
if config.Browse {
|
||||||
return listDir(t, name, file, c.Response())
|
return listDir(t, name, file, c.Response())
|
||||||
}
|
}
|
||||||
|
|
||||||
if os.IsNotExist(err) {
|
return next(c)
|
||||||
return next(c)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
defer index.Close()
|
defer index.Close()
|
||||||
|
|
@ -242,11 +241,6 @@ func StaticWithConfig(config StaticConfig) echo.MiddlewareFunc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func openFile(fs http.FileSystem, name string) (http.File, error) {
|
|
||||||
pathWithSlashes := filepath.ToSlash(name)
|
|
||||||
return fs.Open(pathWithSlashes)
|
|
||||||
}
|
|
||||||
|
|
||||||
func serveFile(c echo.Context, file http.File, info os.FileInfo) error {
|
func serveFile(c echo.Context, file http.File, info os.FileInfo) error {
|
||||||
http.ServeContent(c.Response(), c.Request(), info.Name(), info.ModTime(), file)
|
http.ServeContent(c.Response(), c.Request(), info.Name(), info.ModTime(), file)
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
12
vendor/github.com/labstack/echo/v4/middleware/static_other.go
generated
vendored
Normal file
12
vendor/github.com/labstack/echo/v4/middleware/static_other.go
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
//go:build !windows
|
||||||
|
|
||||||
|
package middleware
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
// We ignore these errors as there could be handler that matches request path.
|
||||||
|
func isIgnorableOpenFileError(err error) bool {
|
||||||
|
return os.IsNotExist(err)
|
||||||
|
}
|
||||||
23
vendor/github.com/labstack/echo/v4/middleware/static_windows.go
generated
vendored
Normal file
23
vendor/github.com/labstack/echo/v4/middleware/static_windows.go
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
package middleware
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
// We ignore these errors as there could be handler that matches request path.
|
||||||
|
//
|
||||||
|
// As of Go 1.20 filepath.Clean has different behaviour on OS related filesystems so we need to use path.Clean
|
||||||
|
// on Windows which has some caveats. The Open methods might return different errors than earlier versions and
|
||||||
|
// as of 1.20 path checks are more strict on the provided path and considers [UNC](https://en.wikipedia.org/wiki/Path_(computing)#UNC)
|
||||||
|
// paths with missing host etc parts as invalid. Previously it would result you `fs.ErrNotExist`.
|
||||||
|
//
|
||||||
|
// For 1.20@Windows we need to treat those errors the same as `fs.ErrNotExists` so we can continue handling
|
||||||
|
// errors in the middleware/handler chain. Otherwise we might end up with status 500 instead of finding a route
|
||||||
|
// or return 404 not found.
|
||||||
|
func isIgnorableOpenFileError(err error) bool {
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
errTxt := err.Error()
|
||||||
|
return errTxt == "http: invalid or unsafe file path" || errTxt == "invalid path"
|
||||||
|
}
|
||||||
1
vendor/github.com/labstack/echo/v4/router.go
generated
vendored
1
vendor/github.com/labstack/echo/v4/router.go
generated
vendored
|
|
@ -524,7 +524,6 @@ func optionsMethodHandler(allowMethods string) func(c Context) error {
|
||||||
// - Return it `Echo#ReleaseContext()`.
|
// - Return it `Echo#ReleaseContext()`.
|
||||||
func (r *Router) Find(method, path string, c Context) {
|
func (r *Router) Find(method, path string, c Context) {
|
||||||
ctx := c.(*context)
|
ctx := c.(*context)
|
||||||
ctx.path = path
|
|
||||||
currentNode := r.tree // Current node as root
|
currentNode := r.tree // Current node as root
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
4
vendor/github.com/mattn/go-isatty/isatty_bsd.go
generated
vendored
4
vendor/github.com/mattn/go-isatty/isatty_bsd.go
generated
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
//go:build (darwin || freebsd || openbsd || netbsd || dragonfly) && !appengine
|
//go:build (darwin || freebsd || openbsd || netbsd || dragonfly || hurd) && !appengine
|
||||||
// +build darwin freebsd openbsd netbsd dragonfly
|
// +build darwin freebsd openbsd netbsd dragonfly hurd
|
||||||
// +build !appengine
|
// +build !appengine
|
||||||
|
|
||||||
package isatty
|
package isatty
|
||||||
|
|
|
||||||
20
vendor/golang.org/x/time/rate/rate.go
generated
vendored
20
vendor/golang.org/x/time/rate/rate.go
generated
vendored
|
|
@ -83,7 +83,7 @@ func (lim *Limiter) Burst() int {
|
||||||
// TokensAt returns the number of tokens available at time t.
|
// TokensAt returns the number of tokens available at time t.
|
||||||
func (lim *Limiter) TokensAt(t time.Time) float64 {
|
func (lim *Limiter) TokensAt(t time.Time) float64 {
|
||||||
lim.mu.Lock()
|
lim.mu.Lock()
|
||||||
_, _, tokens := lim.advance(t) // does not mutute lim
|
_, tokens := lim.advance(t) // does not mutate lim
|
||||||
lim.mu.Unlock()
|
lim.mu.Unlock()
|
||||||
return tokens
|
return tokens
|
||||||
}
|
}
|
||||||
|
|
@ -183,7 +183,7 @@ func (r *Reservation) CancelAt(t time.Time) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// advance time to now
|
// advance time to now
|
||||||
t, _, tokens := r.lim.advance(t)
|
t, tokens := r.lim.advance(t)
|
||||||
// calculate new number of tokens
|
// calculate new number of tokens
|
||||||
tokens += restoreTokens
|
tokens += restoreTokens
|
||||||
if burst := float64(r.lim.burst); tokens > burst {
|
if burst := float64(r.lim.burst); tokens > burst {
|
||||||
|
|
@ -304,7 +304,7 @@ func (lim *Limiter) SetLimitAt(t time.Time, newLimit Limit) {
|
||||||
lim.mu.Lock()
|
lim.mu.Lock()
|
||||||
defer lim.mu.Unlock()
|
defer lim.mu.Unlock()
|
||||||
|
|
||||||
t, _, tokens := lim.advance(t)
|
t, tokens := lim.advance(t)
|
||||||
|
|
||||||
lim.last = t
|
lim.last = t
|
||||||
lim.tokens = tokens
|
lim.tokens = tokens
|
||||||
|
|
@ -321,7 +321,7 @@ func (lim *Limiter) SetBurstAt(t time.Time, newBurst int) {
|
||||||
lim.mu.Lock()
|
lim.mu.Lock()
|
||||||
defer lim.mu.Unlock()
|
defer lim.mu.Unlock()
|
||||||
|
|
||||||
t, _, tokens := lim.advance(t)
|
t, tokens := lim.advance(t)
|
||||||
|
|
||||||
lim.last = t
|
lim.last = t
|
||||||
lim.tokens = tokens
|
lim.tokens = tokens
|
||||||
|
|
@ -356,7 +356,7 @@ func (lim *Limiter) reserveN(t time.Time, n int, maxFutureReserve time.Duration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
t, last, tokens := lim.advance(t)
|
t, tokens := lim.advance(t)
|
||||||
|
|
||||||
// Calculate the remaining number of tokens resulting from the request.
|
// Calculate the remaining number of tokens resulting from the request.
|
||||||
tokens -= float64(n)
|
tokens -= float64(n)
|
||||||
|
|
@ -379,15 +379,11 @@ func (lim *Limiter) reserveN(t time.Time, n int, maxFutureReserve time.Duration)
|
||||||
if ok {
|
if ok {
|
||||||
r.tokens = n
|
r.tokens = n
|
||||||
r.timeToAct = t.Add(waitDuration)
|
r.timeToAct = t.Add(waitDuration)
|
||||||
}
|
|
||||||
|
|
||||||
// Update state
|
// Update state
|
||||||
if ok {
|
|
||||||
lim.last = t
|
lim.last = t
|
||||||
lim.tokens = tokens
|
lim.tokens = tokens
|
||||||
lim.lastEvent = r.timeToAct
|
lim.lastEvent = r.timeToAct
|
||||||
} else {
|
|
||||||
lim.last = last
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r
|
return r
|
||||||
|
|
@ -396,7 +392,7 @@ func (lim *Limiter) reserveN(t time.Time, n int, maxFutureReserve time.Duration)
|
||||||
// advance calculates and returns an updated state for lim resulting from the passage of time.
|
// advance calculates and returns an updated state for lim resulting from the passage of time.
|
||||||
// lim is not changed.
|
// lim is not changed.
|
||||||
// advance requires that lim.mu is held.
|
// advance requires that lim.mu is held.
|
||||||
func (lim *Limiter) advance(t time.Time) (newT time.Time, newLast time.Time, newTokens float64) {
|
func (lim *Limiter) advance(t time.Time) (newT time.Time, newTokens float64) {
|
||||||
last := lim.last
|
last := lim.last
|
||||||
if t.Before(last) {
|
if t.Before(last) {
|
||||||
last = t
|
last = t
|
||||||
|
|
@ -409,7 +405,7 @@ func (lim *Limiter) advance(t time.Time) (newT time.Time, newLast time.Time, new
|
||||||
if burst := float64(lim.burst); tokens > burst {
|
if burst := float64(lim.burst); tokens > burst {
|
||||||
tokens = burst
|
tokens = burst
|
||||||
}
|
}
|
||||||
return t, last, tokens
|
return t, tokens
|
||||||
}
|
}
|
||||||
|
|
||||||
// durationFromTokens is a unit conversion function from the number of tokens to the duration
|
// durationFromTokens is a unit conversion function from the number of tokens to the duration
|
||||||
|
|
|
||||||
6
vendor/modules.txt
vendored
6
vendor/modules.txt
vendored
|
|
@ -530,7 +530,7 @@ github.com/kolo/xmlrpc
|
||||||
# github.com/kr/text v0.2.0
|
# github.com/kr/text v0.2.0
|
||||||
## explicit
|
## explicit
|
||||||
github.com/kr/text
|
github.com/kr/text
|
||||||
# github.com/labstack/echo/v4 v4.10.0
|
# github.com/labstack/echo/v4 v4.10.2
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
github.com/labstack/echo/v4
|
github.com/labstack/echo/v4
|
||||||
github.com/labstack/echo/v4/middleware
|
github.com/labstack/echo/v4/middleware
|
||||||
|
|
@ -559,7 +559,7 @@ github.com/mailru/easyjson/jwriter
|
||||||
# github.com/mattn/go-colorable v0.1.13
|
# github.com/mattn/go-colorable v0.1.13
|
||||||
## explicit; go 1.15
|
## explicit; go 1.15
|
||||||
github.com/mattn/go-colorable
|
github.com/mattn/go-colorable
|
||||||
# github.com/mattn/go-isatty v0.0.16
|
# github.com/mattn/go-isatty v0.0.17
|
||||||
## explicit; go 1.15
|
## explicit; go 1.15
|
||||||
github.com/mattn/go-isatty
|
github.com/mattn/go-isatty
|
||||||
# github.com/mattn/go-runewidth v0.0.13
|
# github.com/mattn/go-runewidth v0.0.13
|
||||||
|
|
@ -871,7 +871,7 @@ golang.org/x/text/transform
|
||||||
golang.org/x/text/unicode/bidi
|
golang.org/x/text/unicode/bidi
|
||||||
golang.org/x/text/unicode/norm
|
golang.org/x/text/unicode/norm
|
||||||
golang.org/x/text/width
|
golang.org/x/text/width
|
||||||
# golang.org/x/time v0.2.0
|
# golang.org/x/time v0.3.0
|
||||||
## explicit
|
## explicit
|
||||||
golang.org/x/time/rate
|
golang.org/x/time/rate
|
||||||
# golang.org/x/tools v0.6.0
|
# golang.org/x/tools v0.6.0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue