Skip to content

Commit

Permalink
Take a lighter touch on forcing PreviewFeatures for QUIC (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuckow authored Apr 23, 2024
1 parent 0e839d0 commit 6432c5d
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<Optimize>true</Optimize>
<LangVersion>latest</LangVersion>
<OutputType>Exe</OutputType>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
<AssemblyName>Nethermind.$(MSBuildProjectName)</AssemblyName>
<RootNamespace>Nethermind.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
<AssemblyName>Nethermind.$(MSBuildProjectName)</AssemblyName>
<RootNamespace>Nethermind.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
</PropertyGroup>
Expand Down
4 changes: 3 additions & 1 deletion src/libp2p/Libp2p.Protocols.Quic/QuicProtocol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@
using System.Net.Quic;
using System.Net.Security;
using System.Net.Sockets;
using System.Runtime.Versioning;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
//using Nethermind.Libp2p.Protocols.Quic;

namespace Nethermind.Libp2p.Protocols;

#pragma warning disable CA1416 // Do not inform about platform compatibility
#pragma warning disable CA2252 // EnablePreviewFeatures is set in the project, but build still fails

/// <summary>
/// https://github.com/libp2p/specs/blob/master/quic/README.md
/// </summary>
[RequiresPreviewFeatures]
public class QuicProtocol : IProtocol
{
private readonly ILogger<QuicProtocol>? _logger;
Expand Down
1 change: 0 additions & 1 deletion src/libp2p/Libp2p/Libp2p.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<RootNamespace>Nethermind.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
<AssemblyName>Nethermind.$(MSBuildProjectName)</AssemblyName>
</PropertyGroup>

Expand Down
2 changes: 2 additions & 0 deletions src/libp2p/Libp2p/Libp2pPeerFactoryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
using Nethermind.Libp2p.Core;
using Nethermind.Libp2p.Protocols;
using Nethermind.Libp2p.Protocols.Pubsub;
using System.Runtime.Versioning;

namespace Nethermind.Libp2p.Stack;

[RequiresPreviewFeatures]
public class Libp2pPeerFactoryBuilder : PeerFactoryBuilderBase<Libp2pPeerFactoryBuilder, Libp2pPeerFactory>,
ILibp2pPeerFactoryBuilder
{
Expand Down
2 changes: 2 additions & 0 deletions src/libp2p/Libp2p/ServiceProviderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
using Microsoft.Extensions.DependencyInjection;
using Nethermind.Libp2p.Core;
using Nethermind.Libp2p.Protocols.Pubsub;
using System.Runtime.Versioning;

namespace Nethermind.Libp2p.Stack;

public static class ServiceProviderExtensions
{
[RequiresPreviewFeatures]
public static IServiceCollection AddLibp2p(this IServiceCollection services, Func<ILibp2pPeerFactoryBuilder, IPeerFactoryBuilder> factorySetup)
{
return services
Expand Down
1 change: 0 additions & 1 deletion src/samples/chat/Chat.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\libp2p\Libp2p.Core\Libp2p.Core.csproj" />
<ProjectReference Include="..\..\libp2p\Libp2p.Protocols.Identify\Libp2p.Protocols.Identify.csproj" />
<ProjectReference Include="..\..\libp2p\Libp2p.Protocols.IpTcp\Libp2p.Protocols.IpTcp.csproj" />
<ProjectReference Include="..\..\libp2p\Libp2p.Protocols.Multistream\Libp2p.Protocols.Multistream.csproj" />
Expand Down
9 changes: 9 additions & 0 deletions src/samples/chat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

```
$ ./Chat
[...]info: Chat[0] Listener started at /ip4/0.0.0.0/tcp/58641/p2p/ABCDEF
```

```
$ ./Chat -d /ip4/127.0.0.1/58641
```
4 changes: 0 additions & 4 deletions src/samples/perf-benchmarks/PerfBenchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BouncyCastle.Cryptography" Version="2.2.1" />
<PackageReference Include="Google.Protobuf" Version="3.25.1" />
<PackageReference Include="Google.Protobuf.Tools" Version="3.25.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\libp2p\Libp2p.Core\Libp2p.Core.csproj" />
<ProjectReference Include="..\..\libp2p\Libp2p.Protocols.Identify\Libp2p.Protocols.Identify.csproj" />
<ProjectReference Include="..\..\libp2p\Libp2p.Protocols.IpTcp\Libp2p.Protocols.IpTcp.csproj" />
<ProjectReference Include="..\..\libp2p\Libp2p.Protocols.Multistream\Libp2p.Protocols.Multistream.csproj" />
Expand Down
29 changes: 0 additions & 29 deletions src/samples/perf-benchmarks/PerfTesting.csproj

This file was deleted.

1 change: 0 additions & 1 deletion src/samples/pubsub-chat/PubsubChat.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\libp2p\Libp2p.Core\Libp2p.Core.csproj" />
<ProjectReference Include="..\..\libp2p\Libp2p.Protocols.MDns\Libp2p.Protocols.MDns.csproj" />
<ProjectReference Include="..\..\libp2p\Libp2p\Libp2p.csproj" />
</ItemGroup>
Expand Down

0 comments on commit 6432c5d

Please sign in to comment.