diff --git a/@libs/LICENSE b/@libs/LICENSE new file mode 100644 index 0000000..3bc3ae4 --- /dev/null +++ b/@libs/LICENSE @@ -0,0 +1,18 @@ +/* + * ISC License + * + * Copyright (c) 2018-2021 + * Frank Denis + * + * 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. + */ diff --git a/FastGithub.DomainResolve/DnscryptProxy.cs b/FastGithub.DomainResolve/DnscryptProxy.cs index fbe0e52..5a37cf0 100644 --- a/FastGithub.DomainResolve/DnscryptProxy.cs +++ b/FastGithub.DomainResolve/DnscryptProxy.cs @@ -1,5 +1,6 @@ using System; using System.Diagnostics; +using System.IO; using System.Linq; using System.Net; using System.Threading; @@ -12,7 +13,8 @@ namespace FastGithub.DomainResolve /// sealed class DnscryptProxy { - private const string name = "dnscrypt-proxy"; + private const string PATH = "dnscryptproxy"; + private const string Name = "dnscrypt-proxy"; /// /// 相关进程 @@ -40,11 +42,11 @@ namespace FastGithub.DomainResolve /// 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.SetEdnsClientSubnetAsync(tomlPath, cancellationToken); - foreach (var process in Process.GetProcessesByName(name)) + foreach (var process in Process.GetProcessesByName(Name)) { process.Kill(); process.WaitForExit(); @@ -55,7 +57,7 @@ namespace FastGithub.DomainResolve StartDnscryptProxy("-service uninstall")?.WaitForExit(); StartDnscryptProxy("-service install")?.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 { @@ -86,11 +88,13 @@ namespace FastGithub.DomainResolve /// private static Process? StartDnscryptProxy(string arguments) { + var fileName = OperatingSystem.IsWindows() ? $"{Name}.exe" : Name; return Process.Start(new ProcessStartInfo { - FileName = OperatingSystem.IsWindows() ? $"{name}.exe" : name, + FileName = Path.Combine(PATH, fileName), Arguments = arguments, - UseShellExecute = true, + WorkingDirectory = PATH, + UseShellExecute = false, CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden }); @@ -102,7 +106,7 @@ namespace FastGithub.DomainResolve /// public override string ToString() { - return name; + return Name; } } } diff --git a/FastGithub.DomainResolve/FastGithub.DomainResolve.csproj b/FastGithub.DomainResolve/FastGithub.DomainResolve.csproj index c2b7f55..1e02d91 100644 --- a/FastGithub.DomainResolve/FastGithub.DomainResolve.csproj +++ b/FastGithub.DomainResolve/FastGithub.DomainResolve.csproj @@ -8,25 +8,28 @@ - + PreserveNewest + + PreserveNewest + - + PreserveNewest - + PreserveNewest - + PreserveNewest diff --git a/pack.sh b/pack.sh index f5c7a5c..d07a31e 100644 --- a/pack.sh +++ b/pack.sh @@ -2,17 +2,15 @@ cd ./FastGithub/bin/publish # linux-x64 -chmod 777 ./linux-x64/dnscrypt-proxy -chmod 777 ./linux-x64/FastGithub -zip -r linux-x64.zip linux-x64 +chmod 777 ./FastGithub_linux-x64/FastGithub +chmod 777 ./FastGithub_linux-x64/dnscryptproxy/dnscrypt-proxy +zip -r FastGithub_linux-x64.zip FastGithub_linux-x64 # osx-x64 -chmod 777 ./osx-x64/dnscrypt-proxy -chmod 777 ./osx-x64/FastGithub -zip -r osx-x64.zip osx-x64 +zip -r FastGithub_osx-x64.zip FastGithub_osx-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 -zip -r win7-x64.zip win7-x64 \ No newline at end of file +zip -r FastGithub_win7-x64.zip FastGithub_win7-x64 \ No newline at end of file