mirror of
https://github.com/fatedier/frp.git
synced 2026-01-11 22:23:12 +00:00
feat: support sudp proxy (#1730)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user