Skip to content

Commit

Permalink
优化网卡
Browse files Browse the repository at this point in the history
  • Loading branch information
snltty committed Oct 1, 2024
1 parent 4066887 commit 14f3fa5
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 58 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }}
with:
tag_name: v1.4.6
release_name: v1.4.6.${{ steps.date.outputs.today }}
tag_name: v1.4.7
release_name: v1.4.7.${{ steps.date.outputs.today }}
draft: false
prerelease: false
body: "1. 增加网卡自动连接间隔\r\n2. 优化网卡,网络切换刷新局域网信息\r\n3. 当使用新分组后,如果设置了新IP,将会被记录,下次使用此分组时,自动启用此IP\r\n4. 当一个分组下所有的客户端都超过了7天未上线,则自动清理"
body: 1. 优化流量统计
- name: upload-win-x86-oss
id: upload-win-x86-oss
uses: tvrcgo/[email protected]
Expand All @@ -47,7 +47,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-win-x86.zip
target-path: /downloads/linker/v1.4.6/linker-win-x86.zip
target-path: /downloads/linker/v1.4.7/linker-win-x86.zip
- name: upload-win-x86
id: upload-win-x86
uses: actions/upload-release-asset@master
Expand All @@ -67,7 +67,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-win-x64.zip
target-path: /downloads/linker/v1.4.6/linker-win-x64.zip
target-path: /downloads/linker/v1.4.7/linker-win-x64.zip
- name: upload-win-x64
id: upload-win-x64
uses: actions/upload-release-asset@master
Expand All @@ -87,7 +87,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-win-arm64.zip
target-path: /downloads/linker/v1.4.6/linker-win-arm64.zip
target-path: /downloads/linker/v1.4.7/linker-win-arm64.zip
- name: upload-win-arm64
id: upload-win-arm64
uses: actions/upload-release-asset@master
Expand All @@ -107,7 +107,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-linux-x64.zip
target-path: /downloads/linker/v1.4.6/linker-linux-x64.zip
target-path: /downloads/linker/v1.4.7/linker-linux-x64.zip
- name: upload-linux-x64
id: upload-linux-x64
uses: actions/upload-release-asset@master
Expand All @@ -127,7 +127,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-linux-arm.zip
target-path: /downloads/linker/v1.4.6/linker-linux-arm.zip
target-path: /downloads/linker/v1.4.7/linker-linux-arm.zip
- name: upload-linux-arm
id: upload-linux-arm
uses: actions/upload-release-asset@master
Expand All @@ -147,7 +147,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-linux-arm64.zip
target-path: /downloads/linker/v1.4.6/linker-linux-arm64.zip
target-path: /downloads/linker/v1.4.7/linker-linux-arm64.zip
- name: upload-linux-arm64
id: upload-linux-arm64
uses: actions/upload-release-asset@master
Expand All @@ -167,7 +167,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-linux-musl-x64.zip
target-path: /downloads/linker/v1.4.6/linker-linux-musl-x64.zip
target-path: /downloads/linker/v1.4.7/linker-linux-musl-x64.zip
- name: upload-linux-musl-x64
id: upload-linux-musl-x64
uses: actions/upload-release-asset@master
Expand All @@ -187,7 +187,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-linux-musl-arm.zip
target-path: /downloads/linker/v1.4.6/linker-linux-musl-arm.zip
target-path: /downloads/linker/v1.4.7/linker-linux-musl-arm.zip
- name: upload-linux-musl-arm
id: upload-linux-musl-arm
uses: actions/upload-release-asset@master
Expand All @@ -207,7 +207,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-linux-musl-arm64.zip
target-path: /downloads/linker/v1.4.6/linker-linux-musl-arm64.zip
target-path: /downloads/linker/v1.4.7/linker-linux-musl-arm64.zip
- name: upload-linux-musl-arm64
id: upload-linux-musl-arm64
uses: actions/upload-release-asset@master
Expand All @@ -227,7 +227,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-osx-x64.zip
target-path: /downloads/linker/v1.4.6/linker-osx-x64.zip
target-path: /downloads/linker/v1.4.7/linker-osx-x64.zip
- name: upload-osx-x64
id: upload-osx-x64
uses: actions/upload-release-asset@master
Expand All @@ -247,7 +247,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-osx-arm64.zip
target-path: /downloads/linker/v1.4.6/linker-osx-arm64.zip
target-path: /downloads/linker/v1.4.7/linker-osx-arm64.zip
- name: upload-osx-arm64
id: upload-osx-arm64
uses: actions/upload-release-asset@master
Expand Down Expand Up @@ -277,7 +277,7 @@ jobs:
key-secret: ${{ secrets.ALIYUN_OSS_SECRET }}
bucket: ide-qbcode
asset-path: ./public/publish-zip/linker-windows-route.zip
target-path: /downloads/linker/v1.4.6/linker-windows-route.zip
target-path: /downloads/linker/v1.4.7/linker-windows-route.zip
- name: upload-windows-route
id: upload-windows-route
uses: actions/upload-release-asset@master
Expand Down
6 changes: 3 additions & 3 deletions linker.libs/linker.libs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<Copyright>snltty</Copyright>
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<Version>1.4.6</Version>
<AssemblyVersion>1.4.6</AssemblyVersion>
<FileVersion>1.4.6</FileVersion>
<Version>1.4.7</Version>
<AssemblyVersion>1.4.7</AssemblyVersion>
<FileVersion>1.4.7</FileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>full</DebugType>
Expand Down
6 changes: 3 additions & 3 deletions linker.tun/linker.tun.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<PackageReleaseNotes>linker tun</PackageReleaseNotes>
<Version>1.4.6</Version>
<AssemblyVersion>1.4.6</AssemblyVersion>
<FileVersion>1.4.6</FileVersion>
<Version>1.4.7</Version>
<AssemblyVersion>1.4.7</AssemblyVersion>
<FileVersion>1.4.7</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
6 changes: 3 additions & 3 deletions linker.tunnel/linker.tunnel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<PackageReleaseNotes>linker tunnel</PackageReleaseNotes>
<Version>1.4.6</Version>
<AssemblyVersion>1.4.6</AssemblyVersion>
<FileVersion>1.4.6</FileVersion>
<Version>1.4.7</Version>
<AssemblyVersion>1.4.7</AssemblyVersion>
<FileVersion>1.4.7</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
6 changes: 3 additions & 3 deletions linker.upnp/linker.upnp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<PackageReleaseNotes>linker upnp</PackageReleaseNotes>
<Version>1.4.6</Version>
<AssemblyVersion>1.4.6</AssemblyVersion>
<FileVersion>1.4.6</FileVersion>
<Version>1.4.7</Version>
<AssemblyVersion>1.4.7</AssemblyVersion>
<FileVersion>1.4.7</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
11 changes: 4 additions & 7 deletions linker/linker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,14 @@
<Title>linker</Title>
<Authors>snltty</Authors>
<Company>snltty</Company>
<Description>1. 增加网卡自动连接间隔
2. 优化网卡,网络切换刷新局域网信息
3. 当使用新分组后,如果设置了新IP,将会被记录,下次使用此分组时,自动启用此IP
4. 当一个分组下所有的客户端都超过了7天未上线,则自动清理</Description>
<Description>1. 优化流量统计</Description>
<Copyright>snltty</Copyright>
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<PackageReleaseNotes>linker</PackageReleaseNotes>
<Version>1.4.6</Version>
<AssemblyVersion>1.4.6</AssemblyVersion>
<FileVersion>1.4.6</FileVersion>
<Version>1.4.7</Version>
<AssemblyVersion>1.4.7</AssemblyVersion>
<FileVersion>1.4.7</FileVersion>
</PropertyGroup>


