add test for tcp multiplexing

This commit is contained in:
Guy Lewin 2020-02-17 10:22:31 +02:00
parent b7020e3f3c
commit 5f79740354
4 changed files with 22 additions and 0 deletions

View File

@ -126,6 +126,14 @@ custom_domains = test6.frp.com
host_header_rewrite = test6.frp.com
header_X-From-Where = frp
[tcpmultiplexing]
type = tcp
# Unused
remote_port = 0
local_ip = 127.0.0.1
local_port = 10701
custom_domains = tcpmulti1
[wildcard_http]
type = http
local_ip = 127.0.0.1

View File

@ -2,6 +2,7 @@
bind_addr = 0.0.0.0
bind_port = 10700
vhost_http_port = 10804
vhost_tcp_port = 10806
log_level = trace
token = 123456
allow_ports = 10000-20000,20002,30000-50000

View File

@ -212,6 +212,17 @@ func TestHttp(t *testing.T) {
}
}
func TestTcpMultiplexing(t *testing.T) {
assert := assert.New(t)
conn, err := gnet.DialTcpByProxy(fmt.Sprintf("http://%s:%d", "127.0.0.1", consts.TEST_TCP_VHOST_FRP_PORT), "tcpmulti1")
if assert.NoError(err) {
res, err := util.SendTcpMsgByConn(conn, consts.TEST_TCP_ECHO_STR)
assert.NoError(err)
assert.Equal(consts.TEST_TCP_ECHO_STR, res)
}
}
func TestWebSocket(t *testing.T) {
assert := assert.New(t)

View File

@ -40,6 +40,8 @@ var (
TEST_HTTP_FOO_STR string = "http foo string: " + TEST_STR
TEST_HTTP_BAR_STR string = "http bar string: " + TEST_STR
TEST_TCP_VHOST_FRP_PORT int = 10806
TEST_STCP_FRP_PORT int = 10805
TEST_STCP_EC_FRP_PORT int = 10905
TEST_STCP_ECHO_STR string = "stcp type:" + TEST_STR