Skip to content

Commit b53d4a6

Browse files
committed
Fix repository
1 parent 17b9640 commit b53d4a6

File tree

340 files changed

+142376
-3240
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

340 files changed

+142376
-3240
lines changed

.github/workflows/build.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: windows-2022
88
steps:
99
- name: Checkout
10-
uses: actions/checkout@v2
10+
uses: actions/checkout@v3
1111

1212
- name: Checksum
1313
shell: pwsh
@@ -18,28 +18,28 @@ jobs:
1818
echo "SOURCE_ROUTEHELPER_SHA256=$(.\sha256.ps1 .\RouteHelper)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
1919
2020
- name: Cache Netch
21-
uses: actions/cache@v2
21+
uses: actions/cache@v3
2222
with:
2323
key: Netch-${{ runner.os }}-Netch-${{ env.SOURCE_NETCH_SHA256 }}
2424
path: |
2525
.\Netch\bin
2626
2727
- name: Cache Other
28-
uses: actions/cache@v2
28+
uses: actions/cache@v3
2929
with:
3030
key: Netch-${{ runner.os }}-Other-${{ env.SOURCE_OTHER_SHA256 }}
3131
path: |
3232
.\Other\release
3333
3434
- name: Cache Redirector
35-
uses: actions/cache@v2
35+
uses: actions/cache@v3
3636
with:
3737
key: Netch-${{ runner.os }}-Redirector-${{ env.SOURCE_REDIRECTOR_SHA256 }}
3838
path: |
3939
.\Redirector\bin
4040
4141
- name: Cache RouteHelper
42-
uses: actions/cache@v2
42+
uses: actions/cache@v3
4343
with:
4444
key: Netch-${{ runner.os }}-RouteHelper-${{ env.SOURCE_ROUTEHELPER_SHA256 }}
4545
path: |
@@ -63,7 +63,7 @@ jobs:
6363
with:
6464
update: true
6565
release: true
66-
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
66+
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
6767

6868
- name: Setup Rust
6969
uses: actions-rs/toolchain@v1

.github/workflows/release.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: windows-2022
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v3
1414

1515
- name: Checksum
1616
shell: pwsh
@@ -21,21 +21,21 @@ jobs:
2121
echo "SOURCE_ROUTEHELPER_SHA256=$(.\sha256.ps1 .\RouteHelper)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
2222
2323
- name: Cache Netch
24-
uses: actions/cache@v2
24+
uses: actions/cache@v3
2525
with:
2626
key: Netch-${{ runner.os }}-Netch-${{ env.SOURCE_NETCH_SHA256 }}
2727
path: |
2828
.\Netch\bin
2929
3030
- name: Cache Redirector
31-
uses: actions/cache@v2
31+
uses: actions/cache@v3
3232
with:
3333
key: Netch-${{ runner.os }}-Redirector-${{ env.SOURCE_REDIRECTOR_SHA256 }}
3434
path: |
3535
.\Redirector\bin
3636
3737
- name: Cache RouteHelper
38-
uses: actions/cache@v2
38+
uses: actions/cache@v3
3939
with:
4040
key: Netch-${{ runner.os }}-RouteHelper-${{ env.SOURCE_ROUTEHELPER_SHA256 }}
4141
path: |
@@ -59,7 +59,7 @@ jobs:
5959
with:
6060
update: true
6161
release: true
62-
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
62+
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
6363

6464
- name: Setup Rust
6565
uses: actions-rs/toolchain@v1

Netch.sln

+2-4
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,17 @@ Global
3737
{A193DF89-ADCF-4DB4-B75C-729C8BA8A9F3}.Release|x64.ActiveCfg = Release|x64
3838
{A193DF89-ADCF-4DB4-B75C-729C8BA8A9F3}.Release|x64.Build.0 = Release|x64
3939
{09222C6B-2FFB-4DA7-BC75-CB0A80086711}.Debug|x64.ActiveCfg = Debug|x64
40-
{09222C6B-2FFB-4DA7-BC75-CB0A80086711}.Debug|x64.Build.0 = Debug|x64
4140
{09222C6B-2FFB-4DA7-BC75-CB0A80086711}.Release|x64.ActiveCfg = Release|x64
41+
{09222C6B-2FFB-4DA7-BC75-CB0A80086711}.Release|x64.Build.0 = Release|x64
4242
{1676DEF3-FBE4-47D2-93A6-8F85EA2F5B74}.Debug|x64.ActiveCfg = Debug|x64
43-
{1676DEF3-FBE4-47D2-93A6-8F85EA2F5B74}.Debug|x64.Build.0 = Debug|x64
4443
{1676DEF3-FBE4-47D2-93A6-8F85EA2F5B74}.Release|x64.ActiveCfg = Release|x64
4544
{1676DEF3-FBE4-47D2-93A6-8F85EA2F5B74}.Release|x64.Build.0 = Release|x64
4645
{7374F7F4-1732-4DED-A603-8335F6704F10}.Debug|x64.ActiveCfg = Debug|x64
47-
{7374F7F4-1732-4DED-A603-8335F6704F10}.Debug|x64.Build.0 = Debug|x64
4846
{7374F7F4-1732-4DED-A603-8335F6704F10}.Release|x64.ActiveCfg = Release|x64
4947
{7374F7F4-1732-4DED-A603-8335F6704F10}.Release|x64.Build.0 = Release|x64
5048
{9142C528-9E42-448D-96B6-7E62E47B54F3}.Debug|x64.ActiveCfg = Debug|x64
51-
{9142C528-9E42-448D-96B6-7E62E47B54F3}.Debug|x64.Build.0 = Debug|x64
5249
{9142C528-9E42-448D-96B6-7E62E47B54F3}.Release|x64.ActiveCfg = Release|x64
50+
{9142C528-9E42-448D-96B6-7E62E47B54F3}.Release|x64.Build.0 = Release|x64
5351
EndGlobalSection
5452
GlobalSection(SolutionProperties) = preSolution
5553
HideSolutionNode = FALSE

