This commit is contained in:
snltty
2024-08-29 15:02:12 +08:00
parent ce1dc9d669
commit 688c758b5a
13 changed files with 98 additions and 22 deletions

View File

@@ -21,6 +21,7 @@ namespace linker.libs
public sealed class OperatingMultipleManager
{
private readonly ConcurrentDictionary<string, bool> dicOperating = new ConcurrentDictionary<string, bool>();
private readonly ConcurrentDictionary<uint, bool> dicOperating1 = new ConcurrentDictionary<uint, bool>();
public bool StartOperation(string key)
{
@@ -31,5 +32,13 @@ namespace linker.libs
dicOperating.TryRemove(key, out _);
}
public bool StartOperation(uint key)
{
return dicOperating1.TryAdd(key, true);
}
public void StopOperation(uint key)
{
dicOperating1.TryRemove(key, out _);
}
}
}

View File

@@ -5,5 +5,8 @@
<file name="favicon.ico" path="res\favicon.ico" comment="res\favicon.ico"/>
<file name="favicon1.ico" path="res\favicon1.ico" comment="res\favicon1.ico"/>
</folder>
<folder name="窗体文件" path="dlg" comment="目录" embed="true" local="false" ignored="false"/>
<folder name="窗体文件" path="dlg" comment="目录" embed="true" local="false" ignored="false">
<file name="net.aardio" path="net.aardio" comment="net.aardio"/>
<file name="full.aardio" path="full.aardio" comment="full.aardio"/>
</folder>
</project>

Binary file not shown.

View File

@@ -0,0 +1,16 @@
import win.ui;
/*DSG{{*/
var winform = win.form(text="linker 管理(专业)";right=859;bottom=699;border="thin";max=false;min=false;topmost=1)
winform.add()
/*}}*/
if(!_WIN10_LATER) import web.view.7; //兼容 Win7 以及之后版本,不支持新版 WebView2 的功能。
else import web.view;//支持 Win10 以及之后版本,导入这个就别导入前面的 web.view.7;
var wb = web.view(winform);
wb.enableDevTools(false);
wb.go("http://127.0.0.1:1804");
winform.show();
win.loopMessage();
return winform;

View File

