Feature: Implement KCP protocol - based on UDP

This commit is contained in:
yuanyuanxiang
2025-07-20 04:42:29 +08:00
parent 07f6c92306
commit a2759a5d6a
25 changed files with 2248 additions and 29 deletions

View File

@@ -9,6 +9,7 @@
#define XXH_INLINE_ALL
#include "xxhash.h"
#include <WS2tcpip.h>
#include <common/ikcp.h>
#define PACKET_LENGTH 0x2000
@@ -309,7 +310,12 @@ public:
typedef class CONTEXT_OBJECT : public context
{
public:
virtual ~CONTEXT_OBJECT(){}
virtual ~CONTEXT_OBJECT(){
if (kcp) {
ikcp_release(kcp);
kcp = nullptr;
}
}
CString sClientInfo[ONLINELIST_MAX];
CString additonalInfo[RES_MAX];
SOCKET sClientSocket;
@@ -330,6 +336,7 @@ public:
BOOL bLogin; // <20>Ƿ<EFBFBD> login
std::string PeerName; // <20>Զ<EFBFBD>IP
Server* server; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ikcpcb* kcp = nullptr; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>KCP<43>
std::string GetProtocol() const override {
return Parser.m_Masker && Parser.m_Masker->GetMaskType() == MaskTypeNone ? "TCP" : "HTTP";