Skip to content

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
  • Loading branch information
snltty committed Dec 9, 2024
1 parent 7480963 commit 908248a
Show file tree
Hide file tree
Showing 22 changed files with 119 additions and 102 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ jobs:
docker tag snltty/linker-musl-x64:latest snltty/linker-musl:amd64 && \
docker push snltty/linker-musl:amd64 && \
docker manifest create snltty/linker-musl:latest snltty/linker-musl:amd64 snltty/linker-musl:arm64 snltty/linker-musl:arm && \
docker manifest create snltty/linker-musl:v1.6.2 snltty/linker-musl:amd64 snltty/linker-musl:arm64 snltty/linker-musl:arm && \
docker manifest create snltty/linker-musl:v1.6.3 snltty/linker-musl:amd64 snltty/linker-musl:arm64 snltty/linker-musl:arm && \
docker manifest push snltty/linker-musl:latest && \
docker manifest push snltty/linker-musl:v1.6.2 && \
docker manifest push snltty/linker-musl:v1.6.3 && \
docker pull --platform linux/arm/v7 snltty/linker-debian-arm:latest && \
docker tag snltty/linker-debian-arm:latest snltty/linker-debian:arm && \
docker push snltty/linker-debian:arm && \
Expand All @@ -70,6 +70,6 @@ jobs:
docker tag snltty/linker-debian-x64:latest snltty/linker-debian:amd64 && \
docker push snltty/linker-debian:amd64 && \
docker manifest create snltty/linker-debian:latest snltty/linker-debian:amd64 snltty/linker-debian:arm64 snltty/linker-debian:arm && \
docker manifest create snltty/linker-debian:v1.6.2 snltty/linker-debian:amd64 snltty/linker-debian:arm64 snltty/linker-debian:arm && \
docker manifest create snltty/linker-debian:v1.6.3 snltty/linker-debian:amd64 snltty/linker-debian:arm64 snltty/linker-debian:arm && \
docker manifest push snltty/linker-debian:latest && \
docker manifest push snltty/linker-debian:v1.6.2
docker manifest push snltty/linker-debian:v1.6.3
30 changes: 15 additions & 15 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }}
with:
tag_name: v1.6.2
release_name: v1.6.2.${{ steps.date.outputs.today }}
tag_name: v1.6.3
release_name: v1.6.3.${{ steps.date.outputs.today }}
draft: false
prerelease: false
body: "1. 修复UI\r\n2. 修复服务端重启无法关闭内网穿透的问题\r\n3. 修复网络掩码计算错误"
body: "1. 优化UI,显示网络计算IP数\r\n2. 修复内网穿透不停止直接删除导致的无法再次添加的问题\r\n3. 优化网卡的端口转发\r\n4. 修复网络掩码计算错误\r\n5. 测试中,不要更,不要更,不要更"
- name: upload-win-x86-oss
id: upload-win-x86-oss
uses: tvrcgo/oss-action@v0.1.1
Expand All @@ -47,7 +47,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-win-x86.zip
target-path: /downloads/linker/v1.6.2/linker-win-x86.zip
target-path: /downloads/linker/v1.6.3/linker-win-x86.zip
- name: upload-win-x86
id: upload-win-x86
uses: actions/upload-release-asset@master
Expand All @@ -67,7 +67,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-win-x64.zip
target-path: /downloads/linker/v1.6.2/linker-win-x64.zip
target-path: /downloads/linker/v1.6.3/linker-win-x64.zip
- name: upload-win-x64
id: upload-win-x64
uses: actions/upload-release-asset@master
Expand All @@ -87,7 +87,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-win-arm64.zip
target-path: /downloads/linker/v1.6.2/linker-win-arm64.zip
target-path: /downloads/linker/v1.6.3/linker-win-arm64.zip
- name: upload-win-arm64
id: upload-win-arm64
uses: actions/upload-release-asset@master
Expand All @@ -107,7 +107,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-linux-x64.zip
target-path: /downloads/linker/v1.6.2/linker-linux-x64.zip
target-path: /downloads/linker/v1.6.3/linker-linux-x64.zip
- name: upload-linux-x64
id: upload-linux-x64
uses: actions/upload-release-asset@master
Expand All @@ -127,7 +127,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-linux-arm.zip
target-path: /downloads/linker/v1.6.2/linker-linux-arm.zip
target-path: /downloads/linker/v1.6.3/linker-linux-arm.zip
- name: upload-linux-arm
id: upload-linux-arm
uses: actions/upload-release-asset@master
Expand All @@ -147,7 +147,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-linux-arm64.zip
target-path: /downloads/linker/v1.6.2/linker-linux-arm64.zip
target-path: /downloads/linker/v1.6.3/linker-linux-arm64.zip
- name: upload-linux-arm64
id: upload-linux-arm64
uses: actions/upload-release-asset@master
Expand All @@ -167,7 +167,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-linux-musl-x64.zip
target-path: /downloads/linker/v1.6.2/linker-linux-musl-x64.zip
target-path: /downloads/linker/v1.6.3/linker-linux-musl-x64.zip
- name: upload-linux-musl-x64
id: upload-linux-musl-x64
uses: actions/upload-release-asset@master
Expand All @@ -187,7 +187,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-linux-musl-arm.zip
target-path: /downloads/linker/v1.6.2/linker-linux-musl-arm.zip
target-path: /downloads/linker/v1.6.3/linker-linux-musl-arm.zip
- name: upload-linux-musl-arm
id: upload-linux-musl-arm
uses: actions/upload-release-asset@master
Expand All @@ -207,7 +207,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-linux-musl-arm64.zip
target-path: /downloads/linker/v1.6.2/linker-linux-musl-arm64.zip
target-path: /downloads/linker/v1.6.3/linker-linux-musl-arm64.zip
- name: upload-linux-musl-arm64
id: upload-linux-musl-arm64
uses: actions/upload-release-asset@master
Expand All @@ -227,7 +227,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-osx-x64.zip
target-path: /downloads/linker/v1.6.2/linker-osx-x64.zip
target-path: /downloads/linker/v1.6.3/linker-osx-x64.zip
- name: upload-osx-x64
id: upload-osx-x64
uses: actions/upload-release-asset@master
Expand All @@ -247,7 +247,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-osx-arm64.zip
target-path: /downloads/linker/v1.6.2/linker-osx-arm64.zip
target-path: /downloads/linker/v1.6.3/linker-osx-arm64.zip
- name: upload-osx-arm64
id: upload-osx-arm64
uses: actions/upload-release-asset@master
Expand Down Expand Up @@ -277,7 +277,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-windows-route.zip
target-path: /downloads/linker/v1.6.2/linker-windows-route.zip
target-path: /downloads/linker/v1.6.3/linker-windows-route.zip
- name: upload-version-oss
id: upload-version-oss
uses: tvrcgo/oss-action@v0.1.1
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ jobs:

