规范配置
This commit is contained in:
parent
6339c18de7
commit
cd1809587b
@ -5,11 +5,10 @@ namespace NoSugarNet.ClientCore.Common
|
|||||||
public struct TunnelClientData
|
public struct TunnelClientData
|
||||||
{
|
{
|
||||||
public byte TunnelId;
|
public byte TunnelId;
|
||||||
public string ServerLocalTargetIP;
|
public string LocalTargetIP;
|
||||||
public ushort ServerLocalTargetPort;
|
public ushort LocalTargetPort;
|
||||||
public ushort ClientLocalPort;
|
public ushort RemoteLocalPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Config
|
public static class Config
|
||||||
{
|
{
|
||||||
public static Dictionary<byte, TunnelClientData> cfgs = new Dictionary<byte, TunnelClientData>();
|
public static Dictionary<byte, TunnelClientData> cfgs = new Dictionary<byte, TunnelClientData>();
|
||||||
|
@ -49,7 +49,7 @@ namespace ServerCore.Manager
|
|||||||
_Protobuf_Cfgs.Cfgs.Clear();
|
_Protobuf_Cfgs.Cfgs.Clear();
|
||||||
foreach (var cfg in Config.cfgs)
|
foreach (var cfg in Config.cfgs)
|
||||||
{
|
{
|
||||||
_Protobuf_Cfgs.Cfgs.Add(new Protobuf_Cfgs_Single() { Port = cfg.Value.ClientLocalPort, TunnelID = cfg.Value.TunnelId });
|
_Protobuf_Cfgs.Cfgs.Add(new Protobuf_Cfgs_Single() { Port = cfg.Value.RemoteLocalPort, TunnelID = cfg.Value.TunnelId });
|
||||||
}
|
}
|
||||||
AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdClientCfgs, ProtoBufHelper.Serizlize(_Protobuf_Cfgs));
|
AppNoSugarNet.networkHelper.SendToServer((int)CommandID.CmdClientCfgs, ProtoBufHelper.Serizlize(_Protobuf_Cfgs));
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ namespace ServerCore.Manager
|
|||||||
BackwardLocalClient serverLocalClient = new BackwardLocalClient(AppNoSugarNet.user.userdata.UID, tunnelId, (byte)Idx);
|
BackwardLocalClient serverLocalClient = new BackwardLocalClient(AppNoSugarNet.user.userdata.UID, tunnelId, (byte)Idx);
|
||||||
serverLocalClient.BandEvent(AppNoSugarNet.log.Log, OnClientLocalConnect, OnClientLocalDisconnect, OnClientLocalDataCallBack);
|
serverLocalClient.BandEvent(AppNoSugarNet.log.Log, OnClientLocalConnect, OnClientLocalDisconnect, OnClientLocalDataCallBack);
|
||||||
//连接成功
|
//连接成功
|
||||||
if (!serverLocalClient.Init(tunnelDataCfg.ServerLocalTargetIP, tunnelDataCfg.ServerLocalTargetPort))
|
if (!serverLocalClient.Init(tunnelDataCfg.LocalTargetIP, tunnelDataCfg.LocalTargetPort))
|
||||||
{
|
{
|
||||||
//TODO告知客户端连接失败
|
//TODO告知客户端连接失败
|
||||||
|
|
||||||
|
@ -23,9 +23,9 @@ namespace NoSugarNet.ClientCli
|
|||||||
dictTunnel[(byte)i] = new TunnelClientData()
|
dictTunnel[(byte)i] = new TunnelClientData()
|
||||||
{
|
{
|
||||||
TunnelId = (byte)i,
|
TunnelId = (byte)i,
|
||||||
ServerLocalTargetIP = cfgSingle.LocalTargetIP,
|
LocalTargetIP = cfgSingle.LocalTargetIP,
|
||||||
ServerLocalTargetPort = (ushort)cfgSingle.LocalTargetPort,
|
LocalTargetPort = (ushort)cfgSingle.LocalTargetPort,
|
||||||
ClientLocalPort = (ushort)cfgSingle.ClientLocalPort,
|
RemoteLocalPort = (ushort)cfgSingle.RemoteLocalPort,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user