diff --git a/server/tools/protobuild/ss_proto.proto b/server/tools/protobuild/ss_proto.proto index 7b6952f..1c6ed51 100644 --- a/server/tools/protobuild/ss_proto.proto +++ b/server/tools/protobuild/ss_proto.proto @@ -24,6 +24,7 @@ message SS_CMKcpHandshake optional string account_id = 2; //账号id optional string session_id = 3; //session id optional string team_uuid = 4; //保留 + optional int32 secret_key_place = 5; //私钥存放位置 0:存在用户协议前(老) 1:存在kcp底层协议头之后(新) } message SS_SMKcpHandshake diff --git a/server/wsproxy/kcpsession.cc b/server/wsproxy/kcpsession.cc index 3010fc3..521f8b3 100644 --- a/server/wsproxy/kcpsession.cc +++ b/server/wsproxy/kcpsession.cc @@ -127,3 +127,13 @@ void KcpSession::DecodeUserPacket(char* buf, int& offset, unsigned int buflen) f8::UdpLog::Instance()->Warning("收到kcp client非法数据包", {}); } } + +void KcpSession::SetSecretKeyPlace(int secret_key_place) +{ + secret_key_place_ = secret_key_place; +} + +int KcpSession::GetSecretKeyPlace() +{ + return secret_key_place_; +} diff --git a/server/wsproxy/kcpsession.h b/server/wsproxy/kcpsession.h index db29158..425a218 100644 --- a/server/wsproxy/kcpsession.h +++ b/server/wsproxy/kcpsession.h @@ -19,6 +19,8 @@ public: int GetSocketHandle() { return socket_handle_; } long long GetSecretKey() { return secret_key_; } void* GetSecretKeyDataPtr() { return &secret_key_; } + void SetSecretKeyPlace(int secret_key_place); + int GetSecretKeyPlace(); void SendClientMsg(char* buf, int buf_len); virtual void OnRecvPacket(a8::UdpPacket* pkt) override; @@ -36,6 +38,7 @@ private: void UpdateInput(); private: + int secret_key_place_ = 0; int socket_handle_ = 0; long long secret_key_ = 0; ikcpcb* kcp_ = nullptr; diff --git a/server/wsproxy/longsession.cc b/server/wsproxy/longsession.cc index 2dbcb3b..3ef3db0 100644 --- a/server/wsproxy/longsession.cc +++ b/server/wsproxy/longsession.cc @@ -25,3 +25,13 @@ void LongSession::UpdatePing() { last_ping_tick_ = a8::XGetTickCount(); } + +void LongSession::SetSecretKeyPlace(int secret_key_place) +{ + kcp_session_->SetSecretKeyPlace(secret_key_place); +} + +int LongSession::GetSecretKeyPlace() +{ + return kcp_session_->GetSecretKeyPlace(); +} diff --git a/server/wsproxy/longsession.h b/server/wsproxy/longsession.h index 4218829..02a657d 100644 --- a/server/wsproxy/longsession.h +++ b/server/wsproxy/longsession.h @@ -17,6 +17,8 @@ class LongSession std::shared_ptr GetKcpSession() { return kcp_session_; } void UpdatePing(); + void SetSecretKeyPlace(int secret_key_place); + int GetSecretKeyPlace(); private: long long last_ping_tick_ = 0;