Expand Down
4 changes: 2 additions & 2 deletions linker/plugins/config/messenger/ConfigMessenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ await sender.ReplyOnly(new MessageResponseWrap
RequestId = requiestid,
Connection = connection,
Payload = MemoryPackSerializer.Serialize(results)
}).ConfigureAwait(false);
},(ushort)ConfigMessengerIds.AccessForward).ConfigureAwait(false);
});
}
}
Expand All @@ -78,7 +78,7 @@ await sender.ReplyOnly(new MessageResponseWrap
RequestId = requiestid,
Connection = connection,
Payload = result.Result.Data
}).ConfigureAwait(false);
}, (ushort)ConfigMessengerIds.AccessUpdateForward).ConfigureAwait(false);
});
}
}
Expand Down
6 changes: 3 additions & 3 deletions linker/plugins/forward/messenger/ForwardMessenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ await sender.ReplyOnly(new MessageResponseWrap
RequestId = requestid,
Connection = connection,
Payload = result.Result.Data
}).ConfigureAwait(false);
}, (ushort)ForwardMessengerIds.TestForward).ConfigureAwait(false);
}
});
}
Expand Down Expand Up @@ -70,7 +70,7 @@ await sender.ReplyOnly(new MessageResponseWrap
Code = MessageResponeCodes.OK,
Payload = result.Result.Data,
RequestId = requestid
}).ConfigureAwait(false);
}, (ushort)ForwardMessengerIds.GetForward).ConfigureAwait(false);
}
});
}
Expand Down Expand Up @@ -102,7 +102,7 @@ await sender.ReplyOnly(new MessageResponseWrap
RequestId = requestid,
Connection = connection,
Payload = MemoryPackSerializer.Serialize(result.Result)
}).ConfigureAwait(false);
}, (ushort)ForwardMessengerIds.Test).ConfigureAwait(false);
});
}

