4 Commits

Author SHA1 Message Date
Flik
9f13b0d4e9 feat(app): 添加服务端和客户端更新功能以及系统状态监控
Some checks failed
Build Multi-Platform Binaries / build-binaries (amd64, darwin, server, false) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (amd64, linux, client, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (amd64, linux, server, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (amd64, windows, client, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (amd64, windows, server, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, client, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, server, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (arm64, darwin, server, false) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (arm64, linux, client, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (arm64, linux, server, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (arm64, windows, server, false) (push) Has been cancelled
Build Multi-Platform Binaries / build-frontend (push) Has been cancelled
- 在App.vue中新增服务端更新模态框和相关功能
- 添加applyServerUpdate API调用和更新确认对话框
- 实现客户端版本信息显示和更新检测功能
- 添加系统状态监控包括CPU、内存和磁盘使用情况
- 新增getClientSystemStats API接口获取客户端系统统计信息
- 更新go.mod和go.sum文件添加必要的依赖包
- 优化UI界面样式和交互体验
2026-01-22 21:32:03 +08:00
Flik
7cddb7b3e7 refactor(app): 移除 naive-ui 依赖并优化配置结构
All checks were successful
Build Multi-Platform Binaries / build-frontend (push) Successful in 31s
Build Multi-Platform Binaries / build-binaries (amd64, linux, client, true) (push) Successful in 1m30s
Build Multi-Platform Binaries / build-binaries (amd64, darwin, server, false) (push) Successful in 1m39s
Build Multi-Platform Binaries / build-binaries (amd64, windows, client, true) (push) Successful in 1m19s
Build Multi-Platform Binaries / build-binaries (amd64, linux, server, true) (push) Successful in 1m43s
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, client, true) (push) Successful in 1m18s
Build Multi-Platform Binaries / build-binaries (amd64, windows, server, true) (push) Successful in 1m38s
Build Multi-Platform Binaries / build-binaries (arm64, darwin, server, false) (push) Successful in 1m50s
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, server, true) (push) Successful in 2m6s
Build Multi-Platform Binaries / build-binaries (arm64, linux, client, true) (push) Successful in 1m18s
Build Multi-Platform Binaries / build-binaries (arm64, linux, server, true) (push) Successful in 1m57s
Build Multi-Platform Binaries / build-binaries (arm64, windows, server, false) (push) Successful in 1m25s
- 从 App.vue 中移除 naive-ui 组件及其主题配置
- 从组件声明中移除 NIcon 和 NTag 组件引用
- 将 JSPluginConfig 从 ServerConfig 中分离
- 在 ServerSettings 中整合 PluginStore 配置
- 更新配置 DTO 结构以支持 PluginStore 配置
- 移除 JS 插件加载和签名验证相关代码
- 从 main.ts 中移除 naive-ui 的引入和使用
- 从 package.json 中移除 naive-ui 和相关自动导入插件依赖
- 在设置页面添加插件商店 URL 配置字段
- 更新 StoreHandler 中插件商店 URL 的获取方式
- 移除 Vite 配置中的自动导入和组件解析插件
2026-01-22 20:37:11 +08:00
Flik
d1058f9e89 feat(app): 添加流量统计功能和服务器配置管理
All checks were successful
Build Multi-Platform Binaries / build-frontend (push) Successful in 38s
Build Multi-Platform Binaries / build-binaries (amd64, linux, client, true) (push) Successful in 1m47s
Build Multi-Platform Binaries / build-binaries (amd64, darwin, server, false) (push) Successful in 1m48s
Build Multi-Platform Binaries / build-binaries (amd64, windows, client, true) (push) Successful in 1m29s
Build Multi-Platform Binaries / build-binaries (amd64, linux, server, true) (push) Successful in 1m53s
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, client, true) (push) Successful in 1m14s
Build Multi-Platform Binaries / build-binaries (amd64, windows, server, true) (push) Successful in 1m40s
Build Multi-Platform Binaries / build-binaries (arm64, darwin, server, false) (push) Successful in 1m36s
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, server, true) (push) Successful in 1m51s
Build Multi-Platform Binaries / build-binaries (arm64, linux, client, true) (push) Successful in 1m17s
Build Multi-Platform Binaries / build-binaries (arm64, linux, server, true) (push) Successful in 1m50s
Build Multi-Platform Binaries / build-binaries (arm64, windows, server, false) (push) Successful in 1m18s
- 在WebServer中添加TrafficStore存储接口
- 将Web配置从根级别移动到Server.Web子结构下
- 移除Web配置中的BindAddr字段并调整默认值逻辑
- 在前端HomeView中替换模拟流量数据显示真实统计数据
- 添加流量统计API接口(/traffic/stats和/traffic/hourly)
- 实现SQLite数据库流量统计表创建和CRUD操作
- 在Relay包中添加带流量统计的数据转发功能
- 在设置页面添加服务器配置编辑和保存功能
- 创建流量统计处理器和相关数据模型定义
2026-01-22 19:53:40 +08:00
Flik
06dfcfaff3 feat(nav): 更新导航菜单结构并添加客户端管理功能
All checks were successful
Build Multi-Platform Binaries / build-frontend (push) Successful in 39s
Build Multi-Platform Binaries / build-binaries (amd64, linux, client, true) (push) Successful in 1m25s
Build Multi-Platform Binaries / build-binaries (amd64, darwin, server, false) (push) Successful in 1m31s
Build Multi-Platform Binaries / build-binaries (amd64, windows, client, true) (push) Successful in 1m24s
Build Multi-Platform Binaries / build-binaries (amd64, linux, server, true) (push) Successful in 1m52s
Build Multi-Platform Binaries / build-binaries (amd64, windows, server, true) (push) Successful in 1m38s
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, client, true) (push) Successful in 1m13s
Build Multi-Platform Binaries / build-binaries (arm64, darwin, server, false) (push) Successful in 1m44s
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, server, true) (push) Successful in 2m2s
Build Multi-Platform Binaries / build-binaries (arm64, linux, client, true) (push) Successful in 1m14s
Build Multi-Platform Binaries / build-binaries (arm64, linux, server, true) (push) Successful in 1m39s
Build Multi-Platform Binaries / build-binaries (arm64, windows, server, false) (push) Successful in 1m19s
- 将插件页面替换为客户端管理页面
- 添加客户端管理视图组件,支持查看客户端列表和状态
- 集成服务器更新检查功能,在页脚显示版本和更新状态
- 添加桌面、服务器、勾选和箭头图标用于界面展示
- 实现客户端统计卡片显示在线和离线状态
- 优化路由配置,移除插件相关路由并添加客户端路由
- 更新DTO结构,分离OS和Arch字段替代平台字段
2026-01-22 19:10:20 +08:00
39 changed files with 2057 additions and 1224 deletions

View File

