Skip to content

Commit

Permalink
升级net9.0;升级NetHandlerContext,支持ProxyProtocol之后直接设置Remote。
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Nov 17, 2024
1 parent 3018d99 commit 28c6b6f
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/publish-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
- uses: actions/checkout@v4
- name: Setup dotNET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.x
- name: Build
run: |
dotnet pack --version-suffix $(date "+%Y.%m%d-beta%H%M") -c Release -o out NewLife.MQTT/NewLife.MQTT.csproj
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup dotNET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
dotnet-version: 9.x
- name: Build
run: |
dotnet pack -c Release -o out NewLife.MQTT/NewLife.MQTT.csproj
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup dotNET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
dotnet-version: 9.x
- name: Build
run: |
dotnet build -c Release
Expand Down
6 changes: 3 additions & 3 deletions NewLife.MQTT/ProxyProtocol/ProxyCodec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class ProxyCodec : Handler
/// <returns></returns>
public override Object? Read(IHandlerContext context, Object message)
{
if (message is IPacket pk && context is NetHandlerContext ctx && ctx.Data is ReceivedEventArgs e)
if (message is IPacket pk && context is NetHandlerContext ctx)
{
var data = pk.GetSpan();
if (ProxyMessage.FastValidHeader(data))
Expand All @@ -30,7 +30,7 @@ public class ProxyCodec : Handler
ext["Proxy"] = msg;

// 修改远程地址
e.Remote = msg.GetClient().EndPoint;
ctx.Remote = msg.GetClient().EndPoint;
}

message = pk.Slice(rs);
Expand All @@ -50,7 +50,7 @@ public class ProxyCodec : Handler
ext["Proxy"] = msg;

// 修改远程地址
e.Remote = msg.Client!.EndPoint;
ctx.Remote = msg.Client!.EndPoint;
}

message = pk.Slice(rs);
Expand Down
6 changes: 3 additions & 3 deletions NewLife.MqttServer/NewLife.MqttServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net6.0;net8.0;net9.0</TargetFrameworks>
<AssemblyName>MqttServer</AssemblyName>
<Namespace>NewLife.MQTTServer</Namespace>
<AssemblyTitle>新生命MQTT服务器</AssemblyTitle>
Expand All @@ -16,13 +16,13 @@
<AssemblyVersion>$(VersionPrefix).*</AssemblyVersion>
<Deterministic>false</Deterministic>
<OutputPath>..\Bin\Server</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NewLife.Core" Version="11.0.2024.1115" />
<PackageReference Include="NewLife.Stardust" Version="3.2.2024.1113" />
<PackageReference Include="NewLife.Stardust" Version="3.2.2024.1117" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Test/Test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="Current">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Company>新生命开发团队</Company>
<Copyright>©2002-2022 NewLife</Copyright>
<VersionPrefix>1.0</VersionPrefix>
Expand Down
2 changes: 1 addition & 1 deletion XUnitTestClient/XUnitTestClient.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<OutputPath>..\Bin\UnitTest</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<IsPackable>false</IsPackable>
Expand Down

0 comments on commit 28c6b6f

Please sign in to comment.