mirror of
https://github.com/VaalaCat/frp-panel.git
synced 2025-09-26 19:31:18 +08:00

refactor: change client manager structure [重构:更改客户端管理器结构适配影子客户端] feat: add proxy config table and dao [添加代理配置独立数据表和DAO层] feat: new proxy config entity [新建的代理配置实体] feat: update and delete proxy config [更新和删除代理配置接口] feat: get config api and beautify proxy item [更新获取配置API并美化代理项] feat: change proxy form style [美化修改代理的表单样式] fix: client edit [修复:编辑客户端的问题] fix: shadow copy status error [修复:影子客户端复制状态错误] fix: http proxy bug [修复:HTTP代理类型的错误] fix: cannot update client [修复:无法更新客户端] feat: record trigger refetch [自动重新获取表格内的数据] fix: filter string length [修复:过滤字符串长度] fix: add client error [修复:添加客户端错误] fix: do not notify client when stopped [修复:停止时不通知客户端] fix: delete when proxy duplicate [修复:代理重复时删除] feat: add http proxy location [添加HTTP代理路由路径] chore: edit style [编辑样式美化] fix: remove expired client [修复:自动移除过期客户端] feat: proxy status [新增代理状态提示] fix: build [修复:构建] fix: refetch trigger [修复:重新获取数据的问题] fix: remove all expired client [修复:移除所有过期客户端] feat: i18n for proxy [代理页面的国际化翻译]
54 lines
1.8 KiB
Go
54 lines
1.8 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type ProxyStats struct {
|
|
*ProxyStatsEntity
|
|
}
|
|
|
|
type ProxyStatsEntity struct {
|
|
ProxyID int `json:"proxy_id" gorm:"primary_key;auto_increment"`
|
|
ServerID string `json:"server_id" gorm:"index"`
|
|
ClientID string `json:"client_id" gorm:"index"`
|
|
OriginClientID string `json:"origin_client_id" gorm:"index"`
|
|
Name string `json:"name"`
|
|
Type string `json:"type"`
|
|
UserID int `json:"user_id" gorm:"index"`
|
|
TenantID int `json:"tenant_id" gorm:"index"`
|
|
TodayTrafficIn int64 `json:"today_traffic_in"`
|
|
TodayTrafficOut int64 `json:"today_traffic_out"`
|
|
HistoryTrafficIn int64 `json:"history_traffic_in"`
|
|
HistoryTrafficOut int64 `json:"history_traffic_out"`
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
DeletedAt gorm.DeletedAt `gorm:"index"`
|
|
}
|
|
|
|
func (*ProxyStats) TableName() string {
|
|
return "proxy_stats"
|
|
}
|
|
|
|
// HistoryProxyStats 历史流量统计,不保证精准,只是为了展示。精准请使用 proxies 表中的 history_traffic_in/history_traffic_out
|
|
// 后续看看是否要改成时序类数据 https://github.com/nakabonne/tstorage
|
|
type HistoryProxyStats struct {
|
|
gorm.Model
|
|
ProxyID int `json:"proxy_id" gorm:"index"`
|
|
ServerID string `json:"server_id" gorm:"index"`
|
|
ClientID string `json:"client_id" gorm:"index"`
|
|
OriginClientID string `json:"origin_client_id" gorm:"index"`
|
|
Name string `json:"name"`
|
|
Type string `json:"type"`
|
|
UserID int `json:"user_id" gorm:"index"`
|
|
TenantID int `json:"tenant_id" gorm:"index"`
|
|
TrafficIn int64 `json:"traffic_in"`
|
|
TrafficOut int64 `json:"traffic_out"`
|
|
}
|
|
|
|
func (*HistoryProxyStats) TableName() string {
|
|
return "history_proxy_stats"
|
|
}
|