Commit Graph

237 Commits

Author SHA1 Message Date
Pierre-Henri Symoneaux 626d55b0c0
fix(gin): Do not panic when handling method not allowed on empty tree (#4003)
Signed-off-by: Pierre-Henri Symoneaux <pierre-henri.symoneaux@ovhcloud.com>
2024-06-22 22:19:04 +08:00
wssccc 4621b7ac98
feat(router): add literal colon support (#1432) (#2857) 2024-06-01 13:44:57 +08:00
thinkerou 3ac729dc4a
feat(gin): support http3 using quic-go/quic-go (#3210)
* experimental support http3

* remove go1.14 and go1.15

* update quic-go package path

* only support go1.19+

* remove go19 support

* update gomod

* chore: refine CI configuration and dependencies

- Remove dynamic Go versioning in favor of pinning to major version `1`
- Update linter version from `v1.56.2` to `v1.58.1` in GitHub Actions workflow

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* chore: refactor CI workflow and improve tests

- Update the golangci-lint-action version from `v5` to `v6` in the GitHub workflow configuration

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* chore: update dependencies and CI configurations

- Update Go version requirement from `1.20` to `1.21` in `go.mod`

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* style: refactor codebase and update tests

- Add an empty line in the import section of `gin.go`

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* chore: enhance code quality and consistency

- Add `gin.go` to the list of files with specific linters in `.golangci.yml`, applying the `gci` linter.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

---------

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-05-09 09:17:06 +08:00
Pedro Aguiar f5f5da8fa0
docs(gin): update link to dont-trust-all-proxies section (#3938) (#3945)
Update link [1] to [2] after PR #3449 was merged.

[1] https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies
[2] https://github.com/gin-gonic/gin/blob/master/docs/doc.md#dont-trust-all-proxies

Closes
2024-05-08 06:31:01 +08:00
Flc゛ e60113dc95
docs(engine): fix comments for the `With` (#3955)
Signed-off-by: Flc゛ <four_leaf_clover@foxmail.com>
2024-05-08 05:29:54 +08:00
Flc゛ ac5e84d93c
feat(engine): Added `OptionFunc` and `With` (#3572)
* feat: Added `OptionFunc` and `With`

* fix: `With(opts...)` must be after `New`

* feat: improve New with

* fix: test

* optimize code

* optimize nolint

* optimize code

Signed-off-by: Flc゛ <four_leaf_clover@foxmail.com>

---------

Signed-off-by: Flc゛ <four_leaf_clover@foxmail.com>
2024-03-11 22:35:30 +08:00
Andy Brody bb3519d26f
chore(IP): add TrustedPlatform constant for Fly.io. (#3839)
Also add some more detail to the docs for how to use TrustedPlatform.

https://fly.io/docs/reference/runtime-environment/#fly-client-ip
2024-02-07 20:18:53 +08:00
Gabriel Augendre 86ff4a64c7
fix(header): Allow header according to RFC 7231 (HTTP 405) (#3759)
Co-authored-by: Helios <i@shangyes.net>
2024-02-06 11:08:56 +08:00
WeiTheShinobi 49f45a5427
docs: remove redundant comments (#3765) 2023-11-16 23:46:11 +08:00
Dylan Maassen van den Brink fe989b6a6f
docs: changed documentation link for trusted proxies (#3575) 2023-04-26 11:18:22 +08:00
t0rchwo0d 4cee78f538
Fix #3500 Add escape logic for header (#3503) 2023-02-19 21:25:48 +08:00
t0rchwo0d 81ac7d55a0
Add escape logic for header (#3500) 2023-02-17 10:00:19 +08:00
RoCry 55e27f1246
fix(engine): missing route params for CreateTestContext (#2778) (#2803) 2022-11-06 17:08:11 +08:00
Jesse 51aea73ba0
fix: modify interface check way (#3327) 2022-10-20 00:49:19 +08:00
wei f197a8bae0
feat(context): add ContextWithFallback feature flag (#3166) (#3172)
Enable fallback Context.Deadline(), Context.Done(), Context.Err() and Context.Value()
2022-06-06 18:43:53 +08:00
thinkerou 4b68a5f12a
chore: update go.mod and remove space from copyright (#3158)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-28 10:42:28 +08:00
Eric_Lee 87811a97bd
fix: the trusted proxies should support ipv6 address by default (#3033) 2022-05-28 08:14:35 +08:00
mstmdev 865fd560fc
Update some comments, add function name prefix to comment (#3090) 2022-03-23 21:35:09 +08:00
thinkerou 2bde107686
test support go1.18 (#2990) 2022-03-21 09:43:17 +08:00
涛叔 b40ded1837
Add h2c support (#1398) 2022-02-05 21:13:20 +08:00
jincheng9 fb5f045417
fix: description error (#2986) 2021-12-15 23:27:23 +08:00
jincheng9 ba7e58989c
fix: typo (#2977)
* fix:typo

* fix: typo
2021-12-05 08:41:25 +08:00
jincheng9 504ec594f8
fix:typo (#2975) 2021-12-03 14:49:51 +08:00
Notealot 0be805a675
TrustedProxies: Add default IPv6 support and refactor (#2967) 2021-12-03 14:49:16 +08:00
jincheng9 830a63d244
fix: typo (#2973)
* fix: typo

* fix: grammar error
2021-12-02 18:00:24 +08:00
jincheng9 bc2417fc40
fix: description error (#2968) 2021-11-30 08:36:36 +08:00
jincheng9 823adfc91a
fix: typo (#2958) 2021-11-25 18:12:08 +08:00
Notealot 2d3d6d2f13
Provide custom options of TrustedPlatform for another CDN services (#2906)
* refine TrustedPlatform and docs

* refactor for switch

* refactor switch to if statement
2021-10-24 08:34:03 +08:00
Zhu Xi 3fe928994b
Update the code logic for latestNode in tree.go (#2897) 2021-10-23 11:58:57 +08:00
Notealot 39181329de
Tidy: Complete TrustedProxies feature (#2887) 2021-10-06 09:37:25 +08:00
Notealot 6d75aba83f
Quick Fix c.ClientIP() mistakely parsing to 127.0.0.1 for who not using r.Run() to run http server (#2832) 2021-09-29 19:26:02 +08:00
寻寻觅觅的Gopher d6534ccf38
turn on HandleMethodNotAllowed when using NoMethod #2871 (#2872) 2021-09-28 09:45:50 +08:00
ziheng 3116a2d7a1
use std http method constant instead of raw string (#2782) 2021-07-09 10:30:44 +08:00
Lanco 9c27053243
byte alignment (#2774) 2021-07-04 10:37:13 +08:00
Alessandro (Ale) Segala dd8a27c0b6
Setting trusted platform using an enum-like (#2739) 2021-06-24 08:58:10 +08:00
Alessandro (Ale) Segala 6703dea51c
Get client IP when using Cloudflare (#2723)
Co-authored-by: thinkerou <thinkerou@gmail.com>
2021-05-28 10:03:59 +08:00
yiranzai b5ca989875
set engine.TrustedProxies For items that don't use gin.RUN (#2692)
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-05-25 13:47:35 +08:00
Manu MA bfc8ca285e
feat(engine): add trustedproxies and remoteIP (#2632)
Co-authored-by: Søren L. Hansen <soren@linux2go.dk>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: thinkerou <thinkerou@gmail.com>
Co-authored-by: Javier Provecho Fernandez <javiertitan@gmail.com>
2021-04-06 11:37:25 +08:00
Bo-Yi Wu d17270dd90
Sync route tree to httprouter latest code (#2368)
* update tree

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* update

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* update

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* update countParams

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* fix testing

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* update

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* update

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* udpate

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* fix testing

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* refactor gin context

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* add fullPath

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* chore: refactor

* remove unused code

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* remove varsCount

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* refactor

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2020-05-10 13:22:25 +08:00
thinkerou 6ac7f194c4
chore: update some code style (#2356) 2020-05-05 13:55:57 +08:00
thinkerou 54175dbe72
chore: update the result of CR (#2354)
* chore: update the result of CR

* Update utils.go

* Update utils.go

* Update context.go

* Update context.go
2020-05-04 11:40:41 +08:00
Bo-Yi Wu 2c43278080
chore(performance): Change *sync.RWMutex to sync.RWMutex (#2351) 2020-05-03 20:39:34 +08:00
AcoNCodes 73ccfea3ba
Add mutex for protect Context.Keys map (#1391)
* Add mutex for protect Context.Keys map

* Fix tests

Co-authored-by: Nikolay Tolkachov <nik.tolkachov@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2020-03-17 00:52:02 +08:00
Ryan J. Yoder 67008be35f
Unix Socket Handling (#2280)
* do not set unix socket permissions. Cleanup unix socket.

* removed useless error checking
2020-03-16 22:36:15 +08:00
Andy Pan 982daeb1ec Use zero-copy approach to convert types between string and byte… (#2206)
* Use zero-copy approach to convert types between string and byte slice

* Rename argument to a eligible one

Benchmark:

BenchmarkBytesConvBytesToStrRaw-4   	21003800	        70.9 ns/op	      96 B/op	       1 allocs/op
BenchmarkBytesConvBytesToStr-4      	1000000000	         0.333 ns/op	       0 B/op	       0 allocs/op
BenchmarkBytesConvStrToBytesRaw-4   	18478059	        59.3 ns/op	      96 B/op	       1 allocs/op
BenchmarkBytesConvStrToBytes-4      	1000000000	         0.373 ns/op	       0 B/op	       0 allocs/op


Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2020-01-18 00:32:50 +08:00
thinkerou d5f12ac6d7
use http method constant (#2155)
* use http method constant

* fix typo
2019-11-29 07:50:49 +08:00
Bo-Yi Wu 352d69c71f
chore(performance): Improve performance for adding RemoveExtraS… (#2159)
* chore: Add RemoveExtraSlash flag

* fix testing

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-11-29 00:02:02 +08:00
Ngalim Siregar 231ff00d1f Refactor redirect request in gin.go (#1970)
* Refactor redirect request in gin.go

* Update http status code
2019-11-26 08:19:30 +08:00
ishanray 517eacb4f9 Update gin.go (#2110) 2019-10-31 11:13:39 +08:00
Dmitry Kutakov 393a63f3b0 Fix 'errcheck' linter warnings (#2093) 2019-10-27 13:58:59 +08:00