Files
panel/internal/http/request/toolbox_system.go
T
耗子 6f0593fbf8 feat: 升级 libtnb/validator v0.2.1,用上新校验能力
- 切片字段加 unique 防重复配置(域名/监听/IP/白名单/网卡/磁盘设备/
  NTP 服务器/应用标识/压缩路径/TLS 版本/索引/定时任务目标)
- 网站统计日期范围 End 加 after_or_equal:Start(结束不早于开始)
- 新增 tags_test.go:CheckRules 体检关键请求 + 全包 validate tag
  编译校验,坏规则名/语法错/未注册自定义规则在测试期即报错

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 23:11:28 +08:00

41 lines
1.1 KiB
Go

package request
import "time"
type ToolboxSystemDNS struct {
DNS1 string `form:"dns1" json:"dns1" validate:"required && ip"`
DNS2 string `form:"dns2" json:"dns2" validate:"required && ip"`
}
type ToolboxSystemSWAP struct {
Size int64 `form:"size" json:"size" validate:"min:0"`
}
type ToolboxSystemTimezone struct {
Timezone string `form:"timezone" json:"timezone" validate:"required"`
}
type ToolboxSystemTime struct {
Time time.Time `form:"time" json:"time" validate:"required"`
}
type ToolboxSystemHostname struct {
Hostname string `form:"hostname" json:"hostname" validate:"required && regex:\"^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$\""`
}
type ToolboxSystemHosts struct {
Hosts string `form:"hosts" json:"hosts"`
}
type ToolboxSystemPassword struct {
Password string `form:"password" json:"password" validate:"required && password"`
}
type ToolboxSystemSyncTime struct {
Server string `form:"server" json:"server"` // 可选的 NTP 服务器地址
}
type ToolboxSystemNTPServers struct {
Servers []string `form:"servers" json:"servers" validate:"required && unique"`
}