@@ -27,7 +27,6 @@ import (
"github.com/gotunnel/internal/server/tunnel" "github.com/gotunnel/internal/server/tunnel"
"github.com/gotunnel/pkg/crypto" "github.com/gotunnel/pkg/crypto"
"github.com/gotunnel/pkg/plugin" "github.com/gotunnel/pkg/plugin"
"github.com/gotunnel/pkg/plugin/sign"
"github.com/gotunnel/pkg/version" "github.com/gotunnel/pkg/version"
) )
@@ -83,18 +82,12 @@ func main() {
server.SetPluginRegistry(registry) server.SetPluginRegistry(registry)
server.SetJSPluginStore(clientStore) // 设置 JS 插件存储,用于客户端重连时恢复插件 server.SetJSPluginStore(clientStore) // 设置 JS 插件存储,用于客户端重连时恢复插件
// 加载 JS 插件配置
if len(cfg.JSPlugins) > 0 {
jsPlugins := loadJSPlugins(cfg.JSPlugins)
server.LoadJSPlugins(jsPlugins)
}
// 启动 Web 控制台 // 启动 Web 控制台
if cfg.Web.Enabled { if cfg.Server.Web.Enabled {
// 强制生成 Web 凭据(如果未配置) // 强制生成 Web 凭据(如果未配置)
if config.GenerateWebCredentials(cfg) { if config.GenerateWebCredentials(cfg) {
log.Printf("[Web] Auto-generated credentials - Username: %s, Password: %s", log.Printf("[Web] Auto-generated credentials - Username: %s, Password: %s",
cfg.Web.Username, cfg.Web.Password) cfg.Server.Web.Username, cfg.Server.Web.Password)
log.Printf("[Web] Please save these credentials and update your config file") log.Printf("[Web] Please save these credentials and update your config file")
// 保存配置以持久化凭据 // 保存配置以持久化凭据
if err := config.SaveServerConfig(*configPath, cfg); err != nil { if err := config.SaveServerConfig(*configPath, cfg); err != nil {
@@ -103,11 +96,11 @@ func main() {
} }
ws := app.NewWebServer(clientStore, server, cfg, *configPath, clientStore) ws := app.NewWebServer(clientStore, server, cfg, *configPath, clientStore)
addr := fmt.Sprintf("%s:%d", cfg.Web.BindAddr, cfg.Web.BindPort) addr := fmt.Sprintf("%s:%d", cfg.Server.BindAddr, cfg.Server.Web.BindPort)
go func() { go func() {
// 始终使用 JWT 认证 // 始终使用 JWT 认证
err := ws.RunWithJWT(addr, cfg.Web.Username, cfg.Web.Password, cfg.Server.Token) err := ws.RunWithJWT(addr, cfg.Server.Web.Username, cfg.Server.Web.Password, cfg.Server.Token)
if err != nil { if err != nil {
log.Printf("[Web] Server error: %v", err) log.Printf("[Web] Server error: %v", err)
} }
@@ -128,69 +121,3 @@ func main() {
log.Fatal(server.Run()) log.Fatal(server.Run())
} }
// loadJSPlugins 加载 JS 插件文件
func loadJSPlugins(configs []config.JSPluginConfig) []tunnel.JSPluginEntry {
var plugins []tunnel.JSPluginEntry
for _, cfg := range configs {
source, err := os.ReadFile(cfg.Path)
if err != nil {
log.Printf("[JSPlugin] Failed to load %s: %v", cfg.Path, err)
continue
}
// 加载签名文件
sigPath := cfg.SigPath
if sigPath == "" {
sigPath = cfg.Path + ".sig"
}
signature, err := os.ReadFile(sigPath)
if err != nil {
log.Printf("[JSPlugin] Failed to load signature for %s: %v", cfg.Name, err)
continue
}
// 服务端也验证签名,防止配置文件被篡改
if err := verifyPluginSignature(cfg.Name, string(source), string(signature)); err != nil {
log.Printf("[JSPlugin] Signature verification failed for %s: %v", cfg.Name, err)
continue
}
plugins = append(plugins, tunnel.JSPluginEntry{
Name: cfg.Name,
Source: string(source),
Signature: string(signature),
AutoPush: cfg.AutoPush,
Config: cfg.Config,
AutoStart: cfg.AutoStart,
})
log.Printf("[JSPlugin] Loaded: %s from %s (verified)", cfg.Name, cfg.Path)
}
return plugins
}
// verifyPluginSignature 验证插件签名
func verifyPluginSignature(name, source, signature string) error {
// 解码签名
signed, err := sign.DecodeSignedPlugin(signature)
if err != nil {
return fmt.Errorf("decode signature: %w", err)
}
// 获取公钥
pubKey, err := sign.GetPublicKeyByID(signed.Payload.KeyID)
if err != nil {
return err
}
// 验证插件名称
if signed.Payload.Name != name {
return fmt.Errorf("name mismatch: %s vs %s", signed.Payload.Name, name)
}
// 验证签名
return sign.VerifyPlugin(pubKey, signed, source)
}

38
go.mod
View File

@@ -3,31 +3,35 @@ module github.com/gotunnel
go 1.24.0 go 1.24.0
require ( require (
github.com/dop251/goja v0.0.0-20251201205617-2bb4c724c0f9
github.com/gin-gonic/gin v1.11.0
github.com/go-playground/validator/v10 v10.30.1
github.com/golang-jwt/jwt/v5 v5.3.0 github.com/golang-jwt/jwt/v5 v5.3.0
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.3
github.com/hashicorp/yamux v0.1.1 github.com/hashicorp/yamux v0.1.1
github.com/shirou/gopsutil/v3 v3.24.5
github.com/swaggo/files v1.0.1
github.com/swaggo/gin-swagger v1.6.1
github.com/swaggo/swag v1.16.6
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
modernc.org/sqlite v1.41.0 modernc.org/sqlite v1.41.0
) )
require ( require (
github.com/KyleBanks/depth v1.2.1 // indirect github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.2.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/bytedance/gopkg v0.1.3 // indirect github.com/bytedance/gopkg v0.1.3 // indirect
github.com/bytedance/sonic v1.14.2 // indirect github.com/bytedance/sonic v1.14.2 // indirect
github.com/bytedance/sonic/loader v0.4.0 // indirect github.com/bytedance/sonic/loader v0.4.0 // indirect
github.com/cloudwego/base64x v0.1.6 // indirect github.com/cloudwego/base64x v0.1.6 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
github.com/dlclark/regexp2 v1.11.4 // indirect github.com/dlclark/regexp2 v1.11.4 // indirect
github.com/dop251/goja v0.0.0-20251201205617-2bb4c724c0f9 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect github.com/dustin/go-humanize v1.0.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.12 // indirect github.com/gabriel-vasile/mimetype v1.4.12 // indirect
github.com/gin-contrib/sse v1.1.0 // indirect github.com/gin-contrib/sse v1.1.0 // indirect
github.com/gin-gonic/gin v1.11.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/jsonpointer v0.22.4 // indirect github.com/go-openapi/jsonpointer v0.22.4 // indirect
github.com/go-openapi/jsonreference v0.21.4 // indirect github.com/go-openapi/jsonreference v0.21.4 // indirect
github.com/go-openapi/spec v0.22.3 // indirect github.com/go-openapi/spec v0.22.3 // indirect
github.com/go-openapi/swag v0.25.4 // indirect
github.com/go-openapi/swag/conv v0.25.4 // indirect github.com/go-openapi/swag/conv v0.25.4 // indirect
github.com/go-openapi/swag/jsonname v0.25.4 // indirect github.com/go-openapi/swag/jsonname v0.25.4 // indirect
github.com/go-openapi/swag/jsonutils v0.25.4 // indirect github.com/go-openapi/swag/jsonutils v0.25.4 // indirect
@@ -37,37 +41,31 @@ require (
github.com/go-openapi/swag/yamlutils v0.25.4 // indirect github.com/go-openapi/swag/yamlutils v0.25.4 // indirect
github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.30.1 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/goccy/go-json v0.10.5 // indirect github.com/goccy/go-json v0.10.5 // indirect
github.com/goccy/go-yaml v1.19.1 // indirect github.com/goccy/go-yaml v1.19.1 // indirect
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e // indirect github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect
github.com/mailru/easyjson v0.9.1 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/quic-go/qpack v0.6.0 // indirect github.com/quic-go/qpack v0.6.0 // indirect
github.com/quic-go/quic-go v0.58.0 // indirect github.com/quic-go/quic-go v0.58.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/swaggo/files v1.0.1 // indirect github.com/tklauser/numcpus v0.6.1 // indirect
github.com/swaggo/gin-swagger v1.6.1 // indirect
github.com/swaggo/swag v1.16.6 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.3.1 // indirect github.com/ugorji/go/codec v1.3.1 // indirect
github.com/urfave/cli/v2 v2.27.7 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 // indirect
go.uber.org/mock v0.6.0 // indirect go.uber.org/mock v0.6.0 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/arch v0.23.0 // indirect golang.org/x/arch v0.23.0 // indirect
golang.org/x/crypto v0.46.0 // indirect golang.org/x/crypto v0.46.0 // indirect
@@ -79,9 +77,7 @@ require (
golang.org/x/text v0.32.0 // indirect golang.org/x/text v0.32.0 // indirect
golang.org/x/tools v0.40.0 // indirect golang.org/x/tools v0.40.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
modernc.org/libc v1.66.10 // indirect modernc.org/libc v1.66.10 // indirect
modernc.org/mathutil v1.7.1 // indirect modernc.org/mathutil v1.7.1 // indirect
modernc.org/memory v1.11.0 // indirect modernc.org/memory v1.11.0 // indirect
sigs.k8s.io/yaml v1.6.0 // indirect
) )

118
go.sum
View File

@@ -1,24 +1,18 @@
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/PuerkitoBio/purell v1.2.1 h1:QsZ4TjvwiMpat6gBCBxEQI0rcS9ehtkKtSpiUnd9N28= github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0=
github.com/PuerkitoBio/purell v1.2.1/go.mod h1:ZwHcC/82TOaovDi//J/804umJFFmbOHPngi8iYYv/Eo= github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M= github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M=
github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM= github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM=
github.com/bytedance/sonic v1.14.0 h1:/OfKt8HFw0kh2rj8N0F6C/qPGRESq0BbaNZgcNXXzQQ=
github.com/bytedance/sonic v1.14.0/go.mod h1:WoEbx8WTcFJfzCe0hbmyTGrfjt8PzNEBdxlNUO24NhA=
github.com/bytedance/sonic v1.14.2 h1:k1twIoe97C1DtYUo+fZQy865IuHia4PR5RPiuGPPIIE= github.com/bytedance/sonic v1.14.2 h1:k1twIoe97C1DtYUo+fZQy865IuHia4PR5RPiuGPPIIE=
github.com/bytedance/sonic v1.14.2/go.mod h1:T80iDELeHiHKSc0C9tubFygiuXoGzrkjKzX2quAx980= github.com/bytedance/sonic v1.14.2/go.mod h1:T80iDELeHiHKSc0C9tubFygiuXoGzrkjKzX2quAx980=
github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA=
github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
github.com/bytedance/sonic/loader v0.4.0 h1:olZ7lEqcxtZygCK9EKYKADnpQoYkRQxaeY2NYzevs+o= github.com/bytedance/sonic/loader v0.4.0 h1:olZ7lEqcxtZygCK9EKYKADnpQoYkRQxaeY2NYzevs+o=
github.com/bytedance/sonic/loader v0.4.0/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo= github.com/bytedance/sonic/loader v0.4.0/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo=
github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M= github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M=
github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU= github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU=
github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo= github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo=
github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
@@ -26,28 +20,31 @@ github.com/dop251/goja v0.0.0-20251201205617-2bb4c724c0f9 h1:3uSSOd6mVlwcX3k5OYO
github.com/dop251/goja v0.0.0-20251201205617-2bb4c724c0f9/go.mod h1:MxLav0peU43GgvwVgNbLAj1s/bSGboKkhuULvq/7hx4= github.com/dop251/goja v0.0.0-20251201205617-2bb4c724c0f9/go.mod h1:MxLav0peU43GgvwVgNbLAj1s/bSGboKkhuULvq/7hx4=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=
github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=
github.com/gabriel-vasile/mimetype v1.4.12 h1:e9hWvmLYvtp846tLHam2o++qitpguFiYCKbn0w9jyqw= github.com/gabriel-vasile/mimetype v1.4.12 h1:e9hWvmLYvtp846tLHam2o++qitpguFiYCKbn0w9jyqw=
github.com/gabriel-vasile/mimetype v1.4.12/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= github.com/gabriel-vasile/mimetype v1.4.12/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4=
github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk=
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w= github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=
github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM= github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM=
github.com/gin-gonic/gin v1.11.0 h1:OW/6PLjyusp2PPXtyxKHU0RbX6I/l28FTdDlae5ueWk= github.com/gin-gonic/gin v1.11.0 h1:OW/6PLjyusp2PPXtyxKHU0RbX6I/l28FTdDlae5ueWk=
github.com/gin-gonic/gin v1.11.0/go.mod h1:+iq/FyxlGzII0KHiBGjuNn4UNENUlKbGlNmc+W50Dls= github.com/gin-gonic/gin v1.11.0/go.mod h1:+iq/FyxlGzII0KHiBGjuNn4UNENUlKbGlNmc+W50Dls=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-openapi/jsonpointer v0.22.4 h1:dZtK82WlNpVLDW2jlA1YCiVJFVqkED1MegOUy9kR5T4= github.com/go-openapi/jsonpointer v0.22.4 h1:dZtK82WlNpVLDW2jlA1YCiVJFVqkED1MegOUy9kR5T4=
github.com/go-openapi/jsonpointer v0.22.4/go.mod h1:elX9+UgznpFhgBuaMQ7iu4lvvX1nvNsesQ3oxmYTw80= github.com/go-openapi/jsonpointer v0.22.4/go.mod h1:elX9+UgznpFhgBuaMQ7iu4lvvX1nvNsesQ3oxmYTw80=
github.com/go-openapi/jsonreference v0.21.4 h1:24qaE2y9bx/q3uRK/qN+TDwbok1NhbSmGjjySRCHtC8= github.com/go-openapi/jsonreference v0.21.4 h1:24qaE2y9bx/q3uRK/qN+TDwbok1NhbSmGjjySRCHtC8=
github.com/go-openapi/jsonreference v0.21.4/go.mod h1:rIENPTjDbLpzQmQWCj5kKj3ZlmEh+EFVbz3RTUh30/4= github.com/go-openapi/jsonreference v0.21.4/go.mod h1:rIENPTjDbLpzQmQWCj5kKj3ZlmEh+EFVbz3RTUh30/4=
github.com/go-openapi/spec v0.22.3 h1:qRSmj6Smz2rEBxMnLRBMeBWxbbOvuOoElvSvObIgwQc= github.com/go-openapi/spec v0.22.3 h1:qRSmj6Smz2rEBxMnLRBMeBWxbbOvuOoElvSvObIgwQc=
github.com/go-openapi/spec v0.22.3/go.mod h1:iIImLODL2loCh3Vnox8TY2YWYJZjMAKYyLH2Mu8lOZs= github.com/go-openapi/spec v0.22.3/go.mod h1:iIImLODL2loCh3Vnox8TY2YWYJZjMAKYyLH2Mu8lOZs=
github.com/go-openapi/swag v0.25.4 h1:OyUPUFYDPDBMkqyxOTkqDYFnrhuhi9NR6QVUvIochMU= github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM=
github.com/go-openapi/swag v0.25.4/go.mod h1:zNfJ9WZABGHCFg2RnY0S4IOkAcVTzJ6z2Bi+Q4i6qFQ=
github.com/go-openapi/swag/conv v0.25.4 h1:/Dd7p0LZXczgUcC/Ikm1+YqVzkEeCc9LnOWjfkpkfe4= github.com/go-openapi/swag/conv v0.25.4 h1:/Dd7p0LZXczgUcC/Ikm1+YqVzkEeCc9LnOWjfkpkfe4=
github.com/go-openapi/swag/conv v0.25.4/go.mod h1:3LXfie/lwoAv0NHoEuY1hjoFAYkvlqI/Bn5EQDD3PPU= github.com/go-openapi/swag/conv v0.25.4/go.mod h1:3LXfie/lwoAv0NHoEuY1hjoFAYkvlqI/Bn5EQDD3PPU=
github.com/go-openapi/swag/jsonname v0.25.4 h1:bZH0+MsS03MbnwBXYhuTttMOqk+5KcQ9869Vye1bNHI= github.com/go-openapi/swag/jsonname v0.25.4 h1:bZH0+MsS03MbnwBXYhuTttMOqk+5KcQ9869Vye1bNHI=
github.com/go-openapi/swag/jsonname v0.25.4/go.mod h1:GPVEk9CWVhNvWhZgrnvRA6utbAltopbKwDu8mXNUMag= github.com/go-openapi/swag/jsonname v0.25.4/go.mod h1:GPVEk9CWVhNvWhZgrnvRA6utbAltopbKwDu8mXNUMag=
github.com/go-openapi/swag/jsonutils v0.25.4 h1:VSchfbGhD4UTf4vCdR2F4TLBdLwHyUDTd1/q4i+jGZA= github.com/go-openapi/swag/jsonutils v0.25.4 h1:VSchfbGhD4UTf4vCdR2F4TLBdLwHyUDTd1/q4i+jGZA=
github.com/go-openapi/swag/jsonutils v0.25.4/go.mod h1:7OYGXpvVFPn4PpaSdPHJBtF0iGnbEaTk8AvBkoWnaAY= github.com/go-openapi/swag/jsonutils v0.25.4/go.mod h1:7OYGXpvVFPn4PpaSdPHJBtF0iGnbEaTk8AvBkoWnaAY=
github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.4 h1:IACsSvBhiNJwlDix7wq39SS2Fh7lUOCJRmx/4SN4sVo=
github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.4/go.mod h1:Mt0Ost9l3cUzVv4OEZG+WSeoHwjWLnarzMePNDAOBiM=
github.com/go-openapi/swag/loading v0.25.4 h1:jN4MvLj0X6yhCDduRsxDDw1aHe+ZWoLjW+9ZQWIKn2s= github.com/go-openapi/swag/loading v0.25.4 h1:jN4MvLj0X6yhCDduRsxDDw1aHe+ZWoLjW+9ZQWIKn2s=
github.com/go-openapi/swag/loading v0.25.4/go.mod h1:rpUM1ZiyEP9+mNLIQUdMiD7dCETXvkkC30z53i+ftTE= github.com/go-openapi/swag/loading v0.25.4/go.mod h1:rpUM1ZiyEP9+mNLIQUdMiD7dCETXvkkC30z53i+ftTE=
github.com/go-openapi/swag/stringutils v0.25.4 h1:O6dU1Rd8bej4HPA3/CLPciNBBDwZj9HiEpdVsb8B5A8= github.com/go-openapi/swag/stringutils v0.25.4 h1:O6dU1Rd8bej4HPA3/CLPciNBBDwZj9HiEpdVsb8B5A8=
@@ -56,26 +53,29 @@ github.com/go-openapi/swag/typeutils v0.25.4 h1:1/fbZOUN472NTc39zpa+YGHn3jzHWhv4
github.com/go-openapi/swag/typeutils v0.25.4/go.mod h1:Ou7g//Wx8tTLS9vG0UmzfCsjZjKhpjxayRKTHXf2pTE= github.com/go-openapi/swag/typeutils v0.25.4/go.mod h1:Ou7g//Wx8tTLS9vG0UmzfCsjZjKhpjxayRKTHXf2pTE=
github.com/go-openapi/swag/yamlutils v0.25.4 h1:6jdaeSItEUb7ioS9lFoCZ65Cne1/RZtPBZ9A56h92Sw= github.com/go-openapi/swag/yamlutils v0.25.4 h1:6jdaeSItEUb7ioS9lFoCZ65Cne1/RZtPBZ9A56h92Sw=
github.com/go-openapi/swag/yamlutils v0.25.4/go.mod h1:MNzq1ulQu+yd8Kl7wPOut/YHAAU/H6hL91fF+E2RFwc= github.com/go-openapi/swag/yamlutils v0.25.4/go.mod h1:MNzq1ulQu+yd8Kl7wPOut/YHAAU/H6hL91fF+E2RFwc=
github.com/go-openapi/testify/enable/yaml/v2 v2.0.2 h1:0+Y41Pz1NkbTHz8NngxTuAXxEodtNSI1WG1c/m5Akw4=
github.com/go-openapi/testify/enable/yaml/v2 v2.0.2/go.mod h1:kme83333GCtJQHXQ8UKX3IBZu6z8T5Dvy5+CW3NLUUg=
github.com/go-openapi/testify/v2 v2.0.2 h1:X999g3jeLcoY8qctY/c/Z8iBHTbwLz7R2WXd6Ub6wls=
github.com/go-openapi/testify/v2 v2.0.2/go.mod h1:HCPmvFFnheKK2BuwSA0TbbdxJ3I16pjwMkYkP4Ywn54=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.27.0 h1:w8+XrWVMhGkxOaaowyKH35gFydVHOvC0/uWoy2Fzwn4=
github.com/go-playground/validator/v10 v10.27.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
github.com/go-playground/validator/v10 v10.30.1 h1:f3zDSN/zOma+w6+1Wswgd9fLkdwy06ntQJp0BBvFG0w= github.com/go-playground/validator/v10 v10.30.1 h1:f3zDSN/zOma+w6+1Wswgd9fLkdwy06ntQJp0BBvFG0w=
github.com/go-playground/validator/v10 v10.30.1/go.mod h1:oSuBIQzuJxL//3MelwSLD5hc2Tu889bF0Idm9Dg26cM= github.com/go-playground/validator/v10 v10.30.1/go.mod h1:oSuBIQzuJxL//3MelwSLD5hc2Tu889bF0Idm9Dg26cM=
github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU= github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU=
github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg=
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw=
github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
github.com/goccy/go-yaml v1.19.1 h1:3rG3+v8pkhRqoQ/88NYNMHYVGYztCOCIZ7UQhu7H+NE= github.com/goccy/go-yaml v1.19.1 h1:3rG3+v8pkhRqoQ/88NYNMHYVGYztCOCIZ7UQhu7H+NE=
github.com/goccy/go-yaml v1.19.1/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= github.com/goccy/go-yaml v1.19.1/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo=
github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs= github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs=
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
@@ -85,19 +85,20 @@ github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aN
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE=
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/mailru/easyjson v0.9.1 h1:LbtsOm5WAswyWbvTEOqhypdPeZzHavpZx96/n553mR8= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
github.com/mailru/easyjson v0.9.1/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -107,21 +108,24 @@ github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdh
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8= github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8=
github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII= github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII=
github.com/quic-go/quic-go v0.54.0 h1:6s1YB9QotYI6Ospeiguknbp2Znb/jZYjZLRXn9kMQBg=
github.com/quic-go/quic-go v0.54.0/go.mod h1:e68ZEaCdyviluZmy44P6Iey98v/Wfz6HCjQEm+l8zTY=
github.com/quic-go/quic-go v0.58.0 h1:ggY2pvZaVdB9EyojxL1p+5mptkuHyX5MOSv4dgWF4Ug= github.com/quic-go/quic-go v0.58.0 h1:ggY2pvZaVdB9EyojxL1p+5mptkuHyX5MOSv4dgWF4Ug=
github.com/quic-go/quic-go v0.58.0/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU= github.com/quic-go/quic-go v0.58.0/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shirou/gopsutil/v3 v3.24.5 h1:i0t8kL+kQTvpAYToeuiVk3TgDeKOFioZO3Ztz/iZ9pI=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shirou/gopsutil/v3 v3.24.5/go.mod h1:bsoOS1aStSs9ErQ1WWfxllSeS1K5D+U30r2NfcubMVk=
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
@@ -129,74 +133,63 @@ github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE= github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE=
github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg= github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg=
github.com/swaggo/gin-swagger v1.6.1 h1:Ri06G4gc9N4t4k8hekMigJ9zKTFSlqj/9paAQCQs7cY= github.com/swaggo/gin-swagger v1.6.1 h1:Ri06G4gc9N4t4k8hekMigJ9zKTFSlqj/9paAQCQs7cY=
github.com/swaggo/gin-swagger v1.6.1/go.mod h1:LQ+hJStHakCWRiK/YNYtJOu4mR2FP+pxLnILT/qNiTw= github.com/swaggo/gin-swagger v1.6.1/go.mod h1:LQ+hJStHakCWRiK/YNYtJOu4mR2FP+pxLnILT/qNiTw=
github.com/swaggo/swag v1.16.6 h1:qBNcx53ZaX+M5dxVyTrgQ0PJ/ACK+NzhwcbieTt+9yI= github.com/swaggo/swag v1.16.6 h1:qBNcx53ZaX+M5dxVyTrgQ0PJ/ACK+NzhwcbieTt+9yI=
github.com/swaggo/swag v1.16.6/go.mod h1:ngP2etMK5a0P3QBizic5MEwpRmluJZPHjXcMoj4Xesg= github.com/swaggo/swag v1.16.6/go.mod h1:ngP2etMK5a0P3QBizic5MEwpRmluJZPHjXcMoj4Xesg=
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA=
github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
github.com/ugorji/go/codec v1.3.1 h1:waO7eEiFDwidsBN6agj1vJQ4AG7lh2yqXyOXqhgQuyY= github.com/ugorji/go/codec v1.3.1 h1:waO7eEiFDwidsBN6agj1vJQ4AG7lh2yqXyOXqhgQuyY=
github.com/ugorji/go/codec v1.3.1/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4= github.com/ugorji/go/codec v1.3.1/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
github.com/urfave/cli/v2 v2.27.7 h1:bH59vdhbjLv3LAvIu6gd0usJHgoTTPhCFib8qqOwXYU=
github.com/urfave/cli/v2 v2.27.7/go.mod h1:CyNAG/xg+iAOg0N4MPGZqVmv2rCoP267496AOXUZjA4=
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 h1:FnBeRrxr7OU4VvAzt5X7s6266i6cSVkkFPS0TuXWbIg=
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y= go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU= go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU=
go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0=
go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/arch v0.20.0 h1:dx1zTU0MAE98U+TQ8BLl7XsJbgze2WnNKF/8tGp/Q6c=
golang.org/x/arch v0.20.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk=
golang.org/x/arch v0.23.0 h1:lKF64A2jF6Zd8L0knGltUnegD62JMFBiCPBmQpToHhg= golang.org/x/arch v0.23.0 h1:lKF64A2jF6Zd8L0knGltUnegD62JMFBiCPBmQpToHhg=
golang.org/x/arch v0.23.0/go.mod h1:dNHoOeKiyja7GTvF9NJS1l3Z2yntpQNzgrjh1cU103A= golang.org/x/arch v0.23.0/go.mod h1:dNHoOeKiyja7GTvF9NJS1l3Z2yntpQNzgrjh1cU103A=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU= golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU=
golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0= golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b h1:M2rDM6z3Fhozi9O7NWsxAkg/yqS/lQJ6PmkyIV3YP+o= golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b h1:M2rDM6z3Fhozi9O7NWsxAkg/yqS/lQJ6PmkyIV3YP+o=
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8= golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ=
golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc=
golang.org/x/mod v0.31.0 h1:HaW9xtz0+kOcWKwli0ZXy79Ix+UW/vOfmWI5QVd2tgI= golang.org/x/mod v0.31.0 h1:HaW9xtz0+kOcWKwli0ZXy79Ix+UW/vOfmWI5QVd2tgI=
golang.org/x/mod v0.31.0/go.mod h1:43JraMp9cGx1Rx3AqioxrbrhNsLl2l/iNAvuBkrezpg= golang.org/x/mod v0.31.0/go.mod h1:43JraMp9cGx1Rx3AqioxrbrhNsLl2l/iNAvuBkrezpg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
@@ -205,28 +198,21 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU= golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY= golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg=
golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s=
golang.org/x/tools v0.40.0 h1:yLkxfA+Qnul4cs9QA3KnlFu0lVmd8JJfoq+E41uSutA= golang.org/x/tools v0.40.0 h1:yLkxfA+Qnul4cs9QA3KnlFu0lVmd8JJfoq+E41uSutA=
golang.org/x/tools v0.40.0/go.mod h1:Ik/tzLRlbscWpqqMRjyWYDisX8bG13FrdXp3o4Sr9lc= golang.org/x/tools v0.40.0/go.mod h1:Ik/tzLRlbscWpqqMRjyWYDisX8bG13FrdXp3o4Sr9lc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
@@ -258,5 +244,3 @@ modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0=
modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A= modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A=
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs=
sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4=

View File

@@ -19,6 +19,8 @@ import (
"github.com/gotunnel/pkg/protocol" "github.com/gotunnel/pkg/protocol"
"github.com/gotunnel/pkg/relay" "github.com/gotunnel/pkg/relay"
"github.com/gotunnel/pkg/update" "github.com/gotunnel/pkg/update"
"github.com/gotunnel/pkg/utils"
"github.com/gotunnel/pkg/version"
"github.com/hashicorp/yamux" "github.com/hashicorp/yamux"
) )
@@ -181,6 +183,7 @@ func (c *Client) connect() error {
Token: c.Token, Token: c.Token,
OS: runtime.GOOS, OS: runtime.GOOS,
Arch: runtime.GOARCH, Arch: runtime.GOARCH,
Version: version.Version,
} }
msg, _ := protocol.NewMessage(protocol.MsgTypeAuth, authReq) msg, _ := protocol.NewMessage(protocol.MsgTypeAuth, authReq)
if err := protocol.WriteMessage(conn, msg); err != nil { if err := protocol.WriteMessage(conn, msg); err != nil {
@@ -286,6 +289,8 @@ func (c *Client) handleStream(stream net.Conn) {
c.handlePluginStatusQuery(stream, msg) c.handlePluginStatusQuery(stream, msg)
case protocol.MsgTypePluginAPIRequest: case protocol.MsgTypePluginAPIRequest:
c.handlePluginAPIRequest(stream, msg) c.handlePluginAPIRequest(stream, msg)
case protocol.MsgTypeSystemStatsRequest:
c.handleSystemStatsRequest(stream, msg)
} }
} }
@@ -1173,3 +1178,27 @@ func (c *Client) sendPluginAPIResponse(stream net.Conn, status int, headers map[
msg, _ := protocol.NewMessage(protocol.MsgTypePluginAPIResponse, resp) msg, _ := protocol.NewMessage(protocol.MsgTypePluginAPIResponse, resp)
protocol.WriteMessage(stream, msg) protocol.WriteMessage(stream, msg)
} }
// handleSystemStatsRequest 处理系统状态请求
func (c *Client) handleSystemStatsRequest(stream net.Conn, msg *protocol.Message) {
defer stream.Close()
stats, err := utils.GetSystemStats()
if err != nil {
log.Printf("[Client] Failed to get system stats: %v", err)
return
}
resp := protocol.SystemStatsResponse{
CPUUsage: stats.CPUUsage,
MemoryTotal: stats.MemoryTotal,
MemoryUsed: stats.MemoryUsed,
MemoryUsage: stats.MemoryUsage,
DiskTotal: stats.DiskTotal,
DiskUsed: stats.DiskUsed,
DiskUsage: stats.DiskUsage,
}
respMsg, _ := protocol.NewMessage(protocol.MsgTypeSystemStatsResponse, resp)
protocol.WriteMessage(stream, respMsg)
}

View File

@@ -21,16 +21,18 @@ type WebServer struct {
Config *config.ServerConfig Config *config.ServerConfig
ConfigPath string ConfigPath string
JSPluginStore db.JSPluginStore JSPluginStore db.JSPluginStore
TrafficStore db.TrafficStore
} }
// NewWebServer 创建Web服务 // NewWebServer 创建Web服务
func NewWebServer(cs db.ClientStore, srv router.ServerInterface, cfg *config.ServerConfig, cfgPath string, jsStore db.JSPluginStore) *WebServer { func NewWebServer(cs db.ClientStore, srv router.ServerInterface, cfg *config.ServerConfig, cfgPath string, store db.Store) *WebServer {
return &WebServer{ return &WebServer{
ClientStore: cs, ClientStore: cs,
Server: srv, Server: srv,
Config: cfg, Config: cfg,
ConfigPath: cfgPath, ConfigPath: cfgPath,
JSPluginStore: jsStore, JSPluginStore: store,
TrafficStore: store,
} }
} }
@@ -109,3 +111,8 @@ func (w *WebServer) SaveConfig() error {
func (w *WebServer) GetJSPluginStore() db.JSPluginStore { func (w *WebServer) GetJSPluginStore() db.JSPluginStore {
return w.JSPluginStore return w.JSPluginStore
} }
// GetTrafficStore 获取流量存储
func (w *WebServer) GetTrafficStore() db.TrafficStore {
return w.TrafficStore
}

View File

@@ -10,20 +10,7 @@ import (
// ServerConfig 服务端配置 // ServerConfig 服务端配置
type ServerConfig struct { type ServerConfig struct {
Server ServerSettings `yaml:"server"` Server ServerSettings `yaml:"server"`
Web WebSettings `yaml:"web"`
PluginStore PluginStoreSettings `yaml:"plugin_store"`
JSPlugins []JSPluginConfig `yaml:"js_plugins,omitempty"`
}
// JSPluginConfig JS 插件配置
type JSPluginConfig struct {
Name string `yaml:"name"`
Path string `yaml:"path"` // JS 文件路径
SigPath string `yaml:"sig_path,omitempty"` // 签名文件路径 (默认为 path + ".sig")
AutoPush []string `yaml:"auto_push,omitempty"` // 自动推送到的客户端 ID 列表
Config map[string]string `yaml:"config,omitempty"` // 插件配置
AutoStart bool `yaml:"auto_start,omitempty"` // 是否自动启动
} }
// PluginStoreSettings 插件仓库设置 // PluginStoreSettings 插件仓库设置
@@ -44,19 +31,20 @@ func (s *PluginStoreSettings) GetPluginStoreURL() string {
// ServerSettings 服务端设置 // ServerSettings 服务端设置
type ServerSettings struct { type ServerSettings struct {
BindAddr string `yaml:"bind_addr"` BindAddr string `yaml:"bind_addr"`
BindPort int `yaml:"bind_port"` BindPort int `yaml:"bind_port"`
Token string `yaml:"token"` Token string `yaml:"token"`
HeartbeatSec int `yaml:"heartbeat_sec"` HeartbeatSec int `yaml:"heartbeat_sec"`
HeartbeatTimeout int `yaml:"heartbeat_timeout"` HeartbeatTimeout int `yaml:"heartbeat_timeout"`
DBPath string `yaml:"db_path"` DBPath string `yaml:"db_path"`
TLSDisabled bool `yaml:"tls_disabled"` // 默认启用 TLS设置为 true 禁用 TLSDisabled bool `yaml:"tls_disabled"`
Web WebSettings `yaml:"web"`
PluginStore PluginStoreSettings `yaml:"plugin_store"`
} }
// WebSettings Web控制台设置 // WebSettings Web控制台设置
type WebSettings struct { type WebSettings struct {
Enabled bool `yaml:"enabled"` Enabled bool `yaml:"enabled"`
BindAddr string `yaml:"bind_addr"`
BindPort int `yaml:"bind_port"` BindPort int `yaml:"bind_port"`
Username string `yaml:"username"` Username string `yaml:"username"`
Password string `yaml:"password"` Password string `yaml:"password"`
@@ -99,12 +87,9 @@ func setDefaults(cfg *ServerConfig) {
} }
// Web 默认启用 // Web 默认启用
if cfg.Web.BindAddr == "" { if cfg.Server.Web.BindPort == 0 {
cfg.Web.BindAddr = "0.0.0.0" cfg.Server.Web.BindPort = 7500
} cfg.Server.Web.Enabled = true
if cfg.Web.BindPort == 0 {
cfg.Web.BindPort = 7500
cfg.Web.Enabled = true
} }
// Token 未配置时自动生成 32 位 // Token 未配置时自动生成 32 位
@@ -126,11 +111,11 @@ func generateToken(length int) string {
// GenerateWebCredentials 生成 Web 控制台凭据 // GenerateWebCredentials 生成 Web 控制台凭据
func GenerateWebCredentials(cfg *ServerConfig) bool { func GenerateWebCredentials(cfg *ServerConfig) bool {
if cfg.Web.Username == "" { if cfg.Server.Web.Username == "" {
cfg.Web.Username = "admin" cfg.Server.Web.Username = "admin"
} }
if cfg.Web.Password == "" { if cfg.Server.Web.Password == "" {
cfg.Web.Password = generateToken(16) cfg.Server.Web.Password = generateToken(16)
return true // 表示生成了新密码 return true // 表示生成了新密码
} }
return false return false

View File

@@ -76,5 +76,21 @@ type JSPluginStore interface {
type Store interface { type Store interface {
ClientStore ClientStore
JSPluginStore JSPluginStore
TrafficStore
Close() error Close() error
} }
// TrafficRecord 流量记录
type TrafficRecord struct {
Timestamp int64 `json:"timestamp"` // Unix 时间戳(小时级别)
Inbound int64 `json:"inbound"` // 入站流量(字节)
Outbound int64 `json:"outbound"` // 出站流量(字节)
}
// TrafficStore 流量存储接口
type TrafficStore interface {
AddTraffic(inbound, outbound int64) error
GetTotalTraffic() (inbound, outbound int64, err error)
Get24HourTraffic() (inbound, outbound int64, err error)
GetHourlyTraffic(hours int) ([]TrafficRecord, error)
}

View File

@@ -4,6 +4,7 @@ import (
"database/sql" "database/sql"
"encoding/json" "encoding/json"
"sync" "sync"
"time"
_ "modernc.org/sqlite" _ "modernc.org/sqlite"
@@ -80,6 +81,33 @@ func (s *SQLiteStore) init() error {
// 迁移:添加 updated_at 列 // 迁移:添加 updated_at 列
s.db.Exec(`ALTER TABLE js_plugins ADD COLUMN updated_at DATETIME DEFAULT CURRENT_TIMESTAMP`) s.db.Exec(`ALTER TABLE js_plugins ADD COLUMN updated_at DATETIME DEFAULT CURRENT_TIMESTAMP`)
// 创建流量统计表
_, err = s.db.Exec(`
CREATE TABLE IF NOT EXISTS traffic_stats (
hour_ts INTEGER PRIMARY KEY,
inbound INTEGER NOT NULL DEFAULT 0,
outbound INTEGER NOT NULL DEFAULT 0
)
`)
if err != nil {
return err
}
// 创建总流量表
_, err = s.db.Exec(`
CREATE TABLE IF NOT EXISTS traffic_total (
id INTEGER PRIMARY KEY CHECK (id = 1),
inbound INTEGER NOT NULL DEFAULT 0,
outbound INTEGER NOT NULL DEFAULT 0
)
`)
if err != nil {
return err
}
// 初始化总流量记录
s.db.Exec(`INSERT OR IGNORE INTO traffic_total (id, inbound, outbound) VALUES (1, 0, 0)`)
return nil return nil
} }
@@ -315,3 +343,82 @@ func (s *SQLiteStore) UpdateJSPluginConfig(name string, config map[string]string
_, err := s.db.Exec(`UPDATE js_plugins SET config = ?, updated_at = CURRENT_TIMESTAMP WHERE name = ?`, string(configJSON), name) _, err := s.db.Exec(`UPDATE js_plugins SET config = ?, updated_at = CURRENT_TIMESTAMP WHERE name = ?`, string(configJSON), name)
return err return err
} }
// ========== 流量统计方法 ==========
// getHourTimestamp 获取当前小时的时间戳
func getHourTimestamp() int64 {
now := time.Now()
return time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), 0, 0, 0, now.Location()).Unix()
}
// AddTraffic 添加流量记录
func (s *SQLiteStore) AddTraffic(inbound, outbound int64) error {
s.mu.Lock()
defer s.mu.Unlock()
hourTs := getHourTimestamp()
// 更新小时统计
_, err := s.db.Exec(`
INSERT INTO traffic_stats (hour_ts, inbound, outbound) VALUES (?, ?, ?)
ON CONFLICT(hour_ts) DO UPDATE SET inbound = inbound + ?, outbound = outbound + ?
`, hourTs, inbound, outbound, inbound, outbound)
if err != nil {
return err
}
// 更新总流量
_, err = s.db.Exec(`
UPDATE traffic_total SET inbound = inbound + ?, outbound = outbound + ? WHERE id = 1
`, inbound, outbound)
return err
}
// GetTotalTraffic 获取总流量
func (s *SQLiteStore) GetTotalTraffic() (inbound, outbound int64, err error) {
s.mu.RLock()
defer s.mu.RUnlock()
err = s.db.QueryRow(`SELECT inbound, outbound FROM traffic_total WHERE id = 1`).Scan(&inbound, &outbound)
return
}
// Get24HourTraffic 获取24小时流量
func (s *SQLiteStore) Get24HourTraffic() (inbound, outbound int64, err error) {
s.mu.RLock()
defer s.mu.RUnlock()
cutoff := time.Now().Add(-24 * time.Hour).Unix()
err = s.db.QueryRow(`
SELECT COALESCE(SUM(inbound), 0), COALESCE(SUM(outbound), 0)
FROM traffic_stats WHERE hour_ts >= ?
`, cutoff).Scan(&inbound, &outbound)
return
}
// GetHourlyTraffic 获取每小时流量记录
func (s *SQLiteStore) GetHourlyTraffic(hours int) ([]TrafficRecord, error) {
s.mu.RLock()
defer s.mu.RUnlock()
cutoff := time.Now().Add(-time.Duration(hours) * time.Hour).Unix()
rows, err := s.db.Query(`
SELECT hour_ts, inbound, outbound FROM traffic_stats
WHERE hour_ts >= ? ORDER BY hour_ts ASC
`, cutoff)
if err != nil {
return nil, err
}
defer rows.Close()
var records []TrafficRecord
for rows.Next() {
var r TrafficRecord
if err := rows.Scan(&r.Timestamp, &r.Inbound, &r.Outbound); err != nil {
return nil, err
}
records = append(records, r)
}
return records, nil
}

View File

@@ -32,6 +32,7 @@ type ClientResponse struct {
RemoteAddr string `json:"remote_addr,omitempty" example:"192.168.1.100:54321"` RemoteAddr string `json:"remote_addr,omitempty" example:"192.168.1.100:54321"`
OS string `json:"os,omitempty" example:"linux"` OS string `json:"os,omitempty" example:"linux"`
Arch string `json:"arch,omitempty" example:"amd64"` Arch string `json:"arch,omitempty" example:"amd64"`
Version string `json:"version,omitempty" example:"1.0.0"`
} }
// ClientListItem 客户端列表项 // ClientListItem 客户端列表项

View File

@@ -3,8 +3,9 @@ package dto
// UpdateServerConfigRequest 更新服务器配置请求 // UpdateServerConfigRequest 更新服务器配置请求
// @Description 更新服务器配置 // @Description 更新服务器配置
type UpdateServerConfigRequest struct { type UpdateServerConfigRequest struct {
Server *ServerConfigPart `json:"server"` Server *ServerConfigPart `json:"server"`
Web *WebConfigPart `json:"web"` Web *WebConfigPart `json:"web"`
PluginStore *PluginStoreConfigPart `json:"plugin_store"`
} }
// ServerConfigPart 服务器配置部分 // ServerConfigPart 服务器配置部分
@@ -21,7 +22,6 @@ type ServerConfigPart struct {
// @Description Web 控制台配置 // @Description Web 控制台配置
type WebConfigPart struct { type WebConfigPart struct {
Enabled bool `json:"enabled"` Enabled bool `json:"enabled"`
BindAddr string `json:"bind_addr" binding:"omitempty"`
BindPort int `json:"bind_port" binding:"omitempty,min=1,max=65535"` BindPort int `json:"bind_port" binding:"omitempty,min=1,max=65535"`
Username string `json:"username" binding:"omitempty,min=3,max=32"` Username string `json:"username" binding:"omitempty,min=3,max=32"`
Password string `json:"password" binding:"omitempty,min=6,max=64"` Password string `json:"password" binding:"omitempty,min=6,max=64"`
@@ -30,8 +30,9 @@ type WebConfigPart struct {
// ServerConfigResponse 服务器配置响应 // ServerConfigResponse 服务器配置响应
// @Description 服务器配置信息 // @Description 服务器配置信息
type ServerConfigResponse struct { type ServerConfigResponse struct {
Server ServerConfigInfo `json:"server"` Server ServerConfigInfo `json:"server"`
Web WebConfigInfo `json:"web"` Web WebConfigInfo `json:"web"`
PluginStore PluginStoreConfigInfo `json:"plugin_store"`
} }
// ServerConfigInfo 服务器配置信息 // ServerConfigInfo 服务器配置信息
@@ -46,8 +47,17 @@ type ServerConfigInfo struct {
// WebConfigInfo Web 配置信息 // WebConfigInfo Web 配置信息
type WebConfigInfo struct { type WebConfigInfo struct {
Enabled bool `json:"enabled"` Enabled bool `json:"enabled"`
BindAddr string `json:"bind_addr"`
BindPort int `json:"bind_port"` BindPort int `json:"bind_port"`
Username string `json:"username"` Username string `json:"username"`
Password string `json:"password"` // 显示为 **** Password string `json:"password"` // 显示为 ****
} }
// PluginStoreConfigPart 插件商店配置部分
type PluginStoreConfigPart struct {
URL string `json:"url"`
}
// PluginStoreConfigInfo 插件商店配置信息
type PluginStoreConfigInfo struct {
URL string `json:"url"`
}

View File

@@ -39,7 +39,8 @@ type VersionInfo struct {
GitCommit string `json:"git_commit,omitempty"` GitCommit string `json:"git_commit,omitempty"`
BuildTime string `json:"build_time,omitempty"` BuildTime string `json:"build_time,omitempty"`
GoVersion string `json:"go_version,omitempty"` GoVersion string `json:"go_version,omitempty"`
Platform string `json:"platform,omitempty"` OS string `json:"os,omitempty"`
Arch string `json:"arch,omitempty"`
} }
// StatusResponse 服务器状态响应 // StatusResponse 服务器状态响应

View File

@@ -115,7 +115,7 @@ func (h *ClientHandler) Get(c *gin.Context) {
return return
} }
online, lastPing, remoteAddr, clientOS, clientArch := h.app.GetServer().GetClientStatus(clientID) online, lastPing, remoteAddr, clientOS, clientArch, clientVersion := h.app.GetServer().GetClientStatus(clientID)
// 复制插件列表 // 复制插件列表
plugins := make([]db.ClientPlugin, len(client.Plugins)) plugins := make([]db.ClientPlugin, len(client.Plugins))
@@ -155,6 +155,7 @@ func (h *ClientHandler) Get(c *gin.Context) {
RemoteAddr: remoteAddr, RemoteAddr: remoteAddr,
OS: clientOS, OS: clientOS,
Arch: clientArch, Arch: clientArch,
Version: clientVersion,
} }
Success(c, resp) Success(c, resp)
@@ -241,7 +242,7 @@ func (h *ClientHandler) Delete(c *gin.Context) {
func (h *ClientHandler) PushConfig(c *gin.Context) { func (h *ClientHandler) PushConfig(c *gin.Context) {
clientID := c.Param("id") clientID := c.Param("id")
online, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID) online, _, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID)
if !online { if !online {
ClientNotOnline(c) ClientNotOnline(c)
return return
@@ -310,7 +311,7 @@ func (h *ClientHandler) Restart(c *gin.Context) {
func (h *ClientHandler) InstallPlugins(c *gin.Context) { func (h *ClientHandler) InstallPlugins(c *gin.Context) {
clientID := c.Param("id") clientID := c.Param("id")
online, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID) online, _, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID)
if !online { if !online {
ClientNotOnline(c) ClientNotOnline(c)
return return
@@ -450,6 +451,17 @@ func (h *ClientHandler) deleteClientPlugin(clientID, pluginID string) error {
return h.app.GetClientStore().UpdateClient(client) return h.app.GetClientStore().UpdateClient(client)
} }
// GetSystemStats 获取客户端系统状态
func (h *ClientHandler) GetSystemStats(c *gin.Context) {
clientID := c.Param("id")
stats, err := h.app.GetServer().GetClientSystemStats(clientID)
if err != nil {
ClientNotOnline(c)
return
}
Success(c, stats)
}
// validateClientID 验证客户端 ID 格式 // validateClientID 验证客户端 ID 格式
func validateClientID(id string) bool { func validateClientID(id string) bool {
if len(id) < 1 || len(id) > 64 { if len(id) < 1 || len(id) > 64 {

View File

@@ -42,12 +42,14 @@ func (h *ConfigHandler) Get(c *gin.Context) {
HeartbeatTimeout: cfg.Server.HeartbeatTimeout, HeartbeatTimeout: cfg.Server.HeartbeatTimeout,
}, },
Web: dto.WebConfigInfo{ Web: dto.WebConfigInfo{
Enabled: cfg.Web.Enabled, Enabled: cfg.Server.Web.Enabled,
BindAddr: cfg.Web.BindAddr, BindPort: cfg.Server.Web.BindPort,
BindPort: cfg.Web.BindPort, Username: cfg.Server.Web.Username,
Username: cfg.Web.Username,
Password: "****", Password: "****",
}, },
PluginStore: dto.PluginStoreConfigInfo{
URL: cfg.Server.PluginStore.URL,
},
} }
Success(c, resp) Success(c, resp)
@@ -93,15 +95,17 @@ func (h *ConfigHandler) Update(c *gin.Context) {
// 更新 Web 配置 // 更新 Web 配置
if req.Web != nil { if req.Web != nil {
cfg.Web.Enabled = req.Web.Enabled cfg.Server.Web.Enabled = req.Web.Enabled
if req.Web.BindAddr != "" {
cfg.Web.BindAddr = req.Web.BindAddr
}
if req.Web.BindPort > 0 { if req.Web.BindPort > 0 {
cfg.Web.BindPort = req.Web.BindPort cfg.Server.Web.BindPort = req.Web.BindPort
} }
cfg.Web.Username = req.Web.Username cfg.Server.Web.Username = req.Web.Username
cfg.Web.Password = req.Web.Password cfg.Server.Web.Password = req.Web.Password
}
// 更新 PluginStore 配置
if req.PluginStore != nil {
cfg.Server.PluginStore.URL = req.PluginStore.URL
} }
if err := h.app.SaveConfig(); err != nil { if err := h.app.SaveConfig(); err != nil {

View File

@@ -14,17 +14,19 @@ type AppInterface interface {
GetConfigPath() string GetConfigPath() string
SaveConfig() error SaveConfig() error
GetJSPluginStore() db.JSPluginStore GetJSPluginStore() db.JSPluginStore
GetTrafficStore() db.TrafficStore
} }
// ServerInterface 服务端接口 // ServerInterface 服务端接口
type ServerInterface interface { type ServerInterface interface {
GetClientStatus(clientID string) (online bool, lastPing, remoteAddr, clientOS, clientArch string) GetClientStatus(clientID string) (online bool, lastPing, remoteAddr, clientOS, clientArch, clientVersion string)
GetAllClientStatus() map[string]struct { GetAllClientStatus() map[string]struct {
Online bool Online bool
LastPing string LastPing string
RemoteAddr string RemoteAddr string
OS string OS string
Arch string Arch string
Version string
} }
ReloadConfig() error ReloadConfig() error
GetBindAddr() string GetBindAddr() string
@@ -56,6 +58,8 @@ type ServerInterface interface {
IsPortAvailable(port int, excludeClientID string) bool IsPortAvailable(port int, excludeClientID string) bool
// 插件 API 代理 // 插件 API 代理
ProxyPluginAPIRequest(clientID string, req protocol.PluginAPIRequest) (*protocol.PluginAPIResponse, error) ProxyPluginAPIRequest(clientID string, req protocol.PluginAPIRequest) (*protocol.PluginAPIResponse, error)
// 系统状态
GetClientSystemStats(clientID string) (*protocol.SystemStatsResponse, error)
} }
// ConfigField 配置字段 // ConfigField 配置字段

View File

@@ -177,7 +177,7 @@ func (h *JSPluginHandler) PushToClient(c *gin.Context) {
c.ShouldBindJSON(&pushReq) // 忽略错误,允许空请求体 c.ShouldBindJSON(&pushReq) // 忽略错误,允许空请求体
// 检查客户端是否在线 // 检查客户端是否在线
online, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID) online, _, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID)
if !online { if !online {
ClientNotOnline(c) ClientNotOnline(c)
return return

View File

@@ -35,7 +35,7 @@ func (h *LogHandler) StreamLogs(c *gin.Context) {
clientID := c.Param("id") clientID := c.Param("id")
// 检查客户端是否在线 // 检查客户端是否在线
online, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID) online, _, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID)
if !online { if !online {
c.JSON(400, gin.H{"code": 400, "message": "client not online"}) c.JSON(400, gin.H{"code": 400, "message": "client not online"})
return return

View File

@@ -371,7 +371,7 @@ func (h *PluginHandler) UpdateClientConfig(c *gin.Context) {
} }
// 如果客户端在线,同步配置 // 如果客户端在线,同步配置
online, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID) online, _, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID)
if online { if online {
if err := h.app.GetServer().SyncPluginConfigToClient(clientID, pluginName, req.Config); err != nil { if err := h.app.GetServer().SyncPluginConfigToClient(clientID, pluginName, req.Config); err != nil {
PartialSuccess(c, gin.H{"status": "partial", "port_changed": portChanged}, "config saved but sync failed: "+err.Error()) PartialSuccess(c, gin.H{"status": "partial", "port_changed": portChanged}, "config saved but sync failed: "+err.Error())

View File

@@ -45,7 +45,7 @@ func (h *PluginAPIHandler) ProxyRequest(c *gin.Context) {
} }
// 检查客户端是否在线 // 检查客户端是否在线
online, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID) online, _, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID)
if !online { if !online {
ClientNotOnline(c) ClientNotOnline(c)
return return

View File

@@ -34,7 +34,7 @@ func NewStoreHandler(app AppInterface) *StoreHandler {
// @Router /api/store/plugins [get] // @Router /api/store/plugins [get]
func (h *StoreHandler) ListPlugins(c *gin.Context) { func (h *StoreHandler) ListPlugins(c *gin.Context) {
cfg := h.app.GetConfig() cfg := h.app.GetConfig()
storeURL := cfg.PluginStore.GetPluginStoreURL() storeURL := cfg.Server.PluginStore.GetPluginStoreURL()
// 从远程 URL 获取插件列表 // 从远程 URL 获取插件列表
client := &http.Client{Timeout: 10 * time.Second} client := &http.Client{Timeout: 10 * time.Second}
@@ -82,7 +82,7 @@ func (h *StoreHandler) Install(c *gin.Context) {
} }
// 检查客户端是否在线 // 检查客户端是否在线
online, _, _, _, _ := h.app.GetServer().GetClientStatus(req.ClientID) online, _, _, _, _, _ := h.app.GetServer().GetClientStatus(req.ClientID)
if !online { if !online {
ClientNotOnline(c) ClientNotOnline(c)
return return

View File

@@ -0,0 +1,76 @@
package handler
import (
"github.com/gin-gonic/gin"
)
// TrafficHandler 流量统计处理器
type TrafficHandler struct {
app AppInterface
}
// NewTrafficHandler 创建流量统计处理器
func NewTrafficHandler(app AppInterface) *TrafficHandler {
return &TrafficHandler{app: app}
}
// GetStats 获取流量统计
// @Summary 获取流量统计
// @Description 获取24小时和总流量统计
// @Tags 流量
// @Produce json
// @Security Bearer
// @Success 200 {object} Response
// @Router /api/traffic/stats [get]
func (h *TrafficHandler) GetStats(c *gin.Context) {
store := h.app.GetTrafficStore()
// 获取24小时流量
in24h, out24h, err := store.Get24HourTraffic()
if err != nil {
InternalError(c, err.Error())
return
}
// 获取总流量
inTotal, outTotal, err := store.GetTotalTraffic()
if err != nil {
InternalError(c, err.Error())
return
}
Success(c, gin.H{
"traffic_24h": gin.H{
"inbound": in24h,
"outbound": out24h,
},
"traffic_total": gin.H{
"inbound": inTotal,
"outbound": outTotal,
},
})
}
// GetHourly 获取每小时流量
// @Summary 获取每小时流量
// @Description 获取最近N小时的流量记录
// @Tags 流量
// @Produce json
// @Security Bearer
// @Param hours query int false "小时数" default(24)
// @Success 200 {object} Response
// @Router /api/traffic/hourly [get]
func (h *TrafficHandler) GetHourly(c *gin.Context) {
hours := 24
store := h.app.GetTrafficStore()
records, err := store.GetHourlyTraffic(hours)
if err != nil {
InternalError(c, err.Error())
return
}
Success(c, gin.H{
"records": records,
})
}

View File

@@ -127,6 +127,7 @@ func getVersionInfo() dto.VersionInfo {
GitCommit: info.GitCommit, GitCommit: info.GitCommit,
BuildTime: info.BuildTime, BuildTime: info.BuildTime,
GoVersion: info.GoVersion, GoVersion: info.GoVersion,
Platform: info.OS + "/" + info.Arch, OS: info.OS,
Arch: info.Arch,
} }
} }

View File

@@ -69,6 +69,7 @@ func (r *GinRouter) SetupRoutes(app handler.AppInterface, jwtAuth *auth.JWTAuth,
api.POST("/client/:id/restart", clientHandler.Restart) api.POST("/client/:id/restart", clientHandler.Restart)
api.POST("/client/:id/install-plugins", clientHandler.InstallPlugins) api.POST("/client/:id/install-plugins", clientHandler.InstallPlugins)
api.POST("/client/:id/plugin/:pluginID/:action", clientHandler.PluginAction) api.POST("/client/:id/plugin/:pluginID/:action", clientHandler.PluginAction)
api.GET("/client/:id/system-stats", clientHandler.GetSystemStats)
// 配置管理 // 配置管理
configHandler := handler.NewConfigHandler(app) configHandler := handler.NewConfigHandler(app)
@@ -110,6 +111,11 @@ func (r *GinRouter) SetupRoutes(app handler.AppInterface, jwtAuth *auth.JWTAuth,
logHandler := handler.NewLogHandler(app) logHandler := handler.NewLogHandler(app)
api.GET("/client/:id/logs", logHandler.StreamLogs) api.GET("/client/:id/logs", logHandler.StreamLogs)
// 流量统计
trafficHandler := handler.NewTrafficHandler(app)
api.GET("/traffic/stats", trafficHandler.GetStats)
api.GET("/traffic/hourly", trafficHandler.GetHourly)
// 插件 API 代理 (通过 Web API 访问客户端插件) // 插件 API 代理 (通过 Web API 访问客户端插件)
pluginAPIHandler := handler.NewPluginAPIHandler(app) pluginAPIHandler := handler.NewPluginAPIHandler(app)
api.Any("/client/:id/plugin-api/:pluginID/*route", pluginAPIHandler.ProxyRequest) api.Any("/client/:id/plugin-api/:pluginID/*route", pluginAPIHandler.ProxyRequest)

View File

@@ -86,6 +86,7 @@ type ClientSession struct {
RemoteAddr string // 客户端 IP 地址 RemoteAddr string // 客户端 IP 地址
OS string // 客户端操作系统 OS string // 客户端操作系统
Arch string // 客户端架构 Arch string // 客户端架构
Version string // 客户端版本
Session *yamux.Session Session *yamux.Session
Rules []protocol.ProxyRule Rules []protocol.ProxyRule
Listeners map[int]net.Listener Listeners map[int]net.Listener
@@ -289,11 +290,11 @@ func (s *Server) handleConnection(conn net.Conn) {
} }
security.LogAuthSuccess(clientIP, clientID) security.LogAuthSuccess(clientIP, clientID)
s.setupClientSession(conn, clientID, authReq.OS, authReq.Arch, rules) s.setupClientSession(conn, clientID, authReq.OS, authReq.Arch, authReq.Version, rules)
} }
// setupClientSession 建立客户端会话 // setupClientSession 建立客户端会话
func (s *Server) setupClientSession(conn net.Conn, clientID, clientOS, clientArch string, rules []protocol.ProxyRule) { func (s *Server) setupClientSession(conn net.Conn, clientID, clientOS, clientArch, clientVersion string, rules []protocol.ProxyRule) {
session, err := yamux.Server(conn, nil) session, err := yamux.Server(conn, nil)
if err != nil { if err != nil {
log.Printf("[Server] Yamux error: %v", err) log.Printf("[Server] Yamux error: %v", err)
@@ -311,6 +312,7 @@ func (s *Server) setupClientSession(conn net.Conn, clientID, clientOS, clientArc
RemoteAddr: remoteAddr, RemoteAddr: remoteAddr,
OS: clientOS, OS: clientOS,
Arch: clientArch, Arch: clientArch,
Version: clientVersion,
Session: session, Session: session,
Rules: rules, Rules: rules,
Listeners: make(map[int]net.Listener), Listeners: make(map[int]net.Listener),
@@ -571,16 +573,16 @@ func (s *Server) sendHeartbeat(cs *ClientSession) bool {
} }
// GetClientStatus 获取客户端状态 // GetClientStatus 获取客户端状态
func (s *Server) GetClientStatus(clientID string) (online bool, lastPing, remoteAddr, clientOS, clientArch string) { func (s *Server) GetClientStatus(clientID string) (online bool, lastPing, remoteAddr, clientOS, clientArch, clientVersion string) {
s.mu.RLock() s.mu.RLock()
defer s.mu.RUnlock() defer s.mu.RUnlock()
if cs, ok := s.clients[clientID]; ok { if cs, ok := s.clients[clientID]; ok {
cs.mu.Lock() cs.mu.Lock()
defer cs.mu.Unlock() defer cs.mu.Unlock()
return true, cs.LastPing.Format(time.RFC3339), cs.RemoteAddr, cs.OS, cs.Arch return true, cs.LastPing.Format(time.RFC3339), cs.RemoteAddr, cs.OS, cs.Arch, cs.Version
} }
return false, "", "", "", "" return false, "", "", "", "", ""
} }
// GetClientPluginStatus 获取客户端插件运行状态 // GetClientPluginStatus 获取客户端插件运行状态
@@ -633,6 +635,7 @@ func (s *Server) GetAllClientStatus() map[string]struct {
RemoteAddr string RemoteAddr string
OS string OS string
Arch string Arch string
Version string
} { } {
// 先复制客户端引用,避免嵌套锁 // 先复制客户端引用,避免嵌套锁
s.mu.RLock() s.mu.RLock()
@@ -648,6 +651,7 @@ func (s *Server) GetAllClientStatus() map[string]struct {
RemoteAddr string RemoteAddr string
OS string OS string
Arch string Arch string
Version string
}) })
for _, cs := range clients { for _, cs := range clients {
@@ -658,12 +662,14 @@ func (s *Server) GetAllClientStatus() map[string]struct {
RemoteAddr string RemoteAddr string
OS string OS string
Arch string Arch string
Version string
}{ }{
Online: true, Online: true,
LastPing: cs.LastPing.Format(time.RFC3339), LastPing: cs.LastPing.Format(time.RFC3339),
RemoteAddr: cs.RemoteAddr, RemoteAddr: cs.RemoteAddr,
OS: cs.OS, OS: cs.OS,
Arch: cs.Arch, Arch: cs.Arch,
Version: cs.Version,
} }
cs.mu.Unlock() cs.mu.Unlock()
} }
@@ -1869,3 +1875,46 @@ func (s *Server) StopClientLogStream(sessionID string) {
func boolPtr(b bool) *bool { func boolPtr(b bool) *bool {
return &b return &b
} }
// GetClientSystemStats 获取客户端系统状态
func (s *Server) GetClientSystemStats(clientID string) (*protocol.SystemStatsResponse, error) {
s.mu.RLock()
cs, ok := s.clients[clientID]
s.mu.RUnlock()
if !ok {
return nil, fmt.Errorf("client %s not online", clientID)
}
stream, err := cs.Session.Open()
if err != nil {
return nil, err
}
defer stream.Close()
// 设置超时
stream.SetDeadline(time.Now().Add(10 * time.Second))
// 发送请求
msg, _ := protocol.NewMessage(protocol.MsgTypeSystemStatsRequest, nil)
if err := protocol.WriteMessage(stream, msg); err != nil {
return nil, err
}
// 读取响应
resp, err := protocol.ReadMessage(stream)
if err != nil {
return nil, err
}
if resp.Type != protocol.MsgTypeSystemStatsResponse {
return nil, fmt.Errorf("unexpected response type: %d", resp.Type)
}
var stats protocol.SystemStatsResponse
if err := resp.ParsePayload(&stats); err != nil {
return nil, err
}
return &stats, nil
}

View File

@@ -71,6 +71,10 @@ const (
// 插件 API 路由消息 // 插件 API 路由消息
MsgTypePluginAPIRequest uint8 = 90 // 插件 API 请求 MsgTypePluginAPIRequest uint8 = 90 // 插件 API 请求
MsgTypePluginAPIResponse uint8 = 91 // 插件 API 响应 MsgTypePluginAPIResponse uint8 = 91 // 插件 API 响应
// 系统状态消息
MsgTypeSystemStatsRequest uint8 = 100 // 请求系统状态
MsgTypeSystemStatsResponse uint8 = 101 // 系统状态响应
) )
// Message 基础消息结构 // Message 基础消息结构
@@ -83,8 +87,9 @@ type Message struct {
type AuthRequest struct { type AuthRequest struct {
ClientID string `json:"client_id"` ClientID string `json:"client_id"`
Token string `json:"token"` Token string `json:"token"`
OS string `json:"os,omitempty"` // 客户端操作系统 OS string `json:"os,omitempty"` // 客户端操作系统
Arch string `json:"arch,omitempty"` // 客户端架构 Arch string `json:"arch,omitempty"` // 客户端架构
Version string `json:"version,omitempty"` // 客户端版本
} }
// AuthResponse 认证响应 // AuthResponse 认证响应
@@ -441,3 +446,17 @@ func NewMessage(msgType uint8, data interface{}) (*Message, error) {
func (m *Message) ParsePayload(v interface{}) error { func (m *Message) ParsePayload(v interface{}) error {
return json.Unmarshal(m.Payload, v) return json.Unmarshal(m.Payload, v)
} }
// SystemStatsRequest 系统状态请求
type SystemStatsRequest struct{}
// SystemStatsResponse 系统状态响应
type SystemStatsResponse struct {
CPUUsage float64 `json:"cpu_usage"` // CPU 使用率 (0-100)
MemoryTotal uint64 `json:"memory_total"` // 总内存 (字节)
MemoryUsed uint64 `json:"memory_used"` // 已用内存 (字节)
MemoryUsage float64 `json:"memory_usage"` // 内存使用率 (0-100)
DiskTotal uint64 `json:"disk_total"` // 总磁盘 (字节)
DiskUsed uint64 `json:"disk_used"` // 已用磁盘 (字节)
DiskUsage float64 `json:"disk_usage"` // 磁盘使用率 (0-100)
}

View File

@@ -4,10 +4,17 @@ import (
"io" "io"
"net" "net"
"sync" "sync"
"sync/atomic"
) )
const bufferSize = 32 * 1024 const bufferSize = 32 * 1024
// TrafficStats 流量统计
type TrafficStats struct {
Inbound int64
Outbound int64
}
// Relay 双向数据转发 // Relay 双向数据转发
func Relay(c1, c2 net.Conn) { func Relay(c1, c2 net.Conn) {
var wg sync.WaitGroup var wg sync.WaitGroup
@@ -17,7 +24,6 @@ func Relay(c1, c2 net.Conn) {
defer wg.Done() defer wg.Done()
buf := make([]byte, bufferSize) buf := make([]byte, bufferSize)
_, _ = io.CopyBuffer(dst, src, buf) _, _ = io.CopyBuffer(dst, src, buf)
// 关闭写端,通知对方数据传输完成
if tc, ok := dst.(*net.TCPConn); ok { if tc, ok := dst.(*net.TCPConn); ok {
tc.CloseWrite() tc.CloseWrite()
} }
@@ -27,3 +33,36 @@ func Relay(c1, c2 net.Conn) {
go copyConn(c2, c1) go copyConn(c2, c1)
wg.Wait() wg.Wait()
} }
// RelayWithStats 带流量统计的双向数据转发
func RelayWithStats(c1, c2 net.Conn, onStats func(in, out int64)) {
var wg sync.WaitGroup
var inbound, outbound int64
wg.Add(2)
copyWithCount := func(dst, src net.Conn, counter *int64) {
defer wg.Done()
buf := make([]byte, bufferSize)
for {
n, err := src.Read(buf)
if n > 0 {
atomic.AddInt64(counter, int64(n))
dst.Write(buf[:n])
}
if err != nil {
break
}
}
if tc, ok := dst.(*net.TCPConn); ok {
tc.CloseWrite()
}
}
go copyWithCount(c1, c2, &inbound)
go copyWithCount(c2, c1, &outbound)
wg.Wait()
if onStats != nil {
onStats(inbound, outbound)
}
}

61
pkg/utils/sysinfo.go Normal file
View File

@@ -0,0 +1,61 @@
package utils
import (
"os"
"runtime"
"time"
"github.com/shirou/gopsutil/v3/cpu"
"github.com/shirou/gopsutil/v3/disk"
"github.com/shirou/gopsutil/v3/mem"
)
// SystemStats 系统状态信息
type SystemStats struct {
CPUUsage float64 `json:"cpu_usage"`
MemoryTotal uint64 `json:"memory_total"`
MemoryUsed uint64 `json:"memory_used"`
MemoryUsage float64 `json:"memory_usage"`
DiskTotal uint64 `json:"disk_total"`
DiskUsed uint64 `json:"disk_used"`
DiskUsage float64 `json:"disk_usage"`
}
// GetSystemStats 获取系统状态信息
func GetSystemStats() (*SystemStats, error) {
stats := &SystemStats{}
// CPU 使用率
cpuPercent, err := cpu.Percent(time.Second, false)
if err == nil && len(cpuPercent) > 0 {
stats.CPUUsage = cpuPercent[0]
}
// 内存信息
memInfo, err := mem.VirtualMemory()
if err == nil {
stats.MemoryTotal = memInfo.Total
stats.MemoryUsed = memInfo.Used
stats.MemoryUsage = memInfo.UsedPercent
}
// 磁盘信息 - 获取根目录或当前工作目录所在磁盘
diskPath := "/"
if runtime.GOOS == "windows" {
// Windows 使用当前工作目录所在盘符
if wd, err := os.Getwd(); err == nil && len(wd) >= 2 {
diskPath = wd[:2] + "\\"
} else {
diskPath = "C:\\"
}
}
diskInfo, err := disk.Usage(diskPath)
if err == nil {
stats.DiskTotal = diskInfo.Total
stats.DiskUsed = diskInfo.Used
stats.DiskUsage = diskInfo.UsedPercent
}
return stats, nil
}

2
web/components.d.ts vendored
View File

@@ -17,8 +17,6 @@ declare module 'vue' {
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default'] HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
InlineLogPanel: typeof import('./src/components/InlineLogPanel.vue')['default'] InlineLogPanel: typeof import('./src/components/InlineLogPanel.vue')['default']
LogViewer: typeof import('./src/components/LogViewer.vue')['default'] LogViewer: typeof import('./src/components/LogViewer.vue')['default']
NIcon: typeof import('naive-ui')['NIcon']
NTag: typeof import('naive-ui')['NTag']
RouterLink: typeof import('vue-router')['RouterLink'] RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView'] RouterView: typeof import('vue-router')['RouterView']
} }

974
web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -11,7 +11,6 @@
"dependencies": { "dependencies": {
"@vicons/ionicons5": "^0.13.0", "@vicons/ionicons5": "^0.13.0",
"axios": "^1.13.2", "axios": "^1.13.2",
"naive-ui": "^2.43.2",
"vue": "^3.5.24", "vue": "^3.5.24",
"vue-router": "^4.6.4" "vue-router": "^4.6.4"
}, },
@@ -24,8 +23,6 @@
"postcss": "^8.5.6", "postcss": "^8.5.6",
"tailwindcss": "^4.1.18", "tailwindcss": "^4.1.18",
"typescript": "~5.9.3", "typescript": "~5.9.3",
"unplugin-auto-import": "^20.3.0",
"unplugin-vue-components": "^30.0.0",
"vite": "^7.2.4", "vite": "^7.2.4",
"vue-tsc": "^3.1.4" "vue-tsc": "^3.1.4"
} }

View File

@@ -2,35 +2,37 @@
import { ref, onMounted, computed, watch } from 'vue' import { ref, onMounted, computed, watch } from 'vue'
import { RouterView, useRouter, useRoute } from 'vue-router' import { RouterView, useRouter, useRoute } from 'vue-router'
import { import {
NConfigProvider, NMessageProvider, NDialogProvider, NGlobalStyle, HomeOutline, DesktopOutline, SettingsOutline,
type GlobalThemeOverrides PersonCircleOutline, LogOutOutline, LogoGithub, ServerOutline, CheckmarkCircleOutline, ArrowUpCircleOutline, CloseOutline
} from 'naive-ui'
import {
HomeOutline, ExtensionPuzzleOutline, SettingsOutline,
PersonCircleOutline, LogOutOutline, LogoGithub
} from '@vicons/ionicons5' } from '@vicons/ionicons5'
import { getServerStatus, getVersionInfo, removeToken, getToken } from './api' import { getServerStatus, getVersionInfo, checkServerUpdate, applyServerUpdate, removeToken, getToken, type UpdateInfo } from './api'
import { useToast } from './composables/useToast'
import { useConfirm } from './composables/useConfirm'
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
const message = useToast()
const dialog = useConfirm()
const serverInfo = ref({ bind_addr: '', bind_port: 0 }) const serverInfo = ref({ bind_addr: '', bind_port: 0 })
const clientCount = ref(0) const clientCount = ref(0)
const version = ref('') const version = ref('')
const showUserMenu = ref(false) const showUserMenu = ref(false)
const updateInfo = ref<UpdateInfo | null>(null)
const showUpdateModal = ref(false)
const updatingServer = ref(false)
const isLoginPage = computed(() => route.path === '/login') const isLoginPage = computed(() => route.path === '/login')
const navItems = [ const navItems = [
{ key: 'home', label: '首页', icon: HomeOutline, path: '/' }, { key: 'home', label: '首页', icon: HomeOutline, path: '/' },
{ key: 'plugins', label: '插件', icon: ExtensionPuzzleOutline, path: '/plugins' }, { key: 'clients', label: '客户端', icon: DesktopOutline, path: '/clients' },
{ key: 'settings', label: '设置', icon: SettingsOutline, path: '/settings' } { key: 'settings', label: '设置', icon: SettingsOutline, path: '/settings' }
] ]
const activeNav = computed(() => { const activeNav = computed(() => {
const path = route.path const path = route.path
if (path === '/' || path === '/home') return 'home' if (path === '/' || path === '/home') return 'home'
if (path.startsWith('/client')) return 'home' if (path === '/clients' || path.startsWith('/client/')) return 'clients'
if (path === '/plugins') return 'plugins'
if (path === '/settings') return 'settings' if (path === '/settings') return 'settings'
return 'home' return 'home'
}) })
@@ -56,16 +58,28 @@ const fetchVersion = async () => {
} }
} }
const checkUpdate = async () => {
if (isLoginPage.value || !getToken()) return
try {
const { data } = await checkServerUpdate()
updateInfo.value = data
} catch (e) {
console.error('Failed to check update', e)
}
}
watch(() => route.path, (newPath, oldPath) => { watch(() => route.path, (newPath, oldPath) => {
if (oldPath === '/login' && newPath !== '/login') { if (oldPath === '/login' && newPath !== '/login') {
fetchServerStatus() fetchServerStatus()
fetchVersion() fetchVersion()
checkUpdate()
} }
}) })
onMounted(() => { onMounted(() => {
fetchServerStatus() fetchServerStatus()
fetchVersion() fetchVersion()
checkUpdate()
}) })
const logout = () => { const logout = () => {
@@ -77,81 +91,160 @@ const toggleUserMenu = () => {
showUserMenu.value = !showUserMenu.value showUserMenu.value = !showUserMenu.value
} }
// 紫色渐变主题 const openUpdateModal = () => {
const themeOverrides: GlobalThemeOverrides = { if (updateInfo.value) {
common: { showUpdateModal.value = true
primaryColor: '#6366f1',
primaryColorHover: '#818cf8',
primaryColorPressed: '#4f46e5',
},
Layout: {
headerColor: '#ffffff'
},
Tabs: {
tabTextColorActiveLine: '#6366f1',
barColor: '#6366f1'
} }
} }
const formatBytes = (bytes: number): string => {
if (bytes === 0) return '0 B'
const k = 1024
const sizes = ['B', 'KB', 'MB', 'GB']
const i = Math.floor(Math.log(bytes) / Math.log(k))
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]
}
const handleApplyServerUpdate = () => {
if (!updateInfo.value?.download_url) {
message.error('没有可用的下载链接')
return
}
dialog.warning({
title: '确认更新服务端',
content: `即将更新服务端到 ${updateInfo.value.latest},更新后服务器将自动重启。确定要继续吗?`,
positiveText: '更新并重启',
negativeText: '取消',
onPositiveClick: async () => {
updatingServer.value = true
try {
await applyServerUpdate(updateInfo.value!.download_url)
message.success('更新已开始,服务器将在几秒后重启')
showUpdateModal.value = false
setTimeout(() => {
window.location.reload()
}, 5000)
} catch (e: any) {
message.error(e.response?.data || '更新失败')
updatingServer.value = false
}
}
})
}
</script> </script>
<template> <template>
<n-config-provider :theme-overrides="themeOverrides"> <div v-if="!isLoginPage" class="app-layout">
<n-global-style /> <!-- Header -->
<n-dialog-provider> <header class="app-header">
<n-message-provider> <div class="header-left">
<div v-if="!isLoginPage" class="app-layout"> <span class="logo">GoTunnel</span>
<!-- Header --> </div>
<header class="app-header"> <nav class="header-nav">
<div class="header-left"> <router-link
<span class="logo">GoTunnel</span> v-for="item in navItems"
</div> :key="item.key"
<nav class="header-nav"> :to="item.path"
<router-link class="nav-item"
v-for="item in navItems" :class="{ active: activeNav === item.key }"
:key="item.key" >
:to="item.path" <component :is="item.icon" class="nav-icon" />
class="nav-item" <span>{{ item.label }}</span>
:class="{ active: activeNav === item.key }" </router-link>
> </nav>
<component :is="item.icon" class="nav-icon" /> <div class="header-right">
<span>{{ item.label }}</span> <div class="user-menu" @click="toggleUserMenu">
</router-link> <PersonCircleOutline class="user-icon" />
</nav> <div v-if="showUserMenu" class="user-dropdown" @click.stop>
<div class="header-right"> <button class="dropdown-item" @click="logout">
<div class="user-menu" @click="toggleUserMenu"> <LogOutOutline class="dropdown-icon" />
<PersonCircleOutline class="user-icon" /> <span>退出登录</span>
<div v-if="showUserMenu" class="user-dropdown" @click.stop> </button>
<button class="dropdown-item" @click="logout"> </div>
<LogOutOutline class="dropdown-icon" />
<span>退出登录</span>
</button>
</div>
</div>
</div>
</header>
<!-- Main Content -->
<main class="main-content">
<RouterView />
</main>
<!-- Footer -->
<footer class="app-footer">
<div class="footer-left">
<span class="brand">GoTunnel</span>
<span v-if="version" class="version">v{{ version }}</span>
</div>
<a href="https://github.com/user/gotunnel" target="_blank" class="footer-link">
<LogoGithub class="footer-icon" />
<span>GitHub</span>
</a>
<span class="copyright">© 2024 Flik. MIT License</span>
</footer>
</div> </div>
<RouterView v-else /> </div>
</n-message-provider> </header>
</n-dialog-provider>
</n-config-provider> <!-- Main Content -->
<main class="main-content">
<RouterView />
</main>
<!-- Footer -->
<footer class="app-footer">
<div class="footer-left">
<span class="brand">GoTunnel</span>
<div v-if="version" class="version-info">
<ServerOutline class="version-icon" />
<span class="version">v{{ version }}</span>
<span v-if="updateInfo" class="update-status" :class="{ latest: !updateInfo.available, 'has-update': updateInfo.available }" @click="openUpdateModal">
<template v-if="updateInfo.available">
<ArrowUpCircleOutline class="status-icon" />
<span>新版本 ({{ updateInfo.latest }})</span>
</template>
<template v-else>
<CheckmarkCircleOutline class="status-icon" />
<span>最新版本</span>
</template>
</span>
</div>
</div>
<a href="https://github.com/user/gotunnel" target="_blank" class="footer-link">
<LogoGithub class="footer-icon" />
<span>GitHub</span>
</a>
<span class="copyright">© 2024 Flik. MIT License</span>
</footer>
<!-- Update Modal -->
<div v-if="showUpdateModal" class="modal-overlay" @click.self="showUpdateModal = false">
<div class="update-modal">
<div class="modal-header">
<h3>系统更新</h3>
<button class="close-btn" @click="showUpdateModal = false">
<CloseOutline />
</button>
</div>
<div class="modal-body" v-if="updateInfo">
<div class="update-info-grid">
<div class="info-row">
<span class="info-label">当前版本</span>
<span class="info-value">{{ updateInfo.current }}</span>
</div>
<div class="info-row">
<span class="info-label">最新版本</span>
<span class="info-value highlight">{{ updateInfo.latest }}</span>
</div>
<div v-if="updateInfo.asset_name" class="info-row">
<span class="info-label">文件名</span>
<span class="info-value">{{ updateInfo.asset_name }}</span>
</div>
<div v-if="updateInfo.asset_size" class="info-row">
<span class="info-label">文件大小</span>
<span class="info-value">{{ formatBytes(updateInfo.asset_size) }}</span>
</div>
</div>
<div v-if="updateInfo.release_note" class="release-note">
<span class="note-label">更新日志</span>
<pre>{{ updateInfo.release_note }}</pre>
</div>
</div>
<div class="modal-footer">
<button class="modal-btn" @click="showUpdateModal = false">取消</button>
<button
v-if="updateInfo?.available && updateInfo?.download_url"
class="modal-btn primary"
:disabled="updatingServer"
@click="handleApplyServerUpdate"
>
{{ updatingServer ? '更新中...' : '立即更新' }}
</button>
</div>
</div>
</div>
</div>
<RouterView v-else />
</template> </template>
<style scoped> <style scoped>
@@ -310,6 +403,48 @@ const themeOverrides: GlobalThemeOverrides = {
font-size: 12px; font-size: 12px;
} }
.version-info {
display: flex;
align-items: center;
gap: 6px;
}
.version-icon {
width: 14px;
height: 14px;
color: rgba(255, 255, 255, 0.5);
}
.update-status {
display: flex;
align-items: center;
gap: 4px;
font-size: 12px;
padding: 2px 8px;
border-radius: 4px;
cursor: pointer;
transition: all 0.2s;
}
.update-status:hover {
opacity: 0.8;
}
.update-status.latest {
color: #34d399;
background: rgba(52, 211, 153, 0.15);
}
.update-status.has-update {
color: #fbbf24;
background: rgba(251, 191, 36, 0.15);
}
.status-icon {
width: 14px;
height: 14px;
}
.footer-link { .footer-link {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -347,4 +482,148 @@ const themeOverrides: GlobalThemeOverrides = {
display: none; display: none;
} }
} }
/* Update Modal */
.modal-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.6);
backdrop-filter: blur(4px);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
}
.update-modal {
background: rgba(30, 27, 75, 0.95);
backdrop-filter: blur(20px);
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 16px;
width: 90%;
max-width: 480px;
max-height: 80vh;
overflow: hidden;
display: flex;
flex-direction: column;
}
.modal-header {
padding: 16px 20px;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
display: flex;
justify-content: space-between;
align-items: center;
}
.modal-header h3 {
margin: 0;
font-size: 16px;
font-weight: 600;
color: white;
}
.close-btn {
background: none;
border: none;
color: rgba(255, 255, 255, 0.6);
cursor: pointer;
padding: 4px;
display: flex;
transition: color 0.2s;
}
.close-btn:hover {
color: white;
}
.modal-body {
padding: 20px;
overflow-y: auto;
flex: 1;
}
.update-info-grid {
display: flex;
flex-direction: column;
gap: 12px;
margin-bottom: 16px;
}
.info-row {
display: flex;
justify-content: space-between;
align-items: center;
}
.info-label {
color: rgba(255, 255, 255, 0.6);
font-size: 13px;
}
.info-value {
color: white;
font-size: 13px;
font-weight: 500;
}
.info-value.highlight {
color: #34d399;
}
.release-note {
margin-top: 16px;
}
.note-label {
display: block;
font-size: 12px;
color: rgba(255, 255, 255, 0.5);
margin-bottom: 8px;
}
.release-note pre {
margin: 0;
white-space: pre-wrap;
font-size: 12px;
color: rgba(255, 255, 255, 0.7);
background: rgba(0, 0, 0, 0.2);
padding: 12px;
border-radius: 8px;
max-height: 200px;
overflow-y: auto;
}
.modal-footer {
padding: 16px 20px;
border-top: 1px solid rgba(255, 255, 255, 0.1);
display: flex;
justify-content: flex-end;
gap: 8px;
}
.modal-btn {
padding: 8px 16px;
border-radius: 8px;
font-size: 13px;
cursor: pointer;
transition: all 0.2s;
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.15);
color: white;
}
.modal-btn:hover:not(:disabled) {
background: rgba(255, 255, 255, 0.2);
}
.modal-btn.primary {
background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
border: none;
}
.modal-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
</style> </style>

View File

@@ -180,3 +180,66 @@ export const createLogStream = (
return eventSource return eventSource
} }
// 流量统计
export interface TrafficStats {
traffic_24h: { inbound: number; outbound: number }
traffic_total: { inbound: number; outbound: number }
}
export interface TrafficRecord {
timestamp: number
inbound: number
outbound: number
}
export const getTrafficStats = () => get<TrafficStats>('/traffic/stats')
export const getTrafficHourly = () => get<{ records: TrafficRecord[] }>('/traffic/hourly')
// 客户端系统状态
export interface SystemStats {
cpu_usage: number
memory_total: number
memory_used: number
memory_usage: number
disk_total: number
disk_used: number
disk_usage: number
}
export const getClientSystemStats = (clientId: string) => get<SystemStats>(`/client/${clientId}/system-stats`)
// 服务器配置
export interface ServerConfigInfo {
bind_addr: string
bind_port: number
token: string
heartbeat_sec: number
heartbeat_timeout: number
}
export interface WebConfigInfo {
enabled: boolean
bind_port: number
username: string
password: string
}
export interface PluginStoreConfigInfo {
url: string
}
export interface ServerConfigResponse {
server: ServerConfigInfo
web: WebConfigInfo
plugin_store: PluginStoreConfigInfo
}
export interface UpdateServerConfigRequest {
server?: Partial<ServerConfigInfo>
web?: Partial<WebConfigInfo>
plugin_store?: Partial<PluginStoreConfigInfo>
}
export const getServerConfig = () => get<ServerConfigResponse>('/config')
export const updateServerConfig = (config: UpdateServerConfigRequest) => put('/config', config)

View File

@@ -1,10 +1,8 @@
import { createApp } from 'vue' import { createApp } from 'vue'
import naive from 'naive-ui'
import './style.css' import './style.css'
import App from './App.vue' import App from './App.vue'
import router from './router' import router from './router'
const app = createApp(App) const app = createApp(App)
app.use(router) app.use(router)
app.use(naive)
app.mount('#app') app.mount('#app')

View File

@@ -15,16 +15,16 @@ const router = createRouter({
name: 'home', name: 'home',
component: () => import('../views/HomeView.vue'), component: () => import('../views/HomeView.vue'),
}, },
{
path: '/clients',
name: 'clients',
component: () => import('../views/ClientsView.vue'),
},
{ {
path: '/client/:id', path: '/client/:id',
name: 'client', name: 'client',
component: () => import('../views/ClientView.vue'), component: () => import('../views/ClientView.vue'),
}, },
{
path: '/plugins',
name: 'plugins',
component: () => import('../views/PluginsView.vue'),
},
{ {
path: '/settings', path: '/settings',
name: 'settings', name: 'settings',

View File

@@ -76,6 +76,7 @@ export interface ClientDetail {
remote_addr?: string remote_addr?: string
os?: string os?: string
arch?: string arch?: string
version?: string
} }
// 服务器状态 // 服务器状态

View File

@@ -15,7 +15,7 @@ import {
getClient, updateClient, deleteClient, pushConfigToClient, disconnectClient, restartClient, getClient, updateClient, deleteClient, pushConfigToClient, disconnectClient, restartClient,
getClientPluginConfig, updateClientPluginConfig, getClientPluginConfig, updateClientPluginConfig,
getStorePlugins, installStorePlugin, getRuleSchemas, startClientPlugin, restartClientPlugin, stopClientPlugin, deleteClientPlugin, getStorePlugins, installStorePlugin, getRuleSchemas, startClientPlugin, restartClientPlugin, stopClientPlugin, deleteClientPlugin,
checkClientUpdate, applyClientUpdate, type UpdateInfo checkClientUpdate, applyClientUpdate, getClientSystemStats, type UpdateInfo, type SystemStats
} from '../api' } from '../api'
import type { ProxyRule, ClientPlugin, ConfigField, StorePluginInfo, RuleSchemasMap } from '../types' import type { ProxyRule, ClientPlugin, ConfigField, StorePluginInfo, RuleSchemasMap } from '../types'
import LogViewer from '../components/LogViewer.vue' import LogViewer from '../components/LogViewer.vue'
@@ -37,12 +37,17 @@ const clientPlugins = ref<ClientPlugin[]>([])
const loading = ref(false) const loading = ref(false)
const clientOs = ref('') const clientOs = ref('')
const clientArch = ref('') const clientArch = ref('')
const clientVersion = ref('')
// 客户端更新相关 // 客户端更新相关
const clientUpdate = ref<UpdateInfo | null>(null) const clientUpdate = ref<UpdateInfo | null>(null)
const checkingUpdate = ref(false) const checkingUpdate = ref(false)
const updatingClient = ref(false) const updatingClient = ref(false)
// 系统状态相关
const systemStats = ref<SystemStats | null>(null)
const loadingStats = ref(false)
// Rule Schemas // Rule Schemas
const pluginRuleSchemas = ref<RuleSchemasMap>({}) const pluginRuleSchemas = ref<RuleSchemasMap>({})
const loadRuleSchemas = async () => { const loadRuleSchemas = async () => {
@@ -103,6 +108,13 @@ const loadClient = async () => {
clientPlugins.value = data.plugins || [] clientPlugins.value = data.plugins || []
clientOs.value = data.os || '' clientOs.value = data.os || ''
clientArch.value = data.arch || '' clientArch.value = data.arch || ''
clientVersion.value = data.version || ''
// 如果客户端在线且有平台信息,自动检测更新
if (data.online && data.os && data.arch) {
autoCheckClientUpdate()
loadSystemStats()
}
} catch (e) { } catch (e) {
message.error('加载客户端信息失败') message.error('加载客户端信息失败')
console.error(e) console.error(e)
@@ -111,6 +123,39 @@ const loadClient = async () => {
} }
} }
// 自动检测客户端更新(静默)
const autoCheckClientUpdate = async () => {
try {
const { data } = await checkClientUpdate(clientOs.value, clientArch.value)
clientUpdate.value = data
} catch (e) {
console.error('Auto check update failed', e)
}
}
// 加载系统状态
const loadSystemStats = async () => {
if (!online.value) return
loadingStats.value = true
try {
const { data } = await getClientSystemStats(clientId)
systemStats.value = data
} catch (e) {
console.error('Failed to load system stats', e)
} finally {
loadingStats.value = false
}
}
// 格式化字节大小
const formatBytes = (bytes: number): string => {
if (bytes === 0) return '0 B'
const k = 1024
const sizes = ['B', 'KB', 'MB', 'GB', 'TB']
const i = Math.floor(Math.log(bytes) / Math.log(k))
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]
}
// 客户端更新 // 客户端更新
const handleCheckClientUpdate = async () => { const handleCheckClientUpdate = async () => {
if (!online.value) { if (!online.value) {
@@ -473,11 +518,11 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
<div class="page-header"> <div class="page-header">
<div class="header-left"> <div class="header-left">
<button class="back-btn" @click="router.push('/')"> <button class="back-btn" @click="router.push('/')">
<n-icon size="20"><ArrowBackOutline /></n-icon> <ArrowBackOutline class="btn-icon-lg" />
</button> </button>
<h1 class="page-title">{{ nickname || clientId }}</h1> <h1 class="page-title">{{ nickname || clientId }}</h1>
<button class="edit-btn" @click="openRenameModal"> <button class="edit-btn" @click="openRenameModal">
<n-icon size="16"><CreateOutline /></n-icon> <CreateOutline class="btn-icon" />
</button> </button>
<span class="status-tag" :class="{ online }"> <span class="status-tag" :class="{ online }">
{{ online ? '在线' : '离线' }} {{ online ? '在线' : '离线' }}
@@ -485,15 +530,15 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
</div> </div>
<div class="header-actions"> <div class="header-actions">
<button v-if="online" class="glass-btn primary" @click="pushConfigToClient(clientId).then(() => message.success('已推送'))"> <button v-if="online" class="glass-btn primary" @click="pushConfigToClient(clientId).then(() => message.success('已推送'))">
<n-icon size="16"><PushOutline /></n-icon> <PushOutline class="btn-icon" />
<span>推送配置</span> <span>推送配置</span>
</button> </button>
<button class="glass-btn" @click="showLogViewer=true"> <button class="glass-btn" @click="showLogViewer=true">
<n-icon size="16"><DocumentTextOutline /></n-icon> <DocumentTextOutline class="btn-icon" />
<span>日志</span> <span>日志</span>
</button> </button>
<button class="glass-btn danger" @click="confirmDelete"> <button class="glass-btn danger" @click="confirmDelete">
<n-icon size="16"><TrashOutline /></n-icon> <TrashOutline class="btn-icon" />
<span>删除</span> <span>删除</span>
</button> </button>
</div> </div>
@@ -517,6 +562,15 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
<span class="stat-label">远程 IP</span> <span class="stat-label">远程 IP</span>
<span class="stat-value">{{ remoteAddr || '-' }}</span> <span class="stat-value">{{ remoteAddr || '-' }}</span>
</div> </div>
<div class="stat-item">
<span class="stat-label">客户端版本</span>
<span class="stat-value">
{{ clientVersion || '-' }}
<span v-if="clientUpdate?.available" class="update-badge" @click="handleApplyClientUpdate">
可更新
</span>
</span>
</div>
<div class="stat-item"> <div class="stat-item">
<span class="stat-label">最后心跳</span> <span class="stat-label">最后心跳</span>
<span class="stat-value">{{ lastPing ? new Date(lastPing).toLocaleTimeString() : '-' }}</span> <span class="stat-value">{{ lastPing ? new Date(lastPing).toLocaleTimeString() : '-' }}</span>
@@ -545,12 +599,57 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
</div> </div>
</div> </div>
<!-- System Stats Card -->
<div class="glass-card" v-if="online">
<div class="card-header">
<h3>系统状态</h3>
<button class="glass-btn tiny" :disabled="loadingStats" @click="loadSystemStats">
<RefreshOutline class="btn-icon-sm" />
刷新
</button>
</div>
<div class="card-body">
<div v-if="!systemStats" class="empty-hint">
{{ loadingStats ? '加载中...' : '点击刷新获取状态' }}
</div>
<template v-else>
<div class="system-stat-item">
<span class="system-stat-label">CPU</span>
<div class="progress-bar">
<div class="progress-fill" :style="{ width: systemStats.cpu_usage + '%' }"></div>
</div>
<span class="system-stat-value">{{ systemStats.cpu_usage.toFixed(1) }}%</span>
</div>
<div class="system-stat-item">
<span class="system-stat-label">内存</span>
<div class="progress-bar">
<div class="progress-fill" :style="{ width: systemStats.memory_usage + '%' }"></div>
</div>
<span class="system-stat-value">{{ systemStats.memory_usage.toFixed(1) }}%</span>
</div>
<div class="system-stat-detail">
{{ formatBytes(systemStats.memory_used) }} / {{ formatBytes(systemStats.memory_total) }}
</div>
<div class="system-stat-item">
<span class="system-stat-label">磁盘</span>
<div class="progress-bar">
<div class="progress-fill" :style="{ width: systemStats.disk_usage + '%' }"></div>
</div>
<span class="system-stat-value">{{ systemStats.disk_usage.toFixed(1) }}%</span>
</div>
<div class="system-stat-detail">
{{ formatBytes(systemStats.disk_used) }} / {{ formatBytes(systemStats.disk_total) }}
</div>
</template>
</div>
</div>
<!-- Update Card --> <!-- Update Card -->
<div class="glass-card"> <div class="glass-card">
<div class="card-header"> <div class="card-header">
<h3>客户端更新</h3> <h3>客户端更新</h3>
<button class="glass-btn tiny" :disabled="!online || checkingUpdate" @click="handleCheckClientUpdate"> <button class="glass-btn tiny" :disabled="!online || checkingUpdate" @click="handleCheckClientUpdate">
<n-icon size="14"><RefreshOutline /></n-icon> <RefreshOutline class="btn-icon-sm" />
检查 检查
</button> </button>
</div> </div>
@@ -563,7 +662,7 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
<div v-if="clientUpdate.download_url" class="update-available"> <div v-if="clientUpdate.download_url" class="update-available">
<p>发现新版本 {{ clientUpdate.latest }}</p> <p>发现新版本 {{ clientUpdate.latest }}</p>
<button class="glass-btn primary small" :disabled="updatingClient" @click="handleApplyClientUpdate"> <button class="glass-btn primary small" :disabled="updatingClient" @click="handleApplyClientUpdate">
<n-icon size="14"><CloudDownloadOutline /></n-icon> <CloudDownloadOutline class="btn-icon-sm" />
更新 更新
</button> </button>
</div> </div>
@@ -580,7 +679,7 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
<div class="card-header"> <div class="card-header">
<h3>代理规则</h3> <h3>代理规则</h3>
<button class="glass-btn primary small" @click="openCreateRule"> <button class="glass-btn primary small" @click="openCreateRule">
<n-icon size="14"><AddOutline /></n-icon> <AddOutline class="btn-icon-sm" />
添加规则 添加规则
</button> </button>
</div> </div>
@@ -757,7 +856,7 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
<div v-for="plugin in storePlugins" :key="plugin.name" class="store-plugin-card"> <div v-for="plugin in storePlugins" :key="plugin.name" class="store-plugin-card">
<div class="store-plugin-header"> <div class="store-plugin-header">
<span class="store-plugin-name">{{ plugin.name }}</span> <span class="store-plugin-name">{{ plugin.name }}</span>
<n-tag size="small">v{{ plugin.version }}</n-tag> <GlassTag>v{{ plugin.version }}</GlassTag>
</div> </div>
<p class="store-plugin-desc">{{ plugin.description }}</p> <p class="store-plugin-desc">{{ plugin.description }}</p>
<button class="glass-btn primary small full" @click="handleInstallStorePlugin(plugin)"> <button class="glass-btn primary small full" @click="handleInstallStorePlugin(plugin)">
@@ -1000,6 +1099,22 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
font-size: 12px; font-size: 12px;
} }
.update-badge {
display: inline-block;
margin-left: 8px;
padding: 2px 8px;
font-size: 11px;
background: rgba(251, 191, 36, 0.2);
color: #fbbf24;
border-radius: 10px;
cursor: pointer;
transition: all 0.2s;
}
.update-badge:hover {
background: rgba(251, 191, 36, 0.3);
}
/* Mini Stats */ /* Mini Stats */
.stats-row { .stats-row {
display: flex; display: flex;
@@ -1335,6 +1450,16 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
height: 14px; height: 14px;
} }
.btn-icon-lg {
width: 20px;
height: 20px;
}
.btn-icon-sm {
width: 14px;
height: 14px;
}
.plugin-icon { .plugin-icon {
width: 18px; width: 18px;
height: 18px; height: 18px;
@@ -1345,4 +1470,49 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
width: 16px; width: 16px;
height: 16px; height: 16px;
} }
/* System Stats */
.system-stat-item {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 8px;
}
.system-stat-label {
width: 40px;
font-size: 12px;
color: rgba(255, 255, 255, 0.6);
}
.progress-bar {
flex: 1;
height: 8px;
background: rgba(255, 255, 255, 0.1);
border-radius: 4px;
overflow: hidden;
}
.progress-fill {
height: 100%;
background: linear-gradient(90deg, #60a5fa, #a78bfa);
border-radius: 4px;
transition: width 0.3s ease;
}
.system-stat-value {
width: 50px;
text-align: right;
font-size: 12px;
color: white;
font-family: monospace;
}
.system-stat-detail {
font-size: 11px;
color: rgba(255, 255, 255, 0.4);
text-align: right;
margin-bottom: 12px;
margin-top: -4px;
}
</style> </style>

View File

@@ -0,0 +1,317 @@
<script setup lang="ts">
import { ref, onMounted, computed } from 'vue'
import { useRouter } from 'vue-router'
import { getClients } from '../api'
import type { ClientStatus } from '../types'
const router = useRouter()
const clients = ref<ClientStatus[]>([])
const loading = ref(true)
const loadClients = async () => {
loading.value = true
try {
const { data } = await getClients()
clients.value = data || []
} catch (e) {
console.error('Failed to load clients', e)
} finally {
loading.value = false
}
}
const onlineClients = computed(() => clients.value.filter(c => c.online).length)
const viewClient = (id: string) => {
router.push(`/client/${id}`)
}
onMounted(loadClients)
</script>
<template>
<div class="clients-page">
<!-- Particles -->
<div class="particles">
<div class="particle particle-1"></div>
<div class="particle particle-2"></div>
<div class="particle particle-3"></div>
</div>
<div class="clients-content">
<!-- Header -->
<div class="page-header">
<h1 class="page-title">客户端管理</h1>
<p class="page-subtitle">管理所有连接的客户端</p>
</div>
<!-- Stats Row -->
<div class="stats-row">
<div class="stat-card">
<span class="stat-value">{{ clients.length }}</span>
<span class="stat-label">总客户端</span>
</div>
<div class="stat-card">
<span class="stat-value online">{{ onlineClients }}</span>
<span class="stat-label">在线</span>
</div>
<div class="stat-card">
<span class="stat-value offline">{{ clients.length - onlineClients }}</span>
<span class="stat-label">离线</span>
</div>
</div>
<!-- Client List -->
<div class="glass-card">
<div class="card-header">
<h3>客户端列表</h3>
<button class="glass-btn small" @click="loadClients">刷新</button>
</div>
<div class="card-body">
<div v-if="loading" class="loading-state">加载中...</div>
<div v-else-if="clients.length === 0" class="empty-state">
<p>暂无客户端连接</p>
<p class="empty-hint">等待客户端连接...</p>
</div>
<div v-else class="clients-grid">
<div
v-for="client in clients"
:key="client.id"
class="client-card"
@click="viewClient(client.id)"
>
<div class="client-header">
<div class="client-status" :class="{ online: client.online }"></div>
<h4 class="client-name">{{ client.nickname || client.id }}</h4>
</div>
<p v-if="client.nickname" class="client-id">{{ client.id }}</p>
<div class="client-info">
<span v-if="client.remote_addr && client.online">{{ client.remote_addr }}</span>
<span>{{ client.rule_count || 0 }} 条规则</span>
</div>
<div class="client-tag" :class="client.online ? 'online' : 'offline'">
{{ client.online ? '在线' : '离线' }}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<style scoped>
.clients-page {
min-height: calc(100vh - 108px);
background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #4c1d95 60%, #581c87 100%);
position: relative;
overflow: hidden;
padding: 32px;
}
.particles {
position: absolute;
inset: 0;
pointer-events: none;
}
.particle {
position: absolute;
border-radius: 50%;
background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
animation: float-particle 20s ease-in-out infinite;
}
.particle-1 { width: 250px; height: 250px; top: -80px; right: -50px; }
.particle-2 { width: 180px; height: 180px; bottom: 10%; left: 5%; animation-delay: -7s; }
.particle-3 { width: 120px; height: 120px; top: 50%; right: 15%; animation-delay: -12s; }
@keyframes float-particle {
0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.3; }
50% { transform: translate(-20px, -60px) scale(0.95); opacity: 0.4; }
}
.clients-content {
position: relative;
z-index: 10;
max-width: 1200px;
margin: 0 auto;
}
.page-header { margin-bottom: 24px; }
.page-title {
font-size: 28px;
font-weight: 700;
color: white;
margin: 0 0 8px 0;
}
.page-subtitle {
color: rgba(255,255,255,0.6);
margin: 0;
font-size: 14px;
}
/* Stats */
.stats-row {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16px;
margin-bottom: 24px;
}
.stat-card {
background: rgba(255,255,255,0.08);
backdrop-filter: blur(20px);
border-radius: 16px;
border: 1px solid rgba(255,255,255,0.12);
padding: 20px;
text-align: center;
}
.stat-value {
display: block;
font-size: 32px;
font-weight: 700;
color: white;
}
.stat-value.online { color: #34d399; }
.stat-value.offline { color: rgba(255,255,255,0.5); }
.stat-label {
font-size: 13px;
color: rgba(255,255,255,0.6);
}
/* Glass Card */
.glass-card {
background: rgba(255,255,255,0.08);
backdrop-filter: blur(20px);
border-radius: 16px;
border: 1px solid rgba(255,255,255,0.12);
}
.card-header {
padding: 16px 20px;
border-bottom: 1px solid rgba(255,255,255,0.08);
display: flex;
justify-content: space-between;
align-items: center;
}
.card-header h3 {
margin: 0;
font-size: 15px;
font-weight: 600;
color: white;
}
.card-body { padding: 20px; }
.loading-state, .empty-state {
text-align: center;
padding: 48px;
color: rgba(255,255,255,0.5);
}
.empty-hint {
font-size: 13px;
color: rgba(255,255,255,0.3);
margin-top: 8px;
}
/* Clients Grid */
.clients-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16px;
}
@media (max-width: 900px) {
.clients-grid { grid-template-columns: repeat(2, 1fr); }
.stats-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
.clients-grid { grid-template-columns: 1fr; }
}
.client-card {
background: rgba(255,255,255,0.05);
border-radius: 12px;
padding: 16px;
border: 1px solid rgba(255,255,255,0.08);
cursor: pointer;
transition: all 0.2s;
position: relative;
}
.client-card:hover {
background: rgba(255,255,255,0.1);
transform: translateY(-2px);
}
.client-header {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 8px;
}
.client-status {
width: 10px;
height: 10px;
border-radius: 50%;
background: rgba(255,255,255,0.3);
}
.client-status.online {
background: #34d399;
box-shadow: 0 0 8px rgba(52,211,153,0.6);
}
.client-name {
font-size: 15px;
font-weight: 600;
color: white;
margin: 0;
}
.client-id {
font-size: 12px;
color: rgba(255,255,255,0.4);
margin: 0 0 8px 0;
font-family: monospace;
}
.client-info {
display: flex;
flex-direction: column;
gap: 4px;
font-size: 13px;
color: rgba(255,255,255,0.6);
margin-bottom: 12px;
}
.client-tag {
display: inline-block;
padding: 4px 10px;
border-radius: 6px;
font-size: 12px;
font-weight: 500;
}
.client-tag.online {
background: rgba(52,211,153,0.2);
color: #34d399;
}
.client-tag.offline {
background: rgba(255,255,255,0.1);
color: rgba(255,255,255,0.5);
}
/* Button */
.glass-btn {
background: rgba(255,255,255,0.1);
border: 1px solid rgba(255,255,255,0.15);
border-radius: 8px;
padding: 8px 16px;
color: white;
font-size: 13px;
cursor: pointer;
transition: all 0.2s;
}
.glass-btn:hover { background: rgba(255,255,255,0.2); }
.glass-btn.small { padding: 6px 12px; font-size: 12px; }
</style>

View File

@@ -1,33 +1,63 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, computed } from 'vue' import { ref, onMounted, computed } from 'vue'
import { getClients } from '../api' import { getClients, getTrafficStats, getTrafficHourly, type TrafficRecord } from '../api'
import type { ClientStatus } from '../types' import type { ClientStatus } from '../types'
const clients = ref<ClientStatus[]>([]) const clients = ref<ClientStatus[]>([])
// Mock data for traffic (API not implemented yet) // 流量统计数据
const trafficStats = ref({ const traffic24h = ref({ inbound: 0, outbound: 0 })
inbound: 0, const trafficTotal = ref({ inbound: 0, outbound: 0 })
outbound: 0, const trafficHistory = ref<TrafficRecord[]>([])
inboundUnit: 'GB',
outboundUnit: 'GB'
})
// Mock 24h traffic data for chart // 格式化字节数
const trafficHistory = ref<Array<{ hour: string; inbound: number; outbound: number }>>([]) const formatBytes = (bytes: number): { value: string; unit: string } => {
if (bytes === 0) return { value: '0', unit: 'B' }
const generateMockTrafficData = () => { const k = 1024
const data = [] const sizes: string[] = ['B', 'KB', 'MB', 'GB', 'TB']
const now = new Date() const i = Math.min(Math.floor(Math.log(bytes) / Math.log(k)), sizes.length - 1)
for (let i = 23; i >= 0; i--) { return {
const hour = new Date(now.getTime() - i * 60 * 60 * 1000) value: parseFloat((bytes / Math.pow(k, i)).toFixed(2)).toString(),
data.push({ unit: sizes[i] as string
hour: hour.getHours().toString().padStart(2, '0') + ':00', }
inbound: Math.random() * 100, }
outbound: Math.random() * 80
}) // 加载流量统计
const loadTrafficStats = async () => {
try {
const { data } = await getTrafficStats()
traffic24h.value = data.traffic_24h
trafficTotal.value = data.traffic_total
} catch (e) {
console.error('Failed to load traffic stats', e)
}
}
// 加载每小时流量
const loadTrafficHourly = async () => {
try {
const { data } = await getTrafficHourly()
const records = data.records || []
// 如果没有数据生成从当前时间开始的24小时空数据
if (records.length === 0) {
const now = new Date()
const currentHour = new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours())
const emptyRecords: TrafficRecord[] = []
for (let i = 23; i >= 0; i--) {
const ts = new Date(currentHour.getTime() - i * 3600 * 1000)
emptyRecords.push({
timestamp: Math.floor(ts.getTime() / 1000),
inbound: 0,
outbound: 0
})
}
trafficHistory.value = emptyRecords
} else {
trafficHistory.value = records
}
} catch (e) {
console.error('Failed to load hourly traffic', e)
} }
trafficHistory.value = data
} }
const loadClients = async () => { const loadClients = async () => {
@@ -47,6 +77,12 @@ const totalRules = computed(() => {
return clients.value.reduce((sum, c) => sum + (c.rule_count || 0), 0) return clients.value.reduce((sum, c) => sum + (c.rule_count || 0), 0)
}) })
// 格式化后的流量统计
const formatted24hInbound = computed(() => formatBytes(traffic24h.value.inbound))
const formatted24hOutbound = computed(() => formatBytes(traffic24h.value.outbound))
const formattedTotalInbound = computed(() => formatBytes(trafficTotal.value.inbound))
const formattedTotalOutbound = computed(() => formatBytes(trafficTotal.value.outbound))
// Chart helpers // Chart helpers
const maxTraffic = computed(() => { const maxTraffic = computed(() => {
const max = Math.max( const max = Math.max(
@@ -59,9 +95,16 @@ const getBarHeight = (value: number) => {
return (value / maxTraffic.value) * 100 return (value / maxTraffic.value) * 100
} }
// 格式化时间戳为小时
const formatHour = (timestamp: number) => {
const date = new Date(timestamp * 1000)
return date.getHours().toString().padStart(2, '0') + ':00'
}
onMounted(() => { onMounted(() => {
loadClients() loadClients()
generateMockTrafficData() loadTrafficStats()
loadTrafficHourly()
}) })
</script> </script>
@@ -80,8 +123,8 @@ onMounted(() => {
<div class="dashboard-content"> <div class="dashboard-content">
<!-- Header --> <!-- Header -->
<div class="dashboard-header"> <div class="dashboard-header">
<h1 class="text-3xl font-bold text-white mb-2">Dashboard</h1> <h1 class="text-3xl font-bold text-white mb-2">仪表盘</h1>
<p class="text-white/70">Monitor your tunnel connections and traffic</p> <p class="text-white/70">监控隧道连接和流量状态</p>
</div> </div>
<!-- Stats Grid --> <!-- Stats Grid -->
@@ -94,9 +137,9 @@ onMounted(() => {
</svg> </svg>
</div> </div>
<div class="stat-content"> <div class="stat-content">
<span class="stat-label">出站流量</span> <span class="stat-label">24h出站</span>
<span class="stat-value">{{ trafficStats.outbound.toFixed(2) }}</span> <span class="stat-value">{{ formatted24hOutbound.value }}</span>
<span class="stat-unit">{{ trafficStats.outboundUnit }}</span> <span class="stat-unit">{{ formatted24hOutbound.unit }}</span>
</div> </div>
</div> </div>
@@ -108,9 +151,37 @@ onMounted(() => {
</svg> </svg>
</div> </div>
<div class="stat-content"> <div class="stat-content">
<span class="stat-label">入站流量</span> <span class="stat-label">24h入站</span>
<span class="stat-value">{{ trafficStats.inbound.toFixed(2) }}</span> <span class="stat-value">{{ formatted24hInbound.value }}</span>
<span class="stat-unit">{{ trafficStats.inboundUnit }}</span> <span class="stat-unit">{{ formatted24hInbound.unit }}</span>
</div>
</div>
<!-- Total Outbound Traffic -->
<div class="stat-card glass-stat">
<div class="stat-icon total-out">
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 11l5-5m0 0l5 5m-5-5v12" />
</svg>
</div>
<div class="stat-content">
<span class="stat-label">总出站</span>
<span class="stat-value">{{ formattedTotalOutbound.value }}</span>
<span class="stat-unit">{{ formattedTotalOutbound.unit }}</span>
</div>
</div>
<!-- Total Inbound Traffic -->
<div class="stat-card glass-stat">
<div class="stat-icon total-in">
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 13l-5 5m0 0l-5-5m5 5V6" />
</svg>
</div>
<div class="stat-content">
<span class="stat-label">总入站</span>
<span class="stat-value">{{ formattedTotalInbound.value }}</span>
<span class="stat-unit">{{ formattedTotalInbound.unit }}</span>
</div> </div>
</div> </div>
@@ -168,13 +239,10 @@ onMounted(() => {
<div class="bar inbound" :style="{ height: getBarHeight(data.inbound) + '%' }"></div> <div class="bar inbound" :style="{ height: getBarHeight(data.inbound) + '%' }"></div>
<div class="bar outbound" :style="{ height: getBarHeight(data.outbound) + '%' }"></div> <div class="bar outbound" :style="{ height: getBarHeight(data.outbound) + '%' }"></div>
</div> </div>
<span class="bar-label">{{ data.hour }}</span> <span class="bar-label">{{ formatHour(data.timestamp) }}</span>
</div> </div>
</div> </div>
</div> </div>
<div class="chart-hint">
<span>流量统计功能开发中当前显示模拟数据</span>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -268,7 +336,7 @@ onMounted(() => {
/* Stats Grid */ /* Stats Grid */
.stats-grid { .stats-grid {
display: grid; display: grid;
grid-template-columns: repeat(4, 1fr); grid-template-columns: repeat(3, 1fr);
gap: 20px; gap: 20px;
margin-bottom: 32px; margin-bottom: 32px;
} }
@@ -338,6 +406,16 @@ onMounted(() => {
box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4); box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
} }
.stat-icon.total-out {
background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
box-shadow: 0 4px 16px rgba(2, 132, 199, 0.4);
}
.stat-icon.total-in {
background: linear-gradient(135deg, #c084fc 0%, #9333ea 100%);
box-shadow: 0 4px 16px rgba(147, 51, 234, 0.4);
}
.stat-icon svg { .stat-icon svg {
color: white; color: white;
} }
@@ -347,25 +425,29 @@ onMounted(() => {
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 4px; gap: 2px;
min-height: 48px;
justify-content: center;
} }
.stat-label { .stat-label {
font-size: 13px; font-size: 13px;
color: rgba(255, 255, 255, 0.6); color: rgba(255, 255, 255, 0.6);
font-weight: 500; font-weight: 500;
line-height: 1.2;
} }
.stat-value { .stat-value {
font-size: 32px; font-size: 28px;
font-weight: 700; font-weight: 700;
color: white; color: white;
line-height: 1.1; line-height: 1.2;
} }
.stat-unit { .stat-unit {
font-size: 12px; font-size: 12px;
color: rgba(255, 255, 255, 0.5); color: rgba(255, 255, 255, 0.5);
line-height: 1.2;
} }
/* Client count special styling */ /* Client count special styling */

View File

@@ -1,22 +1,31 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import { CloudDownloadOutline, RefreshOutline, ServerOutline } from '@vicons/ionicons5' import { ServerOutline, SettingsOutline, SaveOutline } from '@vicons/ionicons5'
import GlassTag from '../components/GlassTag.vue'
import { useToast } from '../composables/useToast' import { useToast } from '../composables/useToast'
import { useConfirm } from '../composables/useConfirm'
import { import {
getVersionInfo, checkServerUpdate, applyServerUpdate, getVersionInfo, getServerConfig, updateServerConfig,
type UpdateInfo, type VersionInfo type VersionInfo, type ServerConfigResponse
} from '../api' } from '../api'
const message = useToast() const message = useToast()
const dialog = useConfirm()
const versionInfo = ref<VersionInfo | null>(null) const versionInfo = ref<VersionInfo | null>(null)
const serverUpdate = ref<UpdateInfo | null>(null)
const loading = ref(true) const loading = ref(true)
const checkingServer = ref(false)
const updatingServer = ref(false) // 服务器配置
const serverConfig = ref<ServerConfigResponse | null>(null)
const configLoading = ref(false)
const savingConfig = ref(false)
// 配置表单
const configForm = ref({
bind_addr: '',
heartbeat_sec: 30,
heartbeat_timeout: 90,
web_username: '',
web_password: '',
plugin_store_url: ''
})
const loadVersionInfo = async () => { const loadVersionInfo = async () => {
try { try {
@@ -29,60 +38,60 @@ const loadVersionInfo = async () => {
} }
} }
const handleCheckServerUpdate = async () => { const loadServerConfig = async () => {
checkingServer.value = true configLoading.value = true
try { try {
const { data } = await checkServerUpdate() const { data } = await getServerConfig()
serverUpdate.value = data serverConfig.value = data
if (data.available) { // 填充表单
message.success('发现新版本: ' + data.latest) configForm.value = {
} else { bind_addr: data.server.bind_addr,
message.info('已是最新版本') heartbeat_sec: data.server.heartbeat_sec,
heartbeat_timeout: data.server.heartbeat_timeout,
web_username: data.web.username,
web_password: '',
plugin_store_url: data.plugin_store.url
} }
} catch (e: any) { } catch (e) {
message.error(e.response?.data || '检查更新失败') console.error('Failed to load server config', e)
} finally { } finally {
checkingServer.value = false configLoading.value = false
} }
} }
const handleApplyServerUpdate = () => { const handleSaveConfig = async () => {
if (!serverUpdate.value?.download_url) { savingConfig.value = true
message.error('没有可用的下载链接') try {
return const updateReq: any = {
} server: {
bind_addr: configForm.value.bind_addr,
dialog.warning({ heartbeat_sec: configForm.value.heartbeat_sec,
title: '确认更新服务端', heartbeat_timeout: configForm.value.heartbeat_timeout
content: `即将更新服务端到 ${serverUpdate.value.latest},更新后服务器将自动重启。确定要继续吗?`, },
positiveText: '更新并重启', web: {
negativeText: '取消', username: configForm.value.web_username
onPositiveClick: async () => { },
updatingServer.value = true plugin_store: {
try { url: configForm.value.plugin_store_url
await applyServerUpdate(serverUpdate.value!.download_url)
message.success('更新已开始,服务器将在几秒后重启')
setTimeout(() => {
window.location.reload()
}, 5000)
} catch (e: any) {
message.error(e.response?.data || '更新失败')
updatingServer.value = false
} }
} }
}) // 只有填写了密码才更新
} if (configForm.value.web_password) {
updateReq.web.password = configForm.value.web_password
const formatBytes = (bytes: number): string => { }
if (bytes === 0) return '0 B' await updateServerConfig(updateReq)
const k = 1024 message.success('配置已保存,部分配置需要重启服务后生效')
const sizes = ['B', 'KB', 'MB', 'GB'] configForm.value.web_password = ''
const i = Math.floor(Math.log(bytes) / Math.log(k)) } catch (e: any) {
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i] message.error(e.response?.data || '保存配置失败')
} finally {
savingConfig.value = false
}
} }
onMounted(() => { onMounted(() => {
loadVersionInfo() loadVersionInfo()
loadServerConfig()
}) })
</script> </script>
@@ -140,47 +149,97 @@ onMounted(() => {
</div> </div>
</div> </div>
<!-- Server Update Card --> <!-- Server Config Card -->
<div class="glass-card"> <div class="glass-card">
<div class="card-header"> <div class="card-header">
<h3>服务端更新</h3> <h3>服务器配置</h3>
<button class="glass-btn small" :disabled="checkingServer" @click="handleCheckServerUpdate"> <SettingsOutline class="header-icon" />
<RefreshOutline class="btn-icon" />
检查更新
</button>
</div> </div>
<div class="card-body"> <div class="card-body">
<div v-if="!serverUpdate" class="empty-state"> <div v-if="configLoading" class="loading-state">加载中...</div>
点击检查更新按钮查看是否有新版本 <div v-else-if="serverConfig" class="config-form">
<div class="form-group">
<label class="form-label">服务器地址</label>
<input
v-model="configForm.bind_addr"
type="text"
class="glass-input"
placeholder="0.0.0.0"
/>
<span class="form-hint">服务器监听地址修改后需重启生效</span>
</div>
<div class="form-row">
<div class="form-group">
<label class="form-label">心跳间隔 ()</label>
<input
v-model.number="configForm.heartbeat_sec"
type="number"
class="glass-input"
min="1"
max="300"
/>
</div>
<div class="form-group">
<label class="form-label">心跳超时 ()</label>
<input
v-model.number="configForm.heartbeat_timeout"
type="number"
class="glass-input"
min="1"
max="600"
/>
</div>
</div>
<div class="form-divider"></div>
<div class="form-row">
<div class="form-group">
<label class="form-label">Web 用户名</label>
<input
v-model="configForm.web_username"
type="text"
class="glass-input"
placeholder="admin"
/>
</div>
<div class="form-group">
<label class="form-label">Web 密码</label>
<input
v-model="configForm.web_password"
type="password"
class="glass-input"
placeholder="留空则不修改"
/>
</div>
</div>
<div class="form-divider"></div>
<div class="form-group">
<label class="form-label">插件商店地址</label>
<input
v-model="configForm.plugin_store_url"
type="text"
class="glass-input"
placeholder="https://example.com/plugins"
/>
<span class="form-hint">插件商店的 API 地址</span>
</div>
<div class="form-actions">
<button
class="glass-btn primary"
:disabled="savingConfig"
@click="handleSaveConfig"
>
<SaveOutline class="btn-icon" />
保存配置
</button>
</div>
</div> </div>
<template v-else> <div v-else class="empty-state">无法加载配置信息</div>
<div v-if="serverUpdate.available" class="update-alert success">
发现新版本 {{ serverUpdate.latest }}当前版本 {{ serverUpdate.current }}
</div>
<div v-else class="update-alert info">
当前已是最新版本 {{ serverUpdate.current }}
</div>
<div v-if="serverUpdate.download_url" class="download-info">
下载文件: {{ serverUpdate.asset_name }}
<GlassTag style="margin-left: 8px;">{{ formatBytes(serverUpdate.asset_size) }}</GlassTag>
</div>
<div v-if="serverUpdate.release_note" class="release-note">
<span class="note-label">更新日志:</span>
<pre>{{ serverUpdate.release_note }}</pre>
</div>
<button
v-if="serverUpdate.available && serverUpdate.download_url"
class="glass-btn primary"
:disabled="updatingServer"
@click="handleApplyServerUpdate"
>
<CloudDownloadOutline class="btn-icon" />
下载并更新服务端
</button>
</template>
</div> </div>
</div> </div>
</div> </div>
@@ -406,4 +465,71 @@ onMounted(() => {
width: 14px; width: 14px;
height: 14px; height: 14px;
} }
/* Config Form */
.config-form {
display: flex;
flex-direction: column;
gap: 16px;
}
.form-group {
display: flex;
flex-direction: column;
gap: 6px;
}
.form-label {
font-size: 13px;
color: rgba(255, 255, 255, 0.7);
font-weight: 500;
}
.form-hint {
font-size: 11px;
color: rgba(255, 255, 255, 0.4);
}
.form-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px;
}
@media (max-width: 500px) {
.form-row {
grid-template-columns: 1fr;
}
}
.form-divider {
height: 1px;
background: rgba(255, 255, 255, 0.1);
margin: 8px 0;
}
.form-actions {
margin-top: 8px;
}
/* Glass Input */
.glass-input {
background: rgba(255, 255, 255, 0.08);
border: 1px solid rgba(255, 255, 255, 0.15);
border-radius: 8px;
padding: 10px 14px;
color: white;
font-size: 14px;
outline: none;
transition: all 0.2s;
}
.glass-input:focus {
border-color: rgba(96, 165, 250, 0.5);
background: rgba(255, 255, 255, 0.12);
}
.glass-input::placeholder {
color: rgba(255, 255, 255, 0.3);
}
</style> </style>

View File

@@ -1,24 +1,10 @@
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
vue(), vue()
AutoImport({
imports: [
'vue',
{
'naive-ui': ['useDialog', 'useMessage', 'useNotification', 'useLoadingBar']
}
]
}),
Components({
resolvers: [NaiveUiResolver()]
})
], ],
build: { build: {
chunkSizeWarningLimit: 1500, chunkSizeWarningLimit: 1500,