From 804f2910fd7612729af14e75c3558fe2d3765fa4 Mon Sep 17 00:00:00 2001 From: 0x7fff <4812302+blizard863@users.noreply.github.com> Date: Thu, 22 Dec 2022 17:55:06 +0800 Subject: [PATCH 1/4] refactor: ifelse (#3224) --- cmd/frpc/sub/stcp.go | 7 ++++--- cmd/frpc/sub/sudp.go | 7 ++++--- cmd/frpc/sub/xtcp.go | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/cmd/frpc/sub/stcp.go b/cmd/frpc/sub/stcp.go index 989387b..d84b23b 100644 --- a/cmd/frpc/sub/stcp.go +++ b/cmd/frpc/sub/stcp.go @@ -59,7 +59,8 @@ var stcpCmd = &cobra.Command{ prefix = user + "." } - if role == "server" { + switch role { + case "server": cfg := &config.STCPProxyConf{} cfg.ProxyName = prefix + proxyName cfg.ProxyType = consts.STCPProxy @@ -75,7 +76,7 @@ var stcpCmd = &cobra.Command{ os.Exit(1) } proxyConfs[cfg.ProxyName] = cfg - } else if role == "visitor" { + case "visitor": cfg := &config.STCPVisitorConf{} cfg.ProxyName = prefix + proxyName cfg.ProxyType = consts.STCPProxy @@ -92,7 +93,7 @@ var stcpCmd = &cobra.Command{ os.Exit(1) } visitorConfs[cfg.ProxyName] = cfg - } else { + default: fmt.Println("invalid role") os.Exit(1) } diff --git a/cmd/frpc/sub/sudp.go b/cmd/frpc/sub/sudp.go index c781223..f96a12e 100644 --- a/cmd/frpc/sub/sudp.go +++ b/cmd/frpc/sub/sudp.go @@ -59,7 +59,8 @@ var sudpCmd = &cobra.Command{ prefix = user + "." } - if role == "server" { + switch role { + case "server": cfg := &config.SUDPProxyConf{} cfg.ProxyName = prefix + proxyName cfg.ProxyType = consts.SUDPProxy @@ -75,7 +76,7 @@ var sudpCmd = &cobra.Command{ os.Exit(1) } proxyConfs[cfg.ProxyName] = cfg - } else if role == "visitor" { + case "visitor": cfg := &config.SUDPVisitorConf{} cfg.ProxyName = prefix + proxyName cfg.ProxyType = consts.SUDPProxy @@ -92,7 +93,7 @@ var sudpCmd = &cobra.Command{ os.Exit(1) } visitorConfs[cfg.ProxyName] = cfg - } else { + default: fmt.Println("invalid role") os.Exit(1) } diff --git a/cmd/frpc/sub/xtcp.go b/cmd/frpc/sub/xtcp.go index 069cce7..b842698 100644 --- a/cmd/frpc/sub/xtcp.go +++ b/cmd/frpc/sub/xtcp.go @@ -59,7 +59,8 @@ var xtcpCmd = &cobra.Command{ prefix = user + "." } - if role == "server" { + switch role { + case "server": cfg := &config.XTCPProxyConf{} cfg.ProxyName = prefix + proxyName cfg.ProxyType = consts.XTCPProxy @@ -75,7 +76,7 @@ var xtcpCmd = &cobra.Command{ os.Exit(1) } proxyConfs[cfg.ProxyName] = cfg - } else if role == "visitor" { + case "visitor": cfg := &config.XTCPVisitorConf{} cfg.ProxyName = prefix + proxyName cfg.ProxyType = consts.XTCPProxy @@ -92,7 +93,7 @@ var xtcpCmd = &cobra.Command{ os.Exit(1) } visitorConfs[cfg.ProxyName] = cfg - } else { + default: fmt.Println("invalid role") os.Exit(1) } From b03f0ad1e681f72e2067e31d60d25ad09ee2f61a Mon Sep 17 00:00:00 2001 From: Craig O'Donnell Date: Sun, 8 Jan 2023 21:34:09 -0500 Subject: [PATCH 2/4] fix: incorrect op for newWorkConn (#3244) (cherry picked from commit 53b6bbf0b14ab632dc89416d7fffa9b1d0887c0a) --- pkg/plugin/server/manager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/plugin/server/manager.go b/pkg/plugin/server/manager.go index 5a8a309..516f407 100644 --- a/pkg/plugin/server/manager.go +++ b/pkg/plugin/server/manager.go @@ -211,7 +211,7 @@ func (m *Manager) NewWorkConn(content *NewWorkConnContent) (*NewWorkConnContent, ctx = NewReqidContext(ctx, reqid) for _, p := range m.newWorkConnPlugins { - res, retContent, err = p.Handle(ctx, OpPing, *content) + res, retContent, err = p.Handle(ctx, OpNewWorkConn, *content) if err != nil { xl.Warn("send NewWorkConn request to plugin [%s] error: %v", p.Name(), err) return nil, errors.New("send NewWorkConn request to plugin error") From 5cfbb976f47bedaa29ed2fc8194db4c825c7205f Mon Sep 17 00:00:00 2001 From: fatedier Date: Tue, 10 Jan 2023 10:19:37 +0800 Subject: [PATCH 3/4] pkg/util/net: fix quic streams leak (#3246) --- pkg/util/net/conn.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/util/net/conn.go b/pkg/util/net/conn.go index 1258ed4..a09da99 100644 --- a/pkg/util/net/conn.go +++ b/pkg/util/net/conn.go @@ -211,3 +211,8 @@ func (conn *wrapQuicStream) RemoteAddr() net.Addr { } return (*net.TCPAddr)(nil) } + +func (conn *wrapQuicStream) Close() error { + conn.Stream.CancelRead(0) + return conn.Stream.Close() +} From 679992db256d97da3ccf9498727a8d3bd7e83b21 Mon Sep 17 00:00:00 2001 From: fatedier Date: Tue, 10 Jan 2023 10:24:44 +0800 Subject: [PATCH 4/4] update version (#3247) --- Release.md | 11 +++-------- pkg/util/version/version.go | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Release.md b/Release.md index bbcb8c5..6738c32 100644 --- a/Release.md +++ b/Release.md @@ -1,9 +1,4 @@ -### New +### Fix -* Add `oidc_scope` parameter to frpc when `authentication_method = oidc`. -* Support quic protocol between frpc and frps. - - -### Improve - -* Upgrade oidc and oauth2 package which is forward compatible. +* Server Plugin send incorrect op name for NewWorkConn. +* QUIC stream leak. diff --git a/pkg/util/version/version.go b/pkg/util/version/version.go index 6228c09..849002d 100644 --- a/pkg/util/version/version.go +++ b/pkg/util/version/version.go @@ -19,7 +19,7 @@ import ( "strings" ) -var version = "0.46.0" +var version = "0.46.1" func Full() string { return version