Skip to content

Commit

Permalink
Fix repository
Browse files Browse the repository at this point in the history
  • Loading branch information
AmazingDM committed Mar 22, 2022
1 parent 17b9640 commit b53d4a6
Show file tree
Hide file tree
Showing 340 changed files with 142,376 additions and 3,240 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Checksum
shell: pwsh
Expand All @@ -18,28 +18,28 @@ jobs:
echo "SOURCE_ROUTEHELPER_SHA256=$(.\sha256.ps1 .\RouteHelper)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
- name: Cache Netch
uses: actions/cache@v2
uses: actions/cache@v3
with:
key: Netch-${{ runner.os }}-Netch-${{ env.SOURCE_NETCH_SHA256 }}
path: |
.\Netch\bin
- name: Cache Other
uses: actions/cache@v2
uses: actions/cache@v3
with:
key: Netch-${{ runner.os }}-Other-${{ env.SOURCE_OTHER_SHA256 }}
path: |
.\Other\release
- name: Cache Redirector
uses: actions/cache@v2
uses: actions/cache@v3
with:
key: Netch-${{ runner.os }}-Redirector-${{ env.SOURCE_REDIRECTOR_SHA256 }}
path: |
.\Redirector\bin
- name: Cache RouteHelper
uses: actions/cache@v2
uses: actions/cache@v3
with:
key: Netch-${{ runner.os }}-RouteHelper-${{ env.SOURCE_ROUTEHELPER_SHA256 }}
path: |
Expand All @@ -63,7 +63,7 @@ jobs:
with:
update: true
release: true
install: base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-libevent mingw-w64-x86_64-pcre2 mingw-w64-x86_64-freetype mingw-w64-x86_64-libpng mingw-w64-x86_64-bzip2 mingw-w64-x86_64-openssl mingw-w64-x86_64-mbedtls mingw-w64-x86_64-libsodium mingw-w64-x86_64-c-ares mingw-w64-x86_64-boost mingw-w64-x86_64-libmariadbclient unzip p7zip
install: base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-libevent mingw-w64-x86_64-pcre2 mingw-w64-x86_64-freetype mingw-w64-x86_64-libpng mingw-w64-x86_64-bzip2 mingw-w64-x86_64-openssl mingw-w64-x86_64-mbedtls mingw-w64-x86_64-libsodium mingw-w64-x86_64-c-ares mingw-w64-x86_64-boost mingw-w64-x86_64-libmariadbclient unzip p7zip autoconf automake libtool

- name: Setup Rust
uses: actions-rs/toolchain@v1
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Checksum
shell: pwsh
Expand All @@ -21,21 +21,21 @@ jobs:
echo "SOURCE_ROUTEHELPER_SHA256=$(.\sha256.ps1 .\RouteHelper)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
- name: Cache Netch
uses: actions/cache@v2
uses: actions/cache@v3
with:
key: Netch-${{ runner.os }}-Netch-${{ env.SOURCE_NETCH_SHA256 }}
path: |
.\Netch\bin
- name: Cache Redirector
uses: actions/cache@v2
uses: actions/cache@v3
with:
key: Netch-${{ runner.os }}-Redirector-${{ env.SOURCE_REDIRECTOR_SHA256 }}
path: |
.\Redirector\bin
- name: Cache RouteHelper
uses: actions/cache@v2
uses: actions/cache@v3
with:
key: Netch-${{ runner.os }}-RouteHelper-${{ env.SOURCE_ROUTEHELPER_SHA256 }}
path: |
Expand All @@ -59,7 +59,7 @@ jobs:
with:
update: true
release: true
install: base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-libevent mingw-w64-x86_64-pcre2 mingw-w64-x86_64-freetype mingw-w64-x86_64-libpng mingw-w64-x86_64-bzip2 mingw-w64-x86_64-openssl mingw-w64-x86_64-mbedtls mingw-w64-x86_64-libsodium mingw-w64-x86_64-c-ares mingw-w64-x86_64-boost mingw-w64-x86_64-libmariadbclient unzip p7zip
install: base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-libevent mingw-w64-x86_64-pcre2 mingw-w64-x86_64-freetype mingw-w64-x86_64-libpng mingw-w64-x86_64-bzip2 mingw-w64-x86_64-openssl mingw-w64-x86_64-mbedtls mingw-w64-x86_64-libsodium mingw-w64-x86_64-c-ares mingw-w64-x86_64-boost mingw-w64-x86_64-libmariadbclient unzip p7zip autoconf automake libtool

