diff --git a/NoSugarNet.ClientCore/Common/CompressAdapter.cs b/NoSugarNet.ClientCore/Common/CompressAdapter.cs
deleted file mode 100644
index e2f4b26..0000000
--- a/NoSugarNet.ClientCore/Common/CompressAdapter.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace NoSugarNet.ClientCore.Common
-{
- ///
- /// 压缩适配器
- ///
- public class CompressAdapter
- {
- IDataCompress mIDataCompress;
- public CompressAdapter(ushort type)
- {
- switch (type)
- {
- //不压缩
- case 0:
- mIDataCompress = new NoCompress();
- break;
- //TODO 其他压缩对比
- default:
- mIDataCompress = new NoCompress();
- break;
- }
- }
-
-
- public byte[] Compress(byte[] data)
- {
- return mIDataCompress.Compress(data);
- }
- public byte[] Decompress(byte[] data)
- {
- return mIDataCompress.Decompress(data);
- }
- }
-
-
- public interface IDataCompress
- {
- public byte[] Compress(byte[] data);
- public byte[] Decompress(byte[] data);
- }
-
- public class NoCompress : IDataCompress
- {
- public byte[] Compress(byte[] data)
- {
- return data;
- }
- public byte[] Decompress(byte[] data)
- {
- return data;
- }
- }
-}
diff --git a/NoSugarNet.ClientCore/Manager/AppLocalClient.cs b/NoSugarNet.ClientCore/Manager/AppLocalClient.cs
index 0a346bc..07589c0 100644
--- a/NoSugarNet.ClientCore/Manager/AppLocalClient.cs
+++ b/NoSugarNet.ClientCore/Manager/AppLocalClient.cs
@@ -4,9 +4,8 @@ using HaoYueNet.ServerNetwork;
using NoSugarNet.ClientCore;
using NoSugarNet.ClientCore.Common;
using NoSugarNet.ClientCore.Network;
-using System.Data;
+using NoSugarNet.DataHelper;
using System.Net;
-using static System.Runtime.InteropServices.JavaScript.JSType;
namespace ServerCore.Manager
{
@@ -15,12 +14,11 @@ namespace ServerCore.Manager
Dictionary mDictTunnelID2Cfg = new Dictionary();
Dictionary mDictTunnelID2Listeners = new Dictionary();
CompressAdapter mCompressAdapter;
+ E_CompressAdapter compressAdapterType;
public LocalMsgQueuePool _localMsgPool = new LocalMsgQueuePool(1000);
- public AppLocalClient()
+ public AppLocalClient()
{
- //初始化压缩适配器,暂时使用0,代表压缩类型
- mCompressAdapter = new CompressAdapter(0);
//注册网络消息
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdCfgs, Recive_CmdCfgs);
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTunnelS2CConnect, Recive_TunnelS2CConnect);
@@ -45,6 +43,9 @@ namespace ServerCore.Manager
///
void InitListenerMode()
{
+ AppNoSugarNet.log.Debug("初始化压缩适配器" + compressAdapterType);
+ //初始化压缩适配器,代表压缩类型
+ mCompressAdapter = new CompressAdapter(compressAdapterType);
foreach (var cfg in mDictTunnelID2Cfg)
{
LocalListener listener = new LocalListener(256, 1024, cfg.Key);
@@ -120,6 +121,7 @@ namespace ServerCore.Manager
Protobuf_Cfgs_Single cfg = msg.Cfgs[i];
mDictTunnelID2Cfg[(byte)cfg.TunnelID] = cfg;
}
+ compressAdapterType = (E_CompressAdapter)msg.CompressAdapterType;
InitListenerMode();
}
public void Recive_TunnelS2CConnect(byte[] reqData)
@@ -279,7 +281,6 @@ namespace ServerCore.Manager
SendDataToRemote(tunnelId, Idx, data);
}
-
void SendDataToRemote(byte tunnelId, byte Idx, byte[] data)
{
//压缩
diff --git a/NoSugarNet.ClientCore/NoSugarNet.ClientCore.csproj b/NoSugarNet.ClientCore/NoSugarNet.ClientCore.csproj
index acb0332..4ef9bb7 100644
--- a/NoSugarNet.ClientCore/NoSugarNet.ClientCore.csproj
+++ b/NoSugarNet.ClientCore/NoSugarNet.ClientCore.csproj
@@ -6,6 +6,10 @@
enable
+
+
+
+
..\Lib\Google.Protobuf.dll
diff --git a/NoSugarNet.ClientCore/Protobuf/ProtobufNoSugar.cs b/NoSugarNet.ClientCore/Protobuf/ProtobufNoSugar.cs
index 549e751..dce38be 100644
--- a/NoSugarNet.ClientCore/Protobuf/ProtobufNoSugar.cs
+++ b/NoSugarN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NRF9UVU5ORUxfQzJTX0RBVEEQjCcS",
+ "GAoTQ01EX1RVTk5FTF9TMkNfREFUQRCNJyorCglFcnJvckNvZGUSEAoMRVJS",
+ "T1JfREVGQVVMEAASDAoIRVJST1JfT0sQASo+CglMb2dpblR5cGUSDwoLQmFz",
+ "ZURlZmF1bHQQABIOCgpIYW9ZdWVBdXRoEAESBwoDQkYzEAMSBwoDQkY0EAQq",
+ "SwoKRGV2aWNlVHlwZRIWChJEZXZpY2VUeXBlX0RlZmF1bHQQABIGCgJQQxAB",
+ "EgsKB0FuZHJvaWQQAhIHCgNJT1MQAxIHCgNQU1YQBCpOChFMb2dpblJlc3Vs",
+ "dFN0YXR1cxIhCh1Mb2dpblJlc3VsdFN0YXR1c19CYXNlRGVmYXVsdBAAEgYK",
+ "Ak9LEAESDgoKQWNjb3VudEVychACQgJIAWIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::AxibugProtobuf.CommandID), typeof(global::AxibugProtobuf.ErrorCode), typeof(global::AxibugProtobuf.LoginType), typeof(global::AxibugProtobuf.DeviceType), typeof(global::AxibugProtobuf.LoginResultStatus), }, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Login), global::AxibugProtobuf.Protobuf_Login.Parser, new[]{ "LoginType", "DeviceType", "Account", "Password" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Login_RESP), global::AxibugProtobuf.Protobuf_Login_RESP.Parser, new[]{ "Token", "LastLoginDate", "RegDate", "Status" }, null, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs), global::AxibugProtobuf.Protobuf_Cfgs.Parser, new[]{ "Cfgs" }, null, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs), global::AxibugProtobuf.Protobuf_Cfgs.Parser, new[]{ "CompressAdapterType", "Cfgs" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs_Single), global::AxibugProtobuf.Protobuf_Cfgs_Single.Parser, new[]{ "TunnelID", "Port" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_ChatMsg), global::AxibugProtobuf.Protobuf_ChatMsg.Parser, new[]{ "ChatMsg" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_ChatMsg_RESP), global::AxibugProtobuf.Protobuf_ChatMsg_RESP.Parser, new[]{ "NickName", "ChatMsg", "Date" }, null, null, null, null),
@@ -788,6 +788,7 @@ namespace AxibugProtobuf {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_Cfgs(Protobuf_Cfgs other) : this() {
+ compressAdapterType_ = other.compressAdapterType_;
cfgs_ = other.cfgs_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
@@ -797,10 +798,24 @@ namespace AxibugProtobuf {
return new Protobuf_Cfgs(this);
}
+ /// Field number for the "CompressAdapterType" field.
+ public const int CompressAdapterTypeFieldNumber = 1;
+ private int compressAdapterType_;
+ ///
+ ///压缩类型
+ ///
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CompressAdapterType {
+ get { return compressAdapterType_; }
+ set {
+ compressAdapterType_ = value;
+ }
+ }
+
/// Field number for the "cfgs" field.
- public const int CfgsFieldNumber = 1;
+ public const int CfgsFieldNumber = 2;
private static readonly pb::FieldCodec _repeated_cfgs_codec
- = pb::FieldCodec.ForMessage(10, global::AxibugProtobuf.Protobuf_Cfgs_Single.Parser);
+ = pb::FieldCodec.ForMessage(18, global::AxibugProtobuf.Protobuf_Cfgs_Single.Parser);
private readonly pbc::RepeatedField cfgs_ = new pbc::RepeatedField();
///
///配置
@@ -823,6 +838,7 @@ namespace AxibugProtobuf {
if (ReferenceEquals(other, this)) {
return true;
}
+ if (CompressAdapterType != other.CompressAdapterType) return false;
if(!cfgs_.Equals(other.cfgs_)) return false;
return Equals(_unknownFields, other._unknownFields);
}
@@ -830,6 +846,7 @@ namespace AxibugProtobuf {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
+ if (CompressAdapterType != 0) hash ^= CompressAdapterType.GetHashCode();
hash ^= cfgs_.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
@@ -847,6 +864,10 @@ namespace AxibugProtobuf {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
+ if (CompressAdapterType != 0) {
+ output.WriteRawTag(8);
+ output.WriteInt32(CompressAdapterType);
+ }
cfgs_.WriteTo(output, _repeated_cfgs_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
@@ -857,6 +878,10 @@ namespace AxibugProtobuf {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
+ if (CompressAdapterType != 0) {
+ output.WriteRawTag(8);
+ output.WriteInt32(CompressAdapterType);
+ }
cfgs_.WriteTo(ref output, _repeated_cfgs_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
@@ -867,6 +892,9 @@ namespace AxibugProtobuf {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
+ if (CompressAdapterType != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeInt32Size(CompressAdapterType);
+ }
size += cfgs_.CalculateSize(_repeated_cfgs_codec);
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
@@ -879,6 +907,9 @@ namespace AxibugProtobuf {
if (other == null) {
return;
}
+ if (other.CompressAdapterType != 0) {
+ CompressAdapterType = other.CompressAdapterType;
+ }
cfgs_.Add(other.cfgs_);
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
@@ -894,7 +925,11 @@ namespace AxibugProtobuf {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
- case 10: {
+ case 8: {
+ CompressAdapterType = input.ReadInt32();
+ break;
+ }
+ case 18: {
cfgs_.AddEntriesFrom(input, _repeated_cfgs_codec);
break;
}
@@ -912,7 +947,11 @@ namespace AxibugProtobuf {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
- case 10: {
+ case 8: {
+ CompressAdapterType = input.ReadInt32();
+ break;
+ }
+ case 18: {
cfgs_.AddEntriesFrom(ref input, _repeated_cfgs_codec);
break;
}
diff --git a/NoSugarNet.DataHelper/Common/CompressAdapter.cs b/NoSugarNet.DataHelper/Common/CompressAdapter.cs
new file mode 100644
index 0000000..e22ab8f
--- /dev/null
+++ b/NoSugarNet.DataHelper/Common/CompressAdapter.cs
@@ -0,0 +1,93 @@
+using System.IO.Compression;
+
+namespace NoSugarNet.DataHelper
+{
+ public enum E_CompressAdapter
+ {
+ //不压缩
+ None = 0,
+ //GIPZ
+ GZIP_Plan1 = 1,
+ }
+
+ ///
+ /// 压缩适配器
+ ///
+ public class CompressAdapter
+ {
+ IDataCompress mIDataCompress;
+ public CompressAdapter(E_CompressAdapter type)
+ {
+ switch (type)
+ {
+ //不压缩
+ case E_CompressAdapter.None:
+ mIDataCompress = new NoCompress();
+ break;
+ //GZIP Plan1
+ case E_CompressAdapter.GZIP_Plan1:
+ mIDataCompress = new GZipCompress();
+ break;
+ //TODO 其他压缩对比
+ //……
+ default:
+ mIDataCompress = new NoCompress();
+ break;
+ }
+ }
+
+ public byte[] Compress(byte[] data)
+ {
+ return mIDataCompress.Compress(data);
+ }
+ public byte[] Decompress(byte[] data)
+ {
+ return mIDataCompress.Decompress(data);
+ }
+ }
+
+
+ public interface IDataCompress
+ {
+ public byte[] Compress(byte[] data);
+ public byte[] Decompress(byte[] data);
+ }
+
+ public class NoCompress : IDataCompress
+ {
+ public byte[] Compress(byte[] data)
+ {
+ return data;
+ }
+ public byte[] Decompress(byte[] data)
+ {
+ return data;
+ }
+ }
+
+ public class GZipCompress : IDataCompress
+ {
+ public byte[] Compress(byte[] data)
+ {
+ using (var compressedStream = new MemoryStream())
+ using (var zipStream = new GZipStream(compressedStream, CompressionMode.Compress))
+ {
+ zipStream.Write(data, 0, data.Length);
+ zipStream.Close();
+ return compressedStream.ToArray();
+ }
+ }
+
+ public byte[] Decompress(byte[] data)
+ {
+ using (var compressedStream = new MemoryStream(data))
+ using (var zipStream = new GZipStream(compressedStream, CompressionMode.Decompress))
+ using (var resultStream = new MemoryStream())
+ {
+ zipStream.CopyTo(resultStream);
+ return resultStream.ToArray();
+ }
+ }
+ }
+
+}
diff --git a/NoSugarNet.DataHelper/NoSugarNet.DataHelper.csproj b/NoSugarNet.DataHelper/NoSugarNet.DataHelper.csproj
new file mode 100644
index 0000000..fa71b7a
--- /dev/null
+++ b/NoSugarNet.DataHelper/NoSugarNet.DataHelper.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
diff --git a/NoSugarNet.ServerCore/Common/CompressAdapter.cs b/NoSugarNet.ServerCore/Common/CompressAdapter.cs
deleted file mode 100644
index 90b589e..0000000
--- a/NoSugarNet.ServerCore/Common/CompressAdapter.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace NoSugarNet.ServerCore.Common
-{
- ///
- /// 压缩适配器
- ///
- public class CompressAdapter
- {
- IDataCompress mIDataCompress;
- public CompressAdapter(ushort type)
- {
- switch (type)
- {
- //不压缩
- case 0:
- mIDataCompress = new NoCompress();
- break;
- //TODO 其他压缩对比
- default:
- mIDataCompress = new NoCompress();
- break;
- }
- }
-
-
- public byte[] Compress(byte[] data)
- {
- return mIDataCompress.Compress(data);
- }
- public byte[] Decompress(byte[] data)
- {
- return mIDataCompress.Decompress(data);
- }
- }
-
-
- public interface IDataCompress
- {
- public byte[] Compress(byte[] data);
- public byte[] Decompress(byte[] data);
- }
-
- public class NoCompress : IDataCompress
- {
- public byte[] Compress(byte[] data)
- {
- return data;
- }
- public byte[] Decompress(byte[] data)
- {
- return data;
- }
- }
-}
diff --git a/NoSugarNet.ServerCore/Common/Config.cs b/NoSugarNet.ServerCore/Common/Config.cs
index 6623b55..1f45d3c 100644
--- a/NoSugarNet.ServerCore/Common/Config.cs
+++ b/NoSugarNet.ServerCore/Common/Config.cs
@@ -1,4 +1,5 @@
-using System.Text;
+using NoSugarNet.DataHelper;
+using System.Text;
namespace NoSugarNet.ServerCore.Common
{
@@ -12,6 +13,7 @@ namespace NoSugarNet.ServerCore.Common
public static class Config
{
- public static Dictionary Cfgs = new Dictionary();
+ public static Dictionary cfgs = new Dictionary();
+ public static E_CompressAdapter compressAdapterType;
}
}
diff --git a/NoSugarNet.ServerCore/Manager/LocalClientManager.cs b/NoSugarNet.ServerCore/Manager/LocalClientManager.cs
index 05a7018..f00b9ec 100644
--- a/NoSugarNet.ServerCore/Manager/LocalClientManager.cs
+++ b/NoSugarNet.ServerCore/Manager/LocalClientManager.cs
@@ -1,11 +1,11 @@
using AxibugProtobuf;
-using NoSugarNet.ClientCore.Network;
using Google.Protobuf;
+using NoSugarNet.ClientCore.Network;
+using NoSugarNet.DataHelper;
using NoSugarNet.ServerCore.Common;
using ServerCore.Common;
using ServerCore.NetWork;
using System.Net.Sockets;
-using System.Collections.Generic;
namespace ServerCore.Manager
{
@@ -14,6 +14,9 @@ namespace ServerCore.Manager
Dictionary mDictCommKey2ServerLocalClients = new Dictionary();
CompressAdapter mCompressAdapter;
+ public long tReciveAllLenght { get; private set; }
+ public long tSendAllLenght { get;private set; }
+
static long GetCommKey(long Uid, int Tunnel, int Idx)
{
return (Uid * 10000000) + (Tunnel * 10000) + Idx;
@@ -24,10 +27,11 @@ namespace ServerCore.Manager
return CommKey / 10000000;
}
- public LocalClientManager()
+ public LocalClientManager(E_CompressAdapter compressAdapterType)
{
+ ServerManager.g_Log.Debug("初始化压缩适配器" + compressAdapterType);
//初始化压缩适配器,暂时使用0,代表压缩类型
- mCompressAdapter = new CompressAdapter(0);
+ mCompressAdapter = new CompressAdapter(compressAdapterType);
//注册网络消息
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTunnelC2SConnect, Recive_TunnelC2SConnect);
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTunnelC2SDisconnect, Recive_TunnelC2SDisconnect);
@@ -176,14 +180,14 @@ namespace ServerCore.Manager
if (!ServerManager.g_ClientMgr.GetClientByUID(uid, out ClientInfo client))
return;
- if (!Config.Cfgs.ContainsKey(tunnelId))
+ if (!Config.cfgs.ContainsKey(tunnelId))
return;
//开一个线程去建立连接
Thread thread = new Thread(() =>
{
//服务器本地局域网连接指定端口
- TunnelClientData tunnelDataCfg = Config.Cfgs[tunnelId];
+ TunnelClientData tunnelDataCfg = Config.cfgs[tunnelId];
ServerLocalClient serverLocalClient = new ServerLocalClient(uid, tunnelId, (byte)Idx);
//连接成功
if (!serverLocalClient.Init(tunnelDataCfg.ServerLocalTargetIP, tunnelDataCfg.ServerLocalTargetPort))
@@ -279,7 +283,8 @@ namespace ServerCore.Manager
//隧道ID定位投递服务端本地连接
if (!GetServerLocalClient(uid, tunnelId, Idx, out ServerLocalClient serverLocalClient))
return;
-
+ //记录数据长度
+ tSendAllLenght += data.Length;
//解压
data = mCompressAdapter.Decompress(data);
//记录数据长度
@@ -331,8 +336,12 @@ namespace ServerCore.Manager
if (!ServerManager.g_ClientMgr.GetClientByUID(uid, out ClientInfo client))
return;
+
//压缩
data = mCompressAdapter.Compress(data);
+ //记录压缩后数据长度
+ tReciveAllLenght += data.Length;
+
byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_S2C_DATA()
{
TunnelID = tunnelId,
diff --git a/NoSugarNet.ServerCore/Manager/LoginManager.cs b/NoSugarNet.ServerCore/Manager/LoginManager.cs
index 55f22cb..569e581 100644
--- a/NoSugarNet.ServerCore/Manager/LoginManager.cs
+++ b/NoSugarNet.ServerCore/Manager/LoginManager.cs
@@ -30,12 +30,13 @@ namespace ServerCore.Manager
ServerManager.g_ClientMgr.ClientSend(cinfo, (int)CommandID.CmdLogin, (int)ErrorCode.ErrorOk, respData);
Protobuf_Cfgs cfgsSP = new Protobuf_Cfgs();
- byte[] keys = Config.Cfgs.Keys.ToArray();
- for (int i = 0; i < Config.Cfgs.Count; i++)
+ byte[] keys = Config.cfgs.Keys.ToArray();
+ for (int i = 0; i < Config.cfgs.Count; i++)
{
- TunnelClientData cfg = Config.Cfgs[keys[i]];
+ TunnelClientData cfg = Config.cfgs[keys[i]];
cfgsSP.Cfgs.Add(new Protobuf_Cfgs_Single() { TunnelID = cfg.TunnelId, Port = cfg.ClientLocalPort });
}
+ cfgsSP.CompressAdapterType = (int)Config.compressAdapterType;
byte[] respDataCfg = ProtoBufHelper.Serizlize(cfgsSP);
ServerManager.g_ClientMgr.ClientSend(cinfo, (int)CommandID.CmdCfgs, (int)ErrorCode.ErrorOk, respDataCfg);
diff --git a/NoSugarNet.ServerCore/Manager/ServerLocalClient/ServerLocalClient.cs b/NoSugarNet.ServerCore/Manager/ServerLocalClient/ServerLocalClient.cs
index 999439a..4a78469 100644
--- a/NoSugarNet.ServerCore/Manager/ServerLocalClient/ServerLocalClient.cs
+++ b/NoSugarNet.ServerCore/Manager/ServerLocalClient/ServerLocalClient.cs
@@ -1,6 +1,7 @@
using HaoYueNet.ClientNetwork.OtherMode;
using ServerCore.Manager;
using System;
+using System.Security.Cryptography;
namespace NoSugarNet.ClientCore.Network
{
diff --git a/NoSugarNet.ServerCore/Manager/ServerManager.cs b/NoSugarNet.ServerCore/Manager/ServerManager.cs
index 0274b9e..8542c82 100644
--- a/NoSugarNet.ServerCore/Manager/ServerManager.cs
+++ b/NoSugarNet.ServerCore/Manager/ServerManager.cs
@@ -1,4 +1,5 @@
-using NoSugarNet.ServerCore;
+using NoSugarNet.DataHelper;
+using NoSugarNet.ServerCore;
using NoSugarNet.ServerCore.Common;
using ServerCore.NetWork;
using System.Net;
@@ -24,15 +25,16 @@ namespace ServerCore.Manager
public static event OnUpdateStatusHandler OnUpdateStatus;
#endregion
- public static void InitServer(int port, Dictionary cfgs)
+ public static void InitServer(int port, Dictionary cfgs,int compressAdapterType = 1)
{
- Config.Cfgs = cfgs;
+ Config.cfgs = cfgs;
+ Config.compressAdapterType = (E_CompressAdapter)compressAdapterType;
g_ClientMgr = new ClientManager();
g_ClientMgr.Init(45000, 120);
g_Log = new LogManager();
g_Login = new LoginManager();
g_Chat = new ChatManager();
- g_Local = new LocalClientManager();
+ g_Local = new LocalClientManager((E_CompressAdapter)compressAdapterType);
//g_SocketMgr = new IOCPNetWork(1024, 1024);
g_SocketMgr = new IOCPNetWork(1024, 4096);
@@ -57,10 +59,14 @@ namespace ServerCore.Manager
{
TunnelCount = TunnelCount,
ClientUserCount = ClientUserCount,
- SendAllLenght = resultSendAllLenght,
- ReciveAllLenght = resultReciveAllLenght,
- ReciveSecSpeed = (resultReciveAllLenght - netStatus.ReciveAllLenght) / (TimerInterval / 1000),
- SendSecSpeed = (resultSendAllLenght - netStatus.SendAllLenght) / (TimerInterval / 1000),
+ srcSendAllLenght = resultSendAllLenght,
+ srcReciveAllLenght = resultReciveAllLenght,
+ srcReciveSecSpeed = (resultReciveAllLenght - netStatus.srcReciveAllLenght) / (TimerInterval / 1000),
+ srcSendSecSpeed = (resultSendAllLenght - netStatus.srcSendAllLenght) / (TimerInterval / 1000),
+ tSendAllLenght = g_Local.tSendAllLenght,
+ tReciveAllLenght = g_Local.tReciveAllLenght,
+ tSendSecSpeed = (g_Local.tSendAllLenght - netStatus.tSendAllLenght) / (TimerInterval / 1000),
+ tReciveSecSpeed = (g_Local.tReciveAllLenght - netStatus.tReciveAllLenght) / (TimerInterval / 1000),
};
netStatus = resutnetStatus;
OnUpdateStatus?.Invoke(resutnetStatus);
diff --git a/NoSugarNet.ServerCore/NetStatus.cs b/NoSugarNet.ServerCore/NetStatus.cs
index db3d95f..f6a4dae 100644
--- a/NoSugarNet.ServerCore/NetStatus.cs
+++ b/NoSugarNet.ServerCore/NetStatus.cs
@@ -4,9 +4,13 @@
{
public int ClientUserCount;
public int TunnelCount;
- public long ReciveAllLenght;
- public long SendAllLenght;
- public long ReciveSecSpeed;
- public long SendSecSpeed;
+ public long srcReciveAllLenght;
+ public long srcSendAllLenght;
+ public long srcReciveSecSpeed;
+ public long srcSendSecSpeed;
+ public long tReciveAllLenght;
+ public long tSendAllLenght;
+ public long tReciveSecSpeed;
+ public long tSendSecSpeed;
}
}
diff --git a/NoSugarNet.ServerCore/NoSugarNet.ServerCore.csproj b/NoSugarNet.ServerCore/NoSugarNet.ServerCore.csproj
index dd8c631..01ca97b 100644
--- a/NoSugarNet.ServerCore/NoSugarNet.ServerCore.csproj
+++ b/NoSugarNet.ServerCore/NoSugarNet.ServerCore.csproj
@@ -6,6 +6,10 @@
enable
+
+
+
+
..\Lib\Google.Protobuf.dll
diff --git a/NoSugarNet.ServerCore/NoSugarNet.ServerCore.csproj.user b/NoSugarNet.ServerCore/NoSugarNet.ServerCore.csproj.user
new file mode 100644
index 0000000..d3ae5c3
--- /dev/null
+++ b/NoSugarNet.ServerCore/NoSugarNet.ServerCore.csproj.user
@@ -0,0 +1,6 @@
+
+
+
+ <_LastSelectedProfileId>F:\Sin365\NoSugarNet\NoSugarNet.ServerCore\Properties\PublishProfiles\FolderProfile.pubxml
+
+
\ No newline at end of file
diff --git a/NoSugarNet.ServerCore/Properties/PublishProfiles/FolderProfile.pubxml b/NoSugarNet.ServerCore/Properties/PublishProfiles/FolderProfile.pubxml
new file mode 100644
index 0000000..d37ba18
--- /dev/null
+++ b/NoSugarNet.ServerCore/Properties/PublishProfiles/FolderProfile.pubxml
@@ -0,0 +1,18 @@
+
+
+
+
+ Release
+ Any CPU
+ bin\Release\net8.0\publish\win-x64\
+ FileSystem
+ <_TargetId>Folder
+ net8.0
+ win-x64
+ false
+ false
+ false
+
+
\ No newline at end of file
diff --git a/NoSugarNet.ServerCore/Properties/PublishProfiles/FolderProfile.pubxml.user b/NoSugarNet.ServerCore/Properties/PublishProfiles/FolderProfile.pubxml.user
new file mode 100644
index 0000000..8aebd5c
--- /dev/null
+++ b/NoSugarNet.ServerCore/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -0,0 +1,10 @@
+
+
+
+
+ True|2024-01-25T09:08:35.3176032Z;
+
+
+
\ No newline at end of file
diff --git a/NoSugarNet.ServerCore/Protobuf/ProtobufNoSugar.cs b/NoSugarNet.ServerCore/Protobuf/ProtobufNoSugar.cs
index 549e751..dce38be 100644
--- a/NoSugarNet.ServerCore/Protobuf/ProtobufNoSugar.cs
+++ b/NoSugarNet.ServerCore/Protobuf/ProtobufNoSugar.cs
@@ -31,39 +31,39 @@ namespace AxibugProtobuf {
"cmQYBCABKAkifwoTUHJvdG9idWZfTG9naW5fUkVTUBINCgVUb2tlbhgBIAEo",
"CRIVCg1MYXN0TG9naW5EYXRlGAIgASgJEg8KB1JlZ0RhdGUYAyABKAkSMQoG",
"U3RhdHVzGAQgASgOMiEuQXhpYnVnUHJvdG9idWYuTG9naW5SZXN1bHRTdGF0",
- "dXMiQwoNUHJvdG9idWZfQ2ZncxIyCgRjZmdzGAEgAygLMiQuQXhpYnVnUHJv",
- "dG9idWYuUHJvdG9idWZfQ2Znc19TaW5nbGUiNgoUUHJvdG9idWZfQ2Znc19T",
- "aW5nbGUSEAoIVHVubmVsSUQYASABKA0SDAoEUG9ydBgCIAEoBSIjChBQcm90",
- "b2J1Zl9DaGF0TXNnEg8KB0NoYXRNc2cYASABKAkiSAoVUHJvdG9idWZfQ2hh",
- "dE1zZ19SRVNQEhAKCE5pY2tOYW1lGAEgASgJEg8KB0NoYXRNc2cYAiABKAkS",
- "DAoERGF0ZRgDIAEoAy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sSUQYASABKA0SCwoDSWR4GAIgASgNEhoKEkh1bnRlck5ldENvcmVfRGF0",
+ "YRgDIAEoDCJOChFQcm90b2J1Zl9TMkNfREFUQRIQCghUdW5uZWxJRBgBIAEo",
+ "DRILCgNJZHgYAiABKA0SGgoSSHVudGVyTmV0Q29yZV9EYXRhGAMgASgMKvoB",
+ "CglDb21tYW5kSUQSDgoKQ01EX0RFRkFVTBAAEg4KCUNNRF9MT0dJThDRDxIN",
+ "CghDTURfQ0ZHUxC5FxIQCgtDTURfQ0hBVE1TRxChHxIbChZDTURfVFVOTkVM",
+ "X0MyU19DT05ORUNUEIgnEhsKFkNNRF9UVU5ORUxfUzJDX0NPTk5FQ1QQiScS",
+ "HgoZQ01EX1RVTk5FTF9DMlNfRElTQ09OTkVDVBCKJxIeChlDTURfVFVOTkVM",
+ "X1MyQ19ESVNDT05ORUNUEIsnEhgKE0NNRF9UVU5ORUxfQzJTX0RBVEEQjCcS",
+ "GAoTQ01EX1RVTk5FTF9TMkNfREFUQRCNJyorCglFcnJvckNvZGUSEAoMRVJS",
+ "T1JfREVGQVVMEAASDAoIRVJST1JfT0sQASo+CglMb2dpblR5cGUSDwoLQmFz",
+ "ZURlZmF1bHQQABIOCgpIYW9ZdWVBdXRoEAESBwoDQkYzEAMSBwoDQkY0EAQq",
+ "SwoKRGV2aWNlVHlwZRIWChJEZXZpY2VUeXBlX0RlZmF1bHQQABIGCgJQQxAB",
+ "EgsKB0FuZHJvaWQQAhIHCgNJT1MQAxIHCgNQU1YQBCpOChFMb2dpblJlc3Vs",
+ "dFN0YXR1cxIhCh1Mb2dpblJlc3VsdFN0YXR1c19CYXNlRGVmYXVsdBAAEgYK",
+ "Ak9LEAESDgoKQWNjb3VudEVychACQgJIAWIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::AxibugProtobuf.CommandID), typeof(global::AxibugProtobuf.ErrorCode), typeof(global::AxibugProtobuf.LoginType), typeof(global::AxibugProtobuf.DeviceType), typeof(global::AxibugProtobuf.LoginResultStatus), }, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Login), global::AxibugProtobuf.Protobuf_Login.Parser, new[]{ "LoginType", "DeviceType", "Account", "Password" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Login_RESP), global::AxibugProtobuf.Protobuf_Login_RESP.Parser, new[]{ "Token", "LastLoginDate", "RegDate", "Status" }, null, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs), global::AxibugProtobuf.Protobuf_Cfgs.Parser, new[]{ "Cfgs" }, null, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs), global::AxibugProtobuf.Protobuf_Cfgs.Parser, new[]{ "CompressAdapterType", "Cfgs" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs_Single), global::AxibugProtobuf.Protobuf_Cfgs_Single.Parser, new[]{ "TunnelID", "Port" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_ChatMsg), global::AxibugProtobuf.Protobuf_ChatMsg.Parser, new[]{ "ChatMsg" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_ChatMsg_RESP), global::AxibugProtobuf.Protobuf_ChatMsg_RESP.Parser, new[]{ "NickName", "ChatMsg", "Date" }, null, null, null, null),
@@ -788,6 +788,7 @@ namespace AxibugProtobuf {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_Cfgs(Protobuf_Cfgs other) : this() {
+ compressAdapterType_ = other.compressAdapterType_;
cfgs_ = other.cfgs_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
@@ -797,10 +798,24 @@ namespace AxibugProtobuf {
return new Protobuf_Cfgs(this);
}
+ /// Field number for the "CompressAdapterType" field.
+ public const int CompressAdapterTypeFieldNumber = 1;
+ private int compressAdapterType_;
+ ///
+ ///压缩类型
+ ///
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CompressAdapterType {
+ get { return compressAdapterType_; }
+ set {
+ compressAdapterType_ = value;
+ }
+ }
+
/// Field number for the "cfgs" field.
- public const int CfgsFieldNumber = 1;
+ public const int CfgsFieldNumber = 2;
private static readonly pb::FieldCodec _repeated_cfgs_codec
- = pb::FieldCodec.ForMessage(10, global::AxibugProtobuf.Protobuf_Cfgs_Single.Parser);
+ = pb::FieldCodec.ForMessage(18, global::AxibugProtobuf.Protobuf_Cfgs_Single.Parser);
private readonly pbc::RepeatedField cfgs_ = new pbc::RepeatedField();
///
///配置
@@ -823,6 +838,7 @@ namespace AxibugProtobuf {
if (ReferenceEquals(other, this)) {
return true;
}
+ if (CompressAdapterType != other.CompressAdapterType) return false;
if(!cfgs_.Equals(other.cfgs_)) return false;
return Equals(_unknownFields, other._unknownFields);
}
@@ -830,6 +846,7 @@ namespace AxibugProtobuf {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
+ if (CompressAdapterType != 0) hash ^= CompressAdapterType.GetHashCode();
hash ^= cfgs_.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
@@ -847,6 +864,10 @@ namespace AxibugProtobuf {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
+ if (CompressAdapterType != 0) {
+ output.WriteRawTag(8);
+ output.WriteInt32(CompressAdapterType);
+ }
cfgs_.WriteTo(output, _repeated_cfgs_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
@@ -857,6 +878,10 @@ namespace AxibugProtobuf {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
+ if (CompressAdapterType != 0) {
+ output.WriteRawTag(8);
+ output.WriteInt32(CompressAdapterType);
+ }
cfgs_.WriteTo(ref output, _repeated_cfgs_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
@@ -867,6 +892,9 @@ namespace AxibugProtobuf {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
+ if (CompressAdapterType != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeInt32Size(CompressAdapterType);
+ }
size += cfgs_.CalculateSize(_repeated_cfgs_codec);
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
@@ -879,6 +907,9 @@ namespace AxibugProtobuf {
if (other == null) {
return;
}
+ if (other.CompressAdapterType != 0) {
+ CompressAdapterType = other.CompressAdapterType;
+ }
cfgs_.Add(other.cfgs_);
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
@@ -894,7 +925,11 @@ namespace AxibugProtobuf {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
- case 10: {
+ case 8: {
+ CompressAdapterType = input.ReadInt32();
+ break;
+ }
+ case 18: {
cfgs_.AddEntriesFrom(input, _repeated_cfgs_codec);
break;
}
@@ -912,7 +947,11 @@ namespace AxibugProtobuf {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
- case 10: {
+ case 8: {
+ CompressAdapterType = input.ReadInt32();
+ break;
+ }
+ case 18: {
cfgs_.AddEntriesFrom(ref input, _repeated_cfgs_codec);
break;
}
diff --git a/NoSugarNet.sln b/NoSugarNet.sln
index 708ff58..c7bf68b 100644
--- a/NoSugarNet.sln
+++ b/NoSugarNet.sln
@@ -10,15 +10,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{EDA9D3FD-1A7
Lib\HaoYueNet.ServerNetwork.dll = Lib\HaoYueNet.ServerNetwork.dll
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NoSugarNet.ServerCore", "NoSugarNet.ServerCore\NoSugarNet.ServerCore.csproj", "{25FB6F12-4619-4D2C-8FC1-70AAAA8AD100}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NoSugarNet.ServerCore", "NoSugarNet.ServerCore\NoSugarNet.ServerCore.csproj", "{25FB6F12-4619-4D2C-8FC1-70AAAA8AD100}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NoSugarNet.ClientCore", "NoSugarNet.ClientCore\NoSugarNet.ClientCore.csproj", "{80AF9D64-681C-4B6F-B2FF-5DD847186749}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NoSugarNet.ClientCore", "NoSugarNet.ClientCore\NoSugarNet.ClientCore.csproj", "{80AF9D64-681C-4B6F-B2FF-5DD847186749}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sample", "Sample", "{5E65F25A-8B59-4FC7-8582-C6887C3CD0A1}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NoSugarNet.ClientCli", "Sample\NoSugarNet.ClientCli\NoSugarNet.ClientCli.csproj", "{29D76CF3-BF7E-45A5-9957-2CBC0A41B6FB}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NoSugarNet.ClientCli", "Sample\NoSugarNet.ClientCli\NoSugarNet.ClientCli.csproj", "{29D76CF3-BF7E-45A5-9957-2CBC0A41B6FB}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NoSugarNet.ServerCli", "Sample\NoSugarNet.ServerCli\NoSugarNet.ServerCli.csproj", "{65220036-9A81-49FA-A5BC-DA06783D2E52}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NoSugarNet.ServerCli", "Sample\NoSugarNet.ServerCli\NoSugarNet.ServerCli.csproj", "{65220036-9A81-49FA-A5BC-DA06783D2E52}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NoSugarNet.DataHelper", "NoSugarNet.DataHelper\NoSugarNet.DataHelper.csproj", "{3C41B685-B46B-4057-826B-C8C6F395BFA8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -42,6 +44,10 @@ Global
{65220036-9A81-49FA-A5BC-DA06783D2E52}.Debug|Any CPU.Build.0 = Debug|Any CPU
{65220036-9A81-49FA-A5BC-DA06783D2E52}.Release|Any CPU.ActiveCfg = Release|Any CPU
{65220036-9A81-49FA-A5BC-DA06783D2E52}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3C41B685-B46B-4057-826B-C8C6F395BFA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3C41B685-B46B-4057-826B-C8C6F395BFA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3C41B685-B46B-4057-826B-C8C6F395BFA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3C41B685-B46B-4057-826B-C8C6F395BFA8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/ProtobufCore/out/CS/ProtobufNoSugar.cs b/ProtobufCore/out/CS/ProtobufNoSugar.cs
index 549e751..dce38be 100644
--- a/ProtobufCore/out/CS/ProtobufNoSugar.cs
+++ b/ProtobufCore/out/CS/ProtobufNoSugar.cs
@@ -31,39 +31,39 @@ namespace AxibugProtobuf {
"cmQYBCABKAkifwoTUHJvdG9idWZfTG9naW5fUkVTUBINCgVUb2tlbhgBIAEo",
"CRIVCg1MYXN0TG9naW5EYXRlGAIgASgJEg8KB1JlZ0RhdGUYAyABKAkSMQoG",
"U3RhdHVzGAQgASgOMiEuQXhpYnVnUHJvdG9idWYuTG9naW5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RGV2aWNlVHlwZRIWChJEZXZpY2VUeXBlX0RlZmF1bHQQABIGCgJQQxAB",
+ "EgsKB0FuZHJvaWQQAhIHCgNJT1MQAxIHCgNQU1YQBCpOChFMb2dpblJlc3Vs",
+ "dFN0YXR1cxIhCh1Mb2dpblJlc3VsdFN0YXR1c19CYXNlRGVmYXVsdBAAEgYK",
+ "Ak9LEAESDgoKQWNjb3VudEVychACQgJIAWIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::AxibugProtobuf.CommandID), typeof(global::AxibugProtobuf.ErrorCode), typeof(global::AxibugProtobuf.LoginType), typeof(global::AxibugProtobuf.DeviceType), typeof(global::AxibugProtobuf.LoginResultStatus), }, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Login), global::AxibugProtobuf.Protobuf_Login.Parser, new[]{ "LoginType", "DeviceType", "Account", "Password" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Login_RESP), global::AxibugProtobuf.Protobuf_Login_RESP.Parser, new[]{ "Token", "LastLoginDate", "RegDate", "Status" }, null, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs), global::AxibugProtobuf.Protobuf_Cfgs.Parser, new[]{ "Cfgs" }, null, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs), global::AxibugProtobuf.Protobuf_Cfgs.Parser, new[]{ "CompressAdapterType", "Cfgs" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs_Single), global::AxibugProtobuf.Protobuf_Cfgs_Single.Parser, new[]{ "TunnelID", "Port" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_ChatMsg), global::AxibugProtobuf.Protobuf_ChatMsg.Parser, new[]{ "ChatMsg" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_ChatMsg_RESP), global::AxibugProtobuf.Protobuf_ChatMsg_RESP.Parser, new[]{ "NickName", "ChatMsg", "Date" }, null, null, null, null),
@@ -788,6 +788,7 @@ namespace AxibugProtobuf {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_Cfgs(Protobuf_Cfgs other) : this() {
+ compressAdapterType_ = other.compressAdapterType_;
cfgs_ = other.cfgs_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
@@ -797,10 +798,24 @@ namespace AxibugProtobuf {
return new Protobuf_Cfgs(this);
}
+ /// Field number for the "CompressAdapterType" field.
+ public const int CompressAdapterTypeFieldNumber = 1;
+ private int compressAdapterType_;
+ ///
+ ///压缩类型
+ ///
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CompressAdapterType {
+ get { return compressAdapterType_; }
+ set {
+ compressAdapterType_ = value;
+ }
+ }
+
/// Field number for the "cfgs" field.
- public const int CfgsFieldNumber = 1;
+ public const int CfgsFieldNumber = 2;
private static readonly pb::FieldCodec _repeated_cfgs_codec
- = pb::FieldCodec.ForMessage(10, global::AxibugProtobuf.Protobuf_Cfgs_Single.Parser);
+ = pb::FieldCodec.ForMessage(18, global::AxibugProtobuf.Protobuf_Cfgs_Single.Parser);
private readonly pbc::RepeatedField cfgs_ = new pbc::RepeatedField();
///
///配置
@@ -823,6 +838,7 @@ namespace AxibugProtobuf {
if (ReferenceEquals(other, this)) {
return true;
}
+ if (CompressAdapterType != other.CompressAdapterType) return false;
if(!cfgs_.Equals(other.cfgs_)) return false;
return Equals(_unknownFields, other._unknownFields);
}
@@ -830,6 +846,7 @@ namespace AxibugProtobuf {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
+ if (CompressAdapterType != 0) hash ^= CompressAdapterType.GetHashCode();
hash ^= cfgs_.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
@@ -847,6 +864,10 @@ namespace AxibugProtobuf {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
+ if (CompressAdapterType != 0) {
+ output.WriteRawTag(8);
+ output.WriteInt32(CompressAdapterType);
+ }
cfgs_.WriteTo(output, _repeated_cfgs_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
@@ -857,6 +878,10 @@ namespace AxibugProtobuf {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
+ if (CompressAdapterType != 0) {
+ output.WriteRawTag(8);
+ output.WriteInt32(CompressAdapterType);
+ }
cfgs_.WriteTo(ref output, _repeated_cfgs_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
@@ -867,6 +892,9 @@ namespace AxibugProtobuf {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
+ if (CompressAdapterType != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeInt32Size(CompressAdapterType);
+ }
size += cfgs_.CalculateSize(_repeated_cfgs_codec);
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
@@ -879,6 +907,9 @@ namespace AxibugProtobuf {
if (other == null) {
return;
}
+ if (other.CompressAdapterType != 0) {
+ CompressAdapterType = other.CompressAdapterType;
+ }
cfgs_.Add(other.cfgs_);
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
@@ -894,7 +925,11 @@ namespace AxibugProtobuf {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
- case 10: {
+ case 8: {
+ CompressAdapterType = input.ReadInt32();
+ break;
+ }
+ case 18: {
cfgs_.AddEntriesFrom(input, _repeated_cfgs_codec);
break;
}
@@ -912,7 +947,11 @@ namespace AxibugProtobuf {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
- case 10: {
+ case 8: {
+ CompressAdapterType = input.ReadInt32();
+ break;
+ }
+ case 18: {
cfgs_.AddEntriesFrom(ref input, _repeated_cfgs_codec);
break;
}
diff --git a/ProtobufCore/proto/protobuf_NoSugar.proto b/ProtobufCore/proto/protobuf_NoSugar.proto
index c3f578f..7599774 100644
--- a/ProtobufCore/proto/protobuf_NoSugar.proto
+++ b/ProtobufCore/proto/protobuf_NoSugar.proto
@@ -72,7 +72,8 @@ message Protobuf_Login_RESP
//配置下行
message Protobuf_Cfgs
{
- repeated Protobuf_Cfgs_Single cfgs = 1;//配置
+ int32 CompressAdapterType = 1;//压缩类型
+ repeated Protobuf_Cfgs_Single cfgs = 2;//配置
}
message Protobuf_Cfgs_Single
diff --git a/Sample/NoSugarNet.ServerCli/Config.cs b/Sample/NoSugarNet.ServerCli/Config.cs
index 75251dd..04aea06 100644
--- a/Sample/NoSugarNet.ServerCli/Config.cs
+++ b/Sample/NoSugarNet.ServerCli/Config.cs
@@ -8,6 +8,7 @@ namespace NoSugarNet.ServerCli
public class ConfigDataModel
{
public int ServerPort { get; set; }
+ public int CompressAdapterType { get; set; }
public List TunnelList { get; set; }
}
diff --git a/Sample/NoSugarNet.ServerCli/Program.cs b/Sample/NoSugarNet.ServerCli/Program.cs
index e7a0e8a..3f9414d 100644
--- a/Sample/NoSugarNet.ServerCli/Program.cs
+++ b/Sample/NoSugarNet.ServerCli/Program.cs
@@ -30,7 +30,7 @@ namespace NoSugarNet.ServerCli
}
ServerManager.OnUpdateStatus += OnUpdateStatus;
- ServerManager.InitServer(Config.cfg.ServerPort, dictTunnel);
+ ServerManager.InitServer(Config.cfg.ServerPort, dictTunnel,Config.cfg.CompressAdapterType);
while (true)
{
@@ -40,8 +40,8 @@ namespace NoSugarNet.ServerCli
static void OnUpdateStatus(NetStatus netState)
{
- string info = $"{Title} RecLen:{netState.ReciveAllLenght} SendLen:{netState.SendAllLenght} tUserNum:{netState.ClientUserCount} tTunnelNum:{netState.TunnelCount} recSpeed:{ConvertBytesToKilobytes(netState.ReciveSecSpeed)}K/s sendSpeed:{ConvertBytesToKilobytes(netState.SendSecSpeed)}K/s";
- Console.Title = info;
+ string info = $"User:{netState.ClientUserCount} Tun:{netState.TunnelCount} rec:{netState.srcReciveAllLenght}|{netState.tReciveAllLenght} {ConvertBytesToKilobytes(netState.srcReciveSecSpeed)}K/s|{ConvertBytesToKilobytes(netState.tReciveSecSpeed)}K/s send:{netState.srcSendAllLenght}|{netState.tSendAllLenght} {ConvertBytesToKilobytes(netState.srcSendSecSpeed)}K/s|{ConvertBytesToKilobytes(netState.tSendSecSpeed)}K/s";
+ Console.Title = Title + info;
Console.WriteLine(info);
}
diff --git a/Sample/NoSugarNet.ServerCli/Properties/PublishProfiles/FolderProfile.pubxml.user b/Sample/NoSugarNet.ServerCli/Properties/PublishProfiles/FolderProfile.pubxml.user
index c6eb72d..63df8fc 100644
--- a/Sample/NoSugarNet.ServerCli/Properties/PublishProfiles/FolderProfile.pubxml.user
+++ b/Sample/NoSugarNet.ServerCli/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
- True|2024-01-23T10:28:01.1220581Z;True|2024-01-23T16:36:21.1141328+08:00;
+ True|2024-01-25T09:09:07.9161603Z;True|2024-01-23T18:28:01.1220581+08:00;True|2024-01-23T16:36:21.1141328+08:00;
\ No newline at end of file