mirror of
https://github.com/fatedier/frp.git
synced 2025-07-23 22:33:30 +07:00
xtcp: when connection timeout occurs, support fallback to STCP (#3460)
This commit is contained in:
@ -376,7 +376,7 @@ var _ = ginkgo.Describe("[Feature: Basic]", func() {
|
||||
for _, test := range tests {
|
||||
framework.NewRequestExpect(f).
|
||||
RequestModify(func(r *request.Request) {
|
||||
r.Timeout(5 * time.Second)
|
||||
r.Timeout(10 * time.Second)
|
||||
}).
|
||||
Protocol(protocol).
|
||||
PortName(test.bindPortName).
|
||||
|
52
test/e2e/basic/xtcp.go
Normal file
52
test/e2e/basic/xtcp.go
Normal file
@ -0,0 +1,52 @@
|
||||
package basic
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/onsi/ginkgo/v2"
|
||||
|
||||
"github.com/fatedier/frp/test/e2e/framework"
|
||||
"github.com/fatedier/frp/test/e2e/framework/consts"
|
||||
"github.com/fatedier/frp/test/e2e/pkg/port"
|
||||
"github.com/fatedier/frp/test/e2e/pkg/request"
|
||||
)
|
||||
|
||||
var _ = ginkgo.Describe("[Feature: XTCP]", func() {
|
||||
f := framework.NewDefaultFramework()
|
||||
|
||||
ginkgo.It("Fallback To STCP", func() {
|
||||
serverConf := consts.DefaultServerConfig
|
||||
clientConf := consts.DefaultClientConfig
|
||||
|
||||
bindPortName := port.GenName("XTCP")
|
||||
clientConf += fmt.Sprintf(`
|
||||
[foo]
|
||||
type = stcp
|
||||
local_port = {{ .%s }}
|
||||
|
||||
[foo-visitor]
|
||||
type = stcp
|
||||
role = visitor
|
||||
server_name = foo
|
||||
bind_port = -1
|
||||
|
||||
[bar-visitor]
|
||||
type = xtcp
|
||||
role = visitor
|
||||
server_name = bar
|
||||
bind_port = {{ .%s }}
|
||||
keep_tunnel_open = true
|
||||
fallback_to = foo-visitor
|
||||
fallback_timeout_ms = 200
|
||||
`, framework.TCPEchoServerPort, bindPortName)
|
||||
|
||||
f.RunProcesses([]string{serverConf}, []string{clientConf})
|
||||
framework.NewRequestExpect(f).
|
||||
RequestModify(func(r *request.Request) {
|
||||
r.Timeout(time.Second)
|
||||
}).
|
||||
PortName(bindPortName).
|
||||
Ensure()
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user