30 Commits
Author SHA1 Message Date
fatedier 00e4fc4dd3 feat(client): reload plugin certificates on frpc reload (#5576)
The https2http and https2https plugins read their certificate and key
once when the proxy starts, so a certificate that an external tool renews
on disk is only picked up after the proxy itself is recreated. frpc
reload rebuilt proxies only when their configuration changed, and a
rebuild closes the work connections that are already in use.

Let the plugin own the refresh. The HTTPS plugin server keeps the active
keypair and the last refresh error in one immutable snapshot published
through an atomic pointer, so a TLS handshake only loads that pointer and
never touches the disk. Reload rereads both files, and when their bytes
match the published pair it returns without parsing or replacing
anything; otherwise it parses the pair and swaps the snapshot in. A read
or parse failure keeps the previous certificate serving and records the
error next to it.

frpc reload collects the reloadable plugins of the live proxies and
applies the new configuration inside the same reload transaction that
also serializes control handoff, so a reload that races a reconnect
still refreshes the plugins of the published control. The certificate
files are read only after that transaction has been released. The config
store API keeps applying configuration without refreshing certificates,
because only an explicit reload may reread files. Proxy status reports a
refresh failure next to the still running proxy instead of dropping its
remote address.

No configuration field is added, and frps and the wire protocol are
unchanged. Without a reload nothing changes: certificates are still read
once at startup, generated self-signed certificates still never reload,
and a proxy whose configuration changed still goes through the existing
rebuild path.
2026-10-19 17:16:55 +08:00
kaixingsandfutrobo 4cc826e236 fix(client): write proxy protocol header in tls2raw plugin (#5362)
Co-authored-by: futrobo <futrobo@163.com>
2026-06-22 23:08:50 +08:00
fatedier a88e0e9a49 refactor: clean up code (#5308) 2026-05-12 11:13:50 +08:00
fatedier cef71fb949 plugin/http_proxy: fix fragmented CONNECT method detection and add read deadline (#5296) 2026-04-27 02:30:29 +08:00
fatedier 410c4861c4 update Release.md (#5295) 2026-04-27 01:31:10 +08:00
fatedier c23894f156 fix: validate CA cert parsing and add missing ReadHeaderTimeout (#5205)
- pkg/transport/tls.go: check AppendCertsFromPEM return value and
  return clear error when CA file contains no valid PEM certificates
- pkg/plugin/client/http2http.go: set ReadHeaderTimeout to 60s to
  match other plugins and prevent slow header attacks
- pkg/plugin/client/http2https.go: same ReadHeaderTimeout fix
2026-03-06 17:59:41 +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 3c8d648ddc vnet: fix issues (#4771) 2025-04-27 15:46:22 +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 b4d5d8c756 plugin https2http&https2https: return 421 if host not match sni (#4323) 2024-07-09 10:50:16 +08:00
fatedier 939c490768 Add http2http client plugin with hostHeaderRewrite and requestHeaders support (#4275) 2024-06-12 17:30:10 +08:00
fatedier f0442d0cd5 plugin: fix http2 not enabled for https2http and https2https plugin (#4230) 2024-05-21 11:26:52 +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 518ca2ceb2 ReverseProxy: use Rewrite to replace Director (#4005)
* display go version in make

* ReverseProxy: use Rewrite to replace Director
2024-02-19 21:04:29 +08:00
fatedier 69ae2b0b69 optimize some code (#3801) 2023-11-27 15:47:49 +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 7cd02f5bd8 add e2e tests for v1 config (#3608) 2023-09-13 16:32:39 +08:00
fatedier c95311d1a0 support yaml/json/toml configuration format, make ini deprecated (#3599) 2023-09-06 10:18:02 +08:00
fatedier 46ff40543a update github actions (#3538) 2023-07-21 10:30:46 +08:00
fatedier 555db9d272 format import package name (#3455) 2023-05-29 14:10:34 +08:00
fatedier 4915852b9c use constant time comparison (#3452) 2023-05-29 00:27:27 +08:00
fatedier 9d077b02cf lint by golangci-lint (#3080) 2022-08-29 01:02:53 +08:00
fatedier 5b8b145577 Use auto generated certificates if plugin_key_path and plugin_crt_path are empty for plugin https2https and https2http. (#2968) 2022-06-05 17:15:28 +08:00
kekeimiku 0cee1877e3 refactor: move from io/ioutil to io and os package (#2592) 2021-09-29 10:33:57 +08:00
Blizardandtanghuafa 3dd888a9ea fix: stuct name typo (#2458)
Co-authored-by: tanghuafa <tanghuafa@bytedance.com>
2021-06-24 16:33:52 +08:00
Kevin Crawley 52d5c9e25b initial commit for https2https plugin (#2201) 2021-01-27 13:14:16 +08:00
fatedier 3fbdea0f6b rename models to pkg (#2005) 2020-09-23 13:49:14 +08:00