From 720234d6d2ccdb2876d621aef588a3667355a8fb Mon Sep 17 00:00:00 2001 From: Rans4ckeR Date: Wed, 13 Nov 2024 19:58:23 +0100 Subject: [PATCH] .NET 9 --- .editorconfig | 7 +- .github/workflows/dotnet.yml | 6 +- .gitignore | 2 + CnCNet/Net/Tunnel/TunnelClient.cs | 8 +-- README.md | 8 +-- cncnet-server.csproj | 111 ++++++++++-------------------- 6 files changed, 54 insertions(+), 88 deletions(-) diff --git a/.editorconfig b/.editorconfig index 8040972..50850c2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -20,7 +20,7 @@ insert_final_newline = false # Organize usings dotnet_separate_import_directive_groups = false dotnet_sort_system_directives_first = true -file_header_template = unset +file_header_template = # this. and Me. preferences dotnet_style_qualification_for_event = false:warning @@ -410,6 +410,9 @@ csharp_prefer_system_threading_lock = true:warning dotnet_diagnostic.IDE0330.severity = warning dotnet_diagnostic.IDE0320.severity = warning +# ReSharper properties +resharper_braces_redundant = false + [*.{cs,vb}] dotnet_style_operator_placement_when_wrapping = beginning_of_line tab_width = 4 @@ -628,6 +631,8 @@ dotnet_diagnostic.MSTEST0029.severity = warning dotnet_diagnostic.MSTEST0026.severity = warning dotnet_diagnostic.MSTEST0030.severity = warning dotnet_diagnostic.MSTEST0031.severity = warning +dotnet_diagnostic.MSTEST0034.severity = warning +dotnet_diagnostic.MSTEST0035.severity = warning [*.vb] dotnet_diagnostic.CA1047.severity = warning \ No newline at end of file diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 00972bb..b58cfe0 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -40,7 +40,7 @@ jobs: matrix: os: [win, linux, osx] platform: [x64, arm64] - framework: [net9.0, net8.0] + framework: [net9.0] release: [Release, V2AndV3Release] steps: - name: Checkout @@ -50,8 +50,8 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@main with: - dotnet-version: ${{ matrix.framework == 'net9.0' && '9.x.x' || '8.x.x' }} - dotnet-quality: ${{ matrix.framework == 'net9.0' && 'preview' || 'ga' }} + dotnet-version: ${{ matrix.framework == 'net10.0' && '10.x.x' || '9.x.x' }} + dotnet-quality: ${{ matrix.framework == 'net10.0' && 'preview' || 'ga' }} - name: Publish run: dotnet publish -c ${{ matrix.release }} -f ${{ matrix.framework }} -r ${{ matrix.os }}-${{ matrix.platform }} --no-self-contained -p:PublishSingleFile=true -p:DebugType=embedded -p:TargetFrameworks=${{ matrix.framework }} -p:SatelliteResourceLanguages=en -p:AssemblyVersion=$env:GitVersion_AssemblySemVer -p:FileVersion=$env:GitVersion_AssemblySemFileVer -p:InformationalVersion=$env:GitVersion_InformationalVersion - name: Zip diff --git a/.gitignore b/.gitignore index 8dd4607..60b2ea0 100644 --- a/.gitignore +++ b/.gitignore @@ -82,6 +82,8 @@ StyleCopReport.xml *.pgc *.pgd *.rsp +# but not Directory.Build.rsp, as it configures directory-level build defaults +!Directory.Build.rsp *.sbr *.tlb *.tli diff --git a/CnCNet/Net/Tunnel/TunnelClient.cs b/CnCNet/Net/Tunnel/TunnelClient.cs index 0ad951c..6df7f26 100644 --- a/CnCNet/Net/Tunnel/TunnelClient.cs +++ b/CnCNet/Net/Tunnel/TunnelClient.cs @@ -6,8 +6,6 @@ internal sealed class TunnelClient private long lastReceiveTick; - private SocketAddress? remoteSocketAddress; - public TunnelClient(int timeout, SocketAddress? remoteSocketAddress = null) { this.timeout = timeout; @@ -18,12 +16,12 @@ public TunnelClient(int timeout, SocketAddress? remoteSocketAddress = null) public SocketAddress? RemoteSocketAddress { - get => remoteSocketAddress; + get; set { - remoteSocketAddress = value; - RemoteIpEndPoint = remoteSocketAddress is not null ? (IPEndPoint)new IPEndPoint(0, 0).Create(remoteSocketAddress) : null; + field = value; + RemoteIpEndPoint = field is not null ? (IPEndPoint)new IPEndPoint(0, 0).Create(field) : null; } } diff --git a/README.md b/README.md index 94e83b8..5eeb4bf 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # CnCNet Tunnel Server -* .NET8 +* .NET 9 * Cross platform (Windows, Linux, Mac, ...) * No admin privileges required to run * Supports CnCNet V2 & V3 tunnel protocol @@ -10,8 +10,8 @@ ## How to run/install -* The V3 version requires the [.NET Runtime 8](https://dotnet.microsoft.com/en-us/download/dotnet/8.0/runtime). -* The V3+V2 version additionally requires the [ASP.NET Core Runtime 8](https://dotnet.microsoft.com/en-us/download/dotnet/8.0/runtime). +* The V3 version requires the [.NET Runtime 9](https://dotnet.microsoft.com/en-us/download/dotnet/9.0/runtime). +* The V3+V2 version additionally requires the [ASP.NET Core Runtime 9](https://dotnet.microsoft.com/en-us/download/dotnet/9.0/runtime). Make sure these ports are open/forwarded to the machine (default ports): @@ -101,7 +101,7 @@ wget https://packages.microsoft.com/config/ubuntu/22.10/packages-microsoft-prod. sudo dpkg -i packages-microsoft-prod.deb rm packages-microsoft-prod.deb sudo apt-get update && \ - sudo apt-get install -y aspnetcore-runtime-8.0 + sudo apt-get install -y aspnetcore-runtime-9.0 ``` ``` diff --git a/cncnet-server.csproj b/cncnet-server.csproj index b0682cb..c4444dc 100644 --- a/cncnet-server.csproj +++ b/cncnet-server.csproj @@ -1,6 +1,6 @@  - net9.0;net8.0 + net9.0 Exe CnCNet Server CnCNet RS Server @@ -32,82 +32,43 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + \ No newline at end of file