最初の代理通讯成功

This commit is contained in:
sin365 2024-01-22 15:08:43 +08:00
parent 06dc7559ba
commit a07a964a0f
21 changed files with 367 additions and 249 deletions

Binary file not shown.

Binary file not shown.

View File

@ -133,7 +133,7 @@
}
catch (Exception e)
{
App.log.Error(e.Message);
AppNoSugarNet.log.Error(e.Message);
}
}
}
@ -152,7 +152,7 @@
}
catch (Exception e)
{
App.log.Error(e.Message);
AppNoSugarNet.log.Error(e.Message);
}
}
}
@ -171,7 +171,7 @@
}
catch (Exception e)
{
App.log.Error(e.Message);
AppNoSugarNet.log.Error(e.Message);
}
}
}
@ -190,7 +190,7 @@
}
catch (Exception e)
{
App.log.Error(e.Message + ", method name : " + callback.Method);
AppNoSugarNet.log.Error(e.Message + ", method name : " + callback.Method);
}
}
}
@ -210,7 +210,7 @@
}
catch (Exception e)
{
App.log.Error(e.Message);
AppNoSugarNet.log.Error(e.Message);
}
}
}

View File

@ -18,7 +18,7 @@ namespace NoSugarNet.ClientCore.Manager
{
ChatMsg = ChatMsg,
};
App.networkHelper.SendToServer((int)CommandID.CmdChatmsg, ProtoBufHelper.Serizlize(msg));
AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdChatmsg, ProtoBufHelper.Serizlize(msg));
}
public void RecvChatMsg(byte[] reqData)

View File

