tcp multiplexing over http connect tunnel

This commit is contained in:
fatedier
2020-03-05 21:47:49 +08:00
committed by GitHub
parent 0b9124d4fd
commit 1db091b381
22 changed files with 565 additions and 26 deletions

View File

@@ -126,6 +126,13 @@ custom_domains = test6.frp.com
host_header_rewrite = test6.frp.com
header_X-From-Where = frp
[tcpmuxhttpconnect]
type = tcpmux
multiplexer = httpconnect
local_ip = 127.0.0.1
local_port = 10701
custom_domains = tunnel1
[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
tcpmux_httpconnect_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 TestTcpMux(t *testing.T) {
assert := assert.New(t)
conn, err := gnet.DialTcpByProxy(fmt.Sprintf("http://%s:%d", "127.0.0.1", consts.TEST_TCP_MUX_FRP_PORT), "tunnel1")
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)