Commit Graph

52 Commits

Author SHA1 Message Date
fatedier cf396563f8 client/proxy: unify work conn wrapping across all proxy types (#5212)
golangci-lint / lint (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled
* client/proxy: extract wrapWorkConn to deduplicate UDP/SUDP connection wrapping

Move the repeated rate-limiting, encryption, and compression wrapping
logic from UDPProxy and SUDPProxy into a shared BaseProxy.wrapWorkConn
method, reducing ~18 lines of duplication in each proxy type.

* client/proxy: unify work conn wrapping with pooled compression for all proxy types

Refactor wrapWorkConn to accept encKey parameter and return
(io.ReadWriteCloser, recycleFn, error), enabling HandleTCPWorkConnection
to reuse the same limiter/encryption/compression pipeline.

Switch all proxy types from WithCompression to WithCompressionFromPool.
TCP non-plugin path calls recycleFn via defer after Join; plugin and
UDP/SUDP paths skip recycle (objects are GC'd safely, per golib contract).
2026-03-07 01:33:37 +08:00
fatedier c62a1da161 fix: close connections on error paths to prevent resource leaks (#5202)
Fix connection leaks in multiple error paths across client and server:
- server/proxy/http: close tmpConn when WithEncryption fails
- client/proxy: close localConn when ProxyProtocol WriteTo fails
- client/visitor/sudp: close visitorConn on all error paths in getNewVisitorConn
- client/visitor/xtcp: close tunnelConn when WithEncryption fails
- client/visitor/xtcp: close lConn when NewKCPConnFromUDP fails
- pkg/plugin/client/unix_domain_socket: close localConn and connInfo.Conn when WriteTo fails, close connInfo.Conn when DialUnix fails
- pkg/plugin/client/tls2raw: close tlsConn when Handshake or Dial fails
2026-03-06 15:18:38 +08:00
fatedier 7526d7a69a refactor: separate auth config from runtime and defer token resolution (#5105)
golangci-lint / lint (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled
2025-12-25 00:53:08 +08:00
fatedier 3fa76b72f3 add proxy protocol support for UDP proxies (#4810) 2025-06-25 11:40:23 +08:00
fatedier a78814a2e9 virtual-net: initial (#4751) 2025-04-16 16:05:54 +08:00
fatedier 69cc422edf client plugin: added plugin tls2raw (#4341) 2024-07-25 14:28:17 +08:00
fatedier dd7e2e8473 return 504 instead of 404 for proxy type http request timeout (#4151) 2024-04-11 20:19:08 +08:00
fatedier 590ccda677 fix x-forwarded-for header (#4111) 2024-03-28 16:47:27 +08:00
fatedier 43ba7bd338 use new log package (#4054) 2024-03-12 13:58:53 +08:00
fatedier d5b41f1e14 sshTunnelGateway refactor (#3784) 2023-11-22 14:35:37 +08:00
fatedier 5e70d5bee0 code optimization (#3625) 2023-09-20 15:18:50 +08:00
fatedier c95311d1a0 support yaml/json/toml configuration format, make ini deprecated (#3599) 2023-09-06 10:18:02 +08:00
fatedier e9e12cf888 fix incorrect use of snappy pool (#3549) 2023-07-25 21:31:26 +08:00
fatedier efcc028a3d fix a race condition issue (#3536) 2023-07-20 22:32:32 +08:00
fatedier cceab7e1b1 client/proxy: simplify the code (#3465) 2023-05-30 22:18:56 +08:00
fatedier 9aef3b9944 adjust code style about config (#3464) 2023-05-30 20:25:22 +08:00
fatedier 555db9d272 format import package name (#3455) 2023-05-29 14:10:34 +08:00
fatedier c71efde303 refactor the code related to xtcp (#3449) 2023-05-28 16:50:43 +08:00
fatedier 8f394dba27 trace log adds join errors (#3352) 2023-03-11 19:34:06 +08:00
fatedier fccd518512 frpc: add parameter nat_hole_server_addr (#3351) 2023-03-10 15:51:14 +08:00
Craig O'Donnell aa31d7ad0b support bandwidth_limit set by server plugin (#3271)
* support bandwidth_limit set by server plugin

* limiter at proxy level

* bandwidth_limit_mode

* updates tests for bandwidth_limit_mode default

* bandwidth_limit_mode as string

* add checkForSrv for bandwidth_limit_mode

* bandwidth_limit flags for sub cmds

* gci write
2023-02-09 00:38:36 +08:00
fatedier 9d077b02cf lint by golangci-lint (#3080) 2022-08-29 01:02:53 +08:00
fatedier c652b8ef07 fix ipv6 address parsing (#2978) 2022-06-14 14:24:34 +08:00
cui fliter 915d9f4c09 fix some typos (#2882)
Signed-off-by: cuishuang <imcusg@gmail.com>
2022-04-02 17:35:51 +08:00
fatedier 10100c28d9 client: add dial_server_timeout (#2805) 2022-02-19 16:49:21 +08:00
fatedier 6194273615 use net.JoinHostPort instead of fmt.Sprintf (#2791) 2022-02-09 15:19:35 +08:00
fatedier 70f4caac23 move dial functions into golib (#2767) 2022-01-20 20:03:07 +08:00
Blizard ea568e8a4f refactor: refine pkg net utils (#2720)
* refactor: refine pkg net utils

* fix: x

Co-authored-by: blizard863 <760076784@qq.com>
2021-12-28 21:14:57 +08:00
kekeimiku 0cee1877e3 refactor: move from io/ioutil to io and os package (#2592) 2021-09-29 10:33:57 +08:00
fatedier fe4e9b55f3 update github.com/pires/go-proxyproto to v0.5.0 2021-06-21 19:35:52 +08:00
iikira 0a2384a283 fix XTCP error handling (#2273) 2021-03-03 20:54:46 +08:00
yuyulei 3621aad1c1 Reconstruct config (#2098)
* refactoring config

* Update by comments
2021-01-26 11:31:08 +08:00
fatedier 3fbdea0f6b rename models to pkg (#2005) 2020-09-23 13:49:14 +08:00
fatedier c9fe23eb10 more e2e tests (#1845) 2020-09-07 14:57:23 +08:00
fatedier 8b75b8b837 fix by golint (#1822) 2020-05-24 17:48:37 +08:00
Tank d193519329 feat: Support user specify udp packet size in config (#1794) 2020-05-07 17:47:36 +08:00
Tank 4797136965 feat: support sudp proxy (#1730) 2020-04-22 21:37:45 +08:00
fatedier 1db091b381 tcp multiplexing over http connect tunnel 2020-03-05 21:47:49 +08:00
fatedier 42014eea23 improve xtcp, fix #1585 2020-01-03 11:39:44 +08:00
fatedier 91e46a2c53 support server plugin feature 2019-12-23 20:00:04 +08:00
fatedier 12cc53d699 update bandwidth_limit 2019-11-09 01:13:30 +08:00
fatedier 6da093a402 support bandwith limit for one proxy 2019-11-03 01:20:49 +08:00
fatedier 649f47c345 change log method 2019-10-12 20:13:12 +08:00
fatedier fdc6902a90 proxy protocol: fix detect method for IPV4 and IPV6 2019-08-26 11:13:33 +08:00
Tyler Compton 666f122a72 Pass client configuration as an argument
The ClientCommonConf, configuration file path, and server UDP port are
now passed around as arguments instead of being shared between
components as global variables. This allows for multiple clients to
exist in the same process, and allows client.Session to be used as a
library more easily.
2019-08-20 14:08:01 -07:00
fatedier 6a1f15b25e support proxy protocol in unix_domain_socket 2019-04-25 12:01:57 +08:00
fatedier b7a73d3469 support proxy protocol for type http 2019-04-10 10:51:01 +08:00
fatedier 9c4ec56491 support proxy protocol 2019-03-29 19:01:18 +08:00
fatedier e691a40260 improve the stability of xtcp 2019-03-11 15:53:58 +08:00
fatedier 3df27b9c04 xtcp: wrap yamux on kcp connections 2019-03-05 11:18:17 +08:00