Skip to content

Commit e649692

Browse files
authored
Merge pull request #4253 from fatedier/dev
bump version
2 parents 4e8e9e1 + 77990c3 commit e649692

15 files changed

+63
-81
lines changed

.github/workflows/build-and-push-image.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build Image and Publish to Dockerhub & GPR
22

33
on:
44
release:
5-
types: [ created ]
5+
types: [ published ]
66
workflow_dispatch:
77
inputs:
88
tag:
@@ -61,7 +61,7 @@ jobs:
6161
echo "TAG_FRPS_GPR=ghcr.io/fatedier/frps:${{ env.TAG_NAME }}" >> $GITHUB_ENV
6262
6363
- name: Build and push frpc
64-
uses: docker/build-push-action@v4
64+
uses: docker/build-push-action@v5
6565
with:
6666
context: .
6767
file: ./dockerfiles/Dockerfile-for-frpc

Release.md

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
### Notable Changes
2-
3-
We have optimized the heartbeat mechanism when tcpmux is enabled (enabled by default). The default value of `heartbeatInterval` has been adjusted to -1. This update ensures that when tcpmux is active, the client does not send additional heartbeats to the server. Since tcpmux incorporates its own heartbeat system, this change effectively reduces unnecessary data consumption, streamlining communication efficiency between client and server.
4-
5-
When connecting to frps versions older than v0.39.0 might encounter compatibility issues due to changes in the heartbeat mechanism. As a temporary workaround, setting the `heartbeatInterval` to 30 can help maintain stable connectivity with these older versions. We recommend updating to the latest frps version to leverage full functionality and improvements.
6-
7-
### Features
1+
### Fixes
82

9-
* Show tcpmux proxies on the frps dashboard.
10-
* `http` proxy can modify the response header. For example, `responseHeaders.set.foo = "bar"` will add a new header `foo: bar` to the response.
3+
* Fixed an issue where HTTP/2 was not enabled for https2http and https2https plugins.
4+
* Fixed the issue where the default values of INI configuration parameters are inconsistent with other configuration formats.
115

12-
### Fixes
6+
### Changes
137

14-
* When an HTTP proxy request times out, it returns 504 instead of 404 now.
8+
* Updated the default value of `transport.tcpMuxKeepaliveInterval` from 60 to 30.
9+
* On the Android platform, the Google DNS server is used only when the default DNS server cannot be obtained.

conf/frpc_full_example.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ transport.poolCount = 5
7676

7777
# Specify keep alive interval for tcp mux.
7878
# only valid if tcpMux is enabled.
79-
# transport.tcpMuxKeepaliveInterval = 60
79+
# transport.tcpMuxKeepaliveInterval = 30
8080

8181
# Communication protocol used to connect to server
8282
# supports tcp, kcp, quic, websocket and wss now, default is tcp

conf/frps_full_example.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ transport.maxPoolCount = 5
3434

3535
# Specify keep alive interval for tcp mux.
3636
# only valid if tcpMux is true.
37-
# transport.tcpMuxKeepaliveInterval = 60
37+
# transport.tcpMuxKeepaliveInterval = 30
3838

3939
# tcpKeepalive specifies the interval between keep-alive probes for an active network connection between frpc and frps.
4040
# If negative, keep-alive probes are disabled.

pkg/config/legacy/client.go

+4-20
Original file line numberDiff line numberDiff line change
@@ -345,35 +345,19 @@ func copySection(source, target *ini.Section) {
345345
}
346346

347347
// GetDefaultClientConf returns a client configuration with default values.
348+
// Note: Some default values here will be set to empty and will be converted to them
349+
// new configuration through the 'Complete' function to set them as the default
350+
// values of the new configuration.
348351
func GetDefaultClientConf() ClientCommonConf {
349352
return ClientCommonConf{
350353
ClientConfig: legacyauth.GetDefaultClientConf(),
351-
ServerAddr: "0.0.0.0",
352-
ServerPort: 7000,
353-
NatHoleSTUNServer: "stun.easyvoip.com:3478",
354-
DialServerTimeout: 10,
355-
DialServerKeepAlive: 7200,
356-
HTTPProxy: os.Getenv("http_proxy"),
357-
LogFile: "console",
358-
LogWay: "console",
359-
LogLevel: "info",
360-
LogMaxDays: 3,
361-
AdminAddr: "127.0.0.1",
362-
PoolCount: 1,
363354
TCPMux: true,
364-
TCPMuxKeepaliveInterval: 60,
365355
LoginFailExit: true,
366-
Start: make([]string, 0),
367356
Protocol: "tcp",
368-
QUICKeepalivePeriod: 10,
369-
QUICMaxIdleTimeout: 30,
370-
QUICMaxIncomingStreams: 100000,
357+
Start: make([]string, 0),
371358
TLSEnable: true,
372359
DisableCustomTLSFirstByte: true,
373-
HeartbeatInterval: 30,
374-
HeartbeatTimeout: 90,
375360
Metas: make(map[string]string),
376-
UDPPacketSize: 1500,
377361
IncludeConfigFiles: make([]string, 0),
378362
}
379363
}

