From 8f105adbcac3b76a97a8e4744cfa31e85d4c51f1 Mon Sep 17 00:00:00 2001 From: fatedier Date: Thu, 6 Jul 2023 19:58:50 +0800 Subject: [PATCH 1/3] update FUNDING.yml (#3520) --- .github/FUNDING.yml | 1 + README_zh.md | 8 ++++++-- Release.md | 11 ----------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index e137534..2d8fe2e 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,4 @@ # These are supported funding model platforms github: [fatedier] +custom: ["https://afdian.net/a/fatedier"] diff --git a/README_zh.md b/README_zh.md index 7a4124b..951a793 100644 --- a/README_zh.md +++ b/README_zh.md @@ -70,14 +70,18 @@ frp 是一个免费且开源的项目,我们欢迎任何人为其开发和进 **提醒:和项目相关的问题最好在 [issues](https://github.com/fatedier/frp/issues) 中反馈,这样方便其他有类似问题的人可以快速查找解决方法,并且也避免了我们重复回答一些问题。** -## 捐助 +## 赞助 如果您觉得 frp 对你有帮助,欢迎给予我们一定的捐助来维持项目的长期发展。 -### GitHub Sponsors +### Sponsors + +长期赞助可以帮助我们保持项目的持续发展。 您可以通过 [GitHub Sponsors](https://github.com/sponsors/fatedier) 赞助我们。 +国内用户可以通过 [爱发电](https://afdian.net/a/fatedier) 赞助我们。 + 企业赞助者可以将贵公司的 Logo 以及链接放置在项目 README 文件中。 ### 知识星球 diff --git a/Release.md b/Release.md index 49667df..cff4dbc 100644 --- a/Release.md +++ b/Release.md @@ -1,12 +1 @@ ### Features - -* frpc supports connecting to frps via the wss protocol by enabling the configuration `protocol = wss`. -* frpc supports stopping the service through the stop command. - -### Improvements - -* service.Run supports passing in context. - -### Fixes - -* Fix an issue caused by a bug in yamux that prevents wss from working properly in certain plugins. From 90861b6821555c253beb10927c88f5f108a8e11d Mon Sep 17 00:00:00 2001 From: fatedier Date: Mon, 17 Jul 2023 17:27:43 +0800 Subject: [PATCH 2/3] update golib (#3532) --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index b42d880..9572d95 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 github.com/coreos/go-oidc/v3 v3.4.0 github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb - github.com/fatedier/golib v0.1.1-0.20230628070619-a1a0c648236a + github.com/fatedier/golib v0.1.1-0.20230717092310-8d13bff6d373 github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible github.com/go-playground/validator/v10 v10.11.0 github.com/google/uuid v1.3.0 diff --git a/go.sum b/go.sum index c259697..c1e754d 100644 --- a/go.sum +++ b/go.sum @@ -121,8 +121,8 @@ github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go. github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb h1:wCrNShQidLmvVWn/0PikGmpdP0vtQmnvyRg3ZBEhczw= github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb/go.mod h1:wx3gB6dbIfBRcucp94PI9Bt3I0F2c/MyNEWuhzpWiwk= -github.com/fatedier/golib v0.1.1-0.20230628070619-a1a0c648236a h1:HiRTFdy3ary86Vi2nsoINy2/YgjDPQ+21j3ikwJSD2E= -github.com/fatedier/golib v0.1.1-0.20230628070619-a1a0c648236a/go.mod h1:Wdn1pJ0dHB1lah6FPYwt4AO9NEmWI0OzW13dpzC9g4E= +github.com/fatedier/golib v0.1.1-0.20230717092310-8d13bff6d373 h1:lprMgD5nOD9k2Af0T/al8nU31YvFkTyCtRapi4z2jbQ= +github.com/fatedier/golib v0.1.1-0.20230717092310-8d13bff6d373/go.mod h1:Wdn1pJ0dHB1lah6FPYwt4AO9NEmWI0OzW13dpzC9g4E= github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible h1:ssXat9YXFvigNge/IkkZvFMn8yeYKFX+uI6wn2mLJ74= github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible/go.mod h1:YpCOaxj7vvMThhIQ9AfTOPW2sfztQR5WDfs7AflSy4s= github.com/fatedier/yamux v0.0.0-20230628132301-7aca4898904d h1:ynk1ra0RUqDWQfvFi5KtMiSobkVQ3cNc0ODb8CfIETo= From efcc028a3deba745619478da504ac7853bd84606 Mon Sep 17 00:00:00 2001 From: fatedier Date: Thu, 20 Jul 2023 22:32:32 +0800 Subject: [PATCH 3/3] fix a race condition issue (#3536) --- Release.md | 5 ++++- client/proxy/proxy.go | 4 +++- client/proxy/sudp.go | 4 +++- client/proxy/udp.go | 4 +++- client/visitor/stcp.go | 4 +++- client/visitor/xtcp.go | 4 +++- go.mod | 4 ++-- go.sum | 7 ++++--- pkg/util/version/version.go | 2 +- server/proxy/http.go | 4 +++- server/proxy/proxy.go | 4 +++- test/e2e/basic/basic.go | 2 ++ 12 files changed, 34 insertions(+), 14 deletions(-) diff --git a/Release.md b/Release.md index cff4dbc..c5d1640 100644 --- a/Release.md +++ b/Release.md @@ -1 +1,4 @@ -### Features +### Fixes + +* Fix the issue of not disabling tcp keepalive when configuring `tcp_keepalive` = -1 in frps. +* Fix a race condition error. diff --git a/client/proxy/proxy.go b/client/proxy/proxy.go index 82d5d9f..62d02fc 100644 --- a/client/proxy/proxy.go +++ b/client/proxy/proxy.go @@ -143,7 +143,9 @@ func (pxy *BaseProxy) HandleTCPWorkConnection(workConn net.Conn, m *msg.StartWor } } if baseConfig.UseCompression { - remote = libio.WithCompression(remote) + var releaseFn func() + remote, releaseFn = libio.WithCompressionFromPool(remote) + defer releaseFn() } // check if we need to send proxy protocol info diff --git a/client/proxy/sudp.go b/client/proxy/sudp.go index 9d61e22..0981c65 100644 --- a/client/proxy/sudp.go +++ b/client/proxy/sudp.go @@ -97,7 +97,9 @@ func (pxy *SUDPProxy) InWorkConn(conn net.Conn, m *msg.StartWorkConn) { } } if pxy.cfg.UseCompression { - rwc = libio.WithCompression(rwc) + var releaseFn func() + rwc, releaseFn = libio.WithCompressionFromPool(rwc) + defer releaseFn() } conn = utilnet.WrapReadWriteCloserToConn(rwc, conn) diff --git a/client/proxy/udp.go b/client/proxy/udp.go index adf9276..cc18700 100644 --- a/client/proxy/udp.go +++ b/client/proxy/udp.go @@ -108,7 +108,9 @@ func (pxy *UDPProxy) InWorkConn(conn net.Conn, m *msg.StartWorkConn) { } } if pxy.cfg.UseCompression { - rwc = libio.WithCompression(rwc) + var releaseFn func() + rwc, releaseFn = libio.WithCompressionFromPool(rwc) + defer releaseFn() } conn = utilnet.WrapReadWriteCloserToConn(rwc, conn) diff --git a/client/visitor/stcp.go b/client/visitor/stcp.go index 2ea27f3..86e09ac 100644 --- a/client/visitor/stcp.go +++ b/client/visitor/stcp.go @@ -126,7 +126,9 @@ func (sv *STCPVisitor) handleConn(userConn net.Conn) { } if sv.cfg.UseCompression { - remote = libio.WithCompression(remote) + var releaseFn func() + remote, releaseFn = libio.WithCompressionFromPool(remote) + defer releaseFn() } libio.Join(userConn, remote) diff --git a/client/visitor/xtcp.go b/client/visitor/xtcp.go index 9f83b39..713ed34 100644 --- a/client/visitor/xtcp.go +++ b/client/visitor/xtcp.go @@ -200,7 +200,9 @@ func (sv *XTCPVisitor) handleConn(userConn net.Conn) { } } if sv.cfg.UseCompression { - muxConnRWCloser = libio.WithCompression(muxConnRWCloser) + var releaseFn func() + muxConnRWCloser, releaseFn = libio.WithCompressionFromPool(muxConnRWCloser) + defer releaseFn() } _, _, errs := libio.Join(userConn, muxConnRWCloser) diff --git a/go.mod b/go.mod index 9572d95..65374ab 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 github.com/coreos/go-oidc/v3 v3.4.0 github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb - github.com/fatedier/golib v0.1.1-0.20230717092310-8d13bff6d373 + github.com/fatedier/golib v0.1.1-0.20230720124328-204db2e322f8 github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible github.com/go-playground/validator/v10 v10.11.0 github.com/google/uuid v1.3.0 @@ -43,7 +43,7 @@ require ( github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.2 // indirect - github.com/golang/snappy v0.0.3 // indirect + github.com/golang/snappy v0.0.4 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect diff --git a/go.sum b/go.sum index c1e754d..68f4520 100644 --- a/go.sum +++ b/go.sum @@ -121,8 +121,8 @@ github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go. github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb h1:wCrNShQidLmvVWn/0PikGmpdP0vtQmnvyRg3ZBEhczw= github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb/go.mod h1:wx3gB6dbIfBRcucp94PI9Bt3I0F2c/MyNEWuhzpWiwk= -github.com/fatedier/golib v0.1.1-0.20230717092310-8d13bff6d373 h1:lprMgD5nOD9k2Af0T/al8nU31YvFkTyCtRapi4z2jbQ= -github.com/fatedier/golib v0.1.1-0.20230717092310-8d13bff6d373/go.mod h1:Wdn1pJ0dHB1lah6FPYwt4AO9NEmWI0OzW13dpzC9g4E= +github.com/fatedier/golib v0.1.1-0.20230720124328-204db2e322f8 h1:8JYzwZ26k1zEsjgits6GHsQxm2tl3K3FYgMMLcIKBKU= +github.com/fatedier/golib v0.1.1-0.20230720124328-204db2e322f8/go.mod h1:Lmi9U4VfvdRvonSMh1FgXVy1hCXycVyJk4E9ktokknE= github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible h1:ssXat9YXFvigNge/IkkZvFMn8yeYKFX+uI6wn2mLJ74= github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible/go.mod h1:YpCOaxj7vvMThhIQ9AfTOPW2sfztQR5WDfs7AflSy4s= github.com/fatedier/yamux v0.0.0-20230628132301-7aca4898904d h1:ynk1ra0RUqDWQfvFi5KtMiSobkVQ3cNc0ODb8CfIETo= @@ -189,8 +189,9 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= diff --git a/pkg/util/version/version.go b/pkg/util/version/version.go index 1778fd8..670e07f 100644 --- a/pkg/util/version/version.go +++ b/pkg/util/version/version.go @@ -19,7 +19,7 @@ import ( "strings" ) -var version = "0.51.0" +var version = "0.51.1" func Full() string { return version diff --git a/server/proxy/http.go b/server/proxy/http.go index 432dbc1..8113916 100644 --- a/server/proxy/http.go +++ b/server/proxy/http.go @@ -175,7 +175,9 @@ func (pxy *HTTPProxy) GetRealConn(remoteAddr string) (workConn net.Conn, err err } } if pxy.cfg.UseCompression { - rwc = libio.WithCompression(rwc) + var releaseFn func() + rwc, releaseFn = libio.WithCompressionFromPool(rwc) + defer releaseFn() } if pxy.GetLimiter() != nil { diff --git a/server/proxy/proxy.go b/server/proxy/proxy.go index aeb2ef0..9d6ee99 100644 --- a/server/proxy/proxy.go +++ b/server/proxy/proxy.go @@ -241,7 +241,9 @@ func (pxy *BaseProxy) handleUserTCPConnection(userConn net.Conn) { } } if cfg.UseCompression { - local = libio.WithCompression(local) + var releaseFn func() + local, releaseFn = libio.WithCompressionFromPool(local) + defer releaseFn() } if pxy.GetLimiter() != nil { diff --git a/test/e2e/basic/basic.go b/test/e2e/basic/basic.go index d032a0d..805b460 100644 --- a/test/e2e/basic/basic.go +++ b/test/e2e/basic/basic.go @@ -298,6 +298,7 @@ var _ = ginkgo.Describe("[Feature: Basic]", func() { case "xtcp": localPortName = framework.TCPEchoServerPort protocol = "tcp" + ginkgo.Skip("stun server is not stable") } correctSK := "abc" @@ -363,6 +364,7 @@ var _ = ginkgo.Describe("[Feature: Basic]", func() { use_encryption = true use_compression = true `, + skipXTCP: true, }, { proxyName: "with-error-sk",