新增打洞协议,一种同时打开的TCP打洞方法

This commit is contained in:
snltty
2024-07-03 16:25:49 +08:00
parent f4a7545ae9
commit 1eba41ed73
17 changed files with 98 additions and 58 deletions

View File

@@ -15,8 +15,8 @@
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl> <PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl> <RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<Version>1.1.1</Version> <Version>1.1.1</Version>
<AssemblyVersion>1.1.1.1</AssemblyVersion> <AssemblyVersion>1.1.1.2</AssemblyVersion>
<FileVersion>1.1.1.1</FileVersion> <FileVersion>1.1.1.2</FileVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>

View File

@@ -14,6 +14,16 @@
<PublishAot>true</PublishAot> <PublishAot>true</PublishAot>
<JsonSerializerIsReflectionEnabledByDefault>true</JsonSerializerIsReflectionEnabledByDefault> <JsonSerializerIsReflectionEnabledByDefault>true</JsonSerializerIsReflectionEnabledByDefault>
<EnablePreviewFeatures>true</EnablePreviewFeatures> <EnablePreviewFeatures>true</EnablePreviewFeatures>
<Version>1.1.1</Version>
<Authors>snltty</Authors>
<Company>snltty</Company>
<Description>snltty</Description>
<Copyright>snltty</Copyright>
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<PackageReleaseNotes>snltty service</PackageReleaseNotes>
<AssemblyVersion>1.1.1.2</AssemblyVersion>
<FileVersion>1.1.1.2</FileVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -170,8 +170,8 @@ namespace linker.tunnel
LoggerHelper.Instance.Error($"tunnel {transport.Name} get remote {remoteMachineId} external ip fail "); LoggerHelper.Instance.Error($"tunnel {transport.Name} get remote {remoteMachineId} external ip fail ");
break; break;
} }
LoggerHelper.Instance.Info($"tunnel {transport.Name} got local external ip {localInfo.ToJson()}"); LoggerHelper.Instance.Info($"tunnel {transport.Name} got local external ip {localInfo.Result.ToJson()}");
LoggerHelper.Instance.Info($"tunnel {transport.Name} got remote external ip {remoteInfo.ToJson()}"); LoggerHelper.Instance.Info($"tunnel {transport.Name} got remote external ip {remoteInfo.Result.ToJson()}");
tunnelTransportInfo = new TunnelTransportInfo tunnelTransportInfo = new TunnelTransportInfo
@@ -265,10 +265,7 @@ namespace linker.tunnel
public void OnFail(TunnelTransportInfo tunnelTransportInfo) public void OnFail(TunnelTransportInfo tunnelTransportInfo)
{ {
ITunnelTransport _transports = transports.FirstOrDefault(c => c.Name == tunnelTransportInfo.TransportName && c.ProtocolType == tunnelTransportInfo.TransportType); ITunnelTransport _transports = transports.FirstOrDefault(c => c.Name == tunnelTransportInfo.TransportName && c.ProtocolType == tunnelTransportInfo.TransportType);
if (_transports != null) _transports?.OnFail(tunnelTransportInfo);
{
_transports.OnFail(tunnelTransportInfo);
}
} }
/// <summary> /// <summary>
/// 收到对方发来的连接成功的消息 /// 收到对方发来的连接成功的消息
@@ -277,10 +274,7 @@ namespace linker.tunnel
public void OnSuccess(TunnelTransportInfo tunnelTransportInfo) public void OnSuccess(TunnelTransportInfo tunnelTransportInfo)
{ {
ITunnelTransport _transports = transports.FirstOrDefault(c => c.Name == tunnelTransportInfo.TransportName && c.ProtocolType == tunnelTransportInfo.TransportType); ITunnelTransport _transports = transports.FirstOrDefault(c => c.Name == tunnelTransportInfo.TransportName && c.ProtocolType == tunnelTransportInfo.TransportType);
if (_transports != null) _transports?.OnSuccess(tunnelTransportInfo);
{
_transports.OnSuccess(tunnelTransportInfo);
}
} }
/// <summary> /// <summary>
@@ -290,6 +284,7 @@ namespace linker.tunnel
public async Task<TunnelTransportWanPortInfo> GetWanPort(TunnelWanPortProtocolInfo _info) public async Task<TunnelTransportWanPortInfo> GetWanPort(TunnelWanPortProtocolInfo _info)
{ {
TunnelWanPortInfo info = tunnelAdapter.GetTunnelWanPortProtocols().FirstOrDefault(c => c.Type == _info.Type && c.ProtocolType == _info.ProtocolType); TunnelWanPortInfo info = tunnelAdapter.GetTunnelWanPortProtocols().FirstOrDefault(c => c.Type == _info.Type && c.ProtocolType == _info.ProtocolType);
if (info == null) return null;
return await GetLocalInfo(info).ConfigureAwait(false); return await GetLocalInfo(info).ConfigureAwait(false);
} }