pkg/config/legacy/server.go

+12-26
Original file line numberDiff line numberDiff line change
@@ -200,34 +200,20 @@ type ServerCommonConf struct {
200200
NatHoleAnalysisDataReserveHours int64 `ini:"nat_hole_analysis_data_reserve_hours" json:"nat_hole_analysis_data_reserve_hours"`
201201
}
202202

203-
// GetDefaultServerConf returns a server configuration with reasonable
204-
// defaults.
203+
// GetDefaultServerConf returns a server configuration with reasonable defaults.
204+
// Note: Some default values here will be set to empty and will be converted to them
205+
// new configuration through the 'Complete' function to set them as the default
206+
// values of the new configuration.
205207
func GetDefaultServerConf() ServerCommonConf {
206208
return ServerCommonConf{
207-
ServerConfig: legacyauth.GetDefaultServerConf(),
208-
BindAddr: "0.0.0.0",
209-
BindPort: 7000,
210-
QUICKeepalivePeriod: 10,
211-
QUICMaxIdleTimeout: 30,
212-
QUICMaxIncomingStreams: 100000,
213-
VhostHTTPTimeout: 60,
214-
DashboardAddr: "0.0.0.0",
215-
LogFile: "console",
216-
LogWay: "console",
217-
LogLevel: "info",
218-
LogMaxDays: 3,
219-
DetailedErrorsToClient: true,
220-
TCPMux: true,
221-
TCPMuxKeepaliveInterval: 60,
222-
TCPKeepAlive: 7200,
223-
AllowPorts: make(map[int]struct{}),
224-
MaxPoolCount: 5,
225-
MaxPortsPerClient: 0,
226-
HeartbeatTimeout: 90,
227-
UserConnTimeout: 10,
228-
HTTPPlugins: make(map[string]HTTPPluginOptions),
229-
UDPPacketSize: 1500,
230-
NatHoleAnalysisDataReserveHours: 7 * 24,
209+
ServerConfig: legacyauth.GetDefaultServerConf(),
210+
DashboardAddr: "0.0.0.0",
211+
LogFile: "console",
212+
LogWay: "console",
213+
DetailedErrorsToClient: true,
214+
TCPMux: true,
215+
AllowPorts: make(map[int]struct{}),
216+
HTTPPlugins: make(map[string]HTTPPluginOptions),
231217
}
232218
}
233219

