最初の代理通讯成功

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) catch (Exception e)
{ {
App.log.Error(e.Message); AppNoSugarNet.log.Error(e.Message);
} }
} }
} }
@ -152,7 +152,7 @@
} }
catch (Exception e) catch (Exception e)
{ {
App.log.Error(e.Message); AppNoSugarNet.log.Error(e.Message);
} }
} }
} }
@ -171,7 +171,7 @@
} }
catch (Exception e) catch (Exception e)
{ {
App.log.Error(e.Message); AppNoSugarNet.log.Error(e.Message);
} }
} }
} }
@ -190,7 +190,7 @@
} }
catch (Exception e) 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) 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, 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) public void RecvChatMsg(byte[] reqData)

View File

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

View File

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

View File

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

View File

@ -32,42 +32,43 @@ namespace AxibugProtobuf {
"CRIVCg1MYXN0TG9naW5EYXRlGAIgASgJEg8KB1JlZ0RhdGUYAyABKAkSMQoG", "CRIVCg1MYXN0TG9naW5EYXRlGAIgASgJEg8KB1JlZ0RhdGUYAyABKAkSMQoG",
"U3RhdHVzGAQgASgOMiEuQXhpYnVnUHJvdG9idWYuTG9naW5SZXN1bHRTdGF0", "U3RhdHVzGAQgASgOMiEuQXhpYnVnUHJvdG9idWYuTG9naW5SZXN1bHRTdGF0",
"dXMiQwoNUHJvdG9idWZfQ2ZncxIyCgRjZmdzGAEgAygLMiQuQXhpYnVnUHJv", "dXMiQwoNUHJvdG9idWZfQ2ZncxIyCgRjZmdzGAEgAygLMiQuQXhpYnVnUHJv",
"dG9idWYuUHJvdG9idWZfQ2Znc19TaW5nbGUiQgoUUHJvdG9idWZfQ2Znc19T", "dG9idWYuUHJvdG9idWZfQ2Znc19TaW5nbGUiNgoUUHJvdG9idWZfQ2Znc19T",
"aW5nbGUSEAoIVHVubmVsSUQYASABKA0SCgoCSVAYAiABKAkSDAoEUG9ydBgD", "aW5nbGUSEAoIVHVubmVsSUQYASABKA0SDAoEUG9ydBgCIAEoBSIjChBQcm90",
"IAEoBSIjChBQcm90b2J1Zl9DaGF0TXNnEg8KB0NoYXRNc2cYASABKAkiSAoV", "b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RlEhAKDEVSUk9SX0RFRkFVTBAAEgwKCEVSUk9SX09LEAEqPgoJ",
"cGUSDwoLQmFzZURlZmF1bHQQABIOCgpIYW9ZdWVBdXRoEAESBwoDQkYzEAMS", "TG9naW5UeXBlEg8KC0Jhc2VEZWZhdWx0EAASDgoKSGFvWXVlQXV0aBABEgcK",
"BwoDQkY0EAQqSwoKRGV2aWNlVHlwZRIWChJEZXZpY2VUeXBlX0RlZmF1bHQQ", "A0JGMxADEgcKA0JGNBAEKksKCkRldmljZVR5cGUSFgoSRGV2aWNlVHlwZV9E",
"ABIGCgJQQxABEgsKB0FuZHJvaWQQAhIHCgNJT1MQAxIHCgNQU1YQBCpOChFM", "ZWZhdWx0EAASBgoCUEMQARILCgdBbmRyb2lkEAISBwoDSU9TEAMSBwoDUFNW",
"b2dpblJlc3VsdFN0YXR1cxIhCh1Mb2dpblJlc3VsdFN0YXR1c19CYXNlRGVm", "EAQqTgoRTG9naW5SZXN1bHRTdGF0dXMSIQodTG9naW5SZXN1bHRTdGF0dXNf",
"YXVsdBAAEgYKAk9LEAESDgoKQWNjb3VudEVychACQgJIAWIGcHJvdG8z")); "QmFzZURlZmF1bHQQABIGCgJPSxABEg4KCkFjY291bnRFcnIQAkICSAFiBnBy",
"b3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { }, 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(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), 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" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs), global::AxibugProtobuf.Protobuf_Cfgs.Parser, new[]{ "Cfgs" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs), global::AxibugProtobuf.Protobuf_Cfgs.Parser, new[]{ "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), 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_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_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_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_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_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] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_Cfgs_Single(Protobuf_Cfgs_Single other) : this() { public Protobuf_Cfgs_Single(Protobuf_Cfgs_Single other) : this() {
tunnelID_ = other.tunnelID_; tunnelID_ = other.tunnelID_;
iP_ = other.iP_;
port_ = other.port_; port_ = other.port_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _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> /// <summary>Field number for the "Port" field.</summary>
public const int PortFieldNumber = 3; public const int PortFieldNumber = 2;
private int port_; private int port_;
/// <summary> /// <summary>
///端口 ///端口
@ -1018,7 +1004,6 @@ namespace AxibugProtobuf {
return true; return true;
} }
if (TunnelID != other.TunnelID) return false; if (TunnelID != other.TunnelID) return false;
if (IP != other.IP) return false;
if (Port != other.Port) return false; if (Port != other.Port) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
@ -1027,7 +1012,6 @@ namespace AxibugProtobuf {
public override int GetHashCode() { public override int GetHashCode() {
int hash = 1; int hash = 1;
if (TunnelID != 0) hash ^= TunnelID.GetHashCode(); if (TunnelID != 0) hash ^= TunnelID.GetHashCode();
if (IP.Length != 0) hash ^= IP.GetHashCode();
if (Port != 0) hash ^= Port.GetHashCode(); if (Port != 0) hash ^= Port.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
@ -1049,12 +1033,8 @@ namespace AxibugProtobuf {
output.WriteRawTag(8); output.WriteRawTag(8);
output.WriteUInt32(TunnelID); output.WriteUInt32(TunnelID);
} }
if (IP.Length != 0) {
output.WriteRawTag(18);
output.WriteString(IP);
}
if (Port != 0) { if (Port != 0) {
output.WriteRawTag(24); output.WriteRawTag(16);
output.WriteInt32(Port); output.WriteInt32(Port);
} }
if (_unknownFields != null) { if (_unknownFields != null) {
@ -1070,12 +1050,8 @@ namespace AxibugProtobuf {
output.WriteRawTag(8); output.WriteRawTag(8);
output.WriteUInt32(TunnelID); output.WriteUInt32(TunnelID);
} }
if (IP.Length != 0) {
output.WriteRawTag(18);
output.WriteString(IP);
}
if (Port != 0) { if (Port != 0) {
output.WriteRawTag(24); output.WriteRawTag(16);
output.WriteInt32(Port); output.WriteInt32(Port);
} }
if (_unknownFields != null) { if (_unknownFields != null) {
@ -1090,9 +1066,6 @@ namespace AxibugProtobuf {
if (TunnelID != 0) { if (TunnelID != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(TunnelID); size += 1 + pb::CodedOutputStream.ComputeUInt32Size(TunnelID);
} }
if (IP.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(IP);
}
if (Port != 0) { if (Port != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Port); size += 1 + pb::CodedOutputStream.ComputeInt32Size(Port);
} }
@ -1110,9 +1083,6 @@ namespace AxibugProtobuf {
if (other.TunnelID != 0) { if (other.TunnelID != 0) {
TunnelID = other.TunnelID; TunnelID = other.TunnelID;
} }
if (other.IP.Length != 0) {
IP = other.IP;
}
if (other.Port != 0) { if (other.Port != 0) {
Port = other.Port; Port = other.Port;
} }
@ -1134,11 +1104,7 @@ namespace AxibugProtobuf {
TunnelID = input.ReadUInt32(); TunnelID = input.ReadUInt32();
break; break;
} }
case 18: { case 16: {
IP = input.ReadString();
break;
}
case 24: {
Port = input.ReadInt32(); Port = input.ReadInt32();
break; break;
} }
@ -1160,11 +1126,7 @@ namespace AxibugProtobuf {
TunnelID = input.ReadUInt32(); TunnelID = input.ReadUInt32();
break; break;
} }
case 18: { case 16: {
IP = input.ReadString();
break;
}
case 24: {
Port = input.ReadInt32(); Port = input.ReadInt32();
break; break;
} }
@ -1854,6 +1816,7 @@ namespace AxibugProtobuf {
public Protobuf_S2C_Connect(Protobuf_S2C_Connect other) : this() { public Protobuf_S2C_Connect(Protobuf_S2C_Connect other) : this() {
tunnelID_ = other.tunnelID_; tunnelID_ = other.tunnelID_;
idx_ = other.idx_; idx_ = other.idx_;
connected_ = other.connected_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _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] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) { public override bool Equals(object other) {
return Equals(other as Protobuf_S2C_Connect); return Equals(other as Protobuf_S2C_Connect);
@ -1905,6 +1882,7 @@ namespace AxibugProtobuf {
} }
if (TunnelID != other.TunnelID) return false; if (TunnelID != other.TunnelID) return false;
if (Idx != other.Idx) return false; if (Idx != other.Idx) return false;
if (Connected != other.Connected) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
@ -1913,6 +1891,7 @@ namespace AxibugProtobuf {
int hash = 1; int hash = 1;
if (TunnelID != 0) hash ^= TunnelID.GetHashCode(); if (TunnelID != 0) hash ^= TunnelID.GetHashCode();
if (Idx != 0) hash ^= Idx.GetHashCode(); if (Idx != 0) hash ^= Idx.GetHashCode();
if (Connected != 0) hash ^= Connected.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
} }
@ -1937,6 +1916,10 @@ namespace AxibugProtobuf {
output.WriteRawTag(16); output.WriteRawTag(16);
output.WriteUInt32(Idx); output.WriteUInt32(Idx);
} }
if (Connected != 0) {
output.WriteRawTag(24);
output.WriteUInt32(Connected);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(output); _unknownFields.WriteTo(output);
} }
@ -1954,6 +1937,10 @@ namespace AxibugProtobuf {
output.WriteRawTag(16); output.WriteRawTag(16);
output.WriteUInt32(Idx); output.WriteUInt32(Idx);
} }
if (Connected != 0) {
output.WriteRawTag(24);
output.WriteUInt32(Connected);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(ref output); _unknownFields.WriteTo(ref output);
} }
@ -1969,6 +1956,9 @@ namespace AxibugProtobuf {
if (Idx != 0) { if (Idx != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Idx); size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Idx);
} }
if (Connected != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Connected);
}
if (_unknownFields != null) { if (_unknownFields != null) {
size += _unknownFields.CalculateSize(); size += _unknownFields.CalculateSize();
} }
@ -1986,6 +1976,9 @@ namespace AxibugProtobuf {
if (other.Idx != 0) { if (other.Idx != 0) {
Idx = other.Idx; Idx = other.Idx;
} }
if (other.Connected != 0) {
Connected = other.Connected;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
} }
@ -2008,6 +2001,10 @@ namespace AxibugProtobuf {
Idx = input.ReadUInt32(); Idx = input.ReadUInt32();
break; break;
} }
case 24: {
Connected = input.ReadUInt32();
break;
}
} }
} }
#endif #endif
@ -2030,6 +2027,10 @@ namespace AxibugProtobuf {
Idx = input.ReadUInt32(); Idx = input.ReadUInt32();
break; 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 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>(); Dictionary<long, ServerLocalClient> mDictCommKey2ServerLocalClients = new Dictionary<long, ServerLocalClient>();
CompressAdapter mCompressAdapter; CompressAdapter mCompressAdapter;
@ -115,23 +108,32 @@ namespace ServerCore.Manager
/// <param name="tunnelId"></param> /// <param name="tunnelId"></param>
void OnClientLocalConnect(long uid, byte tunnelId,int Idx) 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)) if (!ServerManager.g_ClientMgr.GetClientByUID(uid, out ClientInfo client))
return; return;
if (!mDictTunnelID2Cfg.ContainsKey(tunnelId)) if (!Config.Cfgs.ContainsKey(tunnelId))
return; return;
//开一个线程去建立连接 //开一个线程去建立连接
Thread thread = new Thread(() => Thread thread = new Thread(() =>
{ {
//服务器本地局域网连接指定端口 //服务器本地局域网连接指定端口
TunnelClientData tunnelDataCfg = mDictTunnelID2Cfg[tunnelId]; TunnelClientData tunnelDataCfg = Config.Cfgs[tunnelId];
ServerLocalClient serverLocalClient = new ServerLocalClient(tunnelId, (byte)Idx); ServerLocalClient serverLocalClient = new ServerLocalClient(uid, tunnelId, (byte)Idx);
//连接成功 //连接成功
if (!serverLocalClient.Init(tunnelDataCfg.IP, tunnelDataCfg.Port)) if (!serverLocalClient.Init(tunnelDataCfg.ServerLocalIP, tunnelDataCfg.ServerLocalPort))
{ {
//连接失败
//TODO告知客户端连接失败 //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(); thread.Start();
@ -143,6 +145,7 @@ namespace ServerCore.Manager
/// <param name="tunnelId"></param> /// <param name="tunnelId"></param>
void OnClientLocalDisconnect(long uid, byte tunnelId,byte Idx) 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)) if (!ServerManager.g_ClientMgr.GetClientByUID(uid, out ClientInfo client))
return; return;
@ -162,6 +165,7 @@ namespace ServerCore.Manager
/// <param name="tunnelId"></param> /// <param name="tunnelId"></param>
public void OnServerLocalConnect(long uid, byte tunnelId, byte Idx, ServerLocalClient serverLocalClient) 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)) if (!ServerManager.g_ClientMgr.GetClientByUID(uid, out ClientInfo client))
return; return;
@ -172,6 +176,7 @@ namespace ServerCore.Manager
{ {
TunnelID = tunnelId, TunnelID = tunnelId,
Idx = Idx, Idx = Idx,
Connected = 1
}); });
//发送给客户端,指定服务端本地端口已连接 //发送给客户端,指定服务端本地端口已连接
ServerManager.g_ClientMgr.ClientSend(client, (int)CommandID.CmdTunnelS2CConnect, (int)ErrorCode.ErrorOk, respData); ServerManager.g_ClientMgr.ClientSend(client, (int)CommandID.CmdTunnelS2CConnect, (int)ErrorCode.ErrorOk, respData);
@ -183,6 +188,7 @@ namespace ServerCore.Manager
/// <param name="tunnelId"></param> /// <param name="tunnelId"></param>
public void OnServerLocalDisconnect(long uid, byte tunnelId, byte Idx, ServerLocalClient serverLocalClient) 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)) if (!ServerManager.g_ClientMgr.GetClientByUID(uid, out ClientInfo client))
return; return;
//添加到服务端本地连接列表 //添加到服务端本地连接列表
@ -207,6 +213,7 @@ namespace ServerCore.Manager
/// <param name="data"></param> /// <param name="data"></param>
public void OnServerLocalDataCallBack(long uid, byte tunnelId,byte Idx, byte[] data) 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)) if (!ServerManager.g_ClientMgr.GetClientByUID(uid, out ClientInfo client))
return; return;
@ -230,6 +237,7 @@ namespace ServerCore.Manager
/// <param name="data"></param> /// <param name="data"></param>
public void OnClientTunnelDataCallBack(long uid, byte tunnelId, byte Idx, byte[] data) public void OnClientTunnelDataCallBack(long uid, byte tunnelId, byte Idx, byte[] data)
{ {
ServerManager.g_Log.Debug($"OnClientTunnelDataCallBack {uid},{tunnelId},{Idx}");
//隧道ID定位投递服务端本地连接 //隧道ID定位投递服务端本地连接
if (!GetServerLocalClient(uid, tunnelId, Idx, out ServerLocalClient serverLocalClient)) if (!GetServerLocalClient(uid, tunnelId, Idx, out ServerLocalClient serverLocalClient))
return; return;

View File

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

View File

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

View File

@ -1,4 +1,6 @@
using ServerCore.NetWork; using NoSugarNet.ServerCore.Common;
using ServerCore.NetWork;
using ServerCore.Common;
using System.Net; using System.Net;
namespace ServerCore.Manager namespace ServerCore.Manager
@ -12,8 +14,9 @@ namespace ServerCore.Manager
public static LocalClientManager g_Local; public static LocalClientManager g_Local;
public static IOCPNetWork g_SocketMgr; 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 = new ClientManager();
g_ClientMgr.Init(45000, 120); g_ClientMgr.Init(45000, 120);
g_Log = new LogManager(); g_Log = new LogManager();

View File

@ -32,42 +32,43 @@ namespace AxibugProtobuf {
"CRIVCg1MYXN0TG9naW5EYXRlGAIgASgJEg8KB1JlZ0RhdGUYAyABKAkSMQoG", "CRIVCg1MYXN0TG9naW5EYXRlGAIgASgJEg8KB1JlZ0RhdGUYAyABKAkSMQoG",
"U3RhdHVzGAQgASgOMiEuQXhpYnVnUHJvdG9idWYuTG9naW5SZXN1bHRTdGF0", "U3RhdHVzGAQgASgOMiEuQXhpYnVnUHJvdG9idWYuTG9naW5SZXN1bHRTdGF0",
"dXMiQwoNUHJvdG9idWZfQ2ZncxIyCgRjZmdzGAEgAygLMiQuQXhpYnVnUHJv", "dXMiQwoNUHJvdG9idWZfQ2ZncxIyCgRjZmdzGAEgAygLMiQuQXhpYnVnUHJv",
"dG9idWYuUHJvdG9idWZfQ2Znc19TaW5nbGUiQgoUUHJvdG9idWZfQ2Znc19T", "dG9idWYuUHJvdG9idWZfQ2Znc19TaW5nbGUiNgoUUHJvdG9idWZfQ2Znc19T",
"aW5nbGUSEAoIVHVubmVsSUQYASABKA0SCgoCSVAYAiABKAkSDAoEUG9ydBgD", "aW5nbGUSEAoIVHVubmVsSUQYASABKA0SDAoEUG9ydBgCIAEoBSIjChBQcm90",
"IAEoBSIjChBQcm90b2J1Zl9DaGF0TXNnEg8KB0NoYXRNc2cYASABKAkiSAoV", "b2J1Zl9DaGF0TXNnEg8KB0NoYXRNc2cYASABKAkiSAoVUHJvdG9idWZfQ2hh",
"UHJvdG9idWZfQ2hhdE1zZ19SRVNQEhAKCE5pY2tOYW1lGAEgASgJEg8KB0No", "dE1zZ19SRVNQEhAKCE5pY2tOYW1lGAEgASgJEg8KB0NoYXRNc2cYAiABKAkS",
"YXRNc2cYAiABKAkSDAoERGF0ZRgDIAEoAyI1ChRQcm90b2J1Zl9DMlNfQ29u", "DAoERGF0ZRgDIAEoAyI1ChRQcm90b2J1Zl9DMlNfQ29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wZV9E",
"ABIGCgJQQxABEgsKB0FuZHJvaWQQAhIHCgNJT1MQAxIHCgNQU1YQBCpOChFM", "ZWZhdWx0EAASBgoCUEMQARILCgdBbmRyb2lkEAISBwoDSU9TEAMSBwoDUFNW",
"b2dpblJlc3VsdFN0YXR1cxIhCh1Mb2dpblJlc3VsdFN0YXR1c19CYXNlRGVm", "EAQqTgoRTG9naW5SZXN1bHRTdGF0dXMSIQodTG9naW5SZXN1bHRTdGF0dXNf",
"YXVsdBAAEgYKAk9LEAESDgoKQWNjb3VudEVychACQgJIAWIGcHJvdG8z")); "QmFzZURlZmF1bHQQABIGCgJPSxABEg4KCkFjY291bnRFcnIQAkICSAFiBnBy",
"b3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { }, 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(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), 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" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs), global::AxibugProtobuf.Protobuf_Cfgs.Parser, new[]{ "Cfgs" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs), global::AxibugProtobuf.Protobuf_Cfgs.Parser, new[]{ "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), 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_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_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_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_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_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] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_Cfgs_Single(Protobuf_Cfgs_Single other) : this() { public Protobuf_Cfgs_Single(Protobuf_Cfgs_Single other) : this() {
tunnelID_ = other.tunnelID_; tunnelID_ = other.tunnelID_;
iP_ = other.iP_;
port_ = other.port_; port_ = other.port_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _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> /// <summary>Field number for the "Port" field.</summary>
public const int PortFieldNumber = 3; public const int PortFieldNumber = 2;
private int port_; private int port_;
/// <summary> /// <summary>
///端口 ///端口
@ -1018,7 +1004,6 @@ namespace AxibugProtobuf {
return true; return true;
} }
if (TunnelID != other.TunnelID) return false; if (TunnelID != other.TunnelID) return false;
if (IP != other.IP) return false;
if (Port != other.Port) return false; if (Port != other.Port) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
@ -1027,7 +1012,6 @@ namespace AxibugProtobuf {
public override int GetHashCode() { public override int GetHashCode() {
int hash = 1; int hash = 1;
if (TunnelID != 0) hash ^= TunnelID.GetHashCode(); if (TunnelID != 0) hash ^= TunnelID.GetHashCode();
if (IP.Length != 0) hash ^= IP.GetHashCode();
if (Port != 0) hash ^= Port.GetHashCode(); if (Port != 0) hash ^= Port.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
@ -1049,12 +1033,8 @@ namespace AxibugProtobuf {
output.WriteRawTag(8); output.WriteRawTag(8);
output.WriteUInt32(TunnelID); output.WriteUInt32(TunnelID);
} }
if (IP.Length != 0) {
output.WriteRawTag(18);
output.WriteString(IP);
}
if (Port != 0) { if (Port != 0) {
output.WriteRawTag(24); output.WriteRawTag(16);
output.WriteInt32(Port); output.WriteInt32(Port);
} }
if (_unknownFields != null) { if (_unknownFields != null) {
@ -1070,12 +1050,8 @@ namespace AxibugProtobuf {
output.WriteRawTag(8); output.WriteRawTag(8);
output.WriteUInt32(TunnelID); output.WriteUInt32(TunnelID);
} }
if (IP.Length != 0) {
output.WriteRawTag(18);
output.WriteString(IP);
}
if (Port != 0) { if (Port != 0) {
output.WriteRawTag(24); output.WriteRawTag(16);
output.WriteInt32(Port); output.WriteInt32(Port);
} }
if (_unknownFields != null) { if (_unknownFields != null) {
@ -1090,9 +1066,6 @@ namespace AxibugProtobuf {
if (TunnelID != 0) { if (TunnelID != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(TunnelID); size += 1 + pb::CodedOutputStream.ComputeUInt32Size(TunnelID);
} }
if (IP.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(IP);
}
if (Port != 0) { if (Port != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Port); size += 1 + pb::CodedOutputStream.ComputeInt32Size(Port);
} }
@ -1110,9 +1083,6 @@ namespace AxibugProtobuf {
if (other.TunnelID != 0) { if (other.TunnelID != 0) {
TunnelID = other.TunnelID; TunnelID = other.TunnelID;
} }
if (other.IP.Length != 0) {
IP = other.IP;
}
if (other.Port != 0) { if (other.Port != 0) {
Port = other.Port; Port = other.Port;
} }
@ -1134,11 +1104,7 @@ namespace AxibugProtobuf {
TunnelID = input.ReadUInt32(); TunnelID = input.ReadUInt32();
break; break;
} }
case 18: { case 16: {
IP = input.ReadString();
break;
}
case 24: {
Port = input.ReadInt32(); Port = input.ReadInt32();
break; break;
} }
@ -1160,11 +1126,7 @@ namespace AxibugProtobuf {
TunnelID = input.ReadUInt32(); TunnelID = input.ReadUInt32();
break; break;
} }
case 18: { case 16: {
IP = input.ReadString();
break;
}
case 24: {
Port = input.ReadInt32(); Port = input.ReadInt32();
break; break;
} }
@ -1854,6 +1816,7 @@ namespace AxibugProtobuf {
public Protobuf_S2C_Connect(Protobuf_S2C_Connect other) : this() { public Protobuf_S2C_Connect(Protobuf_S2C_Connect other) : this() {
tunnelID_ = other.tunnelID_; tunnelID_ = other.tunnelID_;
idx_ = other.idx_; idx_ = other.idx_;
connected_ = other.connected_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _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] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) { public override bool Equals(object other) {
return Equals(other as Protobuf_S2C_Connect); return Equals(other as Protobuf_S2C_Connect);
@ -1905,6 +1882,7 @@ namespace AxibugProtobuf {
} }
if (TunnelID != other.TunnelID) return false; if (TunnelID != other.TunnelID) return false;
if (Idx != other.Idx) return false; if (Idx != other.Idx) return false;
if (Connected != other.Connected) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
@ -1913,6 +1891,7 @@ namespace AxibugProtobuf {
int hash = 1; int hash = 1;
if (TunnelID != 0) hash ^= TunnelID.GetHashCode(); if (TunnelID != 0) hash ^= TunnelID.GetHashCode();
if (Idx != 0) hash ^= Idx.GetHashCode(); if (Idx != 0) hash ^= Idx.GetHashCode();
if (Connected != 0) hash ^= Connected.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
} }
@ -1937,6 +1916,10 @@ namespace AxibugProtobuf {
output.WriteRawTag(16); output.WriteRawTag(16);
output.WriteUInt32(Idx); output.WriteUInt32(Idx);
} }
if (Connected != 0) {
output.WriteRawTag(24);
output.WriteUInt32(Connected);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(output); _unknownFields.WriteTo(output);
} }
@ -1954,6 +1937,10 @@ namespace AxibugProtobuf {
output.WriteRawTag(16); output.WriteRawTag(16);
output.WriteUInt32(Idx); output.WriteUInt32(Idx);
} }
if (Connected != 0) {
output.WriteRawTag(24);
output.WriteUInt32(Connected);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(ref output); _unknownFields.WriteTo(ref output);
} }
@ -1969,6 +1956,9 @@ namespace AxibugProtobuf {
if (Idx != 0) { if (Idx != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Idx); size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Idx);
} }
if (Connected != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Connected);
}
if (_unknownFields != null) { if (_unknownFields != null) {
size += _unknownFields.CalculateSize(); size += _unknownFields.CalculateSize();
} }
@ -1986,6 +1976,9 @@ namespace AxibugProtobuf {
if (other.Idx != 0) { if (other.Idx != 0) {
Idx = other.Idx; Idx = other.Idx;
} }
if (other.Connected != 0) {
Connected = other.Connected;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
} }
@ -2008,6 +2001,10 @@ namespace AxibugProtobuf {
Idx = input.ReadUInt32(); Idx = input.ReadUInt32();
break; break;
} }
case 24: {
Connected = input.ReadUInt32();
break;
}
} }
} }
#endif #endif
@ -2030,6 +2027,10 @@ namespace AxibugProtobuf {
Idx = input.ReadUInt32(); Idx = input.ReadUInt32();
break; break;
} }
case 24: {
Connected = input.ReadUInt32();
break;
}
} }
} }
} }

