Compare commits

...
7 Commits
20 changed files with 2845 additions and 2619 deletions
+8 -8
View File
@@ -1,12 +1,12 @@
pnpm run build
rustup default nightly
rem 使用rust nightly构建支持win7的版本,请先将根目录的windows.0.48.5 放入以下目录
rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\lib\x64
rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\lib\x86
rem C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\你自己的版本\atlmfc\lib\x64
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
@REM 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
@REM 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
@REM pnpm run release-win7
+7 -10
View File
@@ -14,23 +14,16 @@ export const updateConfigJson = async (configJsonSeverUrl: Array<string> | strin
const {
proxyNetworks,
autoStart,
relayAllPeerrpc,
connectAfterStart,
multiThread,
enablExitNode,
useSmoltcp,
saveErrorLog,
logLevel,
serverUrl,
port,
enableCustomListener,
enablePreventSleep,
customListenerData,
customListenerV6Data,
enableCustomListenerV6,
bindDeviceEnable,
...otherConfig
} = mainStore.config;
let writeServerUrl: Array<string> | string = serverUrl;
let writeCustomListenerData: Array<string> = (customListenerData || "").split("\n");
if (isArray) {
writeServerUrl = intersection(
uniq([serverUrl, ...configJsonSeverUrl]).filter(boolean => boolean),
@@ -43,7 +36,11 @@ export const updateConfigJson = async (configJsonSeverUrl: Array<string> | strin
mainStore.basePeers
).join(",");
}
await writeTextFile(path, JSON.stringify({ serverUrl: writeServerUrl, ...otherConfig }, null, 4), { baseDir: BaseDirectory.Resource });
await writeTextFile(
path,
JSON.stringify({ serverUrl: writeServerUrl, enableCustomListener, customListenerData: writeCustomListenerData, ...otherConfig }, null, 4),
{ baseDir: BaseDirectory.Resource }
);
} catch (err) {
console.error(err);
ElMessage.error(`更新config.json失败`);
+37 -38
View File
@@ -8,6 +8,7 @@ import { resourceDir as getResourceDir, join } from "@tauri-apps/api/path";
import { invoke } from "@tauri-apps/api/core";
// import { ElConfirmPrimary } from "~/utils/element";
import { open } from "@tauri-apps/plugin-shell";
import { computed } from "vue";
const DEFAULT_TRAY_NAME = "main";
@@ -30,13 +31,10 @@ export async function useTray(init: boolean = false, beforExit: Function, handle
tooltip: `EasyTierGame\n${pkg.version}`,
title: `EasyTierGame\n${pkg.version}`,
id: DEFAULT_TRAY_NAME,
menu: await Menu.new({
id: "main",
items: await generateMenuItem(beforExit, handleConnection),
}),
action: async (e) => {
menu: await Menu.new({ id: "main", items: await generateMenuItem(beforExit, handleConnection) }),
action: async e => {
toggleVisibility();
},
}
});
}
} catch (error) {
@@ -47,18 +45,13 @@ export async function useTray(init: boolean = false, beforExit: Function, handle
if (init) {
tray.setTooltip(`EasyTierGame\n${pkg.version}`);
tray.setShowMenuOnLeftClick(false);
tray.setMenu(
await Menu.new({
id: "main",
items: await generateMenuItem(beforExit, handleConnection),
})
);
tray.setMenu(await Menu.new({ id: "main", items: await generateMenuItem(beforExit, handleConnection) }));
}
return tray;
}
export async function generateMenuItem(beforExit: Function, handleConnection:Function) {
export async function generateMenuItem(beforExit: Function, handleConnection: Function) {
return [
await MenuItemShow("显示 / 隐藏"),
await MenuItemExchangeConnection("联机 / 断开", handleConnection),
@@ -66,7 +59,7 @@ export async function generateMenuItem(beforExit: Function, handleConnection:Fun
await PredefinedMenuItem.new({ item: "Separator" }),
await MenuItemPublicPeers(),
await PredefinedMenuItem.new({ item: "Separator" }),
await MenuItemExit("退出", beforExit),
await MenuItemExit("退出", beforExit)
];
}
@@ -79,18 +72,17 @@ export async function MenuItemExit(text: string, beforExit: Function) {
await beforExit();
}
await getCurrentWindow().close();
},
}
});
}
export async function MenuItemPublicPeers() {
return await MenuItem.new({
id: "publicPeers",
text: "公共节点",
action: async () => {
await open(import.meta.env.VITE_PUBLIC_PEERS_URL)
},
await open(import.meta.env.VITE_PUBLIC_PEERS_URL);
}
});
}
@@ -100,17 +92,17 @@ export async function MenuItemShow(text: string) {
text,
action: async () => {
await toggleVisibility();
},
}
});
}
export async function MenuItemExchangeConnection(text: string, handleConnection:Function) {
const menutItem = await MenuItem.new({
export async function MenuItemExchangeConnection(text: string, handleConnection: Function) {
const menutItem = await MenuItem.new({
id: "exchangeConnection",
text,
action: async () => {
const isStart = await handleConnection();
},
}
});
return menutItem;
}
@@ -121,12 +113,10 @@ export async function MenuItemTheme() {
text: "主题切换",
action: async () => {
const mainStore = useMainStore();
mainStore.$patch({
theme: !mainStore.theme
});
mainStore.$patch({ theme: !mainStore.theme });
// mainStore.$persist();
await setTheme(mainStore.theme);
},
}
});
}
@@ -159,18 +149,27 @@ export async function setTrayTooltip(tray: TrayIcon | null, tooltip?: string | n
}
}
const versionWeight = (version: string) => {
version = version ? version.trim() : "";
const [major = "0", minor = "0", patch = "0"] = version.split(".");
return parseInt(major) * 10000 + parseInt(minor) * 100 + parseInt(patch);
};
const versionDifference = (current: string, latest: string) => {
const currentVersion = versionWeight(current);
const latestVersion = versionWeight(latest);
return currentVersion - latestVersion;
};
export const checkNewVersion = async () => {
const mainStore = useMainStore();
// if(mainStore.latestTagName && mainStore.latestTagName == pkg.version) return;
if (hasNewVersion.value) return;
let [tagName, downloadUrl] = await invoke<string[]>("fetch_game_releases");
if(tagName && pkg.version !== tagName) {
return true; //有新版
// const [err] = await ElConfirmPrimary("有新版本是否下载?", "发现新版本", {
// confirmButtonText: "下载",
// cancelButtonText: "取消",
// })
// if(!err) {
// open(downloadUrl);
// }
}
return false; //没有新版
}
mainStore.latestTagName = tagName;
};
export const hasNewVersion = computed<boolean>(() => {
const mainStore = useMainStore();
return !!mainStore.latestTagName && versionDifference(pkg.version, mainStore.latestTagName) < 0 ;
});
+39 -28
View File
@@ -5,16 +5,31 @@ import type { WebviewLabel, WebviewOptions } from "@tauri-apps/api/webview";
import useMainStore from "@/stores/index";
import { onBeforeUnmount } from "vue";
const _listenersMaps: { [key: string]: [UnlistenFn | null, UnlistenFn | null] } = {};
const _listenersMaps: { [key: string]: [UnlistenFn | null] } = {};
const dealCloseListener = async (
dialog: WebviewWindow,
label: string,
beforeCloseFunc?: () => void | null
) => {
const unlistenFnList: [UnlistenFn | null] = _listenersMaps[label] || [null];
let [unListenlogClose] = unlistenFnList;
unListenlogClose && (await unListenlogClose());
unListenlogClose = await dialog.onCloseRequested(async () => {
beforeCloseFunc && (await beforeCloseFunc());
unListenlogClose && (await unListenlogClose());
console.log("close")
});
};
export default async (
label: WebviewLabel,
options?: Omit<WebviewOptions, "x" | "y" | "width" | "height"> & WindowOptions,
afterCreatedFunc?: (webviewWindow: WebviewWindow, appWindow: Window) => void | null,
beforeCloseFunc?: () => void | null
) => {
const unlistenFnList: [UnlistenFn | null, UnlistenFn | null] = _listenersMaps[label] || [null, null];
let [unlistenLogCreated, unListenlogClose] = unlistenFnList;
const unlistenFnList: [UnlistenFn | null] = _listenersMaps[label] || [null];
let dialog = await WebviewWindow.getByLabel(label);
if (!dialog) {
let defaultOpts: { [key: string]: any; parent: Window | undefined } = {
@@ -38,28 +53,20 @@ export default async (
defaultOpts.x = logicalPosition.x;
defaultOpts.y = logicalPosition.y;
}
unlistenLogCreated && (await (unlistenLogCreated as Function)());
unListenlogClose && (await unListenlogClose());
dialog = new WebviewWindow(label, { ...defaultOpts, ...options });
unlistenLogCreated = await dialog.listen("tauri://webview-created", async () => {
if (dialog) {
afterCreatedFunc && (await afterCreatedFunc(dialog, appWindow));
await dialog.show();
}
});
unlistenFnList[0] = unlistenLogCreated;
unListenlogClose = await dialog.onCloseRequested(async () => {
beforeCloseFunc && (await beforeCloseFunc());
unListenlogClose && (await unListenlogClose());
unlistenLogCreated && (await (unlistenLogCreated as Function)());
});
unlistenFnList[1] = unlistenLogCreated;
_listenersMaps[label] = unlistenFnList;
await dealCloseListener(dialog, label, beforeCloseFunc);
afterCreatedFunc && (await afterCreatedFunc(dialog, appWindow));
await dialog.show();
} else {
const visible = await dialog.isVisible();
if (visible) {
await dialog.close();
unlistenLogCreated && (await (unlistenLogCreated as Function)());
} else {
const appWindow = getCurrentWindow();
await dealCloseListener(dialog, label, beforeCloseFunc);
afterCreatedFunc && (await afterCreatedFunc(dialog, appWindow));
await dialog.show();
}
}
};
@@ -68,15 +75,19 @@ export const dataSubscribe = async (cb?: (...args: any) => any) => {
if (!cb) return;
const mainStore = useMainStore();
const abort = new AbortController();
window.addEventListener("storage", async () => {
mainStore.$hydrate();
if (cb && cb instanceof Function) {
await cb();
window.addEventListener(
"storage",
async () => {
mainStore.$hydrate();
if (cb && cb instanceof Function) {
await cb();
}
},
{
signal: abort.signal
}
}, {
signal: abort.signal
})
);
onBeforeUnmount(() => {
abort?.abort();
})
});
};
+93 -93
View File
@@ -3,107 +3,107 @@ import path from "path";
import vueJSX from "@vitejs/plugin-vue-jsx";
export default defineNuxtConfig({
ssr: false,
ssr: false,
devServer: {
port: 5000
},
telemetry: false,
devServer: {
port: 5000
},
imports: {
autoImport: false
},
telemetry: false,
css: ["~/assets/css/main.css", "element-plus/theme-chalk/dark/css-vars.css"],
modules: [
"@element-plus/nuxt",
"@pinia/nuxt",
[
"pinia-plugin-persistedstate/nuxt",
{
key: "__glj_persisted_%id",
storage: "localStorage"
}
],
"@nuxtjs/tailwindcss"
],
imports: {
autoImport: false
},
alias: {
"@": path.resolve(__dirname, "./")
},
css: ["~/assets/css/main.css", "element-plus/theme-chalk/dark/css-vars.css"],
modules: [
"@element-plus/nuxt",
"@pinia/nuxt",
[
"pinia-plugin-persistedstate/nuxt",
{
key: "__glj_persisted_%id",
storage: "localStorage"
}
],
"@nuxtjs/tailwindcss"
],
experimental: {
payloadExtraction: false
},
alias: {
"@": path.resolve(__dirname, "./")
},
devtools: {
enabled: false
},
experimental: {
payloadExtraction: false
},
router: {
options: {
hashMode: true
}
},
devtools: {
enabled: false
},
vite: {
plugins: [vueJSX({})],
envDir: "env",
optimizeDeps: {
// include: [...optimizeDepsElementPlusIncludes]
},
// prevent vite from obscuring rust errors
clearScreen: false,
// Tauri expects a fixed port, fail if that port is not available
server: {
strictPort: true
},
// to access the Tauri environment variables set by the CLI with information about the current target
envPrefix: ["VITE_", "TAURI_"],
build: {
// minify: "esbuild",
chunkSizeWarningLimit: 1500,
// Tauri uses Chromium on Windows and WebKit on macOS and Linux
target: process.env.TAURI_PLATFORM == "windows" ? "chrome105" : "safari13",
// don't minify for debug builds
minify: !process.env.TAURI_DEBUG ? "esbuild" : false,
// 为调试构建生成源代码映射 (sourcemap)
sourcemap: !!process.env.TAURI_DEBUG
},
esbuild: {
// pure: ["console.log"],
drop: ["debugger"]
}
},
router: {
options: {
hashMode: true
}
},
postcss: {
plugins: {
tailwindcss: {},
autoprefixer: {}
}
},
vite: {
plugins: [vueJSX({})],
envDir: "env",
optimizeDeps: {
// include: [...optimizeDepsElementPlusIncludes]
},
// prevent vite from obscuring rust errors
clearScreen: false,
// Tauri expects a fixed port, fail if that port is not available
server: {
strictPort: true
},
// to access the Tauri environment variables set by the CLI with information about the current target
envPrefix: ["VITE_", "TAURI_"],
build: {
// minify: "esbuild",
chunkSizeWarningLimit: 1500,
// Tauri uses Chromium on Windows and WebKit on macOS and Linux
target: process.env.TAURI_PLATFORM == "windows" ? "chrome105" : "safari13",
// don't minify for debug builds
minify: !process.env.TAURI_DEBUG ? "esbuild" : false,
// 为调试构建生成源代码映射 (sourcemap)
sourcemap: !!process.env.TAURI_DEBUG
},
esbuild: {
// pure: ["console.log"],
drop: ["debugger"]
}
},
app: {
rootId: "__easytier",
cdnURL: "./",
buildAssetsDir: "__easytier/",
head: {
meta: [
{
name: "viewport",
content: "width=device-width, initial-scale=1"
},
{
charset: "utf-8"
}
],
title: "easytier-game"
// link: [],
// style: [],
// script: [],
// noscript: []
}
},
compatibilityDate: "2024-11-12"
postcss: {
plugins: {
tailwindcss: {},
autoprefixer: {}
}
},
app: {
rootId: "__easytier",
cdnURL: "./",
buildAssetsDir: "__easytier/",
head: {
meta: [
{
name: "viewport",
content: "width=device-width, initial-scale=1"
},
{
charset: "utf-8"
}
],
title: "easytier-game"
// link: [],
// style: [],
// script: [],
// noscript: []
}
},
compatibilityDate: "2024-11-12"
});
+17 -17
View File
@@ -3,7 +3,7 @@
"private": true,
"author": "leizi97",
"description": "A simple network initiator based on Easytier",
"version": "1.4.1",
"version": "1.4.4",
"scripts": {
"dev": "nuxt dev --dotenv env/.env.dev --host 0.0.0.0",
"build": "nuxt generate --dotenv env/.env.prod",
@@ -13,29 +13,29 @@
"devDependencies": {
"@element-plus/icons-vue": "^2.3.1",
"@element-plus/nuxt": "^1.1.1",
"@nuxtjs/tailwindcss": "6.13.1",
"@pinia/nuxt": "0.9.0",
"@tauri-apps/api": "^2.2.0",
"@tauri-apps/cli": "2.2.7",
"@nuxtjs/tailwindcss": "6.13.2",
"@pinia/nuxt": "0.11.0",
"@tauri-apps/api": "2.5.0",
"@tauri-apps/cli": "2.5.0",
"@tauri-apps/plugin-cli": "^2.2.0",
"@tauri-apps/plugin-clipboard-manager": "2.2.0",
"@tauri-apps/plugin-dialog": "2.2.0",
"@tauri-apps/plugin-fs": "^2.2.0",
"@tauri-apps/plugin-log": "2.2.1",
"@tauri-apps/plugin-shell": "^2.2.0",
"@tauri-apps/plugin-window-state": "2.2.1",
"@tauri-apps/plugin-clipboard-manager": "2.2.2",
"@tauri-apps/plugin-dialog": "2.2.1",
"@tauri-apps/plugin-fs": "2.2.1",
"@tauri-apps/plugin-log": "2.3.1",
"@tauri-apps/plugin-shell": "2.2.1",
"@tauri-apps/plugin-window-state": "2.2.2",
"@types/lodash-es": "^4.17.12",
"@vitejs/plugin-vue-jsx": "^4.1.1",
"@vueuse/core": "12.4.0",
"@vitejs/plugin-vue-jsx": "4.1.2",
"@vueuse/core": "12.7.0",
"archiver": "^7.0.1",
"element-plus": "2.9.4",
"element-plus": "2.9.7",
"less": "4.2.1",
"lodash-es": "^4.17.21",
"nuxt": "3.15.4",
"pinia": "2.3.1",
"nuxt": "3.16.2",
"pinia": "3.0.2",
"pinia-plugin-persistedstate": "^4.2.0",
"postcss": "^8.4.38",
"prettier": "3.4.2",
"prettier": "3.5.2",
"prettier-plugin-tailwindcss": "0.6.11"
}
}
+79 -22
View File
@@ -2,8 +2,8 @@
<div class="flex h-full flex-col items-start overflow-auto px-[25px]">
<div class="flex flex-nowrap items-center gap-[15px]">
<div class="flex flex-nowrap items-center gap-[5px]">
<ElCheckbox v-model="mainStore.config.enableCustomProtocol">默认直连(p2p)使用的协议</ElCheckbox>
<ElTooltip content="如果没有支持该协议的节点地址,程序会自动处理,请放心使用">
<ElCheckbox v-model="mainStore.config.enableCustomProtocol">直连(P2P)优先使用传输协议</ElCheckbox>
<ElTooltip content="若无法建立指定的协议,会自动使用可建立连接的协议">
<ElIcon><QuestionFilled /></ElIcon>
</ElTooltip>
</div>
@@ -24,7 +24,7 @@
</div>
</div>
<div>
<ElCheckbox v-model="mainStore.config.relayAllPeerrpc">帮助对等节点建立直连(p2p)通信</ElCheckbox>
<ElCheckbox v-model="mainStore.config.relayAllPeerrpc">帮助他人建立直连(P2P)连接</ElCheckbox>
</div>
<div><ElCheckbox v-model="mainStore.config.connectAfterStart">软件启动后自动"启动联机"(搭配开机自启无感联机)</ElCheckbox></div>
<div class="flex flex-nowrap items-center gap-[15px]">
@@ -38,8 +38,8 @@
</div>
<div><ElCheckbox v-model="mainStore.config.enablePreventSleep">防止系统休眠(比如:屏幕会一直亮着)</ElCheckbox></div>
<div class="flex flex-nowrap items-center gap-[5px]">
<ElCheckbox v-model="mainStore.config.latencyfirst">延迟优先模式将尝试使用低延迟路径转发流量</ElCheckbox>
<ElTooltip content="视网络质量进行选择,可能会出现中转与直连(p2p)来回切换的情况">
<ElCheckbox v-model="mainStore.config.latencyfirst">使用低延迟模式</ElCheckbox>
<ElTooltip content="弱网环境下可能会导致网络延迟延迟忽高忽低">
<ElIcon><QuestionFilled /></ElIcon>
</ElTooltip>
</div>
@@ -124,10 +124,11 @@
</template>
</ElDialog>
</div>
<div class="flex items-center gap-[10px]">
<!-- <div class="flex items-center gap-[10px]">
<ElCheckbox
:disabled="mainStore.config.disbleListenner"
v-model="mainStore.config.enableCustomListenerV6"
:model-value="mainStore.config.enableCustomListenerV6"
@change="handleCustomListenerV6Change"
>
自定义IPV6监听地址
</ElCheckbox>
@@ -140,23 +141,23 @@
placeholder="请输入自定义IPV6监听地址"
/>
</div>
<ElTooltip content="例如:tcp://[::]:11010,如果未设置,将在随机UDP端口上监听">
<ElTooltip content="例如:tcp://[::]:11010,如果未设置,将在随机UDP端口上监听(内核版本2.2.3之后,ipv6监听被移除并合并到'自定义监听')">
<ElIcon><QuestionFilled /></ElIcon>
</ElTooltip>
<CoreVersionWarning version="2.1.0" />
</div>
</div> -->
<ElDivider />
<div class="flex items-center gap-[10px]">
<ElCheckbox v-model="mainStore.config.devName">自定义网卡名</ElCheckbox>
<ElCheckbox v-model="mainStore.config.devName">自定义虚拟网卡名</ElCheckbox>
<ElInput
size="small"
maxlength="10"
v-model="mainStore.config.devNameValue"
placeholder="请输入网卡名"
placeholder="请输入虚拟网卡名"
/>
</div>
<div class="flex items-center gap-[10px]">
<ElCheckbox v-model="mainStore.config.enableNetCardMetric">自定义easytier网卡跃点</ElCheckbox>
<ElCheckbox v-model="mainStore.config.enableNetCardMetric">自定义虚拟网卡优先级</ElCheckbox>
<ElInputNumber
controls-position="right"
:min="1"
@@ -166,9 +167,9 @@
:precision="0"
size="small"
v-model="mainStore.config.netCardMetricValue"
placeholder="请选择跃点数"
placeholder="请输入优先级"
/>
<ElTooltip content="设置easytier网卡的跃点,提升网卡优先级,跃点越小,网卡优先级越高">
<ElTooltip content="数值越小,优先级越高">
<ElIcon><QuestionFilled /></ElIcon>
</ElTooltip>
</div>
@@ -177,17 +178,59 @@
size="small"
type="warning"
>
(不使用自定义网卡名,那么联机时默认会生成一个名为 "et_xxx" 的网卡也可以使用 设置跃点 功能除非你启用了下面的功能)
(不使用自定义虚拟网卡名,那么联机时默认会生成一个名为 "et_xxx" 的网卡也可以使用 自定义虚拟网卡优先级
功能除非你启用了下面的功能)
</ElText>
</div>
<div><ElCheckbox v-model="mainStore.config.noTun">不创建TUN设备(网卡)可以使用子网代理访问节点</ElCheckbox></div>
<div class="flex items-center gap-[5px]">
<ElCheckbox v-model="mainStore.config.noTun">不创建TUN虚拟网卡</ElCheckbox>
<ElTooltip content="开启后该节点无法主动访问其他节点">
<ElIcon><QuestionFilled /></ElIcon>
</ElTooltip>
</div>
<div class="flex items-center gap-[5px]">
<div><ElCheckbox v-model="mainStore.config.bindDeviceEnable">绑定物理网卡</ElCheckbox></div>
<!-- <div class="flex items-center gap-[5px]"> -->
<!-- <ElSelect
placeholder="选择设备"
v-model="mainStore.config.bindDevice"
filterable
no-data-text="暂无网卡设备数据请刷新"
>
<ElOption
v-for="guid in guids"
:key="guid[0]"
:label="guid[1]"
:value="guid[0]"
></ElOption>
</ElSelect> -->
<!-- <ElButton @click="getGuids">刷新</ElButton> -->
<ElTooltip content="将连接器的套接字绑定到物理设备以避免路由问题。比如子网代理网段与某节点的网段冲突,绑定物理设备后可以与该节点正常通信">
<ElIcon><QuestionFilled /></ElIcon>
</ElTooltip>
<!-- </div> -->
<CoreVersionWarning version="2.2.3" />
</div>
<ElDivider />
<div><ElCheckbox v-model="mainStore.config.enablExitNode">允许此节点成为出口节点</ElCheckbox></div>
<div><ElCheckbox v-model="mainStore.config.disableEncryption">禁用对等节点通信的加密</ElCheckbox></div>
<div><ElCheckbox v-model="mainStore.config.multiThread">启用多线程运行</ElCheckbox></div>
<div class="flex items-center gap-[5px]">
<ElCheckbox v-model="mainStore.config.disableEncryption">关闭信息加密</ElCheckbox>
<ElTooltip content="关闭后通信数据将在互联网上明文传输,如房间名和密码">
<ElIcon><QuestionFilled /></ElIcon>
</ElTooltip>
</div>
<div class="flex items-center gap-[5px]">
<ElCheckbox v-model="mainStore.config.multiThread">开启多线程</ElCheckbox>
<ElTooltip content="开启后可能会提高网络性能">
<ElIcon><QuestionFilled /></ElIcon>
</ElTooltip>
</div>
<div class="flex items-center gap-[10px]">
<ElText>压缩算法</ElText>
<ElText>传输数据压缩算法</ElText>
<div class="w-[160px]">
<ElSelect
size="small"
@@ -210,8 +253,8 @@
<ElDivider />
<div class="flex items-center gap-[10px]">
<ElCheckbox v-model="mainStore.config.useSmoltcp">为子网代理启用smoltcp堆栈</ElCheckbox>
<ElTooltip content="使用用户态TCP/IP协议栈smoltcp,避免操作系统防火墙问题导致无法子网代理">
<ElCheckbox v-model="mainStore.config.useSmoltcp">为子网代理和 KCP 代理开启用户网络栈</ElCheckbox>
<ElTooltip content="开启后会降低网络性能,但不需要配置防火墙">
<ElIcon><QuestionFilled /></ElIcon>
</ElTooltip>
</div>
@@ -269,6 +312,20 @@
listenerDialogData.visible = false;
};
// const handleCustomListenerV6Change = async (value: boolean) => {
// if (value) {
// const [error, _] = await ElConfirmDanger("内核版本2.2.3之后,ipv6监听被移除并合并到'自定义监听',请谨慎使用", "警告", {
// confirmButtonText: "继续使用",
// cancelButtonText: "取消"
// });
// if (!error) {
// mainStore.config.enableCustomListenerV6 = value;
// }
// } else {
// mainStore.config.enableCustomListenerV6 = value;
// }
// };
const mainStore = useMainStore();
const data = ["trace", "debug", "info", "warn", "error", "off"];
const guids = ref<string[][]>([]);
@@ -297,7 +354,7 @@
};
// 为bind_device功能增加改方法
const _getGuids = async () => {
const getGuids = async () => {
const guidsValue = await invoke<string[][]>("get_network_adapter_guids");
guids.value = guidsValue && guidsValue.length > 0 ? guidsValue : [];
};
+13 -9
View File
@@ -1,12 +1,18 @@
<template>
<div class="flex h-full flex-col gap-[10px]">
<ElRadioGroup
:disabled="!data.isSwitchEnable"
v-model="mainStore.cidrEnable"
>
<ElRadioButton :value="true">开启</ElRadioButton>
<ElRadioButton :value="false">关闭</ElRadioButton>
</ElRadioGroup>
<div class="flex items-center gap-[10px]">
<ElRadioGroup
:disabled="!data.isSwitchEnable"
v-model="mainStore.cidrEnable"
>
<ElRadioButton :value="true">开启</ElRadioButton>
<ElRadioButton :value="false">关闭</ElRadioButton>
</ElRadioGroup>
<div class="flex items-center gap-[10px]">
<ElCheckbox v-model="mainStore.proxyForwardBySystem">通过系统内核转发子网代理数据包禁用内置NAT</ElCheckbox>
<CoreVersionWarning version="2.2.3" />
</div>
</div>
<div class="flex-1 overflow-auto">
<ElInput
placeholder="例如: 192.168.1.0/24 一行一个"
@@ -113,6 +119,4 @@
onBeforeUnmount(() => {
unlistenStart && unlistenStart();
});
</script>
+44 -10
View File
@@ -252,6 +252,10 @@
</ElFormItem>
</div>
</ElForm>
<!-- <div class="flex justify-center items-center gap-[5px]">
<el-button>分享当前配置</el-button>
<el-button>导入联机配置</el-button>
</div> -->
<div class="mt-auto flex items-start">
<div>
<div class="pt-[4px]">
@@ -330,7 +334,7 @@
</div>
<div class="mt-[10px] pl-[2px]">
<ElTooltip
placement="left"
placement="top"
content="日志"
>
<ElButton
@@ -407,7 +411,7 @@
<ElBadge
badge-class="!text-[9px] cursor-pointer"
:hidden="!data.hasNewVersion"
:hidden="!hasNewVersion"
:offset="[6, 7]"
value="N"
>
@@ -711,7 +715,7 @@
SwitchFilled
} from "@element-plus/icons-vue";
import { reactive, onBeforeUnmount, onMounted, ref, toRaw, computed } from "vue";
import { useTray, setTrayRunState, setTrayTooltip, checkNewVersion } from "~/composables/tray";
import { useTray, setTrayRunState, setTrayTooltip, checkNewVersion, hasNewVersion } from "~/composables/tray";
import { getMatches } from "@tauri-apps/plugin-cli";
import { initStartWinIpBroadcast } from "~/composables/netcard";
import useMainStore from "@/stores/index";
@@ -750,7 +754,7 @@
// console.error(config);
const protocols = supportProtocols();
const data = reactive({
hasNewVersion: false, //easytierGame有没有新版
//easytierGame有没有新版
logVisible: false,
cidrVisible: false,
advanceVisible: false,
@@ -1116,6 +1120,26 @@
}
};
const compatibleIpv6Listener = async () => {
// ipv6监听在后续版本合并到customListenner里了,这里做兼容处理
if (config.enableCustomListenerV6 && config.customListenerV6Data) {
const customListener = config.customListenerV6Data.trim();
if (customListener) {
const customListenerV4 = config.customListenerData
.trim()
.split("\n")
.map(el => el.trim())
.filter(el => el);
if (!customListenerV4.includes(customListener)) {
config.customListenerData += `\n${customListener}`;
}
}
}
if (config.enableCustomListenerV6) {
config.enableCustomListenerV6 = false;
}
};
const initConnectAfterStart = async () => {
if (config.connectAfterStart && data.coreVersion) {
await reset();
@@ -1132,10 +1156,12 @@
try {
const decoder = new TextDecoder("utf-8");
const guiJsonStr = decoder.decode(guiJsonStrUint8);
const regex = /^(\s*\/\/.*)/gm;
const regex2 = /(,?)\s*\/\/.*(?=\n|$|\r\n)/gm;
const resultStr = guiJsonStr.replace(regex, "").replace(regex2, "$1");
const guiJson = JSON.parse(resultStr);
// console.log(guiJsonStr);
// const regex = /^(\s*\/\/.*)/gm;
// const regex2 = /(,?)\s*\/\/.*(?=\n|$|\r\n)/gm;
// const resultStr = guiJsonStr.replace(regex, "").replace(regex2, "$1");
// console.log(resultStr);
const guiJson = JSON.parse(guiJsonStr);
let saveServerUrl = "";
if (guiJson.serverUrl) {
if (Array.isArray(guiJson.serverUrl)) {
@@ -1153,6 +1179,7 @@
config: {
...mainStore.config,
...guiJson,
customListenerData: guiJson?.customListenerData.join("\n") || "",
serverUrl: saveServerUrl
}
});
@@ -1210,6 +1237,7 @@
await compatibleInitAutoStart();
// await initAutoStart();
await initStartWinIpBroadcast();
await compatibleIpv6Listener();
await getCoreVersion();
await listenObj.listenThreadId();
await listenObj.listenServerThreadId();
@@ -1220,7 +1248,6 @@
initPreventSleep();
mountedShow(); // 不需要await
closePrevent();
data.hasNewVersion = await checkNewVersion();
dataSubscribe(async () => {
if (mainStore.createConfigInEasytier) {
b(async () => {
@@ -1229,6 +1256,7 @@
}
});
getReleaseList();
checkNewVersion();
});
onBeforeUnmount(() => {
@@ -1372,6 +1400,12 @@
if (config.disableKcpInput) {
args.push("--disable-kcp-input");
}
if (config.bindDeviceEnable) {
args.push("--bind-device", "true");
}
if (mainStore.proxyForwardBySystem) {
args.push("--proxy-forward-by-system");
}
return args;
};
@@ -1793,7 +1827,7 @@
cidrTimer && clearInterval(cidrTimer);
cidrTimer = setInterval(() => {
appWindow.emitTo({ kind: "WebviewWindow", label: "cidr" }, "route", data.isStart);
}, 1000);
}, 650);
},
() => {
cidrTimer && clearInterval(cidrTimer);
+6 -1
View File
@@ -54,7 +54,11 @@
prop="lat_ms"
width="100"
label="延迟/ms"
></ElTableColumn>
>
<template #default="{ row }">
{{ row.lat_ms && !isNaN(Number(row.lat_ms)) ? Number(row.lat_ms).toFixed(0) : row.lat_ms || "-" }}
</template>
</ElTableColumn>
<ElTableColumn
sortable
width="100"
@@ -108,6 +112,7 @@
import { ATJ, parseCliInfo } from "@/utils";
import { ElConfirmDanger } from "~/utils/element";
import { getCurrentWindow } from "@tauri-apps/api/window";
import { isNaN } from "lodash-es";
// enum NatType {
// // has NAT; but own a single public IP, port is not changed
// Unknown = 0;
+1838 -1905
View File
File diff suppressed because it is too large Load Diff
+596 -430
View File
File diff suppressed because it is too large Load Diff
+18 -16
View File
@@ -1,6 +1,6 @@
[package]
name = "easytier-game"
version = "1.4.1"
version = "1.4.4"
homepage = "https://github.com/EasyTier/EasyTier"
repository = "https://github.com/EasyTier/EasytierGame"
description = "A simple network initiator based on Easytier"
@@ -18,32 +18,34 @@ name = "app_lib"
crate-type = ["staticlib", "cdylib", "rlib"]
[build-dependencies]
tauri-build = { version = "2.0.5", features = [] }
tauri-build = { version = "2.2.0", features = [] }
# prost-build = "0.13.2"
[target.x86_64-pc-windows-msvc.build-dependencies]
thunk-rs = { git = "https://github.com/easytier/thunk.git", default-features = false, features = ["win7"] } # 需要安装curl和7zip,并添加他们的路径到环境变量
[dependencies]
serde_json = "1.0.137"
serde = { version = "1.0.217", features = ["derive"] }
log = "0.4.25"
tauri = { version = "2.2.5", features = [ "protocol-asset",
log = "0.4.26"
tauri = { version = "2.5.0", features = [ "protocol-asset",
"tray-icon",
"image-png",
"image-ico",
"devtools"
"image-ico"
] }
tauri-plugin-log = "2.2.1"
tauri-plugin-shell = "2.2.0"
tauri-plugin-log = "2.3.1"
tauri-plugin-shell = "2.2.1"
reqwest = { version = "0.12.12", features = ["json"] }
zip = "2.2.2"
zip = "2.2.3"
sysinfo = '0.33.1'
planif = { git = "https://github.com/mattrobineau/planif", tag = "1.0.1" }
whoami = "1.5.2"
tauri-plugin-fs = "2.2.0"
tauri-plugin-clipboard-manager = "2.2.1"
rand = "0.8.5"
tauri-plugin-fs = "2.2.1"
tauri-plugin-clipboard-manager = "2.2.2"
rand = "0.9.0"
tokio = { version = "1.43.0", features = ["process"] }
tauri-plugin-dialog = "2.2.0"
tauri-plugin-dialog = "2.2.1"
# prost = "0.13"
# prost-types = "0.13"
hashbrown = "0.15.2"
@@ -51,9 +53,9 @@ hashbrown = "0.15.2"
[dependencies.windows]
version = "0.58.0"
features = ["Win32_System_TaskScheduler", "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]
tauri-plugin-cli = "2.2.0"
tauri-plugin-single-instance = "2.2.1"
tauri-plugin-window-state = "2.2.1"
tauri-plugin-single-instance = "2.2.3"
tauri-plugin-window-state = "2.2.2"
+1
View File
@@ -1,4 +1,5 @@
fn main() {
thunk::thunk();
let mut windows = tauri_build::WindowsAttributes::new();
windows = windows.app_manifest(
r#"
+29 -19
View File
@@ -4,27 +4,37 @@
"tcp",
"udp"
], // 协议类型
// easytier服务地址 - 可填写多个 方式1,逗号分隔,"xxxx.cn,yyyy.com" 方式2,数组 ["xxxx.cn","yyyy.com"] (默认选中第一个)
"serverUrl": "public.easytier.top:11010",
"networkName": "", // 网络名
"networkPassword": "", // 网络密码
"hostname": "configTest", // 主机名
"ipv4": "10.126.126.1", // IP地址(选填,下面有dhcp)
"disableIpv6": false, // 禁用ipv6
"disbleListenner": true, // 禁用端口监听
"serverUrl": "public.easytier.top:11010",
"enableCustomListener": true,
"customListenerData": [
"tcp://0.0.0.0:11010",
"udp://0.0.0.0:11010",
"tcp://[::]:11010"
],
"networkName": "", //房间名
"networkPassword": "", //房间密码
"hostname": "", //主机名
"ipv4": "", // 虚拟IP地址
"disableIpv6": false, // 禁用ipv6
"enableCustomListenerV6": true, // 启用ipv6监听
"customListenerV6Data": "udp://[::]:11010", // ipv6监听地址
"disbleListenner": false, // 禁用监听
"disableEncryption": false, // 禁用加密
"enablExitNode": false, // 启用出口节点
"noTun": false, // 禁用tun
"latencyfirst": false, // 延迟优先
"disableUdpHolePunching": false, // 禁用udp打洞
"disbleP2p": false, // 禁用p2p, 强制中转
"dhcp": false, // 动态分配IP
"devName": false, // 是否启用自定义网卡名
"devNameValue": "", // 网卡名(启用devName之后才生效)
"enableCustonProtocol": false, // 是否启用自定义协议
"customProtocol": "tcp", // 自定义协议类型
"enableNetCardMetric": false, // 自定义easytier每次生成的网卡跃点
"netCardMetricValue": 1, // 网卡跃点数量(1-9999)
"enableKcpProxy": false, // 启用kcp代理
"disableKcpInput": false //禁用kcp输入
"disableUdpHolePunching": false, // 禁用udp打洞
"disbleP2p": false, // 禁用p2p 强制中转
"dhcp": true, // 启用dhcp,动态获取IP
"devName": true, // 启用自定义网卡名
"devNameValue": "etgame", // 自定义网卡名
"enableCustomProtocol": true, // 自定义p2p时默认协议
"customProtocol": "tcp", // 自定义p2p时使用的协议类型
"enableNetCardMetric": true, // 启用自定义网卡跃点
"netCardMetricValue": 1, // 网卡跃点
"enablePreventSleep": false, // 启用防止睡眠
"compression": "none", // 压缩算法
"enableKcpProxy": true, // 启用kcp代理
"disableKcpInput": false // 禁用kcp输入
}
Binary file not shown.
Binary file not shown.
+5 -5
View File
@@ -92,13 +92,13 @@ fn generate_random_user_agent() -> String {
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:{version}) Gecko/20100101 Firefox/{version}",
];
let mut rng = rand::thread_rng();
let template = user_agents[rng.gen_range(0..user_agents.len())];
let mut rng = rand::rng();
let template = user_agents[rng.random_range(0..user_agents.len())];
// 生成随机版本号
let version_major: u8 = rng.gen_range(70..90);
let version_minor: u8 = rng.gen_range(0..10);
let version_patch: u8 = rng.gen_range(0..10);
let version_major: u8 = rng.random_range(70..90);
let version_minor: u8 = rng.random_range(0..10);
let version_patch: u8 = rng.random_range(0..10);
let version = format!("{}.{}.{}", version_major, version_minor, version_patch);
// 替换模板中的版本号占位符
+2 -2
View File
@@ -1,7 +1,7 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "easytier-game",
"version": "1.4.1",
"version": "1.4.4",
"identifier": "com.tauri.easytier-game",
"build": {
@@ -12,7 +12,7 @@
"app": {
"windows": [
{
"title": "easytier-game 1.4.1",
"title": "easytier-game 1.4.4",
"label": "main",
"minWidth": 340,
"width": 340,
+13 -6
View File
@@ -15,8 +15,8 @@ const store = defineStore("main", {
disableIpv6: false, // 是否禁用IPv6
port: "11010", // 监听端口号
enableCustomListener: true, // 是否自定义监听
customListenerV6Data: "udp://[::]:11010", //自定义ipv6监听
enableCustomListenerV6: true, // 是否自定义监听
enableCustomListenerV6: true, // 是否自定义IPV6监听
customListenerV6Data: "udp://[::]:11010", //自定义ipv6监
customListenerData: "tcp://0.0.0.0:11010\nudp://0.0.0.0:11010\ntcp://[::]:11010", // 自定义监听地址
disbleListenner: false, // 是否禁用监听
disableEncryption: false, // 是否禁用加密
@@ -41,6 +41,7 @@ const store = defineStore("main", {
compression: "none", //加密算法
enableKcpProxy: true, //启用kcp代理 默认开启
disableKcpInput: false, //禁用kcp输入
bindDeviceEnable: false, //是否绑定设备
},
serverConfig: {
enableWhiteList: true, // 是否启用白名单
@@ -51,7 +52,8 @@ const store = defineStore("main", {
port: "11010" // 服务器端口
},
cidrEnable: false,
basePeers: ["public.easytier.top:11010","public.easytier.net:11010"],
proxyForwardBySystem: false, // 是否通过系统内核转发子网代理数据包,禁用内置NAT
basePeers: ["public.easytier.top:11010", "public.easytier.net:11010"],
theme: false, //主题 false light true dark
configStartEnable: false, //使用配置文件启动
configPath: "", //配置文件路径
@@ -67,8 +69,9 @@ const store = defineStore("main", {
winipBcPid: 0,
winipBcStart: false,
latestTagName: "",
gameList: [] as Array<{name: string, exePath: string, id: string, coverImg?: string; showImg: string}>, // 游戏列表
gameList: [] as Array<{ name: string; exePath: string; id: string; coverImg?: string; showImg: string }> // 游戏列表
};
},
persist: {
@@ -101,7 +104,7 @@ const store = defineStore("main", {
"config.enableNetCardMetric",
"config.netCardMetricValue",
"config.port",
"config.disbleListenner",
"config.enableCustomListener",
"config.customListenerData",
@@ -116,6 +119,8 @@ const store = defineStore("main", {
"config.enableKcpProxy",
"config.disableKcpInput",
"config.bindDeviceEnable",
"serverConfig.autoStart",
// 'serverConfig.enableListener',
"serverConfig.enableWhiteList",
@@ -124,6 +129,7 @@ const store = defineStore("main", {
"serverConfig.port",
"cidrEnable",
"proxyForwardBySystem",
"basePeers",
"theme",
"configStartEnable",
@@ -136,7 +142,8 @@ const store = defineStore("main", {
"delayInjectDll",
"forceBindInput",
"forceBindFile",
"latestTagName",
"gameList"
]
// // 除了这些,其他都要存下来