规整协议

This commit is contained in:
sin365 2024-06-25 14:35:44 +08:00
parent 2c11d70b68
commit e1c9454cbd
11 changed files with 197 additions and 100 deletions

View File

@ -15,7 +15,7 @@ namespace NoSugarNet.ClientCore
public static NetworkHelper networkHelper;
public static AppLogin login;
public static AppChat chat;
public static AppLocalClient local;
public static AppForwardLocalClient forwardlocal;
public static UserDataManager user;
public static System.Timers.Timer _SpeedCheckTimeTimer;//速度检测计时器
public static int TimerInterval = 1000;//计时器间隔
@ -34,7 +34,7 @@ namespace NoSugarNet.ClientCore
networkHelper = new NetworkHelper();
login = new AppLogin();
chat = new AppChat();
local = new AppLocalClient();
forwardlocal = new AppForwardLocalClient();
user = new UserDataManager();
netStatus = new NetStatus();
_SpeedCheckTimeTimer = new System.Timers.Timer();
@ -53,7 +53,7 @@ namespace NoSugarNet.ClientCore
public static void Close()
{
local.StopAll();
forwardlocal.StopAll();
networkHelper.CloseConntect();
AppNoSugarNet.log.Info("停止");
_SpeedCheckTimeTimer.Enabled = false;
@ -61,8 +61,8 @@ namespace NoSugarNet.ClientCore
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);
forwardlocal.GetCurrLenght(out long resultReciveAllLenght, out long resultSendAllLenght);
forwardlocal.GetClientCount(out int ClientUserCount, out int TunnelCount);
NetStatus resutnetStatus = new NetStatus()
{
@ -72,10 +72,10 @@ namespace NoSugarNet.ClientCore
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),
tSendAllLenght = forwardlocal.tSendAllLenght,
tReciveAllLenght = forwardlocal.tReciveAllLenght,
tSendSecSpeed = (forwardlocal.tSendAllLenght - netStatus.tSendAllLenght) / (TimerInterval / 1000),
tReciveSecSpeed = (forwardlocal.tReciveAllLenght - netStatus.tReciveAllLenght) / (TimerInterval / 1000),
};
netStatus = resutnetStatus;
OnUpdateStatus?.Invoke(resutnetStatus);

View File

@ -11,7 +11,7 @@ using System.Net;
namespace ServerCore.Manager
{
public class AppLocalClient
public class AppForwardLocalClient
{
Dictionary<byte, Protobuf_Cfgs_Single> mDictTunnelID2Cfg = new Dictionary<byte, Protobuf_Cfgs_Single>();
Dictionary<byte, ForwardLocalListener> mDictTunnelID2Listeners = new Dictionary<byte, ForwardLocalListener>();
@ -22,13 +22,13 @@ namespace ServerCore.Manager
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.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)
@ -202,7 +202,7 @@ namespace ServerCore.Manager
});
//告知给服务端,来自客户端本地的连接建立
AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SConnect, respData);
AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SForwardConnect, respData);
}
/// <summary>
/// 当客户端本地端口连接断开
@ -223,7 +223,7 @@ namespace ServerCore.Manager
});
//告知给服务端,来自客户端本地的连接断开
AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SDisconnect, respData);
AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SForwardDisconnect, respData);
}
/// <summary>
@ -243,7 +243,7 @@ namespace ServerCore.Manager
{
IdxWithMsg msg = msglist[i];
//投递给服务端,来自客户端本地的连接数据
AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SData, msg.data);
AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SForwardData, msg.data);
//发送后回收
LocalMsgQueuePool._localMsgPool.Enqueue(msg);
}
@ -343,7 +343,7 @@ namespace ServerCore.Manager
return;
}
//投递给服务端,来自客户端本地的连接数据
AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SData, respData);
AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SForwardData, respData);
}
#endregion

View File

@ -57,7 +57,7 @@ namespace NoSugarNet.ClientCore.Network
NetworkDeBugLog("连接失败!");
//停止所有
AppNoSugarNet.local.StopAll();
AppNoSugarNet.forwardlocal.StopAll();
//自动重连开关
if (bAutoReConnect)
@ -100,7 +100,7 @@ namespace NoSugarNet.ClientCore.Network
NetworkDeBugLog("OnConnectClose");
//停止所有
AppNoSugarNet.local.StopAll();
AppNoSugarNet.forwardlocal.StopAll();
//自动重连开关
if (bAutoReConnect)

