feat: support sudp proxy (#1730)

This commit is contained in:
Tank
2020-04-22 21:37:45 +08:00
committed by GitHub
parent 6d78af6144
commit 4797136965
15 changed files with 669 additions and 1 deletions

View File

@@ -72,6 +72,12 @@ local_port = 10701
use_encryption = true
use_compression = true
[sudp]
type = sudp
sk = abcdefg
local_ip = 127.0.0.1
local_port = 10702
[web01]
type = http
local_ip = 127.0.0.1

View File

@@ -23,3 +23,12 @@ bind_addr = 127.0.0.1
bind_port = 10905
use_encryption = true
use_compression = true
[sudp_visitor]
type = sudp
role = visitor
server_name = sudp
sk = abcdefg
bind_addr = 127.0.0.1
bind_port = 10816

View File

@@ -118,6 +118,16 @@ func TestStcp(t *testing.T) {
}
}
func TestSudp(t *testing.T) {
assert := assert.New(t)
// Normal
addr := fmt.Sprintf("127.0.0.1:%d", consts.TEST_SUDP_FRP_PORT)
res, err := util.SendUdpMsg(addr, consts.TEST_SUDP_ECHO_STR)
assert.NoError(err)
assert.Equal(consts.TEST_SUDP_ECHO_STR, res)
}
func TestHttp(t *testing.T) {
assert := assert.New(t)
// web01

View File

@@ -46,6 +46,9 @@ var (
TEST_STCP_EC_FRP_PORT int = 10905
TEST_STCP_ECHO_STR string = "stcp type:" + TEST_STR
TEST_SUDP_FRP_PORT int = 10816
TEST_SUDP_ECHO_STR string = "sudp type:" + TEST_STR
ProxyTcpPortNotAllowed string = "tcp_port_not_allowed"
ProxyTcpPortUnavailable string = "tcp_port_unavailable"
ProxyTcpPortNormal string = "tcp_port_normal"

View File

@@ -71,6 +71,11 @@ func GetProxyStatus(statusAddr string, user string, passwd string, name string)
return &s, nil
}
}
for _, s := range allStatus.Sudp {
if s.Name == name {
return &s, nil
}
}
return status, errors.New("no proxy status found")
}