Skip to content

Commit

Permalink
.NET 9
Browse files Browse the repository at this point in the history
  • Loading branch information
Rans4ckeR committed Nov 13, 2024
1 parent ab11ad5 commit 720234d
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 88 deletions.
7 changes: 6 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 3 additions & 5 deletions CnCNet/Net/Tunnel/TunnelClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ internal sealed class TunnelClient

private long lastReceiveTick;

private SocketAddress? remoteSocketAddress;

public TunnelClient(int timeout, SocketAddress? remoteSocketAddress = null)
{
this.timeout = timeout;
Expand All @@ -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;
}
}

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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):

Expand Down Expand Up @@ -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
```

```
Expand Down
111 changes: 36 additions & 75 deletions cncnet-server.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<TargetFramework>net9.0</TargetFramework>
<OutputType>Exe</OutputType>
<Title>CnCNet Server</Title>
<Product>CnCNet RS Server</Product>
Expand Down Expand Up @@ -32,82 +32,43 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Diagnostics" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.Abstractions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Abstractions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.EventSource" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Primitives" Version="9.0.0" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />
<PackageReference Include="System.CommandLine.NamingConventionBinder" Version="2.0.0-beta4.22272.1" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework) == 'net9.0'">
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Diagnostics" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.Abstractions" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Abstractions" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Logging.EventSource" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="Microsoft.Extensions.Primitives" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="System.Diagnostics.EventLog" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="System.Text.Encodings.Web" Version="9.0.0-rc.1.24431.7" />
<PackageReference Include="System.Text.Json" Version="9.0.0-rc.1.24431.7" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework) == 'net8.0'">
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Diagnostics" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.EventSource" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Primitives" Version="8.0.0" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="8.0.1" />
<PackageReference Include="System.Diagnostics.EventLog" Version="8.0.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="8.0.0" />
<PackageReference Include="System.Text.Encodings.Web" Version="8.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="9.0.0" />
<PackageReference Include="System.Diagnostics.EventLog" Version="9.0.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="9.0.0" />
<PackageReference Include="System.Text.Encodings.Web" Version="9.0.0" />
<PackageReference Include="System.Text.Json" Version="9.0.0" />
</ItemGroup>
</Project>

0 comments on commit 720234d

Please sign in to comment.