View File

@ -45,13 +45,19 @@ namespace AxibugProtobuf {
"IAEoDRILCgNJZHgYAiABKA0iTgoRUHJvdG9idWZfQzJTX0RBVEESEAoIVHVu",
"bmVsSUQYASABKA0SCwoDSWR4GAIgASgNEhoKEkh1bnRlck5ldENv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VkVSU0VfRElTQ09O",
"TkVDVBDyLhImCiFDTURfVFVOTkVMX1MyQ19SRVZFUlNFX0RJU0NPTk5FQ1QQ",
"8y4SIAobQ01EX1RVTk5FTF9DMlNfUkVWRVJTRV9EQVRBEPQuEiAKG0NNRF9U",
"VU5ORUxfUzJDX1JFVkVSU0VfREFUQRD1LiorCglFcnJvckNvZGUSEAoMRVJS",
"T1JfREVGQVVMEAASDAoIRVJST1JfT0sQASo+CglMb2dpblR5cGUSDwoLQmFz",
"ZURlZmF1bHQQABIOCgpIYW9ZdWVBdXRoEAESBwoDQkYzEAMSBwoDQkY0EAQq",
"SwoKRGV2aWNlVHlwZRIWChJEZXZpY2VUeXBlX0RlZmF1bHQQABIGCgJQQxAB",
@ -97,29 +103,53 @@ namespace AxibugProtobuf {
/// </summary>
[pbr::OriginalName("CMD_CHATMSG")] CmdChatmsg = 4001,
/// <summary>
///客户端告知服务端 客户端本地连接建立 上行 Protobuf_C2S_Connect
///正向代理,客户端告知服务端 客户端本地连接建立 上行 Protobuf_C2S_Connect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_C2S_CONNECT")] CmdTunnelC2SConnect = 5000,
[pbr::OriginalName("CMD_TUNNEL_C2S_FORWARD_CONNECT")] CmdTunnelC2SForwardConnect = 5000,
/// <summary>
///服务端告知客户端 服务端本地连接建立 下行 Protobuf_S2C_Connect
///正向代理,服务端告知客户端 服务端本地连接建立 下行 Protobuf_S2C_Connect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_S2C_CONNECT")] CmdTunnelS2CConnect = 5001,
[pbr::OriginalName("CMD_TUNNEL_S2C_FORWARD_CONNECT")] CmdTunnelS2CForwardConnect = 5001,
/// <summary>
///客户端告知服务端 客户端本地连接断开 上行 Protobuf_C2S_Disconnect
///正向代理,客户端告知服务端 客户端本地连接断开 上行 Protobuf_C2S_Disconnect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_C2S_DISCONNECT")] CmdTunnelC2SDisconnect = 5002,
[pbr::OriginalName("CMD_TUNNEL_C2S_FORWARD_DISCONNECT")] CmdTunnelC2SForwardDisconnect = 5002,
/// <summary>
///服务端告知客户端 服务端本地连接断开 下行 Protobuf_S2C_Disconnect
///正向代理,服务端告知客户端 服务端本地连接断开 下行 Protobuf_S2C_Disconnect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_S2C_DISCONNECT")] CmdTunnelS2CDisconnect = 5003,
[pbr::OriginalName("CMD_TUNNEL_S2C_FORWARD_DISCONNECT")] CmdTunnelS2CForwardDisconnect = 5003,
/// <summary>
///客户端投递本地TCP通讯数据包 上行 Protobuf_C2S_DATA
///正向代理,客户端投递本地TCP通讯数据包 上行 Protobuf_C2S_DATA
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_C2S_DATA")] CmdTunnelC2SData = 5004,
[pbr::OriginalName("CMD_TUNNEL_C2S_FORWARD_DATA")] CmdTunnelC2SForwardData = 5004,
/// <summary>
///服务端投递本地TCP通讯数据包 下行 Protobuf_S2C_DATA
///正向代理,服务端投递本地TCP通讯数据包 下行 Protobuf_S2C_DATA
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_S2C_DATA")] CmdTunnelS2CData = 5005,
[pbr::OriginalName("CMD_TUNNEL_S2C_FORWARD_DATA")] CmdTunnelS2CForwardData = 5005,
/// <summary>
///反向代理,客户端告知服务端 客户端本地连接建立 上行 Protobuf_C2S_Connect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_C2S_REVERSE_CONNECT")] CmdTunnelC2SReverseConnect = 6000,
/// <summary>
///反向代理,服务端告知客户端 服务端本地连接建立 下行 Protobuf_S2C_Connect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_S2C_REVERSE_CONNECT")] CmdTunnelS2CReverseConnect = 6001,
/// <summary>
///反向代理,客户端告知服务端 客户端本地连接断开 上行 Protobuf_C2S_Disconnect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_C2S_REVERSE_DISCONNECT")] CmdTunnelC2SReverseDisconnect = 6002,
/// <summary>
///反向代理,服务端告知客户端 服务端本地连接断开 下行 Protobuf_S2C_Disconnect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_S2C_REVERSE_DISCONNECT")] CmdTunnelS2CReverseDisconnect = 6003,
/// <summary>
///反向代理客户端投递本地TCP通讯数据包 上行 Protobuf_C2S_DATA
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_C2S_REVERSE_DATA")] CmdTunnelC2SReverseData = 6004,
/// <summary>
///反向代理服务端投递本地TCP通讯数据包 下行 Protobuf_S2C_DATA
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_S2C_REVERSE_DATA")] CmdTunnelS2CReverseData = 6005,
}
public enum ErrorCode {

View File

@ -174,7 +174,7 @@ namespace ServerCore.Manager
cinfo.IsOffline = true;
cinfo.LogOutDT = DateTime.Now;
//断开所有连接
ServerManager.g_Local.StopAll(cinfo.UID);
ServerManager.g_ForwardLocal.StopAll(cinfo.UID);
}
public void RemoveClientForSocket(Socket sk)

View File

@ -9,7 +9,7 @@ using System.Net.Sockets;
namespace ServerCore.Manager
{
public class LocalClientManager
public class ForwardLocalClientManager
{
Dictionary<long, BackwardLocalClient> mDictCommKey2ServerLocalClients = new Dictionary<long, BackwardLocalClient>();
CompressAdapter mCompressAdapter;
@ -27,15 +27,15 @@ namespace ServerCore.Manager
return CommKey / 10000000;
}
public LocalClientManager(E_CompressAdapter compressAdapterType)
public ForwardLocalClientManager(E_CompressAdapter compressAdapterType)
{
ServerManager.g_Log.Debug("初始化压缩适配器" + compressAdapterType);
//初始化压缩适配器暂时使用0代表压缩类型
mCompressAdapter = new CompressAdapter(compressAdapterType);
//注册网络消息
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTunnelC2SConnect, Recive_TunnelC2SConnect);
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTunnelC2SDisconnect, Recive_TunnelC2SDisconnect);
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTunnelC2SData, Recive_TunnelC2SData);
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTunnelC2SForwardConnect, Recive_TunnelC2SConnect);
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTunnelC2SForwardDisconnect, Recive_TunnelC2SDisconnect);
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTunnelC2SForwardData, Recive_TunnelC2SData);
}
public void GetCurrLenght(out long resultReciveAllLenght,out long resultSendAllLenght)
@ -204,7 +204,7 @@ namespace ServerCore.Manager
Connected = 0//失败
});
//发送给客户端,指定服务端本地端口已连接
ServerManager.g_ClientMgr.ClientSend(client, (int)CommandID.CmdTunnelS2CConnect, (int)ErrorCode.ErrorOk, respData);
ServerManager.g_ClientMgr.ClientSend(client, (int)CommandID.CmdTunnelS2CForwardConnect, (int)ErrorCode.ErrorOk, respData);
}
});
thread.Start();
@ -248,7 +248,7 @@ namespace ServerCore.Manager
Connected = 1
});
//发送给客户端,指定服务端本地端口已连接
ServerManager.g_ClientMgr.ClientSend(client, (int)CommandID.CmdTunnelS2CConnect, (int)ErrorCode.ErrorOk, respData);
ServerManager.g_ClientMgr.ClientSend(client, (int)CommandID.CmdTunnelS2CForwardConnect, (int)ErrorCode.ErrorOk, respData);
}
/// <summary>
/// 当服务端本地端口连接断开
@ -269,7 +269,7 @@ namespace ServerCore.Manager
Idx= Idx,
});
//发送给客户端,指定服务端本地端口连接已断开
ServerManager.g_ClientMgr.ClientSend(client, (int)CommandID.CmdTunnelS2CDisconnect, (int)ErrorCode.ErrorOk, respData);
ServerManager.g_ClientMgr.ClientSend(client, (int)CommandID.CmdTunnelS2CForwardDisconnect, (int)ErrorCode.ErrorOk, respData);
}
#endregion
@ -351,7 +351,7 @@ namespace ServerCore.Manager
});
//发送给客户端指定客户端本地隧道ID
ServerManager.g_ClientMgr.ClientSend(client, (int)CommandID.CmdTunnelS2CData, (int)ErrorCode.ErrorOk, respData);
ServerManager.g_ClientMgr.ClientSend(client, (int)CommandID.CmdTunnelS2CForwardData, (int)ErrorCode.ErrorOk, respData);
}
#endregion
}

