diff options
Diffstat (limited to 'vendor/github.com/gin-contrib')
-rw-r--r-- | vendor/github.com/gin-contrib/cors/.golangci.yml | 43 | ||||
-rw-r--r-- | vendor/github.com/gin-contrib/cors/.goreleaser.yaml | 57 | ||||
-rw-r--r-- | vendor/github.com/gin-contrib/cors/.travis.yml | 31 | ||||
-rw-r--r-- | vendor/github.com/gin-contrib/cors/README.md | 87 | ||||
-rw-r--r-- | vendor/github.com/gin-contrib/cors/config.go | 7 | ||||
-rw-r--r-- | vendor/github.com/gin-contrib/cors/cors.go | 15 | ||||
-rw-r--r-- | vendor/github.com/gin-contrib/gzip/.gitignore | 1 | ||||
-rw-r--r-- | vendor/github.com/gin-contrib/gzip/.golangci.yml | 48 | ||||
-rw-r--r-- | vendor/github.com/gin-contrib/gzip/handler.go | 1 |
9 files changed, 205 insertions, 85 deletions
diff --git a/vendor/github.com/gin-contrib/cors/.golangci.yml b/vendor/github.com/gin-contrib/cors/.golangci.yml new file mode 100644 index 000000000..5a0031c30 --- /dev/null +++ b/vendor/github.com/gin-contrib/cors/.golangci.yml @@ -0,0 +1,43 @@ +linters: + enable-all: false + disable-all: true + fast: false + enable: + - bodyclose + - deadcode + - depguard + - dogsled + - dupl + - errcheck + - exportloopref + - exhaustive + - gochecknoinits + - goconst + - gocritic + - gocyclo + - gofmt + - goimports + - goprintffuncname + - gosec + - gosimple + - govet + - ineffassign + - lll + - misspell + - nakedret + - noctx + - nolintlint + - rowserrcheck + - staticcheck + - structcheck + - stylecheck + - typecheck + - unconvert + - unparam + - unused + - varcheck + - whitespace + - gofumpt + +run: + timeout: 3m diff --git a/vendor/github.com/gin-contrib/cors/.goreleaser.yaml b/vendor/github.com/gin-contrib/cors/.goreleaser.yaml new file mode 100644 index 000000000..aa5453cfc --- /dev/null +++ b/vendor/github.com/gin-contrib/cors/.goreleaser.yaml @@ -0,0 +1,57 @@ +project_name: queue + +builds: + - + # If true, skip the build. + # Useful for library projects. + # Default is false + skip: true + +changelog: + # Set it to true if you wish to skip the changelog generation. + # This may result in an empty release notes on GitHub/GitLab/Gitea. + skip: false + + # Changelog generation implementation to use. + # + # Valid options are: + # - `git`: uses `git log`; + # - `github`: uses the compare GitHub API, appending the author login to the changelog. + # - `gitlab`: uses the compare GitLab API, appending the author name and email to the changelog. + # - `github-native`: uses the GitHub release notes generation API, disables the groups feature. + # + # Defaults to `git`. + use: git + + # Sorts the changelog by the commit's messages. + # Could either be asc, desc or empty + # Default is empty + sort: asc + + # Group commits messages by given regex and title. + # Order value defines the order of the groups. + # Proving no regex means all commits will be grouped under the default group. + # Groups are disabled when using github-native, as it already groups things by itself. + # + # Default is no groups. + groups: + - title: Features + regexp: "^.*feat[(\\w)]*:+.*$" + order: 0 + - title: 'Bug fixes' + regexp: "^.*fix[(\\w)]*:+.*$" + order: 1 + - title: 'Enhancements' + regexp: "^.*chore[(\\w)]*:+.*$" + order: 2 + - title: Others + order: 999 + + filters: + # Commit messages matching the regexp listed here will be removed from + # the changelog + # Default is empty + exclude: + - '^docs' + - 'CICD' + - typo diff --git a/vendor/github.com/gin-contrib/cors/.travis.yml b/vendor/github.com/gin-contrib/cors/.travis.yml deleted file mode 100644 index e5308a10d..000000000 --- a/vendor/github.com/gin-contrib/cors/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: go -sudo: false - -go: - - 1.11.x - - 1.12.x - - 1.13.x - - 1.14.x - - master - -matrix: - fast_finish: true - include: - - go: 1.11.x - env: GO111MODULE=on - - go: 1.12.x - env: GO111MODULE=on - -script: - - go test -v -covermode=atomic -coverprofile=coverage.out - -after_success: - - bash <(curl -s https://codecov.io/bash) - -notifications: - webhooks: - urls: - - https://webhooks.gitter.im/e/acc2c57482e94b44f557 - on_success: change - on_failure: always - on_start: false diff --git a/vendor/github.com/gin-contrib/cors/README.md b/vendor/github.com/gin-contrib/cors/README.md index bd567b10b..6289994d0 100644 --- a/vendor/github.com/gin-contrib/cors/README.md +++ b/vendor/github.com/gin-contrib/cors/README.md @@ -1,10 +1,9 @@ # CORS gin's middleware -[](https://travis-ci.org/gin-contrib/cors) +[](https://github.com/gin-contrib/cors/actions/workflows/go.yml) [](https://codecov.io/gh/gin-contrib/cors) [](https://goreportcard.com/report/github.com/gin-contrib/cors) [](https://godoc.org/github.com/gin-contrib/cors) -[](https://gitter.im/gin-gonic/gin) Gin middleware/handler to enable CORS support. @@ -15,7 +14,7 @@ Gin middleware/handler to enable CORS support. Download and install it: ```sh -$ go get github.com/gin-contrib/cors +go get github.com/gin-contrib/cors ``` Import it in your code: @@ -24,37 +23,37 @@ Import it in your code: import "github.com/gin-contrib/cors" ``` -### Canonical example: +### Canonical example ```go package main import ( - "time" + "time" - "github.com/gin-contrib/cors" - "github.com/gin-gonic/gin" + "github.com/gin-contrib/cors" + "github.com/gin-gonic/gin" ) func main() { - router := gin.Default() - // CORS for https://foo.com and https://github.com origins, allowing: - // - PUT and PATCH methods - // - Origin header - // - Credentials share - // - Preflight requests cached for 12 hours - router.Use(cors.New(cors.Config{ - AllowOrigins: []string{"https://foo.com"}, - AllowMethods: []string{"PUT", "PATCH"}, - AllowHeaders: []string{"Origin"}, - ExposeHeaders: []string{"Content-Length"}, - AllowCredentials: true, - AllowOriginFunc: func(origin string) bool { - return origin == "https://github.com" - }, - MaxAge: 12 * time.Hour, - })) - router.Run() + router := gin.Default() + // CORS for https://foo.com and https://github.com origins, allowing: + // - PUT and PATCH methods + // - Origin header + // - Credentials share + // - Preflight requests cached for 12 hours + router.Use(cors.New(cors.Config{ + AllowOrigins: []string{"https://foo.com"}, + AllowMethods: []string{"PUT", "PATCH"}, + AllowHeaders: []string{"Origin"}, + ExposeHeaders: []string{"Content-Length"}, + AllowCredentials: true, + AllowOriginFunc: func(origin string) bool { + return origin == "https://github.com" + }, + MaxAge: 12 * time.Hour, + })) + router.Run() } ``` @@ -62,30 +61,32 @@ func main() { ```go func main() { - router := gin.Default() - // - No origin allowed by default - // - GET,POST, PUT, HEAD methods - // - Credentials share disabled - // - Preflight requests cached for 12 hours - config := cors.DefaultConfig() - config.AllowOrigins = []string{"http://google.com"} - // config.AllowOrigins == []string{"http://google.com", "http://facebook.com"} - - router.Use(cors.New(config)) - router.Run() + router := gin.Default() + // - No origin allowed by default + // - GET,POST, PUT, HEAD methods + // - Credentials share disabled + // - Preflight requests cached for 12 hours + config := cors.DefaultConfig() + config.AllowOrigins = []string{"http://google.com"} + // config.AllowOrigins = []string{"http://google.com", "http://facebook.com"} + // config.AllowAllOrigins = true + + router.Use(cors.New(config)) + router.Run() } ``` +note: while Default() allows all origins, DefaultConfig() does not and you will still have to use AllowAllOrigins ### Default() allows all origins ```go func main() { - router := gin.Default() - // same as - // config := cors.DefaultConfig() - // config.AllowAllOrigins = true - // router.Use(cors.New(config)) - router.Use(cors.Default()) - router.Run() + router := gin.Default() + // same as + // config := cors.DefaultConfig() + // config.AllowAllOrigins = true + // router.Use(cors.New(config)) + router.Use(cors.Default()) + router.Run() } ``` diff --git a/vendor/github.com/gin-contrib/cors/config.go b/vendor/github.com/gin-contrib/cors/config.go index d4fc11801..735c8c1ab 100644 --- a/vendor/github.com/gin-contrib/cors/config.go +++ b/vendor/github.com/gin-contrib/cors/config.go @@ -12,7 +12,6 @@ type cors struct { allowCredentials bool allowOriginFunc func(string) bool allowOrigins []string - exposeHeaders []string normalHeaders http.Header preflightHeaders http.Header wildcardOrigins [][]string @@ -43,6 +42,12 @@ func newCors(config Config) *cors { panic(err.Error()) } + for _, origin := range config.AllowOrigins { + if origin == "*" { + config.AllowAllOrigins = true + } + } + return &cors{ allowOriginFunc: config.AllowOriginFunc, allowAllOrigins: config.AllowAllOrigins, diff --git a/vendor/github.com/gin-contrib/cors/cors.go b/vendor/github.com/gin-contrib/cors/cors.go index d6d06de03..f0e230ae4 100644 --- a/vendor/github.com/gin-contrib/cors/cors.go +++ b/vendor/github.com/gin-contrib/cors/cors.go @@ -23,7 +23,7 @@ type Config struct { AllowOriginFunc func(origin string) bool // AllowMethods is a list of methods the client is allowed to use with - // cross-domain requests. Default value is simple methods (GET and POST) + // cross-domain requests. Default value is simple methods (GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS) AllowMethods []string // AllowHeaders is list of non simple headers the client is allowed to use with @@ -34,11 +34,11 @@ type Config struct { // cookies, HTTP authentication or client side SSL certificates. AllowCredentials bool - // ExposedHeaders indicates which headers are safe to expose to the API of a CORS + // ExposeHeaders indicates which headers are safe to expose to the API of a CORS // API specification ExposeHeaders []string - // MaxAge indicates how long (in seconds) the results of a preflight request + // MaxAge indicates how long (with second-precision) the results of a preflight request // can be cached MaxAge time.Duration @@ -95,7 +95,7 @@ func (c Config) validateAllowedSchemas(origin string) bool { } // Validate is check configuration of user defined. -func (c *Config) Validate() error { +func (c Config) Validate() error { if c.AllowAllOrigins && (c.AllowOriginFunc != nil || len(c.AllowOrigins) > 0) { return errors.New("conflict settings: all origins are allowed. AllowOriginFunc or AllowOrigins is not needed") } @@ -103,10 +103,7 @@ func (c *Config) Validate() error { return errors.New("conflict settings: all origins disabled") } for _, origin := range c.AllowOrigins { - if origin == "*" { - c.AllowAllOrigins = true - return nil - } else if !strings.Contains(origin, "*") && !c.validateAllowedSchemas(origin) { + if !strings.Contains(origin, "*") && !c.validateAllowedSchemas(origin) { return errors.New("bad origin: origins must contain '*' or include " + strings.Join(c.getAllowedSchemas(), ",")) } } @@ -148,7 +145,7 @@ func (c Config) parseWildcardRules() [][]string { // DefaultConfig returns a generic default configuration mapped to localhost. func DefaultConfig() Config { return Config{ - AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD"}, + AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"}, AllowHeaders: []string{"Origin", "Content-Length", "Content-Type"}, AllowCredentials: false, MaxAge: 12 * time.Hour, diff --git a/vendor/github.com/gin-contrib/gzip/.gitignore b/vendor/github.com/gin-contrib/gzip/.gitignore new file mode 100644 index 000000000..2d830686d --- /dev/null +++ b/vendor/github.com/gin-contrib/gzip/.gitignore @@ -0,0 +1 @@ +coverage.out diff --git a/vendor/github.com/gin-contrib/gzip/.golangci.yml b/vendor/github.com/gin-contrib/gzip/.golangci.yml new file mode 100644 index 000000000..60b7c368b --- /dev/null +++ b/vendor/github.com/gin-contrib/gzip/.golangci.yml @@ -0,0 +1,48 @@ +linters: + enable-all: false + disable-all: true + fast: false + enable: + - bodyclose + - deadcode + - depguard + - dogsled + - dupl + - errcheck + - exportloopref + - exhaustive + - gochecknoinits + - goconst + - gocritic + - gocyclo + - gofmt + - goimports + - goprintffuncname + - gosec + - gosimple + - govet + - ineffassign + - lll + - misspell + - nakedret + - noctx + - nolintlint + - rowserrcheck + - staticcheck + - structcheck + - stylecheck + - typecheck + - unconvert + - unparam + - unused + - varcheck + - whitespace + - gofumpt + +run: + timeout: 3m + +linters-settings: + dupl: + # tokens count to trigger issue, 150 by default + threshold: 200 diff --git a/vendor/github.com/gin-contrib/gzip/handler.go b/vendor/github.com/gin-contrib/gzip/handler.go index 58f87db9b..7de33eb64 100644 --- a/vendor/github.com/gin-contrib/gzip/handler.go +++ b/vendor/github.com/gin-contrib/gzip/handler.go @@ -64,7 +64,6 @@ func (g *gzipHandler) shouldCompress(req *http.Request) bool { if !strings.Contains(req.Header.Get("Accept-Encoding"), "gzip") || strings.Contains(req.Header.Get("Connection"), "Upgrade") || strings.Contains(req.Header.Get("Accept"), "text/event-stream") { - return false } |