Commit Graph

39 Commits

Author SHA1 Message Date
Erik Dubbelboer 1899b234a1 bug: fasthttpproxy dialers return nil DialFunc on error, causing panic (#2248) (#2279) 2026-06-06 11:28:48 +02:00
Erik Dubbelboer 534461ad12 fasthttpproxy: reject CRLF in HTTP proxy CONNECT target (#2174)
Reject dial target addresses containing CR or LF before building the
HTTP CONNECT request in httpProxyDial.

This prevents header injection through HTTP proxies when callers pass
unsanitized target addresses via low-level dial paths such as
HostClient.Addr or direct proxy dialer usage.

Reported by https://github.com/OLU-DEVX
2026-04-05 07:03:35 +02:00
Erik Dubbelboer c2b317d47d Go 1.26 and golangci-lint updates (#2146)
Keep Go 1.24 compatibility for now (by not using `wg.Go()`).
2026-02-21 10:28:39 +01:00
Erik Dubbelboer 80e3281747 fasthttpproxy: scope proxy auth cache to GetDialFunc (#2144)
Move auth cache from package-level to GetDialFunc lifetime to prevent
leaks.
2026-02-20 22:53:25 +01:00
Erik Dubbelboer 1b8c5593da Fix named return bugs
The new golangci-lint doesn't allow empty return statements anymore.

But returning a specific value with named return variables actually assigns it to the variable.
See: https://go.dev/play/p/kNhVx2scGx5

This caused a bug here: https://github.com/valyala/fasthttp/issues/2090
2025-10-23 23:47:40 +02:00
Erik Dubbelboer 0ad54a45d9 Update lint and fix new lint errors 2025-09-28 02:59:00 +02:00
Erik Dubbelboer 4d25421ae5 Drop Go 1.23 support (#2065)
The Go team doesn't support this version anymore. This is required to
update our golang.org/x/... dependencies.
2025-09-10 22:16:01 +02:00
Erik Dubbelboer 4891fc5304 Update golangci-lint to v2 (#1980) 2025-03-25 06:40:55 +01:00
Erik Dubbelboer b1c27881cb Try to fix tests with dial timeouts (#1940)
Use github.com and .io instead of example.com and google.com as they are
probably more reliable within Github actions.
2025-01-15 05:47:54 +01:00
Lavish 40bdc4abc7 feat(fasthttpproxy): add dual-stack connection support to enable IPv6 proxies for HTTP and SOCKS5 dialers (#1885)
* feat(fasthttpproxy): add dual-stack connection support to enable IPv6 proxies for HTTP and SOCKS5 dialers

- Added `FasthttpHTTPDialerDualStack` to support dual-stack (IPv4 and IPv6) connections for HTTP proxies, enabling IPv6 proxy usage.
- Added `FasthttpSocksDialerDualStack` to support dual-stack (IPv4 and IPv6) connections for SOCKS5 proxies, enabling IPv6 proxy usage.
- Improved dialer configuration to ensure compatibility with both IPv4 and IPv6 proxies.

* fix(lint): address linting issues in code
2024-10-22 19:19:00 +02:00
newacorn 6ed7f6bbf7 Add a multifunctional Dialer struct. (#1829)
Add a multifunctional `Dialer` struct and reimplement the function API

Reimplement the existing function interfaces of the fasthttpproxy package through Dialer. Refactor Dialer.GetDialFunc to ensure that its performance is comparable to the original function interfaces when the proxy does not change with the request address.
2024-08-24 12:46:01 +02:00
Sniper91 21b235d033 add timeout to proxy connection reading and writing (#1791)
Co-authored-by: kalmanzhao <kalmanzhao@tencent.com>
2024-06-19 11:19:46 +02:00
Oleksandr Redko 8236f8d49a fasthttpproxy: fix doc examples 2023-08-30 14:13:49 +02:00
Pluto e181af17c7 fasthttpproxy support ipv6 (#1597)
Co-authored-by: liwengang <liwengang.zz@bytedance.com>
2023-07-21 09:55:22 +02:00
Oleksandr Redko ffdf59d04c Enable gofumpt linter; format code gofumpt -w . (#1576) 2023-06-13 15:18:59 +02:00
LeoSun 239cce45b1 format : update some codes style (#1533)
* update some codes style

* update adaptor.go and client.go

* Update fasthttpproxy/http.go

Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>

---------

Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
2023-04-04 13:48:48 -07:00
Erik Dubbelboer 9c0e39f092 Fix proxy auth bug
fixes #1513
2023-03-08 20:13:22 +01:00
Oleksandr Redko e15a810a98 docs: fix grammar issues and typos in comments (#1492) 2023-02-13 10:43:44 +08:00
Oleksandr Redko f111c7e548 Add missing fasthttp prefix in example usage (#1487) 2023-02-10 18:18:30 +08:00
Amzza0x00 f6aac906c8 Fixed an error caused of character when @ > 1 during proxy authentication (#1452)
* Fixed a error caused by more @ character during proxy authentication

* Fixed a error caused by more @ character during proxy authentication
2022-12-08 15:03:55 +08:00
Aoang a696949f6c Deprecate Go 1.15 (#1379)
* Dropping support for 1.15.

* Replaces Go 1.16 Deprecated functions

* Update test build flag

* Fix import sort and comment

* Update github.com/klauspost/compress to v1.15.9

https://github.com/klauspost/compress improved performance and changed Minimum version is 1.16, this should be the final supported release for Go 1.16 (https://github.com/klauspost/compress/commit/6d0019a95afa3221f7522d1f2eed0033b5e79470) .
2022-09-15 22:28:25 +03:00
Aoang ea6052464e Add Go 1.19 Support (#1355)
* Update Go Version to Go1.19.x And add cache

* Fix CI Line endings

* Update test CI Go Version to Go1.19.x And add cache

* Update Gosec Security Scanner CI to securego/gosec@v2.12.0

* Format comment

Go 1.19 adds support for links, lists, and clearer headings in doc comments. As part of this change, gofmt now reformats doc comments to make their rendered meaning clearer. See “Go Doc Comments” for syntax details and descriptions of common mistakes now highlighted by gofmt. As another part of this change, the new package go/doc/comment provides parsing and reformatting of doc comments as well as support for rendering them to HTML, Markdown, and text.

ref: https://tip.golang.org/doc/go1.19
ref: https://tip.golang.org/doc/comment

* Fix doc structure
2022-08-14 11:31:57 +02:00
Erik Dubbelboer 7a5afddf5b Use %v for errors and %q for strings (#1262)
Mostly in tests.
2022-04-01 18:11:16 +02:00
Aoang b85d2a274b Fix http proxy behavior (#1221)
Add Host header fix behavior
https://datatracker.ietf.org/doc/html/rfc7230#section-5.4
2022-02-18 10:52:19 +01:00
Erik Dubbelboer e9db537178 Use %w to wrap errors (#1175) 2021-12-13 09:41:34 +01:00
Erik Dubbelboer 0263cae5a2 Fix FasthttpSocksDialer example 2021-08-14 10:28:45 +02:00
Erik Dubbelboer 87fc95849c Run go test on github actions (#1047)
* Run go test on github actions

travis-ci.org has stopped.
See also: https://github.com/curl/curl/issues/7150

Downside: github actions don't support ppc64le

* Run less

* delete .travis.yml

* Remove travis + minor lint fixes
2021-06-18 13:36:54 +02:00
peakle 1a7995ba88 format err info (#989) 2021-03-05 17:39:17 +01:00
kiyon f40ea7eb40 Improve socks proxy (#990)
* Improve documentation about DelClientCookie which related with #951.

* use proxy.FromURL to support auth
2021-03-05 17:38:59 +01:00
Erik Dubbelboer 00973e5c0a Don't use %w
We support versions of Go that don't have this yet.
2020-11-03 20:43:44 +01:00
Maxim Korolyov d7752d2a70 fixed default schema for for req url (#897) 2020-11-02 22:24:57 +01:00
Maxim Korolyov 9697ccb834 Added httpproxy v2 (#889)
* httpproxy v2 with improved auth barrier storage and full https proxy support

* fixed package name

* moved back the env proxy
2020-10-29 21:05:59 +01:00
Maxim Korolyov 4eac1ae470 Added proxy from env support (#885)
* added proxy from env support

* fixed package name

* fixed err wrapping

* evoid 2 err wrapping in the same format
2020-10-25 14:46:54 +01:00
Vitali Pikulik 56775f4d9f tryDial timeout (#881)
* Change tryDial to handle timeout correctly

* fasthttpproxy/http.go accepts timeout

* Fix example doc

Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>

* Improve import in httpproxy

* Simplify tryDial

* Cleanup

* Wait for concurrencyCh

Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
2020-10-03 09:44:36 +02:00
Erik Dubbelboer 571315f30a Only base64 the proxy auth once 2020-04-23 15:05:56 +02:00
Erik Dubbelboer 54df169029 Add fasthttpproxy.FasthttpHTTPDialer 2020-04-20 18:32:19 +02:00
Erik Dubbelboer 8b0b919f26 Fix FasthttpSocksDialer documentation 2019-09-13 21:47:26 +02:00
Erik Dubbelboer e5e21db0c3 Reuse the socks5 dialer
Fixes https://github.com/valyala/fasthttp/issues/644
2019-09-07 10:13:56 +02:00
Erik Dubbelboer 7529e6b2e5 Add SOCKS5 dialer
See: https://github.com/valyala/fasthttp/issues/161
2018-09-05 19:58:53 +03:00