diff --git a/Lib/NetLib_Standard2/HaoYueNet.ClientNetwork.Standard2.dll b/Lib/NetLib_Standard2/HaoYueNet.ClientNetwork.Standard2.dll
new file mode 100644
index 0000000..3802b84
Binary files /dev/null and b/Lib/NetLib_Standard2/HaoYueNet.ClientNetwork.Standard2.dll differ
diff --git a/Lib/NetLib_Standard2/HaoYueNet.ClientNetworkNet.Standard2.dll b/Lib/NetLib_Standard2/HaoYueNet.ClientNetworkNet.Standard2.dll
deleted file mode 100644
index b1390f1..0000000
Binary files a/Lib/NetLib_Standard2/HaoYueNet.ClientNetworkNet.Standard2.dll and /dev/null differ
diff --git a/NoSugarNet.Adapter/NoSugarNet.Adapter.csproj.user b/NoSugarNet.Adapter/NoSugarNet.Adapter.csproj.user
new file mode 100644
index 0000000..beee134
--- /dev/null
+++ b/NoSugarNet.Adapter/NoSugarNet.Adapter.csproj.user
@@ -0,0 +1,6 @@
+
+
+
+ <_LastSelectedProfileId>F:\Sin365\NoSugarNet\NoSugarNet.Adapter\Properties\PublishProfiles\FolderProfile.pubxml
+
+
\ No newline at end of file
diff --git a/NoSugarNet.ClientCli.Standard2/Config.cs b/NoSugarNet.ClientCli.Standard2/Config.cs
new file mode 100644
index 0000000..4770d4e
--- /dev/null
+++ b/NoSugarNet.ClientCli.Standard2/Config.cs
@@ -0,0 +1,73 @@
+using System.Text;
+using System.Text.Encodings.Web;
+using System.Text.Json;
+using System.Text.Unicode;
+
+namespace NoSugarNet.ClientCli
+{
+
+ public class ConfigDataModel
+ {
+ public string ServerIP { get; set; }
+ public int ServerPort { get; set; }
+ public int CompressAdapterType { get; set; }
+ public List TunnelList { get; set; }
+ }
+
+ public class ConfigDataModel_Single
+ {
+ public string LocalTargetIP { get; set; }
+ public int LocalTargetPort { get; set; }
+ public int RemoteLocalPort { get; set; }
+ }
+
+ public static class Config
+ {
+ public static ConfigDataModel cfg;
+ public static bool LoadConfig()
+ {
+ try
+ {
+ string path = System.Environment.CurrentDirectory + "//config.cfg";
+ if (!File.Exists(path))
+ {
+ ConfigDataModel sampleCfg = new ConfigDataModel
+ {
+ ServerIP = "127.0.0.1",
+ ServerPort = 1000,
+ TunnelList = new List()
+ {
+ new ConfigDataModel_Single(){ LocalTargetIP = "127.0.0.1",LocalTargetPort=3389,RemoteLocalPort = 20001},
+ new ConfigDataModel_Single(){ LocalTargetIP = "127.0.0.1",LocalTargetPort=3389,RemoteLocalPort = 20002}
+ }
+ };
+
+ string jsonString = JsonSerializer.Serialize(sampleCfg, new JsonSerializerOptions()
+ {
+ // 整齐打印
+ WriteIndented = true,
+ //重新编码,解决中文乱码问题
+ Encoder = JavaScriptEncoder.Create(UnicodeRanges.All)
+ });
+ System.IO.File.WriteAllText(path, jsonString, Encoding.UTF8);
+
+ Console.WriteLine("未找到配置,已生成模板,请浏览" + path);
+ return false;
+ }
+ StreamReader sr = new StreamReader(path, Encoding.Default);
+ String jsonstr = sr.ReadToEnd();
+ cfg = JsonSerializer.Deserialize(jsonstr);
+ sr.Close();
+ if (cfg?.TunnelList.Count > 0)
+ return true;
+ else
+ return false;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("配置文件异常:" + ex.ToString());
+ return false;
+ }
+ }
+ }
+}
diff --git a/NoSugarNet.ClientCli.Standard2/NoSugarNet.ClientCli.Standard2.csproj b/NoSugarNet.ClientCli.Standard2/NoSugarNet.ClientCli.Standard2.csproj
new file mode 100644
index 0000000..5360dad
--- /dev/null
+++ b/NoSugarNet.ClientCli.Standard2/NoSugarNet.ClientCli.Standard2.csproj
@@ -0,0 +1,14 @@
+
+
+
+ Exe
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/NoSugarNet.ClientCli.Standard2/Program.cs b/NoSugarNet.ClientCli.Standard2/Program.cs
new file mode 100644
index 0000000..99aba84
--- /dev/null
+++ b/NoSugarNet.ClientCli.Standard2/Program.cs
@@ -0,0 +1,77 @@
+using NoSugarNet.ClientCore;
+using NoSugarNet.ClientCore.Common;
+
+namespace NoSugarNet.ClientCli.Standard2
+{
+ internal class Program
+ {
+ static string Title = "NoSugarNetClient";
+ static void Main(string[] args)
+ {
+ if (!Config.LoadConfig())
+ {
+ Console.WriteLine("配置文件错误");
+ Console.ReadLine();
+ return;
+ }
+
+ AppNoSugarNet.OnUpdateStatus += OnUpdateStatus;
+
+ Dictionary dictTunnel = new Dictionary();
+ for (int i = 0; i < Config.cfg.TunnelList.Count; i++)
+ {
+ ConfigDataModel_Single cfgSingle = Config.cfg.TunnelList[i];
+ dictTunnel[(byte)i] = new TunnelClientData()
+ {
+ TunnelId = (byte)i,
+ LocalTargetIP = cfgSingle.LocalTargetIP,
+ LocalTargetPort = (ushort)cfgSingle.LocalTargetPort,
+ RemoteLocalPort = (ushort)cfgSingle.RemoteLocalPort,
+ };
+ }
+
+ AppNoSugarNet.Init(dictTunnel, Config.cfg.CompressAdapterType, OnNoSugarNetLog);
+ AppNoSugarNet.Connect(Config.cfg.ServerIP, Config.cfg.ServerPort);
+ while (true)
+ {
+ string CommandStr = Console.ReadLine();
+ string Command = "";
+ Command = ((CommandStr.IndexOf(" ") <= 0) ? CommandStr : CommandStr.Substring(0, CommandStr.IndexOf(" ")));
+ string[] CmdArr = CommandStr.Split(' ');
+ switch (Command)
+ {
+ case "con":
+ AppNoSugarNet.Connect(Config.cfg.ServerIP, Config.cfg.ServerPort);
+ break;
+ case "tlist":
+ AppNoSugarNet.forwardlocal.GetClientCount(out int ClientUserCount, out int TunnelCount);
+ Console.WriteLine($"GetClientCount->{ClientUserCount} TunnelCount->{TunnelCount}");
+
+ AppNoSugarNet.forwardlocal.GetClientDebugInfo();
+ break;
+ case "stop":
+ AppNoSugarNet.Close();
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ static void OnUpdateStatus(NetStatus Forward_NetStatus, NetStatus Reverse_NetStatus)
+ {
+ string info = $"Forward: t:{Forward_NetStatus.TunnelCount} r:{ConvertBytesToKilobytes(Forward_NetStatus.srcReciveSecSpeed)}K/s|{ConvertBytesToKilobytes(Forward_NetStatus.tReciveSecSpeed)}K/s s: {ConvertBytesToKilobytes(Forward_NetStatus.srcSendSecSpeed)}K/s|{ConvertBytesToKilobytes(Forward_NetStatus.tSendSecSpeed)}K/s" +
+ $"| Reverse t:{Reverse_NetStatus.TunnelCount} r:{ConvertBytesToKilobytes(Reverse_NetStatus.srcReciveSecSpeed)}K/s|{ConvertBytesToKilobytes(Reverse_NetStatus.tReciveSecSpeed)}K/s s: {ConvertBytesToKilobytes(Reverse_NetStatus.srcSendSecSpeed)}K/s|{ConvertBytesToKilobytes(Reverse_NetStatus.tSendSecSpeed)}K/s";
+ Console.Title = Title + info;
+ Console.WriteLine(info);
+ }
+ static string ConvertBytesToKilobytes(long bytes)
+ {
+ return Math.Round((double)bytes / 1024, 2).ToString("F2");
+ }
+ static void OnNoSugarNetLog(int LogLevel, string msg)
+ {
+ Console.WriteLine(msg);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/NoSugarNet.ClientCore.Standard2/AppNoSugarNet.cs b/NoSugarNet.ClientCore.Standard2/AppNoSugarNet.cs
index a6e4847..b76ea66 100644
--- a/NoSugarNet.ClientCore.Standard2/AppNoSugarNet.cs
+++ b/NoSugarNet.ClientCore.Standard2/AppNoSugarNet.cs
@@ -1,9 +1,12 @@
-using NoSugarNet.ClientCoreNet.Standard2.Manager;
-using NoSugarNet.ClientCoreNet.Standard2.Network;
+using NoSugarNet.Adapter.DataHelper;
+using NoSugarNet.ClientCore.Common;
+using NoSugarNet.ClientCore.Manager;
+using NoSugarNet.ClientCore.Network;
using ServerCore.Manager;
-using static NoSugarNet.ClientCoreNet.Standard2.Manager.LogManager;
+using System.Collections.Generic;
+using static NoSugarNet.ClientCore.Manager.LogManager;
-namespace NoSugarNet.ClientCoreNet.Standard2
+namespace NoSugarNet.ClientCore
{
public class AppNoSugarNet
{
@@ -15,28 +18,35 @@ namespace NoSugarNet.ClientCoreNet.Standard2
public static NetworkHelper networkHelper;
public static AppLogin login;
public static AppChat chat;
- public static AppLocalClient local;
+ public static AppForwardLocalClient forwardlocal;
+ public static AppReverseLocalClient reverselocal;
public static UserDataManager user;
public static System.Timers.Timer _SpeedCheckTimeTimer;//速度检测计时器
public static int TimerInterval = 1000;//计时器间隔
- static NetStatus netStatus;
+ static NetStatus Forward_NetStatus;
+ static NetStatus Reverse_NetStatus;
#region 委托和事件
- public delegate void OnUpdateStatusHandler(NetStatus Status);
+ public delegate void OnUpdateStatusHandler(NetStatus ForwardStatus, NetStatus ReverseStatus);
public static event OnUpdateStatusHandler OnUpdateStatus;
#endregion
- public static void Init(OnLogHandler onLog = null)
+ public static void Init(Dictionary cfgs, int compressAdapterType = 0,OnLogHandler onLog = null)
{
+ Config.cfgs = cfgs;
+ Config.compressAdapterType = (E_CompressAdapter)compressAdapterType;
+
log = new LogManager();
if(onLog != null)
LogManager.OnLog += onLog;
networkHelper = new NetworkHelper();
login = new AppLogin();
chat = new AppChat();
- local = new AppLocalClient();
+ forwardlocal = new AppForwardLocalClient();
+ reverselocal = new AppReverseLocalClient(Config.compressAdapterType);
user = new UserDataManager();
- netStatus = new NetStatus();
+ Forward_NetStatus = new NetStatus();
+ Reverse_NetStatus = new NetStatus();
_SpeedCheckTimeTimer = new System.Timers.Timer();
_SpeedCheckTimeTimer.Interval = TimerInterval;
_SpeedCheckTimeTimer.Elapsed += Checktimer_Elapsed;
@@ -53,7 +63,7 @@ namespace NoSugarNet.ClientCoreNet.Standard2
public static void Close()
{
- local.StopAll();
+ forwardlocal.StopAll();
networkHelper.CloseConntect();
AppNoSugarNet.log.Info("停止");
_SpeedCheckTimeTimer.Enabled = false;
@@ -61,24 +71,45 @@ namespace NoSugarNet.ClientCoreNet.Standard2
static void Checktimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
- local.GetCurrLenght(out long resultReciveAllLenght, out long resultSendAllLenght);
- local.GetClientCount(out int ClientUserCount, out int TunnelCount);
-
- NetStatus resutnetStatus = new NetStatus()
{
- TunnelCount = TunnelCount,
- ClientUserCount = ClientUserCount,
- srcSendAllLenght = resultSendAllLenght,
- srcReciveAllLenght = resultReciveAllLenght,
- srcReciveSecSpeed = (resultReciveAllLenght - netStatus.srcReciveAllLenght) / (TimerInterval / 1000),
- srcSendSecSpeed = (resultSendAllLenght - netStatus.srcSendAllLenght) / (TimerInterval / 1000),
- tSendAllLenght = local.tSendAllLenght,
- tReciveAllLenght = local.tReciveAllLenght,
- tSendSecSpeed = (local.tSendAllLenght - netStatus.tSendAllLenght) / (TimerInterval / 1000),
- tReciveSecSpeed = (local.tReciveAllLenght - netStatus.tReciveAllLenght) / (TimerInterval / 1000),
- };
- netStatus = resutnetStatus;
- OnUpdateStatus?.Invoke(resutnetStatus);
+ forwardlocal.GetCurrLenght(out long resultReciveAllLenght, out long resultSendAllLenght);
+ forwardlocal.GetClientCount(out int ClientUserCount, out int TunnelCount);
+ NetStatus resutnetStatus = new NetStatus()
+ {
+ TunnelCount = TunnelCount,
+ ClientUserCount = ClientUserCount,
+ srcSendAllLenght = resultSendAllLenght,
+ srcReciveAllLenght = resultReciveAllLenght,
+ srcReciveSecSpeed = (resultReciveAllLenght - Forward_NetStatus.srcReciveAllLenght) / (TimerInterval / 1000),
+ srcSendSecSpeed = (resultSendAllLenght - Forward_NetStatus.srcSendAllLenght) / (TimerInterval / 1000),
+ tSendAllLenght = forwardlocal.tSendAllLenght,
+ tReciveAllLenght = forwardlocal.tReciveAllLenght,
+ tSendSecSpeed = (forwardlocal.tSendAllLenght - Forward_NetStatus.tSendAllLenght) / (TimerInterval / 1000),
+ tReciveSecSpeed = (forwardlocal.tReciveAllLenght - Forward_NetStatus.tReciveAllLenght) / (TimerInterval / 1000),
+ };
+ Forward_NetStatus = resutnetStatus;
+ }
+
+ {
+ reverselocal.GetCurrLenght(out long resultReciveAllLenght, out long resultSendAllLenght);
+ reverselocal.GetClientCount(out int ClientUserCount, out int TunnelCount);
+ NetStatus resutnetStatus = new NetStatus()
+ {
+ TunnelCount = TunnelCount,
+ ClientUserCount = ClientUserCount,
+ srcSendAllLenght = resultSendAllLenght,
+ srcReciveAllLenght = resultReciveAllLenght,
+ srcReciveSecSpeed = (resultReciveAllLenght - Reverse_NetStatus.srcReciveAllLenght) / (TimerInterval / 1000),
+ srcSendSecSpeed = (resultSendAllLenght - Reverse_NetStatus.srcSendAllLenght) / (TimerInterval / 1000),
+ tSendAllLenght = reverselocal.tSendAllLenght,
+ tReciveAllLenght = reverselocal.tReciveAllLenght,
+ tSendSecSpeed = (reverselocal.tSendAllLenght - Reverse_NetStatus.tSendAllLenght) / (TimerInterval / 1000),
+ tReciveSecSpeed = (reverselocal.tReciveAllLenght - Reverse_NetStatus.tReciveAllLenght) / (TimerInterval / 1000),
+ };
+ Reverse_NetStatus = resutnetStatus;
+ }
+
+ OnUpdateStatus?.Invoke(Forward_NetStatus , Reverse_NetStatus);
}
}
}
\ No newline at end of file
diff --git a/NoSugarNet.ClientCore.Standard2/Common/Config.cs b/NoSugarNet.ClientCore.Standard2/Common/Config.cs
new file mode 100644
index 0000000..d58e3ab
--- /dev/null
+++ b/NoSugarNet.ClientCore.Standard2/Common/Config.cs
@@ -0,0 +1,18 @@
+using NoSugarNet.Adapter.DataHelper;
+using System.Collections.Generic;
+
+namespace NoSugarNet.ClientCore.Common
+{
+ public struct TunnelClientData
+ {
+ public byte TunnelId;
+ public string LocalTargetIP;
+ public ushort LocalTargetPort;
+ public ushort RemoteLocalPort;
+ }
+ public static class Config
+ {
+ public static Dictionary cfgs = new Dictionary();
+ public static E_CompressAdapter compressAdapterType;
+ }
+}
diff --git a/NoSugarNet.ClientCore.Standard2/Common/Helper.cs b/NoSugarNet.ClientCore.Standard2/Common/Helper.cs
index 8daba3e..e1239ed 100644
--- a/NoSugarNet.ClientCore.Standard2/Common/Helper.cs
+++ b/NoSugarNet.ClientCore.Standard2/Common/Helper.cs
@@ -1,6 +1,6 @@
using System;
-namespace NoSugarNet.ClientCoreNet.Standard2.Common
+namespace NoSugarNet.ClientCore.Common
{
public static class Helper
{
diff --git a/NoSugarNet.ClientCore.Standard2/Common/ProtoBufHelper.cs b/NoSugarNet.ClientCore.Standard2/Common/ProtoBufHelper.cs
index 3c229bc..ab2d64f 100644
--- a/NoSugarNet.ClientCore.Standard2/Common/ProtoBufHelper.cs
+++ b/NoSugarNet.ClientCore.Standard2/Common/ProtoBufHelper.cs
@@ -1,7 +1,7 @@
using Google.Protobuf;
using System;
-namespace NoSugarNet.ClientCoreNet.Standard2.Common
+namespace NoSugarNet.ClientCore.Common
{
public static class ProtoBufHelper
{
diff --git a/NoSugarNet.ClientCore.Standard2/Event/EEvent.cs b/NoSugarNet.ClientCore.Standard2/Event/EEvent.cs
index 5e1e9f4..71fc2a7 100644
--- a/NoSugarNet.ClientCore.Standard2/Event/EEvent.cs
+++ b/NoSugarNet.ClientCore.Standard2/Event/EEvent.cs
@@ -1,4 +1,4 @@
-namespace NoSugarNet.ClientCoreNet.Standard2.Event
+namespace NoSugarNet.ClientCore.Event
{
public enum EEvent
{
diff --git a/NoSugarNet.ClientCore.Standard2/Event/EventSystem.cs b/NoSugarNet.ClientCore.Standard2/Event/EventSystem.cs
index b4f4d92..a9761ec 100644
--- a/NoSugarNet.ClientCore.Standard2/Event/EventSystem.cs
+++ b/NoSugarNet.ClientCore.Standard2/Event/EventSystem.cs
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
-namespace NoSugarNet.ClientCoreNet.Standard2.Event
+namespace NoSugarNet.ClientCore.Event
{
public class EventData
{
diff --git a/NoSugarNet.ClientCore.Standard2/Manager/AppChat.cs b/NoSugarNet.ClientCore.Standard2/Manager/AppChat.cs
index 68b1635..e1ea8e1 100644
--- a/NoSugarNet.ClientCore.Standard2/Manager/AppChat.cs
+++ b/NoSugarNet.ClientCore.Standard2/Manager/AppChat.cs
@@ -1,9 +1,9 @@
using AxibugProtobuf;
-using NoSugarNet.ClientCoreNet.Standard2.Common;
-using NoSugarNet.ClientCoreNet.Standard2.Event;
-using NoSugarNet.ClientCoreNet.Standard2.Network;
+using NoSugarNet.ClientCore.Common;
+using NoSugarNet.ClientCore.Event;
+using NoSugarNet.ClientCore.Network;
-namespace NoSugarNet.ClientCoreNet.Standard2.Manager
+namespace NoSugarNet.ClientCore.Manager
{
public class AppChat
{
diff --git a/NoSugarNet.ClientCore.Standard2/Manager/AppLocalClient.cs b/NoSugarNet.ClientCore.Standard2/Manager/AppForwardLocalClient.cs
similarity index 62%
rename from NoSugarNet.ClientCore.Standard2/Manager/AppLocalClient.cs
rename to NoSugarNet.ClientCore.Standard2/Manager/AppForwardLocalClient.cs
index 1324112..2a24270 100644
--- a/NoSugarNet.ClientCore.Standard2/Manager/AppLocalClient.cs
+++ b/NoSugarNet.ClientCore.Standard2/Manager/AppForwardLocalClient.cs
@@ -1,34 +1,32 @@
using AxibugProtobuf;
using Google.Protobuf;
-using NoSugarNet.ClientCoreNet.Standard2;
-using NoSugarNet.ClientCoreNet.Standard2.Common;
-using NoSugarNet.ClientCoreNet.Standard2.Network;
-using NoSugarNet.DataHelper;
+using NoSugarNet.Adapter;
+using NoSugarNet.Adapter.DataHelper;
+using NoSugarNet.ClientCore;
+using NoSugarNet.ClientCore.Common;
+using NoSugarNet.ClientCore.Network;
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Net;
namespace ServerCore.Manager
{
- public class AppLocalClient
+ public class AppForwardLocalClient
{
Dictionary mDictTunnelID2Cfg = new Dictionary();
- Dictionary mDictTunnelID2Listeners = new Dictionary();
- CompressAdapter mCompressAdapter;
- E_CompressAdapter compressAdapterType;
- public LocalMsgQueuePool _localMsgPool = new LocalMsgQueuePool(1000);
+ Dictionary mDictTunnelID2Listeners = new Dictionary();
+ NoSugarNet.Adapter.DataHelper.E_CompressAdapter compressAdapterType;
public long tReciveAllLenght { get; private set; }
public long tSendAllLenght { get; private set; }
- public AppLocalClient()
+ public AppForwardLocalClient()
{
//注册网络消息
- NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdCfgs, Recive_CmdCfgs);
- NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTunnelS2CConnect, Recive_TunnelS2CConnect);
- NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTunnelS2CDisconnect, Recive_TunnelS2CDisconnect);
- NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTunnelS2CData, Recive_TunnelS2CData);
+ NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdServerCfgs, Recive_CmdCfgs);
+ NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTunnelS2CForwardConnect, Recive_TunnelS2CConnect);
+ NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTunnelS2CForwardDisconnect, Recive_TunnelS2CDisconnect);
+ NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTunnelS2CForwardData, Recive_TunnelS2CData);
}
public void GetCurrLenght(out long resultReciveAllLenght, out long resultSendAllLenght)
@@ -51,20 +49,40 @@ namespace ServerCore.Manager
ClientUserCount = mDictTunnelID2Listeners.Count;
}
+ public void GetClientDebugInfo()
+ {
+ AppNoSugarNet.log.Debug($"------------ mDictTunnelID2Listeners {mDictTunnelID2Listeners.Count} ------------");
+ lock (mDictTunnelID2Listeners)
+ {
+ foreach (var item in mDictTunnelID2Listeners)
+ {
+ var cinfo = item.Value.GetDictIdx2LocalClientInfo();
+ AppNoSugarNet.log.Debug($"----- TunnelID {item.Key} ObjcurrSeed->{item.Value.currSeed} ClientList->{item.Value.ClientList.Count} Idx2LocalClient->{cinfo.Count} -----");
+
+ foreach (var c in cinfo)
+ {
+ AppNoSugarNet.log.Debug($"----- Idx {c.Key} bRemoteConnect->{c.Value.bRemoteConnect} msgQueue.Count->{c.Value.msgQueue.Count} -----");
+ }
+ }
+ }
+ }
+
///
/// 初始化连接,先获取到配置
///
void InitListenerMode()
{
AppNoSugarNet.log.Info("初始化压缩适配器" + compressAdapterType);
- //初始化压缩适配器,代表压缩类型
- mCompressAdapter = new CompressAdapter(compressAdapterType);
+ ////初始化压缩适配器,代表压缩类型
+ //mCompressAdapter = new NoSugarNet.Adapter.DataHelper.CompressAdapter(compressAdapterType);
foreach (var cfg in mDictTunnelID2Cfg)
{
- LocalListener listener = new LocalListener(256, 1024, cfg.Key);
+ ForwardLocalListener listener = new ForwardLocalListener(256, 1024, cfg.Key,AppNoSugarNet.user.userdata.UID);
AppNoSugarNet.log.Info($"开始监听配置 Tunnel:{cfg.Key},Port:{cfg.Value.Port}");
- listener.Init();
- listener.Start(new IPEndPoint(IPAddress.Any.Address, (int)cfg.Value.Port));
+ listener.BandEvent(AppNoSugarNet.log.Log, OnClientLocalConnect, OnClientLocalDisconnect, OnClientTunnelDataCallBack);
+ listener.StartListener((uint)cfg.Value.Port);
+ //listener.Init();
+ //listener.Start(new IPEndPoint(IPAddress.Any.Address, (int)cfg.Value.Port));
//listener.Init((int)cfg.Value.Port);
AddLocalListener(listener);
}
@@ -77,7 +95,7 @@ namespace ServerCore.Manager
///
///
///
- void AddLocalListener(LocalListener _listener)
+ void AddLocalListener(ForwardLocalListener _listener)
{
lock (mDictTunnelID2Listeners)
{
@@ -89,7 +107,7 @@ namespace ServerCore.Manager
///
///
///
- void RemoveLocalListener(LocalListener _listener)
+ void RemoveLocalListener(ForwardLocalListener _listener)
{
lock (mDictTunnelID2Listeners)
{
@@ -99,7 +117,7 @@ namespace ServerCore.Manager
}
}
}
- bool GetLocalListener(byte tunnelId,out LocalListener _listener)
+ bool GetLocalListener(byte tunnelId,out ForwardLocalListener _listener)
{
_listener = null;
if (!mDictTunnelID2Listeners.ContainsKey(tunnelId))
@@ -115,11 +133,13 @@ namespace ServerCore.Manager
byte[] keys = mDictTunnelID2Listeners.Keys.ToArray();
for (int i = 0; i < keys.Length; i++)
{
- LocalListener _listener = mDictTunnelID2Listeners[keys[i]];
- _listener.StopAll();
+ ForwardLocalListener _listener = mDictTunnelID2Listeners[keys[i]];
+ _listener.StopAllLocalClient();
+ _listener.StopWithClear();
//_listener.Stop();
RemoveLocalListener(_listener);
}
+ mDictTunnelID2Listeners.Clear();
}
}
#endregion
@@ -127,7 +147,7 @@ namespace ServerCore.Manager
#region 解析服务端下行数据
public void Recive_CmdCfgs(byte[] reqData)
{
- AppNoSugarNet.log.Debug("Recive_CmdCfgs");
+ AppNoSugarNet.log.Debug("Forward->Recive_CmdCfgs");
Protobuf_Cfgs msg = ProtoBufHelper.DeSerizlize(reqData);
for (int i = 0;i < msg.Cfgs.Count;i++)
@@ -135,29 +155,28 @@ namespace ServerCore.Manager
Protobuf_Cfgs_Single cfg = msg.Cfgs[i];
mDictTunnelID2Cfg[(byte)cfg.TunnelID] = cfg;
}
- compressAdapterType = (E_CompressAdapter)msg.CompressAdapterType;
+ compressAdapterType = (NoSugarNet.Adapter.DataHelper.E_CompressAdapter)msg.CompressAdapterType;
InitListenerMode();
}
public void Recive_TunnelS2CConnect(byte[] reqData)
{
- AppNoSugarNet.log.Debug("Recive_TunnelS2CConnect");
- Protobuf_S2C_Connect msg = ProtoBufHelper.DeSerizlize(reqData);
+ AppNoSugarNet.log.Debug("Forward->Recive_TunnelS2CConnect");
+ Protobuf_Tunnel_Connect msg = ProtoBufHelper.DeSerizlize(reqData);
if(msg.Connected == 1)
- OnServerLocalConnect((byte)msg.TunnelID,(byte)msg.Idx);
+ OnRemoteLocalConnect((byte)msg.TunnelID,(byte)msg.Idx);
else
- OnServerLocalDisconnect((byte)msg.TunnelID, (byte)msg.Idx);
+ OnRemoteLocalDisconnect((byte)msg.TunnelID, (byte)msg.Idx);
}
public void Recive_TunnelS2CDisconnect(byte[] reqData)
{
- AppNoSugarNet.log.Debug("Recive_TunnelS2CDisconnect");
- Protobuf_S2C_Disconnect msg = ProtoBufHelper.DeSerizlize(reqData);
- OnServerLocalDisconnect((byte)msg.TunnelID,(byte)msg.Idx);
+ AppNoSugarNet.log.Debug("Forward->Recive_TunnelS2CDisconnect");
+ Protobuf_Tunnel_Disconnect msg = ProtoBufHelper.DeSerizlize(reqData);
+ OnRemoteLocalDisconnect((byte)msg.TunnelID,(byte)msg.Idx);
}
public void Recive_TunnelS2CData(byte[] reqData)
{
- //AppNoSugarNet.log.Debug("Recive_TunnelS2CData");
- Protobuf_S2C_DATA msg = ProtoBufHelper.DeSerizlize(reqData);
- OnServerLocalDataCallBack((byte)msg.TunnelID,(byte)msg.Idx, msg.HunterNetCoreData.ToArray());
+ Protobuf_Tunnel_DATA msg = ProtoBufHelper.DeSerizlize(reqData);
+ OnRemoteLocalDataCallBack((byte)msg.TunnelID,(byte)msg.Idx, msg.HunterNetCoreData.ToArray());
}
#endregion
@@ -167,51 +186,51 @@ namespace ServerCore.Manager
///
///
///
- public void OnClientLocalConnect(byte tunnelId,byte _Idx)
+ public void OnClientLocalConnect(long UID, byte tunnelId,byte _Idx)
{
- AppNoSugarNet.log.Debug($"OnClientLocalConnect {tunnelId},{_Idx}");
+ AppNoSugarNet.log.Debug($"Forward->OnClientLocalConnect {tunnelId},{_Idx}");
if (!mDictTunnelID2Cfg.ContainsKey(tunnelId))
return;
- byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_C2S_Connect()
+ byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_Tunnel_Connect()
{
TunnelID = tunnelId,
Idx = _Idx,
});
//告知给服务端,来自客户端本地的连接建立
- AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SConnect, respData);
+ AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SForwardConnect, respData);
}
///
/// 当客户端本地端口连接断开
///
///
///
- public void OnClientLocalDisconnect(byte tunnelId, byte _Idx)
+ public void OnClientLocalDisconnect(long UID, byte tunnelId, byte _Idx)
{
- AppNoSugarNet.log.Debug($"OnClientLocalDisconnect {tunnelId},{_Idx}");
+ AppNoSugarNet.log.Debug($"Forward->OnClientLocalDisconnect {tunnelId},{_Idx}");
//隧道ID定位投递服务端本地连接
if (!mDictTunnelID2Cfg.ContainsKey(tunnelId))
return;
- byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_C2S_Disconnect()
+ byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_Tunnel_Disconnect()
{
TunnelID = tunnelId,
Idx= _Idx,
});
//告知给服务端,来自客户端本地的连接断开
- AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SDisconnect, respData);
+ AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SForwardDisconnect, respData);
}
///
/// 当服务端本地端口连接
///
///
- public void OnServerLocalConnect(byte tunnelId,byte Idx)
+ public void OnRemoteLocalConnect(byte tunnelId,byte Idx)
{
- AppNoSugarNet.log.Debug($"OnServerLocalConnect {tunnelId},{Idx}");
- if (!GetLocalListener(tunnelId, out LocalListener _listener))
+ AppNoSugarNet.log.Debug($"Forward->OnRemoteLocalConnect {tunnelId},{Idx}");
+ if (!GetLocalListener(tunnelId, out ForwardLocalListener _listener))
return;
//维护状态
_listener.SetRemoteConnectd(Idx, true);
@@ -221,9 +240,9 @@ namespace ServerCore.Manager
{
IdxWithMsg msg = msglist[i];
//投递给服务端,来自客户端本地的连接数据
- AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SData, msg.data);
+ AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SForwardData, msg.data);
//发送后回收
- AppNoSugarNet.local._localMsgPool.Enqueue(msg);
+ MsgQueuePool._MsgPool.Enqueue(msg);
}
}
}
@@ -232,10 +251,10 @@ namespace ServerCore.Manager
///
///
///
- public void OnServerLocalDisconnect(byte tunnelId, byte Idx)
+ public void OnRemoteLocalDisconnect(byte tunnelId, byte Idx)
{
- AppNoSugarNet.log.Debug($"OnServerLocalDisconnect {tunnelId},{Idx}");
- if (!GetLocalListener(tunnelId, out LocalListener _listener))
+ AppNoSugarNet.log.Debug($"Forward->OnRemoteLocalDisconnect {tunnelId},{Idx}");
+ if (!GetLocalListener(tunnelId, out ForwardLocalListener _listener))
return;
_listener.SetRemoteConnectd(Idx,false);
_listener.CloseConnectByIdx(Idx);
@@ -249,15 +268,15 @@ namespace ServerCore.Manager
///
///
///
- public void OnServerLocalDataCallBack(byte tunnelId,byte Idx, byte[] data)
+ public void OnRemoteLocalDataCallBack(byte tunnelId,byte Idx, byte[] data)
{
- //AppNoSugarNet.log.Info($"OnServerLocalDataCallBack {tunnelId},{Idx},Data长度:{data.Length}");
- if (!GetLocalListener(tunnelId, out LocalListener _listener))
+ //AppNoSugarNet.log.Info($"OnRemoteLocalDataCallBack {tunnelId},{Idx},Data长度:{data.Length}");
+ if (!GetLocalListener(tunnelId, out ForwardLocalListener _listener))
return;
//记录压缩前数据长度
tReciveAllLenght += data.Length;
//解压
- data = mCompressAdapter.Decompress(data);
+ data = CompressAdapterSelector.Adapter(compressAdapterType).Decompress(data);
_listener.SendSocketByIdx(Idx,data);
}
///
@@ -266,16 +285,16 @@ namespace ServerCore.Manager
///
///
///
- public void OnClientTunnelDataCallBack(byte tunnelId,byte Idx, byte[] data)
+ public void OnClientTunnelDataCallBack(long UID, byte tunnelId,byte Idx, byte[] data)
{
- //AppNoSugarNet.log.Info($"OnClientTunnelDataCallBack {tunnelId},{Idx}");
+ //AppNoSugarNet.log.Info($"OnClientTunnelDataCallBack {tunnelId},{Idx} data.Length->{data.Length}");
int SlienLenght = 1000;
//判断数据量大时分包
if (data.Length > SlienLenght)
{
- byte[] tempSpan = data;
- byte[] tempSpanSlien = null;
+ Span tempSpan = data;
+ Span tempSpanSlien = null;
int PageCount = (int)(data.Length / SlienLenght);
if (data.Length % SlienLenght > 0)
{
@@ -284,21 +303,13 @@ namespace ServerCore.Manager
for (int i = 0; i < PageCount; i++)
{
- tempSpanSlien = new byte[SlienLenght];
int StartIdx = i * SlienLenght;
if (i != PageCount - 1)//不是最后一个包
- Array.Copy(tempSpan, StartIdx, tempSpanSlien, 0, SlienLenght);
- else//最后一个
- Array.Copy(tempSpan, StartIdx, tempSpanSlien, 0, tempSpanSlien.Length - StartIdx);
-
- SendDataToRemote(tunnelId, Idx, tempSpanSlien);
-
- /*if (i != PageCount - 1)//不是最后一个包
tempSpanSlien = tempSpan.Slice(StartIdx, SlienLenght);
else//最后一个
tempSpanSlien = tempSpan.Slice(StartIdx);
- SendDataToRemote(tunnelId, Idx, tempSpanSlien.ToArray());*/
+ SendDataToRemote(tunnelId, Idx, tempSpanSlien.ToArray());
}
return;
}
@@ -308,18 +319,18 @@ namespace ServerCore.Manager
void SendDataToRemote(byte tunnelId, byte Idx, byte[] data)
{
//压缩
- data = mCompressAdapter.Compress(data);
+ data = CompressAdapterSelector.Adapter(compressAdapterType).Compress(data);
//记录压缩后数据长度
tSendAllLenght += data.Length;
- byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_C2S_DATA()
+ byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_Tunnel_DATA()
{
TunnelID = tunnelId,
Idx = Idx,
HunterNetCoreData = ByteString.CopyFrom(data)
});
- if (!GetLocalListener(tunnelId, out LocalListener _listener))
+ if (!GetLocalListener(tunnelId, out ForwardLocalListener _listener))
return;
//远程未连接,添加到缓存
@@ -329,7 +340,7 @@ namespace ServerCore.Manager
return;
}
//投递给服务端,来自客户端本地的连接数据
- AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SData, respData);
+ AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SForwardData, respData);
}
#endregion
diff --git a/NoSugarNet.ClientCore.Standard2/Manager/AppLogin.cs b/NoSugarNet.ClientCore.Standard2/Manager/AppLogin.cs
index d9684d3..2be3d30 100644
--- a/NoSugarNet.ClientCore.Standard2/Manager/AppLogin.cs
+++ b/NoSugarNet.ClientCore.Standard2/Manager/AppLogin.cs
@@ -1,21 +1,29 @@
using AxibugProtobuf;
-using NoSugarNet.ClientCoreNet.Standard2.Common;
-using NoSugarNet.ClientCoreNet.Standard2.Network;
+using NoSugarNet.ClientCore.Common;
+using NoSugarNet.ClientCore.Network;
+using System;
-namespace NoSugarNet.ClientCoreNet.Standard2.Manager
+namespace NoSugarNet.ClientCore.Manager
{
public class AppLogin
{
+ static string LastLoginGuid = "";
public AppLogin()
{
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdLogin, RecvLoginMsg);
}
- public void Login(string Account)
+
+ public void Login()
{
+ AppNoSugarNet.log.Debug("-->Login");
+ if(string.IsNullOrEmpty(LastLoginGuid))
+ LastLoginGuid = Guid.NewGuid().ToString();
+
+ AppNoSugarNet.user.userdata.Account = LastLoginGuid;
Protobuf_Login msg = new Protobuf_Login()
{
LoginType = 0,
- Account = Account,
+ Account = AppNoSugarNet.user.userdata.Account,
};
AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdLogin, ProtoBufHelper.Serizlize(msg));
}
@@ -26,13 +34,13 @@ namespace NoSugarNet.ClientCoreNet.Standard2.Manager
if (msg.Status == LoginResultStatus.Ok)
{
AppNoSugarNet.log.Info("登录成功");
- AppNoSugarNet.user.InitMainUserData(AppNoSugarNet.user.userdata.Account);
+ AppNoSugarNet.user.InitMainUserData(AppNoSugarNet.user.userdata.Account,msg.UID);
+ AppNoSugarNet.reverselocal.Send_ClientCfg();
}
else
{
AppNoSugarNet.log.Info("登录失败");
}
}
-
}
}
diff --git a/NoSugarNet.ClientCore.Standard2/Manager/AppReverseLocalClient.cs b/NoSugarNet.ClientCore.Standard2/Manager/AppReverseLocalClient.cs
new file mode 100644
index 0000000..663f59b
--- /dev/null
+++ b/NoSugarNet.ClientCore.Standard2/Manager/AppReverseLocalClient.cs
@@ -0,0 +1,365 @@
+using AxibugProtobuf;
+using Google.Protobuf;
+using NoSugarNet.Adapter;
+using NoSugarNet.Adapter.DataHelper;
+using NoSugarNet.ClientCore;
+using NoSugarNet.ClientCore.Common;
+using NoSugarNet.ClientCore.Network;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+
+namespace ServerCore.Manager
+{
+ public class AppReverseLocalClient
+ {
+ Dictionary mDictCommKey2LocalClients = new Dictionary();
+ NoSugarNet.Adapter.DataHelper.CompressAdapter mCompressAdapter;
+ //public LocalMsgQueuePool _localMsgPool = new LocalMsgQueuePool(1000);
+
+ public long tReciveAllLenght { get; private set; }
+ public long tSendAllLenght { get; private set; }
+
+ Protobuf_Cfgs _Send_Protobuf_Cfgs = new Protobuf_Cfgs();
+
+ static long GetCommKey(long Uid, int Tunnel, int Idx)
+ {
+ return (Uid * 10000000) + (Tunnel * 10000) + Idx;
+ }
+
+ static long GetUidForCommKey(long CommKey)
+ {
+ return CommKey / 10000000;
+ }
+
+ public AppReverseLocalClient(NoSugarNet.Adapter.DataHelper.E_CompressAdapter compressAdapterType)
+ {
+ AppNoSugarNet.log.Debug("Reverse->初始化压缩适配器" + compressAdapterType);
+ //初始化压缩适配器,暂时使用0,代表压缩类型
+ mCompressAdapter = new CompressAdapter(compressAdapterType);
+
+ //注册网络消息
+ NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTunnelS2CReverseConnect, Recive_TunnelS2CConnect);
+ NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTunnelS2CReverseDisconnect, Recive_TunnelS2CDisconnect);
+ NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTunnelS2CReverseData, Recive_TunnelS2CData);
+ }
+
+ public void GetCurrLenght(out long resultReciveAllLenght, out long resultSendAllLenght)
+ {
+ resultReciveAllLenght = 0;
+ resultSendAllLenght = 0;
+ long[] Keys = mDictCommKey2LocalClients.Keys.ToArray();
+ for (int i = 0; i < Keys.Length; i++)
+ {
+ //local和转发 收发相反
+ resultSendAllLenght += mDictCommKey2LocalClients[Keys[i]].mReciveAllLenght;
+ resultReciveAllLenght += mDictCommKey2LocalClients[Keys[i]].mSendAllLenght;
+ }
+ }
+
+ public void Send_ClientCfg()
+ {
+ AppNoSugarNet.log.Debug("Reverse->-->Send_ClientCfg");
+
+ _Send_Protobuf_Cfgs.CompressAdapterType = (int)Config.compressAdapterType;
+ _Send_Protobuf_Cfgs.Cfgs.Clear();
+ foreach (var cfg in Config.cfgs)
+ {
+ _Send_Protobuf_Cfgs.Cfgs.Add(new Protobuf_Cfgs_Single() { Port = cfg.Value.RemoteLocalPort, TunnelID = cfg.Value.TunnelId });
+ }
+ AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdClientCfgs, ProtoBufHelper.Serizlize(_Send_Protobuf_Cfgs));
+ }
+
+
+ #region 解析服务端下行数据
+ public void Recive_TunnelS2CConnect(byte[] reqData)
+ {
+ AppNoSugarNet.log.Debug("Reverse->Recive_TunnelS2CConnect");
+ Protobuf_Tunnel_Connect msg = ProtoBufHelper.DeSerizlize(reqData);
+ if (msg.Connected == 1)
+ OnRemoteLocalConnect((byte)msg.TunnelID, (byte)msg.Idx);
+ else
+ OnRemoteLocalDisconnect((byte)msg.TunnelID, (byte)msg.Idx);
+ }
+ public void Recive_TunnelS2CDisconnect(byte[] reqData)
+ {
+ AppNoSugarNet.log.Debug("Reverse->Recive_TunnelS2CDisconnect");
+ Protobuf_Tunnel_Disconnect msg = ProtoBufHelper.DeSerizlize(reqData);
+ OnRemoteLocalDisconnect((byte)msg.TunnelID, (byte)msg.Idx);
+ }
+ public void Recive_TunnelS2CData(byte[] reqData)
+ {
+ Protobuf_Tunnel_DATA msg = ProtoBufHelper.DeSerizlize(reqData);
+ OnRemoteTunnelDataCallBack(AppNoSugarNet.user.userdata.UID, (byte)msg.TunnelID, (byte)msg.Idx, msg.HunterNetCoreData.ToArray());
+ }
+ #endregion
+
+
+ #region 两端本地端口连接事件通知
+
+ ///
+ /// 当服务端本地端口连接
+ ///
+ ///
+ public void OnRemoteLocalConnect(byte tunnelId, byte Idx)
+ {
+ AppNoSugarNet.log.Debug($"Reverse->OnRemoteLocalConnect{AppNoSugarNet.user.userdata.UID},{tunnelId},{Idx}");
+
+ if (!Config.cfgs.ContainsKey(tunnelId))
+ return;
+
+ //开一个线程去建立连接
+ Thread thread = new Thread(() =>
+ {
+ //服务器本地局域网连接指定端口
+ TunnelClientData tunnelDataCfg = Config.cfgs[tunnelId];
+ BackwardLocalClient serverLocalClient = new BackwardLocalClient(AppNoSugarNet.user.userdata.UID, tunnelId, (byte)Idx);
+ serverLocalClient.BandEvent(AppNoSugarNet.log.Log, OnClientLocalConnect, OnClientLocalDisconnect, OnClientLocalDataCallBack);
+ //连接成功
+ if (!serverLocalClient.Init(tunnelDataCfg.LocalTargetIP, tunnelDataCfg.LocalTargetPort))
+ {
+ //TODO告知客户端连接失败
+ byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_Tunnel_Connect()
+ {
+ TunnelID = tunnelId,
+ Idx = (uint)Idx,
+ Connected = 0//失败
+ });
+ //发送给客户端,指定服务端本地端口已连接
+ AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SReverseConnect, respData);
+ }
+ });
+ thread.Start();
+ }
+ ///
+ /// 当服务端本地端口连接断开
+ ///
+ ///
+ ///
+ public void OnRemoteLocalDisconnect(byte tunnelId, byte Idx)
+ {
+ AppNoSugarNet.log.Debug($"Reverse->OnRemoteLocalDisconnect {AppNoSugarNet.user.userdata.UID},{tunnelId},{Idx}");
+
+ //隧道ID定位投递服务端本地连接
+ if (!GetClientLocalClient(AppNoSugarNet.user.userdata.UID, tunnelId, Idx, out BackwardLocalClient LocalClient))
+ return;
+
+ //断开服务端本地客户端连接
+ CloseClientLocalClient(AppNoSugarNet.user.userdata.UID, tunnelId, Idx);
+ }
+
+ ///
+ /// 当服务端本地端口连接
+ ///
+ ///
+ ///
+ public void OnClientLocalConnect(long uid, byte tunnelId, byte Idx, BackwardLocalClient serverLocalClient)
+ {
+ AppNoSugarNet.log.Debug($"Reverse->OnServerLocalConnect {uid},{tunnelId},{Idx}");
+
+ //添加到服务端本地连接列表
+ AddClientLocalClient(uid, tunnelId, Idx, serverLocalClient);
+
+ byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_Tunnel_Connect()
+ {
+ TunnelID = tunnelId,
+ Idx = Idx,
+ Connected = 1
+ });
+ //发送给客户端,指定服务端本地端口已连接
+ AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SReverseConnect, respData);
+ }
+ ///
+ /// 当服务端本地端口连接断开
+ ///
+ ///
+ ///
+ public void OnClientLocalDisconnect(long uid, byte tunnelId, byte Idx, BackwardLocalClient serverLocalClient)
+ {
+ AppNoSugarNet.log.Debug($"Reverse->OnClientLocalDisconnect {uid},{tunnelId},{Idx}");
+ //移除到服务端本地连接列表
+ RemoveClientLocalClient(uid, tunnelId, Idx);
+
+ byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_Tunnel_Disconnect()
+ {
+ TunnelID = tunnelId,
+ Idx = Idx,
+ });
+ //发送给客户端,指定服务端本地端口连接已断开
+ AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SReverseDisconnect, respData);
+ }
+ #endregion
+
+ #region 连接字典管理
+ ///
+ /// 追加连接
+ ///
+ ///
+ ///
+ ///
+ void AddClientLocalClient(long uid, byte tunnelId, byte Idx, BackwardLocalClient serverClient)
+ {
+ long CommKey = GetCommKey(uid, tunnelId, Idx);
+ lock (mDictCommKey2LocalClients)
+ {
+ mDictCommKey2LocalClients[CommKey] = serverClient;
+ }
+ }
+ ///
+ /// 删除连接
+ ///
+ ///
+ ///
+ void RemoveClientLocalClient(long uid, byte tunnelId, byte Idx)
+ {
+ lock (mDictCommKey2LocalClients)
+ {
+ long CommKey = GetCommKey(uid, tunnelId, Idx);
+
+ if (!mDictCommKey2LocalClients.ContainsKey(CommKey))
+ return;
+ mDictCommKey2LocalClients[CommKey].Release();
+ mDictCommKey2LocalClients.Remove(CommKey);
+ }
+ }
+
+ bool GetClientLocalClient(long uid, byte tunnelId, byte Idx, out BackwardLocalClient serverLocalClient)
+ {
+ serverLocalClient = null;
+
+ long CommKey = GetCommKey(uid, tunnelId, Idx);
+
+ if (!mDictCommKey2LocalClients.ContainsKey(CommKey))
+ return false;
+
+ serverLocalClient = mDictCommKey2LocalClients[CommKey];
+ return true;
+ }
+
+ void CloseClientLocalClient(long uid, byte tunnelId, byte Idx)
+ {
+ //隧道ID定位投递服务端本地连接
+ if (!GetClientLocalClient(uid, tunnelId, Idx, out BackwardLocalClient _LocalClient))
+ return;
+ _LocalClient.CloseConntect();
+ RemoveClientLocalClient(uid, tunnelId, Idx);
+ }
+
+ public void GetClientCount(out int ClientUserCount, out int TunnelCount)
+ {
+ TunnelCount = mDictCommKey2LocalClients.Count;
+ long[] CommIDKeys = mDictCommKey2LocalClients.Keys.ToArray();
+ List TempHadLocalConnetList = new List();
+ for (int i = 0; i < CommIDKeys.Length; i++)
+ {
+ long uid = GetUidForCommKey(CommIDKeys[i]);
+ if (!TempHadLocalConnetList.Contains(uid))
+ TempHadLocalConnetList.Add(uid);
+ }
+ ClientUserCount = TempHadLocalConnetList.Count;
+ }
+
+ public void StopAll(long Uid)
+ {
+ List TempRemoveCommIDList = new List();
+ lock (mDictCommKey2LocalClients)
+ {
+ long[] CommIDKeys = mDictCommKey2LocalClients.Keys.ToArray();
+ for (int i = 0; i < CommIDKeys.Length; i++)
+ {
+ long CommID = CommIDKeys[i];
+ long tempUid = GetUidForCommKey(CommID);
+ if (tempUid == Uid)
+ TempRemoveCommIDList.Add(CommID);
+ }
+ }
+
+ for (int i = 0; i < TempRemoveCommIDList.Count; i++)
+ {
+ long CommID = TempRemoveCommIDList[i];
+ if (!mDictCommKey2LocalClients.ContainsKey(CommID))
+ continue;
+ BackwardLocalClient _serverLoackClient = mDictCommKey2LocalClients[CommID];
+ _serverLoackClient.CloseConntect();
+ }
+ }
+ #endregion
+
+
+ #region 数据投递
+ ///
+ /// 来自客户端本地连接投递的Tunnel数据
+ ///
+ ///
+ ///
+ ///
+ public void OnRemoteTunnelDataCallBack(long uid, byte tunnelId, byte Idx, byte[] data)
+ {
+ //隧道ID定位投递服务端本地连接
+ if (!GetClientLocalClient(uid, tunnelId, Idx, out BackwardLocalClient serverLocalClient))
+ return;
+ //记录数据长度
+ tReciveAllLenght += data.Length;
+ //解压
+ data = mCompressAdapter.Decompress(data);
+ //记录数据长度
+ serverLocalClient.mSendAllLenght += data.LongLength;
+ //发送给对应服务端本地连接数据
+ serverLocalClient.SendToServer(data);
+ }
+ ///
+ /// 来自服务端本地连接投递的Tunnel数据
+ ///
+ ///
+ ///
+ ///
+ public void OnClientLocalDataCallBack(long uid, byte tunnelId, byte Idx, byte[] data)
+ {
+ //AppNoSugarNet.log.Debug($"Reverse->OnClientLocalDataCallBack {uid},{tunnelId},{Idx},data -> {data.Length}");
+ int SlienLenght = 1000;
+ //判断数据量大时分包
+ if (data.Length > SlienLenght)
+ {
+ Span tempSpan = data;
+ Span tempSpanSlien = null;
+ int PageCount = (int)(data.Length / SlienLenght);
+ if (data.Length % SlienLenght > 0)
+ {
+ PageCount++;
+ }
+
+ for (int i = 0; i < PageCount; i++)
+ {
+ int StartIdx = i * SlienLenght;
+ if (i != PageCount - 1)//不是最后一个包
+ tempSpanSlien = tempSpan.Slice(StartIdx, SlienLenght);
+ else//最后一个
+ tempSpanSlien = tempSpan.Slice(StartIdx);
+
+ SendDataToRemote(uid, tunnelId, Idx, tempSpanSlien.ToArray());
+ }
+ return;
+ }
+ SendDataToRemote(uid, tunnelId, Idx, data);
+ }
+ void SendDataToRemote(long uid, byte tunnelId, byte Idx, byte[] data)
+ {
+ //压缩
+ data = mCompressAdapter.Compress(data);
+ //记录压缩后数据长度
+ tSendAllLenght += data.Length;
+
+ byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_Tunnel_DATA()
+ {
+ TunnelID = tunnelId,
+ Idx = Idx,
+ HunterNetCoreData = ByteString.CopyFrom(data)
+ });
+
+ //发送给客户端,指定客户端本地隧道ID
+ AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SReverseData, respData);
+ }
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/NoSugarNet.ClientCore.Standard2/Manager/LocalClient/LocalListener.cs b/NoSugarNet.ClientCore.Standard2/Manager/LocalClient/LocalListener.cs
index 641023b..a4cc697 100644
--- a/NoSugarNet.ClientCore.Standard2/Manager/LocalClient/LocalListener.cs
+++ b/NoSugarNet.ClientCore.Standard2/Manager/LocalClient/LocalListener.cs
@@ -1,264 +1,295 @@
-using HaoYueNet.ServerNetwork.Standard2;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net.Sockets;
+//using HaoYueNet.ServerNetwork;
+//using System.Net.Sockets;
-namespace NoSugarNet.ClientCoreNet.Standard2
-{
- public class LocalListener : TcpSaeaServer_SourceMode
- {
- public byte mTunnelID;
- public long mReciveAllLenght;
- public long mSendAllLenght;
- public LocalListener(int numConnections, int receiveBufferSize, byte TunnelID)
- : base(numConnections, receiveBufferSize)
- {
- OnClientNumberChange += ClientNumberChange;
- OnReceive += ReceiveData;
- OnDisconnected += OnDisconnect;
- OnNetLog += OnShowNetLog;
+//namespace NoSugarNet.ClientCore
+//{
+// public class LocalListener : TcpSaeaServer_SourceMode
+// {
+// public byte mTunnelID;
+// public long mReciveAllLenght;
+// public long mSendAllLenght;
+// public long currSeed;
+// static long Seed;
- mTunnelID = TunnelID;
- }
+// public LocalListener(int numConnections, int receiveBufferSize, byte TunnelID)
+// : base(numConnections, receiveBufferSize)
+// {
+// OnClientNumberChange += ClientNumberChange;
+// OnReceive += ReceiveData;
+// OnDisconnected += OnDisconnect;
+// OnNetLog += OnShowNetLog;
- private void ClientNumberChange(int num, AsyncUserToken token)
- {
- AppNoSugarNet.log.Info("Client数发生变化");
- //增加连接数
- if (num > 0)
- {
- int Idx = AddDictSocket(token.Socket);
- if (GetSocketByIdx(Idx, out LocalClientInfo _localClientInf))
- {
- AppNoSugarNet.local.OnClientLocalConnect(mTunnelID, (byte)Idx);
- }
- }
- }
+// mTunnelID = TunnelID;
- ///
- /// 通过下标发送
- ///
- ///
- ///
- public void SendSocketByIdx(int Idx, byte[] data)
- {
- if (GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
- {
- mSendAllLenght += data.Length;
- SendToSocket(_localClientInfo._socket, data);
- }
- //TODO连接前缓存数据
- }
+// currSeed = Seed++;
+// }
- ///
- /// 接受包回调
- ///
- /// 协议ID
- /// 错误编号
- /// 业务数据
- private void ReceiveData(AsyncUserToken token, byte[] data)
- {
- DataCallBack(token.Socket, data);
- }
+// private void ClientNumberChange(int num, AsyncUserToken token)
+// {
+// AppNoSugarNet.log.Info("Client数发生变化");
+// //增加连接数stsc
+// if (num > 0)
+// {
+// int Idx = AddDictSocket(token.Socket);
+// if (GetSocketByIdx(Idx, out LocalClientInfo _localClientInf))
+// {
+// AppNoSugarNet.local.OnClientLocalConnect(mTunnelID, (byte)Idx);
+// }
+// }
+// }
- public void DataCallBack(Socket sk, byte[] data)
- {
- //AppNoSugarNet.log.Info("收到消息 数据长度=>" + data.Length);
- //记录接受长度
- mReciveAllLenght += data.Length;
- if (!GetSocketIdxBySocket(sk, out int Idx))
- return;
- try
- {
- //抛出网络数据
- AppNoSugarNet.local.OnClientTunnelDataCallBack(mTunnelID, (byte)Idx, data);
- }
- catch (Exception ex)
- {
- AppNoSugarNet.log.Info("逻辑处理错误:" + ex.ToString());
- }
- }
+// ///
+// /// 通过下标发送
+// ///
+// ///
+// ///
+// public void SendSocketByIdx(int Idx, byte[] data)
+// {
+// if (GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
+// {
+// mSendAllLenght += data.Length;
+// SendToSocket(_localClientInfo._socket, data);
+// }
+// //TODO连接前缓存数据
+// }
- public void CloseConnectByIdx(byte Idx)
- {
- if (GetSocketByIdx(Idx, out LocalClientInfo _localClientInf))
- {
- _localClientInf._socket.Shutdown(SocketShutdown.Both);
- }
- }
+// ///
+// /// 接受包回调
+// ///
+// /// 协议ID
+// /// 错误编号
+// /// 业务数据
+// private void ReceiveData(AsyncUserToken token, byte[] data)
+// {
+// DataCallBack(token.Socket, data);
+// }
- ///
- /// 断开连接
- ///
- ///
- public void OnDisconnect(AsyncUserToken token)
- {
- AppNoSugarNet.log.Info("断开连接");
+// public void DataCallBack(Socket sk, byte[] data)
+// {
+// //AppNoSugarNet.log.Info("收到消息 数据长度=>" + data.Length);
+// //记录接受长度
+// mReciveAllLenght += data.Length;
+// if (!GetSocketIdxBySocket(sk, out int Idx))
+// return;
+// try
+// {
+// //抛出网络数据
+// AppNoSugarNet.local.OnClientTunnelDataCallBack(mTunnelID, (byte)Idx, data);
+// }
+// catch (Exception ex)
+// {
+// AppNoSugarNet.log.Info("逻辑处理错误:" + ex.ToString());
+// }
+// }
- if (!GetSocketIdxBySocket(token.Socket, out int Idx))
- return;
+// public void CloseConnectByIdx(byte Idx)
+// {
+// if (GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
+// {
+// //把未发送消息队列回收了
+// while (_localClientInfo.msgQueue.Count > 0)
+// {
+// IdxWithMsg msg = _localClientInfo.msgQueue.Dequeue();
+// AppNoSugarNet.local._localMsgPool.Enqueue(msg);
+// }
- AppNoSugarNet.local.OnClientLocalDisconnect(mTunnelID, (byte)Idx);
- RemoveDictSocket(token.Socket);
- }
+// _localClientInfo._socket.Shutdown(SocketShutdown.Both);
+// }
+// }
- public void OnShowNetLog(string msg)
- {
- AppNoSugarNet.log.Info(msg);
- }
+// ///
+// /// 断开连接
+// ///
+// ///
+// public void OnDisconnect(AsyncUserToken token)
+// {
+// AppNoSugarNet.log.Info("断开连接");
- #region 一个轻量级无用户连接管理
- Dictionary DictSocketHandle2Idx = new Dictionary();
- Dictionary DictIdx2LocalClientInfo = new Dictionary();
- int mSeedIdx = 0;
- List FreeIdxs = new List();
- public class LocalClientInfo
- {
- public Socket _socket;
- public bool bRemoteConnect;
- public bool bLocalConnect => _socket.Connected;
- public Queue msgQueue = new Queue();
- }
+// if (!GetSocketIdxBySocket(token.Socket, out int Idx))
+// return;
- int GetNextIdx()
- {
- if (FreeIdxs.Count > 0)
- {
- int Idx = FreeIdxs[0];
- FreeIdxs.RemoveAt(0);
- return Idx;
- }
- return mSeedIdx++;
- }
+// AppNoSugarNet.local.OnClientLocalDisconnect(mTunnelID, (byte)Idx);
+// RemoveDictSocket(token.Socket);
+// }
- ///
- /// 追加Socket返回下标
- ///
- ///
- ///
- public int AddDictSocket(Socket socket)
- {
- if (socket == null)
- return -1;
- lock (DictSocketHandle2Idx)
- {
- int Idx = GetNextIdx();
- DictSocketHandle2Idx[socket.Handle] = Idx;
- DictIdx2LocalClientInfo[Idx] = new LocalClientInfo() { _socket = socket,bRemoteConnect = false};
- return Idx;
- }
- }
+// public void OnShowNetLog(string msg)
+// {
+// AppNoSugarNet.log.Info(msg);
+// }
- public void RemoveDictSocket(Socket socket)
- {
- if (socket == null)
- return;
- lock (DictSocketHandle2Idx)
- {
- if (!DictSocketHandle2Idx.ContainsKey(socket.Handle))
- return;
- int Idx = DictSocketHandle2Idx[socket.Handle];
- FreeIdxs.Add(Idx);
- if (DictIdx2LocalClientInfo.ContainsKey(Idx))
- DictIdx2LocalClientInfo.Remove(Idx);
- DictSocketHandle2Idx.Remove(socket.Handle);
- }
- }
+// #region 一个轻量级无用户连接管理
+// Dictionary DictSocketHandle2Idx = new Dictionary();
+// Dictionary DictIdx2LocalClientInfo = new Dictionary();
+// int mSeedIdx = 0;
+// List FreeIdxs = new List();
+// public class LocalClientInfo
+// {
+// public Socket _socket;
+// public bool bRemoteConnect;
+// public bool bLocalConnect => _socket.Connected;
+// public Queue msgQueue = new Queue();
+// }
- bool GetSocketByIdx(int Idx, out LocalClientInfo _localClientInfo)
- {
- if (!DictIdx2LocalClientInfo.ContainsKey(Idx))
- {
- _localClientInfo = null;
- return false;
- }
+// public Dictionary GetDictIdx2LocalClientInfo()
+// {
+// return DictIdx2LocalClientInfo;
+// }
- _localClientInfo = DictIdx2LocalClientInfo[Idx];
- return true;
- }
+// int GetNextIdx()
+// {
+// if (FreeIdxs.Count > 0)
+// {
+// int Idx = FreeIdxs[0];
+// FreeIdxs.RemoveAt(0);
+// return Idx;
+// }
+// return mSeedIdx++;
+// }
- public bool GetSocketIdxBySocket(Socket _socket, out int Idx)
- {
- if (_socket == null)
- {
- Idx = -1;
- return false;
- }
+// void ResetFree()
+// {
+// FreeIdxs.Clear();
+// mSeedIdx = 0;
+// }
- if (!DictSocketHandle2Idx.ContainsKey(_socket.Handle))
- {
- Idx = -1;
- return false;
- }
+// ///
+// /// 追加Socket返回下标
+// ///
+// ///
+// ///
+// public int AddDictSocket(Socket socket)
+// {
+// if (socket == null)
+// return -1;
+// lock (DictSocketHandle2Idx)
+// {
+// int Idx = GetNextIdx();
+// DictSocketHandle2Idx[socket.Handle] = Idx;
+// DictIdx2LocalClientInfo[Idx] = new LocalClientInfo() { _socket = socket,bRemoteConnect = false};
+// AppNoSugarNet.log.Debug($"AddDictSocket mTunnelID->{mTunnelID} Idx->{Idx} socket.Handle{socket.Handle}");
+// return Idx;
+// }
+// }
- Idx = DictSocketHandle2Idx[_socket.Handle];
- return true;
- }
+// public void RemoveDictSocket(Socket socket)
+// {
+// if (socket == null)
+// return;
+// lock (DictSocketHandle2Idx)
+// {
+// if (!DictSocketHandle2Idx.ContainsKey(socket.Handle))
+// return;
+// int Idx = DictSocketHandle2Idx[socket.Handle];
+// FreeIdxs.Add(Idx);
+// if (DictIdx2LocalClientInfo.ContainsKey(Idx))
+// DictIdx2LocalClientInfo.Remove(Idx);
+// DictSocketHandle2Idx.Remove(socket.Handle);
+// AppNoSugarNet.log.Debug($"RemoveDictSocket mTunnelID->{mTunnelID} Idx->{Idx} socket.Handle{socket.Handle}");
+// }
+// }
- public bool CheckRemoteConnect(int Idx)
- {
- if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
- return false;
- return _localClientInfo.bRemoteConnect;
- }
+// bool GetSocketByIdx(int Idx, out LocalClientInfo _localClientInfo)
+// {
+// if (!DictIdx2LocalClientInfo.ContainsKey(Idx))
+// {
+// _localClientInfo = null;
+// return false;
+// }
- public void SetRemoteConnectd(int Idx,bool bConnected)
- {
- if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
- return;
- if (bConnected)
- AppNoSugarNet.log.Info("远端本地连接已连接!!!!");
- else
- AppNoSugarNet.log.Info("远端本地连接已断开连接!!!!");
- _localClientInfo.bRemoteConnect = bConnected;
- }
+// _localClientInfo = DictIdx2LocalClientInfo[Idx];
+// return true;
+// }
- public void StopAll()
- {
- lock (DictIdx2LocalClientInfo)
- {
- int[] Idxs = DictIdx2LocalClientInfo.Keys.ToArray();
- for (int i = 0; i < Idxs.Length; i++)
- {
- CloseConnectByIdx((byte)Idxs[i]);
- }
- DictIdx2LocalClientInfo.Clear();
- }
- }
+// public bool GetSocketIdxBySocket(Socket _socket, out int Idx)
+// {
+// if (_socket == null)
+// {
+// Idx = -1;
+// return false;
+// }
- #endregion
+// if (!DictSocketHandle2Idx.ContainsKey(_socket.Handle))
+// {
+// Idx = -1;
+// return false;
+// }
- #region 缓存
- public void EnqueueIdxWithMsg(byte Idx, byte[] data)
- {
- if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
- return;
+// Idx = DictSocketHandle2Idx[_socket.Handle];
+// return true;
+// }
- IdxWithMsg Msg = AppNoSugarNet.local._localMsgPool.Dequeue();
- Msg.Idx = Idx;
- Msg.data = data;
- _localClientInfo.msgQueue.Enqueue(Msg);
- }
- public bool GetDictMsgQueue(byte Idx,out List MsgList)
- {
- if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo) || _localClientInfo.msgQueue.Count < 1)
- {
- MsgList = null;
- return false;
- }
+// public bool CheckRemoteConnect(int Idx)
+// {
+// if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
+// return false;
+// return _localClientInfo.bRemoteConnect;
+// }
- MsgList = new List();
- lock (_localClientInfo.msgQueue)
- {
- while (_localClientInfo.msgQueue.Count > 0)
- {
- IdxWithMsg msg = _localClientInfo.msgQueue.Dequeue();
- MsgList.Add(msg);
- }
- return true;
- }
- }
- #endregion
- }
-}
+// public void SetRemoteConnectd(int Idx,bool bConnected)
+// {
+// if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
+// return;
+// if (bConnected)
+// AppNoSugarNet.log.Info("远端本地连接已连接!!!!");
+// else
+// AppNoSugarNet.log.Info("远端本地连接已断开连接!!!!");
+// _localClientInfo.bRemoteConnect = bConnected;
+// }
+
+// public void StopAllLocalClient()
+// {
+// lock (DictIdx2LocalClientInfo)
+// {
+// int[] Idxs = DictIdx2LocalClientInfo.Keys.ToArray();
+// for (int i = 0; i < Idxs.Length; i++)
+// {
+// CloseConnectByIdx((byte)Idxs[i]);
+// }
+// DictIdx2LocalClientInfo.Clear();
+// DictSocketHandle2Idx.Clear();
+// ResetFree();
+
+// //清理事件
+// OnClientNumberChange -= ClientNumberChange;
+// OnReceive -= ReceiveData;
+// OnDisconnected -= OnDisconnect;
+// OnNetLog -= OnShowNetLog;
+// }
+// }
+
+// #endregion
+
+
+// #region 缓存
+// public void EnqueueIdxWithMsg(byte Idx, byte[] data)
+// {
+// if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
+// return;
+
+// IdxWithMsg Msg = AppNoSugarNet.local._localMsgPool.Dequeue();
+// Msg.Idx = Idx;
+// Msg.data = data;
+// _localClientInfo.msgQueue.Enqueue(Msg);
+// }
+// public bool GetDictMsgQueue(byte Idx,out List MsgList)
+// {
+// if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo) || _localClientInfo.msgQueue.Count < 1)
+// {
+// MsgList = null;
+// return false;
+// }
+
+// MsgList = new List();
+// lock (_localClientInfo.msgQueue)
+// {
+// while (_localClientInfo.msgQueue.Count > 0)
+// {
+// IdxWithMsg msg = _localClientInfo.msgQueue.Dequeue();
+// MsgList.Add(msg);
+// }
+// return true;
+// }
+// }
+// #endregion
+// }
+//}
diff --git a/NoSugarNet.ClientCore.Standard2/Manager/LocalClient/LocalListener_Source.cs b/NoSugarNet.ClientCore.Standard2/Manager/LocalClient/LocalListener_Source.cs
index 57f3da7..69e9a15 100644
--- a/NoSugarNet.ClientCore.Standard2/Manager/LocalClient/LocalListener_Source.cs
+++ b/NoSugarNet.ClientCore.Standard2/Manager/LocalClient/LocalListener_Source.cs
@@ -1,292 +1,296 @@
-using HaoYueNet.ClientNetworkNet.Standard2.OtherMode;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net.Sockets;
+//using HaoYueNet.ClientNetwork.OtherMode;
+//using HaoYueNet.ServerNetwork;
+//using System.Net.Sockets;
-namespace NoSugarNet.ClientCoreNet.Standard2
-{
- public class LocalListener_Source : NetworkHelperCore_ListenerMode
- {
- public byte mTunnelID;
- public long mReciveAllLenght;
- public long mSendAllLenght;
- public LocalListener_Source(int numConnections, int receiveBufferSize, byte TunnelID)
- : base()
- {
- OnConnected += ClientNumberChange;
- OnReceive += ReceiveData;
- OnDisconnected += OnDisconnectClient;
- OnNetLog += OnShowNetLog;
+//namespace NoSugarNet.ClientCore
+//{
+// public class LocalListener_Source : NetworkHelperCore_ListenerMode
+// {
+// public byte mTunnelID;
+// public long mReciveAllLenght;
+// public long mSendAllLenght;
+// public LocalListener_Source(int numConnections, int receiveBufferSize, byte TunnelID)
+// : base()
+// {
+// OnConnected += ClientNumberChange;
+// OnReceive += ReceiveData;
+// OnDisconnected += OnDisconnectClient;
+// OnNetLog += OnShowNetLog;
- mTunnelID = TunnelID;
- }
+// mTunnelID = TunnelID;
+// }
- private void ClientNumberChange(Socket socket)
- {
- AppNoSugarNet.log.Info("Client数发生变化");
- //增加连接数
- int Idx = AddDictSocket(socket);
- if (GetSocketByIdx(Idx, out LocalClientInfo _localClientInf))
- {
- AppNoSugarNet.local.OnClientLocalConnect(mTunnelID, (byte)Idx);
- }
- }
+// private void ClientNumberChange(Socket socket)
+// {
+// AppNoSugarNet.log.Info("Client数发生变化");
+// //增加连接数
+// int Idx = AddDictSocket(socket);
+// if (GetSocketByIdx(Idx, out LocalClientInfo _localClientInf))
+// {
+// AppNoSugarNet.local.OnClientLocalConnect(mTunnelID, (byte)Idx);
+// }
+// }
- ///
- /// 通过下标发送
- ///
- ///
- ///
- public void SendSocketByIdx(int Idx, byte[] data)
- {
- if (GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
- {
- mSendAllLenght += data.Length;
- SendToClient(_localClientInfo._socket, data);
- }
- //TODO连接前缓存数据
- }
+// ///
+// /// 通过下标发送
+// ///
+// ///
+// ///
+// public void SendSocketByIdx(int Idx, byte[] data)
+// {
+// if (GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
+// {
+// mSendAllLenght += data.Length;
+// SendToClient(_localClientInfo._socket, data);
+// }
+// //TODO连接前缓存数据
+// }
- ///
- /// 接受包回调
- ///
- /// 协议ID
- /// 错误编号
- /// 业务数据
- private void ReceiveData(Socket sk, byte[] data)
- {
- DataCallBack(sk, data);
- }
+// ///
+// /// 接受包回调
+// ///
+// /// 协议ID
+// /// 错误编号
+// /// 业务数据
+// private void ReceiveData(Socket sk, byte[] data)
+// {
+// DataCallBack(sk, data);
+// }
- public void DataCallBack(Socket sk, byte[] data)
- {
- //AppNoSugarNet.log.Info("收到消息 数据长度=>" + data.Length);
- //记录接受长度
- mReciveAllLenght += data.Length;
- if (!GetSocketIdxBySocket(sk, out int Idx))
- return;
- try
- {
- if (GetMsgQueueByIdx(sk.Handle, out Queue _queue))
- {
- lock (_queue)
- {
- _queue.Enqueue(data);
- while (_queue.Count > 0)
- {
- AppNoSugarNet.local.OnClientTunnelDataCallBack(mTunnelID, (byte)Idx, _queue.Dequeue());
- }
- }
- }
+// public void DataCallBack(Socket sk, byte[] data)
+// {
+// //AppNoSugarNet.log.Info("收到消息 数据长度=>" + data.Length);
+// //记录接受长度
+// mReciveAllLenght += data.Length;
+// if (!GetSocketIdxBySocket(sk, out int Idx))
+// return;
+// try
+// {
+// if (GetMsgQueueByIdx(sk.Handle, out Queue _queue))
+// {
+// lock (_queue)
+// {
+// _queue.Enqueue(data);
+// while (_queue.Count > 0)
+// {
+// AppNoSugarNet.local.OnClientTunnelDataCallBack(mTunnelID, (byte)Idx, _queue.Dequeue());
+// }
+// }
+// }
- ////抛出网络数据
- //AppNoSugarNet.local.OnClientTunnelDataCallBack(mTunnelID, (byte)Idx, data);
- }
- catch (Exception ex)
- {
- AppNoSugarNet.log.Info("逻辑处理错误:" + ex.ToString());
- }
- }
+// ////抛出网络数据
+// //AppNoSugarNet.local.OnClientTunnelDataCallBack(mTunnelID, (byte)Idx, data);
+// }
+// catch (Exception ex)
+// {
+// AppNoSugarNet.log.Info("逻辑处理错误:" + ex.ToString());
+// }
+// }
- public void CloseConnectByIdx(byte Idx)
- {
- if (GetSocketByIdx(Idx, out LocalClientInfo _localClientInf))
- {
- _localClientInf._socket.Shutdown(SocketShutdown.Both);
- }
- }
+// public void CloseConnectByIdx(byte Idx)
+// {
+// if (GetSocketByIdx(Idx, out LocalClientInfo _localClientInf))
+// {
+// _localClientInf._socket.Shutdown(SocketShutdown.Both);
+// }
+// }
- ///
- /// 断开连接
- ///
- ///
- public void OnDisconnectClient(Socket sk)
- {
- AppNoSugarNet.log.Info("断开连接");
+// ///
+// /// 断开连接
+// ///
+// ///
+// public void OnDisconnectClient(Socket sk)
+// {
+// AppNoSugarNet.log.Info("断开连接");
- if (!GetSocketIdxBySocket(sk, out int Idx))
- return;
+// if (!GetSocketIdxBySocket(sk, out int Idx))
+// return;
- AppNoSugarNet.local.OnClientLocalDisconnect(mTunnelID, (byte)Idx);
- RemoveDictSocket(sk);
- }
+// AppNoSugarNet.local.OnClientLocalDisconnect(mTunnelID, (byte)Idx);
+// RemoveDictSocket(sk);
+// }
- public void OnShowNetLog(string msg)
- {
- AppNoSugarNet.log.Info(msg);
- }
+// public void OnShowNetLog(string msg)
+// {
+// AppNoSugarNet.log.Info(msg);
+// }
- #region 一个轻量级无用户连接管理
- Dictionary DictSocketHandle2Idx = new Dictionary();
- Dictionary> DictSocketHandle2Msg = new Dictionary>();
- Dictionary DictIdx2LocalClientInfo = new Dictionary();
- int mSeedIdx = 0;
- List FreeIdxs = new List();
- public class LocalClientInfo
- {
- public Socket _socket;
- public bool bRemoteConnect;
- public bool bLocalConnect => _socket.Connected;
- public Queue msgQueue = new Queue();
- }
+// #region 一个轻量级无用户连接管理
+// Dictionary DictSocketHandle2Idx = new Dictionary();
+// Dictionary> DictSocketHandle2Msg = new Dictionary>();
+// Dictionary DictIdx2LocalClientInfo = new Dictionary();
+// int mSeedIdx = 0;
+// List FreeIdxs = new List();
+// public class LocalClientInfo
+// {
+// public Socket _socket;
+// public bool bRemoteConnect;
+// public bool bLocalConnect => _socket.Connected;
+// public Queue msgQueue = new Queue();
+// }
- int GetNextIdx()
- {
- if (FreeIdxs.Count > 0)
- {
- int Idx = FreeIdxs[0];
- FreeIdxs.RemoveAt(0);
- return Idx;
- }
- return mSeedIdx++;
- }
+// int GetNextIdx()
+// {
+// if (FreeIdxs.Count > 0)
+// {
+// int Idx = FreeIdxs[0];
+// FreeIdxs.RemoveAt(0);
+// return Idx;
+// }
+// return mSeedIdx++;
+// }
- ///
- /// 追加Socket返回下标
- ///
- ///
- ///
- public int AddDictSocket(Socket socket)
- {
- if (socket == null)
- return -1;
- lock (DictSocketHandle2Idx)
- {
- int Idx = GetNextIdx();
- DictSocketHandle2Idx[socket.Handle] = Idx;
- DictIdx2LocalClientInfo[Idx] = new LocalClientInfo() { _socket = socket,bRemoteConnect = false};
- DictSocketHandle2Msg[socket.Handle] = new Queue();
- return Idx;
- }
- }
+// ///
+// /// 追加Socket返回下标
+// ///
+// ///
+// ///
+// public int AddDictSocket(Socket socket)
+// {
+// if (socket == null)
+// return -1;
- public void RemoveDictSocket(Socket socket)
- {
- if (socket == null)
- return;
- lock (DictSocketHandle2Idx)
- {
- if (!DictSocketHandle2Idx.ContainsKey(socket.Handle))
- return;
- int Idx = DictSocketHandle2Idx[socket.Handle];
- FreeIdxs.Add(Idx);
- if (DictIdx2LocalClientInfo.ContainsKey(Idx))
- DictIdx2LocalClientInfo.Remove(Idx);
+// lock (DictSocketHandle2Idx)
+// {
+// int Idx = GetNextIdx();
+// DictSocketHandle2Idx[socket.Handle] = Idx;
+// DictIdx2LocalClientInfo[Idx] = new LocalClientInfo() { _socket = socket,bRemoteConnect = false};
+// DictSocketHandle2Msg[socket.Handle] = new Queue();
+// AppNoSugarNet.log.Debug($"AddDictSocket mTunnelID->{mTunnelID} Idx->{Idx} socket.Handle{socket.Handle}");
+// return Idx;
+// }
+// }
+
+// public void RemoveDictSocket(Socket socket)
+// {
+// if (socket == null)
+// return;
+// lock (DictSocketHandle2Idx)
+// {
+// if (!DictSocketHandle2Idx.ContainsKey(socket.Handle))
+// return;
+// int Idx = DictSocketHandle2Idx[socket.Handle];
+// FreeIdxs.Add(Idx);
+// if (DictIdx2LocalClientInfo.ContainsKey(Idx))
+// DictIdx2LocalClientInfo.Remove(Idx);
- if (DictSocketHandle2Msg.ContainsKey(socket.Handle))
- DictSocketHandle2Msg.Remove(socket.Handle);
+// if (DictSocketHandle2Msg.ContainsKey(socket.Handle))
+// DictSocketHandle2Msg.Remove(socket.Handle);
- DictSocketHandle2Idx.Remove(socket.Handle);
- }
- }
+// DictSocketHandle2Idx.Remove(socket.Handle);
- bool GetSocketByIdx(int Idx, out LocalClientInfo _localClientInfo)
- {
- if (!DictIdx2LocalClientInfo.ContainsKey(Idx))
- {
- _localClientInfo = null;
- return false;
- }
+// AppNoSugarNet.log.Debug($"RemoveDictSocket mTunnelID->{mTunnelID} Idx->{Idx} socket.Handle{socket.Handle}");
+// }
+// }
- _localClientInfo = DictIdx2LocalClientInfo[Idx];
- return true;
- }
+// bool GetSocketByIdx(int Idx, out LocalClientInfo _localClientInfo)
+// {
+// if (!DictIdx2LocalClientInfo.ContainsKey(Idx))
+// {
+// _localClientInfo = null;
+// return false;
+// }
- bool GetMsgQueueByIdx(IntPtr handle, out Queue _queue)
- {
- if (!DictSocketHandle2Msg.ContainsKey(handle))
- {
- _queue = null;
- return false;
- }
+// _localClientInfo = DictIdx2LocalClientInfo[Idx];
+// return true;
+// }
- _queue = DictSocketHandle2Msg[handle];
- return true;
- }
+// bool GetMsgQueueByIdx(IntPtr handle, out Queue _queue)
+// {
+// if (!DictSocketHandle2Msg.ContainsKey(handle))
+// {
+// _queue = null;
+// return false;
+// }
- public bool GetSocketIdxBySocket(Socket _socket, out int Idx)
- {
- if (_socket == null)
- {
- Idx = -1;
- return false;
- }
+// _queue = DictSocketHandle2Msg[handle];
+// return true;
+// }
- if (!DictSocketHandle2Idx.ContainsKey(_socket.Handle))
- {
- Idx = -1;
- return false;
- }
+// public bool GetSocketIdxBySocket(Socket _socket, out int Idx)
+// {
+// if (_socket == null)
+// {
+// Idx = -1;
+// return false;
+// }
- Idx = DictSocketHandle2Idx[_socket.Handle];
- return true;
- }
+// if (!DictSocketHandle2Idx.ContainsKey(_socket.Handle))
+// {
+// Idx = -1;
+// return false;
+// }
- public bool CheckRemoteConnect(int Idx)
- {
- if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
- return false;
- return _localClientInfo.bRemoteConnect;
- }
+// Idx = DictSocketHandle2Idx[_socket.Handle];
+// return true;
+// }
- public void SetRemoteConnectd(int Idx,bool bConnected)
- {
- if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
- return;
- if (bConnected)
- AppNoSugarNet.log.Info("远端本地连接已连接!!!!");
- else
- AppNoSugarNet.log.Info("远端本地连接已断开连接!!!!");
- _localClientInfo.bRemoteConnect = bConnected;
- }
+// public bool CheckRemoteConnect(int Idx)
+// {
+// if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
+// return false;
+// return _localClientInfo.bRemoteConnect;
+// }
- public void StopAll()
- {
- lock (DictIdx2LocalClientInfo)
- {
- int[] Idxs = DictIdx2LocalClientInfo.Keys.ToArray();
- for (int i = 0; i < Idxs.Length; i++)
- {
- CloseConnectByIdx((byte)Idxs[i]);
- }
- DictIdx2LocalClientInfo.Clear();
- }
- }
+// public void SetRemoteConnectd(int Idx,bool bConnected)
+// {
+// if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
+// return;
+// if (bConnected)
+// AppNoSugarNet.log.Info("远端本地连接已连接!!!!");
+// else
+// AppNoSugarNet.log.Info("远端本地连接已断开连接!!!!");
+// _localClientInfo.bRemoteConnect = bConnected;
+// }
- #endregion
+// public void StopAll()
+// {
+// lock (DictIdx2LocalClientInfo)
+// {
+// int[] Idxs = DictIdx2LocalClientInfo.Keys.ToArray();
+// for (int i = 0; i < Idxs.Length; i++)
+// {
+// CloseConnectByIdx((byte)Idxs[i]);
+// }
+// DictIdx2LocalClientInfo.Clear();
+// FreeIdxs.Clear();
+// mSeedIdx = 0;
+// }
+// }
+
+// #endregion
- #region 缓存
- public void EnqueueIdxWithMsg(byte Idx, byte[] data)
- {
- if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
- return;
+// #region 缓存
+// public void EnqueueIdxWithMsg(byte Idx, byte[] data)
+// {
+// if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
+// return;
- IdxWithMsg Msg = AppNoSugarNet.local._localMsgPool.Dequeue();
- Msg.Idx = Idx;
- Msg.data = data;
- _localClientInfo.msgQueue.Enqueue(Msg);
- }
- public bool GetDictMsgQueue(byte Idx,out List MsgList)
- {
- if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo) || _localClientInfo.msgQueue.Count < 1)
- {
- MsgList = null;
- return false;
- }
+// IdxWithMsg Msg = AppNoSugarNet.local._localMsgPool.Dequeue();
+// Msg.Idx = Idx;
+// Msg.data = data;
+// _localClientInfo.msgQueue.Enqueue(Msg);
+// }
+// public bool GetDictMsgQueue(byte Idx,out List MsgList)
+// {
+// if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo) || _localClientInfo.msgQueue.Count < 1)
+// {
+// MsgList = null;
+// return false;
+// }
- MsgList = new List();
- lock (_localClientInfo.msgQueue)
- {
- while (_localClientInfo.msgQueue.Count > 0)
- {
- IdxWithMsg msg = _localClientInfo.msgQueue.Dequeue();
- MsgList.Add(msg);
- }
- return true;
- }
- }
- #endregion
- }
-}
+// MsgList = new List();
+// lock (_localClientInfo.msgQueue)
+// {
+// while (_localClientInfo.msgQueue.Count > 0)
+// {
+// IdxWithMsg msg = _localClientInfo.msgQueue.Dequeue();
+// MsgList.Add(msg);
+// }
+// return true;
+// }
+// }
+// #endregion
+// }
+//}
diff --git a/NoSugarNet.ClientCore.Standard2/Manager/LocalClient/LocalMsgQueuePool.cs b/NoSugarNet.ClientCore.Standard2/Manager/LocalClient/LocalMsgQueuePool.cs
index 9201ee4..2e98933 100644
--- a/NoSugarNet.ClientCore.Standard2/Manager/LocalClient/LocalMsgQueuePool.cs
+++ b/NoSugarNet.ClientCore.Standard2/Manager/LocalClient/LocalMsgQueuePool.cs
@@ -1,55 +1,53 @@
-using System.Collections.Generic;
+//namespace NoSugarNet.ClientCore
+//{
+// public class IdxWithMsg
+// {
+// public byte Idx;
+// public byte[] data;
+// }
-namespace NoSugarNet.ClientCoreNet.Standard2
-{
- public class IdxWithMsg
- {
- public byte Idx;
- public byte[] data;
- }
+// public class LocalMsgQueuePool
+// {
+// Queue msg_pool;
- public class LocalMsgQueuePool
- {
- Queue msg_pool;
+// public LocalMsgQueuePool(int capacity)
+// {
+// msg_pool = new Queue(capacity);
+// }
- public LocalMsgQueuePool(int capacity)
- {
- msg_pool = new Queue(capacity);
- }
+// ///
+// /// 向 Queue 的末尾添加一个对象。
+// ///
+// ///
+// public void Enqueue(IdxWithMsg item)
+// {
+// lock (msg_pool)
+// {
+// item.Idx = 0;
+// item.data = null;
+// msg_pool.Enqueue(item);
+// }
+// }
- ///
- /// 向 Queue 的末尾添加一个对象。
- ///
- ///
- public void Enqueue(IdxWithMsg item)
- {
- lock (msg_pool)
- {
- item.Idx = 0;
- item.data = null;
- msg_pool.Enqueue(item);
- }
- }
+// //移除并返回在 Queue 的开头的对象。
+// public IdxWithMsg Dequeue()
+// {
+// lock (msg_pool)
+// {
+// if(msg_pool.Count > 0)
+// return msg_pool.Dequeue();
+// return new IdxWithMsg();
+// }
+// }
- //移除并返回在 Queue 的开头的对象。
- public IdxWithMsg Dequeue()
- {
- lock (msg_pool)
- {
- if(msg_pool.Count > 0)
- return msg_pool.Dequeue();
- return new IdxWithMsg();
- }
- }
+// public int Count
+// {
+// get { return msg_pool.Count; }
+// }
- public int Count
- {
- get { return msg_pool.Count; }
- }
-
- public void Clear()
- {
- msg_pool.Clear();
- }
- }
-}
+// public void Clear()
+// {
+// msg_pool.Clear();
+// }
+// }
+//}
diff --git a/NoSugarNet.ClientCore.Standard2/Manager/LogManager.cs b/NoSugarNet.ClientCore.Standard2/Manager/LogManager.cs
index e309b0a..e356779 100644
--- a/NoSugarNet.ClientCore.Standard2/Manager/LogManager.cs
+++ b/NoSugarNet.ClientCore.Standard2/Manager/LogManager.cs
@@ -1,4 +1,4 @@
-namespace NoSugarNet.ClientCoreNet.Standard2.Manager
+namespace NoSugarNet.ClientCore.Manager
{
public class LogManager
{
@@ -44,5 +44,10 @@
{
OnLog?.Invoke((int)logtype, str);
}
+
+ public void Log(int logtype, string str)
+ {
+ OnLog?.Invoke(logtype, str);
+ }
}
}
\ No newline at end of file
diff --git a/NoSugarNet.ClientCore.Standard2/Manager/UserDataManager.cs b/NoSugarNet.ClientCore.Standard2/Manager/UserDataManager.cs
index cf95c10..795136c 100644
--- a/NoSugarNet.ClientCore.Standard2/Manager/UserDataManager.cs
+++ b/NoSugarNet.ClientCore.Standard2/Manager/UserDataManager.cs
@@ -1,6 +1,6 @@
using AxibugProtobuf;
-namespace NoSugarNet.ClientCoreNet.Standard2.Manager
+namespace NoSugarNet.ClientCore.Manager
{
public class UserDataBase
{
@@ -23,10 +23,11 @@ namespace NoSugarNet.ClientCoreNet.Standard2.Manager
public MainUserDataBase userdata { get;private set; } = new MainUserDataBase();
public bool IsLoggedIn => userdata.IsLoggedIn;
- public void InitMainUserData(string UName)
+ public void InitMainUserData(string UName,long UID)
{
userdata.Account = UName;
userdata.IsLoggedIn = true;
+ userdata.UID = UID;
//以及其他数据初始化
//...
}
@@ -49,7 +50,7 @@ namespace NoSugarNet.ClientCoreNet.Standard2.Manager
//如果之前已登录,则重新登录
if (userdata.IsLoggedIn)
{
- AppNoSugarNet.login.Login(userdata.Account);
+ AppNoSugarNet.login.Login();
}
}
}
diff --git a/NoSugarNet.ClientCore.Standard2/NetStatus.cs b/NoSugarNet.ClientCore.Standard2/NetStatus.cs
index 95392de..b764cd9 100644
--- a/NoSugarNet.ClientCore.Standard2/NetStatus.cs
+++ b/NoSugarNet.ClientCore.Standard2/NetStatus.cs
@@ -1,4 +1,4 @@
-namespace NoSugarNet.ClientCoreNet.Standard2
+namespace NoSugarNet.ClientCore
{
public struct NetStatus
{
diff --git a/NoSugarNet.ClientCore.Standard2/Network/NetMsg.cs b/NoSugarNet.ClientCore.Standard2/Network/NetMsg.cs
index 101b5a0..b85a4a2 100644
--- a/NoSugarNet.ClientCore.Standard2/Network/NetMsg.cs
+++ b/NoSugarNet.ClientCore.Standard2/Network/NetMsg.cs
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
-namespace NoSugarNet.ClientCoreNet.Standard2.Network
+namespace NoSugarNet.ClientCore.Network
{
public class NetMsg
diff --git a/NoSugarNet.ClientCore.Standard2/Network/NetworkHelper.cs b/NoSugarNet.ClientCore.Standard2/Network/NetworkHelper.cs
index 0a1c387..24582c1 100644
--- a/NoSugarNet.ClientCore.Standard2/Network/NetworkHelper.cs
+++ b/NoSugarNet.ClientCore.Standard2/Network/NetworkHelper.cs
@@ -1,8 +1,14 @@
-using HaoYueNet.ClientNetworkNet.Standard2;
+using AxibugProtobuf;
+using Google.Protobuf;
+using HaoYueNet.ClientNetwork;
using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
using System.Threading;
+using System.Threading.Tasks;
-namespace NoSugarNet.ClientCoreNet.Standard2.Network
+namespace NoSugarNet.ClientCore.Network
{
///
/// 继承网络库,以支持网络功能
@@ -28,7 +34,7 @@ namespace NoSugarNet.ClientCoreNet.Standard2.Network
///
/// 是否自动重连
///
- public bool bAutoReConnect = false;
+ public bool bAutoReConnect = true;
///
/// 重连尝试时间
///
@@ -39,12 +45,21 @@ namespace NoSugarNet.ClientCoreNet.Standard2.Network
NetworkDeBugLog($"NetworkConnected:{IsConnect}");
if (IsConnect)
{
- AppNoSugarNet.login.Login(Guid.NewGuid().ToString());
+ //从未登录过
+ if (!AppNoSugarNet.user.IsLoggedIn)
+ {
+ //首次登录
+ AppNoSugarNet.login.Login();
+ }
}
else
{
//连接失败
NetworkDeBugLog("连接失败!");
+
+ //停止所有
+ AppNoSugarNet.forwardlocal.StopAll();
+
//自动重连开关
if (bAutoReConnect)
ReConnect();
@@ -86,7 +101,8 @@ namespace NoSugarNet.ClientCoreNet.Standard2.Network
NetworkDeBugLog("OnConnectClose");
//停止所有
- AppNoSugarNet.local.StopAll();
+ AppNoSugarNet.forwardlocal.StopAll();
+ AppNoSugarNet.reverselocal.StopAll(AppNoSugarNet.user.userdata.UID);
//自动重连开关
if (bAutoReConnect)
diff --git a/NoSugarNet.ClientCore.Standard2/NoSugarNet.Adapter/BackwardLocalClient.cs b/NoSugarNet.ClientCore.Standard2/NoSugarNet.Adapter/BackwardLocalClient.cs
new file mode 100644
index 0000000..b818ea3
--- /dev/null
+++ b/NoSugarNet.ClientCore.Standard2/NoSugarNet.Adapter/BackwardLocalClient.cs
@@ -0,0 +1,113 @@
+using HaoYueNet.ClientNetwork.OtherMode;
+using System;
+
+namespace NoSugarNet.Adapter
+{
+ ///
+ /// 继承网络库,以支持网络功能
+ ///
+ public class BackwardLocalClient : NetworkHelperCore_SourceMode
+ {
+ public long mUID;
+ public byte mTunnelID;
+ public byte mIdx;
+ public long mReciveAllLenght;
+ public long mSendAllLenght;
+
+ public delegate void OnBackwardLogOutHandler(int LogLevel, string Msg);
+ public delegate void OnBackwardConnectHandler(long uid, byte tunnelId, byte Idx, BackwardLocalClient serverLocalClient);
+ public delegate void OnBackwardDisconnectHandler(long uid, byte tunnelId, byte Idx, BackwardLocalClient serverLocalClient);
+ public delegate void OnBackwardDataCallBackHandler(long uid, byte tunnelId, byte Idx, byte[] data);
+
+ public event OnBackwardLogOutHandler OnBackwardLogOut;
+ public event OnBackwardConnectHandler OnBackwardConnect;
+ public event OnBackwardDisconnectHandler OnBackwardDisconnect;
+ public event OnBackwardDataCallBackHandler OnBackwardDataCallBack;
+
+ public BackwardLocalClient(long UID,byte TunnelID, byte Idx)
+ {
+ mUID = UID;
+ mTunnelID = TunnelID;
+ mIdx = Idx;
+ //指定接收服务器数据事件
+ OnReceiveData += GetDataCallBack;
+ //断开连接
+ OnClose += OnConnectClose;
+ OnConnected += NetworkConnected;
+ //网络库调试信息输出事件,用于打印网络内容
+ OnLogOut += NetworkDeBugLog;
+ }
+
+ public void BandEvent(
+ OnBackwardLogOutHandler _OnBackwardLogOut,
+ OnBackwardConnectHandler _OnConnect,
+ OnBackwardDisconnectHandler _OnDisconnect,
+ OnBackwardDataCallBackHandler _OnDataCallBack
+ )
+ {
+ OnBackwardLogOut += _OnBackwardLogOut;
+ OnBackwardConnect += _OnConnect;
+ OnBackwardDisconnect += _OnDisconnect;
+ OnBackwardDataCallBack += _OnDataCallBack;
+ }
+
+ public void NetworkConnected(bool IsConnect)
+ {
+ NetworkDeBugLog($"NetworkConnected:{IsConnect}");
+ if (IsConnect)
+ {
+ OnBackwardConnect?.Invoke(mUID, mTunnelID, mIdx, this);
+ }
+ else
+ {
+ //连接失败
+ NetworkDeBugLog("连接失败!");
+ }
+ }
+
+ public void NetworkDeBugLog(string str)
+ {
+ OnBackwardLogOut?.Invoke(1 ,"NetCoreDebug >> " + str);
+ }
+
+ ///
+ /// 接受包回调
+ ///
+ /// 协议ID
+ /// 错误编号
+ /// 业务数据
+ public void GetDataCallBack(byte[] data)
+ {
+ //NetworkDeBugLog("收到消息 数据长度=>" + data.Length);
+ try
+ {
+ //记录接收数据长度
+ mReciveAllLenght += data.Length;
+ //抛出网络数据
+ OnBackwardDataCallBack?.Invoke(mUID, mTunnelID, mIdx, data);
+ }
+ catch (Exception ex)
+ {
+ NetworkDeBugLog("逻辑处理错误:" + ex.ToString());
+ }
+
+ }
+
+ ///
+ /// 关闭连接
+ ///
+ void OnConnectClose()
+ {
+ NetworkDeBugLog("OnConnectClose");
+ OnBackwardDisconnect?.Invoke(mUID, mTunnelID,mIdx,this);
+ }
+
+ public void Release()
+ {
+ OnBackwardLogOut -= OnBackwardLogOut;
+ OnBackwardConnect -= OnBackwardConnect;
+ OnBackwardDisconnect -= OnBackwardDisconnect;
+ OnBackwardDataCallBack -= OnBackwardDataCallBack;
+ }
+ }
+}
diff --git a/NoSugarNet.ClientCore.Standard2/NoSugarNet.Adapter/DataHelper/CompressAdapter.cs b/NoSugarNet.ClientCore.Standard2/NoSugarNet.Adapter/DataHelper/CompressAdapter.cs
new file mode 100644
index 0000000..2bce95e
--- /dev/null
+++ b/NoSugarNet.ClientCore.Standard2/NoSugarNet.Adapter/DataHelper/CompressAdapter.cs
@@ -0,0 +1,94 @@
+using System.IO;
+using System.IO.Compression;
+
+namespace NoSugarNet.Adapter.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
+ {
+ byte[] Compress(byte[] data);
+ 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.ClientCore.Standard2/NoSugarNet.Adapter/DataHelper/CompressAdapterSelector.cs b/NoSugarNet.ClientCore.Standard2/NoSugarNet.Adapter/DataHelper/CompressAdapterSelector.cs
new file mode 100644
index 0000000..8699761
--- /dev/null
+++ b/NoSugarNet.ClientCore.Standard2/NoSugarNet.Adapter/DataHelper/CompressAdapterSelector.cs
@@ -0,0 +1,19 @@
+using NoSugarNet.Adapter.DataHelper;
+using System.Collections.Generic;
+
+namespace NoSugarNet.Adapter.DataHelper
+{
+ public static class CompressAdapterSelector
+ {
+ static Dictionary mDictAdapter = new Dictionary();
+
+ public static CompressAdapter Adapter(E_CompressAdapter adptType)
+ {
+ if(mDictAdapter.ContainsKey(adptType))
+ return mDictAdapter[adptType];
+
+ mDictAdapter[adptType] = new CompressAdapter(adptType);
+ return mDictAdapter[adptType];
+ }
+ }
+}
\ No newline at end of file
diff --git a/NoSugarNet.ClientCore.Standard2/NoSugarNet.Adapter/ForwardLocalListener.cs b/NoSugarNet.ClientCore.Standard2/NoSugarNet.Adapter/ForwardLocalListener.cs
new file mode 100644
index 0000000..030cd70
--- /dev/null
+++ b/NoSugarNet.ClientCore.Standard2/NoSugarNet.Adapter/ForwardLocalListener.cs
@@ -0,0 +1,347 @@
+using HaoYueNet.ServerNetwork.Standard2;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Sockets;
+
+namespace NoSugarNet.Adapter
+{
+ public class ForwardLocalListener : TcpSaeaServer_SourceMode
+ {
+ public byte mTunnelID;
+ public long mReciveAllLenght;
+ public long mSendAllLenght;
+ public long currSeed;
+ public long mUid;
+ static long Seed;
+
+ public enum AdptLogLevel
+ {
+ Debug,
+ Info,
+ Warning,
+ Error
+ }
+
+ public delegate void OnLogOutHandler(int LogLevel,string Msg);
+ public delegate void OnClientLocalConnectHandler(long UID, byte tunnelId, byte _Idx);
+ public delegate void OnClientLocalDisconnectHandler(long UID, byte tunnelId, byte _Idx);
+ public delegate void OnClientTunnelDataCallBackHandler(long UID, byte tunnelId, byte Idx, byte[] data);
+
+ public event OnLogOutHandler OnForwardLogOut;
+ public event OnClientLocalConnectHandler OnClientLocalConnect;
+ public event OnClientLocalDisconnectHandler OnClientLocalDisconnect;
+ public event OnClientTunnelDataCallBackHandler OnClientTunnelDataCallBack;
+
+ public ForwardLocalListener(int numConnections, int receiveBufferSize, byte TunnelID, long mUid)
+ : base(numConnections, receiveBufferSize)
+ {
+ OnClientNumberChange += ClientNumberChange;
+ OnReceive += ReceiveData;
+ OnDisconnected += OnDisconnect;
+ OnNetLog += OnShowNetLog;
+
+ mTunnelID = TunnelID;
+
+ currSeed = Seed++;
+ this.mUid = mUid;
+ }
+
+
+
+ public event OnLogOutHandler OnForwardLogOut2;
+
+ public void BandEvent(
+ OnLogOutHandler _OnLogOut,
+ OnClientLocalConnectHandler _OnClientLocalConnect,
+ OnClientLocalDisconnectHandler _OnClientLocalDisconnect,
+ OnClientTunnelDataCallBackHandler _ClientTunnelDataCall
+ )
+ {
+ OnForwardLogOut += _OnLogOut;
+ OnClientLocalConnect += _OnClientLocalConnect;
+ OnClientLocalDisconnect += _OnClientLocalDisconnect;
+ OnClientTunnelDataCallBack += _ClientTunnelDataCall;
+ }
+
+ public void StartListener(uint port)
+ {
+ Init();
+ Start(new IPEndPoint(IPAddress.Any.Address, (int)port));
+ }
+
+ private void ClientNumberChange(int num, AsyncUserToken token)
+ {
+ OnForwardLogOut?.Invoke((int)AdptLogLevel.Info, "Client数发生变化");
+ //增加连接数stsc
+ if (num > 0)
+ {
+ int Idx = AddDictSocket(token.Socket);
+ if (GetSocketByIdx(Idx, out LocalClientInfo _localClientInf))
+ {
+ OnClientLocalConnect?.Invoke(mUid, mTunnelID, (byte)Idx);
+ }
+ }
+ }
+
+ ///
+ /// 通过下标发送
+ ///
+ ///
+ ///
+ public void SendSocketByIdx(int Idx, byte[] data)
+ {
+ if (GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
+ {
+ mSendAllLenght += data.Length;
+ SendToSocket(_localClientInfo._socket, data);
+ }
+ //TODO连接前缓存数据
+ }
+
+ ///
+ /// 接受包回调
+ ///
+ /// 协议ID
+ /// 错误编号
+ /// 业务数据
+ private void ReceiveData(AsyncUserToken token, byte[] data)
+ {
+ DataCallBack(token.Socket, data);
+ }
+
+ public void DataCallBack(Socket sk, byte[] data)
+ {
+ //AppNoSugarNet.log.Info("收到消息 数据长度=>" + data.Length);
+ //记录接受长度
+ mReciveAllLenght += data.Length;
+ if (!GetSocketIdxBySocket(sk, out int Idx))
+ return;
+ try
+ {
+ //抛出网络数据
+ OnClientTunnelDataCallBack?.Invoke(mUid, mTunnelID, (byte)Idx, data);
+ }
+ catch (Exception ex)
+ {
+ OnForwardLogOut?.Invoke((int)AdptLogLevel.Error,"逻辑处理错误:" + ex.ToString());
+ }
+ }
+
+ public void CloseConnectByIdx(byte Idx)
+ {
+ if (GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
+ {
+ //把未发送消息队列回收了
+ while (_localClientInfo.msgQueue.Count > 0)
+ {
+ IdxWithMsg msg = _localClientInfo.msgQueue.Dequeue();
+ MsgQueuePool._MsgPool.Enqueue(msg);
+ }
+
+ _localClientInfo._socket.Shutdown(SocketShutdown.Both);
+ }
+ }
+
+ ///
+ /// 断开连接
+ ///
+ ///
+ public void OnDisconnect(AsyncUserToken token)
+ {
+ OnForwardLogOut?.Invoke((int)AdptLogLevel.Info,"断开连接");
+
+ if (!GetSocketIdxBySocket(token.Socket, out int Idx))
+ return;
+
+ OnClientLocalDisconnect?.Invoke(mUid, mTunnelID, (byte)Idx);
+ RemoveDictSocket(token.Socket);
+ }
+
+ public void OnShowNetLog(string msg)
+ {
+ OnForwardLogOut?.Invoke((int)AdptLogLevel.Info, msg);
+ }
+
+ #region 一个轻量级无用户连接管理
+ Dictionary DictSocketHandle2Idx = new Dictionary();
+ Dictionary DictIdx2LocalClientInfo = new Dictionary();
+ int mSeedIdx = 0;
+ List FreeIdxs = new List();
+ public class LocalClientInfo
+ {
+ public Socket _socket;
+ public bool bRemoteConnect;
+ public bool bLocalConnect => _socket.Connected;
+ public Queue msgQueue = new Queue();
+ }
+
+ public Dictionary GetDictIdx2LocalClientInfo()
+ {
+ return DictIdx2LocalClientInfo;
+ }
+
+ int GetNextIdx()
+ {
+ if (FreeIdxs.Count > 0)
+ {
+ int Idx = FreeIdxs[0];
+ FreeIdxs.RemoveAt(0);
+ return Idx;
+ }
+ return mSeedIdx++;
+ }
+
+ void ResetFree()
+ {
+ FreeIdxs.Clear();
+ mSeedIdx = 0;
+ }
+
+ ///
+ /// 追加Socket返回下标
+ ///
+ ///
+ ///
+ public int AddDictSocket(Socket socket)
+ {
+ if (socket == null)
+ return -1;
+ lock (DictSocketHandle2Idx)
+ {
+ int Idx = GetNextIdx();
+ DictSocketHandle2Idx[socket.Handle] = Idx;
+ DictIdx2LocalClientInfo[Idx] = new LocalClientInfo() { _socket = socket,bRemoteConnect = false};
+ OnForwardLogOut?.Invoke((int)AdptLogLevel.Debug, $"AddDictSocket mTunnelID->{mTunnelID} Idx->{Idx} socket.Handle{socket.Handle}");
+ return Idx;
+ }
+ }
+
+ public void RemoveDictSocket(Socket socket)
+ {
+ if (socket == null)
+ return;
+ lock (DictSocketHandle2Idx)
+ {
+ if (!DictSocketHandle2Idx.ContainsKey(socket.Handle))
+ return;
+ int Idx = DictSocketHandle2Idx[socket.Handle];
+ FreeIdxs.Add(Idx);
+ if (DictIdx2LocalClientInfo.ContainsKey(Idx))
+ DictIdx2LocalClientInfo.Remove(Idx);
+ DictSocketHandle2Idx.Remove(socket.Handle);
+ OnForwardLogOut?.Invoke((int)AdptLogLevel.Debug, $"RemoveDictSocket mTunnelID->{mTunnelID} Idx->{Idx} socket.Handle{socket.Handle}");
+ }
+ }
+
+ bool GetSocketByIdx(int Idx, out LocalClientInfo _localClientInfo)
+ {
+ if (!DictIdx2LocalClientInfo.ContainsKey(Idx))
+ {
+ _localClientInfo = null;
+ return false;
+ }
+
+ _localClientInfo = DictIdx2LocalClientInfo[Idx];
+ return true;
+ }
+
+ public bool GetSocketIdxBySocket(Socket _socket, out int Idx)
+ {
+ if (_socket == null)
+ {
+ Idx = -1;
+ return false;
+ }
+
+ if (!DictSocketHandle2Idx.ContainsKey(_socket.Handle))
+ {
+ Idx = -1;
+ return false;
+ }
+
+ Idx = DictSocketHandle2Idx[_socket.Handle];
+ return true;
+ }
+
+ public bool CheckRemoteConnect(int Idx)
+ {
+ if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
+ return false;
+ return _localClientInfo.bRemoteConnect;
+ }
+
+ public void SetRemoteConnectd(int Idx,bool bConnected)
+ {
+ if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
+ return;
+ if (bConnected)
+ OnForwardLogOut?.Invoke((int)AdptLogLevel.Info,"远端本地连接已连接!!!!");
+ else
+ OnForwardLogOut?.Invoke((int)AdptLogLevel.Info, "远端本地连接已断开连接!!!!");
+ _localClientInfo.bRemoteConnect = bConnected;
+ }
+
+ public void StopAllLocalClient()
+ {
+ lock (DictIdx2LocalClientInfo)
+ {
+ int[] Idxs = DictIdx2LocalClientInfo.Keys.ToArray();
+ for (int i = 0; i < Idxs.Length; i++)
+ {
+ CloseConnectByIdx((byte)Idxs[i]);
+ }
+ DictIdx2LocalClientInfo.Clear();
+ DictSocketHandle2Idx.Clear();
+ ResetFree();
+ }
+ }
+
+ public void StopWithClear()
+ {
+ base.Stop();
+ //清理事件
+ OnForwardLogOut -= OnForwardLogOut;
+ OnClientLocalConnect -= OnClientLocalConnect;
+ OnClientLocalDisconnect -= OnClientLocalDisconnect;
+ OnClientTunnelDataCallBack -= OnClientTunnelDataCallBack;
+ }
+
+ #endregion
+
+
+ #region 缓存
+ public void EnqueueIdxWithMsg(byte Idx, byte[] data)
+ {
+ if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
+ return;
+
+ IdxWithMsg Msg = MsgQueuePool._MsgPool.Dequeue();
+ Msg.Idx = Idx;
+ Msg.data = data;
+ _localClientInfo.msgQueue.Enqueue(Msg);
+ }
+ public bool GetDictMsgQueue(byte Idx,out List MsgList)
+ {
+ if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo) || _localClientInfo.msgQueue.Count < 1)
+ {
+ MsgList = null;
+ return false;
+ }
+
+ MsgList = new List();
+ lock (_localClientInfo.msgQueue)
+ {
+ while (_localClientInfo.msgQueue.Count > 0)
+ {
+ IdxWithMsg msg = _localClientInfo.msgQueue.Dequeue();
+ MsgList.Add(msg);
+ }
+ return true;
+ }
+ }
+ #endregion
+ }
+
+}
diff --git a/NoSugarNet.ClientCore.Standard2/NoSugarNet.Adapter/LocalMsgQueuePool.cs b/NoSugarNet.ClientCore.Standard2/NoSugarNet.Adapter/LocalMsgQueuePool.cs
new file mode 100644
index 0000000..c33616c
--- /dev/null
+++ b/NoSugarNet.ClientCore.Standard2/NoSugarNet.Adapter/LocalMsgQueuePool.cs
@@ -0,0 +1,57 @@
+using System.Collections.Generic;
+
+namespace NoSugarNet.Adapter
+{
+ public class IdxWithMsg
+ {
+ public byte Idx;
+ public byte[] data;
+ }
+
+ public class MsgQueuePool
+ {
+ public static MsgQueuePool _MsgPool = new MsgQueuePool(1000);
+
+ Queue msg_pool;
+
+ public MsgQueuePool(int capacity)
+ {
+ msg_pool = new Queue(capacity);
+ }
+
+ ///
+ /// 向 Queue 的末尾添加一个对象。
+ ///
+ ///
+ public void Enqueue(IdxWithMsg item)
+ {
+ lock (msg_pool)
+ {
+ item.Idx = 0;
+ item.data = null;
+ msg_pool.Enqueue(item);
+ }
+ }
+
+ //移除并返回在 Queue 的开头的对象。
+ public IdxWithMsg Dequeue()
+ {
+ lock (msg_pool)
+ {
+ if(msg_pool.Count > 0)
+ return msg_pool.Dequeue();
+ return new IdxWithMsg();
+ }
+ }
+
+ public int Count
+ {
+ get { return msg_pool.Count; }
+ }
+
+ public void Clear()
+ {
+ msg_pool.Clear();
+ }
+ }
+}
diff --git a/NoSugarNet.ClientCore.Standard2/NoSugarNet.ClientCore.Standard2.csproj b/NoSugarNet.ClientCore.Standard2/NoSugarNet.ClientCore.Standard2.csproj
index 59561e8..68f335e 100644
--- a/NoSugarNet.ClientCore.Standard2/NoSugarNet.ClientCore.Standard2.csproj
+++ b/NoSugarNet.ClientCore.Standard2/NoSugarNet.ClientCore.Standard2.csproj
@@ -13,8 +13,8 @@
..\Lib\Google.Protobuf.dll
-
- ..\Lib\NetLib_Standard2\HaoYueNet.ClientNetworkNet.Standard2.dll
+
+ ..\Lib\NetLib_Standard2\HaoYueNet.ClientNetwork.Standard2.dll
..\Lib\NetLib_Standard2\HaoYueNet.ServerNetwork.Standard2.dll
diff --git a/NoSugarNet.ClientCore.Standard2/Properties/PublishProfiles/FolderProfile.pubxml.user b/NoSugarNet.ClientCore.Standard2/Properties/PublishProfiles/FolderProfile.pubxml.user
index 040aa3b..a77223e 100644
--- a/NoSugarNet.ClientCore.Standard2/Properties/PublishProfiles/FolderProfile.pubxml.user
+++ b/NoSugarNet.ClientCore.Standard2/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
- True|2024-04-15T06:51:39.2435225Z;True|2024-04-15T14:51:19.4250865+08:00;True|2024-04-15T14:49:22.9829361+08:00;
+ True|2024-10-18T08:27:43.7757014Z||;True|2024-10-18T16:15:48.7317736+08:00||;True|2024-10-18T15:37:40.8031046+08:00||;True|2024-10-18T15:36:28.8043094+08:00||;True|2024-04-15T14:51:39.2435225+08:00||;True|2024-04-15T14:51:19.4250865+08:00||;True|2024-04-15T14:49:22.9829361+08:00||;
\ No newline at end of file
diff --git a/NoSugarNet.ClientCore.Standard2/Protobuf/ProtobufNoSugar.cs b/NoSugarNet.ClientCore.Standard2/Protobuf/ProtobufNoSugar.cs
index dce38be..dd89e45 100644
--- a/NoSugarNet.ClientCore.Standard2/Protobuf/ProtobufNoSugar.cs
+++ b/NoSugarNet.ClientCore.Standard2/Protobuf/ProtobufNoSugar.cs
@@ -28,51 +28,51 @@ namespace AxibugProtobuf {
"UHJvdG9idWZfTG9naW4SLAoJbG9naW5UeXBlGAEgASgOMhkuQXhpYnVnUHJv",
"dG9idWYuTG9naW5UeXBlEi4KCmRldmljZVR5cGUYAiABKA4yGi5BeGlidWdQ",
"cm90b2J1Zi5EZXZpY2VUeXBlEg8KB0FjY291bnQYAyABKAkSEAoIUGFzc3dv",
- "cmQYBCABKAkifwoTUHJvdG9idWZfTG9naW5fUkVTUBINCgVUb2tlbhgBIAEo",
- "CRIVCg1MYXN0TG9naW5EYXRlGAIgASgJEg8KB1JlZ0RhdGUYAyABKAkSMQoG",
- "U3RhdHVzGAQgASgOMiEuQXhpYnVnUHJvdG9idWYuTG9naW5SZXN1bHRTdGF0",
- "dXMiYAoNUHJvdG9idWZfQ2ZncxIbChNDb21wcmVzc0FkYXB0ZXJUeXBlGAEg",
- "ASgFEjIKBGNmZ3MYAiADKAsyJC5BeGlidWdQcm90b2J1Zi5Qcm90b2J1Zl9D",
- "ZmdzX1NpbmdsZSI2ChRQcm90b2J1Zl9DZmdzX1NpbmdsZRIQCghUdW5uZWxJ",
- "RBgBIAEoDRIMCgRQb3J0GAIgASgFIiMKEFByb3RvYnVmX0NoYXRNc2cSDwoH",
- "Q2hhdE1zZxgBIAEoCSJIChVQcm90b2J1Zl9DaGF0TXNnX1JFU1ASEAoITmlj",
- "a05hbWUYASABKAkSDwoHQ2hhdE1zZxgCIAEoCRIMCgREYXRlGAMgASgDIjUK",
- "FFByb3RvYnVmX0MyU19Db25uZWN0EhAKCFR1bm5lbElEGAEgASgNEgsKA0lk",
- "eBgCIAEoDSJIChRQcm90b2J1Zl9TMkNfQ29ubmVjdBIQCghUdW5uZWxJRBgB",
- "IAEoDRILCgNJZHgYAiABKA0SEQoJQ29ubmVjdGVkGAMgASgNIjgKF1Byb3Rv",
- "YnVmX0MyU19EaXNjb25uZWN0EhAKCFR1bm5lbElEGAEgASgNEgsKA0lkeBgC",
- "IAEoDSI4ChdQcm90b2J1Zl9TMkNfRGlzY29ubmVjdBIQCghUdW5uZWxJRBgB",
- "IAEoDRILCgNJZHgYAiABKA0iTgoRUHJvdG9idWZfQzJTX0RBVEESEAoIVHVu",
+ "cmQYBCABKAkijAEKE1Byb3RvYnVmX0xvZ2luX1JFU1ASDQoFVG9rZW4YASAB",
+ "KAkSFQoNTGFzdExvZ2luRGF0ZRgCIAEoCRIPCgdSZWdEYXRlGAMgASgJEjEK",
+ "BlN0YXR1cxgEIAEoDjIhLkF4aWJ1Z1Byb3RvYnVmLkxvZ2luUmVzdWx0U3Rh",
+ "dHVzEgsKA1VJRBgFIAEoAyJgCg1Qcm90b2J1Zl9DZmdzEhsKE0NvbXByZXNz",
+ "QWRhcHRlclR5cGUYASABKAUSMgoEY2ZncxgCIAMoCzIkLkF4aWJ1Z1Byb3Rv",
+ "YnVmLlByb3RvYnVmX0NmZ3NfU2luZ2xlIjYKFFByb3RvYnVmX0NmZ3NfU2lu",
+ "Z2xlEhAKCFR1bm5lbElEGAEgASgNEgwKBFBvcnQYAiABKAUiIwoQUHJvdG9i",
+ "dWZfQ2hhdE1zZxIPCgdDaGF0TXNnGAEgASgJIkgKFVByb3RvYnVmX0NoYXRN",
+ "c2dfUkVTUBIQCghOaWNrTmFtZRgBIAEoCRIPCgdDaGF0TXNnGAIgASgJEgwK",
+ "BERhdGUYAyABKAMiSwoXUHJvdG9idWZfVHVubmVsX0Nvbm5lY3QSEAoIVHVu",
+ "bmVsSUQYASABKA0SCwoDSWR4GAIgASgNEhEKCUNvbm5lY3RlZBgDIAEoDSI7",
+ "ChpQcm90b2J1Zl9UdW5uZWxfRGlzY29ubmVjdBIQCghUdW5uZWxJRBgBIAEo",
+ "DRILCgNJZHgYAiABKA0iUQoUUHJvdG9idWZfVHVubmVsX0RBVEESEAoIVHVu",
"bmVsSUQYASABKA0SCwoDSWR4GAIgASgNEhoKEkh1bnRlck5ldENvcmVfRGF0",
- "YRgDIAEoDCJOChFQcm90b2J1Zl9TMkNfREFUQRIQCghUdW5uZWxJRBgBIAEo",
- "DRILCgNJZHgYAiABKA0SGgoSSHVudGVyTmV0Q29yZV9EYXRhGAMgASgMKvoB",
- "CglDb21tYW5kSUQSDgoKQ01EX0RFRkFVTBAAEg4KCUNNRF9MT0dJThDRDxIN",
- "CghDTURfQ0ZHUxC5FxIQCgtDTURfQ0hBVE1TRxChHxIbChZDTURfVFVOTkVM",
- "X0MyU19DT05ORUNUEIgnEhsKFkNNRF9UVU5ORUxfUzJDX0NPTk5FQ1QQiScS",
- "HgoZQ01EX1RVTk5FTF9DMlNfRElTQ09OTkVDVBCKJxIeChlDTURfVFVOTkVM",
- "X1MyQ19ESVNDT05ORUNUEIsnEhgKE0NNRF9UVU5ORUxfQzJTX0RBVEEQjCcS",
- "GAoTQ01EX1RVTk5FTF9TMkNfREFUQRCNJyorCglFcnJvckNvZGUSEAoMRVJS",
- "T1JfREVGQVVMEAASDAoIRVJST1JfT0sQASo+CglMb2dpblR5cGUSDwoLQmFz",
- "ZURlZmF1bHQQABIOCgpIYW9ZdWVBdXRoEAESBwoDQkYzEAMSBwoDQkY0EAQq",
- "SwoKRGV2aWNlVHlwZRIWChJEZXZpY2VUeXBlX0RlZmF1bHQQABIGCgJQQxAB",
- "EgsKB0FuZHJvaWQQAhIHCgNJT1MQAxIHCgNQU1YQBCpOChFMb2dpblJlc3Vs",
- "dFN0YXR1cxIhCh1Mb2dpblJlc3VsdFN0YXR1c19CYXNlRGVmYXVsdBAAEgYK",
- "Ak9LEAESDgoKQWNjb3VudEVychACQgJIAWIGcHJvdG8z"));
+ "YRgDIAEoDCqlBAoJQ29tbWFuZElEEg4KCkNNRF9ERUZBVUwQABIOCglDTURf",
+ "TE9HSU4Q0Q8SFAoPQ01EX1NFUlZFUl9DRkdTELkXEhQKD0NNRF9DTElFTlRf",
+ "Q0ZHUxC6FxIQCgtDTURfQ0hBVE1TRxChHxIjCh5DTURfVFVOTkVMX0MyU19G",
+ "T1JXQVJEX0NPTk5FQ1QQiCcSIwoeQ01EX1RVTk5FTF9TMkNfRk9SV0FSRF9D",
+ "T05ORUNUEIknEiYKIUNNRF9UVU5ORUxfQzJTX0ZPUldBUkRfRElTQ09OTkVD",
+ "VBCKJxImCiFDTURfVFVOTkVMX1MyQ19GT1JXQVJEX0RJU0NPTk5FQ1QQiycS",
+ "IAobQ01EX1RVTk5FTF9DMlNfRk9SV0FSRF9EQVRBEIwnEiAKG0NNRF9UVU5O",
+ "RUxfUzJDX0ZPUldBUkRfREFUQRCNJxIjCh5DTURfVFVOTkVMX0MyU19SRVZF",
+ "UlNFX0NPTk5FQ1QQ8C4SIwoeQ01EX1RVTk5FTF9TMkNfUkVWRVJTRV9DT05O",
+ "RUNUEPEuEiYKIUNNRF9UVU5ORUxfQzJTX1JFVkVSU0VfRElTQ09OTkVDVBDy",
+ "LhImCiFDTURfVFVOTkVMX1MyQ19SRVZFUlNFX0RJU0NPTk5FQ1QQ8y4SIAob",
+ "Q01EX1RVTk5FTF9DMlNfUkVWRVJTRV9EQVRBEPQuEiAKG0NNRF9UVU5ORUxf",
+ "UzJDX1JFVkVSU0VfREFUQRD1LiorCglFcnJvckNvZGUSEAoMRVJST1JfREVG",
+ "QVVMEAASDAoIRVJST1JfT0sQASo+CglMb2dpblR5cGUSDwoLQmFzZURlZmF1",
+ "bHQQABIOCgpIYW9ZdWVBdXRoEAESBwoDQkYzEAMSBwoDQkY0EAQqSwoKRGV2",
+ "aWNlVHlwZRIWChJEZXZpY2VUeXBlX0RlZmF1bHQQABIGCgJQQxABEgsKB0Fu",
+ "ZHJvaWQQAhIHCgNJT1MQAxIHCgNQU1YQBCpOChFMb2dpblJlc3VsdFN0YXR1",
+ "cxIhCh1Mb2dpblJlc3VsdFN0YXR1c19CYXNlRGVmYXVsdBAAEgYKAk9LEAES",
+ "DgoKQWNjb3VudEVychACQgJIAWIGcHJvdG8z"));
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_Login_RESP), global::AxibugProtobuf.Protobuf_Login_RESP.Parser, new[]{ "Token", "LastLoginDate", "RegDate", "Status", "UID" }, 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),
- new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_C2S_Connect), global::AxibugProtobuf.Protobuf_C2S_Connect.Parser, new[]{ "TunnelID", "Idx" }, null, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_S2C_Connect), global::AxibugProtobuf.Protobuf_S2C_Connect.Parser, new[]{ "TunnelID", "Idx", "Connected" }, null, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_C2S_Disconnect), global::AxibugProtobuf.Protobuf_C2S_Disconnect.Parser, new[]{ "TunnelID", "Idx" }, null, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_S2C_Disconnect), global::AxibugProtobuf.Protobuf_S2C_Disconnect.Parser, new[]{ "TunnelID", "Idx" }, null, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_C2S_DATA), global::AxibugProtobuf.Protobuf_C2S_DATA.Parser, new[]{ "TunnelID", "Idx", "HunterNetCoreData" }, null, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_S2C_DATA), global::AxibugProtobuf.Protobuf_S2C_DATA.Parser, new[]{ "TunnelID", "Idx", "HunterNetCoreData" }, null, null, null, null)
+ new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Tunnel_Connect), global::AxibugProtobuf.Protobuf_Tunnel_Connect.Parser, new[]{ "TunnelID", "Idx", "Connected" }, null, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Tunnel_Disconnect), global::AxibugProtobuf.Protobuf_Tunnel_Disconnect.Parser, new[]{ "TunnelID", "Idx" }, null, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Tunnel_DATA), global::AxibugProtobuf.Protobuf_Tunnel_DATA.Parser, new[]{ "TunnelID", "Idx", "HunterNetCoreData" }, null, null, null, null)
}));
}
#endregion
@@ -91,35 +91,63 @@ namespace AxibugProtobuf {
///
///配置信息 下行 对应 Protobuf_Cfgs
///
- [pbr::OriginalName("CMD_CFGS")] CmdCfgs = 3001,
+ [pbr::OriginalName("CMD_SERVER_CFGS")] CmdServerCfgs = 3001,
+ ///
+ ///配置信息 上行 对应 Protobuf_Cfgs
+ ///
+ [pbr::OriginalName("CMD_CLIENT_CFGS")] CmdClientCfgs = 3002,
///
///广播信息上行 | 下行 对应 Protobuf_ChatMsg | Protobuf_ChatMsg_RESP
///
[pbr::OriginalName("CMD_CHATMSG")] CmdChatmsg = 4001,
///
- ///客户端告知服务端 客户端本地连接建立 上行 Protobuf_C2S_Connect
+ ///正向代理,客户端告知服务端 客户端本地连接建立 上行 Protobuf_Tunnel_Connect
///
- [pbr::OriginalName("CMD_TUNNEL_C2S_CONNECT")] CmdTunnelC2SConnect = 5000,
+ [pbr::OriginalName("CMD_TUNNEL_C2S_FORWARD_CONNECT")] CmdTunnelC2SForwardConnect = 5000,
///
- ///服务端告知客户端 服务端本地连接建立 下行 Protobuf_S2C_Connect
+ ///正向代理,服务端告知客户端 服务端本地连接建立 下行 Protobuf_Tunnel_Connect
///
- [pbr::OriginalName("CMD_TUNNEL_S2C_CONNECT")] CmdTunnelS2CConnect = 5001,
+ [pbr::OriginalName("CMD_TUNNEL_S2C_FORWARD_CONNECT")] CmdTunnelS2CForwardConnect = 5001,
///
- ///客户端告知服务端 客户端本地连接断开 上行 Protobuf_C2S_Disconnect
+ ///正向代理,客户端告知服务端 客户端本地连接断开 上行 Protobuf_Tunnel_Disconnect
///
- [pbr::OriginalName("CMD_TUNNEL_C2S_DISCONNECT")] CmdTunnelC2SDisconnect = 5002,
+ [pbr::OriginalName("CMD_TUNNEL_C2S_FORWARD_DISCONNECT")] CmdTunnelC2SForwardDisconnect = 5002,
///
- ///服务端告知客户端 服务端本地连接断开 下行 Protobuf_S2C_Disconnect
+ ///正向代理,服务端告知客户端 服务端本地连接断开 下行 Protobuf_Tunnel_Disconnect
///
- [pbr::OriginalName("CMD_TUNNEL_S2C_DISCONNECT")] CmdTunnelS2CDisconnect = 5003,
+ [pbr::OriginalName("CMD_TUNNEL_S2C_FORWARD_DISCONNECT")] CmdTunnelS2CForwardDisconnect = 5003,
///
- ///客户端投递本地TCP通讯数据包 上行 Protobuf_C2S_DATA
+ ///正向代理,客户端投递本地TCP通讯数据包 上行 Protobuf_Tunnel_DATA
///
- [pbr::OriginalName("CMD_TUNNEL_C2S_DATA")] CmdTunnelC2SData = 5004,
+ [pbr::OriginalName("CMD_TUNNEL_C2S_FORWARD_DATA")] CmdTunnelC2SForwardData = 5004,
///
- ///服务端投递本地TCP通讯数据包 下行 Protobuf_S2C_DATA
+ ///正向代理,服务端投递本地TCP通讯数据包 下行 Protobuf_Tunnel_DATA
///
- [pbr::OriginalName("CMD_TUNNEL_S2C_DATA")] CmdTunnelS2CData = 5005,
+ [pbr::OriginalName("CMD_TUNNEL_S2C_FORWARD_DATA")] CmdTunnelS2CForwardData = 5005,
+ ///
+ ///反向代理,客户端告知服务端 客户端本地连接建立 上行 Protobuf_Tunnel_Connect
+ ///
+ [pbr::OriginalName("CMD_TUNNEL_C2S_REVERSE_CONNECT")] CmdTunnelC2SReverseConnect = 6000,
+ ///
+ ///反向代理,服务端告知客户端 服务端本地连接建立 下行 Protobuf_Tunnel_Connect
+ ///
+ [pbr::OriginalName("CMD_TUNNEL_S2C_REVERSE_CONNECT")] CmdTunnelS2CReverseConnect = 6001,
+ ///
+ ///反向代理,客户端告知服务端 客户端本地连接断开 上行 Protobuf_Tunnel_Disconnect
+ ///
+ [pbr::OriginalName("CMD_TUNNEL_C2S_REVERSE_DISCONNECT")] CmdTunnelC2SReverseDisconnect = 6002,
+ ///
+ ///反向代理,服务端告知客户端 服务端本地连接断开 下行 Protobuf_Tunnel_Disconnect
+ ///
+ [pbr::OriginalName("CMD_TUNNEL_S2C_REVERSE_DISCONNECT")] CmdTunnelS2CReverseDisconnect = 6003,
+ ///
+ ///反向代理,客户端投递本地TCP通讯数据包 上行 Protobuf_Tunnel_DATA
+ ///
+ [pbr::OriginalName("CMD_TUNNEL_C2S_REVERSE_DATA")] CmdTunnelC2SReverseData = 6004,
+ ///
+ ///反向代理,服务端投递本地TCP通讯数据包 下行 Protobuf_Tunnel_DATA
+ ///
+ [pbr::OriginalName("CMD_TUNNEL_S2C_REVERSE_DATA")] CmdTunnelS2CReverseData = 6005,
}
public enum ErrorCode {
@@ -497,6 +525,7 @@ namespace AxibugProtobuf {
lastLoginDate_ = other.lastLoginDate_;
regDate_ = other.regDate_;
status_ = other.status_;
+ uID_ = other.uID_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
@@ -561,6 +590,17 @@ namespace AxibugProtobuf {
}
}
+ /// Field number for the "UID" field.
+ public const int UIDFieldNumber = 5;
+ private long uID_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public long UID {
+ get { return uID_; }
+ set {
+ uID_ = value;
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Protobuf_Login_RESP);
@@ -578,6 +618,7 @@ namespace AxibugProtobuf {
if (LastLoginDate != other.LastLoginDate) return false;
if (RegDate != other.RegDate) return false;
if (Status != other.Status) return false;
+ if (UID != other.UID) return false;
return Equals(_unknownFields, other._unknownFields);
}
@@ -588,6 +629,7 @@ namespace AxibugProtobuf {
if (LastLoginDate.Length != 0) hash ^= LastLoginDate.GetHashCode();
if (RegDate.Length != 0) hash ^= RegDate.GetHashCode();
if (Status != global::AxibugProtobuf.LoginResultStatus.BaseDefault) hash ^= Status.GetHashCode();
+ if (UID != 0L) hash ^= UID.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
@@ -620,6 +662,10 @@ namespace AxibugProtobuf {
output.WriteRawTag(32);
output.WriteEnum((int) Status);
}
+ if (UID != 0L) {
+ output.WriteRawTag(40);
+ output.WriteInt64(UID);
+ }
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
@@ -645,6 +691,10 @@ namespace AxibugProtobuf {
output.WriteRawTag(32);
output.WriteEnum((int) Status);
}
+ if (UID != 0L) {
+ output.WriteRawTag(40);
+ output.WriteInt64(UID);
+ }
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
@@ -666,6 +716,9 @@ namespace AxibugProtobuf {
if (Status != global::AxibugProtobuf.LoginResultStatus.BaseDefault) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Status);
}
+ if (UID != 0L) {
+ size += 1 + pb::CodedOutputStream.ComputeInt64Size(UID);
+ }
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
@@ -689,6 +742,9 @@ namespace AxibugProtobuf {
if (other.Status != global::AxibugProtobuf.LoginResultStatus.BaseDefault) {
Status = other.Status;
}
+ if (other.UID != 0L) {
+ UID = other.UID;
+ }
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
@@ -719,6 +775,10 @@ namespace AxibugProtobuf {
Status = (global::AxibugProtobuf.LoginResultStatus) input.ReadEnum();
break;
}
+ case 40: {
+ UID = input.ReadInt64();
+ break;
+ }
}
}
#endif
@@ -749,6 +809,10 @@ namespace AxibugProtobuf {
Status = (global::AxibugProtobuf.LoginResultStatus) input.ReadEnum();
break;
}
+ case 40: {
+ UID = input.ReadInt64();
+ break;
+ }
}
}
}
@@ -1610,15 +1674,15 @@ namespace AxibugProtobuf {
}
- public sealed partial class Protobuf_C2S_Connect : pb::IMessage
+ public sealed partial class Protobuf_Tunnel_Connect : pb::IMessage
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
- private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Protobuf_C2S_Connect());
+ private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Protobuf_Tunnel_Connect());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pb::MessageParser Parser { get { return _parser; } }
+ public static pb::MessageParser Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
@@ -1631,228 +1695,14 @@ namespace AxibugProtobuf {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Protobuf_C2S_Connect() {
+ public Protobuf_Tunnel_Connect() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Protobuf_C2S_Connect(Protobuf_C2S_Connect other) : this() {
- tunnelID_ = other.tunnelID_;
- idx_ = other.idx_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Protobuf_C2S_Connect Clone() {
- return new Protobuf_C2S_Connect(this);
- }
-
- /// Field number for the "TunnelID" field.
- public const int TunnelIDFieldNumber = 1;
- private uint tunnelID_;
- ///
- ///TunnelID
- ///
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public uint TunnelID {
- get { return tunnelID_; }
- set {
- tunnelID_ = value;
- }
- }
-
- /// Field number for the "Idx" field.
- public const int IdxFieldNumber = 2;
- private uint idx_;
- ///
- ///单个隧道连接下标
- ///
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public uint Idx {
- get { return idx_; }
- set {
- idx_ = value;
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override bool Equals(object other) {
- return Equals(other as Protobuf_C2S_Connect);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public bool Equals(Protobuf_C2S_Connect other) {
- if (ReferenceEquals(other, null)) {
- return false;
- }
- if (ReferenceEquals(other, this)) {
- return true;
- }
- if (TunnelID != other.TunnelID) return false;
- if (Idx != other.Idx) return false;
- return Equals(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override int GetHashCode() {
- int hash = 1;
- if (TunnelID != 0) hash ^= TunnelID.GetHashCode();
- if (Idx != 0) hash ^= Idx.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
- return hash;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override string ToString() {
- return pb::JsonFormatter.ToDiagnosticString(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void WriteTo(pb::CodedOutputStream output) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- output.WriteRawMessage(this);
- #else
- if (TunnelID != 0) {
- output.WriteRawTag(8);
- output.WriteUInt32(TunnelID);
- }
- if (Idx != 0) {
- output.WriteRawTag(16);
- output.WriteUInt32(Idx);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
- if (TunnelID != 0) {
- output.WriteRawTag(8);
- output.WriteUInt32(TunnelID);
- }
- if (Idx != 0) {
- output.WriteRawTag(16);
- output.WriteUInt32(Idx);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(ref output);
- }
- }
- #endif
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public int CalculateSize() {
- int size = 0;
- if (TunnelID != 0) {
- size += 1 + pb::CodedOutputStream.ComputeUInt32Size(TunnelID);
- }
- if (Idx != 0) {
- size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Idx);
- }
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
- return size;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(Protobuf_C2S_Connect other) {
- if (other == null) {
- return;
- }
- if (other.TunnelID != 0) {
- TunnelID = other.TunnelID;
- }
- if (other.Idx != 0) {
- Idx = other.Idx;
- }
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(pb::CodedInputStream input) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- input.ReadRawMessage(this);
- #else
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
- break;
- case 8: {
- TunnelID = input.ReadUInt32();
- break;
- }
- case 16: {
- Idx = input.ReadUInt32();
- break;
- }
- }
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
- break;
- case 8: {
- TunnelID = input.ReadUInt32();
- break;
- }
- case 16: {
- Idx = input.ReadUInt32();
- break;
- }
- }
- }
- }
- #endif
-
- }
-
- public sealed partial class Protobuf_S2C_Connect : pb::IMessage
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- , pb::IBufferMessage
- #endif
- {
- private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Protobuf_S2C_Connect());
- private pb::UnknownFieldSet _unknownFields;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pb::MessageParser Parser { get { return _parser; } }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pbr::MessageDescriptor Descriptor {
- get { return global::AxibugProtobuf.ProtobufNoSugarReflection.Descriptor.MessageTypes[7]; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- pbr::MessageDescriptor pb::IMessage.Descriptor {
- get { return Descriptor; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Protobuf_S2C_Connect() {
- OnConstruction();
- }
-
- partial void OnConstruction();
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Protobuf_S2C_Connect(Protobuf_S2C_Connect other) : this() {
+ public Protobuf_Tunnel_Connect(Protobuf_Tunnel_Connect other) : this() {
tunnelID_ = other.tunnelID_;
idx_ = other.idx_;
connected_ = other.connected_;
@@ -1860,8 +1710,8 @@ namespace AxibugProtobuf {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Protobuf_S2C_Connect Clone() {
- return new Protobuf_S2C_Connect(this);
+ public Protobuf_Tunnel_Connect Clone() {
+ return new Protobuf_Tunnel_Connect(this);
}
/// Field number for the "TunnelID" field.
@@ -1908,11 +1758,11 @@ namespace AxibugProtobuf {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
- return Equals(other as Protobuf_S2C_Connect);
+ return Equals(other as Protobuf_Tunnel_Connect);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public bool Equals(Protobuf_S2C_Connect other) {
+ public bool Equals(Protobuf_Tunnel_Connect other) {
if (ReferenceEquals(other, null)) {
return false;
}
@@ -2005,7 +1855,7 @@ namespace AxibugProtobuf {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(Protobuf_S2C_Connect other) {
+ public void MergeFrom(Protobuf_Tunnel_Connect other) {
if (other == null) {
return;
}
@@ -2077,15 +1927,229 @@ namespace AxibugProtobuf {
}
- public sealed partial class Protobuf_C2S_Disconnect : pb::IMessage
+ public sealed partial class Protobuf_Tunnel_Disconnect : pb::IMessage
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
- private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Protobuf_C2S_Disconnect());
+ private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Protobuf_Tunnel_Disconnect());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pb::MessageParser Parser { get { return _parser; } }
+ public static pb::MessageParser Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::AxibugProtobuf.ProtobufNoSugarReflection.Descriptor.MessageTypes[7]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public Protobuf_Tunnel_Disconnect() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public Protobuf_Tunnel_Disconnect(Protobuf_Tunnel_Disconnect other) : this() {
+ tunnelID_ = other.tunnelID_;
+ idx_ = other.idx_;
+ _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public Protobuf_Tunnel_Disconnect Clone() {
+ return new Protobuf_Tunnel_Disconnect(this);
+ }
+
+ /// Field number for the "TunnelID" field.
+ public const int TunnelIDFieldNumber = 1;
+ private uint tunnelID_;
+ ///
+ ///TunnelID
+ ///
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public uint TunnelID {
+ get { return tunnelID_; }
+ set {
+ tunnelID_ = value;
+ }
+ }
+
+ /// Field number for the "Idx" field.
+ public const int IdxFieldNumber = 2;
+ private uint idx_;
+ ///
+ ///单个隧道连接下标
+ ///
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public uint Idx {
+ get { return idx_; }
+ set {
+ idx_ = value;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as Protobuf_Tunnel_Disconnect);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(Protobuf_Tunnel_Disconnect other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (TunnelID != other.TunnelID) return false;
+ if (Idx != other.Idx) return false;
+ return Equals(_unknownFields, other._unknownFields);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (TunnelID != 0) hash ^= TunnelID.GetHashCode();
+ if (Idx != 0) hash ^= Idx.GetHashCode();
+ if (_unknownFields != null) {
+ hash ^= _unknownFields.GetHashCode();
+ }
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ output.WriteRawMessage(this);
+ #else
+ if (TunnelID != 0) {
+ output.WriteRawTag(8);
+ output.WriteUInt32(TunnelID);
+ }
+ if (Idx != 0) {
+ output.WriteRawTag(16);
+ output.WriteUInt32(Idx);
+ }
+ if (_unknownFields != null) {
+ _unknownFields.WriteTo(output);
+ }
+ #endif
+ }
+
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
+ if (TunnelID != 0) {
+ output.WriteRawTag(8);
+ output.WriteUInt32(TunnelID);
+ }
+ if (Idx != 0) {
+ output.WriteRawTag(16);
+ output.WriteUInt32(Idx);
+ }
+ if (_unknownFields != null) {
+ _unknownFields.WriteTo(ref output);
+ }
+ }
+ #endif
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (TunnelID != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeUInt32Size(TunnelID);
+ }
+ if (Idx != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Idx);
+ }
+ if (_unknownFields != null) {
+ size += _unknownFields.CalculateSize();
+ }
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(Protobuf_Tunnel_Disconnect other) {
+ if (other == null) {
+ return;
+ }
+ if (other.TunnelID != 0) {
+ TunnelID = other.TunnelID;
+ }
+ if (other.Idx != 0) {
+ Idx = other.Idx;
+ }
+ _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ input.ReadRawMessage(this);
+ #else
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+ break;
+ case 8: {
+ TunnelID = input.ReadUInt32();
+ break;
+ }
+ case 16: {
+ Idx = input.ReadUInt32();
+ break;
+ }
+ }
+ }
+ #endif
+ }
+
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
+ break;
+ case 8: {
+ TunnelID = input.ReadUInt32();
+ break;
+ }
+ case 16: {
+ Idx = input.ReadUInt32();
+ break;
+ }
+ }
+ }
+ }
+ #endif
+
+ }
+
+ public sealed partial class Protobuf_Tunnel_DATA : pb::IMessage
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
+ private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Protobuf_Tunnel_DATA());
+ private pb::UnknownFieldSet _unknownFields;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
@@ -2098,442 +2162,14 @@ namespace AxibugProtobuf {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Protobuf_C2S_Disconnect() {
+ public Protobuf_Tunnel_DATA() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Protobuf_C2S_Disconnect(Protobuf_C2S_Disconnect other) : this() {
- tunnelID_ = other.tunnelID_;
- idx_ = other.idx_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Protobuf_C2S_Disconnect Clone() {
- return new Protobuf_C2S_Disconnect(this);
- }
-
- /// Field number for the "TunnelID" field.
- public const int TunnelIDFieldNumber = 1;
- private uint tunnelID_;
- ///
- ///TunnelID
- ///
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public uint TunnelID {
- get { return tunnelID_; }
- set {
- tunnelID_ = value;
- }
- }
-
- /// Field number for the "Idx" field.
- public const int IdxFieldNumber = 2;
- private uint idx_;
- ///
- ///单个隧道连接下标
- ///
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public uint Idx {
- get { return idx_; }
- set {
- idx_ = value;
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override bool Equals(object other) {
- return Equals(other as Protobuf_C2S_Disconnect);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public bool Equals(Protobuf_C2S_Disconnect other) {
- if (ReferenceEquals(other, null)) {
- return false;
- }
- if (ReferenceEquals(other, this)) {
- return true;
- }
- if (TunnelID != other.TunnelID) return false;
- if (Idx != other.Idx) return false;
- return Equals(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override int GetHashCode() {
- int hash = 1;
- if (TunnelID != 0) hash ^= TunnelID.GetHashCode();
- if (Idx != 0) hash ^= Idx.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
- return hash;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override string ToString() {
- return pb::JsonFormatter.ToDiagnosticString(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void WriteTo(pb::CodedOutputStream output) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- output.WriteRawMessage(this);
- #else
- if (TunnelID != 0) {
- output.WriteRawTag(8);
- output.WriteUInt32(TunnelID);
- }
- if (Idx != 0) {
- output.WriteRawTag(16);
- output.WriteUInt32(Idx);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
- if (TunnelID != 0) {
- output.WriteRawTag(8);
- output.WriteUInt32(TunnelID);
- }
- if (Idx != 0) {
- output.WriteRawTag(16);
- output.WriteUInt32(Idx);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(ref output);
- }
- }
- #endif
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public int CalculateSize() {
- int size = 0;
- if (TunnelID != 0) {
- size += 1 + pb::CodedOutputStream.ComputeUInt32Size(TunnelID);
- }
- if (Idx != 0) {
- size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Idx);
- }
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
- return size;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(Protobuf_C2S_Disconnect other) {
- if (other == null) {
- return;
- }
- if (other.TunnelID != 0) {
- TunnelID = other.TunnelID;
- }
- if (other.Idx != 0) {
- Idx = other.Idx;
- }
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(pb::CodedInputStream input) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- input.ReadRawMessage(this);
- #else
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
- break;
- case 8: {
- TunnelID = input.ReadUInt32();
- break;
- }
- case 16: {
- Idx = input.ReadUInt32();
- break;
- }
- }
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
- break;
- case 8: {
- TunnelID = input.ReadUInt32();
- break;
- }
- case 16: {
- Idx = input.ReadUInt32();
- break;
- }
- }
- }
- }
- #endif
-
- }
-
- public sealed partial class Protobuf_S2C_Disconnect : pb::IMessage
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- , pb::IBufferMessage
- #endif
- {
- private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Protobuf_S2C_Disconnect());
- private pb::UnknownFieldSet _unknownFields;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pb::MessageParser Parser { get { return _parser; } }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pbr::MessageDescriptor Descriptor {
- get { return global::AxibugProtobuf.ProtobufNoSugarReflection.Descriptor.MessageTypes[9]; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- pbr::MessageDescriptor pb::IMessage.Descriptor {
- get { return Descriptor; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Protobuf_S2C_Disconnect() {
- OnConstruction();
- }
-
- partial void OnConstruction();
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Protobuf_S2C_Disconnect(Protobuf_S2C_Disconnect other) : this() {
- tunnelID_ = other.tunnelID_;
- idx_ = other.idx_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Protobuf_S2C_Disconnect Clone() {
- return new Protobuf_S2C_Disconnect(this);
- }
-
- /// Field number for the "TunnelID" field.
- public const int TunnelIDFieldNumber = 1;
- private uint tunnelID_;
- ///
- ///TunnelID
- ///
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public uint TunnelID {
- get { return tunnelID_; }
- set {
- tunnelID_ = value;
- }
- }
-
- /// Field number for the "Idx" field.
- public const int IdxFieldNumber = 2;
- private uint idx_;
- ///
- ///单个隧道连接下标
- ///
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public uint Idx {
- get { return idx_; }
- set {
- idx_ = value;
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override bool Equals(object other) {
- return Equals(other as Protobuf_S2C_Disconnect);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public bool Equals(Protobuf_S2C_Disconnect other) {
- if (ReferenceEquals(other, null)) {
- return false;
- }
- if (ReferenceEquals(other, this)) {
- return true;
- }
- if (TunnelID != other.TunnelID) return false;
- if (Idx != other.Idx) return false;
- return Equals(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override int GetHashCode() {
- int hash = 1;
- if (TunnelID != 0) hash ^= TunnelID.GetHashCode();
- if (Idx != 0) hash ^= Idx.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
- return hash;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override string ToString() {
- return pb::JsonFormatter.ToDiagnosticString(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void WriteTo(pb::CodedOutputStream output) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- output.WriteRawMessage(this);
- #else
- if (TunnelID != 0) {
- output.WriteRawTag(8);
- output.WriteUInt32(TunnelID);
- }
- if (Idx != 0) {
- output.WriteRawTag(16);
- output.WriteUInt32(Idx);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
- if (TunnelID != 0) {
- output.WriteRawTag(8);
- output.WriteUInt32(TunnelID);
- }
- if (Idx != 0) {
- output.WriteRawTag(16);
- output.WriteUInt32(Idx);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(ref output);
- }
- }
- #endif
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public int CalculateSize() {
- int size = 0;
- if (TunnelID != 0) {
- size += 1 + pb::CodedOutputStream.ComputeUInt32Size(TunnelID);
- }
- if (Idx != 0) {
- size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Idx);
- }
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
- return size;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(Protobuf_S2C_Disconnect other) {
- if (other == null) {
- return;
- }
- if (other.TunnelID != 0) {
- TunnelID = other.TunnelID;
- }
- if (other.Idx != 0) {
- Idx = other.Idx;
- }
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(pb::CodedInputStream input) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- input.ReadRawMessage(this);
- #else
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
- break;
- case 8: {
- TunnelID = input.ReadUInt32();
- break;
- }
- case 16: {
- Idx = input.ReadUInt32();
- break;
- }
- }
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
- break;
- case 8: {
- TunnelID = input.ReadUInt32();
- break;
- }
- case 16: {
- Idx = input.ReadUInt32();
- break;
- }
- }
- }
- }
- #endif
-
- }
-
- public sealed partial class Protobuf_C2S_DATA : pb::IMessage
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- , pb::IBufferMessage
- #endif
- {
- private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Protobuf_C2S_DATA());
- private pb::UnknownFieldSet _unknownFields;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pb::MessageParser Parser { get { return _parser; } }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pbr::MessageDescriptor Descriptor {
- get { return global::AxibugProtobuf.ProtobufNoSugarReflection.Descriptor.MessageTypes[10]; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- pbr::MessageDescriptor pb::IMessage.Descriptor {
- get { return Descriptor; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Protobuf_C2S_DATA() {
- OnConstruction();
- }
-
- partial void OnConstruction();
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Protobuf_C2S_DATA(Protobuf_C2S_DATA other) : this() {
+ public Protobuf_Tunnel_DATA(Protobuf_Tunnel_DATA other) : this() {
tunnelID_ = other.tunnelID_;
idx_ = other.idx_;
hunterNetCoreData_ = other.hunterNetCoreData_;
@@ -2541,8 +2177,8 @@ namespace AxibugProtobuf {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Protobuf_C2S_DATA Clone() {
- return new Protobuf_C2S_DATA(this);
+ public Protobuf_Tunnel_DATA Clone() {
+ return new Protobuf_Tunnel_DATA(this);
}
/// Field number for the "TunnelID" field.
@@ -2586,11 +2222,11 @@ namespace AxibugProtobuf {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
- return Equals(other as Protobuf_C2S_DATA);
+ return Equals(other as Protobuf_Tunnel_DATA);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public bool Equals(Protobuf_C2S_DATA other) {
+ public bool Equals(Protobuf_Tunnel_DATA other) {
if (ReferenceEquals(other, null)) {
return false;
}
@@ -2683,257 +2319,7 @@ namespace AxibugProtobuf {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(Protobuf_C2S_DATA other) {
- if (other == null) {
- return;
- }
- if (other.TunnelID != 0) {
- TunnelID = other.TunnelID;
- }
- if (other.Idx != 0) {
- Idx = other.Idx;
- }
- if (other.HunterNetCoreData.Length != 0) {
- HunterNetCoreData = other.HunterNetCoreData;
- }
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(pb::CodedInputStream input) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- input.ReadRawMessage(this);
- #else
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
- break;
- case 8: {
- TunnelID = input.ReadUInt32();
- break;
- }
- case 16: {
- Idx = input.ReadUInt32();
- break;
- }
- case 26: {
- HunterNetCoreData = input.ReadBytes();
- break;
- }
- }
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
- break;
- case 8: {
- TunnelID = input.ReadUInt32();
- break;
- }
- case 16: {
- Idx = input.ReadUInt32();
- break;
- }
- case 26: {
- HunterNetCoreData = input.ReadBytes();
- break;
- }
- }
- }
- }
- #endif
-
- }
-
- public sealed partial class Protobuf_S2C_DATA : pb::IMessage
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- , pb::IBufferMessage
- #endif
- {
- private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Protobuf_S2C_DATA());
- private pb::UnknownFieldSet _unknownFields;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pb::MessageParser Parser { get { return _parser; } }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static pbr::MessageDescriptor Descriptor {
- get { return global::AxibugProtobuf.ProtobufNoSugarReflection.Descriptor.MessageTypes[11]; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- pbr::MessageDescriptor pb::IMessage.Descriptor {
- get { return Descriptor; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Protobuf_S2C_DATA() {
- OnConstruction();
- }
-
- partial void OnConstruction();
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Protobuf_S2C_DATA(Protobuf_S2C_DATA other) : this() {
- tunnelID_ = other.tunnelID_;
- idx_ = other.idx_;
- hunterNetCoreData_ = other.hunterNetCoreData_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public Protobuf_S2C_DATA Clone() {
- return new Protobuf_S2C_DATA(this);
- }
-
- /// Field number for the "TunnelID" field.
- public const int TunnelIDFieldNumber = 1;
- private uint tunnelID_;
- ///
- ///TunnelID
- ///
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public uint TunnelID {
- get { return tunnelID_; }
- set {
- tunnelID_ = value;
- }
- }
-
- /// Field number for the "Idx" field.
- public const int IdxFieldNumber = 2;
- private uint idx_;
- ///
- ///单个隧道连接下标
- ///
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public uint Idx {
- get { return idx_; }
- set {
- idx_ = value;
- }
- }
-
- /// Field number for the "HunterNetCore_Data" field.
- public const int HunterNetCoreDataFieldNumber = 3;
- private pb::ByteString hunterNetCoreData_ = pb::ByteString.Empty;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public pb::ByteString HunterNetCoreData {
- get { return hunterNetCoreData_; }
- set {
- hunterNetCoreData_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override bool Equals(object other) {
- return Equals(other as Protobuf_S2C_DATA);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public bool Equals(Protobuf_S2C_DATA other) {
- if (ReferenceEquals(other, null)) {
- return false;
- }
- if (ReferenceEquals(other, this)) {
- return true;
- }
- if (TunnelID != other.TunnelID) return false;
- if (Idx != other.Idx) return false;
- if (HunterNetCoreData != other.HunterNetCoreData) return false;
- return Equals(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override int GetHashCode() {
- int hash = 1;
- if (TunnelID != 0) hash ^= TunnelID.GetHashCode();
- if (Idx != 0) hash ^= Idx.GetHashCode();
- if (HunterNetCoreData.Length != 0) hash ^= HunterNetCoreData.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
- return hash;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public override string ToString() {
- return pb::JsonFormatter.ToDiagnosticString(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void WriteTo(pb::CodedOutputStream output) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- output.WriteRawMessage(this);
- #else
- if (TunnelID != 0) {
- output.WriteRawTag(8);
- output.WriteUInt32(TunnelID);
- }
- if (Idx != 0) {
- output.WriteRawTag(16);
- output.WriteUInt32(Idx);
- }
- if (HunterNetCoreData.Length != 0) {
- output.WriteRawTag(26);
- output.WriteBytes(HunterNetCoreData);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
- if (TunnelID != 0) {
- output.WriteRawTag(8);
- output.WriteUInt32(TunnelID);
- }
- if (Idx != 0) {
- output.WriteRawTag(16);
- output.WriteUInt32(Idx);
- }
- if (HunterNetCoreData.Length != 0) {
- output.WriteRawTag(26);
- output.WriteBytes(HunterNetCoreData);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(ref output);
- }
- }
- #endif
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public int CalculateSize() {
- int size = 0;
- if (TunnelID != 0) {
- size += 1 + pb::CodedOutputStream.ComputeUInt32Size(TunnelID);
- }
- if (Idx != 0) {
- size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Idx);
- }
- if (HunterNetCoreData.Length != 0) {
- size += 1 + pb::CodedOutputStream.ComputeBytesSize(HunterNetCoreData);
- }
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
- return size;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public void MergeFrom(Protobuf_S2C_DATA other) {
+ public void MergeFrom(Protobuf_Tunnel_DATA other) {
if (other == null) {
return;
}
diff --git a/NoSugarNet.DataHelper/Properties/PublishProfiles/FolderProfile.pubxml b/NoSugarNet.DataHelper/Properties/PublishProfiles/FolderProfile.pubxml
new file mode 100644
index 0000000..9b45bd1
--- /dev/null
+++ b/NoSugarNet.DataHelper/Properties/PublishProfiles/FolderProfile.pubxml
@@ -0,0 +1,14 @@
+
+
+
+
+ Release
+ Any CPU
+ F:\Sin365\NoSugarNet\Lib\NetLib_Standard2
+ FileSystem
+ <_TargetId>Folder
+ netstandard2.0
+
+
\ No newline at end of file
diff --git a/NoSugarNet.DataHelper/Properties/PublishProfiles/FolderProfile.pubxml.user b/NoSugarNet.DataHelper/Properties/PublishProfiles/FolderProfile.pubxml.user
new file mode 100644
index 0000000..57720b4
--- /dev/null
+++ b/NoSugarNet.DataHelper/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -0,0 +1,10 @@
+
+
+
+
+ True|2024-04-15T06:43:38.1978223Z;True|2024-04-15T14:42:22.9030158+08:00;True|2024-04-15T14:10:55.2191388+08:00;True|2024-04-15T14:07:27.2723988+08:00;False|2024-04-15T14:07:03.8682886+08:00;False|2024-04-15T14:06:57.0680795+08:00;
+
+
+
\ No newline at end of file
diff --git a/NoSugarNet.sln b/NoSugarNet.sln
index e11546d..4125f73 100644
--- a/NoSugarNet.sln
+++ b/NoSugarNet.sln
@@ -22,7 +22,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NoSugarNet.ServerCli", "Sam
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NetLib_Standard2", "NetLib_Standard2", "{4A660CAE-CD92-411C-9D8E-7CB677DB3C74}"
ProjectSection(SolutionItems) = preProject
- Lib\NetLib_Standard2\HaoYueNet.ClientNetworkNet.Standard2.dll = Lib\NetLib_Standard2\HaoYueNet.ClientNetworkNet.Standard2.dll
+ Lib\NetLib_Standard2\HaoYueNet.ClientNetwork.Standard2.dll = Lib\NetLib_Standard2\HaoYueNet.ClientNetwork.Standard2.dll
Lib\NetLib_Standard2\HaoYueNet.ServerNetwork.Standard2.dll = Lib\NetLib_Standard2\HaoYueNet.ServerNetwork.Standard2.dll
Lib\NetLib_Standard2\NoSugarNet.DataHelper.deps.json = Lib\NetLib_Standard2\NoSugarNet.DataHelper.deps.json
Lib\NetLib_Standard2\NoSugarNet.DataHelper.dll = Lib\NetLib_Standard2\NoSugarNet.DataHelper.dll
@@ -31,7 +31,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NetLib_Standard2", "NetLib_
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NoSugarNet.ClientCore.Standard2", "NoSugarNet.ClientCore.Standard2\NoSugarNet.ClientCore.Standard2.csproj", "{5DB2B608-6F99-430A-99AC-534410393955}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NoSugarNet.Adapter", "NoSugarNet.Adapter\NoSugarNet.Adapter.csproj", "{961FA85B-B6A7-4F45-8239-9E91315253B4}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NoSugarNet.Adapter", "NoSugarNet.Adapter\NoSugarNet.Adapter.csproj", "{961FA85B-B6A7-4F45-8239-9E91315253B4}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NoSugarNet.ClientCli.Standard2", "NoSugarNet.ClientCli.Standard2\NoSugarNet.ClientCli.Standard2.csproj", "{97906C2A-2C93-4C63-A237-A75B6EDA8FA4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -63,6 +65,10 @@ Global
{961FA85B-B6A7-4F45-8239-9E91315253B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{961FA85B-B6A7-4F45-8239-9E91315253B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{961FA85B-B6A7-4F45-8239-9E91315253B4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {97906C2A-2C93-4C63-A237-A75B6EDA8FA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {97906C2A-2C93-4C63-A237-A75B6EDA8FA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {97906C2A-2C93-4C63-A237-A75B6EDA8FA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {97906C2A-2C93-4C63-A237-A75B6EDA8FA4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -71,6 +77,7 @@ Global
{29D76CF3-BF7E-45A5-9957-2CBC0A41B6FB} = {5E65F25A-8B59-4FC7-8582-C6887C3CD0A1}
{65220036-9A81-49FA-A5BC-DA06783D2E52} = {5E65F25A-8B59-4FC7-8582-C6887C3CD0A1}
{4A660CAE-CD92-411C-9D8E-7CB677DB3C74} = {EDA9D3FD-1A72-434D-81F6-B1B420406D20}
+ {97906C2A-2C93-4C63-A237-A75B6EDA8FA4} = {5E65F25A-8B59-4FC7-8582-C6887C3CD0A1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {637DC2BB-F9BB-41A2-ADC0-B41B871F66DE}
diff --git a/NosugarNetForUnity/Assets/MainUI.cs b/NosugarNetForUnity/Assets/MainUI.cs
index d539806..35ff20f 100644
--- a/NosugarNetForUnity/Assets/MainUI.cs
+++ b/NosugarNetForUnity/Assets/MainUI.cs
@@ -1,7 +1,6 @@
-using NoSugarNet.ClientCoreNet.Standard2;
+using NoSugarNet.ClientCore;
+using NoSugarNet.ClientCore.Common;
using System;
-using System.Collections;
-using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@@ -28,8 +27,7 @@ public class MainUI : MonoBehaviour
btnStop.onClick.AddListener(StopNoSugarNetClient);
AddLog("");
- AppNoSugarNet.OnUpdateStatus += OnUpdateStatus;
- AppNoSugarNet.Init(OnNoSugarNetLog);
+ AppNoSugarNet.Init(new System.Collections.Generic.Dictionary(),0, OnNoSugarNetLog);
}
private void OnDisable()
diff --git a/NosugarNetForUnity/Assets/Plugins/HaoYueNet.ClientNetwork.Standard2.dll b/NosugarNetForUnity/Assets/Plugins/HaoYueNet.ClientNetwork.Standard2.dll
new file mode 100644
index 0000000..3802b84
Binary files /dev/null and b/NosugarNetForUnity/Assets/Plugins/HaoYueNet.ClientNetwork.Standard2.dll differ
diff --git a/NosugarNetForUnity/Assets/Plugins/NoSugarNet.DataHelper.dll.meta b/NosugarNetForUnity/Assets/Plugins/HaoYueNet.ClientNetwork.Standard2.dll.meta
similarity index 93%
rename from NosugarNetForUnity/Assets/Plugins/NoSugarNet.DataHelper.dll.meta
rename to NosugarNetForUnity/Assets/Plugins/HaoYueNet.ClientNetwork.Standard2.dll.meta
index 2b3ed26..9905920 100644
--- a/NosugarNetForUnity/Assets/Plugins/NoSugarNet.DataHelper.dll.meta
+++ b/NosugarNetForUnity/Assets/Plugins/HaoYueNet.ClientNetwork.Standard2.dll.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 1d83e3c67ee8b794c97b5876ece7a16e
+guid: 190142f96344cb447afd8a87378fa1df
PluginImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/NosugarNetForUnity/Assets/Plugins/HaoYueNet.ClientNetworkNet.Standard2.dll b/NosugarNetForUnity/Assets/Plugins/HaoYueNet.ClientNetworkNet.Standard2.dll
deleted file mode 100644
index c3c4a90..0000000
Binary files a/NosugarNetForUnity/Assets/Plugins/HaoYueNet.ClientNetworkNet.Standard2.dll and /dev/null differ
diff --git a/NosugarNetForUnity/Assets/Plugins/HaoYueNet.ClientNetworkNet.Standard2.dll.meta b/NosugarNetForUnity/Assets/Plugins/HaoYueNet.ClientNetworkNet.Standard2.dll.meta
deleted file mode 100644
index fa5284c..0000000
--- a/NosugarNetForUnity/Assets/Plugins/HaoYueNet.ClientNetworkNet.Standard2.dll.meta
+++ /dev/null
@@ -1,33 +0,0 @@
-fileFormatVersion: 2
-guid: 324deac494a24a7499801349c7908062
-PluginImporter:
- externalObjects: {}
- serializedVersion: 2
- iconMap: {}
- executionOrder: {}
- defineConstraints: []
- isPreloaded: 0
- isOverridable: 0
- isExplicitlyReferenced: 0
- validateReferences: 1
- platformData:
- - first:
- Any:
- second:
- enabled: 1
- settings: {}
- - first:
- Editor: Editor
- second:
- enabled: 0
- settings:
- DefaultValueInitialized: true
- - first:
- Windows Store Apps: WindowsStoreApps
- second:
- enabled: 0
- settings:
- CPU: AnyCPU
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/NosugarNetForUnity/Assets/Plugins/NoSugarNet.ClientCore.Standard2.dll b/NosugarNetForUnity/Assets/Plugins/NoSugarNet.ClientCore.Standard2.dll
index 58d737f..d7b721c 100644
Binary files a/NosugarNetForUnity/Assets/Plugins/NoSugarNet.ClientCore.Standard2.dll and b/NosugarNetForUnity/Assets/Plugins/NoSugarNet.ClientCore.Standard2.dll differ
diff --git a/NosugarNetForUnity/Assets/Plugins/NoSugarNet.DataHelper.dll b/NosugarNetForUnity/Assets/Plugins/NoSugarNet.DataHelper.dll
deleted file mode 100644
index 46e3832..0000000
Binary files a/NosugarNetForUnity/Assets/Plugins/NoSugarNet.DataHelper.dll and /dev/null differ
diff --git a/Sample/NoSugarNet.ServerCli/NoSugarNet.ServerCli.csproj b/Sample/NoSugarNet.ServerCli/NoSugarNet.ServerCli.csproj
index c941ed4..c533bbd 100644
--- a/Sample/NoSugarNet.ServerCli/NoSugarNet.ServerCli.csproj
+++ b/Sample/NoSugarNet.ServerCli/NoSugarNet.ServerCli.csproj
@@ -16,6 +16,7 @@
+