diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8637c55b..9ab3944a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,8 +15,6 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | - 6.0.x - 7.0.x 8.0.x - name: Checkout code diff --git a/Source/MQTTnet.AspnetCore/MQTTnet.AspNetCore.csproj b/Source/MQTTnet.AspnetCore/MQTTnet.AspNetCore.csproj index e381d7c1b..675fae48d 100644 --- a/Source/MQTTnet.AspnetCore/MQTTnet.AspNetCore.csproj +++ b/Source/MQTTnet.AspnetCore/MQTTnet.AspNetCore.csproj @@ -1,7 +1,7 @@ - net6.0;net8.0 + net8.0 MQTTnet.AspNetCore MQTTnet.AspNetCore True diff --git a/Source/MQTTnet.Benchmarks/MQTTnet.Benchmarks.csproj b/Source/MQTTnet.Benchmarks/MQTTnet.Benchmarks.csproj index 9a23ab336..4a4563028 100644 --- a/Source/MQTTnet.Benchmarks/MQTTnet.Benchmarks.csproj +++ b/Source/MQTTnet.Benchmarks/MQTTnet.Benchmarks.csproj @@ -4,7 +4,7 @@ true Exe Full - net6.0;net8.0 + net8.0 false false false diff --git a/Source/MQTTnet.Benchmarks/Program.cs b/Source/MQTTnet.Benchmarks/Program.cs index bff20e88d..d395269f2 100644 --- a/Source/MQTTnet.Benchmarks/Program.cs +++ b/Source/MQTTnet.Benchmarks/Program.cs @@ -111,7 +111,7 @@ static void RenderMenu() { Console.Clear(); - Console.WriteLine($"MQTTnet - Benchmarks ({TargetFrameworkProvider.TargetFramework})"); + Console.WriteLine($"MQTTnet - Benchmarks"); Console.WriteLine("-----------------------------------------------"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Press arrow keys for benchmark selection"); diff --git a/Source/MQTTnet.Extensions.ManagedClient/MQTTnet.Extensions.ManagedClient.csproj b/Source/MQTTnet.Extensions.ManagedClient/MQTTnet.Extensions.ManagedClient.csproj index 21e6ce8ac..c06f61ba7 100644 --- a/Source/MQTTnet.Extensions.ManagedClient/MQTTnet.Extensions.ManagedClient.csproj +++ b/Source/MQTTnet.Extensions.ManagedClient/MQTTnet.Extensions.ManagedClient.csproj @@ -1,7 +1,7 @@ - net6.0;net8.0 + net8.0 MQTTnet.Extensions.ManagedClient MQTTnet.Extensions.ManagedClient True diff --git a/Source/MQTTnet.Extensions.Rpc/MQTTnet.Extensions.Rpc.csproj b/Source/MQTTnet.Extensions.Rpc/MQTTnet.Extensions.Rpc.csproj index 5ccea0deb..39f4249c6 100644 --- a/Source/MQTTnet.Extensions.Rpc/MQTTnet.Extensions.Rpc.csproj +++ b/Source/MQTTnet.Extensions.Rpc/MQTTnet.Extensions.Rpc.csproj @@ -1,7 +1,7 @@ - net6.0;net8.0 + net8.0 MQTTnet.Extensions.Rpc MQTTnet.Extensions.Rpc True diff --git a/Source/MQTTnet.Extensions.TopicTemplate/MQTTnet.Extensions.TopicTemplate.csproj b/Source/MQTTnet.Extensions.TopicTemplate/MQTTnet.Extensions.TopicTemplate.csproj index 6bdeb8d65..7149f4526 100644 --- a/Source/MQTTnet.Extensions.TopicTemplate/MQTTnet.Extensions.TopicTemplate.csproj +++ b/Source/MQTTnet.Extensions.TopicTemplate/MQTTnet.Extensions.TopicTemplate.csproj @@ -1,7 +1,7 @@ - net6.0;net8.0 + net8.0 MQTTnet.Extensions.TopicTemplate MQTTnet.Extensions.TopicTemplate True diff --git a/Source/MQTTnet.Server/MQTTnet.Server.csproj b/Source/MQTTnet.Server/MQTTnet.Server.csproj index 590d4b3fc..7f09ecdf7 100644 --- a/Source/MQTTnet.Server/MQTTnet.Server.csproj +++ b/Source/MQTTnet.Server/MQTTnet.Server.csproj @@ -1,7 +1,7 @@  - net6.0;net8.0 + net8.0 MQTTnet.Server MQTTnet.Server True diff --git a/Source/MQTTnet.TestApp/Program.cs b/Source/MQTTnet.TestApp/Program.cs index 8ac2c9b50..f4af9e0a8 100644 --- a/Source/MQTTnet.TestApp/Program.cs +++ b/Source/MQTTnet.TestApp/Program.cs @@ -2,99 +2,97 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using MQTTnet.Diagnostics; using System; using System.Threading; using System.Threading.Tasks; -namespace MQTTnet.TestApp +namespace MQTTnet.TestApp; + +public static class Program { - public static class Program + public static void Main() { - public static void Main() - { - Console.WriteLine($"MQTTnet - TestApp.{TargetFrameworkProvider.TargetFramework}"); - Console.WriteLine("1 = Start client"); - Console.WriteLine("2 = Start server"); - Console.WriteLine("3 = Start performance test"); - Console.WriteLine("4 = Start managed client"); - Console.WriteLine("5 = Start public broker test"); - Console.WriteLine("6 = Start server & client"); - Console.WriteLine("7 = Client flow test"); - Console.WriteLine("8 = Start performance test (client only)"); - Console.WriteLine("9 = Start server (no trace)"); - Console.WriteLine("a = Start QoS 2 benchmark"); - Console.WriteLine("b = Start QoS 1 benchmark"); - Console.WriteLine("c = Start QoS 0 benchmark"); - Console.WriteLine("d = Start server with logging"); - Console.WriteLine("e = Start Message Throughput Test"); - Console.WriteLine("f = Start AsyncLock Test"); - - var pressedKey = Console.ReadKey(true); - if (pressedKey.KeyChar == '1') - { - Task.Run(ClientTest.RunAsync); - } - else if (pressedKey.KeyChar == '2') - { - Task.Run(ServerTest.RunAsync); - } - else if (pressedKey.KeyChar == '3') - { - Task.Run(PerformanceTest.RunClientAndServer); - } - else if (pressedKey.KeyChar == '4') - { - Task.Run(ManagedClientTest.RunAsync); - } - else if (pressedKey.KeyChar == '5') - { - Task.Run(PublicBrokerTest.RunAsync); - } - else if (pressedKey.KeyChar == '6') - { - Task.Run(ServerAndClientTest.RunAsync); - } - else if (pressedKey.KeyChar == '7') - { - Task.Run(ClientFlowTest.RunAsync); - } - else if (pressedKey.KeyChar == '8') - { - PerformanceTest.RunClientOnly(); - return; - } - else if (pressedKey.KeyChar == '9') - { - ServerTest.RunEmptyServer(); - return; - } - else if (pressedKey.KeyChar == 'a') - { - Task.Run(PerformanceTest.RunQoS2Test); - } - else if (pressedKey.KeyChar == 'b') - { - Task.Run(PerformanceTest.RunQoS1Test); - } - else if (pressedKey.KeyChar == 'c') - { - Task.Run(PerformanceTest.RunQoS0Test); - } - else if (pressedKey.KeyChar == 'd') - { - Task.Run(ServerTest.RunEmptyServerWithLogging); - } - else if (pressedKey.KeyChar == 'e') - { - Task.Run(new MessageThroughputTest().Run); - } - else if (pressedKey.KeyChar == 'f') - { - Task.Run(new AsyncLockTest().Run); - } + Console.WriteLine("MQTTnet - TestApp"); + Console.WriteLine("1 = Start client"); + Console.WriteLine("2 = Start server"); + Console.WriteLine("3 = Start performance test"); + Console.WriteLine("4 = Start managed client"); + Console.WriteLine("5 = Start public broker test"); + Console.WriteLine("6 = Start server & client"); + Console.WriteLine("7 = Client flow test"); + Console.WriteLine("8 = Start performance test (client only)"); + Console.WriteLine("9 = Start server (no trace)"); + Console.WriteLine("a = Start QoS 2 benchmark"); + Console.WriteLine("b = Start QoS 1 benchmark"); + Console.WriteLine("c = Start QoS 0 benchmark"); + Console.WriteLine("d = Start server with logging"); + Console.WriteLine("e = Start Message Throughput Test"); + Console.WriteLine("f = Start AsyncLock Test"); - Thread.Sleep(Timeout.Infinite); + var pressedKey = Console.ReadKey(true); + if (pressedKey.KeyChar == '1') + { + Task.Run(ClientTest.RunAsync); } + else if (pressedKey.KeyChar == '2') + { + Task.Run(ServerTest.RunAsync); + } + else if (pressedKey.KeyChar == '3') + { + Task.Run(PerformanceTest.RunClientAndServer); + } + else if (pressedKey.KeyChar == '4') + { + Task.Run(ManagedClientTest.RunAsync); + } + else if (pressedKey.KeyChar == '5') + { + Task.Run(PublicBrokerTest.RunAsync); + } + else if (pressedKey.KeyChar == '6') + { + Task.Run(ServerAndClientTest.RunAsync); + } + else if (pressedKey.KeyChar == '7') + { + Task.Run(ClientFlowTest.RunAsync); + } + else if (pressedKey.KeyChar == '8') + { + PerformanceTest.RunClientOnly(); + return; + } + else if (pressedKey.KeyChar == '9') + { + ServerTest.RunEmptyServer(); + return; + } + else if (pressedKey.KeyChar == 'a') + { + Task.Run(PerformanceTest.RunQoS2Test); + } + else if (pressedKey.KeyChar == 'b') + { + Task.Run(PerformanceTest.RunQoS1Test); + } + else if (pressedKey.KeyChar == 'c') + { + Task.Run(PerformanceTest.RunQoS0Test); + } + else if (pressedKey.KeyChar == 'd') + { + Task.Run(ServerTest.RunEmptyServerWithLogging); + } + else if (pressedKey.KeyChar == 'e') + { + Task.Run(new MessageThroughputTest().Run); + } + else if (pressedKey.KeyChar == 'f') + { + Task.Run(new AsyncLockTest().Run); + } + + Thread.Sleep(Timeout.Infinite); } } \ No newline at end of file diff --git a/Source/MQTTnet.Tests/MQTTnet.Tests.csproj b/Source/MQTTnet.Tests/MQTTnet.Tests.csproj index 0aef64bbc..3cddeb211 100644 --- a/Source/MQTTnet.Tests/MQTTnet.Tests.csproj +++ b/Source/MQTTnet.Tests/MQTTnet.Tests.csproj @@ -1,7 +1,7 @@ - net6.0;net8.0 + net8.0 false false false diff --git a/Source/MQTTnet/Client/Options/MqttClientTlsOptions.cs b/Source/MQTTnet/Client/Options/MqttClientTlsOptions.cs index 4df8c7a2e..8a8fbb8e4 100644 --- a/Source/MQTTnet/Client/Options/MqttClientTlsOptions.cs +++ b/Source/MQTTnet/Client/Options/MqttClientTlsOptions.cs @@ -50,7 +50,5 @@ public sealed class MqttClientTlsOptions public SslProtocols SslProtocol { get; set; } = SslProtocols.Tls12 | SslProtocols.Tls13; -#if NET7_0_OR_GREATER - public X509Certificate2Collection TrustChain { get; set; } -#endif + public X509Certificate2Collection TrustChain { get; set; } } \ No newline at end of file diff --git a/Source/MQTTnet/Client/Options/MqttClientTlsOptionsBuilder.cs b/Source/MQTTnet/Client/Options/MqttClientTlsOptionsBuilder.cs index 204e94b66..265f2ab76 100644 --- a/Source/MQTTnet/Client/Options/MqttClientTlsOptionsBuilder.cs +++ b/Source/MQTTnet/Client/Options/MqttClientTlsOptionsBuilder.cs @@ -14,7 +14,7 @@ public sealed class MqttClientTlsOptionsBuilder { readonly MqttClientTlsOptions _tlsOptions = new() { - // If someone used this builder the change is very very high that TLS + // If someone used this builder the change is very high that TLS // should be actually used. UseTls = true }; @@ -140,11 +140,9 @@ public MqttClientTlsOptionsBuilder WithCipherSuitesPolicy(EncryptionPolicy encry return this; } -#if NET7_0_OR_GREATER - public MqttClientTlsOptionsBuilder WithTrustChain(X509Certificate2Collection chain) - { - _tlsOptions.TrustChain = chain; - return this; - } -#endif + public MqttClientTlsOptionsBuilder WithTrustChain(X509Certificate2Collection chain) + { + _tlsOptions.TrustChain = chain; + return this; + } } \ No newline at end of file diff --git a/Source/MQTTnet/Diagnostics/Runtime/TargetFrameworkProvider.cs b/Source/MQTTnet/Diagnostics/Runtime/TargetFrameworkProvider.cs deleted file mode 100644 index 38f2c2111..000000000 --- a/Source/MQTTnet/Diagnostics/Runtime/TargetFrameworkProvider.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace MQTTnet.Diagnostics; - -public static class TargetFrameworkProvider -{ - public static string TargetFramework - { - get - { -#if NET6_0 - return "net6.0"; -#elif NET8_0 - return "net8.0"; -#endif - } - } -} \ No newline at end of file diff --git a/Source/MQTTnet/Implementations/MqttTcpChannel.cs b/Source/MQTTnet/Implementations/MqttTcpChannel.cs index 8f3368479..1f1bbf85f 100644 --- a/Source/MQTTnet/Implementations/MqttTcpChannel.cs +++ b/Source/MQTTnet/Implementations/MqttTcpChannel.cs @@ -147,7 +147,6 @@ public async Task ConnectAsync(CancellationToken cancellationToken) AllowRenegotiation = _tcpOptions.TlsOptions.AllowRenegotiation }; -#if NET7_0_OR_GREATER if (_tcpOptions.TlsOptions.TrustChain?.Count > 0) { sslOptions.CertificateChainPolicy = new X509ChainPolicy @@ -159,7 +158,6 @@ public async Task ConnectAsync(CancellationToken cancellationToken) sslOptions.CertificateChainPolicy.CustomTrustStore.AddRange(_tcpOptions.TlsOptions.TrustChain); } -#endif await sslStream.AuthenticateAsClientAsync(sslOptions, cancellationToken).ConfigureAwait(false); } diff --git a/Source/MQTTnet/MQTTnet.csproj b/Source/MQTTnet/MQTTnet.csproj index 94b6528ca..fbc7e5fa1 100644 --- a/Source/MQTTnet/MQTTnet.csproj +++ b/Source/MQTTnet/MQTTnet.csproj @@ -10,7 +10,7 @@ - net6.0;net8.0 + net8.0 MQTTnet MQTTnet True