dev-tcptunnel #1

Merged
sin365 merged 5 commits from dev-tcptunnel into master 2023-07-04 13:08:39 +08:00
18 changed files with 2078 additions and 35 deletions
Showing only changes of commit d93940835e - Show all commits

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -33,17 +33,18 @@ namespace AxibugProtobuf {
"dHVzGAQgASgOMiEuQXhpYnVnUHJvdG9idWYuTG9naW5SZXN1bHRTdGF0dXMi",
"IwoQUHJvdG9idWZfQ2hhdE1zZxIPCgdDaGF0TXNnGAEgASgJIkgKFVByb3Rv",
"YnVmX0NoYXRNc2dfUkVTUBIQCghOaWNrTmFtZRgBIAEoCRIPCgdDaGF0TXNn",
"GAIgASgJEgwKBERhdGUYAyABKAMqnAEKCUNvbW1hbmRJRBIOCgpDTURfREVG",
"GAIgASgJEgwKBERhdGUYAyABKAMqzQEKCUNvbW1hbmRJRBIOCgpDTURfREVG",
"QVVMEAASDgoJQ01EX0xPR0lOENAPEhAKC0NNRF9DSEFUTVNHEKAfEhgKE0NN",
"RF9VU0VSX09OTElORUxJU1QQiCcSEgoNQ01EX1VTRVJfSk9JThCnJxITCg5D",
"TURfVVNFUl9MRUFWRRCoJxIaChVDTURfVVNFUl9TVEFURV9VUERBVEUQqScq",
"KwoJRXJyb3JDb2RlEhAKDEVSUk9SX0RFRkFVTBAAEgwKCEVSUk9SX09LEAEq",
"PgoJTG9naW5UeXBlEg8KC0Jhc2VEZWZhdWx0EAASDgoKSGFvWXVlQXV0aBAB",
"EgcKA0JGMxADEgcKA0JGNBAEKksKCkRldmljZVR5cGUSFgoSRGV2aWNlVHlw",
"ZV9EZWZhdWx0EAASBgoCUEMQARILCgdBbmRyb2lkEAISBwoDSU9TEAMSBwoD",
"UFNWEAQqTgoRTG9naW5SZXN1bHRTdGF0dXMSIQodTG9naW5SZXN1bHRTdGF0",
"dXNfQmFzZURlZmF1bHQQABIGCgJPSxABEg4KCkFjY291bnRFcnIQAkICSAFi",
"BnByb3RvMw=="));
"TURfVVNFUl9MRUFWRRCoJxIaChVDTURfVVNFUl9TVEFURV9VUERBVEUQqScS",
"GAoTQ01EX1RDUFRVTk5FTF9IRUxMTxCJJxIVChBDTURfVENQVFVOTkVMX0RP",
"EIonKj4KCUVycm9yQ29kZRIQCgxFUlJPUl9ERUZBVUwQABIMCghFUlJPUl9P",
"SxABEhEKDUVSUk9SX05PVEZBTkQQZCo+CglMb2dpblR5cGUSDwoLQmFzZURl",
"ZmF1bHQQABIOCgpIYW9ZdWVBdXRoEAESBwoDQkYzEAMSBwoDQkY0EAQqSwoK",
"RGV2aWNlVHlwZRIWChJEZXZpY2VUeXBlX0RlZmF1bHQQABIGCgJQQxABEgsK",
"B0FuZHJvaWQQAhIHCgNJT1MQAxIHCgNQU1YQBCpOChFMb2dpblJlc3VsdFN0",
"YXR1cxIhCh1Mb2dpblJlc3VsdFN0YXR1c19CYXNlRGVmYXVsdBAAEgYKAk9L",
"EAESDgoKQWNjb3VudEVychACQgJIAWIGcHJvdG8z"));
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[] {
@ -86,6 +87,14 @@ namespace AxibugProtobuf {
///更新在线用户状态 下行 对应 Protobuf_UserState_RESP
/// </summary>
[pbr::OriginalName("CMD_USER_STATE_UPDATE")] CmdUserStateUpdate = 5033,
/// <summary>
///TCP打洞请求 上行 | 下行 对应 Protobuf_TcpTunnel_HellToSev | Protobuf_TcpTunnel_HellToSev_RESP
/// </summary>
[pbr::OriginalName("CMD_TCPTUNNEL_HELLO")] CmdTcptunnelHello = 5001,
/// <summary>
///TCP打洞请求 下行 对应 Protobuf_TcpTunnel_DoTunnel | Protobuf_TcpTunnel_DoTunnel_RESP
/// </summary>
[pbr::OriginalName("CMD_TCPTUNNEL_DO")] CmdTcptunnelDo = 5002,
}
public enum ErrorCode {
@ -97,6 +106,10 @@ namespace AxibugProtobuf {
///成功
/// </summary>
[pbr::OriginalName("ERROR_OK")] ErrorOk = 1,
/// <summary>
///用户不存在
/// </summary>
[pbr::OriginalName("ERROR_NOTFAND")] ErrorNotfand = 100,
}
public enum LoginType {

View File

@ -0,0 +1,920 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: protobuf_TcpTunnel.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace AxibugProtobuf {
/// <summary>Holder for reflection information generated from protobuf_TcpTunnel.proto</summary>
public static partial class ProtobufTcpTunnelReflection {
#region Descriptor
/// <summary>File descriptor for protobuf_TcpTunnel.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static ProtobufTcpTunnelReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"Chhwcm90b2J1Zl9UY3BUdW5uZWwucHJvdG8SDkF4aWJ1Z1Byb3RvYnVmIisK",
"HFByb3RvYnVmX1RjcFR1bm5lbF9IZWxsVG9TZXYSCwoDVUlEGAEgASgDIiMK",
"IVByb3RvYnVmX1RjcFR1bm5lbF9IZWxsVG9TZXZfUkVTUCI9ChtQcm90b2J1",
"Zl9UY3BUdW5uZWxfRG9UdW5uZWwSCwoDVUlEGAEgASgDEhEKCXRhcmdldFVJ",
"RBgCIAEoAyJ3CiBQcm90b2J1Zl9UY3BUdW5uZWxfRG9UdW5uZWxfUkVTUBIR",
"Cgl0YXJnZXRVSUQYASABKAMSDAoEbXlJUBgCIAEoCRIOCgZteVBvcnQYAyAB",
"KAUSDwoHb3RoZXJJUBgEIAEoCRIRCglvdGhlclBvcnQYBSABKAVCAkgBYgZw",
"cm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_TcpTunnel_HellToSev), global::AxibugProtobuf.Protobuf_TcpTunnel_HellToSev.Parser, new[]{ "UID" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_TcpTunnel_HellToSev_RESP), global::AxibugProtobuf.Protobuf_TcpTunnel_HellToSev_RESP.Parser, null, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_TcpTunnel_DoTunnel), global::AxibugProtobuf.Protobuf_TcpTunnel_DoTunnel.Parser, new[]{ "UID", "TargetUID" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_TcpTunnel_DoTunnel_RESP), global::AxibugProtobuf.Protobuf_TcpTunnel_DoTunnel_RESP.Parser, new[]{ "TargetUID", "MyIP", "MyPort", "OtherIP", "OtherPort" }, null, null, null, null)
}));
}
#endregion
}
#region Messages
/// <summary>
///Tcp打洞请求
/// </summary>
public sealed partial class Protobuf_TcpTunnel_HellToSev : pb::IMessage<Protobuf_TcpTunnel_HellToSev>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Protobuf_TcpTunnel_HellToSev> _parser = new pb::MessageParser<Protobuf_TcpTunnel_HellToSev>(() => new Protobuf_TcpTunnel_HellToSev());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Protobuf_TcpTunnel_HellToSev> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::AxibugProtobuf.ProtobufTcpTunnelReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_HellToSev() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_HellToSev(Protobuf_TcpTunnel_HellToSev other) : this() {
uID_ = other.uID_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_HellToSev Clone() {
return new Protobuf_TcpTunnel_HellToSev(this);
}
/// <summary>Field number for the "UID" field.</summary>
public const int UIDFieldNumber = 1;
private long uID_;
/// <summary>
///自己的UID
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public long UID {
get { return uID_; }
set {
uID_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Protobuf_TcpTunnel_HellToSev);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(Protobuf_TcpTunnel_HellToSev other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (UID != other.UID) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (UID != 0L) hash ^= UID.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (UID != 0L) {
output.WriteRawTag(8);
output.WriteInt64(UID);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (UID != 0L) {
output.WriteRawTag(8);
output.WriteInt64(UID);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (UID != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(UID);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(Protobuf_TcpTunnel_HellToSev other) {
if (other == null) {
return;
}
if (other.UID != 0L) {
UID = other.UID;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
UID = input.ReadInt64();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
UID = input.ReadInt64();
break;
}
}
}
}
#endif
}
/// <summary>
///Tcp打洞请求 下行
/// </summary>
public sealed partial class Protobuf_TcpTunnel_HellToSev_RESP : pb::IMessage<Protobuf_TcpTunnel_HellToSev_RESP>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Protobuf_TcpTunnel_HellToSev_RESP> _parser = new pb::MessageParser<Protobuf_TcpTunnel_HellToSev_RESP>(() => new Protobuf_TcpTunnel_HellToSev_RESP());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Protobuf_TcpTunnel_HellToSev_RESP> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::AxibugProtobuf.ProtobufTcpTunnelReflection.Descriptor.MessageTypes[1]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_HellToSev_RESP() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_HellToSev_RESP(Protobuf_TcpTunnel_HellToSev_RESP other) : this() {
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_HellToSev_RESP Clone() {
return new Protobuf_TcpTunnel_HellToSev_RESP(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Protobuf_TcpTunnel_HellToSev_RESP);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(Protobuf_TcpTunnel_HellToSev_RESP other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(Protobuf_TcpTunnel_HellToSev_RESP other) {
if (other == null) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
}
}
}
#endif
}
/// <summary>
///Tcp打洞请求
/// </summary>
public sealed partial class Protobuf_TcpTunnel_DoTunnel : pb::IMessage<Protobuf_TcpTunnel_DoTunnel>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Protobuf_TcpTunnel_DoTunnel> _parser = new pb::MessageParser<Protobuf_TcpTunnel_DoTunnel>(() => new Protobuf_TcpTunnel_DoTunnel());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Protobuf_TcpTunnel_DoTunnel> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::AxibugProtobuf.ProtobufTcpTunnelReflection.Descriptor.MessageTypes[2]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_DoTunnel() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_DoTunnel(Protobuf_TcpTunnel_DoTunnel other) : this() {
uID_ = other.uID_;
targetUID_ = other.targetUID_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_DoTunnel Clone() {
return new Protobuf_TcpTunnel_DoTunnel(this);
}
/// <summary>Field number for the "UID" field.</summary>
public const int UIDFieldNumber = 1;
private long uID_;
/// <summary>
///自己的UID
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public long UID {
get { return uID_; }
set {
uID_ = value;
}
}
/// <summary>Field number for the "targetUID" field.</summary>
public const int TargetUIDFieldNumber = 2;
private long targetUID_;
/// <summary>
///目标的UID
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public long TargetUID {
get { return targetUID_; }
set {
targetUID_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Protobuf_TcpTunnel_DoTunnel);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(Protobuf_TcpTunnel_DoTunnel other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (UID != other.UID) return false;
if (TargetUID != other.TargetUID) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (UID != 0L) hash ^= UID.GetHashCode();
if (TargetUID != 0L) hash ^= TargetUID.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (UID != 0L) {
output.WriteRawTag(8);
output.WriteInt64(UID);
}
if (TargetUID != 0L) {
output.WriteRawTag(16);
output.WriteInt64(TargetUID);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (UID != 0L) {
output.WriteRawTag(8);
output.WriteInt64(UID);
}
if (TargetUID != 0L) {
output.WriteRawTag(16);
output.WriteInt64(TargetUID);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (UID != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(UID);
}
if (TargetUID != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(TargetUID);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(Protobuf_TcpTunnel_DoTunnel other) {
if (other == null) {
return;
}
if (other.UID != 0L) {
UID = other.UID;
}
if (other.TargetUID != 0L) {
TargetUID = other.TargetUID;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
UID = input.ReadInt64();
break;
}
case 16: {
TargetUID = input.ReadInt64();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
UID = input.ReadInt64();
break;
}
case 16: {
TargetUID = input.ReadInt64();
break;
}
}
}
}
#endif
}
/// <summary>
///双方信息 下行
/// </summary>
public sealed partial class Protobuf_TcpTunnel_DoTunnel_RESP : pb::IMessage<Protobuf_TcpTunnel_DoTunnel_RESP>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Protobuf_TcpTunnel_DoTunnel_RESP> _parser = new pb::MessageParser<Protobuf_TcpTunnel_DoTunnel_RESP>(() => new Protobuf_TcpTunnel_DoTunnel_RESP());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Protobuf_TcpTunnel_DoTunnel_RESP> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::AxibugProtobuf.ProtobufTcpTunnelReflection.Descriptor.MessageTypes[3]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_DoTunnel_RESP() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_DoTunnel_RESP(Protobuf_TcpTunnel_DoTunnel_RESP other) : this() {
targetUID_ = other.targetUID_;
myIP_ = other.myIP_;
myPort_ = other.myPort_;
otherIP_ = other.otherIP_;
otherPort_ = other.otherPort_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_DoTunnel_RESP Clone() {
return new Protobuf_TcpTunnel_DoTunnel_RESP(this);
}
/// <summary>Field number for the "targetUID" field.</summary>
public const int TargetUIDFieldNumber = 1;
private long targetUID_;
/// <summary>
///目标的UID
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public long TargetUID {
get { return targetUID_; }
set {
targetUID_ = value;
}
}
/// <summary>Field number for the "myIP" field.</summary>
public const int MyIPFieldNumber = 2;
private string myIP_ = "";
/// <summary>
///自己的IP
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string MyIP {
get { return myIP_; }
set {
myIP_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "myPort" field.</summary>
public const int MyPortFieldNumber = 3;
private int myPort_;
/// <summary>
///自己的Port
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int MyPort {
get { return myPort_; }
set {
myPort_ = value;
}
}
/// <summary>Field number for the "otherIP" field.</summary>
public const int OtherIPFieldNumber = 4;
private string otherIP_ = "";
/// <summary>
///对方的IP
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string OtherIP {
get { return otherIP_; }
set {
otherIP_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "otherPort" field.</summary>
public const int OtherPortFieldNumber = 5;
private int otherPort_;
/// <summary>
///对方的Port
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int OtherPort {
get { return otherPort_; }
set {
otherPort_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Protobuf_TcpTunnel_DoTunnel_RESP);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(Protobuf_TcpTunnel_DoTunnel_RESP other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (TargetUID != other.TargetUID) return false;
if (MyIP != other.MyIP) return false;
if (MyPort != other.MyPort) return false;
if (OtherIP != other.OtherIP) return false;
if (OtherPort != other.OtherPort) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (TargetUID != 0L) hash ^= TargetUID.GetHashCode();
if (MyIP.Length != 0) hash ^= MyIP.GetHashCode();
if (MyPort != 0) hash ^= MyPort.GetHashCode();
if (OtherIP.Length != 0) hash ^= OtherIP.GetHashCode();
if (OtherPort != 0) hash ^= OtherPort.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (TargetUID != 0L) {
output.WriteRawTag(8);
output.WriteInt64(TargetUID);
}
if (MyIP.Length != 0) {
output.WriteRawTag(18);
output.WriteString(MyIP);
}
if (MyPort != 0) {
output.WriteRawTag(24);
output.WriteInt32(MyPort);
}
if (OtherIP.Length != 0) {
output.WriteRawTag(34);
output.WriteString(OtherIP);
}
if (OtherPort != 0) {
output.WriteRawTag(40);
output.WriteInt32(OtherPort);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (TargetUID != 0L) {
output.WriteRawTag(8);
output.WriteInt64(TargetUID);
}
if (MyIP.Length != 0) {
output.WriteRawTag(18);
output.WriteString(MyIP);
}
if (MyPort != 0) {
output.WriteRawTag(24);
output.WriteInt32(MyPort);
}
if (OtherIP.Length != 0) {
output.WriteRawTag(34);
output.WriteString(OtherIP);
}
if (OtherPort != 0) {
output.WriteRawTag(40);
output.WriteInt32(OtherPort);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (TargetUID != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(TargetUID);
}
if (MyIP.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(MyIP);
}
if (MyPort != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(MyPort);
}
if (OtherIP.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(OtherIP);
}
if (OtherPort != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(OtherPort);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(Protobuf_TcpTunnel_DoTunnel_RESP other) {
if (other == null) {
return;
}
if (other.TargetUID != 0L) {
TargetUID = other.TargetUID;
}
if (other.MyIP.Length != 0) {
MyIP = other.MyIP;
}
if (other.MyPort != 0) {
MyPort = other.MyPort;
}
if (other.OtherIP.Length != 0) {
OtherIP = other.OtherIP;
}
if (other.OtherPort != 0) {
OtherPort = other.OtherPort;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
TargetUID = input.ReadInt64();
break;
}
case 18: {
MyIP = input.ReadString();
break;
}
case 24: {
MyPort = input.ReadInt32();
break;
}
case 34: {
OtherIP = input.ReadString();
break;
}
case 40: {
OtherPort = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
TargetUID = input.ReadInt64();
break;
}
case 18: {
MyIP = input.ReadString();
break;
}
case 24: {
MyPort = input.ReadInt32();
break;
}
case 34: {
OtherIP = input.ReadString();
break;
}
case 40: {
OtherPort = input.ReadInt32();
break;
}
}
}
}
#endif
}
#endregion
}
#endregion Designer generated code

View File

@ -33,17 +33,18 @@ namespace AxibugProtobuf {
"dHVzGAQgASgOMiEuQXhpYnVnUHJvdG9idWYuTG9naW5SZXN1bHRTdGF0dXMi",
"IwoQUHJvdG9idWZfQ2hhdE1zZxIPCgdDaGF0TXNnGAEgASgJIkgKFVByb3Rv",
"YnVmX0NoYXRNc2dfUkVTUBIQCghOaWNrTmFtZRgBIAEoCRIPCgdDaGF0TXNn",
"GAIgASgJEgwKBERhdGUYAyABKAMqnAEKCUNvbW1hbmRJRBIOCgpDTURfREVG",
"GAIgASgJEgwKBERhdGUYAyABKAMqzQEKCUNvbW1hbmRJRBIOCgpDTURfREVG",
"QVVMEAASDgoJQ01EX0xPR0lOENAPEhAKC0NNRF9DSEFUTVNHEKAfEhgKE0NN",
"RF9VU0VSX09OTElORUxJU1QQiCcSEgoNQ01EX1VTRVJfSk9JThCnJxITCg5D",
"TURfVVNFUl9MRUFWRRCoJxIaChVDTURfVVNFUl9TVEFURV9VUERBVEUQqScq",
"KwoJRXJyb3JDb2RlEhAKDEVSUk9SX0RFRkFVTBAAEgwKCEVSUk9SX09LEAEq",
"PgoJTG9naW5UeXBlEg8KC0Jhc2VEZWZhdWx0EAASDgoKSGFvWXVlQXV0aBAB",
"EgcKA0JGMxADEgcKA0JGNBAEKksKCkRldmljZVR5cGUSFgoSRGV2aWNlVHlw",
"ZV9EZWZhdWx0EAASBgoCUEMQARILCgdBbmRyb2lkEAISBwoDSU9TEAMSBwoD",
"UFNWEAQqTgoRTG9naW5SZXN1bHRTdGF0dXMSIQodTG9naW5SZXN1bHRTdGF0",
"dXNfQmFzZURlZmF1bHQQABIGCgJPSxABEg4KCkFjY291bnRFcnIQAkICSAFi",
"BnByb3RvMw=="));
"TURfVVNFUl9MRUFWRRCoJxIaChVDTURfVVNFUl9TVEFURV9VUERBVEUQqScS",
"GAoTQ01EX1RDUFRVTk5FTF9IRUxMTxCJJxIVChBDTURfVENQVFVOTkVMX0RP",
"EIonKj4KCUVycm9yQ29kZRIQCgxFUlJPUl9ERUZBVUwQABIMCghFUlJPUl9P",
"SxABEhEKDUVSUk9SX05PVEZBTkQQZCo+CglMb2dpblR5cGUSDwoLQmFzZURl",
"ZmF1bHQQABIOCgpIYW9ZdWVBdXRoEAESBwoDQkYzEAMSBwoDQkY0EAQqSwoK",
"RGV2aWNlVHlwZRIWChJEZXZpY2VUeXBlX0RlZmF1bHQQABIGCgJQQxABEgsK",
"B0FuZHJvaWQQAhIHCgNJT1MQAxIHCgNQU1YQBCpOChFMb2dpblJlc3VsdFN0",
"YXR1cxIhCh1Mb2dpblJlc3VsdFN0YXR1c19CYXNlRGVmYXVsdBAAEgYKAk9L",
"EAESDgoKQWNjb3VudEVychACQgJIAWIGcHJvdG8z"));
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[] {
@ -86,6 +87,14 @@ namespace AxibugProtobuf {
///更新在线用户状态 下行 对应 Protobuf_UserState_RESP
/// </summary>
[pbr::OriginalName("CMD_USER_STATE_UPDATE")] CmdUserStateUpdate = 5033,
/// <summary>
///TCP打洞请求 上行 | 下行 对应 Protobuf_TcpTunnel_HellToSev | Protobuf_TcpTunnel_HellToSev_RESP
/// </summary>
[pbr::OriginalName("CMD_TCPTUNNEL_HELLO")] CmdTcptunnelHello = 5001,
/// <summary>
///TCP打洞请求 下行 对应 Protobuf_TcpTunnel_DoTunnel | Protobuf_TcpTunnel_DoTunnel_RESP
/// </summary>
[pbr::OriginalName("CMD_TCPTUNNEL_DO")] CmdTcptunnelDo = 5002,
}
public enum ErrorCode {
@ -97,6 +106,10 @@ namespace AxibugProtobuf {
///成功
/// </summary>
[pbr::OriginalName("ERROR_OK")] ErrorOk = 1,
/// <summary>
///用户不存在
/// </summary>
[pbr::OriginalName("ERROR_NOTFAND")] ErrorNotfand = 100,
}
public enum LoginType {

View File

@ -0,0 +1,920 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: protobuf_TcpTunnel.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace AxibugProtobuf {
/// <summary>Holder for reflection information generated from protobuf_TcpTunnel.proto</summary>
public static partial class ProtobufTcpTunnelReflection {
#region Descriptor
/// <summary>File descriptor for protobuf_TcpTunnel.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static ProtobufTcpTunnelReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"Chhwcm90b2J1Zl9UY3BUdW5uZWwucHJvdG8SDkF4aWJ1Z1Byb3RvYnVmIisK",
"HFByb3RvYnVmX1RjcFR1bm5lbF9IZWxsVG9TZXYSCwoDVUlEGAEgASgDIiMK",
"IVByb3RvYnVmX1RjcFR1bm5lbF9IZWxsVG9TZXZfUkVTUCI9ChtQcm90b2J1",
"Zl9UY3BUdW5uZWxfRG9UdW5uZWwSCwoDVUlEGAEgASgDEhEKCXRhcmdldFVJ",
"RBgCIAEoAyJ3CiBQcm90b2J1Zl9UY3BUdW5uZWxfRG9UdW5uZWxfUkVTUBIR",
"Cgl0YXJnZXRVSUQYASABKAMSDAoEbXlJUBgCIAEoCRIOCgZteVBvcnQYAyAB",
"KAUSDwoHb3RoZXJJUBgEIAEoCRIRCglvdGhlclBvcnQYBSABKAVCAkgBYgZw",
"cm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_TcpTunnel_HellToSev), global::AxibugProtobuf.Protobuf_TcpTunnel_HellToSev.Parser, new[]{ "UID" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_TcpTunnel_HellToSev_RESP), global::AxibugProtobuf.Protobuf_TcpTunnel_HellToSev_RESP.Parser, null, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_TcpTunnel_DoTunnel), global::AxibugProtobuf.Protobuf_TcpTunnel_DoTunnel.Parser, new[]{ "UID", "TargetUID" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_TcpTunnel_DoTunnel_RESP), global::AxibugProtobuf.Protobuf_TcpTunnel_DoTunnel_RESP.Parser, new[]{ "TargetUID", "MyIP", "MyPort", "OtherIP", "OtherPort" }, null, null, null, null)
}));
}
#endregion
}
#region Messages
/// <summary>
///Tcp打洞请求
/// </summary>
public sealed partial class Protobuf_TcpTunnel_HellToSev : pb::IMessage<Protobuf_TcpTunnel_HellToSev>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Protobuf_TcpTunnel_HellToSev> _parser = new pb::MessageParser<Protobuf_TcpTunnel_HellToSev>(() => new Protobuf_TcpTunnel_HellToSev());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Protobuf_TcpTunnel_HellToSev> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::AxibugProtobuf.ProtobufTcpTunnelReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_HellToSev() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_HellToSev(Protobuf_TcpTunnel_HellToSev other) : this() {
uID_ = other.uID_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_HellToSev Clone() {
return new Protobuf_TcpTunnel_HellToSev(this);
}
/// <summary>Field number for the "UID" field.</summary>
public const int UIDFieldNumber = 1;
private long uID_;
/// <summary>
///自己的UID
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public long UID {
get { return uID_; }
set {
uID_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Protobuf_TcpTunnel_HellToSev);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(Protobuf_TcpTunnel_HellToSev other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (UID != other.UID) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (UID != 0L) hash ^= UID.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (UID != 0L) {
output.WriteRawTag(8);
output.WriteInt64(UID);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (UID != 0L) {
output.WriteRawTag(8);
output.WriteInt64(UID);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (UID != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(UID);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(Protobuf_TcpTunnel_HellToSev other) {
if (other == null) {
return;
}
if (other.UID != 0L) {
UID = other.UID;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
UID = input.ReadInt64();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
UID = input.ReadInt64();
break;
}
}
}
}
#endif
}
/// <summary>
///Tcp打洞请求 下行
/// </summary>
public sealed partial class Protobuf_TcpTunnel_HellToSev_RESP : pb::IMessage<Protobuf_TcpTunnel_HellToSev_RESP>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Protobuf_TcpTunnel_HellToSev_RESP> _parser = new pb::MessageParser<Protobuf_TcpTunnel_HellToSev_RESP>(() => new Protobuf_TcpTunnel_HellToSev_RESP());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Protobuf_TcpTunnel_HellToSev_RESP> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::AxibugProtobuf.ProtobufTcpTunnelReflection.Descriptor.MessageTypes[1]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_HellToSev_RESP() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_HellToSev_RESP(Protobuf_TcpTunnel_HellToSev_RESP other) : this() {
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_HellToSev_RESP Clone() {
return new Protobuf_TcpTunnel_HellToSev_RESP(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Protobuf_TcpTunnel_HellToSev_RESP);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(Protobuf_TcpTunnel_HellToSev_RESP other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(Protobuf_TcpTunnel_HellToSev_RESP other) {
if (other == null) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
}
}
}
#endif
}
/// <summary>
///Tcp打洞请求
/// </summary>
public sealed partial class Protobuf_TcpTunnel_DoTunnel : pb::IMessage<Protobuf_TcpTunnel_DoTunnel>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Protobuf_TcpTunnel_DoTunnel> _parser = new pb::MessageParser<Protobuf_TcpTunnel_DoTunnel>(() => new Protobuf_TcpTunnel_DoTunnel());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Protobuf_TcpTunnel_DoTunnel> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::AxibugProtobuf.ProtobufTcpTunnelReflection.Descriptor.MessageTypes[2]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_DoTunnel() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_DoTunnel(Protobuf_TcpTunnel_DoTunnel other) : this() {
uID_ = other.uID_;
targetUID_ = other.targetUID_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_DoTunnel Clone() {
return new Protobuf_TcpTunnel_DoTunnel(this);
}
/// <summary>Field number for the "UID" field.</summary>
public const int UIDFieldNumber = 1;
private long uID_;
/// <summary>
///自己的UID
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public long UID {
get { return uID_; }
set {
uID_ = value;
}
}
/// <summary>Field number for the "targetUID" field.</summary>
public const int TargetUIDFieldNumber = 2;
private long targetUID_;
/// <summary>
///目标的UID
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public long TargetUID {
get { return targetUID_; }
set {
targetUID_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Protobuf_TcpTunnel_DoTunnel);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(Protobuf_TcpTunnel_DoTunnel other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (UID != other.UID) return false;
if (TargetUID != other.TargetUID) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (UID != 0L) hash ^= UID.GetHashCode();
if (TargetUID != 0L) hash ^= TargetUID.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (UID != 0L) {
output.WriteRawTag(8);
output.WriteInt64(UID);
}
if (TargetUID != 0L) {
output.WriteRawTag(16);
output.WriteInt64(TargetUID);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (UID != 0L) {
output.WriteRawTag(8);
output.WriteInt64(UID);
}
if (TargetUID != 0L) {
output.WriteRawTag(16);
output.WriteInt64(TargetUID);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (UID != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(UID);
}
if (TargetUID != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(TargetUID);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(Protobuf_TcpTunnel_DoTunnel other) {
if (other == null) {
return;
}
if (other.UID != 0L) {
UID = other.UID;
}
if (other.TargetUID != 0L) {
TargetUID = other.TargetUID;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
UID = input.ReadInt64();
break;
}
case 16: {
TargetUID = input.ReadInt64();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
UID = input.ReadInt64();
break;
}
case 16: {
TargetUID = input.ReadInt64();
break;
}
}
}
}
#endif
}
/// <summary>
///双方信息 下行
/// </summary>
public sealed partial class Protobuf_TcpTunnel_DoTunnel_RESP : pb::IMessage<Protobuf_TcpTunnel_DoTunnel_RESP>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Protobuf_TcpTunnel_DoTunnel_RESP> _parser = new pb::MessageParser<Protobuf_TcpTunnel_DoTunnel_RESP>(() => new Protobuf_TcpTunnel_DoTunnel_RESP());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Protobuf_TcpTunnel_DoTunnel_RESP> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::AxibugProtobuf.ProtobufTcpTunnelReflection.Descriptor.MessageTypes[3]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_DoTunnel_RESP() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_DoTunnel_RESP(Protobuf_TcpTunnel_DoTunnel_RESP other) : this() {
targetUID_ = other.targetUID_;
myIP_ = other.myIP_;
myPort_ = other.myPort_;
otherIP_ = other.otherIP_;
otherPort_ = other.otherPort_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Protobuf_TcpTunnel_DoTunnel_RESP Clone() {
return new Protobuf_TcpTunnel_DoTunnel_RESP(this);
}
/// <summary>Field number for the "targetUID" field.</summary>
public const int TargetUIDFieldNumber = 1;
private long targetUID_;
/// <summary>
///目标的UID
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public long TargetUID {
get { return targetUID_; }
set {
targetUID_ = value;
}
}
/// <summary>Field number for the "myIP" field.</summary>
public const int MyIPFieldNumber = 2;
private string myIP_ = "";
/// <summary>
///自己的IP
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string MyIP {
get { return myIP_; }
set {
myIP_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "myPort" field.</summary>
public const int MyPortFieldNumber = 3;
private int myPort_;
/// <summary>
///自己的Port
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int MyPort {
get { return myPort_; }
set {
myPort_ = value;
}
}
/// <summary>Field number for the "otherIP" field.</summary>
public const int OtherIPFieldNumber = 4;
private string otherIP_ = "";
/// <summary>
///对方的IP
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string OtherIP {
get { return otherIP_; }
set {
otherIP_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "otherPort" field.</summary>
public const int OtherPortFieldNumber = 5;
private int otherPort_;
/// <summary>
///对方的Port
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int OtherPort {
get { return otherPort_; }
set {
otherPort_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Protobuf_TcpTunnel_DoTunnel_RESP);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(Protobuf_TcpTunnel_DoTunnel_RESP other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (TargetUID != other.TargetUID) return false;
if (MyIP != other.MyIP) return false;
if (MyPort != other.MyPort) return false;
if (OtherIP != other.OtherIP) return false;
if (OtherPort != other.OtherPort) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (TargetUID != 0L) hash ^= TargetUID.GetHashCode();
if (MyIP.Length != 0) hash ^= MyIP.GetHashCode();
if (MyPort != 0) hash ^= MyPort.GetHashCode();
if (OtherIP.Length != 0) hash ^= OtherIP.GetHashCode();
if (OtherPort != 0) hash ^= OtherPort.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (TargetUID != 0L) {
output.WriteRawTag(8);
output.WriteInt64(TargetUID);
}
if (MyIP.Length != 0) {
output.WriteRawTag(18);
output.WriteString(MyIP);
}
if (MyPort != 0) {
output.WriteRawTag(24);
output.WriteInt32(MyPort);
}
if (OtherIP.Length != 0) {
output.WriteRawTag(34);
output.WriteString(OtherIP);
}
if (OtherPort != 0) {
output.WriteRawTag(40);
output.WriteInt32(OtherPort);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (TargetUID != 0L) {
output.WriteRawTag(8);
output.WriteInt64(TargetUID);
}
if (MyIP.Length != 0) {
output.WriteRawTag(18);
output.WriteString(MyIP);
}
if (MyPort != 0) {
output.WriteRawTag(24);
output.WriteInt32(MyPort);
}
if (OtherIP.Length != 0) {
output.WriteRawTag(34);
output.WriteString(OtherIP);
}
if (OtherPort != 0) {
output.WriteRawTag(40);
output.WriteInt32(OtherPort);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (TargetUID != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(TargetUID);
}
if (MyIP.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(MyIP);
}
if (MyPort != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(MyPort);
}
if (OtherIP.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(OtherIP);
}
if (OtherPort != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(OtherPort);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(Protobuf_TcpTunnel_DoTunnel_RESP other) {
if (other == null) {
return;
}
if (other.TargetUID != 0L) {
TargetUID = other.TargetUID;
}
if (other.MyIP.Length != 0) {
MyIP = other.MyIP;
}
if (other.MyPort != 0) {
MyPort = other.MyPort;
}
if (other.OtherIP.Length != 0) {
OtherIP = other.OtherIP;
}
if (other.OtherPort != 0) {
OtherPort = other.OtherPort;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
TargetUID = input.ReadInt64();
break;
}
case 18: {
MyIP = input.ReadString();
break;
}
case 24: {
MyPort = input.ReadInt32();
break;
}
case 34: {
OtherIP = input.ReadString();
break;
}
case 40: {
OtherPort = input.ReadInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
TargetUID = input.ReadInt64();
break;
}
case 18: {
MyIP = input.ReadString();
break;
}
case 24: {
MyPort = input.ReadInt32();
break;
}
case 34: {
OtherIP = input.ReadString();
break;
}
case 40: {
OtherPort = input.ReadInt32();
break;
}
}
}
}
#endif
}
#endregion
}
#endregion Designer generated code

View File

@ -15,15 +15,15 @@ enum CommandID
CMD_USER_LEAVE = 5032; //线 Protobuf_UserOffline_RESP
CMD_USER_STATE_UPDATE = 5033; //线 Protobuf_UserState_RESP
//CMD_TUNNEL_UDPSERVER_INFO = 6000; //UDP服务器信息 | Protobuf_UDPServer_Info | Protobuf_UDPServer_Info_RESP
//CMD_TUNNEL_2Server_OK = 6001; //UDP建立连接 Protobuf_MakeTunnel_RESP
//CMD_TUNNEL_MAKE = 6002; // | Protobuf_MakeTunnel | Protobuf_MakeTunnel_RESP
CMD_TCPTUNNEL_HELLO = 5001; //TCP打洞请求 | Protobuf_TcpTunnel_HellToSev | Protobuf_TcpTunnel_HellToSev_RESP
CMD_TCPTUNNEL_DO = 5002; //TCP打洞请求 Protobuf_TcpTunnel_DoTunnel | Protobuf_TcpTunnel_DoTunnel_RESP
}
enum ErrorCode
{
ERROR_DEFAUL = 0;//使
ERROR_OK = 1; //
ERROR_NOTFIND = 100; //
}
enum LoginType

View File

@ -0,0 +1,32 @@
syntax = "proto3";
package AxibugProtobuf;
option optimize_for = SPEED;
//Tcp打洞请求
message Protobuf_TcpTunnel_HellToSev
{
int64 UID = 1;//UID
}
//Tcp打洞请求
message Protobuf_TcpTunnel_HellToSev_RESP
{
}
//Tcp打洞请求
message Protobuf_TcpTunnel_DoTunnel
{
int64 UID = 1;//UID
int64 targetUID = 2;//UID
}
//
message Protobuf_TcpTunnel_DoTunnel_RESP
{
int64 targetUID = 1;//UID
string myIP = 2;//IP
int32 myPort = 3;//Port
string otherIP = 4;//IP
int32 otherPort = 5;//Port
}

View File

@ -1,6 +1,6 @@
using ServerCore.Manager;
ServerManager.InitServer(23846);
ServerManager.InitServer(23846, 23847);
while (true)
{

View File

@ -11,19 +11,26 @@ namespace ServerCore.Manager
public static LoginManager g_Login;
public static ChatManager g_Chat;
public static P2PUserManager g_P2PMgr;
public static TcpTunnelClientManager g_TcpTunnelMgr;
public static IOCPNetWork g_SocketMgr;
public static IOCPNetWork g_SocketTcpTunnelMgr;
public static void InitServer(int port)
public static void InitServer(int port, int tcptunnelport)
{
g_ClientMgr = new ClientManager();
g_Log = new LogManager();
g_Login = new LoginManager();
g_Chat = new ChatManager();
g_P2PMgr = new P2PUserManager();
g_TcpTunnelMgr = new TcpTunnelClientManager();
g_SocketMgr = new IOCPNetWork(1024, 1024);
g_SocketMgr.Init();
g_SocketMgr.Start(new IPEndPoint(IPAddress.Any.Address, port));
Console.WriteLine("监听:" + port);
g_SocketMgr.Start(new IPEndPoint(IPAddress.Any.Address, port));
g_SocketTcpTunnelMgr = new IOCPNetWork(1024, 1024);
g_SocketTcpTunnelMgr.Init();
g_SocketTcpTunnelMgr.Start(new IPEndPoint(IPAddress.Any.Address, tcptunnelport));
Console.WriteLine("监听:" + tcptunnelport);
Console.WriteLine("Succeed!");
}
}

View File

@ -0,0 +1,146 @@
using AxibugProtobuf;
using ServerCore.Common;
using ServerCore.Event;
using ServerCore.NetWork;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Timers;
using static System.Runtime.CompilerServices.RuntimeHelpers;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace ServerCore.Manager
{
public class TCPTunnelClientInfo
{
public long UID { get; set; }
public string IP { get; set; }
public int Port { get; set; }
public Socket _Socket { get; set; }
}
public class TcpTunnelClientManager
{
public TcpTunnelClientManager()
{
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTcptunnelHello, TcpTunnelHello);
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdTcptunnelDo, TcptunnelDo);
}
private Dictionary<long, TCPTunnelClientInfo> _DictUID2Client = new Dictionary<long, TCPTunnelClientInfo>();
private Dictionary<Socket, TCPTunnelClientInfo> _DictScoket2Client = new Dictionary<Socket, TCPTunnelClientInfo>();
void AddClient(long UID,Socket _socket)
{
IPEndPoint ipEndPoint = (IPEndPoint)_socket.RemoteEndPoint;
if (!_DictUID2Client.ContainsKey(UID))
{
TCPTunnelClientInfo cinfo = new TCPTunnelClientInfo()
{
UID = UID,
IP = ipEndPoint.Address.ToString(),
Port = ipEndPoint.Port,
_Socket = _socket
};
_DictScoket2Client[_socket] = cinfo;
}
else
{
_DictUID2Client[UID].UID = UID;
_DictUID2Client[UID].IP = ipEndPoint.Address.ToString();
_DictUID2Client[UID].Port = ipEndPoint.Port;
_DictUID2Client[UID]._Socket = _socket;
_DictScoket2Client[_socket] = _DictUID2Client[UID];
}
}
void RemoveClient(long UID)
{
if (_DictUID2Client.ContainsKey(UID))
{
_DictScoket2Client.Remove(_DictUID2Client[UID]._Socket);
_DictUID2Client.Remove(UID);
}
}
void RemoveClientBySocket(Socket _socket)
{
if (_DictScoket2Client.ContainsKey(_socket))
{
_DictUID2Client.Remove(_DictScoket2Client[_socket].UID);
_DictScoket2Client.Remove(_socket);
}
}
TCPTunnelClientInfo GetClient(long UID)
{
if (_DictUID2Client.ContainsKey(UID))
{
return _DictUID2Client[UID];
}
else
return null;
}
public void TcpTunnelHello(Socket _socket, byte[] reqData)
{
ServerManager.g_Log.Debug("收到TcpTunnel 打洞端口Hello");
Protobuf_TcpTunnel_HellToSev msg = ProtoBufHelper.DeSerizlize<Protobuf_TcpTunnel_HellToSev>(reqData);
AddClient(msg.UID, _socket);
Protobuf_TcpTunnel_HellToSev_RESP resp = new Protobuf_TcpTunnel_HellToSev_RESP();
ClientSend(msg.UID, (int)CommandID.CmdTcptunnelHello, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp));
}
public void TcptunnelDo(Socket _socket, byte[] reqData)
{
ServerManager.g_Log.Debug("收到TcpTunnel 打洞端口Hello");
Protobuf_TcpTunnel_DoTunnel msg = ProtoBufHelper.DeSerizlize<Protobuf_TcpTunnel_DoTunnel>(reqData);
TCPTunnelClientInfo Other = GetClient(msg.TargetUID);
if (Other == null)
{
Protobuf_TcpTunnel_DoTunnel_RESP respToErr = new Protobuf_TcpTunnel_DoTunnel_RESP();
ClientSend(msg.UID, (int)CommandID.CmdTcptunnelDo, (int)ErrorCode.ErrorNotfand, ProtoBufHelper.Serizlize(respToErr));
return;
}
TCPTunnelClientInfo mine = GetClient(msg.UID);
Protobuf_TcpTunnel_DoTunnel_RESP respToMine = new Protobuf_TcpTunnel_DoTunnel_RESP()
{
MyIP = mine.IP,
MyPort = mine.Port,
OtherIP = Other.IP,
OtherPort= Other.Port,
TargetUID = msg.TargetUID,
};
ClientSend(msg.UID, (int)CommandID.CmdTcptunnelHello, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(respToMine));
Protobuf_TcpTunnel_DoTunnel_RESP respToOther = new Protobuf_TcpTunnel_DoTunnel_RESP()
{
MyIP = Other.IP,
MyPort = Other.Port,
OtherIP = mine.IP,
OtherPort = mine.Port,
TargetUID = msg.UID,
};
ClientSend(msg.TargetUID, (int)CommandID.CmdTcptunnelHello, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(respToOther));
}
/// <summary>
/// 错误
/// </summary>
/// <param name="UID"></param>
/// <param name="CMDID"></param>
/// <param name="ERRCODE"></param>
/// <param name="data"></param>
public void ClientSend(long UID, int CMDID, int ERRCODE, byte[] data)
{
if (_DictUID2Client.ContainsKey(UID))
{
ServerManager.g_SocketTcpTunnelMgr.SendToSocket(_DictUID2Client[UID]._Socket, CMDID, ERRCODE, data);
}
}
}
}

View File

@ -60,19 +60,11 @@ namespace ServerCore.NetWork
/// </summary>
/// <param name="sk"></param>
public override void OnClose(AsyncUserToken token)
{
OnCloseToOld(token.Socket);
}
/// <summary>
/// 断开连接
/// </summary>
/// <param name="sk"></param>
public void OnCloseToOld(Socket sk)
{
Console.WriteLine("断开连接");
ServerManager.g_ClientMgr.SetClientOfflineForSocket(sk);
//TODO 要删除不同的
ServerManager.g_ClientMgr.SetClientOfflineForSocket(token.Socket);
s
}
}
}