mirror of
https://github.com/snltty/linker.git
synced 2025-09-26 21:15:57 +08:00
防火墙
This commit is contained in:
2
.github/workflows/dotnet.yml
vendored
2
.github/workflows/dotnet.yml
vendored
@@ -37,7 +37,7 @@ jobs:
|
||||
release_name: v1.7.9.${{ steps.date.outputs.today }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
body: "1. 一些累计更新\r\n2. 优化安卓APP\r\n3. 新增防火墙,用于网卡、端口转发、和socks5\r\n4. 检测密钥是否正确\r\n5. 如果你设备很多,请尝试升级其中一个成功重启后再升级其它"
|
||||
body: "1. 一些累计更新\r\n2. 优化安卓APP\r\n3. 新增防火墙,用于网卡、端口转发、和socks5\r\n4. 优化重启清理数据,优化了网卡自启动问题\r\n5. 检测密钥是否正确\r\n6. 如果你设备很多,请尝试升级其中一个成功重启后再升级其它"
|
||||
- name: publish projects
|
||||
run: ./publish.bat "C:\\Android\\android-sdk"
|
||||
- name: upload-win-x86-oss
|
||||
|
@@ -25,10 +25,19 @@ namespace linker.libs
|
||||
public static async Task Await()
|
||||
{
|
||||
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
|
||||
AppDomain.CurrentDomain.ProcessExit += (sender, e) => cancellationTokenSource.Cancel();
|
||||
Console.CancelKeyPress += (sender, e) => cancellationTokenSource.Cancel();
|
||||
|
||||
AppDomain.CurrentDomain.ProcessExit += (sender, e) => Exit(cancellationTokenSource);
|
||||
Console.CancelKeyPress += (sender, e) => Exit(cancellationTokenSource);
|
||||
await Task.Delay(-1, cancellationTokenSource.Token).ConfigureAwait(false);
|
||||
}
|
||||
private static void Exit(CancellationTokenSource cancellationTokenSource)
|
||||
{
|
||||
if(cancellationTokenSource.IsCancellationRequested == false)
|
||||
{
|
||||
cancellationTokenSource.Cancel();
|
||||
AppExit(0);
|
||||
}
|
||||
}
|
||||
|
||||
private delegate bool ConsoleCtrlDelegate(int ctrlType);
|
||||
private static ConsoleCtrlDelegate handler;
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using System.Net;
|
||||
using linker.libs;
|
||||
using System.Net;
|
||||
using System.Text.Json.Serialization;
|
||||
namespace linker.messenger.signin
|
||||
{
|
||||
@@ -10,11 +11,12 @@ namespace linker.messenger.signin
|
||||
|
||||
public SignInClientState()
|
||||
{
|
||||
if (OperatingSystem.IsAndroid() == false)
|
||||
{
|
||||
AppDomain.CurrentDomain.ProcessExit += (s, e) => Disponse();
|
||||
Console.CancelKeyPress += (s, e) => Disponse();
|
||||
}
|
||||
Helper.OnAppExit += Helper_OnAppExit;
|
||||
}
|
||||
|
||||
private void Helper_OnAppExit(object sender, EventArgs e)
|
||||
{
|
||||
Disponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@@ -33,6 +33,7 @@ namespace linker.messenger.store.file
|
||||
private void Helper_OnAppExit(object sender, EventArgs e)
|
||||
{
|
||||
Save();
|
||||
dBfactory.Dispose();
|
||||
}
|
||||
|
||||
private void Load()
|
||||
|
@@ -4,7 +4,6 @@ using linker.libs.timer;
|
||||
using linker.tunnel.connection;
|
||||
using LiteDB;
|
||||
using System.Net;
|
||||
using System.Runtime.ExceptionServices;
|
||||
|
||||
namespace linker.messenger.store.file
|
||||
{
|
||||
@@ -47,12 +46,6 @@ namespace linker.messenger.store.file
|
||||
//让服务自动重启
|
||||
Helper.AppExit(1);
|
||||
}
|
||||
|
||||
if (OperatingSystem.IsAndroid() == false)
|
||||
{
|
||||
AppDomain.CurrentDomain.ProcessExit += (s, e) => { database.Checkpoint(); database.Dispose(); };
|
||||
Console.CancelKeyPress += (s, e) => { database.Checkpoint(); database.Dispose(); };
|
||||
}
|
||||
TimerHelper.SetIntervalLong(database.Checkpoint, 3000);
|
||||
}
|
||||
|
||||
@@ -60,6 +53,12 @@ namespace linker.messenger.store.file
|
||||
{
|
||||
return database.GetCollection<T>(name);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
database.Checkpoint();
|
||||
database.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -29,11 +29,6 @@ namespace linker.messenger.tuntap
|
||||
this.linkerTunDeviceAdapter = linkerTunDeviceAdapter;
|
||||
linkerTunDeviceAdapter.AddHooks(new List<ILinkerTunPacketHook> { tuntapFirewall });
|
||||
Helper.OnAppExit += Helper_OnAppExit;
|
||||
if (OperatingSystem.IsAndroid() == false)
|
||||
{
|
||||
AppDomain.CurrentDomain.ProcessExit += (s, e) => Shutdown();
|
||||
Console.CancelKeyPress += (s, e) => Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
private void Helper_OnAppExit(object sender, EventArgs e)
|
||||
|
@@ -16,8 +16,13 @@ namespace linker.tun
|
||||
|
||||
public LanSnat()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Helper_OnAppExit(object sender, EventArgs e)
|
||||
{
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
public void Setup(IPAddress address, byte prefixLength, LinkerTunAppNatItemInfo[] items, ref string error)
|
||||
{
|
||||
if (OperatingSystem.IsWindows() == false) return;
|
||||
|
@@ -156,6 +156,7 @@ namespace linker.tun
|
||||
cancellationTokenSource?.Cancel();
|
||||
linkerTunDevice.Shutdown();
|
||||
linkerTunDevice.RemoveNat(out string error);
|
||||
lanSnat.Shutdown();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -289,7 +290,7 @@ namespace linker.tun
|
||||
List<ILinkerTunPacketHook> list = this.hooks.ToList();
|
||||
list.AddRange(hooks);
|
||||
|
||||
this.hooks = list.Distinct().OrderBy(c=>c.Level).ToArray();
|
||||
this.hooks = list.Distinct().OrderBy(c => c.Level).ToArray();
|
||||
}
|
||||
|
||||
private void Read()
|
||||
@@ -334,7 +335,7 @@ namespace linker.tun
|
||||
/// </summary>
|
||||
/// <param name="buffer"></param>
|
||||
/// <returns></returns>
|
||||
public bool Write(string srcId,ReadOnlyMemory<byte> buffer)
|
||||
public bool Write(string srcId, ReadOnlyMemory<byte> buffer)
|
||||
{
|
||||
if (linkerTunDevice == null || Status != LinkerTunDeviceStatus.Running) return false;
|
||||
|
||||
|
@@ -23,8 +23,9 @@
|
||||
<Description>1. 一些累计更新
|
||||
2. 优化安卓APP
|
||||
3. 新增防火墙,用于网卡、端口转发、和socks5
|
||||
4. 检测密钥是否正确
|
||||
5. 如果你设备很多,请尝试升级其中一个成功重启后再升级其它</Description>
|
||||
4. 优化重启清理数据,优化了网卡自启动问题
|
||||
5. 检测密钥是否正确
|
||||
6. 如果你设备很多,请尝试升级其中一个成功重启后再升级其它</Description>
|
||||
<Copyright>snltty</Copyright>
|
||||
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
|
||||
|
@@ -1,7 +1,8 @@
|
||||
v1.7.9
|
||||
2025-05-11 18:02:02
|
||||
2025-05-11 18:26:11
|
||||
1. 一些累计更新
|
||||
2. 优化安卓APP
|
||||
3. 新增防火墙,用于网卡、端口转发、和socks5
|
||||
4. 检测密钥是否正确
|
||||
5. 如果你设备很多,请尝试升级其中一个成功重启后再升级其它
|
||||
4. 优化重启清理数据,优化了网卡自启动问题
|
||||
5. 检测密钥是否正确
|
||||
6. 如果你设备很多,请尝试升级其中一个成功重启后再升级其它
|
Reference in New Issue
Block a user