Compare commits

..
11 Commits
Author SHA1 Message Date
黑先森 bc66a13fbf #Fix 新配置没有持久化的问题 #35 2026-05-14 21:42:52 +08:00
黑先森 89913eeebc #Update 更新构建流程,更新所有包体,发布1.5.4 2026-05-13 22:23:56 +08:00
黑先森 1f344f1d65 #Update 增加对2.6.1-2.6.4的高级配置,更新easytier为最新版 2026-05-13 21:42:38 +08:00
黑先森 fb5e5bfff0 #Update 修复多子网代理失败的bug #31,更新包体 2026-04-12 00:19:35 +08:00
黑先森 70c3217ab5 #Update 增加txt协议,更新包体,修复停止联机后的依旧显示联机成功的问题 2026-01-06 22:45:52 +08:00
黑先森 e91bd07ce8 #Update 更新包体 2025-12-16 14:18:17 +08:00
黑先森 9f63d9bf2e #Update 开机自启兼容配置改为win7 优化联机是否成功的判断方式
#Update 开机自启兼容配置改为win7 优化联机是否成功的判断方式

优化联机是否成功的判断方式

版本号更新->1.5.3
2025-11-18 16:42:58 +08:00
黑先森 94968401fc #Update 为公共服务列表增加输入筛选,为成员列表增加kcp代理和quic代理等提示,config.json增加相关配置并更新config_template.json说明文档 #23 2025-11-07 16:44:00 +08:00
黑先森 86adc2c40b #Update 增加对成员列表kcp和quic代理显示 增加部分配置到configJson #23 2025-11-06 18:31:10 +08:00
黑先森 6b373a3ed6 #Update 优化构建流程 2025-11-03 16:13:50 +08:00
黑先森 fa480a8162 #Update 将“子网代理”按钮移至启动联机下拉菜单内,将“分享和导入配置按钮“移到主界面 2025-11-03 15:20:28 +08:00
25 changed files with 4201 additions and 4769 deletions
+1
View File
@@ -10,6 +10,7 @@ dist
.idea .idea
.vscode .vscode
release release
target
src-tauri/easytier/logs src-tauri/easytier/logs
src-tauri/easytier/tool/ResourcesExtract.exe src-tauri/easytier/tool/ResourcesExtract.exe
-12
View File
@@ -1,12 +0,0 @@
pnpm run build
rustup default nightly
@REM rem 使用rust nightly构建支持win7的版本,请先将根目录的windows.0.48.5 放入以下目录
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\lib\x64
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\lib\x86
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\atlmfc\lib\x64
@REM rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\atlmfc\lib\x86
pnpm tauri build -- -Z build-std --target x86_64-win7-windows-msvc
rustup default stable
pnpm tauri build
pnpm run release
pnpm run release-win7
+2 -7
View File
@@ -7,7 +7,7 @@ import { bounce } from "~/utils";
const b = bounce(600); const b = bounce(600);
export type ConfigServerUrlType = Array<string>; export type ConfigServerUrlType = Array<string>;
export const updateConfigJsonBounce = (configJsonSeverUrl?: ConfigServerUrlType) => { export const updateConfigJsonBounce = (configJsonSeverUrl?: ConfigServerUrlType | null) => {
b(async () => { b(async () => {
const mainStore = useMainStore(); const mainStore = useMainStore();
if (mainStore.createConfigInEasytier) { if (mainStore.createConfigInEasytier) {
@@ -16,7 +16,7 @@ export const updateConfigJsonBounce = (configJsonSeverUrl?: ConfigServerUrlType)
}); });
}; };
export const updateConfigJson = async (configJsonSeverUrl?: ConfigServerUrlType) => { export const updateConfigJson = async (configJsonSeverUrl?: ConfigServerUrlType | null) => {
const mainStore = useMainStore(); const mainStore = useMainStore();
const path = import.meta.env.VITE_CONFIG_FILE_NAME; const path = import.meta.env.VITE_CONFIG_FILE_NAME;
if (isNil(configJsonSeverUrl)) { if (isNil(configJsonSeverUrl)) {
@@ -30,7 +30,6 @@ export const updateConfigJson = async (configJsonSeverUrl?: ConfigServerUrlType)
const { const {
proxyNetworks, proxyNetworks,
autoStart, autoStart,
connectAfterStart,
saveErrorLog, saveErrorLog,
serverUrl, serverUrl,
enableCustomListener, enableCustomListener,
@@ -39,10 +38,6 @@ export const updateConfigJson = async (configJsonSeverUrl?: ConfigServerUrlType)
acceptDNS, acceptDNS,
enablePortForward, enablePortForward,
portForwardData, portForwardData,
tcpWhitelist,
udpWhitelist,
tcpWhitelistEnable,
udpWhitelistEnable,
...otherConfig ...otherConfig
} = mainStore.config; } = mainStore.config;
let writeServerUrl: Array<string> = serverUrl; let writeServerUrl: Array<string> = serverUrl;
+6
View File
@@ -31,6 +31,12 @@ export const getServerArgs = () => {
if (networkSecret) { if (networkSecret) {
args.push("--network-secret", networkSecret); args.push("--network-secret", networkSecret);
} }
if (mainStore.serverConfig.ipv6PublicAddrProvider) {
args.push("--ipv6-public-addr-provider", "true");
}
if (mainStore.serverConfig.disableRelayData) {
args.push("--disable-relay-data", "true");
}
return args; return args;
}; };
+24 -21
View File
@@ -3,7 +3,7 @@
"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.5.1", "version": "1.5.5",
"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",
@@ -11,32 +11,35 @@
"release-win7": "node zip.js win7" "release-win7": "node zip.js win7"
}, },
"devDependencies": { "devDependencies": {
"@element-plus/icons-vue": "^2.3.2", "@element-plus/icons-vue": "2.3.2",
"@element-plus/nuxt": "1.1.4", "@element-plus/nuxt": "1.1.4",
"@nuxtjs/tailwindcss": "6.13.2", "@nuxtjs/tailwindcss": "6.13.2",
"@oxc-minify/binding-win32-x64-msvc": "^0.107.0",
"@oxc-parser/binding-win32-x64-msvc": "^0.107.0",
"@oxc-transform/binding-win32-x64-msvc": "^0.107.0",
"@pinia/nuxt": "0.11.2", "@pinia/nuxt": "0.11.2",
"@tauri-apps/api": "2.9.0", "@tauri-apps/api": "2.11.0",
"@tauri-apps/cli": "2.9.1", "@tauri-apps/cli": "2.11.1",
"@tauri-apps/plugin-cli": "2.4.0", "@tauri-apps/plugin-cli": "2.4.1",
"@tauri-apps/plugin-clipboard-manager": "2.3.0", "@tauri-apps/plugin-clipboard-manager": "2.3.2",
"@tauri-apps/plugin-dialog": "2.4.0", "@tauri-apps/plugin-dialog": "2.7.1",
"@tauri-apps/plugin-fs": "2.4.2", "@tauri-apps/plugin-fs": "2.5.1",
"@tauri-apps/plugin-log": "2.7.0", "@tauri-apps/plugin-log": "2.8.0",
"@tauri-apps/plugin-shell": "2.3.1", "@tauri-apps/plugin-shell": "2.3.5",
"@tauri-apps/plugin-window-state": "2.4.0", "@tauri-apps/plugin-window-state": "2.4.1",
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "4.17.12",
"@vitejs/plugin-vue-jsx": "5.1.1", "@vitejs/plugin-vue-jsx": "5.1.1",
"@vueuse/core": "12.7.0", "@vueuse/core": "12.7.0",
"archiver": "^7.0.1", "archiver": "7.0.1",
"element-plus": "2.11.5", "element-plus": "2.13.0",
"less": "4.2.1", "less": "4.2.1",
"lodash-es": "^4.17.21", "lodash-es": "4.17.21",
"nuxt": "3.19.2", "nuxt": "3.20.2",
"pinia": "3.0.3", "pinia": "3.0.4",
"pinia-plugin-persistedstate": "4.5.0", "pinia-plugin-persistedstate": "4.7.1",
"postcss": "^8.4.38", "postcss": "8.4.49",
"prettier": "3.6.2", "prettier": "3.7.4",
"prettier-plugin-tailwindcss": "0.6.14" "prettier-plugin-tailwindcss": "0.7.2"
}, },
"dependencies": { "dependencies": {
"is-ip": "^5.0.1" "is-ip": "^5.0.1"
+49 -3
View File
@@ -37,6 +37,15 @@
</ElButton> </ElButton>
</div> </div>
<div><ElCheckbox v-model="mainStore.config.enablePreventSleep">防止系统休眠(比如:屏幕会一直亮着)</ElCheckbox></div> <div><ElCheckbox v-model="mainStore.config.enablePreventSleep">防止系统休眠(比如:屏幕会一直亮着)</ElCheckbox></div>
<div class="flex flex-nowrap items-center gap-[5px]">
<ElCheckbox v-model="mainStore.config.enableUdpBroadcastRelay">Windows UDP 广播中继</ElCheckbox>
<ElTooltip
content="开启后,虚拟网络内的其他设备可以接收到本机发出的 UDP 广播包,让依赖局域网广播的应用(如局域网游戏发现、DLNA 投屏)在虚拟网络中正常工作"
>
<ElIcon><QuestionFilled /></ElIcon>
</ElTooltip>
<CoreVersionWarning version="2.6.4" />
</div>
<div class="flex flex-nowrap items-center gap-[5px]"> <div class="flex flex-nowrap items-center gap-[5px]">
<ElCheckbox v-model="mainStore.config.latencyfirst">使用低延迟模式</ElCheckbox> <ElCheckbox v-model="mainStore.config.latencyfirst">使用低延迟模式</ElCheckbox>
<ElTooltip content="弱网环境下可能会导致网络延迟延迟忽高忽低"> <ElTooltip content="弱网环境下可能会导致网络延迟延迟忽高忽低">
@@ -98,14 +107,22 @@
<CoreVersionWarning version="2.3.1" /> <CoreVersionWarning version="2.3.1" />
</div> </div>
<ElDivider /> <ElDivider />
<div class="flex w-full flex-nowrap items-center gap-[5px] mb-[3px]"> <div class="mb-[3px] flex w-full flex-nowrap items-center gap-[5px]">
<ElCheckbox v-model="mainStore.config.tcpWhitelistEnable">TCP端口白名单</ElCheckbox> <ElCheckbox v-model="mainStore.config.tcpWhitelistEnable">TCP端口白名单</ElCheckbox>
<ElInput class="flex-1" v-model="mainStore.config.tcpWhitelist" placeholder="支持单个端口(80)和范围(8000-9000)" /> <ElInput
class="flex-1"
v-model="mainStore.config.tcpWhitelist"
placeholder="支持单个端口(80)和范围(8000-9000)"
/>
<CoreVersionWarning version="2.4.2" /> <CoreVersionWarning version="2.4.2" />
</div> </div>
<div class="flex w-full flex-nowrap items-center gap-[5px]"> <div class="flex w-full flex-nowrap items-center gap-[5px]">
<ElCheckbox v-model="mainStore.config.udpWhitelistEnable">UDP端口白名单</ElCheckbox> <ElCheckbox v-model="mainStore.config.udpWhitelistEnable">UDP端口白名单</ElCheckbox>
<ElInput class="flex-1" v-model="mainStore.config.udpWhitelist" placeholder="支持单个端口(53)和范围(5000-6000)" /> <ElInput
class="flex-1"
v-model="mainStore.config.udpWhitelist"
placeholder="支持单个端口(53)和范围(5000-6000)"
/>
<CoreVersionWarning version="2.4.2" /> <CoreVersionWarning version="2.4.2" />
</div> </div>
<div class="flex items-center gap-[10px]"> <div class="flex items-center gap-[10px]">
@@ -352,6 +369,35 @@
打开日志目录 打开日志目录
</ElButton> </ElButton>
</div> </div>
<ElDivider />
<div class="flex flex-nowrap items-center gap-[5px]">
<ElCheckbox v-model="mainStore.config.enableUpnp">UPnP 端口映射</ElCheckbox>
<ElTooltip content="自动向路由器请求端口映射,默认开启,启动时无需额外配置">
<ElIcon><QuestionFilled /></ElIcon>
</ElTooltip>
<CoreVersionWarning version="2.6.2" />
</div>
<div class="flex flex-nowrap items-center gap-[5px]">
<ElCheckbox v-model="mainStore.config.ipv6PublicAddrProvider">公网 IPv6 地址前缀提供</ElCheckbox>
<ElTooltip content="持有公网 IPv6 前缀的节点可开启,让同网络下其他节点自动获取独立公网地址">
<ElIcon><QuestionFilled /></ElIcon>
</ElTooltip>
<CoreVersionWarning version="2.6.2" />
</div>
<div class="flex flex-nowrap items-center gap-[5px]">
<ElCheckbox v-model="mainStore.config.ipv6PublicAddrAuto">公网 IPv6 地址自动获取</ElCheckbox>
<ElTooltip content="从持有公网 IPv6 前缀的提供者节点自动获取独立公网地址">
<ElIcon><QuestionFilled /></ElIcon>
</ElTooltip>
<CoreVersionWarning version="2.6.2" />
</div>
<div class="flex flex-nowrap items-center gap-[5px]">
<ElCheckbox v-model="mainStore.config.disableRelayData">禁用 Relay 数据转发</ElCheckbox>
<ElTooltip content="禁止节点转发 relay 数据流量而保留控制面功能,适用于不希望本节点承担中继带宽的场景">
<ElIcon><QuestionFilled /></ElIcon>
</ElTooltip>
<CoreVersionWarning version="2.6.3" />
</div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
+101 -152
View File
@@ -337,6 +337,12 @@
<ElDivider class="!m-0 !h-[2px]" /> <ElDivider class="!m-0 !h-[2px]" />
</ElDropdownItem> </ElDropdownItem>
<ElDropdownItem <ElDropdownItem
command="cidr"
:icon="Share"
>
子网代理
</ElDropdownItem>
<!-- <ElDropdownItem
command="import_config" command="import_config"
:icon="Link" :icon="Link"
> >
@@ -347,7 +353,7 @@
:icon="Share" :icon="Share"
> >
分享联机配置 分享联机配置
</ElDropdownItem> </ElDropdownItem> -->
<ElDropdownItem <ElDropdownItem
command="reconnect" command="reconnect"
:icon="RefreshRight" :icon="RefreshRight"
@@ -406,21 +412,32 @@
开机自启 开机自启
</ElCheckbox> </ElCheckbox>
</ElTooltip> </ElTooltip>
<div> <div class="flex items-center gap-[0_2px]">
<ElButton <ElDropdown
@click="handleShowCidrDialog" @command="handleStartCommand"
:icon="Share" trigger="click"
size="small" :show-arrow="false"
> >
子网代理 <ElButton
</ElButton> :icon="Share"
<ElButton size="small"
@click="handleShowAdvanceDialog" >
:icon="Setting" 分享/导入
size="small" </ElButton>
> <template #dropdown>
高级选项 <el-dropdown-item command="share_config">分享联机配置</el-dropdown-item>
</ElButton> <el-dropdown-item command="import_config">导入联机配置</el-dropdown-item>
</template>
</ElDropdown>
<div>
<ElButton
@click="handleShowAdvanceDialog"
:icon="Setting"
size="small"
>
高级选项
</ElButton>
</div>
</div> </div>
<div class="flex items-center gap-[0_5px]"> <div class="flex items-center gap-[0_5px]">
<div> <div>
@@ -982,6 +999,7 @@
mainStore.basePeers = uniq([...mainStore.config.serverUrl, ...mainStore.basePeers]); mainStore.basePeers = uniq([...mainStore.config.serverUrl, ...mainStore.basePeers]);
}; };
let getMemeberTimer: number | null = null;
const listenObj: { [key: string]: any } = { const listenObj: { [key: string]: any } = {
unListenOutPut: null, unListenOutPut: null,
unListenThreadId: null, unListenThreadId: null,
@@ -992,31 +1010,34 @@
server_thread_id: ref(null), server_thread_id: ref(null),
async listenOutput() { async listenOutput() {
// const appWindow = getCurrentWindow(); // const appWindow = getCurrentWindow();
const unListen = await listen<string>("command-output", async event => { getMemeberTimer && clearInterval(getMemeberTimer);
data.isStart = true; getMemeberTimer = setInterval(async () => {
// console.error(event.payload); const [error, member] = await ATJ(invoke<string>("get_members_by_cli"));
if (event.payload) { if(!data.isStart) {
data.startLoading = false; getMemeberTimer && clearInterval(getMemeberTimer);
let ipv4 = /dhcp ip changed. old: None, new: Some\((\d+\.\d+\.\d+\.\d+).*\)/g.exec(event.payload as string)?.[1]; getMemeberTimer = null;
let devName = /tun device ready. dev: (.*)/g.exec(event.payload as string)?.[1]; ipReset();
if (mainStore.configStartEnable || mainStore.config.dhcp) { return;
let configIpv4 = /ipv4\s.*=\s.*[\'\"](\d+\.\d+\.\d+\.\d+).*[\'\"]/g.exec(event.payload as string)?.[1]; }
if (configIpv4) { if (!error && member !== "_EasytierGameCliFailedToConnect_") {
mainStore.config.ipv4 = configIpv4; const memberJson = JSON.parse(member) as Member[];
} const localData = memberJson.find(member => member?.cost == "Local");
} const ipv4 = localData?.ipv4;
// if (event.payload.includes("peer connection removed")) { if (localData && ipv4) {
// data.isSuccessGetIp = false; mainStore.config.ipv4 = ipv4;
// }
if (event.payload.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: ${mainStore.config.ipv4}`); await setTrayTooltip(tray, `IP: ${mainStore.config.ipv4}`);
return;
} }
if (ipv4) { ipReset();
mainStore.config.ipv4 = ipv4; }
await setTrayTooltip(tray, `IP: ${ipv4}`); }, 1000);
} const unListen = await listen<string>("command-output", async event => {
data.isStart = true;
if (event.payload) {
data.startLoading = false;
let devName = /tun device ready. dev: (.*)/g.exec(event.payload as string)?.[1];
if ( if (
devName && devName &&
mainStore.config.enableNetCardMetric && mainStore.config.enableNetCardMetric &&
@@ -1043,7 +1064,10 @@
data.log = logArr.slice(start).join("\n"); data.log = logArr.slice(start).join("\n");
data.log += (event.payload as string) + "\n"; data.log += (event.payload as string) + "\n";
}); });
this.unListenOutPut = unListen; this.unListenOutPut = () => {
getMemeberTimer && clearInterval(getMemeberTimer);
unListen();
};
}, },
async listenThreadId() { async listenThreadId() {
const unListen = await listen("thread-id", event => { const unListen = await listen("thread-id", event => {
@@ -1172,7 +1196,6 @@
); );
}; };
let unlistenDownload: UnlistenFn | null = null; let unlistenDownload: UnlistenFn | null = null;
let unlistenDownloadError: UnlistenFn | null = null; let unlistenDownloadError: UnlistenFn | null = null;
let progress = ref<number>(0); let progress = ref<number>(0);
@@ -1386,101 +1409,6 @@
}); });
}; };
// 过滤可用节点的函数
const filterAvailableNodes = (nodes: NodeItem[]): NodeItem[] => {
return nodes.filter(node => {
// 基本条件:节点必须激活且被批准
if (!node.is_active || !node.is_approved) {
return false;
}
// 健康状态检查
if (node.current_health_status !== "healthy") {
return false;
}
// 使用率检查:使用率不能超过95%
if (node.usage_percentage > 95) {
return false;
}
// 24小时健康率检查:必须大于90%
if (node.health_percentage_24h < 90) {
return false;
}
// 响应时间检查:响应时间不能超过60秒
if (node.last_response_time > 60000) {
return false;
}
// 连接数检查:当前连接数不能超过最大连接数的90%
if (node.current_connections > node.max_connections * 0.9) {
return false;
}
// 必须有有效的地址
if (!node.address || !node.host || !node.port) {
return false;
}
return true;
});
};
// 按优先级排序节点的函数
const sortNodesByPriority = (nodes: NodeItem[]): NodeItem[] => {
return nodes.sort((a, b) => {
// 优先级排序规则:
// 1. 响应时间越短越好
// 2. 使用率越低越好
// 3. 24小时健康率越高越好
// 4. 当前连接数越少越好
// 响应时间权重最高
const responseTimeDiff = a.last_response_time - b.last_response_time;
if (Math.abs(responseTimeDiff) > 1000) {
// 如果响应时间差异超过1秒
return responseTimeDiff;
}
// 使用率权重次之
const usageDiff = a.usage_percentage - b.usage_percentage;
if (Math.abs(usageDiff) > 5) {
// 如果使用率差异超过5%
return usageDiff;
}
// 24小时健康率
const healthDiff = b.health_percentage_24h - a.health_percentage_24h;
if (Math.abs(healthDiff) > 1) {
// 如果健康率差异超过1%
return healthDiff;
}
// 当前连接数
return a.current_connections - b.current_connections;
});
};
// 将节点添加到服务器列表的函数
const addNodesToServerList = (nodes: NodeItem[]) => {
// 提取服务器地址
const serverAddresses = nodes.map(node => node.address.replace(`${node.protocol}://`, ""));
// 去重并添加到基础服务器列表
const uniqueAddresses = uniq([...serverAddresses, ...mainStore.basePeers]);
mainStore.basePeers = uniqueAddresses;
// 如果当前没有选择服务器,自动选择第一个最佳节点
if (mainStore.config.serverUrl.length === 0 && serverAddresses.length > 0) {
mainStore.config.serverUrl = [serverAddresses[0]];
console.log(`自动选择最佳服务器: ${serverAddresses[0]}`);
}
console.log(`已添加 ${serverAddresses.length} 个可用服务器到列表`);
};
let logsTimer: number | null = null; let logsTimer: number | null = null;
let serverLogsTimer: number | null = null; let serverLogsTimer: number | null = null;
let cidrTimer: number | null = null; let cidrTimer: number | null = null;
@@ -1506,7 +1434,6 @@
checkNewVersion(); checkNewVersion();
} }
await storageDialog(); await storageDialog();
}); });
// storageEventEmitter.addEventListener("localStorageChange", () => { // storageEventEmitter.addEventListener("localStorageChange", () => {
@@ -1519,7 +1446,6 @@
return data.configJsonSeverUrl; return data.configJsonSeverUrl;
}); });
onBeforeUnmount(() => { onBeforeUnmount(() => {
unListenAll(); unListenAll();
listenObj.unListenReleaseList && listenObj.unListenReleaseList(); listenObj.unListenReleaseList && listenObj.unListenReleaseList();
@@ -1529,7 +1455,6 @@
cidrTimer && clearInterval(cidrTimer); cidrTimer && clearInterval(cidrTimer);
stopPreventSleep(); stopPreventSleep();
// unListenStorage && unListenStorage(); // unListenStorage && unListenStorage();
}); });
const getArgs = async () => { const getArgs = async () => {
@@ -1600,7 +1525,7 @@
args.push("--disable-p2p"); args.push("--disable-p2p");
} }
if (mainStore.config.disableIpv6) { if (mainStore.config.disableIpv6) {
args.push("--disable-ipv6"); args.push("--disable-ipv6", "true");
} }
if (mainStore.config.disbleListenner) { if (mainStore.config.disbleListenner) {
args.push("--no-listener"); args.push("--no-listener");
@@ -1627,33 +1552,35 @@
return /^\d+\.\d+\.\d+\.\d+\/\d+$/g.test(cidr); return /^\d+\.\d+\.\d+\.\d+\/\d+$/g.test(cidr);
}); });
if (newformatProxyNetworks.length > 0) { if (newformatProxyNetworks.length > 0) {
args.push("--proxy-networks", ...newformatProxyNetworks); for(const cidr of newformatProxyNetworks) {
args.push("-n", cidr);
}
} }
mainStore.config.proxyNetworks = formatProxyNetworks.join("\n"); mainStore.config.proxyNetworks = formatProxyNetworks.join("\n");
} }
if (mainStore.config.disableEncryption) { if (mainStore.config.disableEncryption) {
args.push("--disable-encryption"); args.push("--disable-encryption", "true");
} }
if (mainStore.config.multiThread) { if (mainStore.config.multiThread) {
args.push("--multi-thread"); args.push("--multi-thread", "true");
} }
if (mainStore.config.enablExitNode) { if (mainStore.config.enablExitNode) {
args.push("--enable-exit-node"); args.push("--enable-exit-node", "true");
} }
if (mainStore.config.noTun) { if (mainStore.config.noTun) {
args.push("--no-tun"); args.push("--no-tun", "true");
} }
if (mainStore.config.latencyfirst) { if (mainStore.config.latencyfirst) {
args.push("--latency-first"); args.push("--latency-first", "true");
} }
if (mainStore.config.useSmoltcp) { if (mainStore.config.useSmoltcp) {
args.push("--use-smoltcp"); args.push("--use-smoltcp", "true");
} }
if (mainStore.config.disableUdpHolePunching) { if (mainStore.config.disableUdpHolePunching) {
args.push("--disable-udp-hole-punching"); args.push("--disable-udp-hole-punching", "true");
} }
if (mainStore.config.relayAllPeerrpc) { if (mainStore.config.relayAllPeerrpc) {
args.push("--relay-all-peer-rpc"); args.push("--relay-all-peer-rpc", "true");
} }
if (mainStore.config.saveErrorLog) { if (mainStore.config.saveErrorLog) {
args.push("--file-log-level", mainStore.config.logLevel, "--file-log-dir", import.meta.env.VITE_LOG_PATH); args.push("--file-log-level", mainStore.config.logLevel, "--file-log-dir", import.meta.env.VITE_LOG_PATH);
@@ -1676,11 +1603,26 @@
if (mainStore.config.disableQuicInput) { if (mainStore.config.disableQuicInput) {
args.push("--disable-quic-input", "true"); args.push("--disable-quic-input", "true");
} }
if (mainStore.config.enableUdpBroadcastRelay) {
args.push("--enable-udp-broadcast-relay", "true");
}
if (!mainStore.config.enableUpnp) {
args.push("--disable-upnp", "true");
}
if (mainStore.config.ipv6PublicAddrProvider) {
args.push("--ipv6-public-addr-provider", "true");
}
if (mainStore.config.ipv6PublicAddrAuto) {
args.push("--ipv6-public-addr-auto", "true");
}
if (mainStore.config.disableRelayData) {
args.push("--disable-relay-data", "true");
}
if (mainStore.config.bindDeviceEnable) { if (mainStore.config.bindDeviceEnable) {
args.push("--bind-device", "true"); args.push("--bind-device", "true");
} }
if (mainStore.proxyForwardBySystem) { if (mainStore.proxyForwardBySystem) {
args.push("--proxy-forward-by-system"); args.push("--proxy-forward-by-system", "true");
} }
if (mainStore.config.acceptDNS) { if (mainStore.config.acceptDNS) {
args.push("--accept-dns", "true"); args.push("--accept-dns", "true");
@@ -1711,12 +1653,17 @@
return args; return args;
}; };
const reset = async () => { const ipReset = async () => {
data.isStart = false;
data.isSuccessGetIp = false; data.isSuccessGetIp = false;
if (mainStore.config.dhcp) { if (mainStore.config.dhcp) {
mainStore.config.ipv4 = ""; mainStore.config.ipv4 = "";
} }
await setTrayRunState(tray, false);
await setTrayTooltip(tray);
};
const reset = async () => {
data.isStart = false;
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) {
@@ -1728,9 +1675,8 @@
} }
} }
} }
await setTrayRunState(tray, false);
await setTrayTooltip(tray);
await unListenAll(); await unListenAll();
await ipReset();
}; };
const handleConnection = async () => { const handleConnection = async () => {
@@ -1879,6 +1825,9 @@
if (command === "create_server") { if (command === "create_server") {
await handleShowServerDialog(); await handleShowServerDialog();
} }
if (command === "cidr") {
await handleShowCidrDialog();
}
if (command === "config_admin") { if (command === "config_admin") {
configAdminData.visible = true; configAdminData.visible = true;
const path = import.meta.env.VITE_CONFIG_ADMIN_PATH; const path = import.meta.env.VITE_CONFIG_ADMIN_PATH;
@@ -2094,7 +2043,7 @@
const handleShowMemberDialog = async () => { const handleShowMemberDialog = async () => {
if (!data.isStart) { if (!data.isStart) {
return ElMessage.warning("请先开始联机"); return ElMessage.warning("请先启动联机");
} }
// if (!mainStore.config.ipv4) { // if (!mainStore.config.ipv4) {
// return ElMessage.warning("请等待获取IP"); // return ElMessage.warning("请等待获取IP");
+68 -69
View File
@@ -1,6 +1,6 @@
<template> <template>
<div class="h-full overflow-auto"> <div class="h-full overflow-auto">
<div class="w-[1200px]"> <div class="max-w-[2000px]">
<ElText <ElText
size="small" size="small"
v-if="!data.member || data.member.length <= 0" v-if="!data.member || data.member.length <= 0"
@@ -10,7 +10,7 @@
<ElTable <ElTable
stripe stripe
border border
:data="data.member" :data="computedMember"
v-else v-else
> >
<ElTableColumn <ElTableColumn
@@ -19,7 +19,7 @@
prop="hostname" prop="hostname"
> >
<template #default="{ row }"> <template #default="{ row }">
<div class="whitespace-pre-wrap"> <div :class="`whitespace-pre-wrap`">
<div> <div>
{{ {{
(row.hostname || "").toLowerCase().includes("publicserver") (row.hostname || "").toLowerCase().includes("publicserver")
@@ -44,7 +44,7 @@
</ElTableColumn> </ElTableColumn>
<ElTableColumn <ElTableColumn
sortable sortable
width="90" width="70"
prop="cost" prop="cost"
label="方式" label="方式"
> >
@@ -65,11 +65,29 @@
label="虚拟网IP" label="虚拟网IP"
:sort-method="sortIpv4" :sort-method="sortIpv4"
:sort-orders="['ascending', 'descending', null]" :sort-orders="['ascending', 'descending', null]"
></ElTableColumn> >
<template #default="{ row }">
<div class="space-y-[5px]">
<div>
{{ row.ipv4 || "-" }}
</div>
<div v-if="row.proxy?.[0]">
<ElTooltip :content="row.proxy?.[1] == 'Connected' ? '已连接' : '已断开'">
<ElTag
size="small"
:type="row.proxy?.[1] == 'Connected' ? 'success' : 'danger'"
>
{{ row.proxy?.[0] || "-" }}代理
</ElTag>
</ElTooltip>
</div>
</div>
</template>
</ElTableColumn>
<ElTableColumn <ElTableColumn
sortable sortable
prop="lat_ms" prop="lat_ms"
width="100" width="80"
label="延迟/ms" label="延迟/ms"
:sort-method="sortLatMs" :sort-method="sortLatMs"
:sort-orders="['ascending', 'descending', null]" :sort-orders="['ascending', 'descending', null]"
@@ -80,7 +98,7 @@
</ElTableColumn> </ElTableColumn>
<ElTableColumn <ElTableColumn
sortable sortable
width="100" width="70"
prop="loss_rate" prop="loss_rate"
label="丢包率" label="丢包率"
> >
@@ -96,12 +114,12 @@
</ElTableColumn> </ElTableColumn>
<ElTableColumn <ElTableColumn
sortable sortable
width="110" width="100"
label="NAT类型" label="NAT类型"
prop="nat_type" prop="nat_type"
> >
<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
@@ -137,65 +155,11 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { invoke } from "@tauri-apps/api/core"; import { invoke } from "@tauri-apps/api/core";
import { reactive, onMounted, onBeforeUnmount } from "vue"; import { reactive, onMounted, onBeforeUnmount, computed } from "vue";
import { ATJ, parseCliInfo } from "@/utils"; import { ATJ } from "@/utils";
import { ElConfirmDanger } from "~/utils/element"; import { ElConfirmDanger } from "~/utils/element";
import { getCurrentWindow } from "@tauri-apps/api/window"; import { getCurrentWindow } from "@tauri-apps/api/window";
import { endsWith, isNaN } from "lodash-es"; import { isNaN } from "lodash-es";
type Member = {
cidr: string;
ipv4: string;
hostname: string;
cost: string;
lat_ms: string;
loss_rate: string;
rx_bytes: string;
tx_bytes: string;
tunnel_proto: string;
nat_type: string;
id: string;
version: string;
connections_addrs: string[];
};
type ConnectionsType = {
route: {
peer_id: number;
ipv4_addr: string | null;
next_hop_peer_id: number;
cost: number;
path_latency: number;
proxy_cidrs: string[];
hostname: string;
stun_info: {
udp_nat_type: number;
tcp_nat_type: number;
last_update_time: number;
public_ip: string[];
min_port: number;
max_port: number;
};
};
peer: {
peer_id: number;
conns: {
conn_id: string;
my_peer_id: number;
peer_id: number;
features: string[];
tunnel: {
tunnel_type: string;
local_addr: {
url: string;
};
remote_addr: {
url: string;
};
};
}[];
};
};
const natMaps = { const natMaps = {
unknown: "未知", unknown: "未知",
@@ -209,10 +173,27 @@
symmetriceasyinc: "nat4-easyinc", symmetriceasyinc: "nat4-easyinc",
symUdpfirewall: "nat4-udpfirewall" symUdpfirewall: "nat4-udpfirewall"
}; };
type natKyes = keyof typeof natMaps;
const data = reactive<{ member: Member[] }>({ type NATKyes = keyof typeof natMaps;
member: []
const data = reactive<{ member: Member[]; proxy: Proxy[] }>({
member: [],
proxy: []
});
const computedMember = computed(() => {
const localMember = data.member.find(member => member?.cost == "Local");
if (!localMember) return data.member;
const ipv4 = localMember.ipv4;
const proxyMember = data.proxy?.filter(proxy => proxy.src.startsWith(`${ipv4}:`));
const proxyObj: Record<string, [string, "Connected" | "Closed"]> = {};
for (const proxy of proxyMember) {
proxyObj[proxy.dst.split(":")[0]] = [proxy.transport_type, proxy.state];
}
return data.member.map(m => {
m.proxy = proxyObj?.[m.ipv4.split(":")?.[0]] || m?.proxy || ["", "Closed"];
return m;
});
}); });
// 延迟排序函数 // 延迟排序函数
@@ -395,9 +376,27 @@
data.member = JSON.parse(member) as Member[]; data.member = JSON.parse(member) as Member[];
} }
// console.log(data.member); // console.log(data.member);
getMembersProxy();
startTimer(); startTimer();
}; };
const getMembersProxy = async () => {
const [error, proxy] = await ATJ(invoke<string>("get_members_proxy"));
if (error) {
data.proxy = [];
return "";
}
if (proxy === "_EasytierGameCliFailedToGetProxy_") {
data.proxy = [];
return "";
}
try {
data.proxy = JSON.parse(proxy) as Proxy[];
} catch (error) {
data.proxy = [];
}
};
const startTimer = () => { const startTimer = () => {
timer && clearTimeout(timer); timer && clearTimeout(timer);
timer = setTimeout(() => { timer = setTimeout(() => {
+62 -37
View File
@@ -1,46 +1,53 @@
<template> <template>
<div class="relative flex h-full flex-col flex-wrap gap-[0] overflow-hidden"> <div class="relative flex h-full flex-col flex-wrap gap-[0] overflow-hidden">
<div class="flex h-[40px] w-full flex-nowrap items-center gap-[0_5px]"> <div class="flex h-[40px] w-full flex-nowrap items-center gap-[0_8px]">
<div class="ml-[5px] mr-auto flex flex-1"> <div class="ml-[5px] mr-auto flex">
<ElText class="text-lg font-semibold">公共服务器节点列表</ElText> <ElText class="text-lg font-semibold">公共服务器节点列表</ElText>
</div> </div>
<div> <div class="flex w-fit flex-nowrap items-center gap-[0_8px]">
<ElButton <div>
:loading="loading" <ElInput
size="small" placeholder="搜索名称/地址"
type="primary" v-model="searchName"
class="mr-[5px]" clearable
@click="refreshNodes" ></ElInput>
> </div>
刷新 <div>
</ElButton> <ElButton
<ElButton size="small"
:disabled="selectedNodes.length === 0" type="primary"
size="small" @click="refreshNodes"
type="success" >
class="mr-[5px]" 刷新
@click="addSelectedToServerList" </ElButton>
> <ElButton
添加选中 ({{ selectedNodes.length }}) :disabled="selectedNodes.length === 0"
</ElButton> size="small"
<ElTag type="success"
v-if="lastUpdateTime" class="mr-[8px]"
size="small" @click="addSelectedToServerList"
type="info" >
> 添加选中 ({{ selectedNodes.length }})
最后更新: {{ lastUpdateTime }} </ElButton>
</ElTag> <ElTag
size="small"
type="info"
>
最后更新: {{ lastUpdateTime || "00:00:00" }}
</ElTag>
</div>
</div> </div>
</div> </div>
<div class="flex w-full flex-1 flex-wrap gap-[0] overflow-auto"> <div class="flex w-full flex-1 flex-wrap gap-[0] overflow-auto">
<ElTable <ElTable
:data="nodes" :data="computedNodes"
stripe stripe
height="100%" height="100%"
ref="tableRef" ref="tableRef"
:empty-text="loading ? '加载中...' : '暂无可用服务器'" :empty-text="loading ? '加载中...' : '暂无可用服务器'"
:default-sort="{ prop: 'last_response_time', order: 'ascending' }" :default-sort="{ prop: 'last_response_time', order: 'ascending' }"
@selection-change="handleSelectionChange" @select-all="handleSelectChange"
@select="handleSelectChange"
@row-click="handleRowClick" @row-click="handleRowClick"
> >
<ElTableColumn <ElTableColumn
@@ -136,7 +143,6 @@
<ElTableColumn <ElTableColumn
prop="description" prop="description"
label="描述" label="描述"
width="300"
sortable sortable
> >
<template #default="{ row }"> <template #default="{ row }">
@@ -151,10 +157,11 @@
<script setup lang="ts"> <script setup lang="ts">
import useMainStore from "@/stores/index"; import useMainStore from "@/stores/index";
import { invoke } from "@tauri-apps/api/core"; import { invoke } from "@tauri-apps/api/core";
import { reactive, onMounted, onBeforeUnmount, ref, useTemplateRef } from "vue"; import { reactive, onMounted, onBeforeUnmount, ref, useTemplateRef, computed, nextTick } from "vue";
import { ElMessage, type TableInstance } from "element-plus"; import { ElMessage, type TableInstance } from "element-plus";
import { dataSubscribe } from "~/composables/windows"; import { dataSubscribe } from "~/composables/windows";
import { uniq } from "lodash-es"; import { inputBounceRef } from "@/utils";
import { uniq } from "lodash-es";
const mainStore = useMainStore(); const mainStore = useMainStore();
// 节点数据 // 节点数据
@@ -162,6 +169,21 @@ import { uniq } from "lodash-es";
const loading = ref(false); const loading = ref(false);
const lastUpdateTime = ref(""); const lastUpdateTime = ref("");
const selectedNodes = ref<NodeItem[]>([]); const selectedNodes = ref<NodeItem[]>([]);
const searchName = ref<string>("");
const computedNodes = computed(() => {
const v = searchName.value.trim();
let result = nodes;
if (v) {
result = nodes.filter(node => node.name.includes(v) || node.address.includes(v));
}
nextTick(() => {
for (const node of selectedNodes.value) {
const nodeItem = nodes?.find(n => n.id === node.id);
tableRef.value?.toggleRowSelection(nodeItem, true);
}
});
return result;
});
const tableRef = useTemplateRef<TableInstance>("tableRef"); const tableRef = useTemplateRef<TableInstance>("tableRef");
// 定时器 // 定时器
@@ -191,14 +213,15 @@ import { uniq } from "lodash-es";
// 刷新节点数据 // 刷新节点数据
const refreshNodes = async () => { const refreshNodes = async () => {
loading.value = true; loading.value = true;
let nodesList = await invoke<string>("fetch_nodes_list", { page: 1, limit: 1000 });
try { try {
let nodesList = await invoke<string>("fetch_nodes_list", { page: 1, limit: 1000 });
if (nodesList === "_EasytierGameFetchNodesError_") { if (nodesList === "_EasytierGameFetchNodesError_") {
nodesList = ""; nodesList = "";
return;
} }
if (nodesList) { if (nodesList) {
const nodesListData: NodesResponse = JSON.parse(nodesList); const nodesListData: NodesResponse = JSON.parse(nodesList);
console.log(nodesListData); // console.log(nodesListData);
if (nodesListData.success && nodesListData.data.items) { if (nodesListData.success && nodesListData.data.items) {
// 过滤可用节点 // 过滤可用节点
const availableNodes = filterAvailableNodes(nodesListData.data.items); const availableNodes = filterAvailableNodes(nodesListData.data.items);
@@ -215,6 +238,7 @@ import { uniq } from "lodash-es";
} }
} }
} catch (err) { } catch (err) {
console.log(nodesList);
console.error("获取节点数据失败:", err); console.error("获取节点数据失败:", err);
ElMessage.error("获取节点数据失败"); ElMessage.error("获取节点数据失败");
} finally { } finally {
@@ -303,7 +327,7 @@ import { uniq } from "lodash-es";
const startRefreshTimer = () => { const startRefreshTimer = () => {
refreshTimer = setInterval(() => { refreshTimer = setInterval(() => {
refreshNodes(); refreshNodes();
}, 10000); // 10秒刷新一次 }, 60000); // 10秒刷新一次
}; };
// 停止定时器 // 停止定时器
@@ -315,12 +339,13 @@ import { uniq } from "lodash-es";
}; };
// 处理选择变化 // 处理选择变化
const handleSelectionChange = (selection: NodeItem[]) => { const handleSelectChange = (selection: NodeItem[]) => {
selectedNodes.value = selection; selectedNodes.value = selection;
}; };
const handleRowClick = (row: NodeItem) => { const handleRowClick = (row: NodeItem) => {
tableRef.value?.toggleRowSelection(row); tableRef.value?.toggleRowSelection(row);
selectedNodes.value = tableRef.value?.getSelectionRows() || [];
}; };
// 添加选中的服务器到主页面服务器列表 // 添加选中的服务器到主页面服务器列表
+12
View File
@@ -44,6 +44,18 @@
> >
<ElCheckbox v-model="mainStore.serverConfig.relayAllPeerrpc">转发所有对等节点的RPC数据包</ElCheckbox> <ElCheckbox v-model="mainStore.serverConfig.relayAllPeerrpc">转发所有对等节点的RPC数据包</ElCheckbox>
</ElTooltip> </ElTooltip>
<ElTooltip
placement="top"
content="持有公网 IPv6 前缀时开启,让同网络下其他节点自动获取独立公网地址"
>
<ElCheckbox v-model="mainStore.serverConfig.ipv6PublicAddrProvider">公网IPv6地址前缀提供</ElCheckbox>
</ElTooltip>
<ElTooltip
placement="top"
content="禁止节点转发 relay 数据流量而保留控制面功能,适用于不希望本节点承担中继带宽的场景"
>
<ElCheckbox v-model="mainStore.serverConfig.disableRelayData">禁用Relay数据转发</ElCheckbox>
</ElTooltip>
</div> </div>
</div> </div>
</template> </template>
+2489 -3087
View File
File diff suppressed because it is too large Load Diff
-3
View File
@@ -1,3 +0,0 @@
{
"extends": "../.nuxt/tsconfig.server.json"
}
+1224 -1324
View File
File diff suppressed because it is too large Load Diff
+11 -11
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "easytier-game" name = "easytier-game"
version = "1.5.1" version = "1.5.5"
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"
@@ -18,7 +18,7 @@ name = "app_lib"
crate-type = ["staticlib", "cdylib", "rlib"] crate-type = ["staticlib", "cdylib", "rlib"]
[build-dependencies] [build-dependencies]
tauri-build = { version = "2.5.1", features = [] } tauri-build = { version = "2.6.1", features = [] }
# prost-build = "0.13.2" # prost-build = "0.13.2"
[target.x86_64-pc-windows-msvc.build-dependencies] [target.x86_64-pc-windows-msvc.build-dependencies]
@@ -28,24 +28,24 @@ thunk-rs = { git = "https://github.com/easytier/thunk.git", default-features = f
serde_json = "1.0.137" serde_json = "1.0.137"
serde = { version = "1.0.217", features = ["derive"] } serde = { version = "1.0.217", features = ["derive"] }
log = "0.4.26" log = "0.4.26"
tauri = { version = "2.9.1", features = [ "protocol-asset", tauri = { version = "2.11.1", features = [ "protocol-asset",
"tray-icon", "tray-icon",
"image-png", "image-png",
"image-ico" "image-ico"
] } ] }
tauri-plugin-log = "2.7.0" tauri-plugin-log = "2.8.0"
tauri-plugin-shell = "2.3.1" tauri-plugin-shell = "2.3.5"
reqwest = { version = "0.12.12", features = ["json"] } reqwest = { version = "0.12.12", features = ["json"] }
zip = "2.2.3" zip = "2.2.3"
sysinfo = '0.33.1' sysinfo = '0.33.1'
# planif = { git = "https://github.com/mattrobineau/planif", tag = "1.0.1" } # planif = { git = "https://github.com/mattrobineau/planif", tag = "1.0.1" }
whoami = "1.5.2" whoami = "1.5.2"
tauri-plugin-fs = "2.4.2" tauri-plugin-fs = "2.5.1"
tauri-plugin-clipboard-manager = "2.3.0" tauri-plugin-clipboard-manager = "2.3.2"
rand = "0.9.0" rand = "0.9.0"
tokio = { version = "1.45.1", features = ["process"] } tokio = { version = "1.45.1", features = ["process"] }
tauri-plugin-dialog = "2.4.0" tauri-plugin-dialog = "2.7.1"
# prost = "0.13" # prost = "0.13"
# prost-types = "0.13" # prost-types = "0.13"
hashbrown = "0.15.2" hashbrown = "0.15.2"
@@ -56,6 +56,6 @@ version = "0.61.3"
features = ["Win32_System_TaskScheduler", "Win32_System_Com", "Win32_System_Power", "Win32_NetworkManagement_IpHelper", "Win32_NetworkManagement_Ndis", "Win32_Networking_WinSock"] features = ["Win32_System_TaskScheduler", "Win32_System_Com", "Win32_System_Power", "Win32_NetworkManagement_IpHelper", "Win32_NetworkManagement_Ndis", "Win32_Networking_WinSock"]
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies] [target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
tauri-plugin-cli = "2.4.0" tauri-plugin-cli = "2.4.1"
tauri-plugin-single-instance = "2.3.4" tauri-plugin-single-instance = "2.4.2"
tauri-plugin-window-state = "2.4.0" tauri-plugin-window-state = "2.4.1"
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "../gen/schemas/desktop-schema.json", "$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default", "identifier": "default",
"description": "enables the default permissions", "description": "enables the default permissions",
"windows": ["main", "log", "member", "cidr", "advance", "tool", "server", "gameList", "storage-listener"], "windows": ["main", "log", "member", "nodesList", "cidr", "advance", "tool", "server", "gameList", "storage-listener"],
"permissions": [ "permissions": [
"core:default", "core:default",
"core:window:allow-minimize", "core:window:allow-minimize",
Binary file not shown.
+12 -1
View File
@@ -14,7 +14,13 @@
"networkName": "", //房间名 "networkName": "", //房间名
"networkPassword": "", //房间密码 "networkPassword": "", //房间密码
"hostname": "", //主机名 "hostname": "", //主机名
"ipv4": "", // 虚拟IP地址 "ipv4": "", // 虚拟IPv4地址
"ipv6": "", // 虚拟IPv6地址
"tcpWhitelistEnable": false, // 启用TCP白名单
"udpWhitelistEnable": false, // 启用UDP白名单
"tcpWhitelist": "", // TCP端口白名单,格式为 "80" 或者 范围 "8000-9000"
"udpWhitelist": "", // UDP端口白名单,格式为 "53" 或者 范围 "5000-6000"
"connectAfterStart": false, // 启动后自动连接
"disableIpv6": false, // 禁用ipv6 "disableIpv6": false, // 禁用ipv6
"disbleListenner": false, // 禁用监听 "disbleListenner": false, // 禁用监听
"disableEncryption": false, // 禁用加密 "disableEncryption": false, // 禁用加密
@@ -31,6 +37,11 @@
"enableNetCardMetric": true, // 启用自定义网卡跃点 "enableNetCardMetric": true, // 启用自定义网卡跃点
"netCardMetricValue": 1, // 网卡跃点 "netCardMetricValue": 1, // 网卡跃点
"enablePreventSleep": false, // 启用防止睡眠 "enablePreventSleep": false, // 启用防止睡眠
"enableUdpBroadcastRelay": true, // Windows UDP广播中继
"enableUpnp": true, // UPnP端口映射
"ipv6PublicAddrProvider": false, // 公网IPv6地址前缀提供
"ipv6PublicAddrAuto": false, // 公网IPv6地址自动获取
"disableRelayData": false, // 禁用Relay数据转发
"compression": "none", // 压缩算法 "compression": "none", // 压缩算法
"enableKcpProxy": true, // 启用kcp代理,就不能启用quic代理 "enableKcpProxy": true, // 启用kcp代理,就不能启用quic代理
"disableKcpInput": false, // 禁用kcp输入 "disableKcpInput": false, // 禁用kcp输入
Binary file not shown.
Binary file not shown.
+33 -35
View File
@@ -1,7 +1,7 @@
use reqwest::{Client, Error}; use reqwest::{Client, Error};
// use futures_util::StreamExt; // use futures_util::StreamExt;
use serde::{Deserialize, Serialize}; use serde::{Deserialize};
use std::collections::HashMap; // use std::collections::HashMap;
use std::fs::{self, File}; use std::fs::{self, File};
use std::io::{BufRead, BufReader, Write}; use std::io::{BufRead, BufReader, Write};
use std::os::windows::process::CommandExt; use std::os::windows::process::CommandExt;
@@ -237,38 +237,6 @@ fn get_tool_exe_path(path: &str) -> String {
return tool_path; return tool_path;
} }
#[derive(Serialize, Deserialize, Debug)]
struct RoutePeerInfo {
peer_id: u64,
cost: u64,
hostname: Option<String>,
udp_stun_info: String,
easytier_version: String,
network_length: u64,
}
#[derive(Serialize, Deserialize, Debug)]
struct RouteTable {
peer_infos: HashMap<u32, RoutePeerInfo>,
ipv4_peer_id_map: HashMap<String, u64>,
}
#[derive(Serialize, Deserialize, Debug)]
struct PeerRouteServiceImpl {
route_table_with_cost: RouteTable,
}
#[derive(Serialize, Deserialize, Debug)]
struct PeerRoute {
my_peer_id: u64,
service_impl: PeerRouteServiceImpl,
}
#[derive(Serialize, Deserialize, Debug)]
struct MyResponse {
response: PeerRoute,
}
#[tauri::command(rename_all = "snake_case")] #[tauri::command(rename_all = "snake_case")]
async fn get_members_by_cli() -> String { async fn get_members_by_cli() -> String {
@@ -299,6 +267,34 @@ async fn get_members_by_cli() -> String {
} }
} }
#[tauri::command(rename_all = "snake_case")]
async fn get_members_proxy() -> String {
let cli_path = get_tool_exe_path("\\easytier\\easytier-cli.exe");
match tokioCommand::new(&cli_path)
.arg("-o")
.arg("json")
.arg("proxy")
.creation_flags(0x08000000)
.output()
.await
{
Ok(output) => {
if output.status.success() {
let output_str = String::from_utf8_lossy(&output.stdout);
return output_str.trim().to_string();
} else {
let output_str = String::from_utf8_lossy(&output.stderr);
log::error!("{}", output_str.trim().to_string());
return "_EasytierGameCliFailedToGetProxy_".to_string();
}
}
Err(_e) => {
log::error!("get member list error");
return "".to_string();
}
}
}
#[tauri::command(rename_all = "snake_case")] #[tauri::command(rename_all = "snake_case")]
async fn get_members_connections_cli() -> String { async fn get_members_connections_cli() -> String {
let cli_path = get_tool_exe_path("\\easytier\\easytier-cli.exe"); let cli_path = get_tool_exe_path("\\easytier\\easytier-cli.exe");
@@ -847,6 +843,7 @@ fn autostart(enabled: bool) -> std::result::Result<(), Box<dyn std::error::Error
exec_action.SetPath(&BSTR::from(exe_path))?; exec_action.SetPath(&BSTR::from(exe_path))?;
exec_action.SetArguments(&BSTR::from("--task-auto-start"))?; exec_action.SetArguments(&BSTR::from("--task-auto-start"))?;
// 设置任务权限为当前用户
let principal = task_definition.Principal()?; let principal = task_definition.Principal()?;
principal.SetUserId(&BSTR::from(whoami::username().as_str()))?; principal.SetUserId(&BSTR::from(whoami::username().as_str()))?;
principal.SetLogonType(TASK_LOGON_INTERACTIVE_TOKEN)?; principal.SetLogonType(TASK_LOGON_INTERACTIVE_TOKEN)?;
@@ -855,7 +852,7 @@ fn autostart(enabled: bool) -> std::result::Result<(), Box<dyn std::error::Error
// 设置任务设置 // 设置任务设置
let settings = task_definition.Settings()?; let settings = task_definition.Settings()?;
settings.SetEnabled(VARIANT_BOOL::from(true))?; settings.SetEnabled(VARIANT_BOOL::from(true))?;
settings.SetCompatibility(TASK_COMPATIBILITY_V2)?; // Windows 7 settings.SetCompatibility(TASK_COMPATIBILITY_V2_1)?; // Windows 7
settings.SetStartWhenAvailable(VARIANT_BOOL::from(true))?; settings.SetStartWhenAvailable(VARIANT_BOOL::from(true))?;
// settings.SetHidden(VARIANT_BOOL::from(true))?; // 注释掉让任务可见 // settings.SetHidden(VARIANT_BOOL::from(true))?; // 注释掉让任务可见
settings.SetExecutionTimeLimit(&BSTR::from("PT0S"))?; settings.SetExecutionTimeLimit(&BSTR::from("PT0S"))?;
@@ -960,6 +957,7 @@ pub fn run() {
download_easytier_zip, download_easytier_zip,
get_members_by_cli, get_members_by_cli,
get_members_connections_cli, get_members_connections_cli,
get_members_proxy,
get_route_by_cli, get_route_by_cli,
fetch_nodes_list, fetch_nodes_list,
search_pid_by_pname, search_pid_by_pname,
+6 -4
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.5.1", "version": "1.5.5",
"identifier": "com.tauri.easytier-game", "identifier": "com.tauri.easytier-game",
"build": { "build": {
@@ -12,7 +12,7 @@
"app": { "app": {
"windows": [ "windows": [
{ {
"title": "easytier-game 1.5.1", "title": "easytier-game 1.5.5",
"label": "main", "label": "main",
"minWidth": 340, "minWidth": 340,
"width": 340, "width": 340,
@@ -49,7 +49,7 @@
} }
}, },
"bundle": { "bundle": {
"active": true, "active": false,
"targets": "all", "targets": "all",
"resources": [ "resources": [
"easytier/config/", "easytier/config/",
@@ -72,7 +72,9 @@
"windows": { "windows": {
"webviewInstallMode": { "webviewInstallMode": {
"type": "embedBootstrapper" "type": "embedBootstrapper"
} },
"wix": null,
"nsis": null
}, },
"createUpdaterArtifacts": false, "createUpdaterArtifacts": false,
"icon": ["icons/icon.png", "icons/icon.rgba", "icons/icon.icns", "icons/icon.ico"] "icon": ["icons/icon.png", "icons/icon.rgba", "icons/icon.icns", "icons/icon.ico"]
+15
View File
@@ -44,6 +44,11 @@ const store = defineStore("main", {
enableNetCardMetric: true, //启用网卡自定义跃点 enableNetCardMetric: true, //启用网卡自定义跃点
netCardMetricValue: 1, //自定义网卡跃点值 netCardMetricValue: 1, //自定义网卡跃点值
enablePreventSleep: false, //组织系统休眠 enablePreventSleep: false, //组织系统休眠
enableUdpBroadcastRelay: true, //Windows UDP广播中继
enableUpnp: true, //UPnP端口映射
ipv6PublicAddrProvider: false, //公网IPv6地址前缀提供
ipv6PublicAddrAuto: false, //公网IPv6地址自动获取
disableRelayData: false, //禁用Relay数据转发
compression: "none", //加密算法 compression: "none", //加密算法
enableKcpProxy: true, //启用kcp代理 默认开启 enableKcpProxy: true, //启用kcp代理 默认开启
disableKcpInput: false, //禁用kcp输入 disableKcpInput: false, //禁用kcp输入
@@ -66,6 +71,8 @@ const store = defineStore("main", {
privateMode: false, //是否启用私有模式 privateMode: false, //是否启用私有模式
privateNetworkName: "", // 私有模式房间名 privateNetworkName: "", // 私有模式房间名
privateNetworkPassword: "", // 私有模式密码 privateNetworkPassword: "", // 私有模式密码
ipv6PublicAddrProvider: false, //公网IPv6地址前缀提供
disableRelayData: false, //禁用Relay数据转发
}, },
cidrEnable: false, cidrEnable: false,
proxyForwardBySystem: false, // 是否通过系统内核转发子网代理数据包,禁用内置NAT proxyForwardBySystem: false, // 是否通过系统内核转发子网代理数据包,禁用内置NAT
@@ -150,6 +157,12 @@ const store = defineStore("main", {
"config.privateMode", "config.privateMode",
"config.enableUdpBroadcastRelay",
"config.enableUpnp",
"config.ipv6PublicAddrProvider",
"config.ipv6PublicAddrAuto",
"config.disableRelayData",
"serverConfig.autoStart", "serverConfig.autoStart",
// 'serverConfig.enableListener', // 'serverConfig.enableListener',
"serverConfig.enableWhiteList", "serverConfig.enableWhiteList",
@@ -159,6 +172,8 @@ const store = defineStore("main", {
"serverConfig.privateMode", "serverConfig.privateMode",
"serverConfig.privateNetworkName", "serverConfig.privateNetworkName",
"serverConfig.privateNetworkPassword", "serverConfig.privateNetworkPassword",
"serverConfig.ipv6PublicAddrProvider",
"serverConfig.disableRelayData",
"cidrEnable", "cidrEnable",
"proxyForwardBySystem", "proxyForwardBySystem",
+62
View File
@@ -57,3 +57,65 @@ interface NodesResponse {
error: string | null; error: string | null;
message: string | null; message: string | null;
} }
type Member = {
cidr: string;
ipv4: string;
hostname: string;
cost: string;
lat_ms: string;
loss_rate: string;
rx_bytes: string;
tx_bytes: string;
tunnel_proto: string;
nat_type: string;
id: string;
version: string;
connections_addrs: string[];
proxy?: [string, "Connected" | "Closed"];
};
type ConnectionsType = {
route: {
peer_id: number;
ipv4_addr: string | null;
next_hop_peer_id: number;
cost: number;
path_latency: number;
proxy_cidrs: string[];
hostname: string;
stun_info: {
udp_nat_type: number;
tcp_nat_type: number;
last_update_time: number;
public_ip: string[];
min_port: number;
max_port: number;
};
};
peer: {
peer_id: number;
conns: {
conn_id: string;
my_peer_id: number;
peer_id: number;
features: string[];
tunnel: {
tunnel_type: string;
local_addr: {
url: string;
};
remote_addr: {
url: string;
};
};
}[];
};
};
type Proxy = {
src: string;
dst: string;
start_time: string;
state: "Connected" | "Closed";
transport_type: string;
};
+23 -2
View File
@@ -3,10 +3,11 @@ import { writeText } from "@tauri-apps/plugin-clipboard-manager";
import { open } from "@tauri-apps/plugin-shell"; import { open } from "@tauri-apps/plugin-shell";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { flatMap, map } from "lodash-es"; import { flatMap, map } from "lodash-es";
import { customRef, ref } from "vue";
export const ENV = import.meta.env; export const ENV = import.meta.env;
export const mixedArray = (a: Array<string>, b: Array<string>, split:string="") => { export const mixedArray = (a: Array<string>, b: Array<string>, split: string = "") => {
return flatMap(a, protocol => map(b, port => `${protocol}${split}${port}`)); return flatMap(a, protocol => map(b, port => `${protocol}${split}${port}`));
}; };
@@ -21,6 +22,26 @@ export const bounce = (time = 3000) => {
}; };
}; };
export const inputBounceRef = (value: string, cb?: Function, delay = 650) => {
let timeout: number | null = null;
return customRef((track, trigger) => {
return {
get() {
track();
return value;
},
set(newValue) {
value = newValue;
trigger();
timeout && clearTimeout(timeout);
timeout = setTimeout(() => {
cb?.(newValue);
}, delay);
}
};
});
};
/** /**
* *
* @param {number} size byte number * @param {number} size byte number
@@ -73,7 +94,7 @@ export const ATJ = (promise: Promise<any>, errorExt: string | undefined = undefi
}); });
}; };
const _supportProtocols = ["tcp", "udp", "ws", "wss", 'srv', 'schema']; const _supportProtocols = ["tcp", "udp", "ws", "wss", "srv", "schema", "txt"];
export const supportProtocols = () => { export const supportProtocols = () => {
return _supportProtocols.slice(); return _supportProtocols.slice();
Binary file not shown.