Compare commits

...
15 Commits
Author SHA1 Message Date
黑先森 8120b65c9b 增加处于联机状态切换自建服务器时的确认
+ 升级vue -> 3.5.13
+ 升级nuxt -> 3.14.1592
2024-11-26 17:46:31 +08:00
黑先森 7af0683775 帮助文档外移至easytier-game.exe同级 2024-11-25 16:08:54 +08:00
黑先森 4191a0a12d 增加生成release包的方法 2024-11-25 15:53:42 +08:00
黑先森 66d8bff8b4 修复打印日志config,修复配置文件启动权重不是最高权重的bug 2024-11-25 15:23:21 +08:00
黑先森 c740039325 更新readme 2024-11-25 14:42:52 +08:00
黑先森 589511e356 新增自建服务器功能,修复优化部分文本,成员列表新增通道协议显示 2024-11-25 14:30:18 +08:00
黑先森 c2d060b202 更新readme 直接使用群号 2024-11-22 18:03:44 +08:00
黑先森 d2cd72fed9 增加部分头像和群图,更新readme 2024-11-22 11:55:39 +08:00
leizi97 efee636180 增加tooltip文本提示 2024-11-21 23:43:51 +08:00
leizi97 4e3f1cbd89 系统托盘增加联机和断开的切换 2024-11-21 23:37:24 +08:00
黑先森 c23191fe45 修复开机自启搭配配置文件方式启动 出现的找不到文件路径问题,并增加配置文件启动相关判断 2024-11-21 18:17:34 +08:00
leizi97 0776b074d2 文档更新 2024-11-20 22:45:07 +08:00
leizi97 cdd3fada1f 新增内核管理模块,可切换easytier内核版本,优化帮助和清除数据提示 2024-11-20 22:36:33 +08:00
黑先森 fe785f6066 增加easytierGame帮助文档,包括删除和打不开界面解决方案 2024-11-20 20:26:23 +08:00
黑先森 37fd7b6fb0 修复一些文本说明,增加清除easytierGame数据的bat,可用于完全卸载easytierGame 2024-11-20 12:09:07 +08:00
26 changed files with 1333 additions and 431 deletions
+14 -1
View File
@@ -28,7 +28,7 @@ Releases [https://github.com/EasyTier/EasytierGame/releases](https://github.c
- 如果还是无法满足您的需求,可以使用配置文件进行启动,具体如何配置,可以查看文档[配置文件](/guide/network/config-file.html) - 如果还是无法满足您的需求,可以使用配置文件进行启动,具体如何配置,可以查看文档[配置文件](/guide/network/config-file.html)
![game-step5](/assets/game-step5.png) ![game-step5](/assets/game-step5.png)
- easytier内核升级后,可以点击更新插件按钮就可以进行更新,但是需要出国,如果无法更新,可以在群里获取 - easytier内核升级后,可以点击内核管理按钮就可以进行内核切换和更新,但是需要出国或者github加速链接,如果无法更新,可以在群里获取
![game-step6](/assets/game-step6.png) ![game-step6](/assets/game-step6.png)
- 1.1.4更新了 配置分享功能 可以与朋友之间分享配置,方便联机 - 1.1.4更新了 配置分享功能 可以与朋友之间分享配置,方便联机
@@ -46,6 +46,12 @@ Releases [https://github.com/EasyTier/EasytierGame/releases](https://github.c
**解压zip后你可以查看 easytier/config_template.json 里的注释进行配置** **解压zip后你可以查看 easytier/config_template.json 里的注释进行配置**
![game-step10](/assets/game-step10.png) ![game-step10](/assets/game-step10.png)
- 1.2.3新增了帮助.txt 位于“easytier/帮助.txt" 内含 无法打开界面和卸载EasytierGame的办法,新增 "easytier/clear_local_data.bat" 用于清除easytierGame的本地缓存数据(需要管理员模式运行)
![game-step11](/assets/game-step11.png)
- 1.2.5新增 自建服务器功能,可以自行搭建服务器,但是需要一些网络知识,具体可以查看文档[自建服务器](https://www.easytier.top/guide/network/host-public-server.html)
![game-step12](/assets/game-step12.png)
## 特性 ## 特性
- 基于easytier组网工具开发,界面清晰简单 - 基于easytier组网工具开发,界面清晰简单
@@ -59,6 +65,13 @@ Releases [https://github.com/EasyTier/EasytierGame/releases](https://github.c
支持Windows 11 、Windows 10 、 Windows 7 支持Windows 11 、Windows 10 、 Windows 7
## 群聊交流
- 主群 EasyTier 支持
### 949700262
- EasyTier游戏联机交流群
### 596667137
## 请不要将本程序和仓库代码用于任何违法用途,由此产生的一切后果,仓库所有者和参与开发的人员不承担任何责任 ## 请不要将本程序和仓库代码用于任何违法用途,由此产生的一切后果,仓库所有者和参与开发的人员不承担任何责任
+11 -1
View File
@@ -11,10 +11,20 @@
const original = console[fnName]; const original = console[fnName];
console[fnName] = (message) => { console[fnName] = (message) => {
original(message); original(message);
if (import.meta.env.PROD) {
try {
if (typeof message === "string") {
logger(message); logger(message);
} else {
logger(JSON.stringify(message));
}
} catch (e) {
logger(`${message}`);
}
}
}; };
} }
forwardConsole("log", trace); forwardConsole("log", info);
forwardConsole("debug", debug); forwardConsole("debug", debug);
forwardConsole("info", info); forwardConsole("info", info);
forwardConsole("warn", warn); forwardConsole("warn", warn);
+15
View File
@@ -27,8 +27,23 @@ html.dark body {
} }
#__easytier { #__easytier {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
padding: 3px 5px; padding: 3px 5px;
} }
.full-label .el-form-item__label {
width: 100%;
padding-right: 0;
}
.full-content .el-form-item__content {
/* height: 100%; */
align-items: flex-start;
overflow: auto;
flex: 1;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

+16 -4
View File
@@ -17,7 +17,7 @@ async function toggleVisibility() {
} }
} }
export async function useTray(init: boolean = false, beforExit: Function) { export async function useTray(init: boolean = false, beforExit: Function, handleConnection: Function) {
let tray; let tray;
try { try {
tray = await TrayIcon.getById(DEFAULT_TRAY_NAME); tray = await TrayIcon.getById(DEFAULT_TRAY_NAME);
@@ -28,7 +28,7 @@ export async function useTray(init: boolean = false, beforExit: Function) {
id: DEFAULT_TRAY_NAME, id: DEFAULT_TRAY_NAME,
menu: await Menu.new({ menu: await Menu.new({
id: "main", id: "main",
items: await generateMenuItem(beforExit), items: await generateMenuItem(beforExit, handleConnection),
}), }),
action: async (e) => { action: async (e) => {
toggleVisibility(); toggleVisibility();
@@ -46,7 +46,7 @@ export async function useTray(init: boolean = false, beforExit: Function) {
tray.setMenu( tray.setMenu(
await Menu.new({ await Menu.new({
id: "main", id: "main",
items: await generateMenuItem(beforExit), items: await generateMenuItem(beforExit, handleConnection),
}) })
); );
} }
@@ -54,9 +54,10 @@ export async function useTray(init: boolean = false, beforExit: Function) {
return tray; return tray;
} }
export async function generateMenuItem(beforExit: Function) { export async function generateMenuItem(beforExit: Function, handleConnection:Function) {
return [ return [
await MenuItemShow("显示 / 隐藏"), await MenuItemShow("显示 / 隐藏"),
await MenuItemExchangeConnection("联机 / 断开", handleConnection),
await MenuItemTheme(), await MenuItemTheme(),
await PredefinedMenuItem.new({ item: "Separator" }), await PredefinedMenuItem.new({ item: "Separator" }),
await MenuItemExit("退出", beforExit), await MenuItemExit("退出", beforExit),
@@ -86,6 +87,17 @@ export async function MenuItemShow(text: string) {
}); });
} }
export async function MenuItemExchangeConnection(text: string, handleConnection:Function) {
const menutItem = await MenuItem.new({
id: "exchangeConnection",
text,
action: async () => {
const isStart = await handleConnection();
},
});
return menutItem;
}
export async function MenuItemTheme() { export async function MenuItemTheme() {
return await MenuItem.new({ return await MenuItem.new({
id: "theme", id: "theme",
+5 -3
View File
@@ -3,10 +3,11 @@
"private": true, "private": true,
"author": "leizi97", "author": "leizi97",
"description": "A simple network initiator based on Easytier", "description": "A simple network initiator based on Easytier",
"version": "1.2.2", "version": "1.2.6",
"scripts": { "scripts": {
"dev": "nuxt dev --dotenv env/.env.dev --host 0.0.0.0", "dev": "nuxt dev --dotenv env/.env.dev --host 0.0.0.0",
"build": "nuxt generate --dotenv env/.env.prod" "build": "nuxt generate --dotenv env/.env.prod",
"release": "node zip.js"
}, },
"devDependencies": { "devDependencies": {
"@element-plus/icons-vue": "^2.3.1", "@element-plus/icons-vue": "^2.3.1",
@@ -26,10 +27,11 @@
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "^4.17.12",
"@vitejs/plugin-vue-jsx": "^4.1.0", "@vitejs/plugin-vue-jsx": "^4.1.0",
"@vueuse/core": "^11.2.0", "@vueuse/core": "^11.2.0",
"archiver": "^7.0.1",
"element-plus": "^2.8.7", "element-plus": "^2.8.7",
"less": "^4.2.0", "less": "^4.2.0",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"nuxt": "^3.13.2", "nuxt": "^3.14.1592",
"pinia": "^2.2.6", "pinia": "^2.2.6",
"pinia-plugin-persistedstate": "^4.1.3", "pinia-plugin-persistedstate": "^4.1.3",
"postcss": "^8.4.38", "postcss": "^8.4.38",
+2 -2
View File
@@ -76,8 +76,8 @@
<ElDivider /> <ElDivider />
<div><ElCheckbox v-model="mainStore.config.enablExitNode">允许此节点成为出口节点</ElCheckbox></div> <div><ElCheckbox v-model="mainStore.config.enablExitNode">允许此节点成为出口节点</ElCheckbox></div>
<div><ElCheckbox v-model="mainStore.config.disableEncryption">禁用对等节点通信的加密默认为false必须与对等节点相同</ElCheckbox></div> <div><ElCheckbox v-model="mainStore.config.disableEncryption">禁用对等节点通信的加密默认为启用必须与对等节点相同</ElCheckbox></div>
<div><ElCheckbox v-model="mainStore.config.multiThread">使用多线程运行默认为单线程</ElCheckbox></div> <div><ElCheckbox v-model="mainStore.config.multiThread">用多线程运行</ElCheckbox></div>
<ElDivider /> <ElDivider />
<div><ElCheckbox v-model="mainStore.config.useSmoltcp">为子网代理启用smoltcp堆栈</ElCheckbox></div> <div><ElCheckbox v-model="mainStore.config.useSmoltcp">为子网代理启用smoltcp堆栈</ElCheckbox></div>
+418 -127
View File
@@ -1,52 +1,51 @@
<template> <template>
<ElForm <ElForm
v-if="!mainStore.enableCreateServer"
size="small" size="small"
label-position="top" label-position="top"
:model="config"> :model="config"
<!-- element-loading-custom-class="config-start" >
v-loading="mainStore.configStartEnable"
:element-loading-spinner="'<path />'"
element-loading-text="-------已经启用配置文件,界面配置不再生效-------" -->
<!-- <div> -->
<ElFormItem <ElFormItem
label="服务器" label="服务器"
prop="serverUrl"> prop="serverUrl"
class="full-label"
>
<template #label> <template #label>
<div class="flex items-center gap-[0_5px]"> <div class="flex items-center flex-nowrap gap-[0_5px]">
<div>服务器</div> <div>服务器</div>
<span>-</span> <span>-</span>
<ElTag <ElTag
effect="dark" effect="dark"
:type="data.isSuccessGetIp ? 'success' : 'info'"> :type="data.isSuccessGetIp ? 'success' : 'info'"
>
{{ data.isSuccessGetIp ? "联机成功" : data.isStart && !data.isSuccessGetIp ? "联机中" : "未联机" }} {{ data.isSuccessGetIp ? "联机成功" : data.isStart && !data.isSuccessGetIp ? "联机中" : "未联机" }}
</ElTag> </ElTag>
<ElButton <ElButton
v-if="!data.coreVersion" v-if="!data.coreVersion"
@click="getCoreVersion(true)"> @click="getCoreVersion(true)"
>
获取内核版本 获取内核版本
</ElButton> </ElButton>
<ElTag <div
v-else v-else
type="info"> class="flex-1 truncate"
>
<ElTooltip :content="data.coreVersion">
<ElTag type="info">
{{ data.coreVersion }} {{ data.coreVersion }}
</ElTag> </ElTag>
<ElPopconfirm </ElTooltip>
width="325" </div>
cancel-button-text="取消"
confirm-button-text="继续"
title="内核从github下载,需要出国工具,可能下载缓慢或失败,是否继续?
也可以从官方群里手动下载后解压到easytier-game.exe同级目录下的easytier目录里,全部覆盖即可"
@confirm="handleUpdateCore">
<template #reference>
<ElButton <ElButton
class="ml-auto"
:disabled="data.isStart" :disabled="data.isStart"
@click="handleCoreManagement"
:loading="data.update" :loading="data.update"
type="warning" type="primary"
size="small"> size="small"
{{ data.coreVersion ? "更新内核" : "下载内核" }} >
内核管理
</ElButton> </ElButton>
</template>
</ElPopconfirm>
</div> </div>
</template> </template>
<ElSelect <ElSelect
@@ -55,7 +54,8 @@
placeholder="请选择服务器地址" placeholder="请选择服务器地址"
default-first-option default-first-option
v-model="config.serverUrl" v-model="config.serverUrl"
@change="handleServerUrlChange"> @change="handleServerUrlChange"
>
<template #prefix> <template #prefix>
<div :class="config.protocol && config.protocol.length > 1 ? 'w-[120px]' : 'w-[80px]'"> <div :class="config.protocol && config.protocol.length > 1 ? 'w-[120px]' : 'w-[80px]'">
<ElSelect <ElSelect
@@ -64,12 +64,14 @@
collapse-tags collapse-tags
@click.stop @click.stop
v-model="config.protocol" v-model="config.protocol"
@change="handleServerUrlChange"> @change="handleServerUrlChange"
>
<ElOption <ElOption
v-for="item in protocols" v-for="item in protocols"
:key="item" :key="item"
:label="item" :label="item"
:value="item"></ElOption> :value="item"
></ElOption>
</ElSelect> </ElSelect>
</div> </div>
</template> </template>
@@ -77,7 +79,8 @@
v-for="item in mainStore.basePeers" v-for="item in mainStore.basePeers"
:key="item" :key="item"
:label="item" :label="item"
:value="item"> :value="item"
>
<div class="flex items-center gap-[20px] overflow-hidden flex-nowrap max-w-[calc(100vw-62px)]"> <div class="flex items-center gap-[20px] overflow-hidden flex-nowrap max-w-[calc(100vw-62px)]">
<ElTooltip :content="item"> <ElTooltip :content="item">
<p class="truncate">{{ item }}</p> <p class="truncate">{{ item }}</p>
@@ -87,7 +90,8 @@
@click.stop="handleDeleteServerUrl(item)" @click.stop="handleDeleteServerUrl(item)"
round round
:icon="Delete" :icon="Delete"
type="danger"></ElButton> type="danger"
></ElButton>
</div> </div>
</div> </div>
</ElOption> </ElOption>
@@ -107,7 +111,8 @@
<ElInput <ElInput
maxlength="100" maxlength="100"
placeholder="请输入网络名" placeholder="请输入网络名"
v-model="config.networkName"></ElInput> v-model="config.networkName"
></ElInput>
</ElFormItem> </ElFormItem>
</div> </div>
<div class="flex-1"> <div class="flex-1">
@@ -125,7 +130,8 @@
maxlength="100" maxlength="100"
placeholder="请输入网络密码" placeholder="请输入网络密码"
v-model="config.networkPassword" v-model="config.networkPassword"
type="password"></ElInput> type="password"
></ElInput>
</ElFormItem> </ElFormItem>
</div> </div>
</div> </div>
@@ -142,11 +148,13 @@
<ElInput <ElInput
maxlength="100" maxlength="100"
placeholder="例如: Player1" placeholder="例如: Player1"
v-model="config.hostname"></ElInput> v-model="config.hostname"
></ElInput>
</ElFormItem> </ElFormItem>
<ElFormItem <ElFormItem
class="w-[70%]" class="w-[70%]"
label="局域网IP"> label="局域网IP"
>
<template #label> <template #label>
<div class="flex items-center h-[20px]"> <div class="flex items-center h-[20px]">
虚拟网IP 虚拟网IP
@@ -159,18 +167,94 @@
inline-prompt inline-prompt
inactive-text="固定IP" inactive-text="固定IP"
active-text="动态获取IP" active-text="动态获取IP"
size="small"></ElSwitch> size="small"
></ElSwitch>
</div> </div>
</template> </template>
<ElInput <ElInput
maxlength="100" maxlength="100"
:disabled="config.dhcp" :disabled="config.dhcp"
:placeholder="data.isStart && config.dhcp ? '等待动态分配IP...' : '例如: 10.126.126.1'" :placeholder="data.isStart && config.dhcp ? '等待动态分配IP...' : '例如: 10.126.126.1'"
v-model="config.ipv4"></ElInput> v-model="config.ipv4"
></ElInput>
</ElFormItem> </ElFormItem>
</div> </div>
<!-- </div> --> </ElForm>
<div class="flex items-start"> <ElForm
v-else
size="small"
label-position="top"
class="flex-1 overflow-hidden pb-[5px]"
:model="config"
>
<ElFormItem
label="白名单"
prop="ServerWhiteList"
class="full-label full-content overflow-hidden !flex flex-col h-full !mb-[0]"
>
<template #label>
<div class="flex items-center flex-nowrap gap-[0_5px]">
<div>白名单</div>
<span>-</span>
<ElTag
effect="dark"
:type="data.isStart ? 'success' : 'info'"
>
{{ data.isSuccessGetIp ? "运行成功" : data.isStart && !data.isSuccessGetIp ? "运行中" : "未启动" }}
</ElTag>
<ElButton
v-if="!data.coreVersion"
@click="getCoreVersion(true)"
>
获取内核版本
</ElButton>
<div
v-else
class="flex-1 truncate"
>
<ElTooltip :content="data.coreVersion">
<ElTag type="info">
{{ data.coreVersion }}
</ElTag>
</ElTooltip>
</div>
<ElButton
class="ml-auto"
:disabled="data.isStart"
@click="handleCoreManagement"
:loading="data.update"
type="primary"
size="small"
>
内核管理
</ElButton>
</div>
</template>
<div class="h-full w-full flex flex-col overflow-hidden">
<div class="flex-1 overflow-auto">
<ElInput
:disabled="!mainStore.enableWhiteList"
placeholder="一行一个,支持通配符列表,如(ab*)。当该参数的列表为空时,就不会为所有其他网络提供转发服务。"
:maxlength="1000"
v-model="mainStore.ServerWhiteList"
type="textarea"
:autosize="{
minRows: 9
}"
resize="none"
></ElInput>
</div>
<div class="text-center">
<ElCheckbox v-model="mainStore.enableWhiteList">启用白名单</ElCheckbox>
<ElCheckbox v-model="mainStore.config.relayAllPeerrpc">转发所有对等节点的RPC数据包</ElCheckbox>
<ElTooltip content="帮助其他虚拟网建立P2P链接">
<ElIcon><QuestionFilled /></ElIcon>
</ElTooltip>
</div>
</div>
</ElFormItem>
</ElForm>
<div class="flex items-start mt-auto">
<div> <div>
<div> <div>
<ElDropdown <ElDropdown
@@ -180,24 +264,47 @@
size="default" size="default"
:type="!data.isStart ? 'primary' : 'danger'" :type="!data.isStart ? 'primary' : 'danger'"
:disabled="data.startLoading || !data.coreVersion || data.update" :disabled="data.startLoading || !data.coreVersion || data.update"
@click="handleConnection"> @click="handleConnection"
{{ !data.isStart ? "启动联机" : "停止联机" }} >
{{
!data.isStart
? mainStore.enableCreateServer
? "启动服务"
: "启动联机"
: mainStore.enableCreateServer
? "停止服务"
: "停止联机"
}}
<template #dropdown> <template #dropdown>
<ElDropdownMenu> <ElDropdownMenu>
<ElDropdownItem <ElDropdownItem
command="import_config" command="import_config"
:icon="Link"> :icon="Link"
>
导入配置 导入配置
</ElDropdownItem> </ElDropdownItem>
<ElDropdownItem <ElDropdownItem
command="share_config" command="share_config"
:icon="Share"> :icon="Share"
分享配置 >
分享联机相关配置
</ElDropdownItem>
<ElDropdownItem
disabled
>
<ElDivider class="!h-[2px] !m-0" />
</ElDropdownItem>
<ElDropdownItem
:icon="SetUp"
command="create_server"
>
{{ mainStore.enableCreateServer ? "我要联机" : "我要开服(自建)" }}
</ElDropdownItem> </ElDropdownItem>
<ElDropdownItem <ElDropdownItem
:icon="Tools" :icon="Tools"
command="toml" command="toml"
:disabled="data.isStart"> :disabled="data.isStart"
>
使用外部配置文件 使用外部配置文件
</ElDropdownItem> </ElDropdownItem>
</ElDropdownMenu> </ElDropdownMenu>
@@ -207,51 +314,62 @@
<div class="mt-[6px] pl-[2px]"> <div class="mt-[6px] pl-[2px]">
<ElTooltip <ElTooltip
placement="left" placement="left"
content="日志"> content="日志"
>
<ElButton <ElButton
:type="!data.logVisible ? 'info' : 'warning'" :type="!data.logVisible ? 'info' : 'warning'"
@click="handleShowLogDialog" @click="handleShowLogDialog"
:icon="List" :icon="List"
size="small" size="small"
plain></ElButton> plain
></ElButton>
</ElTooltip> </ElTooltip>
<ElTooltip <ElTooltip
placement="left" placement="left"
content="成员"> content="成员"
>
<ElButton <ElButton
@click="handleShowMemberDialog" @click="handleShowMemberDialog"
:icon="UserFilled" :icon="UserFilled"
plain plain
type="success" type="success"
size="small"></ElButton> size="small"
></ElButton>
</ElTooltip> </ElTooltip>
</div> </div>
</div> </div>
<div class="ml-auto"> <div class="ml-auto">
<ElCheckbox <ElCheckbox
v-model="config.disbleP2p" v-model="config.disbleP2p"
size="small"> size="small"
>
强制中转 强制中转
</ElCheckbox> </ElCheckbox>
<ElTooltip <ElTooltip
placement="top-start" placement="top-start"
content="自启后隐藏于托盘,不显示界面"> content="自启后隐藏于托盘,不显示界面"
>
<ElCheckbox <ElCheckbox
@change="handleAutoStartByTask" @change="handleAutoStartByTask"
:model-value="config.autoStart" :model-value="config.autoStart"
size="small"> size="small"
>
开机自启 开机自启
</ElCheckbox> </ElCheckbox>
</ElTooltip> </ElTooltip>
<div> <div>
<ElButton <ElButton
@click="handleShowCidrDialog" @click="handleShowCidrDialog"
:icon="Share"> :icon="Share"
size="small"
>
子网代理 子网代理
</ElButton> </ElButton>
<ElButton <ElButton
@click="handleShowAdvanceDialog" @click="handleShowAdvanceDialog"
:icon="Setting"> :icon="Setting"
size="small"
>
高级选项 高级选项
</ElButton> </ElButton>
</div> </div>
@@ -262,7 +380,8 @@
type="primary" type="primary"
size="small" size="small"
:icon="MagicStick" :icon="MagicStick"
@click="handleShowToolDialog"> @click="handleShowToolDialog"
>
增强工具 增强工具
</ElButton> </ElButton>
</div> </div>
@@ -270,13 +389,86 @@
class="!text-[9px] pb-[2px] ml-[8px] truncate" class="!text-[9px] pb-[2px] ml-[8px] truncate"
type="info" type="info"
:underline="false" :underline="false"
@click="open('https://github.com/EasyTier/EasytierGame')"> @click="open('https://github.com/EasyTier/EasytierGame')"
>
EasytierGame主页 EasytierGame主页
</ElLink> </ElLink>
</div> </div>
</div> </div>
</div> </div>
</ElForm> <ElDialog
width="95%"
top="10px"
append-to-body
:z-index="10"
class="!mb-0"
v-model="coreManagementData.visible"
:close-on-press-escape="false"
title="内核管理"
>
<div>
<ElText>当前版本: {{ data.coreVersion || "-" }}</ElText>
</div>
<div class="mt-[10px] pb-[5px]">
<ElText class="!mr-[10px]">选择一个内核版本安装</ElText>
<ElButton
:loading="coreManagementData.loading"
@click="getReleaseList"
size="small"
>
刷新
</ElButton>
</div>
<ElSelect
placeholder="请选择内核版本"
no-data-text="正在获取中..."
popper-class="!h-[120px]"
v-model="coreManagementData.data"
>
<ElOption
v-for="(release, idx) in data.releaseList"
:key="`${idx}-ray`"
:label="release[0]"
:value="`${release[2]}<>${release[1]}`"
>
{{ release ? release[0] : "" }}
</ElOption>
</ElSelect>
<div class="pb-[5px] mt-[10px]">
<ElTooltip content="不使用出国软件也能告诉下载github Release包的地址,可自行搜索替换使用">
<ElText>github下载加速地址</ElText>
</ElTooltip>
</div>
<ElInput
v-model="mainStore.githubFastUrl"
placeholder="请输入github加速地址"
></ElInput>
<template #footer>
<div class="text-right">
<ElButton
size="small"
:loading="data.update"
@click="handleInstallCore"
type="primary"
>
安装选中内核
</ElButton>
<ElButton
size="small"
type="warning"
@click="addQQGroup"
>
加群获取
</ElButton>
<ElButton
size="small"
@click="coreManagementData.visible = false"
>
取消
</ElButton>
</div>
</template>
</ElDialog>
<ElDialog <ElDialog
width="95%" width="95%"
top="10px" top="10px"
@@ -285,12 +477,14 @@
class="!mb-0" class="!mb-0"
v-model="importConfigData.visible" v-model="importConfigData.visible"
:close-on-press-escape="false" :close-on-press-escape="false"
title="导入分享"> title="导入分享"
>
<ElInput <ElInput
type="textarea" type="textarea"
:rows="6" :rows="6"
placeholder="请粘贴分享的配置" placeholder="请粘贴分享的配置"
v-model="importConfigData.data"></ElInput> v-model="importConfigData.data"
></ElInput>
<template #footer> <template #footer>
<div> <div>
<el-text type="danger">导入成功后您当前的部分配置将被替换</el-text> <el-text type="danger">导入成功后您当前的部分配置将被替换</el-text>
@@ -299,7 +493,8 @@
<ElButton <ElButton
size="small" size="small"
@click="handleStartImport" @click="handleStartImport"
type="primary"> type="primary"
>
导入 导入
</ElButton> </ElButton>
</div> </div>
@@ -313,7 +508,8 @@
class="!mb-0" class="!mb-0"
v-model="configStart.visible" v-model="configStart.visible"
:close-on-press-escape="false" :close-on-press-escape="false"
title="配置文件启动"> title="配置文件启动"
>
<div class="flex items-center gap-[0_4px]"> <div class="flex items-center gap-[0_4px]">
<span>启用</span> <span>启用</span>
<ElSwitch v-model="mainStore.configStartEnable"></ElSwitch> <ElSwitch v-model="mainStore.configStartEnable"></ElSwitch>
@@ -322,14 +518,16 @@
</ElTooltip> </ElTooltip>
<ElButton <ElButton
@click="openConfigDir" @click="openConfigDir"
size="small"> size="small"
>
打开配置目录 打开配置目录
</ElButton> </ElButton>
<ElButton <ElButton
@click="handleStartCommand('toml')" @click="handleStartCommand('toml')"
type="primary" type="primary"
:icon="RefreshRight" :icon="RefreshRight"
size="small"> size="small"
>
刷新 刷新
</ElButton> </ElButton>
</div> </div>
@@ -337,12 +535,14 @@
<ElSelect <ElSelect
v-model="mainStore.configPath" v-model="mainStore.configPath"
no-data-text="目录没有配置文件" no-data-text="目录没有配置文件"
placeholder="选择配置文件"> placeholder="选择配置文件"
>
<ElOption <ElOption
v-for="item in configStart.list" v-for="item in configStart.list"
:key="item.path" :key="item.path"
:value="item.path" :value="item.path"
:label="item.name"></ElOption> :label="item.name"
></ElOption>
</ElSelect> </ElSelect>
</div> </div>
<template #footer> <template #footer>
@@ -350,7 +550,8 @@
<ElButton <ElButton
size="small" size="small"
@click="configStart.visible = false" @click="configStart.visible = false"
type="danger"> type="danger"
>
关闭 关闭
</ElButton> </ElButton>
</div> </div>
@@ -361,7 +562,7 @@
import { invoke } from "@tauri-apps/api/core"; import { invoke } from "@tauri-apps/api/core";
import { listen } from "@tauri-apps/api/event"; import { listen } from "@tauri-apps/api/event";
import { open, Command } from "@tauri-apps/plugin-shell"; import { open, Command } from "@tauri-apps/plugin-shell";
import { QuestionFilled, Delete, List, UserFilled, Setting, Share, RefreshRight, Link, Tools, MagicStick } from "@element-plus/icons-vue"; import { QuestionFilled, Delete, List, UserFilled, Setting, Share, RefreshRight, Link, Tools, MagicStick, SetUp } from "@element-plus/icons-vue";
import { reactive, onBeforeUnmount, onMounted } from "vue"; import { reactive, onBeforeUnmount, onMounted } from "vue";
import { useTray, setTrayRunState, setTrayTooltip } from "~/composables/tray"; import { useTray, setTrayRunState, setTrayTooltip } from "~/composables/tray";
import { initStartWinIpBroadcast } from "~/composables/netcard"; import { initStartWinIpBroadcast } from "~/composables/netcard";
@@ -376,21 +577,29 @@
import { updateConfigJson } from "~/composables/configJson"; import { updateConfigJson } from "~/composables/configJson";
import { writeText, readText } from "@tauri-apps/plugin-clipboard-manager"; import { writeText, readText } from "@tauri-apps/plugin-clipboard-manager";
import { sortedUniq, uniq } from "lodash-es"; import { sortedUniq, uniq } from "lodash-es";
import { bounce } from "~/utils"; import { bounce, addQQGroup } from "~/utils";
import { ElConfirmDanger, ElConfirmPrimary } from "~/utils/element";
let is_close = false; let is_close = false;
const tray = await useTray(true, async () => { const tray = await useTray(
true,
async () => {
is_close = true; is_close = true;
await invoke("stop_command", { child_id: listenObj.thread_id || 0 }); await invoke("stop_command", { child_id: listenObj.thread_id || 0 });
await invoke("stop_command", { child_id: data.winipBcPid || 0 }); await invoke("stop_command", { child_id: data.winipBcPid || 0 });
}); },
async () => {
await handleConnection();
return data.isStart;
}
);
const mainStore = useMainStore(); const mainStore = useMainStore();
const config = mainStore.config; const config = mainStore.config;
// console.error(config); // console.error(config);
const protocols = ["tcp", "udp", "ws", "wss", "wg", "quic"]; const protocols = ["tcp", "udp", "ws", "wss", "wg", "quic"];
const data = reactive({ const data = reactive<{ [key: string]: any; releaseList: Array<Array<string>> }>({
logVisible: false, logVisible: false,
cidrVisible: false, cidrVisible: false,
advanceVisible: false, advanceVisible: false,
@@ -401,30 +610,36 @@
log: "", log: "",
update: false, update: false,
releaseList: [], releaseList: [],
coreVersion: "", coreVersion: "-",
isSuccessGetIp: false, isSuccessGetIp: false,
startLoading: false, startLoading: false,
isStart: false, isStart: false,
connectionSuccess: false, connectionSuccess: false,
configJsonSeverUrl: "", // 本地保存一次,用于回填config.json configJsonSeverUrl: "" // 本地保存一次,用于回填config.json
}); });
const configStart = reactive<{ list: Array<{ path: string; name: string }>; [key: string]: any }>({ const configStart = reactive<{ list: Array<{ path: string; name: string }>; [key: string]: any }>({
visible: false, visible: false,
loading: false, loading: false,
list: [], //配置文件列表 list: [] //配置文件列表
}); });
const importConfigData = reactive<{ data: ""; [key: string]: any }>({ const importConfigData = reactive<{ data: ""; [key: string]: any }>({
visible: false, visible: false,
loading: false, loading: false,
data: "", data: ""
});
const coreManagementData = reactive<{ data: ""; [key: string]: any }>({
visible: false,
loading: false,
data: ""
}); });
const closePrevent = async () => { const closePrevent = async () => {
const appWindow = getCurrentWindow(); const appWindow = getCurrentWindow();
if (appWindow.label == "main") { if (appWindow.label == "main") {
appWindow.onCloseRequested(async (event) => { appWindow.onCloseRequested(async event => {
// console.error(appWindow.label); // console.error(appWindow.label);
if (!is_close) { if (!is_close) {
// console.error(1); // console.error(1);
@@ -472,7 +687,7 @@
thread_id: null, thread_id: null,
async listenOutput() { async listenOutput() {
// const appWindow = getCurrentWindow(); // const appWindow = getCurrentWindow();
const unListen = await listen("command-output", async (event) => { const unListen = await listen("command-output", async event => {
data.isStart = true; data.isStart = true;
// console.error(event.payload); // console.error(event.payload);
if (event.payload) { if (event.payload) {
@@ -487,7 +702,7 @@
await setTrayTooltip(tray, `IP: ${ipv4}`); await setTrayTooltip(tray, `IP: ${ipv4}`);
} }
} else { } else {
if ((event.payload as string).includes("new peer connection added")) { if ((event.payload as string).includes("new peer connection added") && !data.isSuccessGetIp) {
await setTrayRunState(tray, true); await setTrayRunState(tray, true);
data.isSuccessGetIp = true; data.isSuccessGetIp = true;
await setTrayTooltip(tray, `IP: ${config.ipv4}`); await setTrayTooltip(tray, `IP: ${config.ipv4}`);
@@ -505,7 +720,7 @@
"netsh", "netsh",
["interface", "ipv4", "set", "interface", devName, "metric=", `${mainStore.config.netCardMetricValue}`], ["interface", "ipv4", "set", "interface", devName, "metric=", `${mainStore.config.netCardMetricValue}`],
{ {
encoding: "gb2312", encoding: "gb2312"
} }
).execute(); ).execute();
} catch (err) { } catch (err) {
@@ -522,7 +737,7 @@
this.unListenOutPut = unListen; this.unListenOutPut = unListen;
}, },
async listenThreadId() { async listenThreadId() {
const unListen = await listen("thread-id", (event) => { const unListen = await listen("thread-id", event => {
if (event.payload) { if (event.payload) {
this.thread_id = event.payload; this.thread_id = event.payload;
} }
@@ -530,14 +745,14 @@
this.unListenThreadId = unListen; this.unListenThreadId = unListen;
}, },
async listenConfigStart() { async listenConfigStart() {
const unListen = await listen("config", (event) => { const unListen = await listen("config", event => {
console.error("config", event.payload); // console.error("config", event.payload);
const ipv4 = config.ipv4; const ipv4 = config.ipv4;
mainStore.$patch(event.payload as any); mainStore.$patch(event.payload as any);
config.ipv4 = ipv4; config.ipv4 = ipv4;
}); });
this.unListenConfigStart = unListen; this.unListenConfigStart = unListen;
}, }
}; };
const unListenAll = async () => { const unListenAll = async () => {
@@ -555,19 +770,23 @@
}; };
const checkUpdate = async () => { const checkUpdate = async () => {
await getReleaseList(); // const latestVersionFileName = data.releaseList?.[0]?.[0]?.[1] as string;
const latestVersionFileName = data.releaseList?.[0]?.[0]?.[1] as string; let [downloadUrl, versionFileName] = (coreManagementData.data as string).split("<>");
if (latestVersionFileName) { if (mainStore.githubFastUrl) {
let fastUrl = mainStore.githubFastUrl.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
if (!fastUrl.endsWith("/")) fastUrl += "/";
downloadUrl = fastUrl + downloadUrl;
}
if (versionFileName) {
// console.error(latestVersionFileName, /\-v(\d+\.\d+\.\d+)/g.exec(latestVersionFileName)); // console.error(latestVersionFileName, /\-v(\d+\.\d+\.\d+)/g.exec(latestVersionFileName));
const latestVersion = /\-v(\d+\.\d+\.\d+)/g.exec(latestVersionFileName)?.[1]; const version = /\-v(\d+\.\d+\.\d+)/g.exec(versionFileName)?.[1];
const currentVersion = /(\d+\.\d+\.\d+)/g.exec(data.coreVersion || "")?.[1]; const currentVersion = /(\d+\.\d+\.\d+)/g.exec(data.coreVersion || "")?.[1];
if (latestVersion && currentVersion != latestVersion) { if (version && currentVersion != version) {
// console.error({ currentVersion, latestVersion }); // console.error({ currentVersion, latestVersion });
ElMessage.success(`更新 -> ${latestVersion}`); ElMessage.success(`更新 -> ${version}`);
const downloadUrl = data.releaseList?.[0]?.[0]?.[2]; return [true, downloadUrl, versionFileName];
return [true, downloadUrl, latestVersionFileName]; } else if (currentVersion === version) {
} else if (currentVersion === latestVersion) { ElMessage.success(`当前版本无需安装`);
ElMessage.success(`当前是最新版`);
return [false, null, null]; return [false, null, null];
} else { } else {
ElMessage.error(`获取版本失败`); ElMessage.error(`获取版本失败`);
@@ -579,8 +798,16 @@
return [false, null, null]; return [false, null, null];
}; };
const handleUpdateCore = async () => { const handleCoreManagement = async () => {
coreManagementData.visible = true;
await getReleaseList();
};
const handleInstallCore = async () => {
try { try {
if (!coreManagementData.data) {
return ElMessage.error("请选择一个内核");
}
data.update = true; data.update = true;
await getCoreVersion(); await getCoreVersion();
const [isNeedUpdate, downloadUrl, latestVersionFileName] = await checkUpdate(); const [isNeedUpdate, downloadUrl, latestVersionFileName] = await checkUpdate();
@@ -593,15 +820,22 @@
await getCoreVersion(); await getCoreVersion();
} catch (err) { } catch (err) {
console.error(err); console.error(err);
}finally { } finally {
data.update = false; data.update = false;
} }
}; };
const getReleaseList = async () => { const getReleaseList = async () => {
const list = await invoke("fetch_easytier_list"); coreManagementData.loading = true;
data.releaseList = list as never[]; const list = await invoke<string[][][]>("fetch_easytier_list");
console.error(data.releaseList); data.releaseList = [
...list.flat().filter(el => {
// console.log(el, el[0], el[2]);
return el && el[0] && el[2] && !el[2].includes("gui");
})
];
coreManagementData.loading = false;
// console.log(data.releaseList);
}; };
const handleAutoStart = async () => { const handleAutoStart = async () => {
@@ -704,8 +938,8 @@
config: { config: {
...mainStore.config, ...mainStore.config,
...guiJson, ...guiJson,
serverUrl: saveServerUrl, serverUrl: saveServerUrl
}, }
}); });
if (mainStore.createConfigInEasytier) { if (mainStore.createConfigInEasytier) {
await updateConfigJson(data.configJsonSeverUrl); await updateConfigJson(data.configJsonSeverUrl);
@@ -715,7 +949,7 @@
ElMessage.error(`config.json格式错误`); ElMessage.error(`config.json格式错误`);
} finally { } finally {
mainStore.$patch({ mainStore.$patch({
createConfigInEasytier: true, // 发现本地存在config.json 默认启用该功能 createConfigInEasytier: true // 发现本地存在config.json 默认启用该功能
}); });
} }
} }
@@ -756,14 +990,51 @@
const getArgs = async () => { const getArgs = async () => {
// console.error(config.proxyNetworks); // console.error(config.proxyNetworks);
const args = []; const args = [];
if (mainStore.configStartEnable && mainStore.configPath) { if (mainStore.configStartEnable) {
// const resourceDir = await getResourceDir(); if (mainStore.configPath) {
// const configPath = await join(resourceDir, mainStore.configPath); const isExists = await exists(mainStore.configPath, { baseDir: BaseDirectory.Resource });
// args.push("-c", configPath); if (isExists) {
const resourceDir = await getResourceDir();
const configPath = await join(resourceDir, mainStore.configPath);
args.push("-c", configPath);
return args;
} else {
const appWindow = getCurrentWindow();
const isVisible = await appWindow.isVisible();
if (!isVisible) {
await appWindow.show();
await appWindow.setFocus();
}
mainStore.configPath = "";
ElMessage.error(`配置文件不存在 请重新选择`);
await handleStartCommand("toml"); // 配置文件不存在,显示配置文件弹窗
return [];
}
} else {
ElMessage.warning(`配置文件不存在 请选择`);
await handleStartCommand("toml"); // 配置文件不存在,显示配置文件弹窗
return [];
}
}
args.push("-c", mainStore.configPath); if (mainStore.enableCreateServer) {
if (config.relayAllPeerrpc) {
args.push("--relay-all-peer-rpc");
}
const whiteList = mainStore.ServerWhiteList.trim()
.split("\n")
.map(el => el.trim())
.filter(el => el)
.join(" ");
if (whiteList && mainStore.enableWhiteList) {
args.push("--relay-network-whitelist", whiteList);
}
if (!whiteList && mainStore.enableWhiteList) {
args.push("--relay-network-whitelist");
}
return args; return args;
} }
if (config.dhcp) { if (config.dhcp) {
args.push("-d"); args.push("-d");
} }
@@ -781,7 +1052,7 @@
} }
if (config.serverUrl) { if (config.serverUrl) {
const formatUrl = config.serverUrl.replace(/\\/g, "/"); const formatUrl = config.serverUrl.replace(/\\/g, "/");
args.push("--peers", ...config.protocol.map((protocol) => `${protocol}://${formatUrl}`)); args.push("--peers", ...config.protocol.map(protocol => `${protocol}://${formatUrl}`));
} }
if (config.disbleP2p) { if (config.disbleP2p) {
args.push("--disable-p2p"); args.push("--disable-p2p");
@@ -797,8 +1068,8 @@
const reg = /\d+\.\d+\.\d+\.\d+\/\d+/g; const reg = /\d+\.\d+\.\d+\.\d+\/\d+/g;
const formatProxyNetworks = config.proxyNetworks const formatProxyNetworks = config.proxyNetworks
.split("\n") .split("\n")
.map((item) => item.trim()) .map(item => item.trim())
.filter((item) => item && reg.test(item)); .filter(item => item && reg.test(item));
args.push("--proxy-networks", ...formatProxyNetworks); args.push("--proxy-networks", ...formatProxyNetworks);
config.proxyNetworks = formatProxyNetworks.join("\n"); config.proxyNetworks = formatProxyNetworks.join("\n");
} }
@@ -842,7 +1113,7 @@
config.ipv4 = ""; config.ipv4 = "";
} }
const memberDialog = await getAllWebviewWindows(); const memberDialog = await getAllWebviewWindows();
const memberDialogs = memberDialog.filter((item) => item.label === "member"); const memberDialogs = memberDialog.filter(item => item.label === "member");
if (memberDialogs && memberDialogs.length > 0) { if (memberDialogs && memberDialogs.length > 0) {
data.memberVisible = false; data.memberVisible = false;
for (const memberDialog of memberDialogs) { for (const memberDialog of memberDialogs) {
@@ -861,14 +1132,16 @@
if (data.isStart) { if (data.isStart) {
await reset(); await reset();
} else { } else {
await setTrayTooltip(tray, "请求联机中...");
const args = await getArgs(); const args = await getArgs();
if (!args || args.length <= 0) { if (!args || args.length <= 0) {
return ElMessage.error("无配置"); await reset();
return;
} }
if (args[0] === "-c") { if (args[0] === "-c") {
ElMessage.warning({ ElMessage.warning({
message: "使用配置文件中.", message: "使用配置文件中.",
duration: 5000, duration: 5000
}); });
} }
data.log = ""; //清空日志 data.log = ""; //清空日志
@@ -877,7 +1150,7 @@
await listenObj.listenOutput(); await listenObj.listenOutput();
await invoke("run_command", { await invoke("run_command", {
args, args
}); });
} }
}; };
@@ -891,10 +1164,10 @@
if (isExists) { if (isExists) {
const entries = await readDir(path, { baseDir: BaseDirectory.Resource }); const entries = await readDir(path, { baseDir: BaseDirectory.Resource });
configStart.list = entries configStart.list = entries
.filter((item) => item.isFile) .filter(item => item.isFile)
.map((item) => ({ .map(item => ({
name: item.name, name: item.name,
path: `${path}${item.name}`, path: `${path}${item.name}`
})) as any; })) as any;
} else { } else {
mainStore.configStartEnable = false; mainStore.configStartEnable = false;
@@ -931,25 +1204,43 @@
importConfigData.data = ""; importConfigData.data = "";
importConfigData.visible = true; importConfigData.visible = true;
} }
if (command === "create_server") {
if (data.isStart) {
const [error] = await ElConfirmDanger("切换会停止{action},是否继续?", "提示", {
action: "`联机/服务`",
confirmButtonText: "继续",
cancelButtonText: "取消"
});
if (!error) await reset();
}
mainStore.enableCreateServer = !mainStore.enableCreateServer;
if (mainStore.config.relayAllPeerrpc && !mainStore.enableCreateServer) {
const [error] = await ElConfirmPrimary("是否关闭RPC流量转发?", "提示", {
confirmButtonText: "关闭",
cancelButtonText: "取消"
});
if (!error) mainStore.config.relayAllPeerrpc = false;
}
}
}; };
const handleStartImport = async () => { const handleStartImport = async () => {
try { const [err] = await ElConfirmPrimary("确定导入?", "提示", {
await ElMessageBox.confirm("确定导入?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消"
}); });
if (!err) {
const payload = JSON.parse(decodeURIComponent(atob(importConfigData.data))); const payload = JSON.parse(decodeURIComponent(atob(importConfigData.data)));
mainStore.$patch({ mainStore.$patch({
config: { config: {
...mainStore.config, ...mainStore.config,
...payload.config, ...payload.config
}, }
}); });
ElMessage.success("导入成功"); ElMessage.success("导入成功");
importConfigData.visible = false; importConfigData.visible = false;
mainStore.basePeers = uniq([config.serverUrl, ...mainStore.basePeers]); mainStore.basePeers = uniq([config.serverUrl, ...mainStore.basePeers]);
} catch (err) { } else {
console.error(err); console.error(err);
if (err !== "cancel") { if (err !== "cancel") {
ElMessage.error("导入失败"); ElMessage.error("导入失败");
@@ -992,7 +1283,7 @@
title: "成员列表", title: "成员列表",
width: 875, width: 875,
height: 380, height: 380,
url: "#/member", url: "#/member"
}, },
() => { () => {
data.memberVisible = true; data.memberVisible = true;
@@ -1011,14 +1302,14 @@
width: 600, width: 600,
height: 380, height: 380,
resizable: false, resizable: false,
url: "#/log", url: "#/log"
}, },
(_, appWindow) => { (_, appWindow) => {
data.logVisible = true; data.logVisible = true;
logsTimer && clearInterval(logsTimer); logsTimer && clearInterval(logsTimer);
logsTimer = setInterval(() => { logsTimer = setInterval(() => {
appWindow.emitTo("log", "logs", data.log); appWindow.emitTo("log", "logs", data.log);
}, 600); }, 650);
}, },
() => { () => {
data.logVisible = false; data.logVisible = false;
@@ -1034,7 +1325,7 @@
width: 600, width: 600,
height: 380, height: 380,
resizable: false, resizable: false,
url: "#/cidr", url: "#/cidr"
}, },
(_, appWindow) => { (_, appWindow) => {
data.cidrVisible = true; data.cidrVisible = true;
@@ -1053,7 +1344,7 @@
width: 600, width: 600,
height: 380, height: 380,
resizable: false, resizable: false,
url: "#/advance", url: "#/advance"
}, },
(_, appWindow) => { (_, appWindow) => {
data.advanceVisible = true; data.advanceVisible = true;
@@ -1072,7 +1363,7 @@
width: 460, width: 460,
height: 480, height: 480,
resizable: true, resizable: true,
url: "#/tool", url: "#/tool"
}, },
(_, appWindow) => { (_, appWindow) => {
data.toolVisible = true; data.toolVisible = true;
+30 -14
View File
@@ -6,21 +6,25 @@
stripe stripe
border border
:data="data.member" :data="data.member"
v-else> v-else
>
<ElTableColumn <ElTableColumn
sortable sortable
width="140" width="140"
label="主机名" label="主机名"
prop="hostname"></ElTableColumn> prop="hostname"
></ElTableColumn>
<ElTableColumn <ElTableColumn
sortable sortable
width="90" width="90"
prop="cost" prop="cost"
label="路由"> label="路由"
>
<template #default="{ row }"> <template #default="{ row }">
<ElTag <ElTag
effect="dark" effect="dark"
:type="row.cost == 'p2p' ? 'success' : 'info'"> :type="row.cost == 'p2p' ? 'success' : 'info'"
>
{{ row.cost }} {{ row.cost }}
</ElTag> </ElTag>
</template> </template>
@@ -29,17 +33,20 @@
sortable sortable
width="120" width="120"
prop="ipv4" prop="ipv4"
label="虚拟网IP"></ElTableColumn> label="虚拟网IP"
></ElTableColumn>
<ElTableColumn <ElTableColumn
sortable sortable
prop="lat_ms" prop="lat_ms"
width="130" width="130"
label="延迟/ms"></ElTableColumn> label="延迟/ms"
></ElTableColumn>
<ElTableColumn <ElTableColumn
sortable sortable
width="120" width="120"
prop="loss_rate" prop="loss_rate"
label="丢包率"> label="丢包率"
>
<template #default="{ row }"> <template #default="{ row }">
{{ row.loss_rate && row.loss_rate != "-" ? Number(row.loss_rate * 100).toFixed(2) + "%" : row.loss_rate }} {{ row.loss_rate && row.loss_rate != "-" ? Number(row.loss_rate * 100).toFixed(2) + "%" : row.loss_rate }}
</template> </template>
@@ -48,15 +55,23 @@
sortable sortable
width="120" width="120"
label="nat_type" label="nat_type"
prop="NAT类型"> prop="NAT类型"
>
<template #default="{ row }"> <template #default="{ row }">
{{ natMaps[row.nat_type.toLowerCase() as natKyes] || row.nat_type || "-" }} {{ natMaps[row.nat_type.toLowerCase() as natKyes] || row.nat_type || "-" }}
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn <ElTableColumn
sortable sortable
width="120"
prop="version" prop="version"
label="版本"></ElTableColumn> label="版本"
></ElTableColumn>
<ElTableColumn
sortable
prop="tunnel_proto"
label="隧道协议"
></ElTableColumn>
</ElTable> </ElTable>
</div> </div>
</div> </div>
@@ -86,14 +101,14 @@
restricted: "nat2", restricted: "nat2",
portrestricted: "nat3", portrestricted: "nat3",
symmetric: "nat4", symmetric: "nat4",
SymmetricEasyDec: "nat4-easydec", symmetriceasydec: "nat4-easydec",
SymmetricEasyInc: "nat4-easyinc", symmetriceasyinc: "nat4-easyinc",
SymUdpFirewall: "nat4-udpfirewall", symUdpfirewall: "nat4-udpfirewall"
}; };
type natKyes = keyof typeof natMaps; type natKyes = keyof typeof natMaps;
const data = reactive<{ member: any[] }>({ const data = reactive<{ member: any[] }>({
member: [], member: []
}); });
const _showTableHeader = [ const _showTableHeader = [
@@ -104,12 +119,13 @@
["loss_rate", "丢包率"], ["loss_rate", "丢包率"],
["nat_type", "NAT类型"], ["nat_type", "NAT类型"],
["version", "版本"], ["version", "版本"],
["tunnel_proto", "隧道协议"]
]; ];
const listenOutput = async () => { const listenOutput = async () => {
const member = await invoke<string>("get_members_by_cli"); const member = await invoke<string>("get_members_by_cli");
const peerInfo = parsePeerInfo(member); const peerInfo = parsePeerInfo(member);
peerInfo.forEach((value) => { peerInfo.forEach(value => {
if (value.cost === "Local") { if (value.cost === "Local") {
value.cost = "本机"; value.cost = "本机";
} }
+485 -153
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1176,7 +1176,7 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
[[package]] [[package]]
name = "easytier-game" name = "easytier-game"
version = "1.2.2" version = "1.2.6"
dependencies = [ dependencies = [
"log", "log",
"planif", "planif",
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "easytier-game" name = "easytier-game"
version = "1.2.2" version = "1.2.6"
homepage = "https://github.com/EasyTier/EasyTier" homepage = "https://github.com/EasyTier/EasyTier"
repository = "https://github.com/EasyTier/EasytierGame" repository = "https://github.com/EasyTier/EasytierGame"
description = "A simple network initiator based on Easytier" description = "A simple network initiator based on Easytier"
+2
View File
@@ -15,6 +15,8 @@
"core:window:allow-minimize", "core:window:allow-minimize",
"core:window:allow-hide", "core:window:allow-hide",
"core:window:allow-close", "core:window:allow-close",
"core:window:allow-set-focus",
"core:window:allow-is-visible",
"shell:allow-open", "shell:allow-open",
"core:window:allow-show", "core:window:allow-show",
"core:window:allow-create", "core:window:allow-create",
+57
View File
@@ -0,0 +1,57 @@
@echo off
chcp 65001 >nul
setlocal
REM 检查是否具有管理员权限
openfiles >nul 2>&1
if %errorlevel% neq 0 (
echo 当前没有管理员权限,鼠标右键clear_data.bat,选择使用管理员模式运行...
pause
exit /b
)
REM 获取当前用户的 Local 目录路径
set "local_dir=%LOCALAPPDATA%"
REM 设置要删除的任务计划程序文件夹名称
set "folder_name=\easytierGame"
set "task_name=auto start"
REM 设置要删除的目标文件夹
set "target_data_dir=%local_dir%\com.tauri.easytier-game"
echo ---
REM 打印 Local 目录路径
echo 当前数据目录: %target_data_dir%
echo ---
echo 您确定要清除EasytierGame的本地数据吗? (y/n)
echo ---
REM 等待用户输入
set /p confirm=输入'y/n'进行确认:
if /i "%confirm%"=="y" (
echo 清除数据中,请稍后...
echo ---
@REM REM 删除任务计划程序文件夹
echo delete auto_start task ...
echo ---
echo ---
schtasks /delete /tn "%folder_name%\%task_name%" /f
schtasks /delete /tn "%folder_name%" /f
echo ---
echo 开始清除本地缓存数据,没有使用开机自启上面就会报错,不影响数据清理...
if exist "%target_data_dir%" (
REM 删除目标文件夹及其内容
rd /s /q "%target_data_dir%"
)
echo 清除本地缓存数据完毕.
echo ---
echo 您可以手动删除EasytierGame目录下所有文件,即可完成卸载.
) else (
echo 取消清理数据
)
pause
endlocal
@@ -0,0 +1,77 @@
# 实例名称,用于在同一台机器上标识此节点
instance_name = ""
# 主机名,用于标识此设备的主机名
hostname = ""
# 实例 ID,一般为 UUID,在同一个虚拟网络中唯一
instance_id = ""
# 此节点的虚拟网 IPv4 地址,如果为空,则此节点将仅转发数据包,不会创建 TUN 设备
ipv4 = ""
# 由 Easytier 自动确定并设置IP地址,默认从10.0.0.1开始。警告:在使用 DHCP 时,如果网络中出现 IP 冲突,IP 将自动更改
dhcp = false
# 监听器列表,用于接受连接
listeners = [
"tcp://0.0.0.0:11010",
"udp://0.0.0.0:11010",
"wg://0.0.0.0:11011",
"ws://0.0.0.0:11011/",
"wss://0.0.0.0:11012/",
]
# 退出节点列表
exit_nodes = [
]
# 用于管理的 RPC 门户地址
rpc_portal = "127.0.0.1:15888"
[network_identity]
# 网络名称,用于标识虚拟网络
network_name = ""
# 网络密钥,用于验证此节点属于虚拟网络
network_secret = ""
# 这里是对等连接节点配置,可以多段配置
[[peer]]
uri = "tcp://public.easytier.top:11010"
[[peer]]
uri = "udp://public.easytier.top:11010"
# 这里是子网代理节点配置,可以有多段配置
[[proxy_network]]
cidr = "10.0.1.0/24"
[[proxy_network]]
cidr = "10.0.2.0/24"
# WireGuard 配置信息
[vpn_portal_config]
# WireGuard 客户端所在的网段,下面为示例
client_cidr = "10.14.14.0/24"
#wg所监听的端口(请勿和listeners的wg冲突)
wireguard_listen = "0.0.0.0:11012"
[flags]
# 连接到对等节点使用的默认协议
default_protocol = "tcp"
# TUN 设备名称,如果为空,则使用默认名称
dev_name = ""
# 禁用p2p
disable_p2p = false
# 是否启用加密
enable_encryption = true
# 是否启用 IPv6 支持
enable_ipv6 = true
# TUN 设备的 MTU
mtu = 1380
# 延迟优先模式,将尝试使用最低延迟路径转发流量,默认使用最短路径
latency_first = false
# 将本节点配置为退出节点
enable_exit_node = false
# 禁用 TUN 设备
no_tun = false
# 为子网代理启用 smoltcp 堆栈
use_smoltcp = false
# 仅转发白名单网络的流量,支持通配符字符串。多个网络名称间可以使用英文空格间隔。如果该参数为空,则禁用转发。默认允许所有网络。例如:'*'(所有网络),'def*'(以def为前缀的网络),'net1 net2'(只允许net1和net2
foreign_network_whitelist = "*"
-23
View File
@@ -1,23 +0,0 @@
hostname = "Test1"
instance_name = "default"
instance_id = "8803362c-e4f1-4df1-93e8-721653945f77"
dhcp = true
listeners = [
"tcp://0.0.0.0:11010",
"udp://0.0.0.0:11010",
"wg://0.0.0.0:11011",
"ws://0.0.0.0:11011/",
"wss://0.0.0.0:11012/",
]
exit_nodes = []
rpc_portal = "0.0.0.0:15888"
[network_identity]
network_name = "default"
network_secret = ""
[[peer]]
uri = "tcp://public.easytier.top:11010"
[[peer]]
uri = "udp://public.easytier.top:11010"
+6 -3
View File
@@ -1,7 +1,7 @@
{ {
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json", "$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "easytier-game", "productName": "easytier-game",
"version": "1.2.2", "version": "1.2.6",
"identifier": "com.tauri.easytier-game", "identifier": "com.tauri.easytier-game",
"build": { "build": {
@@ -13,7 +13,7 @@
"app": { "app": {
"windows": [ "windows": [
{ {
"title": "easytier-game 1.2.2", "title": "easytier-game 1.2.6",
"label": "main", "label": "main",
"minWidth": 340, "minWidth": 340,
"width": 340, "width": 340,
@@ -43,10 +43,13 @@
"easytier/icons/", "easytier/icons/",
"easytier/config_template.json", "easytier/config_template.json",
"easytier/tool/WinIPBroadcast.exe", "easytier/tool/WinIPBroadcast.exe",
"easytier/tool/MicrosoftEdgeWebview2Setup.exe",
"easytier/easytier-cli.exe", "easytier/easytier-cli.exe",
"easytier/easytier-core.exe", "easytier/easytier-core.exe",
"easytier/Packet.dll", "easytier/Packet.dll",
"easytier/wintun.dll" "easytier/wintun.dll",
"easytier/clear_local_data.bat",
"帮助.txt"
], ],
"windows": { "windows": {
"webviewInstallMode": { "webviewInstallMode": {
+16
View File
@@ -0,0 +1,16 @@
[如果界面无法打开]
1. 如果您已经启动easytier-game.exe,那它可能会在后台运行,打开任务管理器关闭easytier-game.exe
2. 使用easytier-game安装目录下的 easytier/tool/MicrosoftEdgeWebview2Setup.exe 安装webview2
3. 再次启用easytier-game.exe
[如果想彻底删除easytierGame]
1. 关闭easytierGame
2. 运行easytier-game安装目录下的 easytier/clear_local_data.bat (需要管理员权限) 输入y确认,清除本地存储数据
3. 删除easytierGame文件夹
+11 -2
View File
@@ -14,7 +14,7 @@ export default defineStore("main", {
connectAfterStart: false, //软件打开后,是否自动连接 connectAfterStart: false, //软件打开后,是否自动连接
disableIpv6: false, // 是否禁用IPv6 disableIpv6: false, // 是否禁用IPv6
disbleListenner: false, // 是否禁用监听 disbleListenner: false, // 是否禁用监听
disableEncryption: false, // 是否禁用加密 disableEncryption: true, // 是否禁用加密
multiThread: false, //使用多线程 multiThread: false, //使用多线程
enablExitNode: false, // 是否启用退出节点 enablExitNode: false, // 是否启用退出节点
noTun: false, // 是否使用TUN noTun: false, // 是否使用TUN
@@ -38,6 +38,10 @@ export default defineStore("main", {
configPath: "", //配置文件路径 configPath: "", //配置文件路径
winIpBcAutoStart: true, winIpBcAutoStart: true,
createConfigInEasytier: false, //在easytier目录生成config.json文件吗 createConfigInEasytier: false, //在easytier目录生成config.json文件吗
githubFastUrl: "https://ghproxy.cc/",
enableCreateServer: false, // 自建服务器
enableWhiteList: true, // 是否启用白名单
ServerWhiteList: "", // 服务器流量转发白名单
winipBcPid: 0, winipBcPid: 0,
winipBcStart: false winipBcStart: false
@@ -80,7 +84,12 @@ export default defineStore("main", {
"configStartEnable", "configStartEnable",
"configPath", "configPath",
"winIpBcAutoStart", "winIpBcAutoStart",
"createConfigInEasytier" "createConfigInEasytier",
"githubFastUrl",
"enableCreateServer",
"enableWhiteList",
"ServerWhiteList"
], ],
// // 除了这些,其他都要存下来 // // 除了这些,其他都要存下来
// omit: ["winipBcPid", "winipBcStart"] // omit: ["winipBcPid", "winipBcStart"]
+9 -5
View File
@@ -1,6 +1,6 @@
import { open } from "@tauri-apps/plugin-shell";
export const ENV = import.meta.env; export const ENV = import.meta.env;
//防抖 //防抖
export const bounce = (time = 3000) => { export const bounce = (time = 3000) => {
let bounceTimer: NodeJS.Timeout | null = null; let bounceTimer: NodeJS.Timeout | null = null;
@@ -50,8 +50,8 @@ export const numRemoveZero = (num: Number) => {
// await-to-js // await-to-js
export const ATJ = (promise: Promise<any>, errorExt: string | undefined = undefined) => { export const ATJ = (promise: Promise<any>, errorExt: string | undefined = undefined) => {
return promise return promise
.then(data => [null, data]) .then((data) => [null, data])
.catch(err => { .catch((err) => {
if (errorExt) { if (errorExt) {
if (typeof errorExt !== "object") { if (typeof errorExt !== "object") {
return [errorExt, undefined]; return [errorExt, undefined];
@@ -72,7 +72,7 @@ export const parsePeerInfo = (content: string) => {
const headers = lines[1] const headers = lines[1]
.split("│") .split("│")
.slice(1, -1) .slice(1, -1)
.map(h => h.trim()); .map((h) => h.trim());
// 初始化结果数组 // 初始化结果数组
const result: any[] = []; const result: any[] = [];
@@ -85,7 +85,7 @@ export const parsePeerInfo = (content: string) => {
const values = lines[i] const values = lines[i]
.split("│") .split("│")
.slice(1, -1) .slice(1, -1)
.map(v => v.trim()); .map((v) => v.trim());
// 创建对象并添加到结果数组 // 创建对象并添加到结果数组
const obj: any = {}; const obj: any = {};
@@ -100,6 +100,10 @@ export const parsePeerInfo = (content: string) => {
return result; return result;
}; };
export const addQQGroup = () => {
open("https://qm.qq.com/q/Yo3HmaEIWC");
};
export function isValidIP(ip: string) { export function isValidIP(ip: string) {
const ipv4Pattern = const ipv4Pattern =
/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/; /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
+66
View File
@@ -0,0 +1,66 @@
/**
* 生成 release 发布包 zip 文件
*/
const releaseDir = "./src-tauri/target/release";
const releaseDirEasytier = `${releaseDir}/easytier/`;
const releaseExe = `${releaseDir}/easytier-game.exe`;
const releaseHelp = `${releaseDir}/帮助.txt`;
const deleteEasytierFiles = ["logs/", "guiLogs/"];
const pkg = require("./package.json");
const fileName = `easytier-game_windows_x86_64_${pkg.version}.zip`; // 发布包格式
const releaseZipDir = "./release";
const releaseZip = `${releaseZipDir}/${fileName}`;
const fs = require("fs");
const path = require("path");
const archiver = require("archiver");
const output = fs.createWriteStream(path.join(__dirname, releaseZip));
const archive = archiver("zip", {
zlib: { level: 8 } // Sets the compression level.
});
// listen for all archive data to be written
// 'close' event is fired only when a file descriptor is involved
output.on("close", function () {
console.log(archive.pointer() + " total bytes");
console.log(`archiver has been finalized and the output ${releaseZip}`);
});
// This event is fired when the data source is drained no matter what was the data source.
// It is not part of this library but rather from the NodeJS Stream API.
// @see: https://nodejs.org/api/stream.html#stream_event_end
output.on("end", function () {
console.log("Data has been drained");
});
// good practice to catch warnings (ie stat failures and other non-blocking errors)
archive.on("warning", function (err) {
if (err.code === "ENOENT") {
// log warning
} else {
// throw error
throw err;
}
});
archive.on("error", function (err) {
throw err;
});
for (const f of deleteEasytierFiles) {
fs.rmSync(path.join(__dirname, releaseDirEasytier + f), { recursive: true, force: true });
}
const r = path.join(__dirname, releaseZipDir);
if (!fs.existsSync(r)) {
fs.mkdirSync(r);
}
// pipe archive data to the file
archive.pipe(output);
archive
.append(fs.createReadStream(path.join(__dirname, releaseExe)), { name: "easytier-game.exe" })
.append(fs.createReadStream(path.join(__dirname, releaseHelp)), { name: "帮助.txt" })
.directory(path.join(__dirname, releaseDirEasytier), "easytier")
.finalize();