- name: Setup Rust
uses: actions-rs/toolchain@v1
Expand Down
6 changes: 2 additions & 4 deletions Netch.sln
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,17 @@ Global
{A193DF89-ADCF-4DB4-B75C-729C8BA8A9F3}.Release|x64.ActiveCfg = Release|x64
{A193DF89-ADCF-4DB4-B75C-729C8BA8A9F3}.Release|x64.Build.0 = Release|x64
{09222C6B-2FFB-4DA7-BC75-CB0A80086711}.Debug|x64.ActiveCfg = Debug|x64
{09222C6B-2FFB-4DA7-BC75-CB0A80086711}.Debug|x64.Build.0 = Debug|x64
{09222C6B-2FFB-4DA7-BC75-CB0A80086711}.Release|x64.ActiveCfg = Release|x64
{09222C6B-2FFB-4DA7-BC75-CB0A80086711}.Release|x64.Build.0 = Release|x64
{1676DEF3-FBE4-47D2-93A6-8F85EA2F5B74}.Debug|x64.ActiveCfg = Debug|x64
{1676DEF3-FBE4-47D2-93A6-8F85EA2F5B74}.Debug|x64.Build.0 = Debug|x64
{1676DEF3-FBE4-47D2-93A6-8F85EA2F5B74}.Release|x64.ActiveCfg = Release|x64
{1676DEF3-FBE4-47D2-93A6-8F85EA2F5B74}.Release|x64.Build.0 = Release|x64
{7374F7F4-1732-4DED-A603-8335F6704F10}.Debug|x64.ActiveCfg = Debug|x64
{7374F7F4-1732-4DED-A603-8335F6704F10}.Debug|x64.Build.0 = Debug|x64
{7374F7F4-1732-4DED-A603-8335F6704F10}.Release|x64.ActiveCfg = Release|x64
{7374F7F4-1732-4DED-A603-8335F6704F10}.Release|x64.Build.0 = Release|x64
{9142C528-9E42-448D-96B6-7E62E47B54F3}.Debug|x64.ActiveCfg = Debug|x64
{9142C528-9E42-448D-96B6-7E62E47B54F3}.Debug|x64.Build.0 = Debug|x64
{9142C528-9E42-448D-96B6-7E62E47B54F3}.Release|x64.ActiveCfg = Release|x64
{9142C528-9E42-448D-96B6-7E62E47B54F3}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
7 changes: 4 additions & 3 deletions Netch/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/bin
/obj
/*.csproj.user
/bin
/obj
/*.csproj.user
FodyWeavers.xsd
1 change: 0 additions & 1 deletion Netch/.must_build

This file was deleted.

55 changes: 31 additions & 24 deletions Netch/App.manifest
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="Netch"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware>
</windowsSettings>
</application>
</assembly>
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
</asmv3:windowsSettings>
</asmv3:application>

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />

<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />

<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />

<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
</assembly>
9 changes: 0 additions & 9 deletions Netch/App.xaml

This file was deleted.

13 changes: 0 additions & 13 deletions Netch/App.xaml.cs

This file was deleted.

10 changes: 0 additions & 10 deletions Netch/AssemblyInfo.cs

This file was deleted.

30 changes: 30 additions & 0 deletions Netch/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
namespace Netch;

public static class Constants
{
public const string TempConfig = "data\\last.json";
public const string TempRouteFile = "data\\route.txt";

public const string AioDnsRuleFile = "bin\\aiodns.conf";
public const string NFDriver = "bin\\nfdriver.sys";
public const string STUNServersFile = "bin\\stun.txt";

public const string LogFile = "logging\\application.log";

public const string OutputTemplate = @"[{Timestamp:yyyy-MM-dd HH:mm:ss}][{Level}] {Message:lj}{NewLine}{Exception}";
public const string EOF = "\r\n";

public const string DefaultGroup = "NONE";

public static class Parameter
{
public const string Show = "-show";
public const string ForceUpdate = "-forceUpdate";
}

public const string WintunDllFile = "bin\\wintun.dll";
public const string DisableModeDirectoryFileName = "disabled";

public const string DefaultPrimaryDNS = "1.1.1.1";
public const string DefaultCNPrimaryDNS = "223.5.5.5";
}
30 changes: 30 additions & 0 deletions Netch/Controllers/DNSController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Netch.Interfaces;
using Netch.Models;
using static Netch.Interops.AioDNS;

namespace Netch.Controllers;

public class DNSController : IController
{
public string Name => "DNS Service";

public async Task StartAsync()
{
var aioDnsConfig = Global.Settings.AioDNS;

Dial(NameList.TYPE_REST, "");
Dial(NameList.TYPE_LIST, Path.GetFullPath(Constants.AioDnsRuleFile));
// TODO remove ListenPort setting
Dial(NameList.TYPE_LISN, $"127.0.0.1:{aioDnsConfig.ListenPort}");
Dial(NameList.TYPE_CDNS, $"{aioDnsConfig.ChinaDNS}");
Dial(NameList.TYPE_ODNS, $"{aioDnsConfig.OtherDNS}");

if (!await InitAsync())
throw new MessageException("AioDNS start failed.");
}

public Task StopAsync()
{
return FreeAsync();
}
}
Loading

0 comments on commit b53d4a6

Please sign in to comment.