Netch/.gitignore

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
/bin
2-
/obj
3-
/*.csproj.user
1+
/bin
2+
/obj
3+
/*.csproj.user
4+
FodyWeavers.xsd

Netch/.must_build

-1
This file was deleted.

Netch/App.manifest

+31-24
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
3-
<assemblyIdentity version="1.0.0.0" name="Netch"/>
4-
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
5-
<security>
6-
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
7-
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
8-
</requestedPrivileges>
9-
</security>
10-
</trustInfo>
11-
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
12-
<application>
13-
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
14-
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
15-
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
16-
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
17-
</application>
18-
</compatibility>
19-
<application xmlns="urn:schemas-microsoft-com:asm.v3">
20-
<windowsSettings>
21-
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware>
22-
</windowsSettings>
23-
</application>
24-
</assembly>
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
3+
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
4+
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
5+
<security>
6+
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
7+
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
8+
</requestedPrivileges>
9+
</security>
10+
</trustInfo>
11+
<asmv3:application>
12+
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
13+
</asmv3:windowsSettings>
14+
</asmv3:application>
15+
16+
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
17+
<application>
18+
<!-- Windows 7 -->
19+
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
20+
21+
<!-- Windows 8 -->
22+
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
23+
24+
<!-- Windows 8.1 -->
25+
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
26+
27+
<!-- Windows 10 -->
28+
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
29+
</application>
30+
</compatibility>
31+
</assembly>

Netch/App.xaml

-9
This file was deleted.

Netch/App.xaml.cs

-13
This file was deleted.

Netch/AssemblyInfo.cs

-10
This file was deleted.

Netch/Constants.cs

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
namespace Netch;
2+
3+
public static class Constants
4+
{
5+
public const string TempConfig = "data\\last.json";
6+
public const string TempRouteFile = "data\\route.txt";
7+
8+
public const string AioDnsRuleFile = "bin\\aiodns.conf";
9+
public const string NFDriver = "bin\\nfdriver.sys";
10+
public const string STUNServersFile = "bin\\stun.txt";
11+
12+
public const string LogFile = "logging\\application.log";
13+
14+
public const string OutputTemplate = @"[{Timestamp:yyyy-MM-dd HH:mm:ss}][{Level}] {Message:lj}{NewLine}{Exception}";
15+
public const string EOF = "\r\n";
16+
17+
public const string DefaultGroup = "NONE";
18+
19+
public static class Parameter
20+
{
21+
public const string Show = "-show";
22+
public const string ForceUpdate = "-forceUpdate";
23+
}
24+
25+
public const string WintunDllFile = "bin\\wintun.dll";
26+
public const string DisableModeDirectoryFileName = "disabled";
27+
28+
public const string DefaultPrimaryDNS = "1.1.1.1";
29+
public const string DefaultCNPrimaryDNS = "223.5.5.5";
30+
}

Netch/Controllers/DNSController.cs

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using Netch.Interfaces;
2+
using Netch.Models;
3+
using static Netch.Interops.AioDNS;
4+
5+
namespace Netch.Controllers;
6+
7+
public class DNSController : IController
8+
{
9+
public string Name => "DNS Service";
10+
11+
public async Task StartAsync()
12+
{
13+
var aioDnsConfig = Global.Settings.AioDNS;
14+
15+
Dial(NameList.TYPE_REST, "");
16+
Dial(NameList.TYPE_LIST, Path.GetFullPath(Constants.AioDnsRuleFile));
17+
// TODO remove ListenPort setting
18+
Dial(NameList.TYPE_LISN, $"127.0.0.1:{aioDnsConfig.ListenPort}");
19+
Dial(NameList.TYPE_CDNS, $"{aioDnsConfig.ChinaDNS}");
20+
Dial(NameList.TYPE_ODNS, $"{aioDnsConfig.OtherDNS}");
21+
22+
if (!await InitAsync())
23+
throw new MessageException("AioDNS start failed.");
24+
}
25+
26+
public Task StopAsync()
27+
{
28+
return FreeAsync();
29+
}
30+
}

0 commit comments

Comments
 (0)