- name: Push
run: |
nuget push ./linker.tunnel/bin/release/linker.tunnel.1.6.2.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol
nuget push ./linker.libs/bin/release/linker.libs.1.6.2.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol
nuget push ./linker.tun/bin/release/linker.tun.1.6.2.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol
nuget push ./linker.tunnel/bin/release/linker.tunnel.1.6.3.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol
nuget push ./linker.libs/bin/release/linker.libs.1.6.3.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol
nuget push ./linker.tun/bin/release/linker.tun.1.6.3.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol
6 changes: 3 additions & 3 deletions linker.libs/linker.libs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<Copyright>snltty</Copyright>
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<Version>1.6.2</Version>
<AssemblyVersion>1.6.2</AssemblyVersion>
<FileVersion>1.6.2</FileVersion>
<Version>1.6.3</Version>
<AssemblyVersion>1.6.3</AssemblyVersion>
<FileVersion>1.6.3</FileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>full</DebugType>
Expand Down
2 changes: 1 addition & 1 deletion linker.tray.win/default.aproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<project ver="10" name="linker.tray.win" libEmbed="true" icon="..\linker\favicon.ico" ui="win" output="linker.tray.win.exe" CompanyName="snltty" FileDescription="linker.tray.win" LegalCopyright="Copyright (C) snltty 2024" ProductName="linker.tray.win" InternalName="linker.install.win" FileVersion="0.0.0.183" ProductVersion="0.0.0.183" publishDir="/dist/" dstrip="false" local="false" ignored="false">
<project ver="10" name="linker.tray.win" libEmbed="true" icon="..\linker\favicon.ico" ui="win" output="linker.tray.win.exe" CompanyName="snltty" FileDescription="linker.tray.win" LegalCopyright="Copyright (C) snltty 2024" ProductName="linker.tray.win" InternalName="linker.install.win" FileVersion="0.0.0.184" ProductVersion="0.0.0.184" publishDir="/dist/" dstrip="false" local="false" ignored="false">
<file name="main.aardio" path="main.aardio" comment="main.aardio"/>
<folder name="资源文件" path="res" embed="true" local="false" ignored="false">
<file name="favicon.ico" path="res\favicon.ico" comment="res\favicon.ico"/>
Expand Down
Binary file modified linker.tray.win/dist/linker.tray.win.exe
Binary file not shown.
16 changes: 16 additions & 0 deletions linker.tun/ILinkerTunDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ public interface ILinkerTunDevice
public void RemoveNat(out string error);