View File

@ -32,42 +32,43 @@ namespace AxibugProtobuf {
"CRIVCg1MYXN0TG9naW5EYXRlGAIgASgJEg8KB1JlZ0RhdGUYAyABKAkSMQoG", "CRIVCg1MYXN0TG9naW5EYXRlGAIgASgJEg8KB1JlZ0RhdGUYAyABKAkSMQoG",
"U3RhdHVzGAQgASgOMiEuQXhpYnVnUHJvdG9idWYuTG9naW5SZXN1bHRTdGF0", "U3RhdHVzGAQgASgOMiEuQXhpYnVnUHJvdG9idWYuTG9naW5SZXN1bHRTdGF0",
"dXMiQwoNUHJvdG9idWZfQ2ZncxIyCgRjZmdzGAEgAygLMiQuQXhpYnVnUHJv", "dXMiQwoNUHJvdG9idWZfQ2ZncxIyCgRjZmdzGAEgAygLMiQuQXhpYnVnUHJv",
"dG9idWYuUHJvdG9idWZfQ2Znc19TaW5nbGUiQgoUUHJvdG9idWZfQ2Znc19T", "dG9idWYuUHJvdG9idWZfQ2Znc19TaW5nbGUiNgoUUHJvdG9idWZfQ2Znc19T",
"aW5nbGUSEAoIVHVubmVsSUQYASABKA0SCgoCSVAYAiABKAkSDAoEUG9ydBgD", "aW5nbGUSEAoIVHVubmVsSUQYASABKA0SDAoEUG9ydBgCIAEoBSIjChBQcm90",
"IAEoBSIjChBQcm90b2J1Zl9DaGF0TXNnEg8KB0NoYXRNc2cYASABKAkiSAoV", "b2J1Zl9DaGF0TXNnEg8KB0NoYXRNc2cYASABKAkiSAoVUHJvdG9idWZfQ2hh",
"UHJvdG9idWZfQ2hhdE1zZ19SRVNQEhAKCE5pY2tOYW1lGAEgASgJEg8KB0No", "dE1zZ19SRVNQEhAKCE5pY2tOYW1lGAEg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GFvWXVlQXV0aBABEgcK",
"BwoDQkY0EAQqSwoKRGV2aWNlVHlwZRIWChJEZXZpY2VUeXBlX0RlZmF1bHQQ", "A0JGMxADEgcKA0JGNBAEKksKCkRldmljZVR5cGUSFgoSRGV2aWNlVHlwZV9E",
"ABIGCgJQQxABEgsKB0FuZHJvaWQQAhIHCgNJT1MQAxIHCgNQU1YQBCpOChFM", "ZWZhdWx0EAASBgoCUEMQARILCgdBbmRyb2lkEAISBwoDSU9TEAMSBwoDUFNW",
"b2dpblJlc3VsdFN0YXR1cxIhCh1Mb2dpblJlc3VsdFN0YXR1c19CYXNlRGVm", "EAQqTgoRTG9naW5SZXN1bHRTdGF0dXMSIQodTG9naW5SZXN1bHRTdGF0dXNf",
"YXVsdBAAEgYKAk9LEAESDgoKQWNjb3VudEVychACQgJIAWIGcHJvdG8z")); "QmFzZURlZmF1bHQQABIGCgJPSxABEg4KCkFjY291bnRFcnIQAkICSAFiBnBy",
"b3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { }, 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(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), 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" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs), global::AxibugProtobuf.Protobuf_Cfgs.Parser, new[]{ "Cfgs" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Cfgs), global::AxibugProtobuf.Protobuf_Cfgs.Parser, new[]{ "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), 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_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_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_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_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_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] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_Cfgs_Single(Protobuf_Cfgs_Single other) : this() { public Protobuf_Cfgs_Single(Protobuf_Cfgs_Single other) : this() {
tunnelID_ = other.tunnelID_; tunnelID_ = other.tunnelID_;
iP_ = other.iP_;
port_ = other.port_; port_ = other.port_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _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> /// <summary>Field number for the "Port" field.</summary>
public const int PortFieldNumber = 3; public const int PortFieldNumber = 2;
private int port_; private int port_;
/// <summary> /// <summary>
///端口 ///端口
@ -1018,7 +1004,6 @@ namespace AxibugProtobuf {
return true; return true;
} }
if (TunnelID != other.TunnelID) return false; if (TunnelID != other.TunnelID) return false;
if (IP != other.IP) return false;
if (Port != other.Port) return false; if (Port != other.Port) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
@ -1027,7 +1012,6 @@ namespace AxibugProtobuf {
public override int GetHashCode() { public override int GetHashCode() {
int hash = 1; int hash = 1;
if (TunnelID != 0) hash ^= TunnelID.GetHashCode(); if (TunnelID != 0) hash ^= TunnelID.GetHashCode();
if (IP.Length != 0) hash ^= IP.GetHashCode();
if (Port != 0) hash ^= Port.GetHashCode(); if (Port != 0) hash ^= Port.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
@ -1049,12 +1033,8 @@ namespace AxibugProtobuf {
output.WriteRawTag(8); output.WriteRawTag(8);
output.WriteUInt32(TunnelID); output.WriteUInt32(TunnelID);
} }
if (IP.Length != 0) {
output.WriteRawTag(18);
output.WriteString(IP);
}
if (Port != 0) { if (Port != 0) {
output.WriteRawTag(24); output.WriteRawTag(16);
output.WriteInt32(Port); output.WriteInt32(Port);
} }
if (_unknownFields != null) { if (_unknownFields != null) {
@ -1070,12 +1050,8 @@ namespace AxibugProtobuf {
output.WriteRawTag(8); output.WriteRawTag(8);
output.WriteUInt32(TunnelID); output.WriteUInt32(TunnelID);
} }
if (IP.Length != 0) {
output.WriteRawTag(18);
output.WriteString(IP);
}
if (Port != 0) { if (Port != 0) {
output.WriteRawTag(24); output.WriteRawTag(16);
output.WriteInt32(Port); output.WriteInt32(Port);
} }
if (_unknownFields != null) { if (_unknownFields != null) {
@ -1090,9 +1066,6 @@ namespace AxibugProtobuf {
if (TunnelID != 0) { if (TunnelID != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(TunnelID); size += 1 + pb::CodedOutputStream.ComputeUInt32Size(TunnelID);
} }
if (IP.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(IP);
}
if (Port != 0) { if (Port != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Port); size += 1 + pb::CodedOutputStream.ComputeInt32Size(Port);
} }
@ -1110,9 +1083,6 @@ namespace AxibugProtobuf {
if (other.TunnelID != 0) { if (other.TunnelID != 0) {
TunnelID = other.TunnelID; TunnelID = other.TunnelID;
} }
if (other.IP.Length != 0) {
IP = other.IP;
}
if (other.Port != 0) { if (other.Port != 0) {
Port = other.Port; Port = other.Port;
} }
@ -1134,11 +1104,7 @@ namespace AxibugProtobuf {
TunnelID = input.ReadUInt32(); TunnelID = input.ReadUInt32();
break; break;
} }
case 18: { case 16: {
IP = input.ReadString();
break;
}
case 24: {
Port = input.ReadInt32(); Port = input.ReadInt32();
break; break;
} }
@ -1160,11 +1126,7 @@ namespace AxibugProtobuf {
TunnelID = input.ReadUInt32(); TunnelID = input.ReadUInt32();
break; break;
} }
case 18: { case 16: {
IP = input.ReadString();
break;
}
case 24: {
Port = input.ReadInt32(); Port = input.ReadInt32();
break; break;
} }
@ -1854,6 +1816,7 @@ namespace AxibugProtobuf {
public Protobuf_S2C_Connect(Protobuf_S2C_Connect other) : this() { public Protobuf_S2C_Connect(Protobuf_S2C_Connect other) : this() {
tunnelID_ = other.tunnelID_; tunnelID_ = other.tunnelID_;
idx_ = other.idx_; idx_ = other.idx_;
connected_ = other.connected_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _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] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) { public override bool Equals(object other) {
return Equals(other as Protobuf_S2C_Connect); return Equals(other as Protobuf_S2C_Connect);
@ -1905,6 +1882,7 @@ namespace AxibugProtobuf {
} }
if (TunnelID != other.TunnelID) return false; if (TunnelID != other.TunnelID) return false;
if (Idx != other.Idx) return false; if (Idx != other.Idx) return false;
if (Connected != other.Connected) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
@ -1913,6 +1891,7 @@ namespace AxibugProtobuf {
int hash = 1; int hash = 1;
if (TunnelID != 0) hash ^= TunnelID.GetHashCode(); if (TunnelID != 0) hash ^= TunnelID.GetHashCode();
if (Idx != 0) hash ^= Idx.GetHashCode(); if (Idx != 0) hash ^= Idx.GetHashCode();
if (Connected != 0) hash ^= Connected.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
} }
@ -1937,6 +1916,10 @@ namespace AxibugProtobuf {
output.WriteRawTag(16); output.WriteRawTag(16);
output.WriteUInt32(Idx); output.WriteUInt32(Idx);
} }
if (Connected != 0) {
output.WriteRawTag(24);
output.WriteUInt32(Connected);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(output); _unknownFields.WriteTo(output);
} }
@ -1954,6 +1937,10 @@ namespace AxibugProtobuf {
output.WriteRawTag(16); output.WriteRawTag(16);
output.WriteUInt32(Idx); output.WriteUInt32(Idx);
} }
if (Connected != 0) {
output.WriteRawTag(24);
output.WriteUInt32(Connected);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(ref output); _unknownFields.WriteTo(ref output);
} }
@ -1969,6 +1956,9 @@ namespace AxibugProtobuf {
if (Idx != 0) { if (Idx != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Idx); size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Idx);
} }
if (Connected != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Connected);
}
if (_unknownFields != null) { if (_unknownFields != null) {
size += _unknownFields.CalculateSize(); size += _unknownFields.CalculateSize();
} }
@ -1986,6 +1976,9 @@ namespace AxibugProtobuf {
if (other.Idx != 0) { if (other.Idx != 0) {
Idx = other.Idx; Idx = other.Idx;
} }
if (other.Connected != 0) {
Connected = other.Connected;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
} }
@ -2008,6 +2001,10 @@ namespace AxibugProtobuf {
Idx = input.ReadUInt32(); Idx = input.ReadUInt32();
break; break;
} }
case 24: {
Connected = input.ReadUInt32();
break;
}
} }
} }
#endif #endif
@ -2030,6 +2027,10 @@ namespace AxibugProtobuf {
Idx = input.ReadUInt32(); Idx = input.ReadUInt32();
break; break;
} }
case 24: {
Connected = input.ReadUInt32();
break;
}
} }
} }
} }

View File

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

View File

@ -7,6 +7,10 @@ namespace NoSugarNet.ClientCli
static void Main(string[] args) static void Main(string[] args)
{ {
AppNoSugarNet.Init("127.0.0.1", 1000); 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> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<None Remove="config.cfg" />
</ItemGroup>
<ItemGroup>
<Page Include="config.cfg" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\NoSugarNet.ServerCore\NoSugarNet.ServerCore.csproj" /> <ProjectReference Include="..\..\NoSugarNet.ServerCore\NoSugarNet.ServerCore.csproj" />
</ItemGroup> </ItemGroup>

View File

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