Commit Graph

51 Commits

Author SHA1 Message Date
ginuerzh 95874c53f5 fix: add status field to service list/detail APIs, unify observeStats retry pattern, fix router bugs
- api: add fillServiceStatus helper and call it from getServiceList/getService
  so status field appears in service list and detail API responses
- observeStats: unify retry pattern across all 9 handlers (http, http2, masque,
  relay, router, socks4, socks5, tungo, tunnel) — buffer events on failure,
  continue to skip fresh collection, clear on success; fix event-loss bug
  where interim events were dropped during retry cycles
- handler/router: check WriteTo/Write return errors in associate.go and
  entrypoint.go; fix DelConnector and ConnectorPool.Del using RLock instead
  of Lock (write under read lock); remove unused fields t and cancel
2026-06-03 22:12:08 +08:00
ginuerzh e543c0b0fd fix(handler/http2): apply traffic limiter + stats to forward proxy path, decouple auth I/O, add idle timeout
- Wrap non-CONNECT upstream with traffic_wrapper and stats_wrapper (was only on CONNECT path)
- Write 503 error response on forwardRequest failure instead of silent connection close
- Decouple resp.Header from w.Header() to prevent metadata header leakage/doubling in 407 responses
- Return pipeTo signal from authenticate instead of dialing inline (matches http handler pattern)
- Add idleTimeout metadata field and pass to xnet.Pipe for CONNECT tunnels
- Add 4 tests for probe resistance host forwarding and knock bypass
2026-05-30 20:06:56 +08:00
ginuerzh 6ccaae0573 refactor(handler/http2): split handler into 3 focused files with 52 tests
Extract authenticate/probe-resistance to auth.go and roundTrip/forwarding
to proxy.go, following the handler/http/ pattern. Export sentinel errors
(ErrAuthFailed, ErrWrongConnType) for precise test assertions. Fix
flushWriter panic recovery to handle non-string/non-error panics. Default
HTTPS port to 443 when no port is specified in the Host header.
2026-05-30 18:01:19 +08:00
ginuerzh c246a1d4fa feat(handler/http,http2): support comma-separated hostnames in probeResistance knock
Knock previously accepted a single hostname. Now it accepts multiple
comma-separated hostnames; probe resistance is bypassed if the request
hostname matches any entry in the list. Matching is case-insensitive
and whitespace around entries is trimmed.
2026-05-28 23:20:27 +08:00
ginuerzh a69a759e17 tunnel: add multiple entrypoints 2025-10-09 22:32:03 +08:00
ginuerzh c7d16962ec add service option for plugin 2025-08-29 23:36:31 +08:00
ginuerzh b597467858 add context for conn 2025-08-04 19:29:38 +08:00
ginuerzh f71351f5ef add interface xnet.SrcAddr/DstAddr 2025-08-03 10:15:53 +08:00
ginuerzh db21de831a fix xnet.Pipe 2025-08-01 23:00:50 +08:00
ginuerzh 3bbc10796c http2: added non-connect request support 2025-07-30 10:06:52 +08:00
ginuerzh 208d18125c replace xnet.Transport by xnet.Pipe 2025-07-28 20:52:15 +08:00
ginuerzh d9a2f44a78 add src field for logger and recorder 2025-07-02 21:35:02 +08:00
ginuerzh fc12e33786 router handler: add cache for sd service 2025-02-09 16:16:44 +08:00
ginuerzh 379d9a73ad service: add limiter.scope option 2025-01-20 23:22:58 +08:00
ginuerzh 06d993023f add traffic reset for stats 2024-12-24 20:11:22 +08:00
ginuerzh fcb54bd576 fix observer for http2 2024-12-16 20:48:11 +08:00
ginuerzh 79b6b9138e add limiterRefreshInterval option for limiter 2024-11-14 20:16:09 +08:00
ginuerzh a0cbee8817 use http.transport for non-connect http tunnel 2024-10-17 21:57:20 +08:00
ginuerzh c42a44abb6 add sniffer utility 2024-10-02 22:51:23 +08:00
ginuerzh 3c8add4b82 add traffic sniffing for handler 2024-09-27 15:55:28 +08:00
ginuerzh e22aa91571 add route for recorder 2024-09-24 20:20:15 +08:00
ginuerzh b39aa63f75 add clientIP for handler recorder object 2024-09-15 18:28:24 +08:00
ginuerzh f681f7aa03 update handler recorder object 2024-09-15 10:51:23 +08:00
ginuerzh 69455ace9d add handler recorder 2024-09-14 23:21:25 +08:00
ginuerzh 31c482c649 add scope param for traffic limiter 2024-08-31 09:30:04 +08:00
ginuerzh 4a4c64cc66 fix host parsing 2024-07-10 22:57:49 +08:00
ginuerzh c1d0887a9b add port range support for service 2024-07-08 22:38:21 +08:00
ginuerzh 22537ff0d2 mv observer/stats to core 2024-07-04 23:05:35 +08:00
ginuerzh 6d819a0c06 add observePeriod option for observer 2024-06-13 21:22:29 +08:00
ginuerzh 3d2a7b7d3b move x/internal/ctx to x/ctx 2024-01-30 18:19:39 +08:00
ginuerzh c959fc2f73 add observer 2024-01-03 20:55:06 +08:00
ginuerzh 88cc6ff4d5 add traffic limiter for proxy handler 2023-11-18 18:28:09 +08:00
ginuerzh 836cf6eade add network for bypass 2023-09-30 17:51:55 +08:00
ginuerzh ddc3c9392e add client addr for auth plugin 2023-09-21 19:59:56 +08:00
ginuerzh 1760151500 add HTTP plugin 2023-09-20 22:56:43 +08:00
ginuerzh 674a70cd23 add client ID for plugin service 2023-09-19 22:31:37 +08:00
Charles Xu 7833ca8bc6 replace deprecated method 2023-09-18 10:16:48 +00:00
ginuerzh 46db8480fa add timeout for sniffing 2023-05-21 15:47:51 +08:00
ginuerzh 32c8188351 add plugin system 2023-04-18 20:52:56 +08:00
ginuerzh 3e35a7b761 add authBasicRealm metadata for HTTP/HTTP2 handler 2023-01-31 13:42:55 +08:00
ginuerzh c1b2d3b086 add http3 reverse proxy 2022-11-12 17:14:11 +08:00
ginuerzh a1255e52d8 fix proxy protocol 2022-09-28 11:47:56 +08:00
ginuerzh 1a1c038fd7 update chain route 2022-09-20 11:48:51 +08:00
ginuerzh 01d7dc77c6 update limiter 2022-09-14 20:00:35 +08:00
ginuerzh a04c8b45f3 update selector 2022-09-04 13:24:32 +08:00
ginuerzh f3f3acd4e1 more fine-grained log level 2022-08-18 11:34:57 +08:00
ginuerzh 1444ebc1ee add metrics 2022-04-05 17:56:36 +08:00
ginuerzh a3346ad246 add pkgs from core 2022-04-04 12:44:35 +08:00
ginuerzh 36947bcbd9 fix imports 2022-03-16 20:06:34 +08:00
ginuerzh 073ad80ce4 remove unnecessary conn 2022-03-15 15:45:22 +08:00