/// <summary>
/// 获取端口转发
/// </summary>
/// <returns></returns>
public List<LinkerTunDeviceForwardItem> GetForward();
/// <summary>
/// 添加端口转发
/// </summary>
Expand Down Expand Up @@ -117,6 +122,17 @@ public sealed class LinkerTunDeviceForwardItem

public string Key => $"{ListenAddr}:{ListenPort}->{ConnectAddr}:{ConnectPort}";
}
public sealed class LinkerTunDeviceForwardItemComparer : IEqualityComparer<LinkerTunDeviceForwardItem>
{
public bool Equals(LinkerTunDeviceForwardItem x, LinkerTunDeviceForwardItem y)
{
return x.ListenPort == y.ListenPort && x.ConnectAddr.Equals(y.ConnectAddr) && x.ConnectPort == y.ConnectPort;
}
public int GetHashCode(LinkerTunDeviceForwardItem obj)
{
return obj.ListenPort.GetHashCode() ^ obj.ConnectAddr.GetHashCode() ^ obj.ConnectPort;
}
}

/// <summary>
/// 数据包
Expand Down
16 changes: 15 additions & 1 deletion linker.tun/LinkerLinuxTunDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Microsoft.Win32.SafeHandles;
using System.Net;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;

namespace linker.tun
{
Expand Down Expand Up @@ -188,7 +189,20 @@ public void RemoveNat(out string error)
}
}


public List<LinkerTunDeviceForwardItem> GetForward()
{
string str = CommandHelper.Linux(string.Empty, new string[] { $"iptables -t nat -L PREROUTING" });
IEnumerable<LinkerTunDeviceForwardItem> lines = str.Split(Environment.NewLine)
.Select(c => Regex.Replace(c, @"\s+", " ").Split(' '))
.Where(c => c.Length > 0 && c[0] == "DNAT" && c[1] == "tcp")
.Select(c =>
{
IPEndPoint dist = IPEndPoint.Parse(c[^1].Replace("to:", ""));
int port = int.Parse(c[^2].Replace("dpt:", ""));
return new LinkerTunDeviceForwardItem { ListenAddr=IPAddress.Any, ListenPort=port, ConnectAddr=dist.Address, ConnectPort=dist.Port };
});
return lines.ToList();
}
public void AddForward(List<LinkerTunDeviceForwardItem> forwards)
{
string[] commands = forwards.Where(c => c != null && c.Enable).SelectMany(c =>
Expand Down
4 changes: 4 additions & 0 deletions linker.tun/LinkerOsxTunDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ public void RemoveNat(out string error)
error = string.Empty;
}

public List<LinkerTunDeviceForwardItem> GetForward()
{
return new List<LinkerTunDeviceForwardItem>();
}
public void AddForward(List<LinkerTunDeviceForwardItem> forwards)
{
}
Expand Down
8 changes: 8 additions & 0 deletions linker.tun/LinkerTunDeviceAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@ public void RemoveNat()
linkerTunDevice?.RemoveNat(out string error);
}

/// <summary>
/// 获取端口转发
/// </summary>
/// <returns></returns>
public List<LinkerTunDeviceForwardItem> GetForward()
{
return linkerTunDevice?.GetForward() ?? [];
}
/// <summary>
/// 添加端口转发
/// </summary>
Expand Down
15 changes: 15 additions & 0 deletions linker.tun/LinkerWinTunDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Net.NetworkInformation;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;

namespace linker.tun
{
Expand Down Expand Up @@ -192,6 +193,20 @@ public void RemoveNat(out string error)
}


