Selaa lähdekoodia

refactor: drop console

Bruce Wayne 3 vuotta sitten
vanhempi
sitoutus
e1ad9c5627

+ 0 - 19
NatTypeTester-Console/NatTypeTester_Console.csproj

@@ -1,19 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <Import Project="..\common.props" />
-
-  <PropertyGroup>
-    <OutputType>Exe</OutputType>
-    <RootNamespace>NatTypeTester</RootNamespace>
-    <AssemblyName>NatTypeTester.Console</AssemblyName>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <PackageReference Include="Dns.Net" Version="0.2.0" />
-  </ItemGroup>
-
-  <ItemGroup>
-    <ProjectReference Include="..\STUN\STUN.csproj" />
-  </ItemGroup>
-
-</Project>

+ 0 - 41
NatTypeTester-Console/Program.cs

@@ -1,41 +0,0 @@
-using Dns.Net.Clients;
-using STUN;
-using STUN.Client;
-using STUN.StunResult;
-using System.Net;
-
-//stun.qq.com:3478 0.0.0.0:0
-string server = @"stun.syncthing.net";
-ushort port = 3478;
-IPEndPoint local = new(IPAddress.Any, 0);
-
-if (args.Length > 0 && StunServer.TryParse(args[0], out StunServer? stun))
-{
-	server = stun.Hostname;
-	port = stun.Port;
-}
-
-if (args.Length > 1)
-{
-	if (IPEndPoint.TryParse(args[2], out IPEndPoint? ipEndPoint))
-	{
-		local = ipEndPoint;
-	}
-}
-
-DefaultDnsClient dnsClient = new();
-IPAddress ip = await dnsClient.QueryAsync(server);
-using StunClient5389UDP client = new(new IPEndPoint(ip, port), local);
-
-using CancellationTokenSource cts = new();
-cts.CancelAfter(TimeSpan.FromSeconds(5));
-await client.QueryAsync(cts.Token);
-
-StunResult5389 res = client.State;
-
-Console.WriteLine($@"Other address is {res.OtherEndPoint}");
-Console.WriteLine($@"Binding test: {res.BindingTestResult}");
-Console.WriteLine($@"Local address: {res.LocalEndPoint}");
-Console.WriteLine($@"Mapped address: {res.PublicEndPoint}");
-Console.WriteLine($@"Nat mapping behavior: {res.MappingBehavior}");
-Console.WriteLine($@"Nat filtering behavior: {res.FilteringBehavior}");

+ 3 - 9
NatTypeTester.sln

@@ -1,19 +1,17 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.29102.190
+# Visual Studio Version 17
+VisualStudioVersion = 17.2.32505.173
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NatTypeTester", "NatTypeTester\NatTypeTester.csproj", "{B5104123-EB01-4079-8865-2A99DD91DC24}"
 EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NatTypeTester_Console", "NatTypeTester-Console\NatTypeTester_Console.csproj", "{CC6BE2E2-81CB-4C0B-BA17-4BB48DD403AC}"
-EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "STUN", "STUN\STUN.csproj", "{BF8F4960-AA76-4A0F-BA6D-EDF26DEFB9CA}"
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest", "UnitTest\UnitTest.csproj", "{AA8AF9BF-5CFB-4725-B42A-7B3B3890A279}"
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NatTypeTester.ViewModels", "NatTypeTester.ViewModels\NatTypeTester.ViewModels.csproj", "{D7626B0E-17B0-4743-888F-A32797442750}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NatTypeTester.Models", "NatTypeTester.Models\NatTypeTester.Models.csproj", "{FC61BC61-E24B-4E78-ABA4-C6CB6C05EFC2}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NatTypeTester.Models", "NatTypeTester.Models\NatTypeTester.Models.csproj", "{FC61BC61-E24B-4E78-ABA4-C6CB6C05EFC2}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -25,10 +23,6 @@ Global
 		{B5104123-EB01-4079-8865-2A99DD91DC24}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{B5104123-EB01-4079-8865-2A99DD91DC24}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{B5104123-EB01-4079-8865-2A99DD91DC24}.Release|Any CPU.Build.0 = Release|Any CPU
-		{CC6BE2E2-81CB-4C0B-BA17-4BB48DD403AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{CC6BE2E2-81CB-4C0B-BA17-4BB48DD403AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{CC6BE2E2-81CB-4C0B-BA17-4BB48DD403AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{CC6BE2E2-81CB-4C0B-BA17-4BB48DD403AC}.Release|Any CPU.Build.0 = Release|Any CPU
 		{BF8F4960-AA76-4A0F-BA6D-EDF26DEFB9CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{BF8F4960-AA76-4A0F-BA6D-EDF26DEFB9CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{BF8F4960-AA76-4A0F-BA6D-EDF26DEFB9CA}.Release|Any CPU.ActiveCfg = Release|Any CPU