View File

@@ -17,8 +17,8 @@
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl> <PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl> <RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<PackageReleaseNotes>linker tunnel</PackageReleaseNotes> <PackageReleaseNotes>linker tunnel</PackageReleaseNotes>
<AssemblyVersion>1.1.1.1</AssemblyVersion> <AssemblyVersion>1.1.1.2</AssemblyVersion>
<FileVersion>1.1.1.1</FileVersion> <FileVersion>1.1.1.2</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -224,11 +224,6 @@ namespace linker.tunnel.proxy
{ {
if (token.Proxy.TargetEP == null) return; if (token.Proxy.TargetEP == null) return;
if (LoggerHelper.Instance.LoggerLevel <= LoggerTypes.DEBUG)
{
LoggerHelper.Instance.Warning($"connect {token.Proxy.ConnectId} {token.Proxy.TargetEP}");
}
Socket socket = new Socket(token.Proxy.TargetEP.AddressFamily, SocketType.Stream, ProtocolType.Tcp); Socket socket = new Socket(token.Proxy.TargetEP.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
socket.KeepAlive(); socket.KeepAlive();
@@ -258,11 +253,7 @@ namespace linker.tunnel.proxy
token.Socket.EndConnect(result); token.Socket.EndConnect(result);
token.Socket.KeepAlive(); token.Socket.KeepAlive();
if (LoggerHelper.Instance.LoggerLevel <= LoggerTypes.DEBUG)
{
LoggerHelper.Instance.Warning($"connect {token.Proxy.ConnectId} {token.Proxy.TargetEP} success");
}
if (state.Data.Length > 0) if (state.Data.Length > 0)
{ {
await token.Socket.SendAsync(state.Data.AsMemory(0, state.Length), SocketFlags.None).ConfigureAwait(false); await token.Socket.SendAsync(state.Data.AsMemory(0, state.Length), SocketFlags.None).ConfigureAwait(false);

View File

@@ -18,9 +18,9 @@ namespace linker.tunnel.transport
public string Label => "TCP、同时打开"; public string Label => "TCP、同时打开";
public TunnelProtocolType ProtocolType => TunnelProtocolType.Tcp; public TunnelProtocolType ProtocolType => TunnelProtocolType.Tcp;
public TunnelWanPortProtocolType AllowWanPortProtocolType => TunnelWanPortProtocolType.Tcp; public TunnelWanPortProtocolType AllowWanPortProtocolType => TunnelWanPortProtocolType.Tcp;
public bool Reverse => false; public bool Reverse => true;
public bool DisableReverse => true; public bool DisableReverse => false;
public bool SSL => true; public bool SSL => true;
@@ -65,7 +65,10 @@ namespace linker.tunnel.transport
{ {
return null; return null;
} }
await Task.Delay(50).ConfigureAwait(false); if(tunnelTransportInfo.Direction == TunnelDirection.Reverse)
{
await Task.Delay(50).ConfigureAwait(false);
}
ITunnelConnection connection = await ConnectForward(tunnelTransportInfo, TunnelMode.Client).ConfigureAwait(false); ITunnelConnection connection = await ConnectForward(tunnelTransportInfo, TunnelMode.Client).ConfigureAwait(false);
if (connection != null) if (connection != null)
{ {

View File

@@ -68,6 +68,7 @@ namespace linker.tunnel.wanport
{ {
public TunnelWanPortType Value { get; set; } public TunnelWanPortType Value { get; set; }
public string Name { get; set; } public string Name { get; set; }
public Dictionary<int, string> Protocols { get; set; } = new Dictionary<int, string>();
} }
public sealed class TunnelWanPortTypeInfoEqualityComparer : IEqualityComparer<TunnelWanPortTypeInfo> public sealed class TunnelWanPortTypeInfoEqualityComparer : IEqualityComparer<TunnelWanPortTypeInfo>

View File

@@ -75,8 +75,8 @@ namespace linker.tunnel.wanport
try try
{ {
Socket socket = new Socket(server.AddressFamily, SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp); Socket socket = new Socket(server.AddressFamily, SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp);
socket.Reuse(true);
await socket.ConnectAsync(server).ConfigureAwait(false); await socket.ConnectAsync(server).ConfigureAwait(false);
await socket.SendAsync(new byte[] { 0 }); await socket.SendAsync(new byte[] { 0 });
int length = await socket.ReceiveAsync(buffer.AsMemory(), SocketFlags.None).ConfigureAwait(false); int length = await socket.ReceiveAsync(buffer.AsMemory(), SocketFlags.None).ConfigureAwait(false);

View File

@@ -1,4 +1,5 @@
using linker.libs; using linker.libs;
using linker.libs.extends;
using System.Diagnostics; using System.Diagnostics;
using System.Net; using System.Net;
@@ -27,7 +28,14 @@ namespace linker.tunnel.wanport
public List<TunnelWanPortTypeInfo> GetTypes() public List<TunnelWanPortTypeInfo> GetTypes()
{ {
return tunnelWanPorts.Select(c => new TunnelWanPortTypeInfo { Value = c.Type, Name = c.Type.ToString() }).Distinct(new TunnelWanPortTypeInfoEqualityComparer()).ToList(); List<TunnelWanPortTypeInfo> res = tunnelWanPorts.Select(c => new TunnelWanPortTypeInfo
{
Value = c.Type,
Name = c.Type.ToString(),
Protocols = tunnelWanPorts
.Where(d => d.Type == c.Type).ToList().Select(d => d.ProtocolType).Distinct().ToDictionary(c => (int)c, d => d.ToString()),
}).Distinct(new TunnelWanPortTypeInfoEqualityComparer()).ToList();
return res;
} }
/// <summary> /// <summary>
@@ -39,6 +47,7 @@ namespace linker.tunnel.wanport
{ {
if (info == null) return null; if (info == null) return null;
var tunnelWanPort = tunnelWanPorts.FirstOrDefault(c => c.Type == info.Type && c.ProtocolType == info.ProtocolType); var tunnelWanPort = tunnelWanPorts.FirstOrDefault(c => c.Type == info.Type && c.ProtocolType == info.ProtocolType);
if (tunnelWanPort == null) return null;
try try
{ {
Stopwatch sw = new Stopwatch(); Stopwatch sw = new Stopwatch();
@@ -49,11 +58,11 @@ namespace linker.tunnel.wanport
{ {
LoggerHelper.Instance.Warning($"get domain ip time:{sw.ElapsedMilliseconds}ms"); LoggerHelper.Instance.Warning($"get domain ip time:{sw.ElapsedMilliseconds}ms");
} }
TunnelWanPortEndPoint WanPort = await tunnelWanPort.GetAsync(server).ConfigureAwait(false); TunnelWanPortEndPoint wanPort = await tunnelWanPort.GetAsync(server).ConfigureAwait(false);
if (WanPort != null) if (wanPort != null)
{ {
WanPort.Local.Address = localIP; wanPort.Local.Address = localIP;
return WanPort; return wanPort;
} }
} }
catch (Exception ex) catch (Exception ex)

View File

@@ -21,7 +21,7 @@
<template #default="scope"> <template #default="scope">
<div> <div>
<el-select v-model="scope.row.ProtocolType" placeholder="Select" size="small" @change="handleEditBlur(scope.row, 'ProtocolType')"> <el-select v-model="scope.row.ProtocolType" placeholder="Select" size="small" @change="handleEditBlur(scope.row, 'ProtocolType')">
<el-option v-for="(item,index) in state.protocolTypes" :key="+index" :label="item" :value="+index"/> <el-option v-for="(item,index) in scope.row.Protocols" :key="+index" :label="item" :value="+index"/>
</el-select> </el-select>
</div> </div>
@@ -87,17 +87,26 @@ import { computed, onMounted, reactive } from 'vue'
export default { export default {
setup(props) { setup(props) {
const globalData = injectGlobalData(); const globalData = injectGlobalData();
const list = ((globalData.value.config.Running.Tunnel || {Servers:[]}).Servers || []).sort((a,b)=>a.Disabled - b.Disabled);
const state = reactive({ const state = reactive({
list:((globalData.value.config.Running.Tunnel || {Servers:[]}).Servers || []).sort((a,b)=>a.Disabled - b.Disabled), list:list,
types:[], types:[],
height: computed(()=>globalData.value.height-130), height: computed(()=>globalData.value.height-130),
sync:true, sync:true
protocolTypes:{1:'tcp',2:'udp'},
}); });
const _getTunnelTypes = ()=>{ const _getTunnelTypes = ()=>{
getTunnelTypes().then((res)=>{ getTunnelTypes().then((res)=>{
state.types = res; state.types = res;
initProtocols(state.list);
});
}
const initProtocols = (list)=>{
list.forEach(c=>{
c.Protocols = state.types.filter(d=>d.Value == c.Type)[0].Protocols;
if(!c.Protocols[c.ProtocolType]){
c.ProtocolType = +Object.keys(c.Protocols)[0];
}
}); });
} }
@@ -105,6 +114,7 @@ export default {
handleEdit(row, column.property); handleEdit(row, column.property);
} }
const handleEdit = (row, p) => { const handleEdit = (row, p) => {
initProtocols([row])
state.list.forEach(c => { state.list.forEach(c => {
c[`NameEditing`] = false; c[`NameEditing`] = false;
c[`TypeEditing`] = false; c[`TypeEditing`] = false;
@@ -114,6 +124,7 @@ export default {
row[`${p}Editing`] = true; row[`${p}Editing`] = true;
} }
const handleEditBlur = (row, p) => { const handleEditBlur = (row, p) => {
initProtocols([row])
row[`${p}Editing`] = false; row[`${p}Editing`] = false;
handleSave(); handleSave();
} }
@@ -126,7 +137,10 @@ export default {
if(state.list.filter(c=>c.Host == '' || c.Name == '').length > 0){ if(state.list.filter(c=>c.Host == '' || c.Name == '').length > 0){
return; return;
} }
state.list.splice(index+1,0,{Name:'',Host:'',Type:0,Disabled:false,ProtocolType:2}); const row = {Name:'',Host:'',Type:0,Disabled:false,ProtocolType:2};
initProtocols([row]);
state.list.splice(index+1,0,row);
handleSave(); handleSave();
} }

View File

@@ -25,8 +25,8 @@
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl> <PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl> <RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<PackageReleaseNotes>linker</PackageReleaseNotes> <PackageReleaseNotes>linker</PackageReleaseNotes>
<AssemblyVersion>1.1.1.1</AssemblyVersion> <AssemblyVersion>1.1.1.2</AssemblyVersion>
<FileVersion>1.1.1.1</FileVersion> <FileVersion>1.1.1.2</FileVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -42,11 +42,11 @@ namespace linker.plugins.tunnel
public List<TunnelWanPortInfo> GetTunnelWanPortProtocols() public List<TunnelWanPortInfo> GetTunnelWanPortProtocols()
{ {
return running.Data.Tunnel.Servers.ToList(); return running.Data.Tunnel.Servers;
} }
public void SetTunnelWanPortProtocols(List<TunnelWanPortInfo> compacts) public void SetTunnelWanPortProtocols(List<TunnelWanPortInfo> compacts)
{ {
running.Data.Tunnel.Servers = compacts.ToArray(); running.Data.Tunnel.Servers = compacts;
running.Data.Update(); running.Data.Update();
} }

View File

@@ -82,7 +82,7 @@ namespace linker.plugins.tunnel
{ {
SetServersParamInfo info = param.Content.DeJson<SetServersParamInfo>(); SetServersParamInfo info = param.Content.DeJson<SetServersParamInfo>();
tunnelMessengerAdapter.SetTunnelWanPortProtocols(info.List.ToList()); tunnelMessengerAdapter.SetTunnelWanPortProtocols(info.List);
if (info.Sync) if (info.Sync)
{ {
await messengerSender.SendOnly(new MessageRequestWrap await messengerSender.SendOnly(new MessageRequestWrap
@@ -179,7 +179,7 @@ namespace linker.plugins.tunnel
public sealed class SetServersParamInfo public sealed class SetServersParamInfo
{ {
public bool Sync { get; set; } public bool Sync { get; set; }
public TunnelWanPortInfo[] List { get; set; } = Array.Empty<TunnelWanPortInfo>(); public List<TunnelWanPortInfo> List { get; set; } =new List<TunnelWanPortInfo>();
} }
public sealed class SetTransportsParamInfo public sealed class SetTransportsParamInfo

View File

@@ -33,17 +33,27 @@ namespace linker.plugins.tunnel
GetRemoveRouteLevel(); GetRemoveRouteLevel();
}; };
if (running.Data.Tunnel.Servers.Length == 0) if (running.Data.Tunnel.Servers.FirstOrDefault(c => c.Type == TunnelWanPortType.Linker && c.ProtocolType == TunnelWanPortProtocolType.Udp) == null)
{ {
running.Data.Tunnel.Servers = new TunnelWanPortInfo[] running.Data.Tunnel.Servers.Add(new TunnelWanPortInfo
{ {
new TunnelWanPortInfo{ Name = "Linker Udp",
Name="Linker Udp", Type = TunnelWanPortType.Linker,
Type= TunnelWanPortType.Linker, ProtocolType = TunnelWanPortProtocolType.Udp,
Disabled = false, Disabled = false,
Host = running.Data.Client.Servers.FirstOrDefault().Host, Host = running.Data.Client.Servers.FirstOrDefault().Host,
} });
}; }
if (running.Data.Tunnel.Servers.FirstOrDefault(c => c.Type == TunnelWanPortType.Linker && c.ProtocolType == TunnelWanPortProtocolType.Tcp) == null)
{
running.Data.Tunnel.Servers.Add(new TunnelWanPortInfo
{
Name = "Linker Tcp",
Type = TunnelWanPortType.Linker,
ProtocolType = TunnelWanPortProtocolType.Tcp,
Disabled = false,
Host = running.Data.Client.Servers.FirstOrDefault().Host,
});
} }
} }

View File

@@ -34,6 +34,8 @@ namespace linker.plugins.tunnel
MemoryPackFormatterProvider.Register(new TunnelTransportWanPortInfoFormatter()); MemoryPackFormatterProvider.Register(new TunnelTransportWanPortInfoFormatter());
MemoryPackFormatterProvider.Register(new TunnelTransportItemInfoFormatter()); MemoryPackFormatterProvider.Register(new TunnelTransportItemInfoFormatter());
MemoryPackFormatterProvider.Register(new TunnelTransportInfoFormatter()); MemoryPackFormatterProvider.Register(new TunnelTransportInfoFormatter());
MemoryPackFormatterProvider.Register(new TunnelWanPortProtocolInfoFormatter());
//管理接口 //管理接口
serviceCollection.AddSingleton<TunnelApiController>(); serviceCollection.AddSingleton<TunnelApiController>();
@@ -43,6 +45,7 @@ namespace linker.plugins.tunnel
//外网端口协议 //外网端口协议
serviceCollection.AddSingleton<TunnelWanPortTransfer>(); serviceCollection.AddSingleton<TunnelWanPortTransfer>();
serviceCollection.AddSingleton<TunnelWanPortProtocolLinkerUdp>(); serviceCollection.AddSingleton<TunnelWanPortProtocolLinkerUdp>();
serviceCollection.AddSingleton<TunnelWanPortProtocolLinkerTcp>();
serviceCollection.AddSingleton<TunnelWanPortProtocolStun>(); serviceCollection.AddSingleton<TunnelWanPortProtocolStun>();
//打洞协议 //打洞协议
@@ -69,6 +72,7 @@ namespace linker.plugins.tunnel
MemoryPackFormatterProvider.Register(new TunnelTransportWanPortInfoFormatter()); MemoryPackFormatterProvider.Register(new TunnelTransportWanPortInfoFormatter());
MemoryPackFormatterProvider.Register(new TunnelTransportItemInfoFormatter()); MemoryPackFormatterProvider.Register(new TunnelTransportItemInfoFormatter());
MemoryPackFormatterProvider.Register(new TunnelTransportInfoFormatter()); MemoryPackFormatterProvider.Register(new TunnelTransportInfoFormatter());
MemoryPackFormatterProvider.Register(new TunnelWanPortProtocolInfoFormatter());
serviceCollection.AddSingleton<TunnelServerMessenger>(); serviceCollection.AddSingleton<TunnelServerMessenger>();
} }

View File

@@ -19,7 +19,7 @@ namespace linker.client.config
public sealed class TunnelRunningInfo public sealed class TunnelRunningInfo
{ {
public ObjectId Id { get; set; } public ObjectId Id { get; set; }
public TunnelWanPortInfo[] Servers { get; set; } = Array.Empty<TunnelWanPortInfo>(); public List<TunnelWanPortInfo> Servers { get; set; } = new List<TunnelWanPortInfo>();
public int RouteLevelPlus { get; set; } = 0; public int RouteLevelPlus { get; set; } = 0;
public ExcludeIPItem[] ExcludeIPs { get; set; } = Array.Empty<ExcludeIPItem>(); public ExcludeIPItem[] ExcludeIPs { get; set; } = Array.Empty<ExcludeIPItem>();
@@ -128,6 +128,9 @@ namespace linker.config
[MemoryPackInclude] [MemoryPackInclude]
TunnelWanPortType Type => tunnelCompactInfo.Type; TunnelWanPortType Type => tunnelCompactInfo.Type;
[MemoryPackInclude]
TunnelWanPortProtocolType ProtocolType => tunnelCompactInfo.ProtocolType;
[MemoryPackInclude] [MemoryPackInclude]
string Host => tunnelCompactInfo.Host; string Host => tunnelCompactInfo.Host;
@@ -135,9 +138,9 @@ namespace linker.config
bool Disabled => tunnelCompactInfo.Disabled; bool Disabled => tunnelCompactInfo.Disabled;
[MemoryPackConstructor] [MemoryPackConstructor]
SerializableTunnelWanPortInfo(string name, TunnelWanPortType type, string host, bool disabled) SerializableTunnelWanPortInfo(string name, TunnelWanPortType type, TunnelWanPortProtocolType protocolType, string host, bool disabled)
{ {
var tunnelCompactInfo = new TunnelWanPortInfo { Name = name, Type = type, Host = host, Disabled = disabled }; var tunnelCompactInfo = new TunnelWanPortInfo { Name = name, Type = type, ProtocolType = protocolType, Host = host, Disabled = disabled };
this.tunnelCompactInfo = tunnelCompactInfo; this.tunnelCompactInfo = tunnelCompactInfo;
} }

View File

@@ -95,8 +95,8 @@ namespace linker.plugins.tunnel.messenger
[MessengerId((ushort)TunnelMessengerIds.Servers)] [MessengerId((ushort)TunnelMessengerIds.Servers)]
public void Servers(IConnection connection) public void Servers(IConnection connection)
{ {
TunnelWanPortInfo[] servers = MemoryPackSerializer.Deserialize<TunnelWanPortInfo[]>(connection.ReceiveRequestWrap.Payload.Span); List<TunnelWanPortInfo> servers = MemoryPackSerializer.Deserialize<List<TunnelWanPortInfo>>(connection.ReceiveRequestWrap.Payload.Span);
tunnelMessengerAdapter.SetTunnelWanPortProtocols(servers.ToList()); tunnelMessengerAdapter.SetTunnelWanPortProtocols(servers);
} }
[MessengerId((ushort)TunnelMessengerIds.ExcludeIPs)] [MessengerId((ushort)TunnelMessengerIds.ExcludeIPs)]