增加dnscryptproxy目录
This commit is contained in:
parent
b3986ed081
commit
c0ca95335c
18
@libs/LICENSE
Normal file
18
@libs/LICENSE
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* ISC License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018-2021
|
||||||
|
* Frank Denis <j at pureftpd dot org>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -12,7 +13,8 @@ namespace FastGithub.DomainResolve
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
sealed class DnscryptProxy
|
sealed class DnscryptProxy
|
||||||
{
|
{
|
||||||
private const string name = "dnscrypt-proxy";
|
private const string PATH = "dnscryptproxy";
|
||||||
|
private const string Name = "dnscrypt-proxy";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 相关进程
|
/// 相关进程
|
||||||
@ -40,11 +42,11 @@ namespace FastGithub.DomainResolve
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task StartAsync(CancellationToken cancellationToken)
|
public async Task StartAsync(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var tomlPath = $"{name}.toml";
|
var tomlPath = Path.Combine(PATH, $"{Name}.toml");
|
||||||
await TomlUtil.SetListensAsync(tomlPath, this.EndPoint, cancellationToken);
|
await TomlUtil.SetListensAsync(tomlPath, this.EndPoint, cancellationToken);
|
||||||
await TomlUtil.SetEdnsClientSubnetAsync(tomlPath, cancellationToken);
|
await TomlUtil.SetEdnsClientSubnetAsync(tomlPath, cancellationToken);
|
||||||
|
|
||||||
foreach (var process in Process.GetProcessesByName(name))
|
foreach (var process in Process.GetProcessesByName(Name))
|
||||||
{
|
{
|
||||||
process.Kill();
|
process.Kill();
|
||||||
process.WaitForExit();
|
process.WaitForExit();
|
||||||
@ -55,7 +57,7 @@ namespace FastGithub.DomainResolve
|
|||||||
StartDnscryptProxy("-service uninstall")?.WaitForExit();
|
StartDnscryptProxy("-service uninstall")?.WaitForExit();
|
||||||
StartDnscryptProxy("-service install")?.WaitForExit();
|
StartDnscryptProxy("-service install")?.WaitForExit();
|
||||||
StartDnscryptProxy("-service start")?.WaitForExit();
|
StartDnscryptProxy("-service start")?.WaitForExit();
|
||||||
this.process = Process.GetProcessesByName(name).FirstOrDefault(item => item.SessionId == 0);
|
this.process = Process.GetProcessesByName(Name).FirstOrDefault(item => item.SessionId == 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -86,11 +88,13 @@ namespace FastGithub.DomainResolve
|
|||||||
/// <param name="arguments"></param>
|
/// <param name="arguments"></param>
|
||||||
private static Process? StartDnscryptProxy(string arguments)
|
private static Process? StartDnscryptProxy(string arguments)
|
||||||
{
|
{
|
||||||
|
var fileName = OperatingSystem.IsWindows() ? $"{Name}.exe" : Name;
|
||||||
return Process.Start(new ProcessStartInfo
|
return Process.Start(new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = OperatingSystem.IsWindows() ? $"{name}.exe" : name,
|
FileName = Path.Combine(PATH, fileName),
|
||||||
Arguments = arguments,
|
Arguments = arguments,
|
||||||
UseShellExecute = true,
|
WorkingDirectory = PATH,
|
||||||
|
UseShellExecute = false,
|
||||||
CreateNoWindow = true,
|
CreateNoWindow = true,
|
||||||
WindowStyle = ProcessWindowStyle.Hidden
|
WindowStyle = ProcessWindowStyle.Hidden
|
||||||
});
|
});
|
||||||
@ -102,7 +106,7 @@ namespace FastGithub.DomainResolve
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return name;
|
return Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,25 +8,28 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="../@libs/dnscrypt-proxy.toml" Link="dnscrypt-proxy.toml">
|
<None Include="../@libs/dnscrypt-proxy.toml" Link="dnscryptproxy/dnscrypt-proxy.toml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="../@libs/LICENSE" Link="dnscryptproxy/LICENSE">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(RuntimeIdentifier)' == 'win-x64'">
|
<ItemGroup Condition="'$(RuntimeIdentifier)' == 'win-x64'">
|
||||||
<None Include="../@libs/windows-x64/dnscrypt-proxy.exe" Link="dnscrypt-proxy.exe">
|
<None Include="../@libs/windows-x64/dnscrypt-proxy.exe" Link="dnscryptproxy/dnscrypt-proxy.exe">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(RuntimeIdentifier)' == 'linux-x64'">
|
<ItemGroup Condition="'$(RuntimeIdentifier)' == 'linux-x64'">
|
||||||
<None Include="../@libs/linux-x64/dnscrypt-proxy" Link="dnscrypt-proxy">
|
<None Include="../@libs/linux-x64/dnscrypt-proxy" Link="dnscryptproxy/dnscrypt-proxy">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(RuntimeIdentifier)' == 'osx-x64'">
|
<ItemGroup Condition="'$(RuntimeIdentifier)' == 'osx-x64'">
|
||||||
<None Include="../@libs/osx-x64/dnscrypt-proxy" Link="dnscrypt-proxy">
|
<None Include="../@libs/osx-x64/dnscrypt-proxy" Link="dnscryptproxy/dnscrypt-proxy">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
14
pack.sh
14
pack.sh
@ -2,17 +2,15 @@
|
|||||||
cd ./FastGithub/bin/publish
|
cd ./FastGithub/bin/publish
|
||||||
|
|
||||||
# linux-x64
|
# linux-x64
|
||||||
chmod 777 ./linux-x64/dnscrypt-proxy
|
chmod 777 ./FastGithub_linux-x64/FastGithub
|
||||||
chmod 777 ./linux-x64/FastGithub
|
chmod 777 ./FastGithub_linux-x64/dnscryptproxy/dnscrypt-proxy
|
||||||
zip -r linux-x64.zip linux-x64
|
zip -r FastGithub_linux-x64.zip FastGithub_linux-x64
|
||||||
|
|
||||||
# osx-x64
|
# osx-x64
|
||||||
chmod 777 ./osx-x64/dnscrypt-proxy
|
zip -r FastGithub_osx-x64.zip FastGithub_osx-x64
|
||||||
chmod 777 ./osx-x64/FastGithub
|
|
||||||
zip -r osx-x64.zip osx-x64
|
|
||||||
|
|
||||||
# win10-x64
|
# win10-x64
|
||||||
zip -r win10-x64.zip win10-x64 -x "./win10-x64/aspnetcorev2_inprocess.dll"
|
zip -r FastGithub_win10-x64.zip FastGithub_win10-x64 -x "./win10-x64/aspnetcorev2_inprocess.dll"
|
||||||
|
|
||||||
# win7-x64
|
# win7-x64
|
||||||
zip -r win7-x64.zip win7-x64
|
zip -r FastGithub_win7-x64.zip FastGithub_win7-x64
|
||||||
Loading…
Reference in New Issue
Block a user