public List<LinkerTunDeviceForwardItem> GetForward()
{
string str = CommandHelper.Windows(string.Empty, new string[] { $"netsh interface portproxy show v4tov4" });
IEnumerable<LinkerTunDeviceForwardItem> lines = str.Split(Environment.NewLine)
.Select(c => Regex.Replace(c, @"\s+", " ").Split(' '))
.Where(c => c.Length > 0 && c[0] == "0.0.0.0")
.Select(c =>
{
IPEndPoint dist = IPEndPoint.Parse($"{c[2]}:{c[3]}");
int port = int.Parse(c[1]);
return new LinkerTunDeviceForwardItem { ListenAddr = IPAddress.Any, ListenPort = port, ConnectAddr = dist.Address, ConnectPort = dist.Port };
});
return lines.ToList();
}
public void AddForward(List<LinkerTunDeviceForwardItem> forwards)
{
string[] commands = forwards.Where(c => c != null && c.Enable).Select(c =>
Expand Down
6 changes: 3 additions & 3 deletions linker.tun/linker.tun.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<PackageReleaseNotes>linker tun</PackageReleaseNotes>
<Version>1.6.2</Version>
<AssemblyVersion>1.6.2</AssemblyVersion>
<FileVersion>1.6.2</FileVersion>
<Version>1.6.3</Version>
<AssemblyVersion>1.6.3</AssemblyVersion>
<FileVersion>1.6.3</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
6 changes: 3 additions & 3 deletions linker.tunnel/linker.tunnel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<PackageReleaseNotes>linker tunnel</PackageReleaseNotes>
<Version>1.6.2</Version>
<AssemblyVersion>1.6.2</AssemblyVersion>
<FileVersion>1.6.2</FileVersion>
<Version>1.6.3</Version>
<AssemblyVersion>1.6.3</AssemblyVersion>
<FileVersion>1.6.3</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
14 changes: 8 additions & 6 deletions linker/linker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,18 @@
<Title>linker</Title>
<Authors>snltty</Authors>
<Company>snltty</Company>
<Description>1. 修复UI
2. 修复服务端重启无法关闭内网穿透的问题
3. 修复网络掩码计算错误</Description>
<Description>1. 优化UI,显示网络计算IP数
2. 修复内网穿透不停止直接删除导致的无法再次添加的问题
3. 优化网卡的端口转发
4. 修复网络掩码计算错误
5. 测试中,不要更,不要更,不要更</Description>
<Copyright>snltty</Copyright>
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<PackageReleaseNotes>linker</PackageReleaseNotes>
<Version>1.6.2</Version>
<AssemblyVersion>1.6.2</AssemblyVersion>
<FileVersion>1.6.2</FileVersion>
<Version>1.6.3</Version>
<AssemblyVersion>1.6.3</AssemblyVersion>
<FileVersion>1.6.3</FileVersion>
</PropertyGroup>


Expand Down
20 changes: 1 addition & 19 deletions linker/plugins/forward/ForwardTransfer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ public ForwardTransfer(FileConfig fileConfig, RunningConfig running, ForwardProx
this.messengerSender = messengerSender;

clientSignInState.NetworkEnabledHandle += Reset;
CheckTask();

}

public Memory<byte> GetData()
Expand Down Expand Up @@ -97,23 +95,7 @@ private void Reset(int times)
Start(false);
});
}
private void CheckTask()
{
TimerHelper.SetInterval(() =>
{
lock (this)
{
var items = running.Data.Forwards
.Where(c => c.GroupId == fileConfig.Data.Client.Group.Id)
.Where(c => c.Started && c.Proxy == false && string.IsNullOrWhiteSpace(c.Msg) == false);
foreach (var item in items)
{
Start(item, false);
}
}
return true;
}, 30000);
}

private void Start(bool errorStop = true)
{
lock (this)
Expand Down
4 changes: 2 additions & 2 deletions linker/plugins/forward/proxy/ForwardProxyTcp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ private void StartTcp(IPEndPoint ep, byte bufferSize)
{
IPEndPoint _localEndPoint = ep;
socket = new Socket(_localEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
socket.IPv6Only(_localEndPoint.AddressFamily, false);
socket.ReuseBind(_localEndPoint);
//socket.IPv6Only(_localEndPoint.AddressFamily, false);
//socket.ReuseBind(_localEndPoint);
socket.Listen(int.MaxValue);

LocalEndpoint = socket.LocalEndPoint as IPEndPoint;
Expand Down
4 changes: 2 additions & 2 deletions linker/plugins/sforward/proxy/SForwardProxyTcp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ private void StartTcp(int port, bool isweb, byte bufferSize, string groupid)
{
IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, port);
Socket socket = new Socket(localEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
socket.IPv6Only(localEndPoint.AddressFamily, false);
socket.ReuseBind(localEndPoint);
//socket.IPv6Only(localEndPoint.AddressFamily, false);
//socket.ReuseBind(localEndPoint);
socket.Listen(int.MaxValue);
AsyncUserToken userToken = new AsyncUserToken
{
Expand Down
Loading

0 comments on commit 908248a

Please sign in to comment.