Update On Sat Jun 8 20:29:23 CEST 2024

This commit is contained in:
github-action[bot]
2024-06-08 20:29:24 +02:00
parent 409e26f88f
commit ca94beda78
126 changed files with 1302 additions and 720 deletions

View File

@@ -41,6 +41,10 @@ const (
MTCP_LISTEN = "0.0.0.0:1238"
MTCP_REMOTE = "0.0.0.0:2003"
MTCP_SERVER = "0.0.0.0:2003"
MWS_LISTEN = "0.0.0.0:1239"
MWS_REMOTE = "ws://0.0.0.0:2004"
MSS_SERVER = "0.0.0.0:2004"
)
func init() {
@@ -127,6 +131,20 @@ func init() {
TCPRemotes: []string{ECHO_SERVER},
TransportType: constant.RelayTypeRaw,
},
// mws
{
Listen: MWS_LISTEN,
ListenType: constant.RelayTypeRaw,
TCPRemotes: []string{MWS_REMOTE},
TransportType: constant.RelayTypeMWS,
},
{
Listen: MSS_SERVER,
ListenType: constant.RelayTypeMWS,
TCPRemotes: []string{ECHO_SERVER},
TransportType: constant.RelayTypeRaw,
},
},
}
logger := zap.S()
@@ -265,6 +283,16 @@ func TestRelayOverMTCP(t *testing.T) {
t.Log("test tcp over mtcp done!")
}
func TestRelayOverMWS(t *testing.T) {
msg := []byte("hello")
// test tcp
res := echo.SendTcpMsg(msg, MWS_LISTEN)
if string(res) != string(msg) {
t.Fatal(res)
}
t.Log("test tcp over mws done!")
}
func BenchmarkTcpRelay(b *testing.B) {
msg := []byte("hello")
for i := 0; i <= b.N; i++ {