Skip to content

Commit 10f2620

Browse files
authored
Merge pull request fatedier#2869 from fatedier/dev
bump version to v0.41.0
2 parents ce67782 + 4acae54 commit 10f2620

21 files changed

+113
-43
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ version: 2
22
jobs:
33
go-version-latest:
44
docker:
5-
- image: cimg/go:1.17-node
5+
- image: cimg/go:1.18-node
66
steps:
77
- checkout
88
- run: make
99
- run: make alltest
1010
go-version-last:
1111
docker:
12-
- image: cimg/go:1.16-node
12+
- image: cimg/go:1.17-node
1313
steps:
1414
- checkout
1515
- run: make

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Set up Go 1.x
1818
uses: actions/setup-go@v2
1919
with:
20-
go-version: 1.17
20+
go-version: 1.18
2121

2222
- run: |
2323
# https://github.com/actions/setup-go/issues/107

.github/workflows/goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Set up Go
1616
uses: actions/setup-go@v2
1717
with:
18-
go-version: 1.17
18+
go-version: 1.18
1919

2020
- run: |
2121
# https://github.com/actions/setup-go/issues/107

.github/workflows/stale.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@ jobs:
1212
stale:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/stale@v3
15+
- uses: actions/stale@v5
1616
with:
1717
repo-token: ${{ secrets.GITHUB_TOKEN }}
1818
stale-issue-message: 'Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.'
19-
stale-pr-message: 'Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.'
19+
stale-pr-message: "PRs go stale after 30d of inactivity. Stale PRs rot after an additional 7d of inactivity and eventually close."
2020
stale-issue-label: 'lifecycle/stale'
2121
exempt-issue-labels: 'bug,doc,enhancement,future,proposal,question,testing,todo,easy,help wanted,assigned'
2222
stale-pr-label: 'lifecycle/stale'
2323
exempt-pr-labels: 'bug,doc,enhancement,future,proposal,question,testing,todo,easy,help wanted,assigned'
2424
days-before-stale: 30
2525
days-before-close: 7
2626
debug-only: ${{ github.event.inputs.debug-only }}
27+
exempt-all-pr-milestones: true
28+
exempt-all-pr-assignees: true

