[PR #5299] Add Auto Transport Mode with IPv4/IPv6 probing and WSS support #5236

Open
opened 2026-05-05 14:57:15 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fatedier/frp/pull/5299
Author: @ming79486
Created: 4/28/2026
Status: 🔄 Open

Base: devHead: dev


📝 Commits (9)

  • 4077c1e feat: add auto transport selection
  • 37f3d25 docs: simplify README for auto transport edition
  • 13cca68 fix: harden auto transport config and validation
  • 664a7cf docs: add minimal auto transport configs
  • 83b6415 feat: probe auto transport over resolved ip families
  • 4d2dace docs: update README for auto transport examples
  • f2c69b4 fix: support wss auto transport over tls
  • 305818b fix: harden auto transport audit issues
  • 861c710 merge upstream dev and resolve PR 5299 conflicts

📊 Changes

53 files changed (+5592 additions, -1610 deletions)

View changed files

📝 README.md (+22 -1369)
README_zh.md (+0 -126)
📝 client/api_router.go (+1 -0)
client/auto_transport.go (+1177 -0)
client/auto_transport_integration_test.go (+270 -0)
client/auto_transport_strategy.go (+136 -0)
📝 client/control.go (+58 -2)
📝 client/control_session.go (+48 -16)
📝 client/service.go (+46 -3)
📝 client/service_test.go (+756 -0)
conf/frpc_auto.toml (+40 -0)
📝 conf/frpc_full_example.toml (+25 -1)
conf/frps_auto.toml (+31 -0)
📝 conf/frps_full_example.toml (+12 -0)
doc/auto_transport.md (+326 -0)
📝 pkg/config/legacy/client.go (+17 -2)
📝 pkg/config/legacy/conversion.go (+30 -0)
📝 pkg/config/legacy/server.go (+8 -0)
📝 pkg/config/load.go (+11 -2)
📝 pkg/config/load_test.go (+244 -0)

...and 33 more files

📄 Description

WHY

This PR adds Auto Transport Mode for frp, allowing frpc and frps to negotiate and select the best transport protocol when both sides set transport.protocol = "auto".

Changes

  • Add client-driven auto transport selection across tcp, kcp, quic, websocket, and wss.
  • Add bootstrap negotiation, server endpoint advertisement, candidate filtering, probing, scoring, and selected transport validation.
  • Add auto transport config parsing, defaults, validation, and backward-compatible legacy config handling.
  • Support the fixed endpoint model:
    • TCP: bindPort
    • KCP: kcpBindPort
    • QUIC: quicBindPort
    • WebSocket/WSS: bindPort
  • Add domain resolution probing for both IPv4 and IPv6 addresses, selecting the fastest usable address/protocol pair.
  • Fix WSS handling by unwrapping TLS first and then processing the WebSocket transport.
  • Add metrics, status reporting, logs, and tests for auto transport behavior.
  • Add minimal auto transport example configs for frps and frpc.

Notes

  • Auto mode is only active when both client and server use transport.protocol = "auto".
  • If transport.proxyURL is configured on the client, candidates are restricted to tcp.
  • QUIC port is configured only on frps; frpc learns it from server advertisement during bootstrap.

Tested

  • go test ./server -count=1
  • go test ./client ./server ./pkg/config/v1 ./pkg/config/v1/validation -count=1
  • go test ./pkg/config ./pkg/config/v1 ./pkg/config/v1/validation -count=1

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fatedier/frp/pull/5299 **Author:** [@ming79486](https://github.com/ming79486) **Created:** 4/28/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `dev` --- ### 📝 Commits (9) - [`4077c1e`](https://github.com/fatedier/frp/commit/4077c1e95dcd0652e964c44d31cf582ff78141da) feat: add auto transport selection - [`37f3d25`](https://github.com/fatedier/frp/commit/37f3d252775de39cc56b5f0d27e6ed5d5cf88545) docs: simplify README for auto transport edition - [`13cca68`](https://github.com/fatedier/frp/commit/13cca686542aa08065461d2b0e2cc708aaf4c1e4) fix: harden auto transport config and validation - [`664a7cf`](https://github.com/fatedier/frp/commit/664a7cff19a4c2af74d5ff9e88285e6b9d5180b2) docs: add minimal auto transport configs - [`83b6415`](https://github.com/fatedier/frp/commit/83b64153b5cb062337c723b3d656d09ff0230901) feat: probe auto transport over resolved ip families - [`4d2dace`](https://github.com/fatedier/frp/commit/4d2dace116d20c5b1d8e387ffdd810416741418e) docs: update README for auto transport examples - [`f2c69b4`](https://github.com/fatedier/frp/commit/f2c69b4b633244f59977d77fbbebf617fdc09f24) fix: support wss auto transport over tls - [`305818b`](https://github.com/fatedier/frp/commit/305818bdbd8eaa3580173fa649825660b172028a) fix: harden auto transport audit issues - [`861c710`](https://github.com/fatedier/frp/commit/861c710bdb046e942341cfa80a9a7bcdb0ae40d2) merge upstream dev and resolve PR 5299 conflicts ### 📊 Changes **53 files changed** (+5592 additions, -1610 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+22 -1369) ➖ `README_zh.md` (+0 -126) 📝 `client/api_router.go` (+1 -0) ➕ `client/auto_transport.go` (+1177 -0) ➕ `client/auto_transport_integration_test.go` (+270 -0) ➕ `client/auto_transport_strategy.go` (+136 -0) 📝 `client/control.go` (+58 -2) 📝 `client/control_session.go` (+48 -16) 📝 `client/service.go` (+46 -3) 📝 `client/service_test.go` (+756 -0) ➕ `conf/frpc_auto.toml` (+40 -0) 📝 `conf/frpc_full_example.toml` (+25 -1) ➕ `conf/frps_auto.toml` (+31 -0) 📝 `conf/frps_full_example.toml` (+12 -0) ➕ `doc/auto_transport.md` (+326 -0) 📝 `pkg/config/legacy/client.go` (+17 -2) 📝 `pkg/config/legacy/conversion.go` (+30 -0) 📝 `pkg/config/legacy/server.go` (+8 -0) 📝 `pkg/config/load.go` (+11 -2) 📝 `pkg/config/load_test.go` (+244 -0) _...and 33 more files_ </details> ### 📄 Description ### WHY <!-- author to complete --> This PR adds Auto Transport Mode for frp, allowing `frpc` and `frps` to negotiate and select the best transport protocol when both sides set `transport.protocol = "auto"`. ### Changes - Add client-driven auto transport selection across `tcp`, `kcp`, `quic`, `websocket`, and `wss`. - Add bootstrap negotiation, server endpoint advertisement, candidate filtering, probing, scoring, and selected transport validation. - Add auto transport config parsing, defaults, validation, and backward-compatible legacy config handling. - Support the fixed endpoint model: - TCP: `bindPort` - KCP: `kcpBindPort` - QUIC: `quicBindPort` - WebSocket/WSS: `bindPort` - Add domain resolution probing for both IPv4 and IPv6 addresses, selecting the fastest usable address/protocol pair. - Fix WSS handling by unwrapping TLS first and then processing the WebSocket transport. - Add metrics, status reporting, logs, and tests for auto transport behavior. - Add minimal auto transport example configs for `frps` and `frpc`. ### Notes - Auto mode is only active when both client and server use `transport.protocol = "auto"`. - If `transport.proxyURL` is configured on the client, candidates are restricted to `tcp`. - QUIC port is configured only on `frps`; `frpc` learns it from server advertisement during bootstrap. ### Tested - `go test ./server -count=1` - `go test ./client ./server ./pkg/config/v1 ./pkg/config/v1/validation -count=1` - `go test ./pkg/config ./pkg/config/v1 ./pkg/config/v1/validation -count=1` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror added the
pull-request
label 2026-05-05 14:57:15 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#5236
No description provided.