From 5d0dbcd1ac34ce3a5dd4d0b6097d7cf38bdfcf9f Mon Sep 17 00:00:00 2001
From: snltty <1069410172@qq.com>
Date: Fri, 13 Sep 2024 09:40:55 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B7=BB=E5=8A=A0=E9=98=B2?=
=?UTF-8?q?=E7=81=AB=E5=A2=99=E8=A7=84=E5=88=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/workflows/dotnet.yml | 30 ++++++++---------
.github/workflows/nuget.yml | 6 ++--
linker.libs/FireWallHelper.cs | 38 +++++++---------------
linker.libs/linker.libs.csproj | 6 ++--
linker.tray.win/default.aproj | 2 +-
linker.tun/linker.tun.csproj | 6 ++--
linker.tunnel/linker.tunnel.csproj | 6 ++--
linker/linker.csproj | 13 +++-----
linker/plugins/firewall/FireWallStartup.cs | 3 +-
version.txt | 11 ++-----
10 files changed, 48 insertions(+), 73 deletions(-)
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index 9dde67ca..7cecb2b2 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -33,11 +33,11 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }}
with:
- tag_name: v1.3.2
- release_name: v1.3.2.${{ steps.date.outputs.today }}
+ tag_name: v1.3.3
+ release_name: v1.3.3.${{ steps.date.outputs.today }}
draft: false
prerelease: false
- body: "1. 优化网卡(设备下线后路由指向错误)\r\n2. 管理页面配置权限\r\n3. 导出配置及指定节点配置权限\r\n4. 实时配置客户端管理权限\r\n5. 重复连接,同设备挤压,不同设备禁止连接\r\n6. 自定义背景图片"
+ body: 1. 优化添加防火墙规则,不使用文件
- name: upload-win-x86-oss
id: upload-win-x86-oss
uses: tvrcgo/oss-action@v0.1.1
@@ -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.3.2/linker-win-x86.zip
+ target-path: /downloads/linker/v1.3.3/linker-win-x86.zip
- name: upload-win-x86
id: upload-win-x86
uses: actions/upload-release-asset@master
@@ -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.3.2/linker-win-x64.zip
+ target-path: /downloads/linker/v1.3.3/linker-win-x64.zip
- name: upload-win-x64
id: upload-win-x64
uses: actions/upload-release-asset@master
@@ -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.3.2/linker-win-arm64.zip
+ target-path: /downloads/linker/v1.3.3/linker-win-arm64.zip
- name: upload-win-arm64
id: upload-win-arm64
uses: actions/upload-release-asset@master
@@ -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.3.2/linker-linux-x64.zip
+ target-path: /downloads/linker/v1.3.3/linker-linux-x64.zip
- name: upload-linux-x64
id: upload-linux-x64
uses: actions/upload-release-asset@master
@@ -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.3.2/linker-linux-arm.zip
+ target-path: /downloads/linker/v1.3.3/linker-linux-arm.zip
- name: upload-linux-arm
id: upload-linux-arm
uses: actions/upload-release-asset@master
@@ -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.3.2/linker-linux-arm64.zip
+ target-path: /downloads/linker/v1.3.3/linker-linux-arm64.zip
- name: upload-linux-arm64
id: upload-linux-arm64
uses: actions/upload-release-asset@master
@@ -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.3.2/linker-linux-musl-x64.zip
+ target-path: /downloads/linker/v1.3.3/linker-linux-musl-x64.zip
- name: upload-linux-musl-x64
id: upload-linux-musl-x64
uses: actions/upload-release-asset@master
@@ -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.3.2/linker-linux-musl-arm.zip
+ target-path: /downloads/linker/v1.3.3/linker-linux-musl-arm.zip
- name: upload-linux-musl-arm
id: upload-linux-musl-arm
uses: actions/upload-release-asset@master
@@ -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.3.2/linker-linux-musl-arm64.zip
+ target-path: /downloads/linker/v1.3.3/linker-linux-musl-arm64.zip
- name: upload-linux-musl-arm64
id: upload-linux-musl-arm64
uses: actions/upload-release-asset@master
@@ -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.3.2/linker-osx-x64.zip
+ target-path: /downloads/linker/v1.3.3/linker-osx-x64.zip
- name: upload-osx-x64
id: upload-osx-x64
uses: actions/upload-release-asset@master
@@ -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.3.2/linker-osx-arm64.zip
+ target-path: /downloads/linker/v1.3.3/linker-osx-arm64.zip
- name: upload-osx-arm64
id: upload-osx-arm64
uses: actions/upload-release-asset@master
@@ -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.3.2/linker-windows-route.zip
+ target-path: /downloads/linker/v1.3.3/linker-windows-route.zip
- name: upload-windows-route
id: upload-windows-route
uses: actions/upload-release-asset@master
diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml
index a397a601..d330a784 100644
--- a/.github/workflows/nuget.yml
+++ b/.github/workflows/nuget.yml
@@ -38,6 +38,6 @@ jobs:
- name: Push
run: |
- nuget push ./linker.tunnel/bin/release/linker.tunnel.1.3.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.3.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.3.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.3.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.3.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.3.3.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol
diff --git a/linker.libs/FireWallHelper.cs b/linker.libs/FireWallHelper.cs
index fa3cb1b0..62a9fa97 100644
--- a/linker.libs/FireWallHelper.cs
+++ b/linker.libs/FireWallHelper.cs
@@ -5,11 +5,11 @@ namespace linker.libs
{
public static class FireWallHelper
{
- public static void Write(string fileName, string distPatt)
+ public static void Write(string fileName)
{
if (OperatingSystem.IsWindows())
{
- Windows(fileName, distPatt);
+ Windows(fileName);
}
else if (OperatingSystem.IsLinux())
{
@@ -19,6 +19,7 @@ public static void Write(string fileName, string distPatt)
private static void Linux(string fileName)
{
+ fileName = Path.GetFileNameWithoutExtension(fileName);
CommandHelper.Linux(string.Empty, new string[] {
$"firewall-cmd --permanent --new-service={fileName}",
$"firewall-cmd --permanent --service={fileName} --set-short=\"My Application {fileName}\"",
@@ -31,34 +32,17 @@ private static void Linux(string fileName)
});
}
- private static void Windows(string fileName, string distPath)
+ private static void Windows(string fileName)
{
try
{
- string content = $@"@echo off
-cd ""%CD%""
-for /f ""tokens=4,5 delims=. "" %%a in ('ver') do if %%a%%b geq 60 goto new
-
-:old
-cmd /c netsh firewall delete allowedprogram program=""%CD%\{fileName}.exe"" profile=ALL
-cmd /c netsh firewall add allowedprogram program=""%CD%\{fileName}.exe"" name=""{fileName}"" ENABLE
-cmd /c netsh firewall add allowedprogram program=""%CD%\{fileName}.exe"" name=""{fileName}"" ENABLE profile=ALL
-goto end
-:new
-cmd /c netsh advfirewall firewall delete rule name=""{fileName}""
-cmd /c netsh advfirewall firewall add rule name=""{fileName}"" dir=in action=allow program=""%CD%\{fileName}.exe"" protocol=tcp enable=yes
-cmd /c netsh advfirewall firewall add rule name=""{fileName}"" dir=in action=allow program=""%CD%\{fileName}.exe"" protocol=udp enable=yes
-cmd /c netsh advfirewall firewall add rule name=""{fileName}"" dir=in action=allow program=""%CD%\{fileName}.exe"" protocol=icmpv4 enable=yes
-:end";
- if (Directory.Exists(distPath) == false)
- {
- Directory.CreateDirectory(distPath);
- }
- string firewall = Path.Join(distPath, "firewall.bat");
-
- File.WriteAllText(firewall, content);
- CommandHelper.Execute(firewall, string.Empty, new string[0],out string error);
- File.Delete(firewall);
+ string name = Path.GetFileNameWithoutExtension(fileName);
+ CommandHelper.Windows(string.Empty, new string[] {
+ $"netsh advfirewall firewall delete rule name=\"{name}\"",
+ $"netsh advfirewall firewall add rule name=\"{name}\" dir=in action=allow program=\"{fileName}\" protocol=tcp enable=yes",
+ $"netsh advfirewall firewall add rule name=\"{name}\" dir=in action=allow program=\"{fileName}\" protocol=udp enable=yes",
+ $"netsh advfirewall firewall add rule name=\"{name}\" dir=in action=allow program=\"{fileName}\" protocol=icmpv4 enable=yes",
+ });
}
catch (Exception)
{
diff --git a/linker.libs/linker.libs.csproj b/linker.libs/linker.libs.csproj
index 7a46f887..6aca246f 100644
--- a/linker.libs/linker.libs.csproj
+++ b/linker.libs/linker.libs.csproj
@@ -14,9 +14,9 @@
snltty
https://github.com/snltty/linker
https://github.com/snltty/linker
- 1.3.2
- 1.3.2
- 1.3.2
+ 1.3.3
+ 1.3.3
+ 1.3.3
full
diff --git a/linker.tray.win/default.aproj b/linker.tray.win/default.aproj
index 083b0e3f..2f7679cf 100644
--- a/linker.tray.win/default.aproj
+++ b/linker.tray.win/default.aproj
@@ -1,5 +1,5 @@
-
+
diff --git a/linker.tun/linker.tun.csproj b/linker.tun/linker.tun.csproj
index 13be61a3..6332ddd1 100644
--- a/linker.tun/linker.tun.csproj
+++ b/linker.tun/linker.tun.csproj
@@ -9,7 +9,7 @@
true
true
linker tun
- 1.3.2
+ 1.3.3
snltty
snltty
linker tun
@@ -17,8 +17,8 @@
https://github.com/snltty/linker
https://github.com/snltty/linker
linker tun
- 1.3.2
- 1.3.2
+ 1.3.3
+ 1.3.3
diff --git a/linker.tunnel/linker.tunnel.csproj b/linker.tunnel/linker.tunnel.csproj
index 208954d2..715bc8a0 100644
--- a/linker.tunnel/linker.tunnel.csproj
+++ b/linker.tunnel/linker.tunnel.csproj
@@ -9,7 +9,7 @@
true
true
linker tunnel
- 1.3.2
+ 1.3.3
snltty
snltty
linker tunnel
@@ -17,8 +17,8 @@
https://github.com/snltty/linker
https://github.com/snltty/linker
linker tunnel
- 1.3.2
- 1.3.2
+ 1.3.3
+ 1.3.3
diff --git a/linker/linker.csproj b/linker/linker.csproj
index 61c6aa4e..e14214ca 100644
--- a/linker/linker.csproj
+++ b/linker/linker.csproj
@@ -17,21 +17,16 @@
true
false
linker
- 1.3.2
+ 1.3.3
snltty
snltty
- 1. 优化网卡(设备下线后路由指向错误)
-2. 管理页面配置权限
-3. 导出配置及指定节点配置权限
-4. 实时配置客户端管理权限
-5. 重复连接,同设备挤压,不同设备禁止连接
-6. 自定义背景图片
+ 1. 优化添加防火墙规则,不使用文件
snltty
https://github.com/snltty/linker
https://github.com/snltty/linker
linker
- 1.3.2
- 1.3.2
+ 1.3.3
+ 1.3.3
diff --git a/linker/plugins/firewall/FireWallStartup.cs b/linker/plugins/firewall/FireWallStartup.cs
index 92624f43..72db3b4a 100644
--- a/linker/plugins/firewall/FireWallStartup.cs
+++ b/linker/plugins/firewall/FireWallStartup.cs
@@ -15,9 +15,10 @@ public sealed class FireWallStartup : IStartup
public void AddClient(ServiceCollection serviceCollection, FileConfig config, Assembly[] assemblies)
{
+ //linker.libs.FireWallHelper.Write(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
#if DEBUG
#else
- linker.libs.FireWallHelper.Write(Path.GetFileNameWithoutExtension(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName), "./");
+ linker.libs.FireWallHelper.Write(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
#endif
}
diff --git a/version.txt b/version.txt
index 05e1ef4c..c9bc4174 100644
--- a/version.txt
+++ b/version.txt
@@ -1,8 +1,3 @@
-v1.3.2
-2024-09-13 00:24:28
-1. 优化网卡(设备下线后路由指向错误)
-2. 管理页面配置权限
-3. 导出配置及指定节点配置权限
-4. 实时配置客户端管理权限
-5. 重复连接,同设备挤压,不同设备禁止连接
-6. 自定义背景图片
\ No newline at end of file
+v1.3.3
+2024-09-13 09:40:55
+1. 优化添加防火墙规则,不使用文件
\ No newline at end of file