mirror of
https://github.com/snltty/linker.git
synced 2025-12-19 01:46:46 +08:00
优化网卡
This commit is contained in:
2
.github/workflows/dotnet.yml
vendored
2
.github/workflows/dotnet.yml
vendored
@@ -37,7 +37,7 @@ jobs:
|
||||
release_name: v1.4.6.${{ steps.date.outputs.today }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
body: "1. 增加网卡自动连接间隔\r\n2. 优化网卡,网络切换刷新局域网信息\r\n3. 当使用新分组后,如果设置了新IP,将会被记录,下次使用此分组时,自动启用此IP\r\n4. 无感,但是略微优化了使用体验,建议更新"
|
||||
body: "1. 增加网卡自动连接间隔\r\n2. 优化网卡,网络切换刷新局域网信息\r\n3. 当使用新分组后,如果设置了新IP,将会被记录,下次使用此分组时,自动启用此IP\r\n4. 当一个分组下所有的客户端都超过了7天未上线,则自动清理"
|
||||
- name: upload-win-x86-oss
|
||||
id: upload-win-x86-oss
|
||||
uses: tvrcgo/oss-action@v0.1.1
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project ver="10" name="linker.tray.win" libEmbed="true" icon="..\linker\favicon.ico" ui="win" output="linker.tray.win.exe" CompanyName="snltty" FileDescription="linker.tray.win" LegalCopyright="Copyright (C) snltty 2024" ProductName="linker.tray.win" InternalName="linker.install.win" FileVersion="0.0.0.125" ProductVersion="0.0.0.125" publishDir="/dist/" dstrip="false" local="false" ignored="false">
|
||||
<project ver="10" name="linker.tray.win" libEmbed="true" icon="..\linker\favicon.ico" ui="win" output="linker.tray.win.exe" CompanyName="snltty" FileDescription="linker.tray.win" LegalCopyright="Copyright (C) snltty 2024" ProductName="linker.tray.win" InternalName="linker.install.win" FileVersion="0.0.0.127" ProductVersion="0.0.0.127" publishDir="/dist/" dstrip="false" local="false" ignored="false">
|
||||
<file name="main.aardio" path="main.aardio" comment="main.aardio"/>
|
||||
<folder name="资源文件" path="res" embed="true" local="false" ignored="false">
|
||||
<file name="favicon.ico" path="res\favicon.ico" comment="res\favicon.ico"/>
|
||||
|
||||
BIN
linker.tray.win/dist/linker.tray.win.exe
vendored
BIN
linker.tray.win/dist/linker.tray.win.exe
vendored
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>linker.web</title><script defer="defer" src="js/chunk-vendors.ac5be1e1.js"></script><script defer="defer" src="js/app.7e8b279c.js"></script><link href="css/chunk-vendors.d8267b33.css" rel="stylesheet"><link href="css/app.acc92c6f.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but linker.web doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
|
||||
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>linker.web</title><script defer="defer" src="js/chunk-vendors.ac5be1e1.js"></script><script defer="defer" src="js/app.59f241f7.js"></script><link href="css/chunk-vendors.d8267b33.css" rel="stylesheet"><link href="css/app.acc92c6f.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but linker.web doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
"use strict";(self["webpackChunklinker_web"]=self["webpackChunklinker_web"]||[]).push([[700],{9256:function(e,a,t){t.r(a),t.d(a,{default:function(){return M}});var n=t(6768);const l={class:"net-wrap app-wrap"},s={class:"inner absolute flex flex-column flex-nowrap"},r={class:"head"},i={class:"body flex-1 relative"},u={class:"status"};function c(e,a,t,c,d,o){const g=(0,n.g2)("Head"),p=(0,n.g2)("List"),v=(0,n.g2)("Status");return(0,n.uX)(),(0,n.CE)("div",l,[(0,n.Lk)("div",s,[(0,n.Lk)("div",r,[(0,n.bF)(g)]),(0,n.Lk)("div",i,[(0,n.bF)(p)]),(0,n.Lk)("div",u,[(0,n.bF)(v,{config:!1})])])])}t(4114);const d=e=>((0,n.Qi)("data-v-213d85ba"),e=e(),(0,n.jt)(),e),o={class:"head-wrap"},g={class:"tools flex"},p=d((()=>(0,n.Lk)("span",{class:"label"},"服务器 ",-1))),v=d((()=>(0,n.Lk)("span",{class:"flex-1"},null,-1))),h={style:{"margin-left":"1rem"}};function f(e,a,t,l,s,r){const i=(0,n.g2)("el-option"),u=(0,n.g2)("el-select"),c=(0,n.g2)("Refresh"),d=(0,n.g2)("el-icon"),f=(0,n.g2)("el-button"),k=(0,n.g2)("Background");return(0,n.uX)(),(0,n.CE)("div",o,[(0,n.Lk)("div",g,[p,(0,n.bF)(u,{modelValue:l.state.server,"onUpdate:modelValue":a[0]||(a[0]=e=>l.state.server=e),placeholder:"服务器",style:{width:"16rem"},size:"small"},{default:(0,n.k6)((()=>[((0,n.uX)(!0),(0,n.CE)(n.FK,null,(0,n.pI)(l.state.servers,(e=>((0,n.uX)(),(0,n.Wv)(i,{key:e.Host,label:e.Name,value:e.Host},null,8,["label","value"])))),128))])),_:1},8,["modelValue"]),v,(0,n.bF)(f,{size:"small",onClick:l.handleRefresh},{default:(0,n.k6)((()=>[(0,n.eW)(" 刷新(F5)"),(0,n.bF)(d,null,{default:(0,n.k6)((()=>[(0,n.bF)(c)])),_:1})])),_:1},8,["onClick"]),(0,n.Lk)("div",h,[(0,n.bF)(k,{name:"net"})])])])}var k=t(3830),m=t(144),b=t(7477),C=t(5096),L={components:{Edit:b.ffu,Refresh:b.C42,Background:C.A},setup(){const e=(0,k.B)(),a=(0,m.Kh)({server:"linker.snltty.com:1802",servers:[]});(0,n.wB)((()=>e.value.config.Client.Servers),(()=>{a.servers=(e.value.config.Client.Servers||[]).slice(0,1),a.server=e.value.config.Client.ServerInfo.Host}));const t=()=>{window.location.reload()};return{state:a,handleRefresh:t}}},w=t(1241);const S=(0,w.A)(L,[["render",f],["__scopeId","data-v-213d85ba"]]);var _=S;const F=e=>((0,n.Qi)("data-v-b6ab4f06"),e=e(),(0,n.jt)(),e),x={class:"net-list-wrap flex flex-column absolute"},z={class:"flex-1 scrollbar"},I={class:"flex"},E=F((()=>(0,n.Lk)("div",{class:"flex-1"},null,-1))),T={class:"tuntap"},A={class:"page t-c"},B={class:"page-wrap t-c"};function P(e,a,t,l,s,r){const i=(0,n.g2)("DeviceName"),u=(0,n.g2)("UpdaterBtn"),c=(0,n.g2)("TuntapShow"),d=(0,n.g2)("el-pagination");return(0,n.uX)(),(0,n.CE)("div",x,[(0,n.Lk)("div",z,[(0,n.Lk)("ul",null,[((0,n.uX)(!0),(0,n.CE)(n.FK,null,(0,n.pI)(l.devices.page.List,((e,a)=>((0,n.uX)(),(0,n.CE)("li",{key:a},[(0,n.Lk)("dl",null,[(0,n.Lk)("dt",I,[(0,n.Lk)("div",null,[(0,n.bF)(i,{item:e},null,8,["item"])]),E,(0,n.Lk)("div",null,[(0,n.bF)(u,{config:!1,item:e},null,8,["item"])])]),(0,n.Lk)("dd",T,[l.tuntap.list[e.MachineId]?((0,n.uX)(),(0,n.Wv)(c,{key:0,item:e},null,8,["item"])):(0,n.Q3)("",!0)])])])))),128))])]),(0,n.Lk)("div",A,[(0,n.Lk)("div",B,[(0,n.bF)(d,{size:"small",background:"",layout:"prev,pager, next","pager-count":5,total:l.devices.page.Count,"page-size":l.devices.page.Request.Size,"current-page":l.devices.page.Request.Page,onCurrentChange:l.handlePageChange,onSizeChange:l.handlePageSizeChange,"page-sizes":[10,20,50,100,255]},null,8,["total","page-size","current-page","onCurrentChange","onSizeChange"])])])])}var y=t(8104),X=t(7985),R=t(9383),D=t(2126),U=t(886),H=t(1198),N={components:{StarFilled:b.BQ2,UpdaterBtn:D.A,DeviceName:U.A,TuntapShow:H.A},setup(e){(0,k.B)();const a=(0,m.Kh)({}),{devices:t,machineId:l,_getSignList:s,_getSignList1:r,handleDeviceEdit:i,handlePageChange:u,handlePageSizeChange:c,handleDel:d,clearDevicesTimeout:o}=(0,X.r)(),{tuntap:g,_getTuntapInfo:p,handleTuntapRefresh:v,clearTuntapTimeout:h,handleTuntapEdit:f,sortTuntapIP:b}=(0,y.O)(),{_getUpdater:C,_subscribeUpdater:L,clearUpdaterTimeout:w}=(0,R.d)();return(0,n.sV)((()=>{u(),v(),s(),r(),p(),C(),L()})),(0,n.hi)((()=>{o(),h(),w()})),{state:a,devices:t,machineId:l,handlePageChange:u,handlePageSizeChange:c,tuntap:g}}};const V=(0,w.A)(N,[["render",P],["__scopeId","data-v-b6ab4f06"]]);var K=V,Q=t(3933),W=t(1387),j={components:{Head:_,List:K,Status:Q.A},setup(){document.addEventListener("contextmenu",(function(e){e.preventDefault()}));const e=(0,k.B)(),a=(0,W.rd)();return(0,n.sV)((()=>{0==e.value.hasAccess("NetManager")&&a.push({name:"NoPermission"})})),{}}};const q=(0,w.A)(j,[["render",c],["__scopeId","data-v-6a3f3b43"]]);var M=q}}]);
|
||||
"use strict";(self["webpackChunklinker_web"]=self["webpackChunklinker_web"]||[]).push([[340],{9256:function(e,a,t){t.r(a),t.d(a,{default:function(){return M}});var n=t(6768);const l={class:"net-wrap app-wrap"},s={class:"inner absolute flex flex-column flex-nowrap"},r={class:"head"},i={class:"body flex-1 relative"},u={class:"status"};function c(e,a,t,c,d,o){const g=(0,n.g2)("Head"),p=(0,n.g2)("List"),v=(0,n.g2)("Status");return(0,n.uX)(),(0,n.CE)("div",l,[(0,n.Lk)("div",s,[(0,n.Lk)("div",r,[(0,n.bF)(g)]),(0,n.Lk)("div",i,[(0,n.bF)(p)]),(0,n.Lk)("div",u,[(0,n.bF)(v,{config:!1})])])])}t(4114);const d=e=>((0,n.Qi)("data-v-213d85ba"),e=e(),(0,n.jt)(),e),o={class:"head-wrap"},g={class:"tools flex"},p=d((()=>(0,n.Lk)("span",{class:"label"},"服务器 ",-1))),v=d((()=>(0,n.Lk)("span",{class:"flex-1"},null,-1))),h={style:{"margin-left":"1rem"}};function f(e,a,t,l,s,r){const i=(0,n.g2)("el-option"),u=(0,n.g2)("el-select"),c=(0,n.g2)("Refresh"),d=(0,n.g2)("el-icon"),f=(0,n.g2)("el-button"),k=(0,n.g2)("Background");return(0,n.uX)(),(0,n.CE)("div",o,[(0,n.Lk)("div",g,[p,(0,n.bF)(u,{modelValue:l.state.server,"onUpdate:modelValue":a[0]||(a[0]=e=>l.state.server=e),placeholder:"服务器",style:{width:"16rem"},size:"small"},{default:(0,n.k6)((()=>[((0,n.uX)(!0),(0,n.CE)(n.FK,null,(0,n.pI)(l.state.servers,(e=>((0,n.uX)(),(0,n.Wv)(i,{key:e.Host,label:e.Name,value:e.Host},null,8,["label","value"])))),128))])),_:1},8,["modelValue"]),v,(0,n.bF)(f,{size:"small",onClick:l.handleRefresh},{default:(0,n.k6)((()=>[(0,n.eW)(" 刷新(F5)"),(0,n.bF)(d,null,{default:(0,n.k6)((()=>[(0,n.bF)(c)])),_:1})])),_:1},8,["onClick"]),(0,n.Lk)("div",h,[(0,n.bF)(k,{name:"net"})])])])}var k=t(3830),m=t(144),b=t(7477),C=t(5096),L={components:{Edit:b.ffu,Refresh:b.C42,Background:C.A},setup(){const e=(0,k.B)(),a=(0,m.Kh)({server:"linker.snltty.com:1802",servers:[]});(0,n.wB)((()=>e.value.config.Client.Servers),(()=>{a.servers=(e.value.config.Client.Servers||[]).slice(0,1),a.server=e.value.config.Client.ServerInfo.Host}));const t=()=>{window.location.reload()};return{state:a,handleRefresh:t}}},w=t(1241);const S=(0,w.A)(L,[["render",f],["__scopeId","data-v-213d85ba"]]);var _=S;const F=e=>((0,n.Qi)("data-v-b6ab4f06"),e=e(),(0,n.jt)(),e),x={class:"net-list-wrap flex flex-column absolute"},z={class:"flex-1 scrollbar"},I={class:"flex"},E=F((()=>(0,n.Lk)("div",{class:"flex-1"},null,-1))),T={class:"tuntap"},A={class:"page t-c"},B={class:"page-wrap t-c"};function P(e,a,t,l,s,r){const i=(0,n.g2)("DeviceName"),u=(0,n.g2)("UpdaterBtn"),c=(0,n.g2)("TuntapShow"),d=(0,n.g2)("el-pagination");return(0,n.uX)(),(0,n.CE)("div",x,[(0,n.Lk)("div",z,[(0,n.Lk)("ul",null,[((0,n.uX)(!0),(0,n.CE)(n.FK,null,(0,n.pI)(l.devices.page.List,((e,a)=>((0,n.uX)(),(0,n.CE)("li",{key:a},[(0,n.Lk)("dl",null,[(0,n.Lk)("dt",I,[(0,n.Lk)("div",null,[(0,n.bF)(i,{item:e},null,8,["item"])]),E,(0,n.Lk)("div",null,[(0,n.bF)(u,{config:!1,item:e},null,8,["item"])])]),(0,n.Lk)("dd",T,[l.tuntap.list[e.MachineId]?((0,n.uX)(),(0,n.Wv)(c,{key:0,item:e},null,8,["item"])):(0,n.Q3)("",!0)])])])))),128))])]),(0,n.Lk)("div",A,[(0,n.Lk)("div",B,[(0,n.bF)(d,{size:"small",background:"",layout:"prev,pager, next","pager-count":5,total:l.devices.page.Count,"page-size":l.devices.page.Request.Size,"current-page":l.devices.page.Request.Page,onCurrentChange:l.handlePageChange,onSizeChange:l.handlePageSizeChange,"page-sizes":[10,20,50,100,255]},null,8,["total","page-size","current-page","onCurrentChange","onSizeChange"])])])])}var y=t(8104),X=t(7985),R=t(9383),D=t(2126),U=t(886),H=t(1198),N={components:{StarFilled:b.BQ2,UpdaterBtn:D.A,DeviceName:U.A,TuntapShow:H.A},setup(e){(0,k.B)();const a=(0,m.Kh)({}),{devices:t,machineId:l,_getSignList:s,_getSignList1:r,handleDeviceEdit:i,handlePageChange:u,handlePageSizeChange:c,handleDel:d,clearDevicesTimeout:o}=(0,X.r)(),{tuntap:g,_getTuntapInfo:p,handleTuntapRefresh:v,clearTuntapTimeout:h,handleTuntapEdit:f,sortTuntapIP:b}=(0,y.O)(),{_getUpdater:C,_subscribeUpdater:L,clearUpdaterTimeout:w}=(0,R.d)();return(0,n.sV)((()=>{u(),v(),s(),r(),p(),C(),L()})),(0,n.hi)((()=>{o(),h(),w()})),{state:a,devices:t,machineId:l,handlePageChange:u,handlePageSizeChange:c,tuntap:g}}};const V=(0,w.A)(N,[["render",P],["__scopeId","data-v-b6ab4f06"]]);var K=V,Q=t(9762),W=t(1387),j={components:{Head:_,List:K,Status:Q.A},setup(){document.addEventListener("contextmenu",(function(e){e.preventDefault()}));const e=(0,k.B)(),a=(0,W.rd)();return(0,n.sV)((()=>{0==e.value.hasAccess("NetManager")&&a.push({name:"NoPermission"})})),{}}};const q=(0,w.A)(j,[["render",c],["__scopeId","data-v-6a3f3b43"]]);var M=q}}]);
|
||||
File diff suppressed because one or more lines are too long
1
linker.tray.win/web/js/937.b307288d.js
Normal file
1
linker.tray.win/web/js/937.b307288d.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<a v-if="config" href="javascript:;" title="linker服务端网速,点击查看详细信息" @click="handleShow">
|
||||
<p>在线 {{state.overallOnline}}</p>
|
||||
<p>上传 {{state.overallSendtSpeed}}/s</p>
|
||||
<p>下载 {{state.overallReceiveSpeed}}/s</p>
|
||||
</a>
|
||||
@@ -60,6 +61,7 @@ export default {
|
||||
timer:0,
|
||||
overallSendtSpeed: '0000.00KB',
|
||||
overallReceiveSpeed: '0000.00KB',
|
||||
overallOnline: '0/0',
|
||||
time:'',
|
||||
list:[],
|
||||
old:null,
|
||||
@@ -85,6 +87,11 @@ export default {
|
||||
getFlows().then(res => {
|
||||
const old = state.old || res;
|
||||
|
||||
if(res.Items['_']){
|
||||
state.overallOnline = `${res.Items['_'].SendtBytes}/${res.Items['_'].ReceiveBytes}`;
|
||||
delete res.Items['_'];
|
||||
}
|
||||
|
||||
let _receiveBytes = 0,_sendtBytes = 0,receiveBytes = 0,sendtBytes = 0;
|
||||
for(let j in old.Items){
|
||||
_receiveBytes+=old.Items[j].ReceiveBytes;
|
||||
@@ -156,7 +163,7 @@ export default {
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
a{
|
||||
font-weight:bold;position:absolute;right:1rem;bottom:90%;
|
||||
font-weight:bold;position:absolute;right:1rem;bottom:80%;
|
||||
border:1px solid #ddd;
|
||||
background-color:#fff;
|
||||
z-index :9
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<Description>1. 增加网卡自动连接间隔
|
||||
2. 优化网卡,网络切换刷新局域网信息
|
||||
3. 当使用新分组后,如果设置了新IP,将会被记录,下次使用此分组时,自动启用此IP
|
||||
4. 无感,但是略微优化了使用体验,建议更新</Description>
|
||||
4. 当一个分组下所有的客户端都超过了7天未上线,则自动清理</Description>
|
||||
<Copyright>snltty</Copyright>
|
||||
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using linker.plugins.messenger;
|
||||
using linker.plugins.relay;
|
||||
using linker.plugins.sforward.proxy;
|
||||
using linker.plugins.signin.messenger;
|
||||
using MemoryPack;
|
||||
|
||||
namespace linker.plugins.flow.messenger
|
||||
@@ -12,24 +13,31 @@ namespace linker.plugins.flow.messenger
|
||||
private readonly MessengerFlow messengerFlow;
|
||||
private readonly SForwardFlow sForwardFlow;
|
||||
private readonly RelayFlow relayFlow;
|
||||
private readonly SignCaching signCaching;
|
||||
|
||||
private DateTime start = DateTime.Now;
|
||||
|
||||
public FlowMessenger(MessengerResolver messengerResolver, FlowTransfer flowTransfer, MessengerFlow messengerFlow, SForwardFlow sForwardFlow, RelayFlow relayFlow)
|
||||
public FlowMessenger(MessengerResolver messengerResolver, FlowTransfer flowTransfer, MessengerFlow messengerFlow, SForwardFlow sForwardFlow, RelayFlow relayFlow, SignCaching signCaching)
|
||||
{
|
||||
this.messengerResolver = messengerResolver;
|
||||
this.flowTransfer = flowTransfer;
|
||||
this.messengerFlow = messengerFlow;
|
||||
this.sForwardFlow = sForwardFlow;
|
||||
this.relayFlow = relayFlow;
|
||||
this.signCaching = signCaching;
|
||||
}
|
||||
|
||||
[MessengerId((ushort)FlowMessengerIds.List)]
|
||||
public void List(IConnection connection)
|
||||
{
|
||||
Dictionary<string, FlowItemInfo> dic = flowTransfer.GetFlows();
|
||||
|
||||
signCaching.GetOnline(out int all, out int online);
|
||||
dic.TryAdd("_", new FlowItemInfo { FlowName = "_", ReceiveBytes = (ulong)all, SendtBytes = (ulong)online });
|
||||
|
||||
FlowInfo serverFlowInfo = new FlowInfo
|
||||
{
|
||||
Items = flowTransfer.GetFlows(),
|
||||
Items = dic,
|
||||
Start = start,
|
||||
Now = DateTime.Now,
|
||||
};
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Net;
|
||||
using System.Text.Json.Serialization;
|
||||
using linker.plugins.messenger;
|
||||
using linker.plugins.signIn.args;
|
||||
using linker.libs.extends;
|
||||
|
||||
namespace linker.plugins.signin.messenger
|
||||
{
|
||||
@@ -31,6 +30,7 @@ namespace linker.plugins.signin.messenger
|
||||
item.Connected = false;
|
||||
Clients.TryAdd(item.MachineId, item);
|
||||
}
|
||||
ClearTask();
|
||||
}
|
||||
|
||||
public async Task<string> Sign(SignInfo signInfo)
|
||||
@@ -53,7 +53,7 @@ namespace linker.plugins.signin.messenger
|
||||
//无限制,则挤压下线
|
||||
cache.Connection?.Disponse(9);
|
||||
|
||||
if(has == false)
|
||||
if (has == false)
|
||||
{
|
||||
cache.Id = new ObjectId(signInfo.MachineId);
|
||||
cache.MachineId = signInfo.MachineId;
|
||||
@@ -94,6 +94,12 @@ namespace linker.plugins.signin.messenger
|
||||
return Clients.TryGetValue(machineId, out SignCacheInfo cache) && cache.Connected;
|
||||
}
|
||||
|
||||
public void GetOnline(out int all, out int online)
|
||||
{
|
||||
all = Clients.Count;
|
||||
online = Clients.Values.Count(c => c.Connected);
|
||||
}
|
||||
|
||||
public bool TryRemove(string machineId, out SignCacheInfo cache)
|
||||
{
|
||||
if (Clients.TryRemove(machineId, out cache))
|
||||
@@ -103,8 +109,48 @@ namespace linker.plugins.signin.messenger
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private void ClearTask()
|
||||
{
|
||||
TimerHelper.SetInterval(() =>
|
||||
{
|
||||
if (LoggerHelper.Instance.LoggerLevel <= LoggerTypes.DEBUG)
|
||||
{
|
||||
LoggerHelper.Instance.Debug($"start cleaning up clients that have exceeded the 7-day timeout period");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
var groups = Clients.Values.GroupBy(c => c.GroupId)
|
||||
.Where(group => group.All(info => (now - info.LastSignIn).TotalMilliseconds > 7 * 24 * 60 * 60 * 1000))
|
||||
.Select(group => group.Key).ToList();
|
||||
|
||||
if (groups.Count > 0)
|
||||
{
|
||||
var items = Clients.Values.Where(c => groups.Contains(c.GroupId)).ToList();
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
Clients.TryRemove(item.MachineId, out _);
|
||||
liteCollection.Delete(item.Id);
|
||||
}
|
||||
dBfactory.Confirm();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LoggerHelper.Instance.Debug($"cleaning up clients error {ex}");
|
||||
}
|
||||
|
||||
return true;
|
||||
}, 5 * 60 * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[MemoryPackable]
|
||||
public sealed partial class SignCacheInfo
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
v1.4.6
|
||||
2024-09-30 12:00:09
|
||||
2024-09-30 16:36:28
|
||||
1. 增加网卡自动连接间隔
|
||||
2. 优化网卡,网络切换刷新局域网信息
|
||||
3. 当使用新分组后,如果设置了新IP,将会被记录,下次使用此分组时,自动启用此IP
|
||||
4. 无感,但是略微优化了使用体验,建议更新
|
||||
4. 当一个分组下所有的客户端都超过了7天未上线,则自动清理
|
||||
Reference in New Issue
Block a user