mirror of
https://github.com/EasyTier/EasytierGame.git
synced 2026-09-20 11:22:37 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f2c800380 | ||
|
|
8b2ce406d8 | ||
|
|
10dde939cb | ||
|
|
84460409ed | ||
|
|
60faa01769 | ||
|
|
26f3f6fb36 | ||
|
|
494087820a | ||
|
|
87f4d98518 | ||
|
|
30a2c3430b | ||
|
|
aab8175ce3 | ||
|
|
136ce06c33 | ||
|
|
bdeda8bebd | ||
|
|
3ee09f7d60 | ||
|
|
7853d3b2f5 | ||
|
|
aacf47b6f5 | ||
|
|
d9b01fc754 | ||
|
|
844fba8462 |
@@ -20,5 +20,8 @@ export const getServerArgs = () => {
|
||||
if (!whiteList && mainStore.serverConfig.enableWhiteList) {
|
||||
args.push("--relay-network-whitelist");
|
||||
}
|
||||
if (mainStore.serverConfig.privateMode) {
|
||||
args.push("--private-mode", "true");
|
||||
}
|
||||
return args;
|
||||
};
|
||||
|
||||
+15
-4
@@ -22,7 +22,7 @@ async function toggleVisibility() {
|
||||
}
|
||||
}
|
||||
|
||||
export async function useTray(init: boolean = false, beforExit: Function, handleConnection: Function) {
|
||||
export async function useTray(init: boolean = false, beforExit: Function, handleConnection: Function, handleReconnect: Function) {
|
||||
let tray;
|
||||
try {
|
||||
tray = await TrayIcon.getById(DEFAULT_TRAY_NAME);
|
||||
@@ -31,7 +31,7 @@ export async function useTray(init: boolean = false, beforExit: Function, handle
|
||||
tooltip: `EasyTierGame\n${pkg.version}`,
|
||||
title: `EasyTierGame\n${pkg.version}`,
|
||||
id: DEFAULT_TRAY_NAME,
|
||||
menu: await Menu.new({ id: "main", items: await generateMenuItem(beforExit, handleConnection) }),
|
||||
menu: await Menu.new({ id: "main", items: await generateMenuItem(beforExit, handleConnection, handleReconnect) }),
|
||||
action: async e => {
|
||||
toggleVisibility();
|
||||
}
|
||||
@@ -45,16 +45,17 @@ export async function useTray(init: boolean = false, beforExit: Function, handle
|
||||
if (init) {
|
||||
tray.setTooltip(`EasyTierGame\n${pkg.version}`);
|
||||
tray.setShowMenuOnLeftClick(false);
|
||||
tray.setMenu(await Menu.new({ id: "main", items: await generateMenuItem(beforExit, handleConnection) }));
|
||||
tray.setMenu(await Menu.new({ id: "main", items: await generateMenuItem(beforExit, handleConnection, handleReconnect) }));
|
||||
}
|
||||
|
||||
return tray;
|
||||
}
|
||||
|
||||
export async function generateMenuItem(beforExit: Function, handleConnection: Function) {
|
||||
export async function generateMenuItem(beforExit: Function, handleConnection: Function, handleReconnect: Function) {
|
||||
return [
|
||||
await MenuItemShow("显示 / 隐藏"),
|
||||
await MenuItemExchangeConnection("联机 / 断开", handleConnection),
|
||||
await MenuItemReconnect("重新联机", handleReconnect),
|
||||
await MenuItemTheme(),
|
||||
await PredefinedMenuItem.new({ item: "Separator" }),
|
||||
await MenuItemPublicPeers(),
|
||||
@@ -63,6 +64,16 @@ export async function generateMenuItem(beforExit: Function, handleConnection: Fu
|
||||
];
|
||||
}
|
||||
|
||||
export async function MenuItemReconnect(text: string, handleReconnect: Function) {
|
||||
return await MenuItem.new({
|
||||
id: "reconnect",
|
||||
text,
|
||||
action: async () => {
|
||||
await handleReconnect();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export async function MenuItemExit(text: string, beforExit: Function) {
|
||||
return await MenuItem.new({
|
||||
id: "quit",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { type UnlistenFn } from "@tauri-apps/api/event";
|
||||
import { getCurrentWindow, PhysicalPosition, type WindowOptions, Window, currentMonitor } from "@tauri-apps/api/window";
|
||||
import { getCurrentWindow, PhysicalPosition, type WindowOptions, Window, currentMonitor, PhysicalSize } from "@tauri-apps/api/window";
|
||||
import { WebviewWindow } from "@tauri-apps/api/webviewWindow";
|
||||
import type { WebviewLabel, WebviewOptions } from "@tauri-apps/api/webview";
|
||||
import useMainStore from "@/stores/index";
|
||||
@@ -44,18 +44,21 @@ export default async (
|
||||
defaultOpts.parent = appWindow;
|
||||
// console.error(logicalPosition);
|
||||
if (defaultOpts.x == 0 && defaultOpts.y == 0) {
|
||||
const appSize = await appWindow.outerSize();
|
||||
const logicalAppSize = {
|
||||
width: 340,
|
||||
height: 305
|
||||
}
|
||||
const factor = await appWindow.scaleFactor();
|
||||
const appPosition = await appWindow.outerPosition();
|
||||
const logicalPosition = new PhysicalPosition(appPosition.x + appSize.width, appPosition.y).toLogical(factor);
|
||||
const logicalPosition = new PhysicalPosition(appPosition.x + Math.ceil((logicalAppSize.width + 5) * factor), appPosition.y).toLogical(factor);
|
||||
defaultOpts.x = logicalPosition.x;
|
||||
defaultOpts.y = logicalPosition.y;
|
||||
}
|
||||
}
|
||||
dialog = new WebviewWindow(label, { ...defaultOpts, ...options });
|
||||
await dealCloseListener(dialog, label, beforeCloseFunc);
|
||||
afterCreatedFunc && (await afterCreatedFunc(dialog, appWindow));
|
||||
await dialog.show();
|
||||
afterCreatedFunc && (await afterCreatedFunc(dialog, appWindow));
|
||||
} else {
|
||||
const visible = await dialog.isVisible();
|
||||
if (visible) {
|
||||
@@ -63,8 +66,8 @@ export default async (
|
||||
} else {
|
||||
const appWindow = getCurrentWindow();
|
||||
await dealCloseListener(dialog, label, beforeCloseFunc);
|
||||
afterCreatedFunc && (await afterCreatedFunc(dialog, appWindow));
|
||||
await dialog.show();
|
||||
afterCreatedFunc && (await afterCreatedFunc(dialog, appWindow));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+7
-7
@@ -3,7 +3,7 @@
|
||||
"private": true,
|
||||
"author": "leizi97",
|
||||
"description": "A simple network initiator based on Easytier",
|
||||
"version": "1.4.5",
|
||||
"version": "1.4.7",
|
||||
"scripts": {
|
||||
"dev": "nuxt dev --dotenv env/.env.dev --host 0.0.0.0",
|
||||
"build": "nuxt generate --dotenv env/.env.prod",
|
||||
@@ -12,9 +12,9 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@element-plus/icons-vue": "^2.3.1",
|
||||
"@element-plus/nuxt": "1.1.2",
|
||||
"@element-plus/nuxt": "1.1.3",
|
||||
"@nuxtjs/tailwindcss": "6.13.2",
|
||||
"@pinia/nuxt": "0.11.0",
|
||||
"@pinia/nuxt": "0.11.1",
|
||||
"@tauri-apps/api": "2.5.0",
|
||||
"@tauri-apps/cli": "2.5.0",
|
||||
"@tauri-apps/plugin-cli": "^2.2.0",
|
||||
@@ -28,14 +28,14 @@
|
||||
"@vitejs/plugin-vue-jsx": "4.1.2",
|
||||
"@vueuse/core": "12.7.0",
|
||||
"archiver": "^7.0.1",
|
||||
"element-plus": "2.9.11",
|
||||
"element-plus": "2.10.2",
|
||||
"less": "4.2.1",
|
||||
"lodash-es": "^4.17.21",
|
||||
"nuxt": "3.17.4",
|
||||
"pinia": "3.0.2",
|
||||
"nuxt": "3.17.5",
|
||||
"pinia": "3.0.3",
|
||||
"pinia-plugin-persistedstate": "4.3.0",
|
||||
"postcss": "^8.4.38",
|
||||
"prettier": "3.5.2",
|
||||
"prettier-plugin-tailwindcss": "0.6.11"
|
||||
"prettier-plugin-tailwindcss": "0.6.13"
|
||||
}
|
||||
}
|
||||
|
||||
+55
-4
@@ -44,19 +44,43 @@
|
||||
</ElTooltip>
|
||||
</div>
|
||||
<div class="flex flex-nowrap items-center gap-[5px]">
|
||||
<ElCheckbox v-model="mainStore.config.enableKcpProxy">启用KCP代理</ElCheckbox>
|
||||
<ElTooltip content="将TCP流量转为KCP流量,降低传输延迟,提升传输速度">
|
||||
<ElCheckbox
|
||||
@change="handleKcpProxyChange"
|
||||
v-model="mainStore.config.enableKcpProxy"
|
||||
>
|
||||
启用KCP代理
|
||||
</ElCheckbox>
|
||||
<ElTooltip content="(不可与QUIC代理同时开启)将TCP流量转为KCP流量,降低传输延迟,提升传输速度">
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
<CoreVersionWarning version="2.2.0" />
|
||||
</div>
|
||||
<div class="flex flex-nowrap items-center gap-[5px]">
|
||||
<ElCheckbox v-model="mainStore.config.disableKcpInput">禁用KCP输入</ElCheckbox>
|
||||
<ElTooltip content="禁用KCP入站流量,其他开启KCP代理的节点无法连接到本节点">
|
||||
<ElTooltip content="不允许其他节点使用 KCP 代理 TCP 流到此节点。开启 KCP 代理的节点访问此节点时,依然使用原始 TCP 连接">
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
<CoreVersionWarning version="2.2.0" />
|
||||
</div>
|
||||
<div class="flex flex-nowrap items-center gap-[5px]">
|
||||
<ElCheckbox
|
||||
@change="handleQuicProxyChange"
|
||||
v-model="mainStore.config.enableQuicProxy"
|
||||
>
|
||||
启用QUIC代理
|
||||
</ElCheckbox>
|
||||
<ElTooltip content="(不可与KCP代理同时开启)使用 QUIC 代理 TCP 流,提高在 UDP 丢包网络上的延迟和吞吐量">
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
<CoreVersionWarning version="2.3.2" />
|
||||
</div>
|
||||
<div class="flex flex-nowrap items-center gap-[5px]">
|
||||
<ElCheckbox v-model="mainStore.config.disableQuicInput">禁用QUIC输入</ElCheckbox>
|
||||
<ElTooltip content="不允许其他节点使用 QUIC 代理 TCP 流到此节点。开启 QUIC 代理的节点访问此节点时,依然使用原始 TCP 连接">
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
<CoreVersionWarning version="2.3.2" />
|
||||
</div>
|
||||
<div><ElCheckbox v-model="mainStore.config.disableUdpHolePunching">禁用UDP打洞功能</ElCheckbox></div>
|
||||
<div><ElCheckbox v-model="mainStore.config.disableIpv6">不使用IPv6</ElCheckbox></div>
|
||||
<div class="flex flex-nowrap items-center gap-[5px]">
|
||||
@@ -66,6 +90,13 @@
|
||||
</ElTooltip>
|
||||
<CoreVersionWarning version="2.3.0" />
|
||||
</div>
|
||||
<div class="flex flex-nowrap items-center gap-[5px]">
|
||||
<ElCheckbox v-model="mainStore.config.privateMode">启用私有模式</ElCheckbox>
|
||||
<ElTooltip content="启用后,不允许使用了与本网络不同的房间名和密码的节点通过本节点进行握手或中转">
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
<CoreVersionWarning version="2.3.1" />
|
||||
</div>
|
||||
<ElDivider />
|
||||
<div class="flex items-center gap-[10px]">
|
||||
<ElCheckbox v-model="mainStore.config.disbleListenner">不监听任何端口,只连接到对等节点</ElCheckbox>
|
||||
@@ -146,7 +177,9 @@
|
||||
配置
|
||||
</ElButton>
|
||||
</ElTooltip>
|
||||
<ElTooltip content="将本地端口转发到虚拟网络中的远程端口.如:udp://0.0.0.0:12345/10.126.126.1:23456,表示将本地UDP端口12345转发到虚拟网络中的10.126.126.1:23456.可以指定多个">
|
||||
<ElTooltip
|
||||
content="将本地端口转发到虚拟网络中的远程端口.如:udp://0.0.0.0:12345/10.126.126.1:23456,表示将本地UDP端口12345转发到虚拟网络中的10.126.126.1:23456.可以指定多个"
|
||||
>
|
||||
<ElIcon><QuestionFilled /></ElIcon>
|
||||
</ElTooltip>
|
||||
<CoreVersionWarning version="2.3.0" />
|
||||
@@ -379,6 +412,24 @@
|
||||
}
|
||||
};
|
||||
|
||||
const handleKcpProxyChange = () => {
|
||||
if (mainStore.config.enableKcpProxy) {
|
||||
if (mainStore.config.enableQuicProxy) {
|
||||
ElMessage.warning("KCP代理和QUIC代理不能同时开启");
|
||||
}
|
||||
mainStore.config.enableQuicProxy = false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleQuicProxyChange = () => {
|
||||
if (mainStore.config.enableQuicProxy) {
|
||||
if (mainStore.config.enableKcpProxy) {
|
||||
ElMessage.warning("KCP代理和QUIC代理不能同时开启");
|
||||
}
|
||||
mainStore.config.enableKcpProxy = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 为bind_device功能增加改方法
|
||||
const getGuids = async () => {
|
||||
const guidsValue = await invoke<string[][]>("get_network_adapter_guids");
|
||||
|
||||
+104
-35
@@ -272,21 +272,6 @@
|
||||
{{ !data.isStart ? "启动联机" : "停止联机" }}
|
||||
<template #dropdown>
|
||||
<ElDropdownMenu>
|
||||
<ElDropdownItem
|
||||
command="import_config"
|
||||
:icon="Link"
|
||||
>
|
||||
导入联机配置
|
||||
</ElDropdownItem>
|
||||
<ElDropdownItem
|
||||
command="share_config"
|
||||
:icon="Share"
|
||||
>
|
||||
分享联机配置
|
||||
</ElDropdownItem>
|
||||
<ElDropdownItem disabled>
|
||||
<ElDivider class="!m-0 !h-[2px]" />
|
||||
</ElDropdownItem>
|
||||
<ElDropdownItem
|
||||
:icon="SetUp"
|
||||
command="create_server"
|
||||
@@ -328,6 +313,27 @@
|
||||
>
|
||||
本地游戏列表
|
||||
</ElDropdownItem>
|
||||
<ElDropdownItem disabled>
|
||||
<ElDivider class="!m-0 !h-[2px]" />
|
||||
</ElDropdownItem>
|
||||
<ElDropdownItem
|
||||
command="import_config"
|
||||
:icon="Link"
|
||||
>
|
||||
导入联机配置
|
||||
</ElDropdownItem>
|
||||
<ElDropdownItem
|
||||
command="share_config"
|
||||
:icon="Share"
|
||||
>
|
||||
分享联机配置
|
||||
</ElDropdownItem>
|
||||
<ElDropdownItem
|
||||
command="reconnect"
|
||||
:icon="RefreshRight"
|
||||
>
|
||||
重新联机
|
||||
</ElDropdownItem>
|
||||
</ElDropdownMenu>
|
||||
</template>
|
||||
</ElDropdown>
|
||||
@@ -720,7 +726,7 @@
|
||||
import { initStartWinIpBroadcast } from "~/composables/netcard";
|
||||
import useMainStore from "@/stores/index";
|
||||
import { ElMessage, ElMessageBox, ElTooltip } from "element-plus";
|
||||
import { getCurrentWindow, type Window } from "@tauri-apps/api/window";
|
||||
import { getCurrentWindow, PhysicalSize, type Window } from "@tauri-apps/api/window";
|
||||
import { getAllWebviewWindows, WebviewWindow } from "@tauri-apps/api/webviewWindow";
|
||||
import etWindows, { dataSubscribe } from "@/composables/windows";
|
||||
import { resourceDir as getResourceDir, join } from "@tauri-apps/api/path";
|
||||
@@ -746,6 +752,9 @@
|
||||
async () => {
|
||||
await handleConnection();
|
||||
return data.isStart;
|
||||
},
|
||||
async () => {
|
||||
await handleReconnect();
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1085,8 +1094,8 @@
|
||||
const list = await invoke<string[][][]>("fetch_easytier_list");
|
||||
data.releaseList = [
|
||||
...list.flat().filter(el => {
|
||||
// console.log(el, el[0], el[2]);
|
||||
return el && el[0] && el[2] && !el[2].includes("gui");
|
||||
// console.log(el, el[0], el[2], el[3]); // el[3] 是prerelease bool值
|
||||
return el && el[0] && el[2] && !el[2].includes("gui") && (el[3] != 'true' || !el[3]);
|
||||
})
|
||||
] as any;
|
||||
coreManagementData.loading = false;
|
||||
@@ -1174,6 +1183,10 @@
|
||||
saveServerUrl = mainStore.basePeers.length > 0 ? mainStore.basePeers[0] || "" : "";
|
||||
}
|
||||
data.configJsonSeverUrl = guiJson.serverUrl;
|
||||
if(guiJson.enableKcpProxy && guiJson.enableQuicProxy) {
|
||||
// 如果同时开启kcp代理和quic代理,则禁用quic代理
|
||||
guiJson.enableQuicProxy = false;
|
||||
}
|
||||
mainStore.$patch({
|
||||
config: {
|
||||
...mainStore.config,
|
||||
@@ -1224,6 +1237,18 @@
|
||||
await appWindow.show();
|
||||
await appWindow.setFocus();
|
||||
}
|
||||
const appWindow = getCurrentWindow();
|
||||
const logicalAppSize = {
|
||||
width: 340,
|
||||
height: 305
|
||||
}
|
||||
const scaleFactor = await appWindow.scaleFactor();
|
||||
const size = new PhysicalSize(Math.ceil(logicalAppSize.width * scaleFactor), Math.ceil(logicalAppSize.height * scaleFactor));
|
||||
appWindow.setSize(size);
|
||||
appWindow.onScaleChanged(({ payload: { scaleFactor } }) => {
|
||||
console.log("scaleFactor", scaleFactor);
|
||||
appWindow.setSize(new PhysicalSize(Math.ceil(logicalAppSize.width * scaleFactor), Math.ceil(logicalAppSize.height * scaleFactor)));
|
||||
});
|
||||
};
|
||||
|
||||
let logsTimer: NodeJS.Timeout | null = null;
|
||||
@@ -1234,7 +1259,7 @@
|
||||
await initGuiJson();
|
||||
await compatibleInitAutoStart();
|
||||
// await initAutoStart();
|
||||
await initStartWinIpBroadcast();
|
||||
// await initStartWinIpBroadcast(); // 对于三层tun而言,winipbroadcast没有作用,先禁用
|
||||
await compatibleIpv6Listener();
|
||||
await getCoreVersion();
|
||||
await listenObj.listenThreadId();
|
||||
@@ -1400,10 +1425,16 @@
|
||||
args.push("--compression", mainStore.config.compression);
|
||||
}
|
||||
if (mainStore.config.enableKcpProxy) {
|
||||
args.push("--enable-kcp-proxy");
|
||||
args.push("--enable-kcp-proxy", 'true');
|
||||
}
|
||||
if (mainStore.config.disableKcpInput) {
|
||||
args.push("--disable-kcp-input");
|
||||
args.push("--disable-kcp-input", 'true');
|
||||
}
|
||||
if (mainStore.config.enableQuicProxy) {
|
||||
args.push("--enable-quic-proxy", 'true');
|
||||
}
|
||||
if (mainStore.config.disableQuicInput) {
|
||||
args.push("--disable-quic-input", 'true');
|
||||
}
|
||||
if (mainStore.config.bindDeviceEnable) {
|
||||
args.push("--bind-device", "true");
|
||||
@@ -1412,7 +1443,7 @@
|
||||
args.push("--proxy-forward-by-system");
|
||||
}
|
||||
if (mainStore.config.acceptDNS) {
|
||||
args.push("--accept-dns");
|
||||
args.push("--accept-dns", "true");
|
||||
}
|
||||
if (mainStore.config.enablePortForward) {
|
||||
let formatPortForward = mainStore.config.portForwardData.trim().split("\n");
|
||||
@@ -1423,6 +1454,9 @@
|
||||
});
|
||||
}
|
||||
}
|
||||
if (mainStore.config.privateMode) {
|
||||
args.push("--private-mode", "true");
|
||||
}
|
||||
return args;
|
||||
};
|
||||
|
||||
@@ -1531,7 +1565,10 @@
|
||||
compression,
|
||||
enablePreventSleep,
|
||||
enableKcpProxy,
|
||||
disableKcpInput
|
||||
disableKcpInput,
|
||||
enableQuicProxy,
|
||||
disableQuicInput,
|
||||
privateMode
|
||||
} = mainStore.config;
|
||||
const WT = btoa(
|
||||
encodeURIComponent(
|
||||
@@ -1564,7 +1601,10 @@
|
||||
compression,
|
||||
enablePreventSleep,
|
||||
enableKcpProxy,
|
||||
disableKcpInput
|
||||
disableKcpInput,
|
||||
enableQuicProxy,
|
||||
disableQuicInput,
|
||||
privateMode
|
||||
}
|
||||
})
|
||||
)
|
||||
@@ -1683,6 +1723,25 @@
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (command === "reconnect") {
|
||||
handleReconnect();
|
||||
}
|
||||
};
|
||||
|
||||
const handleReconnect = async () => {
|
||||
if (data.isStart) {
|
||||
ElMessage.info({
|
||||
message: "正在重新联机...",
|
||||
duration: 2200
|
||||
});
|
||||
await handleConnection();
|
||||
setTimeout(() => {
|
||||
handleConnection();
|
||||
}, 2000);
|
||||
} else {
|
||||
handleConnection();
|
||||
}
|
||||
};
|
||||
|
||||
const handleDeleteAdminConfig = async () => {
|
||||
@@ -1921,16 +1980,26 @@
|
||||
};
|
||||
|
||||
const storageDialog = async () => {
|
||||
await etWindows("storage-listener", {
|
||||
title: "自建服务器",
|
||||
minWidth: 1,
|
||||
minHeight: 1,
|
||||
width: 1,
|
||||
height: 1,
|
||||
x: 9999,
|
||||
y: 9999,
|
||||
resizable: false,
|
||||
url: "#/storage-listener"
|
||||
});
|
||||
await etWindows(
|
||||
"storage-listener",
|
||||
{
|
||||
title: "存储监听",
|
||||
minWidth: 0,
|
||||
minHeight: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
x: 9999,
|
||||
y: 9999,
|
||||
resizable: false,
|
||||
transparent: true,
|
||||
hiddenTitle: true,
|
||||
alwaysOnBottom: true,
|
||||
visible: false,
|
||||
url: "#/storage-listener"
|
||||
},
|
||||
dialog => {
|
||||
dialog.hide();
|
||||
}
|
||||
);
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -48,6 +48,8 @@
|
||||
width="120"
|
||||
prop="ipv4"
|
||||
label="虚拟网IP"
|
||||
:sort-method="sortIpv4"
|
||||
:sort-orders="['ascending', 'descending', null]"
|
||||
></ElTableColumn>
|
||||
<ElTableColumn
|
||||
sortable
|
||||
@@ -98,11 +100,15 @@
|
||||
width="90"
|
||||
prop="rx_bytes"
|
||||
label="接收"
|
||||
:sort-method="sortBytes"
|
||||
:sort-orders="['ascending', 'descending', null]"
|
||||
></ElTableColumn>
|
||||
<ElTableColumn
|
||||
sortable
|
||||
prop="tx_bytes"
|
||||
label="传输"
|
||||
:sort-method="(a, b) => sortBytes(a, b, 'tx_bytes')"
|
||||
:sort-orders="['ascending', 'descending', null]"
|
||||
></ElTableColumn>
|
||||
</ElTable>
|
||||
</div>
|
||||
@@ -173,6 +179,101 @@
|
||||
return valueA - valueB;
|
||||
};
|
||||
|
||||
// IP地址排序函数
|
||||
const sortIpv4 = (a: any, b: any): number => {
|
||||
const ipToNumber = (ip: string): number => {
|
||||
if (!ip || ip === "-" || ip === "") {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 处理可能包含端口号或子网掩码的情况
|
||||
const cleanIp = ip.split("/")[0].split(":")[0];
|
||||
const parts = cleanIp.split(".");
|
||||
|
||||
if (parts.length !== 4) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
try {
|
||||
const nums = parts.map(part => {
|
||||
const num = parseInt(part, 10);
|
||||
return isNaN(num) || num < 0 || num > 255 ? 0 : num;
|
||||
});
|
||||
|
||||
// 将IP地址转换为32位数字进行比较
|
||||
return (nums[0] << 24) + (nums[1] << 16) + (nums[2] << 8) + nums[3];
|
||||
} catch {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
const numA = ipToNumber(a.ipv4);
|
||||
const numB = ipToNumber(b.ipv4);
|
||||
|
||||
return numA - numB;
|
||||
};
|
||||
|
||||
// 字节数据排序函数
|
||||
const sortBytes = (a: any, b: any, field: string = 'rx_bytes'): number => {
|
||||
const parseBytes = (bytesStr: string): number => {
|
||||
if (!bytesStr || bytesStr === "-" || bytesStr === "") {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 统一转换为小写并去除空格
|
||||
const cleanStr = bytesStr.toLowerCase().trim();
|
||||
|
||||
// 使用正则表达式匹配数字和单位
|
||||
const match = cleanStr.match(/^(\d+(?:\.\d+)?)\s*([a-z]*)$/);
|
||||
if (!match) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const value = parseFloat(match[1]);
|
||||
const unit = match[2];
|
||||
|
||||
if (isNaN(value)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 根据单位转换为字节数
|
||||
switch (unit) {
|
||||
case 'b':
|
||||
case 'byte':
|
||||
case 'bytes':
|
||||
case '':
|
||||
return value;
|
||||
case 'k':
|
||||
case 'kb':
|
||||
case 'kib':
|
||||
return value * 1024;
|
||||
case 'm':
|
||||
case 'mb':
|
||||
case 'mib':
|
||||
return value * 1024 * 1024;
|
||||
case 'g':
|
||||
case 'gb':
|
||||
case 'gib':
|
||||
return value * 1024 * 1024 * 1024;
|
||||
case 't':
|
||||
case 'tb':
|
||||
case 'tib':
|
||||
return value * 1024 * 1024 * 1024 * 1024;
|
||||
case 'p':
|
||||
case 'pb':
|
||||
case 'pib':
|
||||
return value * 1024 * 1024 * 1024 * 1024 * 1024;
|
||||
default:
|
||||
return value; // 未知单位当作字节处理
|
||||
}
|
||||
};
|
||||
|
||||
const bytesA = parseBytes(a[field]);
|
||||
const bytesB = parseBytes(b[field]);
|
||||
|
||||
return bytesA - bytesB;
|
||||
};
|
||||
|
||||
// 格式化延迟显示
|
||||
const formatLatency = (latMs: any): string => {
|
||||
if (latMs === null || latMs === undefined || latMs === "") {
|
||||
|
||||
@@ -27,6 +27,12 @@
|
||||
>
|
||||
<ElCheckbox v-model="mainStore.serverConfig.autoStart">自动启动</ElCheckbox>
|
||||
</ElTooltip>
|
||||
<ElTooltip
|
||||
placement="top"
|
||||
content="启用后,不允许使用了与本网络不同的房间名和密码的节点通过本节点进行握手或中转"
|
||||
>
|
||||
<ElCheckbox v-model="mainStore.serverConfig.privateMode">私有模式</ElCheckbox>
|
||||
</ElTooltip>
|
||||
<ElTooltip
|
||||
placement="top"
|
||||
content="帮助其他虚拟网建立P2P链接"
|
||||
|
||||
+5
-5
@@ -10,7 +10,7 @@
|
||||
name="netcard"
|
||||
class="flex h-full flex-col"
|
||||
>
|
||||
<div>
|
||||
<!-- <div>
|
||||
<div>
|
||||
<ElTooltip
|
||||
content="找不到游戏房间时,就开启它后再尝试搜索房间(默认开启)
|
||||
@@ -39,13 +39,13 @@
|
||||
active-text="已开启"
|
||||
inactive-text="已关闭"
|
||||
></ElSwitch>
|
||||
</div>
|
||||
</div> -->
|
||||
<div>
|
||||
<ElTooltip
|
||||
content="使用ForceBindIP启动应用 (强制绑定IP或者网卡),如果还没有启动联机,请先启动联机,联机成功后,点击刷新获取easytier生成的网卡"
|
||||
>
|
||||
<ElText>
|
||||
方案2
|
||||
方案1
|
||||
<ElIcon class="ml-[3px]"><QuestionFilled /></ElIcon>
|
||||
</ElText>
|
||||
</ElTooltip>
|
||||
@@ -131,7 +131,7 @@
|
||||
<div>
|
||||
<ElTooltip content="设置网卡的跃点,提升网卡优先级,尝试将您联机使用的网卡跃点设置为最小,请先查询网卡信息">
|
||||
<ElText>
|
||||
方案3
|
||||
方案2
|
||||
<ElIcon class="ml-[3px]"><QuestionFilled /></ElIcon>
|
||||
</ElText>
|
||||
</ElTooltip>
|
||||
@@ -502,7 +502,7 @@
|
||||
|
||||
onMounted(() => {
|
||||
data.pingIp = mainStore.config.ipv4;
|
||||
initStartWinIpBroadcast();
|
||||
// initStartWinIpBroadcast();
|
||||
getGuids();
|
||||
});
|
||||
|
||||
|
||||
Generated
+775
-940
File diff suppressed because it is too large
Load Diff
Generated
+1
-1
@@ -1253,7 +1253,7 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
|
||||
|
||||
[[package]]
|
||||
name = "easytier-game"
|
||||
version = "1.4.5"
|
||||
version = "1.4.7"
|
||||
dependencies = [
|
||||
"hashbrown 0.15.2",
|
||||
"log",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "easytier-game"
|
||||
version = "1.4.5"
|
||||
version = "1.4.7"
|
||||
homepage = "https://github.com/EasyTier/EasyTier"
|
||||
repository = "https://github.com/EasyTier/EasytierGame"
|
||||
description = "A simple network initiator based on Easytier"
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
"core:tray:allow-get-by-id",
|
||||
"core:tray:allow-set-icon",
|
||||
"core:tray:allow-new",
|
||||
"core:window:allow-set-size",
|
||||
{
|
||||
"identifier": "shell:allow-spawn",
|
||||
"allow": [
|
||||
|
||||
@@ -35,6 +35,9 @@
|
||||
"netCardMetricValue": 1, // 网卡跃点
|
||||
"enablePreventSleep": false, // 启用防止睡眠
|
||||
"compression": "none", // 压缩算法
|
||||
"enableKcpProxy": true, // 启用kcp代理
|
||||
"disableKcpInput": false // 禁用kcp输入
|
||||
"enableKcpProxy": true, // 启用kcp代理,就不能启用quic代理
|
||||
"disableKcpInput": false, // 禁用kcp输入
|
||||
"enableQuicProxy": false, // 启用quic代理,就不能启用kcp代理
|
||||
"disableQuicInput": false, // 禁用quic输入
|
||||
"privateMode": false // 启用私有模式
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
+32
-24
@@ -322,7 +322,11 @@ async fn get_route_by_cli() -> String {
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
async fn download_easytier_zip(app_handle: tauri::AppHandle ,download_url: String, file_name: String) {
|
||||
async fn download_easytier_zip(
|
||||
app_handle: tauri::AppHandle,
|
||||
download_url: String,
|
||||
file_name: String,
|
||||
) {
|
||||
let cache_dir_path = get_tool_exe_path("\\easytier\\cache");
|
||||
let cache_file_name = format!("{}\\{}", cache_dir_path, file_name);
|
||||
let cache_file_name_path = path::Path::new(&cache_file_name);
|
||||
@@ -355,14 +359,18 @@ async fn download_easytier_zip(app_handle: tauri::AppHandle ,download_url: Strin
|
||||
while let Some(item) = response.chunk().await.unwrap() {
|
||||
match file.write_all(&item) {
|
||||
Ok(_) => {
|
||||
app_handle.emit("download_core_progress", [item.len() as u64, context_size]).expect("error to emit download_core_progress");
|
||||
},Err(why) => {
|
||||
app_handle
|
||||
.emit("download_core_progress", [item.len() as u64, context_size])
|
||||
.expect("error to emit download_core_progress");
|
||||
}
|
||||
Err(why) => {
|
||||
log::error!("error to write file: {}", why);
|
||||
app_handle.emit("download_core_progress_error", why.to_string()).expect("error to emit download_core_progress_error");
|
||||
return
|
||||
app_handle
|
||||
.emit("download_core_progress_error", why.to_string())
|
||||
.expect("error to emit download_core_progress_error");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
println!("下载完成");
|
||||
unzip(path);
|
||||
@@ -512,18 +520,19 @@ fn stop_command(child_id: u32) {
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
async fn fetch_easytier_list() -> Vec<Vec<[String; 3]>> {
|
||||
async fn fetch_easytier_list() -> Vec<Vec<[String; 4]>> {
|
||||
// 获取release列表
|
||||
if let Ok(release) = fetch_releases().await {
|
||||
let mut release_list = Vec::new();
|
||||
let mut release_list: Vec<Vec<[String; 4]>> = Vec::new();
|
||||
for re in release {
|
||||
let mut assets_list = Vec::new();
|
||||
let mut assets_list: Vec<[String; 4]> = Vec::new();
|
||||
for asset in re.assets {
|
||||
if asset.name.contains("windows-x86_64") {
|
||||
assets_list.push([
|
||||
re.tag_name.clone(),
|
||||
asset.name.clone(),
|
||||
asset.browser_download_url.clone(),
|
||||
re.prerelease.to_string(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -661,11 +670,11 @@ fn ensure_task_folder_and_cleanup(
|
||||
unsafe {
|
||||
let root = BSTR::from("\\");
|
||||
let root_folder: ITaskFolder = task_service.GetFolder(&root)?;
|
||||
|
||||
|
||||
match task_service.GetFolder(folder_path) {
|
||||
Ok(existing_folder) => {
|
||||
println!("任务文件夹已存在: {}", folder_path);
|
||||
|
||||
|
||||
// 检查并清理现有任务
|
||||
if let Ok(_existing_task) = existing_folder.GetTask(task_name) {
|
||||
println!("发现同名任务: {},准备删除", task_name);
|
||||
@@ -738,23 +747,23 @@ fn autostart(enabled: bool) -> std::result::Result<(), Box<dyn std::error::Error
|
||||
&VARIANT::default(),
|
||||
&VARIANT::default(),
|
||||
)?;
|
||||
|
||||
|
||||
let folder_path = BSTR::from("\\easytierGame");
|
||||
let task_name = BSTR::from("auto start");
|
||||
|
||||
|
||||
let task_definition = task_service.NewTask(0)?;
|
||||
|
||||
|
||||
// 设置任务信息
|
||||
let registration_info = task_definition.RegistrationInfo()?;
|
||||
registration_info.SetDescription(&BSTR::from("EasytierGame auto start task"))?;
|
||||
registration_info.SetAuthor(&BSTR::from("EasytierGame"))?;
|
||||
|
||||
|
||||
// 改为用户登录触发
|
||||
let triggers = task_definition.Triggers()?;
|
||||
let trigger = triggers.Create(TASK_TRIGGER_LOGON)?;
|
||||
let logon_trigger: ILogonTrigger = trigger.cast()?;
|
||||
logon_trigger.SetEnabled(VARIANT_BOOL::from(true))?;
|
||||
|
||||
|
||||
// 设置动作
|
||||
let actions = task_definition.Actions()?;
|
||||
let action = actions.Create(TASK_ACTION_EXEC)?;
|
||||
@@ -763,14 +772,13 @@ fn autostart(enabled: bool) -> std::result::Result<(), Box<dyn std::error::Error
|
||||
let exe_path: &str = exe.to_str().unwrap();
|
||||
exec_action.SetPath(&BSTR::from(exe_path))?;
|
||||
exec_action.SetArguments(&BSTR::from("--task-auto-start"))?;
|
||||
|
||||
|
||||
// 使用当前用户运行
|
||||
let principal = task_definition.Principal()?;
|
||||
principal.SetUserId(&BSTR::from(whoami::username().as_str()))?;
|
||||
principal.SetLogonType(TASK_LOGON_INTERACTIVE_TOKEN)?;
|
||||
principal.SetRunLevel(TASK_RUNLEVEL_HIGHEST)?;
|
||||
|
||||
|
||||
// 设置任务设置
|
||||
let settings = task_definition.Settings()?;
|
||||
settings.SetEnabled(VARIANT_BOOL::from(true))?;
|
||||
@@ -778,12 +786,12 @@ fn autostart(enabled: bool) -> std::result::Result<(), Box<dyn std::error::Error
|
||||
settings.SetStartWhenAvailable(VARIANT_BOOL::from(true))?;
|
||||
// settings.SetHidden(VARIANT_BOOL::from(true))?; // 注释掉让任务可见
|
||||
settings.SetExecutionTimeLimit(&BSTR::from("PT0S"))?;
|
||||
settings.SetDisallowStartIfOnBatteries(VARIANT_BOOL(0))?; // 允许在电池供电时启动
|
||||
|
||||
|
||||
|
||||
// 获取文件夹并注册任务
|
||||
let task_folder = ensure_task_folder_and_cleanup(&task_service, &folder_path, &task_name)?;
|
||||
|
||||
let task_folder =
|
||||
ensure_task_folder_and_cleanup(&task_service, &folder_path, &task_name)?;
|
||||
|
||||
let _auto_task = task_folder.RegisterTaskDefinition(
|
||||
&task_name,
|
||||
&task_definition,
|
||||
@@ -791,9 +799,9 @@ fn autostart(enabled: bool) -> std::result::Result<(), Box<dyn std::error::Error
|
||||
&VARIANT::default(),
|
||||
&VARIANT::default(),
|
||||
TASK_LOGON_INTERACTIVE_TOKEN,
|
||||
&VARIANT::default()
|
||||
&VARIANT::default(),
|
||||
)?;
|
||||
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||
"productName": "easytier-game",
|
||||
"version": "1.4.5",
|
||||
"version": "1.4.7",
|
||||
"identifier": "com.tauri.easytier-game",
|
||||
|
||||
"build": {
|
||||
@@ -12,14 +12,14 @@
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"title": "easytier-game 1.4.5",
|
||||
"title": "easytier-game 1.4.7",
|
||||
"label": "main",
|
||||
"minWidth": 340,
|
||||
"width": 340,
|
||||
"height": 305,
|
||||
"minHeight": 305,
|
||||
"maxHeight": 305,
|
||||
"maxWidth": 360,
|
||||
"maxHeight": 405,
|
||||
"maxWidth": 460,
|
||||
"resizable": true,
|
||||
"fullscreen": false,
|
||||
"decorations": true,
|
||||
|
||||
+11
-1
@@ -44,8 +44,11 @@ const store = defineStore("main", {
|
||||
compression: "none", //加密算法
|
||||
enableKcpProxy: true, //启用kcp代理 默认开启
|
||||
disableKcpInput: false, //禁用kcp输入
|
||||
enableQuicProxy: false, //启用quic代理 默认开启
|
||||
disableQuicInput: false, //禁用quic输入
|
||||
bindDeviceEnable: false, //是否绑定设备
|
||||
acceptDNS: false, //魔法dns
|
||||
privateMode: false, //是否启用私有模式
|
||||
|
||||
enablePortForward: false, //是否启用端口转发
|
||||
portForwardData: "", //端口转发数据
|
||||
@@ -56,7 +59,8 @@ const store = defineStore("main", {
|
||||
serverWhiteList: "", // 服务器流量转发白名单
|
||||
// enableListener: true, // 是否启用监听
|
||||
autoStart: false, //随软件自启
|
||||
port: "11010" // 服务器端口
|
||||
port: "11010", // 服务器端口
|
||||
privateMode: false, //是否启用私有模式
|
||||
},
|
||||
cidrEnable: false,
|
||||
proxyForwardBySystem: false, // 是否通过系统内核转发子网代理数据包,禁用内置NAT
|
||||
@@ -128,17 +132,23 @@ const store = defineStore("main", {
|
||||
|
||||
"config.enableKcpProxy",
|
||||
"config.disableKcpInput",
|
||||
"config.enableQuicProxy",
|
||||
"config.disableQuicInput",
|
||||
|
||||
|
||||
"config.bindDeviceEnable",
|
||||
|
||||
"config.acceptDNS",
|
||||
|
||||
"config.privateMode",
|
||||
|
||||
"serverConfig.autoStart",
|
||||
// 'serverConfig.enableListener',
|
||||
"serverConfig.enableWhiteList",
|
||||
"serverConfig.relayAllPeerrpc",
|
||||
"serverConfig.serverWhiteList",
|
||||
"serverConfig.port",
|
||||
"serverConfig.privateMode",
|
||||
|
||||
"cidrEnable",
|
||||
"proxyForwardBySystem",
|
||||
|
||||
Reference in New Issue
Block a user