Expand Down
6 changes: 2 additions & 4 deletions linker/plugins/messenger/MessengerResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ public async Task Receive(IConnection connection, ReadOnlyMemory<byte> data, obj
MessageRequestWrap requestWrap = connection.ReceiveRequestWrap;
try
{

//回复的消息
if ((MessageTypes)(data.Span[0] & 0b0000_1111) == MessageTypes.RESPONSE)
{
Expand All @@ -203,7 +202,7 @@ public async Task Receive(IConnection connection, ReadOnlyMemory<byte> data, obj
Connection = connection,
Code = MessageResponeCodes.NOT_FOUND,
RequestId = requestWrap.RequestId
}).ConfigureAwait(false);
}, requestWrap.MessengerId).ConfigureAwait(false);
}
return;
}
Expand All @@ -220,13 +219,12 @@ public async Task Receive(IConnection connection, ReadOnlyMemory<byte> data, obj
//有需要回复的
if (requestWrap.Reply == true && connection.ResponseData.Length > 0)
{
messengerFlow.AddSendt(requestWrap.MessengerId, (ulong)connection.ResponseData.Length);
bool res = await messengerSender.ReplyOnly(new MessageResponseWrap
{
Connection = connection,
Payload = connection.ResponseData,
RequestId = requestWrap.RequestId
}).ConfigureAwait(false);
}, requestWrap.MessengerId).ConfigureAwait(false);
}
}
catch (Exception ex)
Expand Down
6 changes: 5 additions & 1 deletion linker/plugins/messenger/MessengerSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public async Task<bool> SendOnly(MessageRequestWrap msg)
/// </summary>
/// <param name="msg"></param>
/// <returns></returns>
public async ValueTask<bool> ReplyOnly(MessageResponseWrap msg)
public async ValueTask<bool> ReplyOnly(MessageResponseWrap msg,ushort messengerId)
{
if (msg.Connection == null)
{
Expand All @@ -111,7 +111,11 @@ public async ValueTask<bool> ReplyOnly(MessageResponseWrap msg)

try
{

byte[] bytes = msg.ToArray(out int length);

messengerFlow.AddSendt(messengerId, (ulong)length);

bool res = await msg.Connection.SendAsync(bytes.AsMemory(0, length)).ConfigureAwait(false);
msg.Return(bytes);
return res;
Expand Down
2 changes: 1 addition & 1 deletion linker/plugins/sforward/messenger/SForwardMessenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ await sender.ReplyOnly(new MessageResponseWrap
Code = MessageResponeCodes.OK,
Payload = result.Result.Data,
RequestId = requestid
}).ConfigureAwait(false);
}, (ushort)SForwardMessengerIds.GetForward).ConfigureAwait(false);
}
});
}
Expand Down
8 changes: 4 additions & 4 deletions linker/plugins/tunnel/messenger/TunnelMessenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ await messengerSender.ReplyOnly(new MessageResponseWrap
Code = MessageResponeCodes.ERROR,
Payload = Helper.EmptyArray,
RequestId = requestid
});
}, (ushort)TunnelMessengerIds.Info);
}
else
{
Expand All @@ -61,7 +61,7 @@ await messengerSender.ReplyOnly(new MessageResponseWrap
Code = MessageResponeCodes.OK,
Payload = MemoryPackSerializer.Serialize(result.Result),
RequestId = requestid
});
}, (ushort)TunnelMessengerIds.Info);
}
});
}
Expand Down Expand Up @@ -139,7 +139,7 @@ await messengerSender.ReplyOnly(new MessageResponseWrap
Connection = connection,
Payload = MemoryPackSerializer.Serialize(MemoryPackSerializer.Deserialize<TunnelTransportWanPortInfo>(result.Result.Data.Span)),
RequestId = requestid,
}).ConfigureAwait(false);
}, (ushort)TunnelMessengerIds.InfoForward).ConfigureAwait(false);
}
});
}
Expand Down Expand Up @@ -248,7 +248,7 @@ await messengerSender.ReplyOnly(new MessageResponseWrap
Connection = connection,
Payload = MemoryPackSerializer.Serialize(results),
RequestId = requestid,
}).ConfigureAwait(false);
}, (ushort)TunnelMessengerIds.ConfigForward).ConfigureAwait(false);
});
}
}
Expand Down
4 changes: 1 addition & 3 deletions linker/plugins/tuntap/messenger/TuntapMessenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ public void ConfigForward(IConnection connection)
}));
}



Task.WhenAll(tasks).ContinueWith(async (result) =>
{
List<TuntapInfo> results = tasks.Where(c => c.Result.Code == MessageResponeCodes.OK)
Expand All @@ -168,7 +166,7 @@ await messengerSender.ReplyOnly(new MessageResponseWrap
RequestId = requiestid,
Connection = connection,
Payload = MemoryPackSerializer.Serialize(results)
}).ConfigureAwait(false);
}, (ushort)TuntapMessengerIds.ConfigForward).ConfigureAwait(false);
});
}
}
Expand Down
9 changes: 3 additions & 6 deletions version.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
v1.4.6
2024-10-01 01:11:48
1. 增加网卡自动连接间隔
2. 优化网卡,网络切换刷新局域网信息
3. 当使用新分组后,如果设置了新IP,将会被记录,下次使用此分组时,自动启用此IP
4. 当一个分组下所有的客户端都超过了7天未上线,则自动清理
v1.4.7
2024-10-01 22:06:50
1. 优化流量统计

0 comments on commit 14f3fa5

Please sign in to comment.