@@ -1,11 +1,13 @@
import win.ui;
/*DSG{{*/
mainForm = win.form(text="linker tray";right=279;bottom=186;max=false)
mainForm = win.form(text="linker tray";right=279;bottom=212;max=false)
mainForm.add(
btnCheck={cls="button";text="检查安装";left=104;top=130;right=173;bottom=153;z=1};
btnInstall={cls="button";text="安装服务";left=95;top=23;right=183;bottom=65;z=2};
btnRun={cls="button";text="运行服务";left=95;top=74;right=183;bottom=113;z=3};
ckAutoStart={cls="checkbox";text="托盘自启动";left=189;top=160;right=269;bottom=177;z=4}
btnCheck={cls="button";text="检查安装";left=8;top=183;right=77;bottom=206;z=1};
btnInstall={cls="button";text="安装服务";left=99;top=23;right=187;bottom=65;z=2};
btnRun={cls="button";text="运行服务";left=99;top=74;right=187;bottom=113;z=3};
btnWebFull={cls="button";text="管理(专业)";left=152;top=135;right=224;bottom=164;z=6};
btnWebNet={cls="button";text="管理(简单)";left=66;top=135;right=138;bottom=164;z=5};
ckAutoStart={cls="checkbox";text="托盘自启动";left=187;top=186;right=273;bottom=203;z=4}
)
/*}}*/
@@ -92,15 +94,13 @@ mainForm.showPopmenu = function(){
});
}
mainForm.reStart = function()
{
mainForm.reStart = function(){
import process.popen;
var prcs = process.popen.cmd("start "+io._exefile+" --task=1");
win.quitMessage();
mainForm.close();
}
mainForm.failureService = function()
{
mainForm.failureService = function(){
import process.popen;
var prcs = process.popen.cmd("sc failure " + mainForm.serviceName +" reset= 0 actions= restart/3000/restart/3000/restart/3000")
prcs.readAll();
@@ -238,11 +238,19 @@ mainForm.runAsTaskCheck = function(){
mainForm.ckAutoStart.oncommand = function(id,event){
mainForm.runAsTask(mainForm.ckAutoStart.checked);
}
mainForm.runAsTaskCommand = function()
{
mainForm.runAsTaskCommand = function(){
mainForm.runAsTask(!mainForm.ckAutoStart.checked);
}
mainForm.btnWebNet.oncommand = function(id,event){
var netFrm = mainForm.loadForm("/net.aardio");
netFrm.show();
}
mainForm.btnWebFull.oncommand = function(id,event){
var fullFrm = mainForm.loadForm("/full.aardio");
fullFrm.show();
}
mainForm.checkService();
mainForm.showPopmenu();

View File

@@ -0,0 +1,16 @@
import win.ui;
/*DSG{{*/
var winform = win.form(text="linker 管理(简单)";right=359;bottom=599;border="thin";max=false;min=false;topmost=1)
winform.add()
/*}}*/
if(!_WIN10_LATER) import web.view.7; //兼容 Win7 以及之后版本,不支持新版 WebView2 的功能。
else import web.view;//支持 Win10 以及之后版本,导入这个就别导入前面的 web.view.7;
var wb = web.view(winform);
wb.enableDevTools(false);
wb.go("http://127.0.0.1:1804/#/net/index.html");
winform.show();
win.loopMessage();
return winform;

View File

@@ -46,6 +46,18 @@ export default {
}
</script>
<style lang="stylus" scoped>
@media screen and (max-width: 1000px) {
body .app-wrap{
border:0;
height:100%;
width 100%;
left:0; top:0;
right:0;
bottom:0;
transform:none;
max-width:100%;
}
}
.app-wrap{
box-sizing:border-box;
background-color:#fff;

View File

@@ -15,7 +15,7 @@
</div>
</dt>
<dd class="tuntap">
<TuntapShow @edit="handleTuntapEdit" :item="item"></TuntapShow>
<TuntapShow v-if="tuntap.list[item.MachineId]" @edit="handleTuntapEdit" :item="item"></TuntapShow>
</dd>
</dl>
</li>
@@ -24,7 +24,7 @@
</div>
<div class="page t-c">
<div class="page-wrap t-c">
<el-pagination small background layout="total,sizes,prev,pager, next" :pager-count="1" :total="devices.page.Count"
<el-pagination size="small" background layout="prev,pager, next" :pager-count="5" :total="devices.page.Count"
:page-size="devices.page.Request.Size" :current-page="devices.page.Request.Page"
@current-change="handlePageChange" @size-change="handlePageSizeChange" :page-sizes="[10, 20, 50, 100,255]" />
</div>

View File

@@ -92,9 +92,15 @@ namespace linker.plugins.client
try
{
if (LoggerHelper.Instance.LoggerLevel <= LoggerTypes.DEBUG)
LoggerHelper.Instance.Info($"connect to signin server :{config.Data.Client.Server}");
LoggerHelper.Instance.Info($"connect to signin server:{config.Data.Client.Server}");
IPEndPoint ip = NetworkHelper.GetEndPoint(config.Data.Client.Server, 1802);
if(ip == null)
{
if (LoggerHelper.Instance.LoggerLevel <= LoggerTypes.DEBUG)
LoggerHelper.Instance.Error($"get domain ip fail:{config.Data.Client.Server}");
return;
}
if (await ConnectServer(ip).ConfigureAwait(false) == false)
{

View File

@@ -578,6 +578,9 @@ namespace linker.plugins.messenger
userToken = null;
cancellationTokenSource?.Cancel();
bufferCache.Clear(true);
//var bytes = new byte[1024];
// while (SourceSocket.Receive(bytes) > 0) ;
}
public override void Disponse(int value = 0)
{

View File

@@ -183,6 +183,8 @@ namespace linker.plugins.relay.messenger
source.Cancel();
target.Cancel();
await Task.Delay(100);
source.TargetStream = target.SourceStream;
source.TargetSocket = target.SourceSocket;
source.TargetNetworkStream = target.SourceNetworkStream;

View File

@@ -84,6 +84,7 @@ namespace linker.plugins.relay.transport
connection.Disponse(7);
return null;
}
await Task.Delay(100).ConfigureAwait(false);
ClearSocket(socket);
SslStream sslStream = null;
@@ -141,7 +142,7 @@ namespace linker.plugins.relay.transport
Payload = MemoryPackSerializer.Serialize(relayInfo)
}).ConfigureAwait(false);
connection.Cancel();
await Task.Delay(30).ConfigureAwait(false);
await Task.Delay(100).ConfigureAwait(false);
ClearSocket(socket);
_ = WaitSSL(connection, socket, relayInfo).ContinueWith((result) =>
{

View File

@@ -103,21 +103,21 @@ namespace linker.plugins.tuntap.proxy
uint ip = BinaryPrimitives.ReadUInt32BigEndian(packet.DistIPAddress.Span[^4..]);
if (ipConnections.TryGetValue(ip, out ITunnelConnection connection) == false || connection == null || connection.Connected == false)
{
/*
if(operatingMultipleManager.StartOperation(ip) == false)
if (operatingMultipleManager.StartOperation(ip) == false)
{
return;
}
*/
//if (LoggerHelper.Instance.LoggerLevel <= LoggerTypes.DEBUG) LoggerHelper.Instance.Debug($"got packet to {packet.Dist} 1");
_ = ConnectTunnel(ip).ContinueWith((result,state) =>
_ = ConnectTunnel(ip).ContinueWith((result, state) =>
{
//operatingMultipleManager.StopOperation((uint)state);
operatingMultipleManager.StopOperation((uint)state);
if (result.Result != null)
{
ipConnections.AddOrUpdate((uint)state, result.Result, (a, b) => result.Result);
}
},ip);
}, ip);
return;
}
//if (LoggerHelper.Instance.LoggerLevel <= LoggerTypes.DEBUG) LoggerHelper.Instance.Debug($"got packet to {packet.Dist} 2")