mirror of
https://github.com/EasyTier/EasyTier.git
synced 2024-11-16 11:42:27 +08:00
🎈 perf: event log
This commit is contained in:
parent
9824d0adaa
commit
dd941681ce
|
@ -4,84 +4,23 @@
|
||||||
"path": "."
|
"path": "."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"name": "gui",
|
||||||
"path": "easytier-gui"
|
"path": "easytier-gui"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"name": "core",
|
||||||
"path": "easytier"
|
"path": "easytier"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "vpnservice",
|
||||||
|
"path": "tauri-plugin-vpnservice"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"eslint.useFlatConfig": true,
|
"i18n-ally.sourceLanguage": "cn",
|
||||||
|
"i18n-ally.keystyle": "nested",
|
||||||
|
"i18n-ally.sortKeys": true,
|
||||||
|
// Disable the default formatter
|
||||||
"prettier.enable": false,
|
"prettier.enable": false,
|
||||||
"editor.formatOnSave": false,
|
|
||||||
"editor.codeActionsOnSave": {
|
|
||||||
"source.fixAll.eslint": "explicit",
|
|
||||||
"source.organizeImports": "never"
|
|
||||||
},
|
|
||||||
"eslint.rules.customizations": [
|
|
||||||
{
|
|
||||||
"rule": "style/*",
|
|
||||||
"severity": "off"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "style/eol-last",
|
|
||||||
"severity": "error"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "format/*",
|
|
||||||
"severity": "off"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "*-indent",
|
|
||||||
"severity": "off"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "*-spacing",
|
|
||||||
"severity": "off"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "*-spaces",
|
|
||||||
"severity": "off"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "*-order",
|
|
||||||
"severity": "off"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "*-dangle",
|
|
||||||
"severity": "off"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "*-newline",
|
|
||||||
"severity": "off"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "*quotes",
|
|
||||||
"severity": "off"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "*semi",
|
|
||||||
"severity": "off"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"eslint.validate": [
|
|
||||||
"code-workspace",
|
|
||||||
"javascript",
|
|
||||||
"javascriptreact",
|
|
||||||
"typescript",
|
|
||||||
"typescriptreact",
|
|
||||||
"vue",
|
|
||||||
"html",
|
|
||||||
"markdown",
|
|
||||||
"json",
|
|
||||||
"jsonc",
|
|
||||||
"yaml",
|
|
||||||
"toml",
|
|
||||||
"gql",
|
|
||||||
"graphql"
|
|
||||||
],
|
|
||||||
"i18n-ally.localesPaths": [
|
|
||||||
"easytier-gui/locales"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
7
easytier-gui/.vscode/settings.json
vendored
7
easytier-gui/.vscode/settings.json
vendored
|
@ -12,12 +12,7 @@
|
||||||
"unplugin",
|
"unplugin",
|
||||||
"pnpm"
|
"pnpm"
|
||||||
],
|
],
|
||||||
"i18n-ally.sourceLanguage": "en",
|
|
||||||
"i18n-ally.keystyle": "nested",
|
|
||||||
"i18n-ally.localesPaths": "locales",
|
"i18n-ally.localesPaths": "locales",
|
||||||
"i18n-ally.sortKeys": true,
|
|
||||||
// Disable the default formatter
|
|
||||||
"prettier.enable": false,
|
|
||||||
"editor.formatOnSave": false,
|
"editor.formatOnSave": false,
|
||||||
// Auto fix
|
// Auto fix
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
|
@ -83,4 +78,4 @@
|
||||||
"jsonc",
|
"jsonc",
|
||||||
"yaml"
|
"yaml"
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -91,3 +91,23 @@ about:
|
||||||
license: 许可证
|
license: 许可证
|
||||||
description: 一个简单、安全、去中心化的内网穿透 VPN 组网方案,使用 Rust 语言和 Tokio 框架实现。
|
description: 一个简单、安全、去中心化的内网穿透 VPN 组网方案,使用 Rust 语言和 Tokio 框架实现。
|
||||||
check_update: 检查更新
|
check_update: 检查更新
|
||||||
|
|
||||||
|
event:
|
||||||
|
Unknown: 未知
|
||||||
|
TunDeviceReady: Tun设备就绪
|
||||||
|
TunDeviceError: Tun设备错误
|
||||||
|
PeerAdded: 对端添加
|
||||||
|
PeerRemoved: 对端移除
|
||||||
|
PeerConnAdded: 对端连接添加
|
||||||
|
PeerConnRemoved: 对端连接移除
|
||||||
|
ListenerAdded: 监听器添加
|
||||||
|
ListenerAddFailed: 监听器添加失败
|
||||||
|
ListenerAcceptFailed: 监听器接受连接失败
|
||||||
|
ConnectionAccepted: 连接已接受
|
||||||
|
ConnectionError: 连接错误
|
||||||
|
Connecting: 正在连接
|
||||||
|
ConnectError: 连接错误
|
||||||
|
VpnPortalClientConnected: VPN门户客户端已连接
|
||||||
|
VpnPortalClientDisconnected: VPN门户客户端已断开连接
|
||||||
|
DhcpIpv4Changed: DHCP IPv4地址更改
|
||||||
|
DhcpIpv4Conflicted: DHCP IPv4地址冲突
|
||||||
|
|
|
@ -90,3 +90,23 @@ about:
|
||||||
license: License
|
license: License
|
||||||
description: 'EasyTier is a simple, safe and decentralized VPN networking solution implemented with the Rust language and Tokio framework.'
|
description: 'EasyTier is a simple, safe and decentralized VPN networking solution implemented with the Rust language and Tokio framework.'
|
||||||
check_update: Check Update
|
check_update: Check Update
|
||||||
|
|
||||||
|
event:
|
||||||
|
Unknown: Unknown
|
||||||
|
TunDeviceReady: TunDeviceReady
|
||||||
|
TunDeviceError: TunDeviceError
|
||||||
|
PeerAdded: PeerAdded
|
||||||
|
PeerRemoved: PeerRemoved
|
||||||
|
PeerConnAdded: PeerConnAdded
|
||||||
|
PeerConnRemoved: PeerConnRemoved
|
||||||
|
ListenerAdded: ListenerAdded
|
||||||
|
ListenerAddFailed: ListenerAddFailed
|
||||||
|
ListenerAcceptFailed: ListenerAcceptFailed
|
||||||
|
ConnectionAccepted: ConnectionAccepted
|
||||||
|
ConnectionError: ConnectionError
|
||||||
|
Connecting: Connecting
|
||||||
|
ConnectError: ConnectError
|
||||||
|
VpnPortalClientConnected: VpnPortalClientConnected
|
||||||
|
VpnPortalClientDisconnected: VpnPortalClientDisconnected
|
||||||
|
DhcpIpv4Changed: DhcpIpv4Changed
|
||||||
|
DhcpIpv4Conflicted: DhcpIpv4Conflicted
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"$schema": "../gen/schemas/desktop-schema.json",
|
||||||
"identifier": "migrated",
|
"identifier": "migrated",
|
||||||
"description": "permissions that were migrated from v1",
|
"description": "permissions that were migrated from v1",
|
||||||
"local": true,
|
"local": true,
|
||||||
|
@ -13,6 +14,7 @@
|
||||||
"core:window:allow-show",
|
"core:window:allow-show",
|
||||||
"core:window:allow-hide",
|
"core:window:allow-hide",
|
||||||
"core:window:allow-set-focus",
|
"core:window:allow-set-focus",
|
||||||
|
"core:window:allow-set-title",
|
||||||
"core:app:default",
|
"core:app:default",
|
||||||
"core:resources:default",
|
"core:resources:default",
|
||||||
"core:menu:default",
|
"core:menu:default",
|
||||||
|
@ -24,7 +26,6 @@
|
||||||
"shell:default",
|
"shell:default",
|
||||||
"process:default",
|
"process:default",
|
||||||
"clipboard-manager:default",
|
"clipboard-manager:default",
|
||||||
"core:tray:default",
|
|
||||||
"core:tray:allow-new",
|
"core:tray:allow-new",
|
||||||
"core:tray:allow-set-menu",
|
"core:tray:allow-set-menu",
|
||||||
"core:tray:allow-set-title",
|
"core:tray:allow-set-title",
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { getCurrentWindow } from '@tauri-apps/api/window'
|
||||||
|
import pkg from '~/../package.json'
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
await getCurrentWindow().setTitle(`Easytier GUI: v${pkg.version}`)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<RouterView />
|
<RouterView />
|
||||||
</template>
|
</template>
|
||||||
|
|
2
easytier-gui/src/auto-imports.d.ts
vendored
2
easytier-gui/src/auto-imports.d.ts
vendored
|
@ -21,6 +21,7 @@ declare global {
|
||||||
const definePage: typeof import('unplugin-vue-router/runtime')['definePage']
|
const definePage: typeof import('unplugin-vue-router/runtime')['definePage']
|
||||||
const defineStore: typeof import('pinia')['defineStore']
|
const defineStore: typeof import('pinia')['defineStore']
|
||||||
const effectScope: typeof import('vue')['effectScope']
|
const effectScope: typeof import('vue')['effectScope']
|
||||||
|
const event2human: typeof import('./composables/utils')['event2human']
|
||||||
const generateMenuItem: typeof import('./composables/tray')['generateMenuItem']
|
const generateMenuItem: typeof import('./composables/tray')['generateMenuItem']
|
||||||
const getActivePinia: typeof import('pinia')['getActivePinia']
|
const getActivePinia: typeof import('pinia')['getActivePinia']
|
||||||
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
|
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
|
||||||
|
@ -83,6 +84,7 @@ declare global {
|
||||||
const shallowReadonly: typeof import('vue')['shallowReadonly']
|
const shallowReadonly: typeof import('vue')['shallowReadonly']
|
||||||
const shallowRef: typeof import('vue')['shallowRef']
|
const shallowRef: typeof import('vue')['shallowRef']
|
||||||
const storeToRefs: typeof import('pinia')['storeToRefs']
|
const storeToRefs: typeof import('pinia')['storeToRefs']
|
||||||
|
const timeAgoCn: typeof import('./composables/utils')['timeAgoCn']
|
||||||
const toRaw: typeof import('vue')['toRaw']
|
const toRaw: typeof import('vue')['toRaw']
|
||||||
const toRef: typeof import('vue')['toRef']
|
const toRef: typeof import('vue')['toRef']
|
||||||
const toRefs: typeof import('vue')['toRefs']
|
const toRefs: typeof import('vue')['toRefs']
|
||||||
|
|
32
easytier-gui/src/components/HumanEvent.vue
Normal file
32
easytier-gui/src/components/HumanEvent.vue
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { EventType } from '~/types/network'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
event: {
|
||||||
|
[key: string]: any
|
||||||
|
}
|
||||||
|
}>()
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
|
const eventKey = computed(() => {
|
||||||
|
const key = Object.keys(props.event)[0]
|
||||||
|
return Object.keys(EventType).includes(key) ? key : 'Unknown'
|
||||||
|
})
|
||||||
|
|
||||||
|
const eventValue = computed(() => {
|
||||||
|
const value = props.event[eventKey.value]
|
||||||
|
return typeof value === 'object' ? value : value
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Fieldset :legend="t(`event.${eventKey}`)">
|
||||||
|
<template v-if="eventKey !== 'Unknown'">
|
||||||
|
<div v-if="event.DhcpIpv4Changed">
|
||||||
|
{{ `${eventValue[0]} -> ${eventValue[1]}` }}
|
||||||
|
</div>
|
||||||
|
<pre v-else>{{ eventValue }}</pre>
|
||||||
|
</template>
|
||||||
|
<pre v-else>{{ eventValue }}</pre>
|
||||||
|
</Fieldset>
|
||||||
|
</template>
|
|
@ -325,7 +325,7 @@ function showEventLogs() {
|
||||||
<small class="text-surface-500 dark:text-surface-400">{{ useTimeAgo(Date.parse(slotProps.item[0])) }}</small>
|
<small class="text-surface-500 dark:text-surface-400">{{ useTimeAgo(Date.parse(slotProps.item[0])) }}</small>
|
||||||
</template>
|
</template>
|
||||||
<template #content="slotProps">
|
<template #content="slotProps">
|
||||||
{{ slotProps.item[1] }}
|
<HumanEvent :event="slotProps.item[1]" />
|
||||||
</template>
|
</template>
|
||||||
</Timeline>
|
</Timeline>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
@ -433,3 +433,9 @@ function showEventLogs() {
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style lang="postcss" scoped>
|
||||||
|
.p-timeline :deep(.p-timeline-event-opposite) {
|
||||||
|
@apply flex-none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -183,3 +183,28 @@ export interface PeerConnStats {
|
||||||
tx_packets: number
|
tx_packets: number
|
||||||
latency_us: number
|
latency_us: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum EventType {
|
||||||
|
TunDeviceReady = 'TunDeviceReady', // string
|
||||||
|
TunDeviceError = 'TunDeviceError', // string
|
||||||
|
|
||||||
|
PeerAdded = 'PeerAdded', // number
|
||||||
|
PeerRemoved = 'PeerRemoved', // number
|
||||||
|
PeerConnAdded = 'PeerConnAdded', // PeerConnInfo
|
||||||
|
PeerConnRemoved = 'PeerConnRemoved', // PeerConnInfo
|
||||||
|
|
||||||
|
ListenerAdded = 'ListenerAdded', // any
|
||||||
|
ListenerAddFailed = 'ListenerAddFailed', // any, string
|
||||||
|
ListenerAcceptFailed = 'ListenerAcceptFailed', // any, string
|
||||||
|
ConnectionAccepted = 'ConnectionAccepted', // string, string
|
||||||
|
ConnectionError = 'ConnectionError', // string, string, string
|
||||||
|
|
||||||
|
Connecting = 'Connecting', // any
|
||||||
|
ConnectError = 'ConnectError', // string, string, string
|
||||||
|
|
||||||
|
VpnPortalClientConnected = 'VpnPortalClientConnected', // string, string
|
||||||
|
VpnPortalClientDisconnected = 'VpnPortalClientDisconnected', // string, string, string
|
||||||
|
|
||||||
|
DhcpIpv4Changed = 'DhcpIpv4Changed', // ipv4 | null, ipv4 | null
|
||||||
|
DhcpIpv4Conflicted = 'DhcpIpv4Conflicted', // ipv4 | null
|
||||||
|
}
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
use std::{
|
use std::{env, io::Cursor, path::PathBuf};
|
||||||
env,
|
|
||||||
fs::File,
|
|
||||||
io::{copy, Cursor},
|
|
||||||
path::PathBuf,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
struct WindowsBuild {}
|
struct WindowsBuild {}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user