230 Commits

Author SHA1 Message Date
fatedier 68509f5d44 Add frps proxy traffic API v2 (#5398)
golangci-lint / lint (push) Waiting to run
2026-07-08 02:05:28 +08:00
fatedier 5cd722b177 feat: add system prune API v2 (#5395)
golangci-lint / lint (push) Has been cancelled
2026-07-07 13:00:53 +08:00
fatedier 5876beceac feat: add system info API v2 (#5394)
golangci-lint / lint (push) Has been cancelled
2026-07-07 02:00:44 +08:00
fatedier ae1c0504ec feat(dashboard): add v2 client detail status (#5381)
golangci-lint / lint (push) Has been cancelled
2026-06-26 21:15:30 +08:00
fatedier 9bde0b07de feat: paginate dashboard clients and proxies via API v2 (#5354)
golangci-lint / lint (push) Has been cancelled
Move the frps dashboard Clients and Proxies views to the paginated
/api/v2/clients and /api/v2/proxies endpoints instead of fetching all
data at once, and extend server-side proxy search so the search box
keeps working under pagination.

Frontend:
- Add V2Envelope/V2Page types and getV2 HTTP helper to api/http.ts
- Add v2 paginated fetch functions to api/client.ts and api/proxy.ts
- Add ClientV2Info and ProxyV2Info types for v2 API responses
- Rewrite Clients.vue with server-side pagination, status/user search
  filtering, and ElPagination component
- Rewrite Proxies.vue with server-side pagination, type tabs, client
  dropdown filter, and a search box that passes q to the API
- Default page size 10, selectable sizes [10, 20, 50, 100]

Backend:
- Extend /api/v2/proxies q matching to also cover online proxy spec
  fields: TCP/UDP remotePort and HTTP/HTTPS/TCPMux customDomains and
  subdomain, so dashboard search no longer needs to scan every page
- Add controller_v2 tests for the new spec-field matching
2026-06-03 14:08:45 +08:00
fatedier 503afe78b7 feat: add dashboard API v2 pagination endpoints (#5351)
golangci-lint / lint (push) Has been cancelled
2026-06-01 20:09:25 +08:00
fatedier 0773938d70 feat: bridge mixed wire protocol SUDP payloads (#5347)
SUDP payload codec follows transport wireProtocol; same-protocol v1/v1 and v2/v2 keep raw join; only mixed proxy/visitor protocols use message-aware bridge; no new capability/selection field.
2026-06-01 16:22:34 +08:00
fatedier 9bacce22a2 feat: use wire v2 framing for XTCP NatHoleSid (#5343) 2026-06-01 16:22:34 +08:00
fatedier 7f8d68b666 feat: use wire v2 framing for UDP workConn payload (#5340) 2026-06-01 16:22:34 +08:00
fatedier a88e0e9a49 refactor: clean up code (#5308)
golangci-lint / lint (push) Has been cancelled
2026-05-12 11:13:50 +08:00
fatedier 8666e3643f protocol: add AEAD encryption negotiation to v2 wire control channel (#5304)
golangci-lint / lint (push) Has been cancelled
2026-05-06 10:43:47 +08:00
fatedier e9464919d1 protocol: add v2 wire protocol with binary framing and capability negotiation (#5294) 2026-04-27 00:17:00 +08:00
fatedier c7ac12ea0f server/group: refactor with shared abstractions and fix concurrency issues (#5222)
golangci-lint / lint (push) Has been cancelled
* server/group: refactor group package with shared abstractions and fix concurrency issues

Extract common patterns into reusable components:
- groupRegistry[G]: generic concurrent map for group lifecycle management
- baseGroup: shared plumbing for listener-based groups (TCP, HTTPS, TCPMux)
- Listener: unified virtual listener replacing 3 identical implementations

Fix concurrency issues:
- Stale-pointer race: isCurrent check + errGroupStale + controller retry loops
- Worker generation safety: pass realLn and acceptCh as params instead of reading mutable fields
- Connection leak: close conn on worker panic recovery path
- ABBA deadlock in HTTP UnRegister: consistent lock ordering (group.mu -> registry.mu)
- Round-robin overflow in HTTPGroup: use unsigned modulo

Add unit tests (17 tests) for registry, listener, and baseGroup.
Add TCPMux group load balancing e2e test.

* server/group: replace tautological assertion with require.NotPanics

* server/group: remove blank line between doc comment and type declaration
2026-03-08 18:57:21 +08:00
fatedier 764a626b6e server/control: deduplicate close-proxy logic and UserInfo construction (#5218)
Extract closeProxy() helper to eliminate duplicated 4-step cleanup
sequence (Close, PxyManager.Del, metrics, plugin notify) between
worker() and CloseProxy().

Extract loginUserInfo() helper to eliminate 4 repeated plugin.UserInfo
constructions using LoginMsg fields.

Optimize worker() to snapshot and clear the proxies map under lock,
then perform cleanup outside the lock to reduce lock hold time.
2026-03-08 00:02:14 +08:00
Oleksandr Redko c2454e7114 refactor: fix modernize lint issues (#5215) 2026-03-07 23:10:19 +08:00
fatedier 017d71717f server: introduce SessionContext to encapsulate NewControl parameters (#5217)
golangci-lint / lint (push) Has been cancelled
Replace 10 positional parameters in NewControl() with a single
SessionContext struct, matching the client-side pattern. This also
eliminates the post-construction mutation of clientRegistry and
removes two TODO comments.
2026-03-07 20:17:00 +08:00
Oleksandr Redko bd200b1a3b fix: typos in comments, tests, functions (#5216) 2026-03-07 18:43:04 +08:00
fatedier c70ceff370 fix: three high-severity bugs across nathole, proxy, and udp modules (#5214)
- pkg/nathole: add RLock when reading clientCfgs map in PreCheck path
  to prevent concurrent map read/write crash
- server/proxy: fix error variable shadowing in GetWorkConnFromPool
  that could return a closed connection with nil error
- pkg/util/net: check ListenUDP error before spawning goroutines
  and assign readConn to struct field so Close() works correctly
2026-03-07 13:36:02 +08:00
fatedier bb3d0e7140 deduplicate common logic across proxy, visitor, and metrics modules (#5213)
golangci-lint / lint (push) Has been cancelled
- Replace duplicate parseBasicAuth with existing httppkg.ParseBasicAuth
- Extract buildDomains helper in BaseProxy for HTTP/HTTPS/TCPMux proxies
- Extract toProxyStats helper to deduplicate ProxyStats construction
- Extract startVisitorListener helper in BaseProxy for STCP/SUDP proxies
- Extract acceptLoop helper in BaseVisitor for STCP/XTCP visitors
2026-03-07 12:00:27 +08:00
fatedier d644593342 server/proxy: simplify HTTPS and TCPMux proxy domain registration (#5208)
Consolidate the separate custom-domain loop and subdomain block into a
single unified loop, matching the pattern already applied to HTTPProxy
in PR #5207. No behavioral change.
2026-03-06 21:31:29 +08:00
fatedier 427c4ca3ae server/proxy: simplify HTTP proxy domain registration by removing duplicate loop (#5207)
The Run() method had two nearly identical loop blocks for registering
custom domains and subdomain, with the same group/non-group registration
logic copy-pasted (~30 lines of duplication).

Consolidate by collecting all domains into a single slice first, then
iterating once with the shared registration logic. Also fixes a minor
inconsistency where the custom domain block used routeConfig.Domain in
CanonicalAddr but the subdomain block used tmpRouteConfig.Domain.
2026-03-06 21:17:30 +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 f22f7d539c server/group: fix port leak and incorrect Listen port in TCPGroup (#5200)
golangci-lint / lint (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled
Fix two bugs in TCPGroup.Listen():
- Release acquired port when net.Listen fails to prevent port leak
- Use realPort instead of port for net.Listen to ensure consistency
  between port manager records and actual listening port
2026-03-06 02:25:47 +08:00
fatedier 462c987f6d pkg/msg: change UDPPacket.Content from string to []byte to avoid redundant base64 encode/decode (#5198) 2026-03-06 01:38:24 +08:00
fatedier fbeb6ca43a refactor: restructure API packages into client/http and server/http with typed proxy/visitor models (#5193)
golangci-lint / lint (push) Has been cancelled
2026-03-04 17:38:43 +08:00
fatedier 01997deb98 add persistent proxy/visitor store with CRUD API and web UI (#5188) 2026-03-02 01:09:59 +08:00
fatedier 519368b1fd server/api: fix DeleteProxies endpoint returning empty response instead of JSON (#5163)
golangci-lint / lint (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled
2026-02-06 11:22:34 +08:00
fatedier 266c492b5d web/frps: add detailed client and proxy views with enhanced tracking (#5144)
golangci-lint / lint (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled
2026-01-31 02:18:35 +08:00
fatedier ed13141c56 refactor: separate API handlers into dedicated packages with improved HTTP utilities (#5127)
golangci-lint / lint (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled
2026-01-14 19:50:55 +08:00
fatedier 1245f8804e server: replace client metadata with IP address in registry (#5118) 2026-01-09 11:07:19 +08:00
fatedier 479e9f50c2 web/frpc: refactor dashboard with improved structure and API layer (#5117)
golangci-lint / lint (push) Has been cancelled
2026-01-09 00:40:51 +08:00
fatedier 36718d88e4 server: add client registry with dashboard support (#5115) 2026-01-08 20:07:14 +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 2e2802ea13 refactor: use MessageSender interface for message transporter (#5083)
golangci-lint / lint (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled
2025-12-02 11:22:48 +08:00
fatedier 1cf325bb0c https: add load balancing group support (#5032) 2025-10-28 17:37:18 +08:00
fatedier 610e5ed479 improve yamux logging (#4952)
golangci-lint / lint (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled
2025-08-25 17:52:58 +08:00
fatedier e6dacf3a67 Fix SSH tunnel gateway binding address issue #4900 (#4902)
golangci-lint / lint (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled
- Fix SSH tunnel gateway incorrectly binding to proxyBindAddr instead of bindAddr
- This caused external connections to fail when proxyBindAddr was set to 127.0.0.1
- SSH tunnel gateway now correctly binds to bindAddr for external accessibility
- Update Release.md with bug fix description

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2025-07-28 15:19:56 +08:00
fatedier 61330d4d79 Update quic-go dependency from v0.48.2 to v0.53.0 (#4862)
golangci-lint / lint (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled
- Update go.mod to use github.com/quic-go/quic-go v0.53.0
- Replace quic.Connection interface with *quic.Conn struct
- Replace quic.Stream interface with *quic.Stream struct
- Update all affected files to use new API:
  - pkg/util/net/conn.go: Update QuicStreamToNetConn function and wrapQuicStream struct
  - server/service.go: Update HandleQUICListener function parameter
  - client/visitor/xtcp.go: Update QUICTunnelSession struct field
  - client/connector.go: Update defaultConnectorImpl struct field

Fixes #4852

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2025-07-01 18:56:46 +08:00
fatedier 3c8d648ddc vnet: fix issues (#4771) 2025-04-27 15:46:22 +08:00
fatedier e0dd947e6a frps: release resources in service.Close() (#4667) 2025-02-12 12:22:57 +08:00
ubergeek77 8b86e1473c Fix ports not being released on Service.Close() (#4666) 2025-02-12 11:28:30 +08:00
Jeb.Wang 450b8393bc Fix goroutine leaks
golangci-lint / lint (push) Has been cancelled
* Fix goroutine leaks
2025-01-16 10:50:57 +08:00
Gabriel Marin 092e5d3f94 client, pkg, server, test: replaced 'interface{}' with 'any' (#4611) 2025-01-02 11:24:08 +08:00
fatedier f7a06cbe61 use go1.23 (#4495) 2024-10-17 17:22:41 +08:00
fatedier e81b36c5ba support responseHeaders.set for proxy type http (#4192) 2024-04-29 15:53:45 +08:00
fatedier ee3892798d change default value of heartbeat interval and timeout when tcpmux enabled (#4186) 2024-04-28 20:48:44 +08:00
fatedier c1893ee1b4 adjust arm compilation configuration (#4181) 2024-04-25 13:08:41 +08:00
fatedier f3a71bc08f show tcpmux proxies on the frps dashboard (#4152) 2024-04-11 22:40:42 +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 f16ef00975 set CompatibilityMode for android (#4091) 2024-03-21 17:34:09 +08:00