@ -34,6 +34,7 @@ namespace ServerCore.Manager
foreach (var cfg in mDictTunnelID2Cfg)
{
LocalListener listener = new LocalListener(1024, 1024, cfg.Key);
AppNoSugarNet.log.Debug($"开始监听配置 Tunnel:{cfg.Key},Port:{cfg.Value.Port}");
listener.Init();
listener.Start(new IPEndPoint(IPAddress.Any.Address, (int)cfg.Value.Port));
AddLocalListener(listener);
@ -99,7 +100,7 @@ namespace ServerCore.Manager
AppNoSugarNet.log.Debug("Recive_CmdCfgs");
Protobuf_Cfgs msg = ProtoBufHelper.DeSerizlize<Protobuf_Cfgs>(reqData);
for (int i = 0;msg.Cfgs.Count > 0;i++)
for (int i = 0;i < msg.Cfgs.Count;i++)
{
Protobuf_Cfgs_Single cfg = msg.Cfgs[i];
mDictTunnelID2Cfg[(byte)cfg.TunnelID] = cfg;
@ -110,7 +111,10 @@ namespace ServerCore.Manager
{
AppNoSugarNet.log.Debug("Recive_TunnelS2CConnect");
Protobuf_S2C_Connect msg = ProtoBufHelper.DeSerizlize<Protobuf_S2C_Connect>(reqData);
OnServerLocalConnect((byte)msg.TunnelID,(byte)msg.Idx);
if(msg.Connected == 1)
OnServerLocalConnect((byte)msg.TunnelID,(byte)msg.Idx);
else
OnServerLocalDisconnect((byte)msg.TunnelID, (byte)msg.Idx);
}
public void Recive_TunnelS2CDisconnect(byte[] reqData)
{
@ -134,6 +138,7 @@ namespace ServerCore.Manager
/// <param name="tunnelId"></param>
public void OnClientLocalConnect(byte tunnelId,byte _Idx)
{
AppNoSugarNet.log.Debug($"OnClientLocalConnect {tunnelId},{_Idx}");
if (!mDictTunnelID2Cfg.ContainsKey(tunnelId))
return;
@ -153,6 +158,7 @@ namespace ServerCore.Manager
/// <param name="tunnelId"></param>
public void OnClientLocalDisconnect(byte tunnelId, byte _Idx)
{
AppNoSugarNet.log.Debug($"OnClientLocalDisconnect {tunnelId},{_Idx}");
//隧道ID定位投递服务端本地连接
if (!mDictTunnelID2Cfg.ContainsKey(tunnelId))
return;
@ -162,6 +168,7 @@ namespace ServerCore.Manager
TunnelID = tunnelId,
Idx= _Idx,
});
//告知给服务端,来自客户端本地的连接断开
AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SDisconnect, respData);
}
@ -171,6 +178,7 @@ namespace ServerCore.Manager
/// <param name="tunnelId"></param>
public void OnServerLocalConnect(byte tunnelId,byte Idx)
{
AppNoSugarNet.log.Debug($"OnServerLocalConnect {tunnelId},{Idx}");
if (!GetLocalListener(tunnelId, out LocalListener _listener))
return;
//维护状态
@ -179,8 +187,11 @@ namespace ServerCore.Manager
{
for(int i = 0; i < msglist.Count; i++)
{
IdxWithMsg msg = msglist[i];
//投递给服务端,来自客户端本地的连接数据
AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SData, msglist[i].data);
AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdTunnelC2SData, msg.data);
//发送后回收
AppNoSugarNet.local._localMsgPool.Enqueue(msg);
}
}
}
@ -191,6 +202,7 @@ namespace ServerCore.Manager
/// <param name="tunnelId"></param>
public void OnServerLocalDisconnect(byte tunnelId, byte Idx)
{
AppNoSugarNet.log.Debug($"OnServerLocalDisconnect {tunnelId},{Idx}");
if (!GetLocalListener(tunnelId, out LocalListener _listener))
return;
@ -208,6 +220,7 @@ namespace ServerCore.Manager
/// <param name="data"></param>
public void OnServerLocalDataCallBack(byte tunnelId,byte Idx, byte[] data)
{
AppNoSugarNet.log.Debug($"OnServerLocalDataCallBack {tunnelId},{Idx}");
if (!GetLocalListener(tunnelId, out LocalListener _listener))
return;
//解压
@ -222,6 +235,7 @@ namespace ServerCore.Manager
/// <param name="data"></param>
public void OnClientTunnelDataCallBack(byte tunnelId,byte Idx, byte[] data)
{
AppNoSugarNet.log.Debug($"OnClientTunnelDataCallBack {tunnelId},{Idx}");
//压缩
data = mCompressAdapter.Compress(data);
byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_C2S_DATA()

View File

@ -1,7 +1,5 @@
using HaoYueNet.ServerNetwork;
using NoSugarNet.ClientCore.Network;
using System.Net.Sockets;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace NoSugarNet.ClientCore
{
@ -89,7 +87,7 @@ namespace NoSugarNet.ClientCore
/// <param name="sk"></param>
public void OnDisconnect(AsyncUserToken token)
{
Console.WriteLine("断开连接");
AppNoSugarNet.log.Debug("断开连接");
if (!GetSocketIdxBySocket(token.Socket, out int Idx))
return;
@ -251,7 +249,6 @@ namespace NoSugarNet.ClientCore
{
IdxWithMsg msg = _localClientInfo.msgQueue.Dequeue();
MsgList.Add(msg);
AppNoSugarNet.local._localMsgPool.Enqueue(msg);
}
return true;
}

View File

@ -66,7 +66,7 @@
}
catch (Exception e)
{
App.log.Error(e.Message);
AppNoSugarNet.log.Error(e.Message);
}
}
}

View File

@ -32,42 +32,43 @@ namespace AxibugProtobuf {
"CRIVCg1MYXN0TG9naW5EYXRlGAIgASgJEg8KB1JlZ0RhdGUYAyABKAkSMQoG",
"U3RhdHVzGAQgASgOMiEuQXhpYnVnUHJvdG9idWYuTG9naW5SZXN1bHRTdGF0",
"dXMiQwoNUHJvdG9idWZfQ2ZncxIyCgRjZmdzGAEgAygLMiQuQXhpYnVnUHJv",
"dG9idWYuUHJvdG9idWZfQ2Znc19TaW5nbGUiQgoUUHJvdG9idWZfQ2Znc19T",
"aW5nbGUSEAoIVHVubmVsSUQYASABKA0SCgoCSVAYAiABKAkSDAoEUG9ydBgD",
"IAEoBSIjChBQcm90b2J1Zl9DaGF0TXNnEg8KB0NoYXRNc2cYASABKAkiSAoV",
"UHJvdG9idWZfQ2hhdE1zZ19SRVNQEhAKCE5pY2tOYW1lGAEgASgJEg8KB0No",
"YXRNc2cYAiABKAkSDAoERGF0ZRgDIAEoAyI1ChRQcm90b2J1Zl9DMlNfQ29u",
"bmVjdBIQCghUdW5uZWxJRBgBIAEoDRILCgNJZHgYAiABKA0iNQoUUHJvdG9i",
"dWZfUzJDX0Nvbm5lY3QSEAoIVHVubmVsSUQYASABKA0SCwoDSWR4GAIgASgN",
"IjgKF1Byb3RvYnVmX0MyU19EaXNjb25uZWN0EhAKCFR1bm5lbElEGAEgASgN",
"EgsKA0lkeBgCIAEoDSI4ChdQcm90b2J1Zl9TMkNfRGlzY29ubmVjdBIQCghU",
"dW5uZWxJRBgBIAEoDRILCgNJZHgYAiABKA0iTgoRUHJvdG9idWZfQzJTX0RB",
"VEESEAoIVHVubmVsSUQYASABKA0SCwoDSWR4GAIgASgNEhoKEkh1bnRlck5l",
"dENvcmVfRGF0YRgDIAEoDCJOChFQcm90b2J1Zl9TMkNfREFUQRIQCghUdW5u",
"ZWxJRBgBIAEoDRILCgNJZHgYAiABKA0SGgoSSHVudGVyTmV0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USFgoSRGV2aWNlVHlwZV9E",
"ZWZhdWx0EAASBgoCUEMQARILCgdBbmRyb2lkEAISBwoDSU9TEAMSBwoDUFNW",
"EAQqTgoRTG9naW5SZXN1bHRTdGF0dXMSIQodTG9naW5SZXN1bHRTdGF0dXNf",
"QmFzZURlZmF1bHQQABIGCgJPSxABEg4KCkFjY291bnRFcnIQAkICSAFiBnBy",
"b3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::AxibugProtobuf.CommandID), typeof(global::AxibugProtobuf.ErrorCode), typeof(global::AxibugProtobuf.LoginType), typeof(global::AxibugProtobuf.DeviceType), typeof(global::AxibugProtobuf.LoginResultStatus), }, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Login), global::AxibugProtobuf.Protobuf_Login.Parser, new[]{ "LoginType", "DeviceType", "Account", "Password" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Login_RESP), global::AxibugProtobuf.Protobuf_Login_RESP.Parser, new[]{ "Token", "LastLoginDate", "RegDate", "Status" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs), global::AxibugProtobuf.Protobuf_Cfgs.Parser, new[]{ "Cfgs" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs_Single), global::AxibugProtobuf.Protobuf_Cfgs_Single.Parser, new[]{ "TunnelID", "IP", "Port" }, 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" }, 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),
@ -952,7 +953,6 @@ namespace AxibugProtobuf {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_Cfgs_Single(Protobuf_Cfgs_Single other) : this() {
tunnelID_ = other.tunnelID_;
iP_ = other.iP_;
port_ = other.port_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
@ -976,22 +976,8 @@ namespace AxibugProtobuf {
}
}
/// <summary>Field number for the "IP" field.</summary>
public const int IPFieldNumber = 2;
private string iP_ = "";
/// <summary>
///IP
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string IP {
get { return iP_; }
set {
iP_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "Port" field.</summary>
public const int PortFieldNumber = 3;
public const int PortFieldNumber = 2;
private int port_;
/// <summary>
///端口
@ -1018,7 +1004,6 @@ namespace AxibugProtobuf {
return true;
}
if (TunnelID != other.TunnelID) return false;
if (IP != other.IP) return false;
if (Port != other.Port) return false;
return Equals(_unknownFields, other._unknownFields);
}
@ -1027,7 +1012,6 @@ namespace AxibugProtobuf {
public override int GetHashCode() {
int hash = 1;
if (TunnelID != 0) hash ^= TunnelID.GetHashCode();
if (IP.Length != 0) hash ^= IP.GetHashCode();
if (Port != 0) hash ^= Port.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
@ -1049,12 +1033,8 @@ namespace AxibugProtobuf {
output.WriteRawTag(8);
output.WriteUInt32(TunnelID);
}
if (IP.Length != 0) {
output.WriteRawTag(18);
output.WriteString(IP);
}
if (Port != 0) {
output.WriteRawTag(24);
output.WriteRawTag(16);
output.WriteInt32(Port);
}
if (_unknownFields != null) {
@ -1070,12 +1050,8 @@ namespace AxibugProtobuf {
output.WriteRawTag(8);
output.WriteUInt32(TunnelID);
}
if (IP.Length != 0) {
output.WriteRawTag(18);
output.WriteString(IP);
}
if (Port != 0) {
output.WriteRawTag(24);
output.WriteRawTag(16);
output.WriteInt32(Port);
}
if (_unknownFields != null) {
@ -1090,9 +1066,6 @@ namespace AxibugProtobuf {
if (TunnelID != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(TunnelID);
}
if (IP.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(IP);
}
if (Port != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Port);
}
@ -1110,9 +1083,6 @@ namespace AxibugProtobuf {
if (other.TunnelID != 0) {
TunnelID = other.TunnelID;
}
if (other.IP.Length != 0) {
IP = other.IP;
}
if (other.Port != 0) {
Port = other.Port;
}
@ -1134,11 +1104,7 @@ namespace AxibugProtobuf {
TunnelID = input.ReadUInt32();
break;
}
case 18: {
IP = input.ReadString();
break;
}
case 24: {
case 16: {
Port = input.ReadInt32();
break;
}
@ -1160,11 +1126,7 @@ namespace AxibugProtobuf {
TunnelID = input.ReadUInt32();
break;
}
case 18: {
IP = input.ReadString();
break;
}
case 24: {
case 16: {
Port = input.ReadInt32();
break;
}
@ -1854,6 +1816,7 @@ namespace AxibugProtobuf {
public Protobuf_S2C_Connect(Protobuf_S2C_Connect other) : this() {
tunnelID_ = other.tunnelID_;
idx_ = other.idx_;
connected_ = other.connected_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
@ -1890,6 +1853,20 @@ namespace AxibugProtobuf {
}
}
/// <summary>Field number for the "Connected" field.</summary>
public const int ConnectedFieldNumber = 3;
private uint connected_;
/// <summary>
///[0]连接失败 [1]连接成功
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public uint Connected {
get { return connected_; }
set {
connected_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Protobuf_S2C_Connect);
@ -1905,6 +1882,7 @@ namespace AxibugProtobuf {
}
if (TunnelID != other.TunnelID) return false;
if (Idx != other.Idx) return false;
if (Connected != other.Connected) return false;
return Equals(_unknownFields, other._unknownFields);
}
@ -1913,6 +1891,7 @@ namespace AxibugProtobuf {
int hash = 1;
if (TunnelID != 0) hash ^= TunnelID.GetHashCode();
if (Idx != 0) hash ^= Idx.GetHashCode();
if (Connected != 0) hash ^= Connected.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
@ -1937,6 +1916,10 @@ namespace AxibugProtobuf {
output.WriteRawTag(16);
output.WriteUInt32(Idx);
}
if (Connected != 0) {
output.WriteRawTag(24);
output.WriteUInt32(Connected);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
@ -1954,6 +1937,10 @@ namespace AxibugProtobuf {
output.WriteRawTag(16);
output.WriteUInt32(Idx);
}
if (Connected != 0) {
output.WriteRawTag(24);
output.WriteUInt32(Connected);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
@ -1969,6 +1956,9 @@ namespace AxibugProtobuf {
if (Idx != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Idx);
}
if (Connected != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Connected);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
@ -1986,6 +1976,9 @@ namespace AxibugProtobuf {
if (other.Idx != 0) {
Idx = other.Idx;
}
if (other.Connected != 0) {
Connected = other.Connected;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
@ -2008,6 +2001,10 @@ namespace AxibugProtobuf {
Idx = input.ReadUInt32();
break;
}
case 24: {
Connected = input.ReadUInt32();
break;
}
}
}
#endif
@ -2030,6 +2027,10 @@ namespace AxibugProtobuf {
Idx = input.ReadUInt32();
break;
}
case 24: {
Connected = input.ReadUInt32();
break;
}
}
}
}

View File

@ -0,0 +1,17 @@
using System.Text;
namespace NoSugarNet.ServerCore.Common
{
public struct TunnelClientData
{
public byte TunnelId;
public string ServerLocalIP;
public ushort ServerLocalPort;
public ushort ClientLocalPort;
}
public static class Config
{
public static Dictionary<byte, TunnelClientData> Cfgs = new Dictionary<byte, TunnelClientData>();
}
}

View File

@ -10,13 +10,6 @@ namespace ServerCore.Manager
{
public class LocalClientManager
{
struct TunnelClientData
{
public string IP;
public ushort Port;
}
Dictionary<byte, TunnelClientData> mDictTunnelID2Cfg = new Dictionary<byte, TunnelClientData>();
Dictionary<long, ServerLocalClient> mDictCommKey2ServerLocalClients = new Dictionary<long, ServerLocalClient>();
CompressAdapter mCompressAdapter;
@ -115,23 +108,32 @@ namespace ServerCore.Manager
/// <param name="tunnelId"></param>
void OnClientLocalConnect(long uid, byte tunnelId,int Idx)
{
ServerManager.g_Log.Debug($"OnClientLocalConnect {uid},{tunnelId},{Idx}");
if (!ServerManager.g_ClientMgr.GetClientByUID(uid, out ClientInfo client))
return;
if (!mDictTunnelID2Cfg.ContainsKey(tunnelId))
if (!Config.Cfgs.ContainsKey(tunnelId))
return;
//开一个线程去建立连接
Thread thread = new Thread(() =>
{
//服务器本地局域网连接指定端口
TunnelClientData tunnelDataCfg = mDictTunnelID2Cfg[tunnelId];
ServerLocalClient serverLocalClient = new ServerLocalClient(tunnelId, (byte)Idx);
TunnelClientData tunnelDataCfg = Config.Cfgs[tunnelId];
ServerLocalClient serverLocalClient = new ServerLocalClient(uid, tunnelId, (byte)Idx);
//连接成功
if (!serverLocalClient.Init(tunnelDataCfg.IP, tunnelDataCfg.Port))
if (!serverLocalClient.Init(tunnelDataCfg.ServerLocalIP, tunnelDataCfg.ServerLocalPort))
{
//连接失败
//TODO告知客户端连接失败
byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_S2C_Connect()
{
TunnelID = tunnelId,
Idx = (uint)Idx,
Connected = 0//失败
});
//发送给客户端,指定服务端本地端口已连接
ServerManager.g_ClientMgr.ClientSend(client, (int)CommandID.CmdTunnelS2CConnect, (int)ErrorCode.ErrorOk, respData);
}
});
thread.Start();
@ -143,6 +145,7 @@ namespace ServerCore.Manager
/// <param name="tunnelId"></param>
void OnClientLocalDisconnect(long uid, byte tunnelId,byte Idx)
{
ServerManager.g_Log.Debug($"OnClientLocalDisconnect {uid},{tunnelId},{Idx}");
if (!ServerManager.g_ClientMgr.GetClientByUID(uid, out ClientInfo client))
return;
@ -162,6 +165,7 @@ namespace ServerCore.Manager
/// <param name="tunnelId"></param>
public void OnServerLocalConnect(long uid, byte tunnelId, byte Idx, ServerLocalClient serverLocalClient)
{
ServerManager.g_Log.Debug($"OnServerLocalConnect {uid},{tunnelId},{Idx}");
if (!ServerManager.g_ClientMgr.GetClientByUID(uid, out ClientInfo client))
return;
@ -172,6 +176,7 @@ namespace ServerCore.Manager
{
TunnelID = tunnelId,
Idx = Idx,
Connected = 1
});
//发送给客户端,指定服务端本地端口已连接
ServerManager.g_ClientMgr.ClientSend(client, (int)CommandID.CmdTunnelS2CConnect, (int)ErrorCode.ErrorOk, respData);
@ -183,6 +188,7 @@ namespace ServerCore.Manager
/// <param name="tunnelId"></param>
public void OnServerLocalDisconnect(long uid, byte tunnelId, byte Idx, ServerLocalClient serverLocalClient)
{
ServerManager.g_Log.Debug($"OnServerLocalDisconnect {uid},{tunnelId},{Idx}");
if (!ServerManager.g_ClientMgr.GetClientByUID(uid, out ClientInfo client))
return;
//添加到服务端本地连接列表
@ -207,6 +213,7 @@ namespace ServerCore.Manager
/// <param name="data"></param>
public void OnServerLocalDataCallBack(long uid, byte tunnelId,byte Idx, byte[] data)
{
ServerManager.g_Log.Debug($"OnServerLocalDataCallBack {uid},{tunnelId},{Idx}");
if (!ServerManager.g_ClientMgr.GetClientByUID(uid, out ClientInfo client))
return;
@ -230,6 +237,7 @@ namespace ServerCore.Manager
/// <param name="data"></param>
public void OnClientTunnelDataCallBack(long uid, byte tunnelId, byte Idx, byte[] data)
{
ServerManager.g_Log.Debug($"OnClientTunnelDataCallBack {uid},{tunnelId},{Idx}");
//隧道ID定位投递服务端本地连接
if (!GetServerLocalClient(uid, tunnelId, Idx, out ServerLocalClient serverLocalClient))
return;

View File

@ -1,4 +1,5 @@
using AxibugProtobuf;
using NoSugarNet.ServerCore.Common;
using ServerCore.Common;
using ServerCore.NetWork;
using System.Net.Sockets;
@ -29,10 +30,12 @@ namespace ServerCore.Manager
ServerManager.g_ClientMgr.ClientSend(cinfo, (int)CommandID.CmdLogin, (int)ErrorCode.ErrorOk, respData);
Protobuf_Cfgs cfgsSP = new Protobuf_Cfgs();
cfgsSP.Cfgs.Add(new Protobuf_Cfgs_Single { TunnelID = 0, IP = "127.0.0.1", Port = 10001 });
cfgsSP.Cfgs.Add(new Protobuf_Cfgs_Single { TunnelID = 1, IP = "127.0.0.1", Port = 10002 });
cfgsSP.Cfgs.Add(new Protobuf_Cfgs_Single { TunnelID = 2, IP = "127.0.0.1", Port = 10003 });
cfgsSP.Cfgs.Add(new Protobuf_Cfgs_Single { TunnelID = 3, IP = "127.0.0.1", Port = 10004 });
byte[] keys = Config.Cfgs.Keys.ToArray();
for (int i = 0; i < Config.Cfgs.Count; i++)
{
TunnelClientData cfg = Config.Cfgs[keys[i]];
cfgsSP.Cfgs.Add(new Protobuf_Cfgs_Single() { TunnelID = cfg.TunnelId, Port = cfg.ClientLocalPort });
}
byte[] respDataCfg = ProtoBufHelper.Serizlize(cfgsSP);
ServerManager.g_ClientMgr.ClientSend(cinfo, (int)CommandID.CmdCfgs, (int)ErrorCode.ErrorOk, respDataCfg);

View File

@ -1,5 +1,6 @@
using HaoYueNet.ClientNetwork.OtherMode;
using ServerCore.Manager;
using System;
namespace NoSugarNet.ClientCore.Network
{
@ -11,8 +12,9 @@ namespace NoSugarNet.ClientCore.Network
public long mUID;
public byte mTunnelID;
public byte mIdx;
public ServerLocalClient(byte TunnelID, byte Idx)
public ServerLocalClient(long UID,byte TunnelID, byte Idx)
{
mUID = UID;
mTunnelID = TunnelID;
mIdx = Idx;
//指定接收服务器数据事件

View File

@ -1,4 +1,6 @@
using ServerCore.NetWork;
using NoSugarNet.ServerCore.Common;
using ServerCore.NetWork;
using ServerCore.Common;
using System.Net;
namespace ServerCore.Manager
@ -12,8 +14,9 @@ namespace ServerCore.Manager
public static LocalClientManager g_Local;
public static IOCPNetWork g_SocketMgr;
public static void InitServer(int port)
public static void InitServer(int port, Dictionary<byte, TunnelClientData> cfgs)
{
Config.Cfgs = cfgs;
g_ClientMgr = new ClientManager();
g_ClientMgr.Init(45000, 120);
g_Log = new LogManager();

View File

@ -32,42 +32,43 @@ namespace AxibugProtobuf {
"CRIVCg1MYXN0TG9naW5EYXRlGAIgASgJEg8KB1JlZ0RhdGUYAyAB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XN1bHRTdGF0dXNf",
"QmFzZURlZmF1bHQQABIGCgJPSxABEg4KCkFjY291bnRFcnIQAkICSAFiBnBy",
"b3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::AxibugProtobuf.CommandID), typeof(global::AxibugProtobuf.ErrorCode), typeof(global::AxibugProtobuf.LoginType), typeof(global::AxibugProtobuf.DeviceType), typeof(global::AxibugProtobuf.LoginResultStatus), }, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Login), global::AxibugProtobuf.Protobuf_Login.Parser, new[]{ "LoginType", "DeviceType", "Account", "Password" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Login_RESP), global::AxibugProtobuf.Protobuf_Login_RESP.Parser, new[]{ "Token", "LastLoginDate", "RegDate", "Status" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs), global::AxibugProtobuf.Protobuf_Cfgs.Parser, new[]{ "Cfgs" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs_Single), global::AxibugProtobuf.Protobuf_Cfgs_Single.Parser, new[]{ "TunnelID", "IP", "Port" }, 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" }, 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),
@ -952,7 +953,6 @@ namespace AxibugProtobuf {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_Cfgs_Single(Protobuf_Cfgs_Single other) : this() {
tunnelID_ = other.tunnelID_;
iP_ = other.iP_;
port_ = other.port_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
@ -976,22 +976,8 @@ namespace AxibugProtobuf {
}
}
/// <summary>Field number for the "IP" field.</summary>
public const int IPFieldNumber = 2;
private string iP_ = "";
/// <summary>
///IP
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string IP {
get { return iP_; }
set {
iP_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "Port" field.</summary>
public const int PortFieldNumber = 3;
public const int PortFieldNumber = 2;
private int port_;
/// <summary>
///端口
@ -1018,7 +1004,6 @@ namespace AxibugProtobuf {
return true;
}
if (TunnelID != other.TunnelID) return false;
if (IP != other.IP) return false;
if (Port != other.Port) return false;
return Equals(_unknownFields, other._unknownFields);
}
@ -1027,7 +1012,6 @@ namespace AxibugProtobuf {
public override int GetHashCode() {
int hash = 1;
if (TunnelID != 0) hash ^= TunnelID.GetHashCode();
if (IP.Length != 0) hash ^= IP.GetHashCode();
if (Port != 0) hash ^= Port.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
@ -1049,12 +1033,8 @@ namespace AxibugProtobuf {
output.WriteRawTag(8);
output.WriteUInt32(TunnelID);
}
if (IP.Length != 0) {
output.WriteRawTag(18);
output.WriteString(IP);
}
if (Port != 0) {
output.WriteRawTag(24);
output.WriteRawTag(16);
output.WriteInt32(Port);
}
if (_unknownFields != null) {
@ -1070,12 +1050,8 @@ namespace AxibugProtobuf {
output.WriteRawTag(8);
output.WriteUInt32(TunnelID);
}
if (IP.Length != 0) {
output.WriteRawTag(18);
output.WriteString(IP);
}
if (Port != 0) {
output.WriteRawTag(24);
output.WriteRawTag(16);
output.WriteInt32(Port);
}
if (_unknownFields != null) {
@ -1090,9 +1066,6 @@ namespace AxibugProtobuf {
if (TunnelID != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(TunnelID);
}
if (IP.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(IP);
}
if (Port != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Port);
}
@ -1110,9 +1083,6 @@ namespace AxibugProtobuf {
if (other.TunnelID != 0) {
TunnelID = other.TunnelID;
}
if (other.IP.Length != 0) {
IP = other.IP;
}
if (other.Port != 0) {
Port = other.Port;
}
@ -1134,11 +1104,7 @@ namespace AxibugProtobuf {
TunnelID = input.ReadUInt32();
break;
}
case 18: {
IP = input.ReadString();
break;
}
case 24: {
case 16: {
Port = input.ReadInt32();
break;
}
@ -1160,11 +1126,7 @@ namespace AxibugProtobuf {
TunnelID = input.ReadUInt32();
break;
}
case 18: {
IP = input.ReadString();
break;
}
case 24: {
case 16: {
Port = input.ReadInt32();
break;
}
@ -1854,6 +1816,7 @@ namespace AxibugProtobuf {
public Protobuf_S2C_Connect(Protobuf_S2C_Connect other) : this() {
tunnelID_ = other.tunnelID_;
idx_ = other.idx_;
connected_ = other.connected_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
@ -1890,6 +1853,20 @@ namespace AxibugProtobuf {
}
}
/// <summary>Field number for the "Connected" field.</summary>
public const int ConnectedFieldNumber = 3;
private uint connected_;
/// <summary>
///[0]连接失败 [1]连接成功
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public uint Connected {
get { return connected_; }
set {
connected_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Protobuf_S2C_Connect);
@ -1905,6 +1882,7 @@ namespace AxibugProtobuf {
}
if (TunnelID != other.TunnelID) return false;
if (Idx != other.Idx) return false;
if (Connected != other.Connected) return false;
return Equals(_unknownFields, other._unknownFields);
}
@ -1913,6 +1891,7 @@ namespace AxibugProtobuf {
int hash = 1;
if (TunnelID != 0) hash ^= TunnelID.GetHashCode();
if (Idx != 0) hash ^= Idx.GetHashCode();
if (Connected != 0) hash ^= Connected.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
@ -1937,6 +1916,10 @@ namespace AxibugProtobuf {
output.WriteRawTag(16);
output.WriteUInt32(Idx);
}
if (Connected != 0) {
output.WriteRawTag(24);
output.WriteUInt32(Connected);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
@ -1954,6 +1937,10 @@ namespace AxibugProtobuf {
output.WriteRawTag(16);
output.WriteUInt32(Idx);
}
if (Connected != 0) {
output.WriteRawTag(24);
output.WriteUInt32(Connected);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
@ -1969,6 +1956,9 @@ namespace AxibugProtobuf {
if (Idx != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Idx);
}
if (Connected != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Connected);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
@ -1986,6 +1976,9 @@ namespace AxibugProtobuf {
if (other.Idx != 0) {
Idx = other.Idx;
}
if (other.Connected != 0) {
Connected = other.Connected;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
@ -2008,6 +2001,10 @@ namespace AxibugProtobuf {
Idx = input.ReadUInt32();
break;
}
case 24: {
Connected = input.ReadUInt32();
break;
}
}
}
#endif
@ -2030,6 +2027,10 @@ namespace AxibugProtobuf {
Idx = input.ReadUInt32();
break;
}
case 24: {
Connected = input.ReadUInt32();
break;
}
}
}
}

View File

@ -32,42 +32,43 @@ namespace AxibugProtobuf {
"CRIVCg1MYXN0TG9naW5EYXRlGAIgASgJEg8KB1JlZ0RhdGUYAyABKAkSMQoG",
"U3RhdHVzGAQgASgOMiEuQXhpYnVnUHJvdG9idWYuTG9naW5SZXN1bHRTdGF0",
"dXMiQwoNUHJvdG9idWZfQ2ZncxIyCgRjZmdzGAEgAygLMiQuQXhpYnVnUHJv",
"dG9idWYuUHJvdG9idWZfQ2Znc19TaW5nbGUiQgoUUHJvdG9idWZfQ2Znc19T",
"aW5nbGUSEAoIVHVubmVsSUQYASABKA0SCgoCSVAYAiABKAkSDAoEUG9ydBgD",
"IAEoBSIjChBQcm90b2J1Zl9DaGF0TXNnEg8KB0NoYXRNc2cYASABKAkiSAoV",
"UHJvdG9idWZfQ2hhdE1zZ19SRVNQEhAKCE5pY2tOYW1lGAEgASgJEg8KB0No",
"YXRNc2cYAiABKAkSDAoERGF0ZRgDIAEoAyI1ChRQcm90b2J1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VUwQABIO",
"CglDTURfTE9HSU4Q0Q8SDQoIQ01EX0NGR1MQuRcSEAoLQ01EX0NIQVRNU0cQ",
"oR8SGwoWQ01EX1RVTk5FTF9DMlNfQ09OTkVDVBCIJxIbChZDTURfVFVOTkVM",
"X1MyQ19DT05ORUNUEIknEh4KGUNNRF9UVU5ORUxfQzJTX0RJU0NPTk5FQ1QQ",
"iicSHgoZQ01EX1RVTk5FTF9TMkNfRElTQ09OTkVDVBCLJxIYChNDTURfVFVO",
"TkVMX0MyU19EQVRBEIwnEhgKE0NNRF9UVU5ORUxfUzJDX0RBVEEQjScqKwoJ",
"RXJyb3JDb2RlEhAKDEVSUk9SX0RFRkFVTBAAEgwKCEVSUk9SX09LEAEqPgoJ",
"TG9naW5UeXBlEg8KC0Jhc2VEZWZhdWx0EAASDgoKSGFvWXVlQXV0aBABEgcK",
"A0JGMxADEgcKA0JGNBAEKksKCkRldmljZVR5cGUSFgoSRGV2aWNlVHlwZV9E",
"ZWZhdWx0EAASBgoCUEMQARILCgdBbmRyb2lkEAISBwoDSU9TEAMSBwoDUFNW",
"EAQqTgoRTG9naW5SZXN1bHRTdGF0dXMSIQodTG9naW5SZXN1bHRTdGF0dXNf",
"QmFzZURlZmF1bHQQABIGCgJPSxABEg4KCkFjY291bnRFcnIQAkICSAFiBnBy",
"b3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::AxibugProtobuf.CommandID), typeof(global::AxibugProtobuf.ErrorCode), typeof(global::AxibugProtobuf.LoginType), typeof(global::AxibugProtobuf.DeviceType), typeof(global::AxibugProtobuf.LoginResultStatus), }, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Login), global::AxibugProtobuf.Protobuf_Login.Parser, new[]{ "LoginType", "DeviceType", "Account", "Password" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Login_RESP), global::AxibugProtobuf.Protobuf_Login_RESP.Parser, new[]{ "Token", "LastLoginDate", "RegDate", "Status" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs), global::AxibugProtobuf.Protobuf_Cfgs.Parser, new[]{ "Cfgs" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs_Single), global::AxibugProtobuf.Protobuf_Cfgs_Single.Parser, new[]{ "TunnelID", "IP", "Port" }, 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" }, 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),
@ -952,7 +953,6 @@ namespace AxibugProtobuf {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_Cfgs_Single(Protobuf_Cfgs_Single other) : this() {
tunnelID_ = other.tunnelID_;
iP_ = other.iP_;
port_ = other.port_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
@ -976,22 +976,8 @@ namespace AxibugProtobuf {
}
}
/// <summary>Field number for the "IP" field.</summary>
public const int IPFieldNumber = 2;
private string iP_ = "";
/// <summary>
///IP
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string IP {
get { return iP_; }
set {
iP_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "Port" field.</summary>
public const int PortFieldNumber = 3;
public const int PortFieldNumber = 2;
private int port_;
/// <summary>
///端口
@ -1018,7 +1004,6 @@ namespace AxibugProtobuf {
return true;
}
if (TunnelID != other.TunnelID) return false;
if (IP != other.IP) return false;
if (Port != other.Port) return false;
return Equals(_unknownFields, other._unknownFields);
}
@ -1027,7 +1012,6 @@ namespace AxibugProtobuf {
public override int GetHashCode() {
int hash = 1;
if (TunnelID != 0) hash ^= TunnelID.GetHashCode();
if (IP.Length != 0) hash ^= IP.GetHashCode();
if (Port != 0) hash ^= Port.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
@ -1049,12 +1033,8 @@ namespace AxibugProtobuf {
output.WriteRawTag(8);
output.WriteUInt32(TunnelID);
}
if (IP.Length != 0) {
output.WriteRawTag(18);
output.WriteString(IP);
}
if (Port != 0) {
output.WriteRawTag(24);
output.WriteRawTag(16);
output.WriteInt32(Port);
}
if (_unknownFields != null) {
@ -1070,12 +1050,8 @@ namespace AxibugProtobuf {
output.WriteRawTag(8);
output.WriteUInt32(TunnelID);
}
if (IP.Length != 0) {
output.WriteRawTag(18);
output.WriteString(IP);
}
if (Port != 0) {
output.WriteRawTag(24);
output.WriteRawTag(16);
output.WriteInt32(Port);
}
if (_unknownFields != null) {
@ -1090,9 +1066,6 @@ namespace AxibugProtobuf {
if (TunnelID != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(TunnelID);
}
if (IP.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(IP);
}
if (Port != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Port);
}
@ -1110,9 +1083,6 @@ namespace AxibugProtobuf {
if (other.TunnelID != 0) {
TunnelID = other.TunnelID;
}
if (other.IP.Length != 0) {
IP = other.IP;
}
if (other.Port != 0) {
Port = other.Port;
}
@ -1134,11 +1104,7 @@ namespace AxibugProtobuf {
TunnelID = input.ReadUInt32();
break;
}
case 18: {
IP = input.ReadString();
break;
}
case 24: {
case 16: {
Port = input.ReadInt32();
break;
}
@ -1160,11 +1126,7 @@ namespace AxibugProtobuf {
TunnelID = input.ReadUInt32();
break;
}
case 18: {
IP = input.ReadString();
break;
}
case 24: {
case 16: {
Port = input.ReadInt32();
break;
}
@ -1854,6 +1816,7 @@ namespace AxibugProtobuf {
public Protobuf_S2C_Connect(Protobuf_S2C_Connect other) : this() {
tunnelID_ = other.tunnelID_;
idx_ = other.idx_;
connected_ = other.connected_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
@ -1890,6 +1853,20 @@ namespace AxibugProtobuf {
}
}
/// <summary>Field number for the "Connected" field.</summary>
public const int ConnectedFieldNumber = 3;
private uint connected_;
/// <summary>
///[0]连接失败 [1]连接成功
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public uint Connected {
get { return connected_; }
set {
connected_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Protobuf_S2C_Connect);
@ -1905,6 +1882,7 @@ namespace AxibugProtobuf {
}
if (TunnelID != other.TunnelID) return false;
if (Idx != other.Idx) return false;
if (Connected != other.Connected) return false;
return Equals(_unknownFields, other._unknownFields);
}
@ -1913,6 +1891,7 @@ namespace AxibugProtobuf {
int hash = 1;
if (TunnelID != 0) hash ^= TunnelID.GetHashCode();
if (Idx != 0) hash ^= Idx.GetHashCode();
if (Connected != 0) hash ^= Connected.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
@ -1937,6 +1916,10 @@ namespace AxibugProtobuf {
output.WriteRawTag(16);
output.WriteUInt32(Idx);
}
if (Connected != 0) {
output.WriteRawTag(24);
output.WriteUInt32(Connected);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
@ -1954,6 +1937,10 @@ namespace AxibugProtobuf {
output.WriteRawTag(16);
output.WriteUInt32(Idx);
}
if (Connected != 0) {
output.WriteRawTag(24);
output.WriteUInt32(Connected);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
@ -1969,6 +1956,9 @@ namespace AxibugProtobuf {
if (Idx != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Idx);
}
if (Connected != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Connected);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
@ -1986,6 +1976,9 @@ namespace AxibugProtobuf {
if (other.Idx != 0) {
Idx = other.Idx;
}
if (other.Connected != 0) {
Connected = other.Connected;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
@ -2008,6 +2001,10 @@ namespace AxibugProtobuf {
Idx = input.ReadUInt32();
break;
}
case 24: {
Connected = input.ReadUInt32();
break;
}
}
}
#endif
@ -2030,6 +2027,10 @@ namespace AxibugProtobuf {
Idx = input.ReadUInt32();
break;
}
case 24: {
Connected = input.ReadUInt32();
break;
}
}
}
}

View File

@ -78,8 +78,7 @@ message Protobuf_Cfgs
message Protobuf_Cfgs_Single
{
uint32 TunnelID = 1;//TunnelID
string IP = 2;//IP
int32 Port = 3;//
int32 Port = 2;//
}
//
@ -107,6 +106,7 @@ message Protobuf_S2C_Connect
{
uint32 TunnelID = 1;//TunnelID
uint32 Idx = 2;//
uint32 Connected = 3;//[0] [1]
}
message Protobuf_C2S_Disconnect

View File

@ -7,6 +7,10 @@ namespace NoSugarNet.ClientCli
static void Main(string[] args)
{
AppNoSugarNet.Init("127.0.0.1", 1000);
while (true)
{
Console.ReadLine();
}
}
}
}

View File

@ -0,0 +1,48 @@
using NoSugarNet.ServerCore.Common;
using System.Text;
namespace NoSugarNet.ServerCli
{
public static class Config
{
public static Dictionary<byte, TunnelClientData> Cfgs = new Dictionary<byte, TunnelClientData>();
public static bool LoadConfig()
{
try
{
StreamReader sr = new StreamReader(System.Environment.CurrentDirectory + "//config.cfg", Encoding.Default);
String line;
while (!string.IsNullOrEmpty((line = sr.ReadLine())))
{
if (!line.Contains(":"))
continue;
try
{
TunnelClientData cfg = new TunnelClientData()
{
TunnelId = Convert.ToByte(line.Split(':')[0].Trim()),
ServerLocalIP = line.Split(':')[1].Trim(),
ServerLocalPort = Convert.ToUInt16(line.Split(':')[2].Trim()),
ClientLocalPort = Convert.ToUInt16(line.Split(':')[3].Trim())
};
Cfgs[cfg.TunnelId] = cfg;
}
catch
{
continue;
}
}
sr.Close();
if (Cfgs.Count > 0)
return true;
else
return false;
}
catch (Exception ex)
{
Console.WriteLine("配置文件异常:" + ex.ToString());
return false;
}
}
}
}

View File

@ -7,6 +7,14 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<None Remove="config.cfg" />
</ItemGroup>
<ItemGroup>
<Page Include="config.cfg" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\NoSugarNet.ServerCore\NoSugarNet.ServerCore.csproj" />
</ItemGroup>

View File

@ -6,7 +6,14 @@ namespace NoSugarNet.ServerCli
{
static void Main(string[] args)
{
ServerManager.InitServer(1000);
if (!Config.LoadConfig())
{
Console.WriteLine("配置文件错误");
Console.ReadLine();
return;
}
ServerManager.InitServer(1000,Config.Cfgs);
while (true)
{
Console.ReadLine();

View File

@ -0,0 +1,4 @@
0:127.0.0.1:3306:10001
1:127.0.0.1:3306:10002
2:127.0.0.1:3306:10003
3:127.0.0.1:3306:10004