View File

@ -13,7 +13,7 @@ namespace ServerCore.Manager
public static LogManager g_Log;
public static LoginManager g_Login;
public static ChatManager g_Chat;
public static LocalClientManager g_Local;
public static ForwardLocalClientManager g_ForwardLocal;
public static IOCPNetWork g_SocketMgr;
public static System.Timers.Timer _SpeedCheckTimeTimer;//速度检测计时器
public static int TimerInterval = 1000;//计时器间隔
@ -34,7 +34,7 @@ namespace ServerCore.Manager
g_Log = new LogManager();
g_Login = new LoginManager();
g_Chat = new ChatManager();
g_Local = new LocalClientManager((E_CompressAdapter)compressAdapterType);
g_ForwardLocal = new ForwardLocalClientManager((E_CompressAdapter)compressAdapterType);
//g_SocketMgr = new IOCPNetWork(1024, 1024);
g_SocketMgr = new IOCPNetWork(1024, 4096);
@ -53,8 +53,8 @@ namespace ServerCore.Manager
static void Checktimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
g_Local.GetCurrLenght(out long resultReciveAllLenght, out long resultSendAllLenght);
g_Local.GetClientCount(out int ClientUserCount, out int TunnelCount);
g_ForwardLocal.GetCurrLenght(out long resultReciveAllLenght, out long resultSendAllLenght);
g_ForwardLocal.GetClientCount(out int ClientUserCount, out int TunnelCount);
NetStatus resutnetStatus = new NetStatus()
{
TunnelCount = TunnelCount,
@ -63,10 +63,10 @@ namespace ServerCore.Manager
srcReciveAllLenght = resultReciveAllLenght,
srcReciveSecSpeed = (resultReciveAllLenght - netStatus.srcReciveAllLenght) / (TimerInterval / 1000),
srcSendSecSpeed = (resultSendAllLenght - netStatus.srcSendAllLenght) / (TimerInterval / 1000),
tSendAllLenght = g_Local.tSendAllLenght,
tReciveAllLenght = g_Local.tReciveAllLenght,
tSendSecSpeed = (g_Local.tSendAllLenght - netStatus.tSendAllLenght) / (TimerInterval / 1000),
tReciveSecSpeed = (g_Local.tReciveAllLenght - netStatus.tReciveAllLenght) / (TimerInterval / 1000),
tSendAllLenght = g_ForwardLocal.tSendAllLenght,
tReciveAllLenght = g_ForwardLocal.tReciveAllLenght,
tSendSecSpeed = (g_ForwardLocal.tSendAllLenght - netStatus.tSendAllLenght) / (TimerInterval / 1000),
tReciveSecSpeed = (g_ForwardLocal.tReciveAllLenght - netStatus.tReciveAllLenght) / (TimerInterval / 1000),
};
netStatus = resutnetStatus;
OnUpdateStatus?.Invoke(resutnetStatus);