pkg/config/v1/client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func (c *ClientTransportConfig) Complete() {
135135
c.ProxyURL = util.EmptyOr(c.ProxyURL, os.Getenv("http_proxy"))
136136
c.PoolCount = util.EmptyOr(c.PoolCount, 1)
137137
c.TCPMux = util.EmptyOr(c.TCPMux, lo.ToPtr(true))
138-
c.TCPMuxKeepaliveInterval = util.EmptyOr(c.TCPMuxKeepaliveInterval, 60)
138+
c.TCPMuxKeepaliveInterval = util.EmptyOr(c.TCPMuxKeepaliveInterval, 30)
139139
if lo.FromPtr(c.TCPMux) {
140140
// If TCPMux is enabled, heartbeat of application layer is unnecessary because we can rely on heartbeat in tcpmux.
141141
c.HeartbeatInterval = util.EmptyOr(c.HeartbeatInterval, -1)

pkg/config/v1/plugin.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package v1
1717
import (
1818
"bytes"
1919
"encoding/json"
20+
"errors"
2021
"fmt"
2122
"reflect"
2223
)
@@ -42,7 +43,7 @@ func (c *TypedClientPluginOptions) UnmarshalJSON(b []byte) error {
4243

4344
c.Type = typeStruct.Type
4445
if c.Type == "" {
45-
return nil
46+
return errors.New("plugin type is empty")
4647
}
4748

4849
v, ok := clientPluginOptionsTypeMap[typeStruct.Type]
@@ -63,6 +64,10 @@ func (c *TypedClientPluginOptions) UnmarshalJSON(b []byte) error {
6364
return nil
6465
}
6566

67+
func (c *TypedClientPluginOptions) MarshalJSON() ([]byte, error) {
68+
return json.Marshal(c.ClientPluginOptions)
69+
}
70+
6671
const (
6772
PluginHTTP2HTTPS = "http2https"
6873
PluginHTTPProxy = "http_proxy"

pkg/config/v1/proxy.go

+4
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ func (c *TypedProxyConfig) UnmarshalJSON(b []byte) error {
195195
return nil
196196
}
197197

198+
func (c *TypedProxyConfig) MarshalJSON() ([]byte, error) {
199+
return json.Marshal(c.ProxyConfigurer)
200+
}
201+
198202
type ProxyConfigurer interface {
199203
Complete(namePrefix string)
200204
GetBaseConfig() *ProxyBaseConfig

pkg/config/v1/server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ type ServerTransportConfig struct {
176176

177177
func (c *ServerTransportConfig) Complete() {
178178
c.TCPMux = util.EmptyOr(c.TCPMux, lo.ToPtr(true))
179-
c.TCPMuxKeepaliveInterval = util.EmptyOr(c.TCPMuxKeepaliveInterval, 60)
179+
c.TCPMuxKeepaliveInterval = util.EmptyOr(c.TCPMuxKeepaliveInterval, 30)
180180
c.TCPKeepAlive = util.EmptyOr(c.TCPKeepAlive, 7200)
181181
c.MaxPoolCount = util.EmptyOr(c.MaxPoolCount, 5)
182182
if lo.FromPtr(c.TCPMux) {

pkg/config/v1/visitor.go

+4
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ func (c *TypedVisitorConfig) UnmarshalJSON(b []byte) error {
120120
return nil
121121
}
122122

123+
func (c *TypedVisitorConfig) MarshalJSON() ([]byte, error) {
124+
return json.Marshal(c.VisitorConfigurer)
125+
}
126+
123127
func NewVisitorConfigurerByType(t VisitorType) VisitorConfigurer {
124128
v, ok := visitorConfigTypeMap[t]
125129
if !ok {

pkg/plugin/client/https2http.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ func NewHTTPS2HTTPPlugin(options v1.ClientPluginOptions) (Plugin, error) {
7272
ErrorLog: stdlog.New(log.NewWriteLogger(log.WarnLevel, 2), "", 0),
7373
}
7474

75-
p.s = &http.Server{
76-
Handler: rp,
77-
ReadHeaderTimeout: 60 * time.Second,
78-
}
79-
8075
var (
8176
tlsConfig *tls.Config
8277
err error
@@ -90,10 +85,15 @@ func NewHTTPS2HTTPPlugin(options v1.ClientPluginOptions) (Plugin, error) {
9085
if err != nil {
9186
return nil, fmt.Errorf("gen TLS config error: %v", err)
9287
}
93-
ln := tls.NewListener(listener, tlsConfig)
88+
89+
p.s = &http.Server{
90+
Handler: rp,
91+
ReadHeaderTimeout: 60 * time.Second,
92+
TLSConfig: tlsConfig,
93+
}
9494

9595
go func() {
96-
_ = p.s.Serve(ln)
96+
_ = p.s.ServeTLS(listener, "", "")
9797
}()
9898
return p, nil
9999
}

pkg/plugin/client/https2https.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,6 @@ func NewHTTPS2HTTPSPlugin(options v1.ClientPluginOptions) (Plugin, error) {
7878
ErrorLog: stdlog.New(log.NewWriteLogger(log.WarnLevel, 2), "", 0),
7979
}
8080

81-
p.s = &http.Server{
82-
Handler: rp,
83-
ReadHeaderTimeout: 60 * time.Second,
84-
}
85-
8681
var (
8782
tlsConfig *tls.Config
8883
err error
@@ -96,10 +91,15 @@ func NewHTTPS2HTTPSPlugin(options v1.ClientPluginOptions) (Plugin, error) {
9691
if err != nil {
9792
return nil, fmt.Errorf("gen TLS config error: %v", err)
9893
}
99-
ln := tls.NewListener(listener, tlsConfig)
94+
95+
p.s = &http.Server{
96+
Handler: rp,
97+
ReadHeaderTimeout: 60 * time.Second,
98+
TLSConfig: tlsConfig,
99+
}
100100

101101
go func() {
102-
_ = p.s.Serve(ln)
102+
_ = p.s.ServeTLS(listener, "", "")
103103
}()
104104
return p, nil
105105
}

pkg/util/system/system_android.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ func fixDNSResolver() {
5959
// Note: If there are other methods to obtain the default DNS servers, the default DNS servers should be used preferentially.
6060
net.DefaultResolver = &net.Resolver{
6161
PreferGo: true,
62-
Dial: func(ctx context.Context, network, _ string) (net.Conn, error) {
63-
return net.Dial(network, "8.8.8.8:53")
62+
Dial: func(ctx context.Context, network, addr string) (net.Conn, error) {
63+
if addr == "127.0.0.1:53" || addr == "[::1]:53" {
64+
addr = "8.8.8.8:53"
65+
}
66+
var d net.Dialer
67+
return d.DialContext(ctx, network, addr)
6468
},
6569
}
6670
}

pkg/util/version/version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
package version
1616

17-
var version = "0.58.0"
17+
var version = "0.58.1"
1818

1919
func Full() string {
2020
return version

0 commit comments

Comments
 (0)