.goreleaser.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
builds:
22
- skip: true
33
checksum:
4-
name_template: 'checksums.txt'
4+
name_template: '{{ .ProjectName }}_{{ .Version }}_sha256_checksums.txt'
5+
algorithm: sha256
6+
extra_files:
7+
- glob: ./release/packages/*
58
release:
69
# Same as for github
710
# Note: it can only be one: either github, gitlab or gitea

Release.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
### New
22

3-
* Added `dial_server_timeout` in frpc to specify connect timeout to frps.
4-
* Additional EndpointParams can be set for OIDC.
5-
* Added CloseProxy operation in server plugin.
3+
* Support go http pprof.
64

75
### Improve
86

9-
* Added some randomness in reconnect delay.
10-
11-
### Fix
12-
13-
* TLS server name is ignored when `tls_trusted_ca_file` isn’t set.
7+
* Change underlying TCP connection keepalive interval to 2 hours.
8+
* Create new connection to server for `sudp` visitor when needed, to avoid frequent reconnections.

client/admin.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package client
1717
import (
1818
"net"
1919
"net/http"
20+
"net/http/pprof"
2021
"time"
2122

2223
"github.com/fatedier/frp/assets"
@@ -26,8 +27,8 @@ import (
2627
)
2728

2829
var (
29-
httpServerReadTimeout = 10 * time.Second
30-
httpServerWriteTimeout = 10 * time.Second
30+
httpServerReadTimeout = 60 * time.Second
31+
httpServerWriteTimeout = 60 * time.Second
3132
)
3233

3334
func (svr *Service) RunAdminServer(address string) (err error) {
@@ -36,6 +37,15 @@ func (svr *Service) RunAdminServer(address string) (err error) {
3637

3738
router.HandleFunc("/healthz", svr.healthz)
3839

40+
// debug
41+
if svr.cfg.PprofEnable {
42+
router.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
43+
router.HandleFunc("/debug/pprof/profile", pprof.Profile)
44+
router.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
45+
router.HandleFunc("/debug/pprof/trace", pprof.Trace)
46+
router.PathPrefix("/debug/pprof/").HandlerFunc(pprof.Index)
47+
}
48+
3949
subRouter := router.NewRoute().Subrouter()
4050
user, passwd := svr.cfg.AdminUser, svr.cfg.AdminPwd
4151
subRouter.Use(frpNet.NewHTTPAuthMiddleware(user, passwd).Middleware)

client/control.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ func (ctl *Control) connectServer() (conn net.Conn, err error) {
252252
dialOptions = append(dialOptions,
253253
libdial.WithProtocol(protocol),
254254
libdial.WithTimeout(time.Duration(ctl.clientCfg.DialServerTimeout)*time.Second),
255+
libdial.WithKeepAlive(time.Duration(ctl.clientCfg.DialServerKeepAlive)*time.Second),
255256
libdial.WithProxy(proxyType, addr),
256257
libdial.WithProxyAuth(auth),
257258
libdial.WithTLSConfig(tlsConfig),

client/service.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ func (svr *Service) login() (conn net.Conn, session *fmux.Session, err error) {
243243
dialOptions = append(dialOptions,
244244
libdial.WithProtocol(protocol),
245245
libdial.WithTimeout(time.Duration(svr.cfg.DialServerTimeout)*time.Second),
246+
libdial.WithKeepAlive(time.Duration(svr.cfg.DialServerKeepAlive)*time.Second),
246247
libdial.WithProxy(proxyType, addr),
247248
libdial.WithProxyAuth(auth),
248249
libdial.WithTLSConfig(tlsConfig),

client/visitor.go

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -377,39 +377,44 @@ func (sv *SUDPVisitor) Run() (err error) {
377377
func (sv *SUDPVisitor) dispatcher() {
378378
xl := xlog.FromContextSafe(sv.ctx)
379379

380+
var (
381+
visitorConn net.Conn
382+
err error
383+
384+
firstPacket *msg.UDPPacket
385+
)
386+
380387
for {
381-
// loop for get frpc to frps tcp conn
382-
// setup worker
383-
// wait worker to finished
384-
// retry or exit
385-
visitorConn, err := sv.getNewVisitorConn()
386-
if err != nil {
387-
// check if proxy is closed
388-
// if checkCloseCh is close, we will return, other case we will continue to reconnect
389-
select {
390-
case <-sv.checkCloseCh:
388+
select {
389+
case firstPacket = <-sv.sendCh:
390+
if firstPacket == nil {
391391
xl.Info("frpc sudp visitor proxy is closed")
392392
return
393-
default:
394393
}
394+
case <-sv.checkCloseCh:
395+
xl.Info("frpc sudp visitor proxy is closed")
396+
return
397+
}
395398

396-
time.Sleep(3 * time.Second)
397-
399+
visitorConn, err = sv.getNewVisitorConn()
400+
if err != nil {
398401
xl.Warn("newVisitorConn to frps error: %v, try to reconnect", err)
399402
continue
400403
}
401404

402-
sv.worker(visitorConn)
405+
// visitorConn always be closed when worker done.
406+
sv.worker(visitorConn, firstPacket)
403407

404408
select {
405409
case <-sv.checkCloseCh:
406410
return
407411
default:
408412
}
409413
}
414+
410415
}
411416

412-
func (sv *SUDPVisitor) worker(workConn net.Conn) {
417+
func (sv *SUDPVisitor) worker(workConn net.Conn, firstPacket *msg.UDPPacket) {
413418
xl := xlog.FromContextSafe(sv.ctx)
414419
xl.Debug("starting sudp proxy worker")
415420

@@ -463,6 +468,14 @@ func (sv *SUDPVisitor) worker(workConn net.Conn) {
463468
}()
464469

465470
var errRet error
471+
if firstPacket != nil {
472+
if errRet = msg.WriteMsg(conn, firstPacket); errRet != nil {
473+
xl.Warn("sender goroutine for udp work connection closed: %v", errRet)
474+
return
475+
}
476+
xl.Trace("send udp package to workConn: %s", firstPacket.Content)
477+
}
478+
466479
for {
467480
select {
468481
case udpMsg, ok := <-sv.sendCh:

0 commit comments

Comments
 (0)