Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Node ¶
type Node struct {
ID uint `gorm:"primaryKey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Name string `gorm:"size:255;not null" json:"name"` // 节点名称,如 "香港 01"
Address string `gorm:"size:255;not null" json:"address"` // 节点对外地址 (域名/IP)
DetectedIP string `gorm:"size:64" json:"detected_ip"` // 自动检测到的心跳来源 IP
Port int `gorm:"default:443" json:"port"` // 对外端口
Secret string `gorm:"size:255;not null;uniqueIndex" json:"secret"` // 节点通信密钥
Status int `gorm:"default:0" json:"status"` // 0: 离线, 1: 在线
LastHeartbeat *time.Time `json:"last_heartbeat"` // 上次心跳时间
TrafficRate float64 `gorm:"default:1.0" json:"traffic_rate"` // 流量结算倍率
// Clash 订阅所需参数
WSEnabled bool `gorm:"default:false" json:"ws_enabled"` // 是否启用 Websocket
WSPath string `gorm:"size:255;default:'/trojan-go'" json:"ws_path"` // Websocket 路径
}
Node 代理节点模型
type User ¶
type User struct {
ID uint `gorm:"primaryKey" json:"id"` // ID 必须显式标记为 id 供前端调用
CreatedAt time.Time `json:"created_at"`
Username string `json:"username"` // 用户名/备注,方便管理区别人
Hash string `gorm:"uniqueIndex;not null;size:255" json:"hash"` // Trojan 密码的 SHA224 哈希值
Password string `json:"password"` // 明文密码(方便管理端查看和分发)
Quota int64 `gorm:"default:-1" json:"quota"` // 流量限额 (字节, -1 为无限)
Used int64 `gorm:"default:0" json:"used"` // 已用总流量
Upload int64 `gorm:"default:0" json:"upload"` // 上传
Download int64 `gorm:"default:0" json:"download"` // 下载
ExpiryTime *time.Time `json:"expiry_time"` // 过期时间
IPLimit int `gorm:"default:0" json:"ip_limit"` // IP 限制数目
Status int `gorm:"default:0" json:"status"` // 0: 正常, 1: 禁用
}
User 代理用户模型
Click to show internal directories.
Click to hide internal directories.