View File

@ -45,13 +45,19 @@ namespace AxibugProtobuf {
"IAEoDRILCgNJZHgYAiABKA0iTgoRUHJvdG9idWZfQzJTX0RBVEESEAoIVHVu",
"bmVsSUQYASABKA0SCwoDSWR4GAIgASgNEhoKEkh1bnRlck5ldENvcmVfRGF0",
"YRgDIAEoDCJOChFQcm90b2J1Zl9TMkNfREFUQRIQCghUdW5uZWxJRBgBIAEo",
"DRILCgNJZHgYAiABKA0SGgoSSHVudGVyTmV0Q29yZV9EYXRhGAMgASgMKvoB",
"DRILCgNJZHgYAiABKA0SGgoSSHVudGVyTmV0Q29yZV9EYXRhGAMgASgMKogE",
"CglDb21tYW5kSUQSDgoKQ01EX0RFRkFVTBAAEg4KCUNNRF9MT0dJThDRDxIN",
"CghDTURfQ0ZHUxC5FxIQCgtDTURfQ0hBVE1TRxChHxIbChZDTURfVFVOTkVM",
"X0MyU19DT05ORUNUEIgnEhsKFkNNRF9UVU5ORUxfUzJDX0NPTk5FQ1QQiScS",
"HgoZQ01EX1RVTk5FTF9DMlNfRElTQ09OTkVDVBCKJxIeChlDTURfVFVOTkVM",
"X1MyQ19ESVNDT05ORUNUEIsnEhgKE0NNRF9UVU5ORUxfQzJTX0RBVEEQjCcS",
"GAoTQ01EX1RVTk5FTF9TMkNfREFUQRCNJyorCglFcnJvckNvZGUSEAoMRVJS",
"CghDTURfQ0ZHUxC5FxIQCgtDTURfQ0hBVE1TRxChHxIjCh5DTURfVFVOTkVM",
"X0MyU19GT1JXQVJEX0NPTk5FQ1QQiCcSIwoeQ01EX1RVTk5FTF9TMkNfRk9S",
"V0FSRF9DT05ORUNUEIknEiYKIUNNRF9UVU5ORUxfQzJTX0ZPUldBUkRfRElT",
"Q09OTkVDVBCKJxImCiFDTURfVFVOTkVMX1MyQ19GT1JXQVJEX0RJU0NPTk5F",
"Q1QQiycSIAobQ01EX1RVTk5FTF9DMlNfRk9SV0FSRF9EQVRBEIwnEiAKG0NN",
"RF9UVU5ORUxfUzJDX0ZPUldBUkRfREFUQRCNJxIjCh5DTURfVFVOTkVMX0My",
"U19SRVZFUlNFX0NPTk5FQ1QQ8C4SIwoeQ01EX1RVTk5FTF9TMkNfUkVWRVJT",
"RV9DT05ORUNUEPEuEiYKIUNNRF9UVU5ORUxfQzJTX1JFVkVSU0VfRElTQ09O",
"TkVDVBDyLhImCiFDTURfVFVOTkVMX1MyQ19SRVZFUlNFX0RJU0NPTk5FQ1QQ",
"8y4SIAobQ01EX1RVTk5FTF9DMlNfUkVWRVJTRV9EQVRBEPQuEiAKG0NNRF9U",
"VU5ORUxfUzJDX1JFVkVSU0VfREFUQRD1LiorCglFcnJvckNvZGUSEAoMRVJS",
"T1JfREVGQVVMEAASDAoIRVJST1JfT0sQASo+CglMb2dpblR5cGUSDwoLQmFz",
"ZURlZmF1bHQQABIOCgpIYW9ZdWVBdXRoEAESBwoDQkYzEAMSBwoDQkY0EAQq",
"SwoKRGV2aWNlVHlwZRIWChJEZXZpY2VUeXBlX0RlZmF1bHQQABIGCgJQQxAB",
@ -97,29 +103,53 @@ namespace AxibugProtobuf {
/// </summary>
[pbr::OriginalName("CMD_CHATMSG")] CmdChatmsg = 4001,
/// <summary>
///客户端告知服务端 客户端本地连接建立 上行 Protobuf_C2S_Connect
///正向代理,客户端告知服务端 客户端本地连接建立 上行 Protobuf_C2S_Connect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_C2S_CONNECT")] CmdTunnelC2SConnect = 5000,
[pbr::OriginalName("CMD_TUNNEL_C2S_FORWARD_CONNECT")] CmdTunnelC2SForwardConnect = 5000,
/// <summary>
///服务端告知客户端 服务端本地连接建立 下行 Protobuf_S2C_Connect
///正向代理,服务端告知客户端 服务端本地连接建立 下行 Protobuf_S2C_Connect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_S2C_CONNECT")] CmdTunnelS2CConnect = 5001,
[pbr::OriginalName("CMD_TUNNEL_S2C_FORWARD_CONNECT")] CmdTunnelS2CForwardConnect = 5001,
/// <summary>
///客户端告知服务端 客户端本地连接断开 上行 Protobuf_C2S_Disconnect
///正向代理,客户端告知服务端 客户端本地连接断开 上行 Protobuf_C2S_Disconnect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_C2S_DISCONNECT")] CmdTunnelC2SDisconnect = 5002,
[pbr::OriginalName("CMD_TUNNEL_C2S_FORWARD_DISCONNECT")] CmdTunnelC2SForwardDisconnect = 5002,
/// <summary>
///服务端告知客户端 服务端本地连接断开 下行 Protobuf_S2C_Disconnect
///正向代理,服务端告知客户端 服务端本地连接断开 下行 Protobuf_S2C_Disconnect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_S2C_DISCONNECT")] CmdTunnelS2CDisconnect = 5003,
[pbr::OriginalName("CMD_TUNNEL_S2C_FORWARD_DISCONNECT")] CmdTunnelS2CForwardDisconnect = 5003,
/// <summary>
///客户端投递本地TCP通讯数据包 上行 Protobuf_C2S_DATA
///正向代理,客户端投递本地TCP通讯数据包 上行 Protobuf_C2S_DATA
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_C2S_DATA")] CmdTunnelC2SData = 5004,
[pbr::OriginalName("CMD_TUNNEL_C2S_FORWARD_DATA")] CmdTunnelC2SForwardData = 5004,
/// <summary>
///服务端投递本地TCP通讯数据包 下行 Protobuf_S2C_DATA
///正向代理,服务端投递本地TCP通讯数据包 下行 Protobuf_S2C_DATA
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_S2C_DATA")] CmdTunnelS2CData = 5005,
[pbr::OriginalName("CMD_TUNNEL_S2C_FORWARD_DATA")] CmdTunnelS2CForwardData = 5005,
/// <summary>
///反向代理,客户端告知服务端 客户端本地连接建立 上行 Protobuf_C2S_Connect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_C2S_REVERSE_CONNECT")] CmdTunnelC2SReverseConnect = 6000,
/// <summary>
///反向代理,服务端告知客户端 服务端本地连接建立 下行 Protobuf_S2C_Connect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_S2C_REVERSE_CONNECT")] CmdTunnelS2CReverseConnect = 6001,
/// <summary>
///反向代理,客户端告知服务端 客户端本地连接断开 上行 Protobuf_C2S_Disconnect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_C2S_REVERSE_DISCONNECT")] CmdTunnelC2SReverseDisconnect = 6002,
/// <summary>
///反向代理,服务端告知客户端 服务端本地连接断开 下行 Protobuf_S2C_Disconnect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_S2C_REVERSE_DISCONNECT")] CmdTunnelS2CReverseDisconnect = 6003,
/// <summary>
///反向代理客户端投递本地TCP通讯数据包 上行 Protobuf_C2S_DATA
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_C2S_REVERSE_DATA")] CmdTunnelC2SReverseData = 6004,
/// <summary>
///反向代理服务端投递本地TCP通讯数据包 下行 Protobuf_S2C_DATA
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_S2C_REVERSE_DATA")] CmdTunnelS2CReverseData = 6005,
}
public enum ErrorCode {

View File

@ -45,13 +45,19 @@ namespace AxibugProtobuf {
"IAEoDRILCgNJZHgYAiABKA0iTgoRUHJvdG9idWZfQzJTX0RBVEESEAoIVHVu",
"bmVsSUQYASABKA0SCwoDSWR4GAIgASgNEhoKEkh1bnRlck5ldENvcmVfRGF0",
"YRgDIAEoDCJOChFQcm90b2J1Zl9TMkNfREFUQRIQCghUdW5uZWxJRBgBIAEo",
"DRILCgNJZHgYAiABKA0SGgoSSHVudGVyTmV0Q29yZV9EYXRhGAMgASgMKvoB",
"DRILCgNJZHgYAiABKA0SGgoSSHVudGVyTmV0Q29yZV9EYXRhGAMgASgMKogE",
"CglDb21tYW5kSUQSDgoKQ01EX0RFRkFVTBA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VJST1JfT0sQASo+CglMb2dpblR5cGUSDwoLQmFz",
"ZURlZmF1bHQQABIOCgpIYW9ZdWVBdXRoEAESBwoDQkYzEAMSBwoDQkY0EAQq",
"SwoKRGV2aWNlVHlwZRIWChJEZXZpY2VUeXBlX0RlZmF1bHQQABIGCgJQQxAB",
@ -97,29 +103,53 @@ namespace AxibugProtobuf {
/// </summary>
[pbr::OriginalName("CMD_CHATMSG")] CmdChatmsg = 4001,
/// <summary>
///客户端告知服务端 客户端本地连接建立 上行 Protobuf_C2S_Connect
///正向代理,客户端告知服务端 客户端本地连接建立 上行 Protobuf_C2S_Connect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_C2S_CONNECT")] CmdTunnelC2SConnect = 5000,
[pbr::OriginalName("CMD_TUNNEL_C2S_FORWARD_CONNECT")] CmdTunnelC2SForwardConnect = 5000,
/// <summary>
///服务端告知客户端 服务端本地连接建立 下行 Protobuf_S2C_Connect
///正向代理,服务端告知客户端 服务端本地连接建立 下行 Protobuf_S2C_Connect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_S2C_CONNECT")] CmdTunnelS2CConnect = 5001,
[pbr::OriginalName("CMD_TUNNEL_S2C_FORWARD_CONNECT")] CmdTunnelS2CForwardConnect = 5001,
/// <summary>
///客户端告知服务端 客户端本地连接断开 上行 Protobuf_C2S_Disconnect
///正向代理,客户端告知服务端 客户端本地连接断开 上行 Protobuf_C2S_Disconnect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_C2S_DISCONNECT")] CmdTunnelC2SDisconnect = 5002,
[pbr::OriginalName("CMD_TUNNEL_C2S_FORWARD_DISCONNECT")] CmdTunnelC2SForwardDisconnect = 5002,
/// <summary>
///服务端告知客户端 服务端本地连接断开 下行 Protobuf_S2C_Disconnect
///正向代理,服务端告知客户端 服务端本地连接断开 下行 Protobuf_S2C_Disconnect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_S2C_DISCONNECT")] CmdTunnelS2CDisconnect = 5003,
[pbr::OriginalName("CMD_TUNNEL_S2C_FORWARD_DISCONNECT")] CmdTunnelS2CForwardDisconnect = 5003,
/// <summary>
///客户端投递本地TCP通讯数据包 上行 Protobuf_C2S_DATA
///正向代理,客户端投递本地TCP通讯数据包 上行 Protobuf_C2S_DATA
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_C2S_DATA")] CmdTunnelC2SData = 5004,
[pbr::OriginalName("CMD_TUNNEL_C2S_FORWARD_DATA")] CmdTunnelC2SForwardData = 5004,
/// <summary>
///服务端投递本地TCP通讯数据包 下行 Protobuf_S2C_DATA
///正向代理,服务端投递本地TCP通讯数据包 下行 Protobuf_S2C_DATA
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_S2C_DATA")] CmdTunnelS2CData = 5005,
[pbr::OriginalName("CMD_TUNNEL_S2C_FORWARD_DATA")] CmdTunnelS2CForwardData = 5005,
/// <summary>
///反向代理,客户端告知服务端 客户端本地连接建立 上行 Protobuf_C2S_Connect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_C2S_REVERSE_CONNECT")] CmdTunnelC2SReverseConnect = 6000,
/// <summary>
///反向代理,服务端告知客户端 服务端本地连接建立 下行 Protobuf_S2C_Connect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_S2C_REVERSE_CONNECT")] CmdTunnelS2CReverseConnect = 6001,
/// <summary>
///反向代理,客户端告知服务端 客户端本地连接断开 上行 Protobuf_C2S_Disconnect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_C2S_REVERSE_DISCONNECT")] CmdTunnelC2SReverseDisconnect = 6002,
/// <summary>
///反向代理,服务端告知客户端 服务端本地连接断开 下行 Protobuf_S2C_Disconnect
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_S2C_REVERSE_DISCONNECT")] CmdTunnelS2CReverseDisconnect = 6003,
/// <summary>
///反向代理客户端投递本地TCP通讯数据包 上行 Protobuf_C2S_DATA
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_C2S_REVERSE_DATA")] CmdTunnelC2SReverseData = 6004,
/// <summary>
///反向代理服务端投递本地TCP通讯数据包 下行 Protobuf_S2C_DATA
/// </summary>
[pbr::OriginalName("CMD_TUNNEL_S2C_REVERSE_DATA")] CmdTunnelS2CReverseData = 6005,
}
public enum ErrorCode {

View File

@ -13,12 +13,19 @@ enum CommandID
CMD_CHATMSG = 4001; //广 | Protobuf_ChatMsg | Protobuf_ChatMsg_RESP
CMD_TUNNEL_C2S_CONNECT = 5000; // Protobuf_C2S_Connect
CMD_TUNNEL_S2C_CONNECT = 5001; // Protobuf_S2C_Connect
CMD_TUNNEL_C2S_DISCONNECT = 5002; // Protobuf_C2S_Disconnect
CMD_TUNNEL_S2C_DISCONNECT = 5003; // Protobuf_S2C_Disconnect
CMD_TUNNEL_C2S_DATA = 5004; //TCP通讯数据包 Protobuf_C2S_DATA
CMD_TUNNEL_S2C_DATA = 5005; //TCP通讯数据包 Protobuf_S2C_DATA
CMD_TUNNEL_C2S_FORWARD_CONNECT = 5000; // Protobuf_C2S_Connect
CMD_TUNNEL_S2C_FORWARD_CONNECT = 5001; // Protobuf_S2C_Connect
CMD_TUNNEL_C2S_FORWARD_DISCONNECT = 5002; // Protobuf_C2S_Disconnect
CMD_TUNNEL_S2C_FORWARD_DISCONNECT = 5003; // Protobuf_S2C_Disconnect
CMD_TUNNEL_C2S_FORWARD_DATA = 5004; //TCP通讯数据包 Protobuf_C2S_DATA
CMD_TUNNEL_S2C_FORWARD_DATA = 5005; //TCP通讯数据包 Protobuf_S2C_DATA
CMD_TUNNEL_C2S_REVERSE_CONNECT = 6000; // Protobuf_C2S_Connect
CMD_TUNNEL_S2C_REVERSE_CONNECT = 6001; // Protobuf_S2C_Connect
CMD_TUNNEL_C2S_REVERSE_DISCONNECT = 6002; // Protobuf_C2S_Disconnect
CMD_TUNNEL_S2C_REVERSE_DISCONNECT = 6003; // Protobuf_S2C_Disconnect
CMD_TUNNEL_C2S_REVERSE_DATA = 6004; //TCP通讯数据包 Protobuf_C2S_DATA
CMD_TUNNEL_S2C_REVERSE_DATA = 6005; //TCP通讯数据包 Protobuf_S2C_DATA
}
enum ErrorCode

View File

@ -28,10 +28,10 @@ namespace NoSugarNet.ClientCli
AppNoSugarNet.Connect(Config.ServerIP, Config.ServerPort);
break;
case "tlist":
AppNoSugarNet.local.GetClientCount(out int ClientUserCount, out int TunnelCount);
AppNoSugarNet.forwardlocal.GetClientCount(out int ClientUserCount, out int TunnelCount);
Console.WriteLine($"GetClientCount->{ClientUserCount} TunnelCount->{TunnelCount}");
AppNoSugarNet.local.GetClientDebugInfo();
AppNoSugarNet.forwardlocal.GetClientDebugInfo();
break;
case "stop":
AppNoSugarNet.Close();