Files
speedtest/internal/db/models.go
T

18 lines
1.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package db
import "time"
// SpeedTestResult 一次完整的测速结果记录
type SpeedTestResult struct {
ID uint `gorm:"primaryKey" json:"id"`
ClientIP string `gorm:"size:64;index" json:"client_ip"` // 客户端 IP(仅后台保存,不对外展示)
ServerIP string `gorm:"size:64" json:"server_ip"` // 服务器看到的来源 IP(NAT 调试用,仅后台保存)
Location string `gorm:"size:64" json:"location"` // 地区(ip2region 离线解析)
UserAgent string `gorm:"size:256" json:"user_agent"` // 浏览器 UA(仅后台保存)
LatencyMs float64 `json:"latency_ms"` // 延迟(毫秒,取中位数)
JitterMs float64 `json:"jitter_ms"` // 抖动(毫秒,平均绝对偏差)
DownloadMbps float64 `json:"download_mbps"` // 下载速度(Mbps
UploadMbps float64 `json:"upload_mbps"` // 上传速度(Mbps
CreatedAt time.Time `gorm:"index" json:"created_at"`
}