From a07a964a0f4b3bac9d8400790c9e3b9c10027a5c Mon Sep 17 00:00:00 2001 From: sin365 <353374337@qq.com> Date: Mon, 22 Jan 2024 15:08:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E5=88=9D=E3=81=AE=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E9=80=9A=E8=AE=AF=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Lib/HaoYueNet.ClientNetwork.dll | Bin 19968 -> 19968 bytes Lib/HaoYueNet.ServerNetwork.dll | Bin 25088 -> 24576 bytes NoSugarNet.ClientCore/Event/EventSystem.cs | 10 +- NoSugarNet.ClientCore/Manager/AppChat.cs | 2 +- .../Manager/AppLocalClient.cs | 20 ++- .../Manager/LocalClient/LocalListener.cs | 5 +- NoSugarNet.ClientCore/Network/NetMsg.cs | 2 +- .../Protobuf/ProtobufNoSugar.cs | 143 +++++++++--------- NoSugarNet.ServerCore/Common/Config.cs | 17 +++ .../Manager/LocalClientManager.cs | 32 ++-- NoSugarNet.ServerCore/Manager/LoginManager.cs | 11 +- .../ServerLocalClient/ServerLocalClient.cs | 4 +- .../Manager/ServerManager.cs | 7 +- .../Protobuf/ProtobufNoSugar.cs | 143 +++++++++--------- ProtobufCore/out/CS/ProtobufNoSugar.cs | 143 +++++++++--------- ProtobufCore/proto/protobuf_NoSugar.proto | 4 +- Sample/NoSugarNet.ClientCli/Program.cs | 4 + Sample/NoSugarNet.ServerCli/Config.cs | 48 ++++++ .../NoSugarNet.ServerCli.csproj | 8 + Sample/NoSugarNet.ServerCli/Program.cs | 9 +- Sample/NoSugarNet.ServerCli/config.cfg | 4 + 21 files changed, 367 insertions(+), 249 deletions(-) create mode 100644 NoSugarNet.ServerCore/Common/Config.cs create mode 100644 Sample/NoSugarNet.ServerCli/Config.cs create mode 100644 Sample/NoSugarNet.ServerCli/config.cfg diff --git a/Lib/HaoYueNet.ClientNetwork.dll b/Lib/HaoYueNet.ClientNetwork.dll index bda3d917c947a4513a757bf015842ffb6ae7222f..6eb54c8ae17ce4128b93c00e88b38a1736ec67f7 100644 GIT binary patch delta 942 zcmX}rPe>F|90&04%-cURo7ArPFEz41+JDr{b+_HpT-#PdQ}fT(mIQ%ThwNae3GQyf zmXOst8HgL?Av91z#)CqKz%UFUsDsva@KA?}7Am}mhu)icIWULM`@Q%3z4^j~VnQe; zJi2EHPPM#@-k&gzw*n1Hw9>6~3+cjhB`S0ZU8*eZ*g~=2)|f2z8~_Zthe_T+Q+oR# zU{ZQ*UIFTyZCFZ{(h8Tv9yi@#PLtY;0E==X^N2oQ!R36==M7d2COD8(z!XN3 zoI)IMbG?^LaN;Icwk3r)(XT0jZo2ar9_y0&gg)ZJB9}tthM|!4j7ZbyC&%IDnx{H} zjv!}3d`L<$!L>$JhOb?3*`(K1BJQKu;km&F7Ry7e0V(u;Z!<~1L^s0T5w zcZS=jz#jVj^fK6FvEmd;ih??~$zy^SrFt>ruGs`H>NQ0(2F$yN7hU{dvz$kTqwHK5 zKc#$f1|7vrdWO{)*Q94yjb$#DVGWY(`Z<(gH iw{rO6=l_eeQNZ;fXK*Gf+K_3SU829^HFa~JHKESE_t1s&@HxM8e!s&PZu^kXJ|y&Z znP0kkW}@AraeYld6}?~Prfouk5T#M!lF+D1rmY(VO4DrBwAbcU-`WO6yXmSMFk9or z3ps!+#%Hb3j-+&IcRJO{qo;2;#10vnHYvVucM z$q5^6#t*R2+KQLHPP*kj#JylCVXYowh_-*tuYP0S!iP`^j(Vr1w;pDrUq zA7WfuhUHl1(lRWEEf3oK2rgP3qyou#`eRs#w}>BAT$Jf3y16DWOpYPOHN{kkHLgX| z2&qDDzR_issTwU@OVSuQj=NkYd5qNH9TS^xgjfrqK)w=nAkD-8 diff --git a/Lib/HaoYueNet.ServerNetwork.dll b/Lib/HaoYueNet.ServerNetwork.dll index 86b01ec7694ba98d8ed66eac6bc483c926f14118..d448aebf513d475e703dad04720c2cb73c1721b4 100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1L-jmSJNSnuY6oNe{KHs3W4ri=v0aQM z_=m9scfBe!;_>ROmazA^zqTrdlR|p<7c9~#gC{W@x#kNq6ut2;5eZB`T z=y`wT5B%qvIyM)L3~QE0xA2QU?+R_iwHa5ZVO4hPRyB&-Em4~?%%qg6z3eGaID~;w zXccAztGa*%i~Jr!R3NCmU75p;lAo-!CC%P`Bsiuyv;r4chUej^H@ z@mqNeSTQ%2360feVjyCGrWg=EP!2NLhfso;Fv}B+fDQF1GTn?~#WL8;pcA07+lZ3T zx1-?mMP0M{G`!5=&usoqdxsw0nu-l=a+0}>6;ExPy=e`6>~=)wYc#!XQ*%cno*_02 z4b{47_4#|=Q&$fG!Kt}tar{Uz5gXyhnm%q30Y^37AD!&!3jUIXyxFIcf-J^gM&Sp4 zo1>9O5d49Z{9TKwL6rp>U9+3N=F*{;@#Frz^6(Om)ZErleXx}-@PS&JusK1xm*EcL#eh#@xd@QR3547?3-@c%$>!05<>ywB7 zQlN9b$nP5Qw`({`}P|q48@CalZ7 z&l%FHLk^%x91rUg` zUPDECzgxNdCOI$nV$mQCseJ6_&tm9RpSxI(YVflq`GB6nJqFw5NA~XeufvgCavr=# z#y99_17r?}M7G=zY{nxTz~MgwT_U)4NdK)aoo9vn&)S7CW#PY84>fOXkncdZVc0lR zFgo_*cQ(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(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 /// 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 /// 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 /// 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 /// 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 /// 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 /// 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() diff --git a/NoSugarNet.ClientCore/Manager/LocalClient/LocalListener.cs b/NoSugarNet.ClientCore/Manager/LocalClient/LocalListener.cs index b5341aa..8cb7abd 100644 --- a/NoSugarNet.ClientCore/Manager/LocalClient/LocalListener.cs +++ b/NoSugarNet.ClientCore/Manager/LocalClient/LocalListener.cs @@ -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 /// 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; } diff --git a/NoSugarNet.ClientCore/Network/NetMsg.cs b/NoSugarNet.ClientCore/Network/NetMsg.cs index b6bb12a..cfc729d 100644 --- a/NoSugarNet.ClientCore/Network/NetMsg.cs +++ b/NoSugarNet.ClientCore/Network/NetMsg.cs @@ -66,7 +66,7 @@ } catch (Exception e) { - App.log.Error(e.Message); + AppNoSugarNet.log.Error(e.Message); } } } diff --git a/NoSugarNet.ClientCore/Protobuf/ProtobufNoSugar.cs b/NoSugarNet.ClientCore/Protobuf/ProtobufNoSugar.cs index 44acd31..549e751 100644 --- a/NoSugarNet.ClientCore/Protobuf/ProtobufNoSugar.cs +++ b/NoSugarNet.ClientCore/Protobuf/ProtobufNoSugar.cs @@ -32,42 +32,43 @@ namespace AxibugProtobuf { "CRIVCg1MYXN0TG9naW5EYXRlGAIgASgJEg8KB1JlZ0RhdGUYAyABKAkSMQoG", "U3RhdHVzGAQgASgOMiEuQXhpYnVnUHJvdG9idWYuTG9naW5SZXN1bHRTdGF0", "dXMiQwoNUHJvdG9idWZfQ2ZncxIyCgRjZmdzGAEgAygLMiQuQXhpYnVnUHJv", - "dG9idWYuUHJvdG9idWZfQ2Znc19TaW5nbGUiQgoUUHJvdG9idWZfQ2Znc19T", - "aW5nbGUSEAoIVHVubmVsSUQYASABKA0SCgoCSVAYAiABKAkSDAoEUG9ydBgD", - "IAEoBSIjChBQcm90b2J1Zl9DaGF0TXNnEg8KB0NoYXRNc2cYASABKAkiSAoV", - "UHJvdG9idWZfQ2hhdE1zZ19SRVNQEhAKCE5pY2tOYW1lGAEgASgJEg8KB0No", - "YXRNc2cYAiABKAkSDAoERGF0ZRgDIAEoAyI1ChRQcm90b2J1Zl9DMlNfQ29u", - "bmVjdBIQCghUdW5uZWxJRBgBIAEoDRILCgNJZHgYAiABKA0iNQoUUHJvdG9i", - "dWZfUzJDX0Nvbm5lY3QSEAoIVHVubmVsSUQYASABKA0SCwoDSWR4GAIgASgN", - "IjgKF1Byb3RvYnVmX0MyU19EaXNjb25uZWN0EhAKCFR1bm5lbElEGAEgASgN", - "EgsKA0lkeBgCIAEoDSI4ChdQcm90b2J1Zl9TMkNfRGlzY29ubmVjdBIQCghU", - "dW5uZWxJRBgBIAEoDRILCgNJZHgYAiABKA0iTgoRUHJvdG9idWZfQzJTX0RB", - "VEESEAoIVHVubmVsSUQYASABKA0SCwoDSWR4GAIgASgNEhoKEkh1bnRlck5l", - "dENvcmVfRGF0YRgDIAEoDCJOChFQcm90b2J1Zl9TMkNfREFUQRIQCghUdW5u", - "ZWxJRBgBIAEoDRILCgNJZHgYAiABKA0S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KksKCkRldmljZVR5cGUSFgoSRGV2aWNlVHlwZV9E", + "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 { } } - /// Field number for the "IP" field. - public const int IPFieldNumber = 2; - private string iP_ = ""; - /// - ///IP - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string IP { - get { return iP_; } - set { - iP_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Field number for the "Port" field. - public const int PortFieldNumber = 3; + public const int PortFieldNumber = 2; private int port_; /// ///端口 @@ -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 { } } + /// Field number for the "Connected" field. + public const int ConnectedFieldNumber = 3; + private uint connected_; + /// + ///[0]连接失败 [1]连接成功 + /// + [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; + } } } } diff --git a/NoSugarNet.ServerCore/Common/Config.cs b/NoSugarNet.ServerCore/Common/Config.cs new file mode 100644 index 0000000..cb75673 --- /dev/null +++ b/NoSugarNet.ServerCore/Common/Config.cs @@ -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 Cfgs = new Dictionary(); + } +} diff --git a/NoSugarNet.ServerCore/Manager/LocalClientManager.cs b/NoSugarNet.ServerCore/Manager/LocalClientManager.cs index 345caee..39575e9 100644 --- a/NoSugarNet.ServerCore/Manager/LocalClientManager.cs +++ b/NoSugarNet.ServerCore/Manager/LocalClientManager.cs @@ -10,13 +10,6 @@ namespace ServerCore.Manager { public class LocalClientManager { - struct TunnelClientData - { - public string IP; - public ushort Port; - } - - Dictionary mDictTunnelID2Cfg = new Dictionary(); Dictionary mDictCommKey2ServerLocalClients = new Dictionary(); CompressAdapter mCompressAdapter; @@ -115,23 +108,32 @@ namespace ServerCore.Manager /// 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 /// 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 /// 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 /// 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 /// 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 /// 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; diff --git a/NoSugarNet.ServerCore/Manager/LoginManager.cs b/NoSugarNet.ServerCore/Manager/LoginManager.cs index c5501ee..55f22cb 100644 --- a/NoSugarNet.ServerCore/Manager/LoginManager.cs +++ b/NoSugarNet.ServerCore/Manager/LoginManager.cs @@ -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); diff --git a/NoSugarNet.ServerCore/Manager/ServerLocalClient/ServerLocalClient.cs b/NoSugarNet.ServerCore/Manager/ServerLocalClient/ServerLocalClient.cs index 8adf70f..ed9275d 100644 --- a/NoSugarNet.ServerCore/Manager/ServerLocalClient/ServerLocalClient.cs +++ b/NoSugarNet.ServerCore/Manager/ServerLocalClient/ServerLocalClient.cs @@ -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; //指定接收服务器数据事件 diff --git a/NoSugarNet.ServerCore/Manager/ServerManager.cs b/NoSugarNet.ServerCore/Manager/ServerManager.cs index 4a7dc96..c9fe2ed 100644 --- a/NoSugarNet.ServerCore/Manager/ServerManager.cs +++ b/NoSugarNet.ServerCore/Manager/ServerManager.cs @@ -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 cfgs) { + Config.Cfgs = cfgs; g_ClientMgr = new ClientManager(); g_ClientMgr.Init(45000, 120); g_Log = new LogManager(); diff --git a/NoSugarNet.ServerCore/Protobuf/ProtobufNoSugar.cs b/NoSugarNet.ServerCore/Protobuf/ProtobufNoSugar.cs index 44acd31..549e751 100644 --- a/NoSugarNet.ServerCore/Protobuf/ProtobufNoSugar.cs +++ b/NoSugarNet.ServerCore/Protobuf/ProtobufNoSugar.cs @@ -32,42 +32,43 @@ namespace AxibugProtobuf { "CRIVCg1MYXN0TG9naW5EYXRlGAIgASgJEg8KB1JlZ0RhdGUYAyABKAkSMQoG", "U3RhdHVzGAQgASgOMiEuQXhpYnVnUHJvdG9idWYuTG9naW5SZXN1bHRTdGF0", "dXMiQwoNUHJvdG9idWZfQ2ZncxIyCgRjZmdzGAEgAygLMiQuQXhpYnVnUHJv", - "dG9idWYuUHJvdG9idWZfQ2Znc19TaW5nbGUiQgoUUHJvdG9idWZfQ2Znc19T", - "aW5nbGUSEAoIVHVubmVsSUQYASABKA0SCgoCSVAYAiABKAkSDAoEUG9ydBgD", - "IAEoBSIjChBQcm90b2J1Zl9DaGF0TXNnEg8KB0NoYXRNc2cYASABKAkiSAoV", - "UHJvdG9idWZfQ2hhdE1zZ19SRVNQEhAKCE5pY2tOYW1lGAEgASgJEg8KB0No", - "YXRNc2cYAiABKAkSDAoERGF0ZRgDIAEoAyI1ChRQcm90b2J1Zl9DMlNfQ29u", - "bmVjdBIQCghUdW5uZWxJRBgBIAEoDRILCgNJZHgYAiABKA0i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NIQVRNU0cQ", + "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 { } } - /// Field number for the "IP" field. - public const int IPFieldNumber = 2; - private string iP_ = ""; - /// - ///IP - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string IP { - get { return iP_; } - set { - iP_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Field number for the "Port" field. - public const int PortFieldNumber = 3; + public const int PortFieldNumber = 2; private int port_; /// ///端口 @@ -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 { } } + /// Field number for the "Connected" field. + public const int ConnectedFieldNumber = 3; + private uint connected_; + /// + ///[0]连接失败 [1]连接成功 + /// + [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; + } } } } diff --git a/ProtobufCore/out/CS/ProtobufNoSugar.cs b/ProtobufCore/out/CS/ProtobufNoSugar.cs index 44acd31..549e751 100644 --- a/ProtobufCore/out/CS/ProtobufNoSugar.cs +++ b/ProtobufCore/out/CS/ProtobufNoSugar.cs @@ -32,42 +32,43 @@ namespace AxibugProtobuf { "CRIVCg1MYXN0TG9naW5EYXRlGAIgASgJEg8KB1JlZ0RhdGUYAyABKAkSMQoG", "U3RhdHVzGAQgASgOMiEuQXhpYnVnUHJvdG9idWYuTG9naW5SZXN1bHRTdGF0", "dXMiQwoNUHJvdG9idWZfQ2ZncxIyCgRjZmdzGAEgAygLMiQuQXhpYnVnUHJv", - "dG9idWYuUHJvdG9idWZfQ2Znc19TaW5nbGUiQgoUUHJvdG9idWZfQ2Znc19T", - "aW5nbGUSEAoIVHVubmVsSUQYASABKA0SCgoCSVAYAiABKAkSDAoEUG9ydBgD", - "IAEoBSIjChBQcm90b2J1Zl9DaGF0TXNnEg8KB0NoYXRNc2cYASABKAkiSAoV", - "UHJvdG9idWZfQ2hhdE1zZ19SRVNQEhAKCE5pY2tOYW1lGAEgASgJEg8KB0No", - "YXRNc2cYAiABKAkSDAoERGF0ZRgDIAEoAyI1ChRQcm90b2J1Zl9DMlNfQ29u", - "bmVjdBIQCghUdW5uZWxJRBgBIAEoDRILCgNJZHgYAiABKA0iNQoUUHJvdG9i", - "dWZfUzJDX0Nvbm5lY3QSEAoIVHVubmVsSUQYASABKA0SCwoDSWR4GAIgASgN", - "IjgKF1Byb3RvYnVmX0MyU19EaXNjb25uZWN0EhAKCFR1bm5lbElEGAEgASgN", - "EgsKA0lkeBgCIAEoDSI4ChdQcm90b2J1Zl9TMkNfRGlzY29ubmVjdBIQCghU", - "dW5uZWxJRBgBIAEoDRILCgNJZHgYAiABKA0iTgoRUHJvdG9idWZfQzJTX0RB", - "VEESEAoIVHVubmVsSUQYASABKA0SCwoDSWR4GAIgASgNEhoKEkh1bnRlck5l", - "dENvcmVfRGF0YRgDIAEoDCJOChFQcm90b2J1Zl9TMkNfREFUQRIQCghUdW5u", - "ZWxJRBgBIAEoDRILCgNJZHgYAiABKA0SGgoSSHVudGVyTmV0Q29yZV9EYXRh", - "GAMg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V9E", + "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 { } } - /// Field number for the "IP" field. - public const int IPFieldNumber = 2; - private string iP_ = ""; - /// - ///IP - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string IP { - get { return iP_; } - set { - iP_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Field number for the "Port" field. - public const int PortFieldNumber = 3; + public const int PortFieldNumber = 2; private int port_; /// ///端口 @@ -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 { } } + /// Field number for the "Connected" field. + public const int ConnectedFieldNumber = 3; + private uint connected_; + /// + ///[0]连接失败 [1]连接成功 + /// + [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; + } } } } diff --git a/ProtobufCore/proto/protobuf_NoSugar.proto b/ProtobufCore/proto/protobuf_NoSugar.proto index cdc651d..c3f578f 100644 --- a/ProtobufCore/proto/protobuf_NoSugar.proto +++ b/ProtobufCore/proto/protobuf_NoSugar.proto @@ -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 diff --git a/Sample/NoSugarNet.ClientCli/Program.cs b/Sample/NoSugarNet.ClientCli/Program.cs index f09c7b0..35b52b7 100644 --- a/Sample/NoSugarNet.ClientCli/Program.cs +++ b/Sample/NoSugarNet.ClientCli/Program.cs @@ -7,6 +7,10 @@ namespace NoSugarNet.ClientCli static void Main(string[] args) { AppNoSugarNet.Init("127.0.0.1", 1000); + while (true) + { + Console.ReadLine(); + } } } } \ No newline at end of file diff --git a/Sample/NoSugarNet.ServerCli/Config.cs b/Sample/NoSugarNet.ServerCli/Config.cs new file mode 100644 index 0000000..eb8c776 --- /dev/null +++ b/Sample/NoSugarNet.ServerCli/Config.cs @@ -0,0 +1,48 @@ +using NoSugarNet.ServerCore.Common; +using System.Text; + +namespace NoSugarNet.ServerCli +{ + public static class Config + { + public static Dictionary Cfgs = new Dictionary(); + 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; + } + } + } +} diff --git a/Sample/NoSugarNet.ServerCli/NoSugarNet.ServerCli.csproj b/Sample/NoSugarNet.ServerCli/NoSugarNet.ServerCli.csproj index 3a33c16..75d10bb 100644 --- a/Sample/NoSugarNet.ServerCli/NoSugarNet.ServerCli.csproj +++ b/Sample/NoSugarNet.ServerCli/NoSugarNet.ServerCli.csproj @@ -7,6 +7,14 @@ enable + + + + + + + + diff --git a/Sample/NoSugarNet.ServerCli/Program.cs b/Sample/NoSugarNet.ServerCli/Program.cs index 108b4bb..76d02a8 100644 --- a/Sample/NoSugarNet.ServerCli/Program.cs +++ b/Sample/NoSugarNet.ServerCli/Program.cs @@ -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(); diff --git a/Sample/NoSugarNet.ServerCli/config.cfg b/Sample/NoSugarNet.ServerCli/config.cfg new file mode 100644 index 0000000..96e433c --- /dev/null +++ b/Sample/NoSugarNet.ServerCli/config.cfg @@ -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 \ No newline at end of file