diff --git a/Netch.sln b/Netch.sln
index ce26dd2d..7602e745 100644
--- a/Netch.sln
+++ b/Netch.sln
@@ -1,16 +1,31 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.31205.134
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.31808.319
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Netch", "Netch\Netch.csproj", "{A193DF89-ADCF-4DB4-B75C-729C8BA8A9F3}"
+ ProjectSection(ProjectDependencies) = postProject
+ {9142C528-9E42-448D-96B6-7E62E47B54F3} = {9142C528-9E42-448D-96B6-7E62E47B54F3}
+ {1676DEF3-FBE4-47D2-93A6-8F85EA2F5B74} = {1676DEF3-FBE4-47D2-93A6-8F85EA2F5B74}
+ {7374F7F4-1732-4DED-A603-8335F6704F10} = {7374F7F4-1732-4DED-A603-8335F6704F10}
+ EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{09222C6B-2FFB-4DA7-BC75-CB0A80086711}"
+ ProjectSection(ProjectDependencies) = postProject
+ {A193DF89-ADCF-4DB4-B75C-729C8BA8A9F3} = {A193DF89-ADCF-4DB4-B75C-729C8BA8A9F3}
+ {1676DEF3-FBE4-47D2-93A6-8F85EA2F5B74} = {1676DEF3-FBE4-47D2-93A6-8F85EA2F5B74}
+ {7374F7F4-1732-4DED-A603-8335F6704F10} = {7374F7F4-1732-4DED-A603-8335F6704F10}
+ EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Redirector", "Redirector\Redirector.vcxproj", "{1676DEF3-FBE4-47D2-93A6-8F85EA2F5B74}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RouteHelper", "RouteHelper\RouteHelper.vcxproj", "{7374F7F4-1732-4DED-A603-8335F6704F10}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedirectorTester", "RedirectorTester\RedirectorTester.csproj", "{9142C528-9E42-448D-96B6-7E62E47B54F3}"
+ ProjectSection(ProjectDependencies) = postProject
+ {1676DEF3-FBE4-47D2-93A6-8F85EA2F5B74} = {1676DEF3-FBE4-47D2-93A6-8F85EA2F5B74}
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -32,6 +47,9 @@ Global
{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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Redirector/Redirector.vcxproj b/Redirector/Redirector.vcxproj
index f35bd7be..03c0e3a1 100644
--- a/Redirector/Redirector.vcxproj
+++ b/Redirector/Redirector.vcxproj
@@ -45,16 +45,16 @@
true
- $(ProjectDir)bin\
- $(ProjectDir)obj\
+ $(ProjectDir)bin\$(Configuration)\
+ $(ProjectDir)obj\$(Configuration)\
.bin
$(ProjectDir)include\;$(IncludePath)
$(ProjectDir)lib\;$(LibraryPath)
false
- $(ProjectDir)bin\
- $(ProjectDir)obj\
+ $(ProjectDir)bin\$(Configuration)\
+ $(ProjectDir)obj\$(Configuration)\
.bin
$(ProjectDir)include\;$(IncludePath)
$(ProjectDir)lib\;$(LibraryPath)
diff --git a/RedirectorTester/.gitignore b/RedirectorTester/.gitignore
new file mode 100644
index 00000000..aeb4af3c
--- /dev/null
+++ b/RedirectorTester/.gitignore
@@ -0,0 +1,3 @@
+/bin
+/obj
+/*.csproj.user
diff --git a/RedirectorTester/App.config b/RedirectorTester/App.config
new file mode 100644
index 00000000..3916e0e4
--- /dev/null
+++ b/RedirectorTester/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/RedirectorTester/App.manifest b/RedirectorTester/App.manifest
new file mode 100644
index 00000000..3963a0b7
--- /dev/null
+++ b/RedirectorTester/App.manifest
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/RedirectorTester/Properties/AssemblyInfo.cs b/RedirectorTester/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..f6256971
--- /dev/null
+++ b/RedirectorTester/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("RedirectorTester")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("RedirectorTester")]
+[assembly: AssemblyCopyright("Copyright © 2021")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("9142c528-9e42-448d-96b6-7e62e47b54f3")]
+
+// 程序集的版本信息由下列四个值组成:
+//
+// 主版本
+// 次版本
+// 生成号
+// 修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
+//通过使用 "*",如下所示:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/RedirectorTester/RedirectorTester.cs b/RedirectorTester/RedirectorTester.cs
new file mode 100644
index 00000000..73f95d94
--- /dev/null
+++ b/RedirectorTester/RedirectorTester.cs
@@ -0,0 +1,87 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace RedirectorTester
+{
+ public class RedirectorTester
+ {
+ public enum NameList : int
+ {
+ AIO_FILTERLOOPBACK,
+ AIO_FILTERINTRANET,
+ AIO_FILTERPARENT,
+ AIO_FILTERICMP,
+ AIO_FILTERTCP,
+ AIO_FILTERUDP,
+ AIO_FILTERDNS,
+
+ AIO_ICMPING,
+
+ AIO_DNSHOST,
+ AIO_DNSPORT,
+
+ AIO_TGTHOST,
+ AIO_TGTPORT,
+ AIO_TGTUSER,
+ AIO_TGTPASS,
+
+ AIO_CLRNAME,
+ AIO_ADDNAME,
+ AIO_BYPNAME
+ }
+
+ [DllImport("Redirector.bin", CallingConvention = CallingConvention.Cdecl)]
+ public static extern bool aio_register([MarshalAs(UnmanagedType.LPWStr)] string value);
+
+ [DllImport("Redirector.bin", CallingConvention = CallingConvention.Cdecl)]
+ public static extern bool aio_unregister([MarshalAs(UnmanagedType.LPWStr)] string value);
+
+ [DllImport("Redirector.bin", CallingConvention = CallingConvention.Cdecl)]
+ public static extern bool aio_dial(NameList name, [MarshalAs(UnmanagedType.LPWStr)] string value);
+
+ [DllImport("Redirector.bin", CallingConvention = CallingConvention.Cdecl)]
+ public static extern bool aio_init();
+
+ [DllImport("Redirector.bin", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void aio_free();
+
+ [DllImport("Redirector.bin", CallingConvention = CallingConvention.Cdecl)]
+ public static extern ulong aio_getUP();
+
+ [DllImport("Redirector.bin", CallingConvention = CallingConvention.Cdecl)]
+ public static extern ulong aio_getDL();
+
+ public static void Main(string[] args)
+ {
+ aio_dial(NameList.AIO_FILTERLOOPBACK, "false");
+ aio_dial(NameList.AIO_FILTERINTRANET, "false");
+ aio_dial(NameList.AIO_FILTERPARENT, "false");
+ aio_dial(NameList.AIO_FILTERICMP, "true");
+ aio_dial(NameList.AIO_FILTERTCP, "true");
+ aio_dial(NameList.AIO_FILTERUDP, "true");
+ aio_dial(NameList.AIO_FILTERDNS, "false");
+
+ aio_dial(NameList.AIO_ICMPING, "10");
+
+ aio_dial(NameList.AIO_DNSHOST, "1.1.1.1");
+ aio_dial(NameList.AIO_DNSPORT, "53");
+
+ aio_dial(NameList.AIO_TGTHOST, "127.0.0.1");
+ aio_dial(NameList.AIO_TGTPORT, "1080");
+ aio_dial(NameList.AIO_TGTUSER, "");
+ aio_dial(NameList.AIO_TGTPASS, "");
+
+ aio_dial(NameList.AIO_CLRNAME, "");
+ aio_dial(NameList.AIO_ADDNAME, "Telegram");
+ aio_dial(NameList.AIO_ADDNAME, "NatTypeTester");
+
+ aio_init();
+ Console.ReadLine();
+ aio_free();
+ }
+ }
+}
diff --git a/RedirectorTester/RedirectorTester.csproj b/RedirectorTester/RedirectorTester.csproj
new file mode 100644
index 00000000..a54c1e95
--- /dev/null
+++ b/RedirectorTester/RedirectorTester.csproj
@@ -0,0 +1,65 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {9142C528-9E42-448D-96B6-7E62E47B54F3}
+ Exe
+ RedirectorTester
+ RedirectorTester
+ v4.8
+ 512
+ true
+ true
+
+
+ true
+ bin\x64\Debug\
+ DEBUG;TRACE
+ full
+ x64
+ 7.3
+ prompt
+ true
+
+
+ bin\x64\Release\
+ TRACE
+ true
+ pdbonly
+ x64
+ 7.3
+ prompt
+ true
+
+
+ RedirectorTester.RedirectorTester
+
+
+ App.manifest
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ COPY /Y $(SolutionDir)Redirector\bin\$(Configuration)\Redirector.bin $(TargetDir) > NUL 2>&1
+COPY /Y $(SolutionDir)Redirector\bin\$(Configuration)\Redirector.pdb $(TargetDir) > NUL 2>&1
+
+
\ No newline at end of file