mirror of
https://github.com/bolucat/Archive.git
synced 2025-12-24 13:28:37 +08:00
Update On Sat Jun 8 20:29:23 CEST 2024
This commit is contained in:
@@ -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++ {
|
||||
|
||||
Reference in New Issue
Block a user