request

package
v3.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Slug    string `json:"slug" form:"slug" validate:"required|notExists:apps,slug"`
	Channel string `json:"channel" form:"channel" validate:"required"`
}

type AppSlug

type AppSlug struct {
	Slug string `json:"slug" form:"slug" validate:"required"`
}

type AppSlugs

type AppSlugs struct {
	Slugs string `json:"slugs" form:"slugs" validate:"required"`
}

type AppUpdateOrder

type AppUpdateOrder struct {
	Slugs []string `json:"slugs" form:"slugs" validate:"required"`
}

type AppUpdateShow

type AppUpdateShow struct {
	Slug string `json:"slug" form:"slug" validate:"required|exists:apps,slug"`
	Show bool   `json:"show" form:"show"`
}

type BackupCreate

type BackupCreate struct {
	Type    string `uri:"type" form:"type" validate:"required|in:website,mysql,postgres,redis,panel"`
	Target  string `json:"target" form:"target" validate:"required|regex:^[a-zA-Z0-9_-]+$"`
	Storage uint   `form:"storage" json:"storage"`
}

type BackupFile

type BackupFile struct {
	Type string `uri:"type" form:"type" validate:"required|in:website,mysql,postgres,redis,panel"`
	File string `json:"file" form:"file" validate:"required"`
}

type BackupList

type BackupList struct {
	Type string `uri:"type" form:"type" validate:"required|in:path,website,mysql,postgres,redis,panel"`
}

type BackupRestore

type BackupRestore struct {
	BackupFile
	Target string `json:"target" form:"target" validate:"required|regex:^[a-zA-Z0-9_-]+$"`
}

type BackupStorageCreate

type BackupStorageCreate struct {
	Type string                  `form:"type" json:"type" validate:"required|in:s3,sftp,webdav"`
	Name string                  `form:"name" json:"name" validate:"required"`
	Info types.BackupStorageInfo `form:"info" json:"info"`
}

type BackupStorageUpdate

type BackupStorageUpdate struct {
	ID   uint                    `form:"id" json:"id" validate:"required|exists:backup_storages,id"`
	Type string                  `form:"type" json:"type" validate:"required|in:s3,sftp,webdav"`
	Name string                  `form:"name" json:"name" validate:"required"`
	Info types.BackupStorageInfo `form:"info" json:"info"`
}

type BackupUpload

type BackupUpload struct {
	Type string                `uri:"type" form:"type"` // 校验没有必要,因为根本没经过验证器
	File *multipart.FileHeader `form:"file"`
}

type CertAccountCreate

type CertAccountCreate struct {
	CA          string `form:"ca" json:"ca" validate:"required|in:googlecn,google,letsencrypt,litessl,buypass,zerossl,sslcom"`
	Email       string `form:"email" json:"email" validate:"required"`
	Kid         string `form:"kid" json:"kid"`
	HmacEncoded string `form:"hmac_encoded" json:"hmac_encoded"`
	KeyType     string `form:"key_type" json:"key_type" validate:"required|in:P256,P384,2048,3072,4096"`
}

type CertAccountUpdate

type CertAccountUpdate struct {
	ID          uint   `form:"id" json:"id" validate:"required|exists:cert_accounts,id"`
	CA          string `form:"ca" json:"ca" validate:"required|in:googlecn,google,letsencrypt,litessl,buypass,zerossl,sslcom"`
	Email       string `form:"email" json:"email" validate:"required"`
	Kid         string `form:"kid" json:"kid"`
	HmacEncoded string `form:"hmac_encoded" json:"hmac_encoded"`
	KeyType     string `form:"key_type" json:"key_type" validate:"required|in:P256,P384,2048,3072,4096"`
}

type CertCreate

type CertCreate struct {
	Type        string   `form:"type" json:"type" validate:"required|in:P256,P384,2048,3072,4096"`
	Domains     []string `form:"domains" json:"domains" validate:"required|isSlice"`
	AutoRenewal bool     `form:"auto_renewal" json:"auto_renewal"`
	AccountID   uint     `form:"account_id" json:"account_id"`
	DNSID       uint     `form:"dns_id" json:"dns_id"`
	WebsiteID   uint     `form:"website_id" json:"website_id"`
}

func (*CertCreate) Rules

func (r *CertCreate) Rules(_ *http.Request) map[string]string

type CertDNSCreate

type CertDNSCreate struct {
	Type acme.DnsType  `form:"type" json:"type" validate:"required|in:aliyun,tencent,huawei,westcn,cloudflare,gcore,porkbun,namesilo,cloudns"`
	Name string        `form:"name" json:"name" validate:"required"`
	Data acme.DNSParam `form:"data" json:"data" validate:"required"`
}

type CertDNSUpdate

type CertDNSUpdate struct {
	ID   uint          `form:"id" json:"id" validate:"required|exists:cert_dns,id"`
	Type acme.DnsType  `form:"type" json:"type" validate:"required|in:aliyun,tencent,huawei,westcn,cloudflare,gcore,porkbun,namesilo,cloudns"`
	Name string        `form:"name" json:"name" validate:"required"`
	Data acme.DNSParam `form:"data" json:"data" validate:"required"`
}

type CertDeploy

type CertDeploy struct {
	ID        uint `form:"id" json:"id" validate:"required|exists:certs,id"`
	WebsiteID uint `form:"website_id" json:"website_id" validate:"required|exists:websites,id"`
}

type CertUpdate

type CertUpdate struct {
	ID          uint     `form:"id" json:"id" validate:"required|exists:certs,id"`
	Type        string   `form:"type" json:"type" validate:"required|in:P256,P384,2048,3072,4096,upload"`
	Domains     []string `form:"domains" json:"domains" validate:"required|isSlice"`
	Cert        string   `form:"cert" json:"cert"`
	Key         string   `form:"key" json:"key"`
	Script      string   `form:"script" json:"script"`
	AutoRenewal bool     `form:"auto_renewal" json:"auto_renewal"`
	AccountID   uint     `form:"account_id" json:"account_id"`
	DNSID       uint     `form:"dns_id" json:"dns_id"`
	WebsiteID   uint     `form:"website_id" json:"website_id"`
}

func (*CertUpdate) Rules

func (r *CertUpdate) Rules(_ *http.Request) map[string]string

type CertUpload

type CertUpload struct {
	Cert string `form:"cert" json:"cert" validate:"required"`
	Key  string `form:"key" json:"key" validate:"required"`
}

type ChunkUploadFinish

type ChunkUploadFinish struct {
	Path       string `json:"path" validate:"required|isUnixPath"`   // 目标目录
	FileName   string `json:"file_name" validate:"required"`         // 文件名
	FileHash   string `json:"file_hash" validate:"required|len:64"`  // 文件SHA256
	ChunkCount int    `json:"chunk_count" validate:"required|min:1"` // 分块总数
	Force      bool   `json:"force"`                                 // 是否覆盖已存在文件
}

ChunkUploadFinish 分块上传完成请求

type ChunkUploadStart

type ChunkUploadStart struct {
	Path       string `json:"path" validate:"required|isUnixPath"`   // 目标目录
	FileName   string `json:"file_name" validate:"required"`         // 文件名
	FileHash   string `json:"file_hash" validate:"required|len:64"`  // 文件SHA256
	ChunkCount int    `json:"chunk_count" validate:"required|min:1"` // 分块总数
	Force      bool   `json:"force"`                                 // 是否覆盖已存在文件
}

ChunkUploadStart 分块上传开始请求

type ContainerComposeCreate

type ContainerComposeCreate struct {
	Name    string     `json:"name" validate:"required|regex:^[a-zA-Z0-9_-]+$"`
	Compose string     `json:"compose" validate:"required"`
	Envs    []types.KV `json:"envs"`
}

type ContainerComposeDown

type ContainerComposeDown struct {
	Name string `uri:"name" validate:"required|regex:^[a-zA-Z0-9_-]+$"`
}

type ContainerComposeGet

type ContainerComposeGet struct {
	Name string `uri:"name" validate:"required|regex:^[a-zA-Z0-9_-]+$"`
}

type ContainerComposeRemove

type ContainerComposeRemove struct {
	Name string `uri:"name" validate:"required|regex:^[a-zA-Z0-9_-]+$"`
}

type ContainerComposeUp

type ContainerComposeUp struct {
	Name  string `uri:"name" validate:"required|regex:^[a-zA-Z0-9_-]+$"`
	Force bool   `json:"force"`
}

type ContainerComposeUpdate

type ContainerComposeUpdate struct {
	Name    string     `uri:"name" validate:"required|regex:^[a-zA-Z0-9_-]+$"`
	Compose string     `json:"compose" validate:"required"`
	Envs    []types.KV `json:"envs"`
}

type ContainerCreate

type ContainerCreate struct {
	Name            string                           `form:"name" json:"name"`
	Image           string                           `form:"image" json:"image" validate:"required"`
	Ports           []types.ContainerPort            `form:"ports" json:"ports"`
	Network         string                           `form:"network" json:"network"`
	Volumes         []types.ContainerContainerVolume `form:"volumes" json:"volumes"`
	Labels          []types.KV                       `form:"labels" json:"labels"`
	Env             []types.KV                       `form:"env" json:"env"`
	Entrypoint      []string                         `form:"entrypoint" json:"entrypoint"`
	Command         []string                         `form:"command" json:"command"`
	RestartPolicy   string                           `form:"restart_policy" json:"restart_policy"`
	AutoRemove      bool                             `form:"auto_remove" json:"auto_remove"`
	Privileged      bool                             `form:"privileged" json:"privileged"`
	OpenStdin       bool                             `form:"openStdin" json:"open_stdin"`
	PublishAllPorts bool                             `form:"publish_all_ports" json:"publish_all_ports"`
	Tty             bool                             `form:"tty" json:"tty"`
	CPUShares       int64                            `form:"cpu_shares" json:"cpu_shares"`
	CPUs            int64                            `form:"cpus" json:"cpus"`
	Memory          int64                            `form:"memory" json:"memory"`
}

type ContainerID

type ContainerID struct {
	ID string `json:"id" form:"id" validate:"required"`
}

type ContainerImageID

type ContainerImageID struct {
	ID string `json:"id" form:"id"`
}

type ContainerImagePull

type ContainerImagePull struct {
	Name     string `form:"name" json:"name" validate:"required"`
	Auth     bool   `form:"auth" json:"auth"`
	Username string `form:"username" json:"username" validate:"requiredIf:Auth,true"`
	Password string `form:"password" json:"password" validate:"requiredIf:Auth,true"`
}

type ContainerNetworkCreate

type ContainerNetworkCreate struct {
	Name    string                          `form:"name" json:"name" validate:"required|regex:^[a-zA-Z0-9_-]+$"`
	Driver  string                          `form:"driver" json:"driver" validate:"required|in:bridge,host,overlay,macvlan,ipvlan,none"`
	Ipv4    types.ContainerContainerNetwork `form:"ipv4" json:"ipv4"`
	Ipv6    types.ContainerContainerNetwork `form:"ipv6" json:"ipv6"`
	Labels  []types.KV                      `form:"labels" json:"labels"`
	Options []types.KV                      `form:"options" json:"options"`
}

type ContainerNetworkID

type ContainerNetworkID struct {
	ID string `json:"id" form:"id" validate:"required"`
}

type ContainerRename

type ContainerRename struct {
	ID   string `form:"id" json:"id" validate:"required"`
	Name string `form:"name" json:"name" validate:"required|regex:^[a-zA-Z0-9_-]+$"`
}

type ContainerVolumeCreate

type ContainerVolumeCreate struct {
	Name    string     `form:"name" json:"name" validate:"required|regex:^[a-zA-Z0-9_-]+$"`
	Driver  string     `form:"driver" json:"driver" validate:"required|in:local"`
	Labels  []types.KV `form:"labels" json:"labels"`
	Options []types.KV `form:"options" json:"options"`
}

type ContainerVolumeID

type ContainerVolumeID struct {
	ID string `json:"id" form:"id" validate:"required"`
}

type CronCreate

type CronCreate struct {
	Name     string            `form:"name" json:"name" validate:"required|notExists:crons,name"`
	Type     string            `form:"type" json:"type" validate:"required"`
	Time     string            `form:"time" json:"time" validate:"required|cron"`
	Script   string            `form:"script" json:"script"`
	SubType  string            `form:"sub_type" json:"sub_type" validate:"requiredIf:Type,backup,cutoff"`
	Flock    bool              `form:"flock" json:"flock"`
	Storage  uint              `form:"storage" json:"storage"`
	Targets  []string          `form:"targets" json:"targets" validate:"requiredIf:Type,backup,cutoff"`
	Keep     uint              `form:"keep" json:"keep" validate:"required"`
	URL      string            `form:"url" json:"url"`
	Method   string            `form:"method" json:"method"`
	Headers  map[string]string `form:"headers" json:"headers"`
	Body     string            `form:"body" json:"body"`
	Timeout  uint              `form:"timeout" json:"timeout"`
	Insecure bool              `form:"insecure" json:"insecure"`
	Retries  uint              `form:"retries" json:"retries"`
}

type CronStatus

type CronStatus struct {
	ID     uint `form:"id" json:"id" validate:"required|exists:crons,id"`
	Status bool `form:"status" json:"status"`
}

type CronUpdate

type CronUpdate struct {
	ID       uint              `form:"id" json:"id" validate:"required|exists:crons,id"`
	Name     string            `form:"name" json:"name" validate:"required"`
	Type     string            `form:"type" json:"type" validate:"required"`
	Time     string            `form:"time" json:"time" validate:"required|cron"`
	Script   string            `form:"script" json:"script"`
	SubType  string            `form:"sub_type" json:"sub_type"`
	Flock    bool              `form:"flock" json:"flock"`
	Storage  uint              `form:"storage" json:"storage"`
	Targets  []string          `form:"targets" json:"targets"`
	Keep     uint              `form:"keep" json:"keep"`
	URL      string            `form:"url" json:"url"`
	Method   string            `form:"method" json:"method"`
	Headers  map[string]string `form:"headers" json:"headers"`
	Body     string            `form:"body" json:"body"`
	Timeout  uint              `form:"timeout" json:"timeout"`
	Insecure bool              `form:"insecure" json:"insecure"`
	Retries  uint              `form:"retries" json:"retries"`
}

type DatabaseComment

type DatabaseComment struct {
	ServerID uint   `form:"server_id" json:"server_id" validate:"required|exists:database_servers,id"`
	Name     string `form:"name" json:"name" validate:"required|regex:^[a-zA-Z0-9_-]+$"`
	Comment  string `form:"comment" json:"comment"`
}

type DatabaseCreate

type DatabaseCreate struct {
	ServerID   uint   `form:"server_id" json:"server_id" validate:"required|exists:database_servers,id"`
	Name       string `form:"name" json:"name" validate:"required|regex:^[a-zA-Z0-9_-]+$"`
	CreateUser bool   `form:"create_user" json:"create_user"`
	Username   string `form:"username" json:"username" validate:"requiredIf:CreateUser,true|not_in:root,admin|regex:^[a-zA-Z0-9_-]+$"`
	Password   string `form:"password" json:"password" validate:"requiredIf:CreateUser,true"`
	Host       string `form:"host" json:"host"`
	Comment    string `form:"comment" json:"comment"`
}

type DatabaseDelete

type DatabaseDelete struct {
	ServerID uint   `form:"server_id" json:"server_id" validate:"required|exists:database_servers,id"`
	Name     string `form:"name" json:"name" validate:"required|regex:^[a-zA-Z0-9_-]+$"`
}

type DatabaseList

type DatabaseList struct {
	Paginate
	Type string `form:"type" json:"type" query:"type"`
}

type DatabaseRedisClear

type DatabaseRedisClear struct {
	ServerID uint `form:"server_id" json:"server_id" validate:"required|exists:database_servers,id"`
	DB       int  `form:"db" json:"db"`
}

type DatabaseRedisData

type DatabaseRedisData struct {
	Paginate
	ServerID uint   `form:"server_id" json:"server_id" query:"server_id" validate:"required|exists:database_servers,id"`
	DB       int    `form:"db" json:"db" query:"db"`
	Search   string `form:"search" json:"search" query:"search"`
}

type DatabaseRedisDatabases

type DatabaseRedisDatabases struct {
	ServerID uint `form:"server_id" json:"server_id" query:"server_id" validate:"required|exists:database_servers,id"`
}

type DatabaseRedisKeyDelete

type DatabaseRedisKeyDelete struct {
	ServerID uint   `form:"server_id" json:"server_id" validate:"required|exists:database_servers,id"`
	DB       int    `form:"db" json:"db"`
	Key      string `form:"key" json:"key" validate:"required"`
}

type DatabaseRedisKeyGet

type DatabaseRedisKeyGet struct {
	ServerID uint   `form:"server_id" json:"server_id" query:"server_id" validate:"required|exists:database_servers,id"`
	DB       int    `form:"db" json:"db" query:"db"`
	Key      string `form:"key" json:"key" query:"key" validate:"required"`
}

type DatabaseRedisKeyRename

type DatabaseRedisKeyRename struct {
	ServerID uint   `form:"server_id" json:"server_id" validate:"required|exists:database_servers,id"`
	DB       int    `form:"db" json:"db"`
	OldKey   string `form:"old_key" json:"old_key" validate:"required"`
	NewKey   string `form:"new_key" json:"new_key" validate:"required"`
}

type DatabaseRedisKeySet

type DatabaseRedisKeySet struct {
	ServerID uint   `form:"server_id" json:"server_id" validate:"required|exists:database_servers,id"`
	DB       int    `form:"db" json:"db"`
	Key      string `form:"key" json:"key" validate:"required"`
	Value    string `form:"value" json:"value" validate:"required"`
	Type     string `form:"type" json:"type" validate:"required|in:string,list,set,zset,hash"`
	TTL      int64  `form:"ttl" json:"ttl"`
}

type DatabaseRedisKeyTTL

type DatabaseRedisKeyTTL struct {
	ServerID uint   `form:"server_id" json:"server_id" validate:"required|exists:database_servers,id"`
	DB       int    `form:"db" json:"db"`
	Key      string `form:"key" json:"key" validate:"required"`
	TTL      int64  `form:"ttl" json:"ttl"`
}

type DatabaseServerCreate

type DatabaseServerCreate struct {
	Name     string `form:"name" json:"name" validate:"required|notExists:database_servers,name|regex:^[a-zA-Z0-9_-]+$"`
	Type     string `form:"type" json:"type" validate:"required|in:mysql,postgresql,redis"`
	Host     string `form:"host" json:"host" validate:"required"`
	Port     uint   `form:"port" json:"port" validate:"required|min:1|max:65535"`
	Username string `form:"username" json:"username"`
	Password string `form:"password" json:"password"`
	Remark   string `form:"remark" json:"remark"`
}

type DatabaseServerUpdate

type DatabaseServerUpdate struct {
	ID       uint   `form:"id" json:"id" validate:"required|exists:database_servers,id"`
	Name     string `form:"name" json:"name" validate:"required|regex:^[a-zA-Z0-9_-]+$"`
	Host     string `form:"host" json:"host" validate:"required"`
	Port     uint   `form:"port" json:"port" validate:"required|min:1|max:65535"`
	Username string `form:"username" json:"username"`
	Password string `form:"password" json:"password"`
	Remark   string `form:"remark" json:"remark"`
}

type DatabaseServerUpdateRemark

type DatabaseServerUpdateRemark struct {
	ID     uint   `form:"id" json:"id" validate:"required|exists:database_servers,id"`
	Remark string `form:"remark" json:"remark"`
}

type DatabaseUserCreate

type DatabaseUserCreate struct {
	ServerID   uint     `form:"server_id" json:"server_id" validate:"required|exists:database_servers,id"`
	Username   string   `form:"username" json:"username" validate:"required|not_in:root,admin|regex:^[a-zA-Z0-9_-]+$"`
	Password   string   `form:"password" json:"password" validate:"required"`
	Host       string   `form:"host" json:"host"`
	Privileges []string `form:"privileges" json:"privileges"`
	Remark     string   `form:"remark" json:"remark"`
}

type DatabaseUserUpdate

type DatabaseUserUpdate struct {
	ID         uint     `form:"id" json:"id" validate:"required|exists:database_users,id"`
	Password   string   `form:"password" json:"password"`
	Privileges []string `form:"privileges" json:"privileges"`
	Remark     string   `form:"remark" json:"remark"`
}

type DatabaseUserUpdateRemark

type DatabaseUserUpdateRemark struct {
	ID     uint   `form:"id" json:"id" validate:"required|exists:database_users,id"`
	Remark string `form:"remark" json:"remark"`
}

type EnvironmentAction

type EnvironmentAction struct {
	Type string `json:"type"`
	Slug string `json:"slug"`
}

EnvironmentAction 环境操作请求

type EnvironmentMirror

type EnvironmentMirror struct {
	Slug   string `json:"slug"`
	Mirror string `form:"mirror" json:"mirror" validate:"required"`
}

EnvironmentMirror Python 镜像设置请求

type EnvironmentPHPConfigTune

type EnvironmentPHPConfigTune struct {
	Version uint `json:"version"`
	// php.ini 常规设置
	ShortOpenTag   string `form:"short_open_tag" json:"short_open_tag"`
	DateTimezone   string `form:"date_timezone" json:"date_timezone"`
	DisplayErrors  string `form:"display_errors" json:"display_errors"`
	ErrorReporting string `form:"error_reporting" json:"error_reporting"`
	// php.ini 禁用函数
	DisableFunctions string `form:"disable_functions" json:"disable_functions"`
	// php.ini 上传限制
	UploadMaxFilesize string `form:"upload_max_filesize" json:"upload_max_filesize"`
	PostMaxSize       string `form:"post_max_size" json:"post_max_size"`
	MaxFileUploads    string `form:"max_file_uploads" json:"max_file_uploads"`
	MemoryLimit       string `form:"memory_limit" json:"memory_limit"`
	// php.ini 超时限制
	MaxExecutionTime string `form:"max_execution_time" json:"max_execution_time"`
	MaxInputTime     string `form:"max_input_time" json:"max_input_time"`
	MaxInputVars     string `form:"max_input_vars" json:"max_input_vars"`
	// php.ini Session 相关
	SessionSaveHandler    string `form:"session_save_handler" json:"session_save_handler"`
	SessionSavePath       string `form:"session_save_path" json:"session_save_path"`
	SessionGcMaxlifetime  string `form:"session_gc_maxlifetime" json:"session_gc_maxlifetime"`
	SessionCookieLifetime string `form:"session_cookie_lifetime" json:"session_cookie_lifetime"`
	// php-fpm.conf 相关
	Pm                string `form:"pm" json:"pm"`
	PmMaxChildren     string `form:"pm_max_children" json:"pm_max_children"`
	PmStartServers    string `form:"pm_start_servers" json:"pm_start_servers"`
	PmMinSpareServers string `form:"pm_min_spare_servers" json:"pm_min_spare_servers"`
	PmMaxSpareServers string `form:"pm_max_spare_servers" json:"pm_max_spare_servers"`
}

EnvironmentPHPConfigTune PHP 配置调整

type EnvironmentPHPModule

type EnvironmentPHPModule struct {
	Version uint   `json:"version"`
	Slug    string `form:"slug" json:"slug" validate:"required"`
}

type EnvironmentPHPUpdateConfig

type EnvironmentPHPUpdateConfig struct {
	Version uint   `json:"version"`
	Config  string `form:"config" json:"config" validate:"required"`
}

type EnvironmentPHPVersion

type EnvironmentPHPVersion struct {
	Version uint `json:"version"`
}

type EnvironmentProxy

type EnvironmentProxy struct {
	Slug  string `json:"slug"`
	Proxy string `form:"proxy" json:"proxy" validate:"required"`
}

EnvironmentProxy Go 代理设置请求

type EnvironmentRegistry

type EnvironmentRegistry struct {
	Slug     string `json:"slug"`
	Registry string `form:"registry" json:"registry" validate:"required"`
}

EnvironmentRegistry Node.js 镜像设置请求

type EnvironmentSlug

type EnvironmentSlug struct {
	Slug string `json:"slug"`
}

EnvironmentSlug 环境版本请求(通用)

type FileCompress

type FileCompress struct {
	Dir   string   `form:"dir" json:"dir" validate:"required|isUnixPath"`
	Paths []string `form:"paths" json:"paths" validate:"required|isSlice"`
	File  string   `form:"file" json:"file" validate:"required|isUnixPath"`
}

func (*FileCompress) Rules

func (r *FileCompress) Rules(_ *http.Request) map[string]string

type FileControl

type FileControl struct {
	Source string `form:"source" json:"source" validate:"required|isUnixPath"`
	Target string `form:"target" json:"target" validate:"required|isUnixPath"`
	Force  bool   `form:"force" json:"force"`
}

type FileCreate

type FileCreate struct {
	Dir  bool   `json:"dir" form:"dir"`
	Path string `json:"path" form:"path" validate:"required|isUnixPath"`
}

type FileList

type FileList struct {
	Path    string `json:"path" form:"path" validate:"required|isUnixPath"`
	Sort    string `json:"sort" form:"sort"`
	Keyword string `form:"keyword" json:"keyword"`
	Sub     bool   `form:"sub" json:"sub"`
}

func (*FileList) Prepare

func (r *FileList) Prepare(req *http.Request) error

type FilePath

type FilePath struct {
	Path string `json:"path" form:"path" validate:"required|isUnixPath"`
}

type FilePermission

type FilePermission struct {
	Path  string `form:"path" json:"path" validate:"required|isUnixPath"`
	Mode  string `form:"mode" json:"mode" validate:"required"`
	Owner string `form:"owner" json:"owner" validate:"required"`
	Group string `form:"group" json:"group" validate:"required"`
}

type FileRemoteDownload

type FileRemoteDownload struct {
	Path string `form:"path" json:"path" validate:"required|isUnixPath"`
	URL  string `form:"url" json:"url" validate:"required|isFullURL"`
}

type FileSave

type FileSave struct {
	Path    string `form:"path" json:"path" validate:"required|isUnixPath"`
	Content string `form:"content" json:"content"`
}

type FileUnCompress

type FileUnCompress struct {
	File string `form:"file" json:"file" validate:"required|isUnixPath"`
	Path string `form:"path" json:"path" validate:"required|isUnixPath"`
}

type FirewallForward

type FirewallForward struct {
	Protocol   string `json:"protocol" validate:"required|in:tcp,udp,tcp/udp"`
	Port       uint   `json:"port" validate:"required|min:1|max:65535"`
	TargetIP   string `json:"target_ip" validate:"required"`
	TargetPort uint   `json:"target_port" validate:"required|min:1|max:65535"`
}

type FirewallIPRule

type FirewallIPRule struct {
	Family    string `json:"family" validate:"required|in:ipv4,ipv6"`
	Protocol  string `json:"protocol" validate:"required|in:tcp,udp,tcp/udp"`
	Address   string `json:"address"`
	Strategy  string `json:"strategy" validate:"required|in:accept,drop,reject"`
	Direction string `json:"direction" validate:"required|in:in,out"`
}

type FirewallRule

type FirewallRule struct {
	Type      string `json:"type"`
	Family    string `json:"family" validate:"required|in:ipv4,ipv6"`
	PortStart uint   `json:"port_start" validate:"required|min:1|max:65535"`
	PortEnd   uint   `json:"port_end" validate:"required|min:1|max:65535"`
	Protocol  string `json:"protocol" validate:"required|in:tcp,udp,tcp/udp"`
	Address   string `json:"address"`
	Strategy  string `json:"strategy" validate:"required|in:accept,drop,reject"`
	Direction string `json:"direction" validate:"required|in:in,out"`
}

type FirewallScanSetting

type FirewallScanSetting struct {
	Enabled    bool     `json:"enabled"`
	Days       uint     `json:"days" validate:"min:1|max:365"`
	Interfaces []string `json:"interfaces"`
}

FirewallScanSetting 扫描感知设置

type FirewallStatus

type FirewallStatus struct {
	Status bool `json:"status" form:"status"`
}

type HomeCurrent

type HomeCurrent struct {
	Nets  []string `json:"nets" form:"nets"`
	Disks []string `json:"disks" form:"disks"`
}

type HomeTopProcesses

type HomeTopProcesses struct {
	Type string `json:"type" form:"type" query:"type" validate:"in:cpu,memory,disk_io"`
}

type ID

type ID struct {
	ID uint `json:"id" form:"id" query:"id" uri:"id" validate:"required|min:1"`
}

type LogDates

type LogDates struct {
	Type string `json:"type" form:"type" query:"type" validate:"required|in:app,db,http"`
}

LogDates 日志日期列表请求

type LogList

type LogList struct {
	Type  string `json:"type" form:"type" query:"type" validate:"required|in:app,db,http"`
	Limit int    `json:"limit" form:"limit" query:"limit" validate:"min:1|max:1000"`
	Date  string `json:"date" form:"date" query:"date"` // 日期,格式为 YYYY-MM-DD,空表示当天
}

LogList 日志列表请求

type MonitorList

type MonitorList struct {
	Start int64 `json:"start"`
	End   int64 `json:"end"`
}

type MonitorSetting

type MonitorSetting struct {
	Enabled bool `json:"enabled"`
	Days    uint `json:"days"`
}

type Paginate

type Paginate struct {
	Page  uint `json:"page" form:"page" query:"page" validate:"required|min:1"`
	Limit uint `json:"limit" form:"limit" query:"limit" validate:"required|min:1|max:10000"`
}

func (*Paginate) Messages

func (r *Paginate) Messages(_ *http.Request) map[string]string

func (*Paginate) Prepare

func (r *Paginate) Prepare(_ *http.Request) error

type ProcessDetail

type ProcessDetail struct {
	PID int32 `json:"pid" form:"pid" query:"pid" validate:"required"`
}

ProcessDetail 获取进程详情请求

type ProcessKill

type ProcessKill struct {
	PID int32 `json:"pid" validate:"required"`
}

ProcessKill 结束进程请求

type ProcessList

type ProcessList struct {
	Page    uint   `json:"page" form:"page" query:"page"`
	Limit   uint   `json:"limit" form:"limit" query:"limit"`
	Sort    string `json:"sort" form:"sort" query:"sort" validate:"in:pid,name,cpu,rss,start_time,ppid,num_threads"`
	Order   string `json:"order" form:"order" query:"order" validate:"in:asc,desc"`
	Status  string `json:"status" form:"status" query:"status" validate:"in:R,S,T,I,Z,W,L"`
	Keyword string `json:"keyword" form:"keyword" query:"keyword"`
}

ProcessList 进程列表请求

type ProcessSignal

type ProcessSignal struct {
	PID    int32 `json:"pid" validate:"required"`
	Signal int   `json:"signal" validate:"required|in:1,2,9,10,12,15,18,19"`
}

ProcessSignal 发送信号请求 支持的信号: SIGHUP(1), SIGINT(2), SIGKILL(9), SIGUSR1(10), SIGUSR2(12), SIGTERM(15), SIGCONT(18), SIGSTOP(19)

type ProjectCreate

type ProjectCreate struct {
	Name         string            `form:"name" json:"name" validate:"required|regex:^[a-zA-Z0-9_-]+$"`
	Type         types.ProjectType `form:"type" json:"type" validate:"required|in:general,php,java,go,python,nodejs,dotnet"`
	Description  string            `form:"description" json:"description"`
	RootDir      string            `form:"root_dir" json:"root_dir"`
	WorkingDir   string            `form:"working_dir" json:"working_dir"`
	ExecStart    string            `form:"exec_start" json:"exec_start"`
	User         string            `form:"user" json:"user"`
	Restart      string            `json:"restart"`
	Environments []types.KV
}

type ProjectUpdate

type ProjectUpdate struct {
	ID              uint       `form:"id" json:"id" validate:"required|exists:projects,id"`
	Name            string     `form:"name" json:"name" validate:"required|regex:^[a-zA-Z0-9_-]+$"`
	Description     string     `form:"description" json:"description"`
	RootDir         string     `form:"root_dir" json:"root_dir" validate:"required"`
	WorkingDir      string     `form:"working_dir" json:"working_dir"`
	ExecStartPre    string     `form:"exec_start_pre" json:"exec_start_pre"`
	ExecStartPost   string     `form:"exec_start_post" json:"exec_start_post"`
	ExecStart       string     `form:"exec_start" json:"exec_start"`
	ExecStop        string     `form:"exec_stop" json:"exec_stop"`
	ExecReload      string     `form:"exec_reload" json:"exec_reload"`
	User            string     `form:"user" json:"user"`
	Restart         string     `json:"restart"`
	RestartSec      string     `json:"restart_sec"`
	RestartMax      int        `json:"restart_max"`
	TimeoutStartSec int        `json:"timeout_start_sec"`
	TimeoutStopSec  int        `json:"timeout_stop_sec"`
	Environments    []types.KV `form:"environments" json:"environments"`
	StandardOutput  string     `form:"standard_output" json:"standard_output"`
	StandardError   string     `form:"standard_error" json:"standard_error"`
	Requires        []string   `form:"requires" json:"requires"`
	Wants           []string   `form:"wants" json:"wants"`
	After           []string   `form:"after" json:"after"`
	Before          []string   `form:"before" json:"before"`

	MemoryLimit float64 `form:"memory_limit" json:"memory_limit"`
	CPUQuota    string  `form:"cpu_quota" json:"cpu_quota"`

	NoNewPrivileges bool     `form:"no_new_privileges" json:"no_new_privileges"`
	ProtectTmp      bool     `form:"protect_tmp" json:"protect_tmp"`
	ProtectHome     bool     `form:"protect_home" json:"protect_home"`
	ProtectSystem   string   `form:"protect_system" json:"protect_system"`
	ReadWritePaths  []string `form:"read_write_paths" json:"read_write_paths"`
	ReadOnlyPaths   []string `form:"read_only_paths" json:"read_only_paths"`
}

type SSHCreate

type SSHCreate struct {
	Name       string `json:"name" form:"name"`
	Host       string `json:"host" form:"host" validate:"required"`
	Port       uint   `json:"port" form:"port" validate:"required|min:1|max:65535"`
	AuthMethod string `json:"auth_method" form:"auth_method" validate:"required|in:password,publickey"`
	User       string `json:"user" form:"user" validate:"required"`
	Password   string `json:"password" form:"password" validate:"requiredIf:AuthMethod,password"`
	Key        string `json:"key" form:"key" validate:"requiredIf:AuthMethod,publickey"`
	Passphrase string `json:"passphrase" form:"passphrase"`
	Remark     string `json:"remark" form:"remark"`
}

type SSHUpdate

type SSHUpdate struct {
	ID         uint   `form:"id" json:"id" validate:"required|exists:sshes,id"`
	Name       string `json:"name" form:"name"`
	Host       string `json:"host" form:"host" validate:"required"`
	Port       uint   `json:"port" form:"port" validate:"required|min:1|max:65535"`
	AuthMethod string `json:"auth_method" form:"auth_method" validate:"required|in:password,publickey"`
	User       string `json:"user" form:"user" validate:"required"`
	Password   string `json:"password" form:"password" validate:"requiredIf:AuthMethod,password"`
	Key        string `json:"key" form:"key" validate:"requiredIf:AuthMethod,publickey"`
	Passphrase string `json:"passphrase" form:"passphrase"`
	Remark     string `json:"remark" form:"remark"`
}

type SafeUpdatePingStatus

type SafeUpdatePingStatus struct {
	Status bool `json:"status" form:"status"`
}

type SafeUpdateSSH

type SafeUpdateSSH struct {
	Port   uint `json:"port" form:"port"  validate:"required|min:1|max:65535"`
	Status bool `json:"status" form:"status"`
}

type SettingCert

type SettingCert struct {
	Cert string `json:"cert" validate:"required"`
	Key  string `json:"key" validate:"required"`
}

type SettingMemo

type SettingMemo struct {
	Content string `json:"content"`
}

type SettingPanel

type SettingPanel struct {
	Name          string   `json:"name" validate:"required"`
	Channel       string   `json:"channel" validate:"required|in:stable,beta"`
	Locale        string   `json:"locale" validate:"required"`
	Entrance      string   `json:"entrance" validate:"required"`
	EntranceError string   `json:"entrance_error" validate:"in:418,nginx,close"` // 安全入口错误页伪装类型
	LoginCaptcha  bool     `json:"login_captcha"`                                // 登录验证码
	OfflineMode   bool     `json:"offline_mode"`
	AutoUpdate    bool     `json:"auto_update"`
	TwoFA         bool     `json:"two_fa"`
	Lifetime      uint     `json:"lifetime" validate:"required|min:10|max:43200"` // 登录超时,单位:分
	IPHeader      string   `json:"ip_header"`
	BindDomain    []string `json:"bind_domain"`
	BindIP        []string `json:"bind_ip"`
	BindUA        []string `json:"bind_ua"`
	WebsitePath   string   `json:"website_path" validate:"required"`
	BackupPath    string   `json:"backup_path" validate:"required"`
	ProjectPath   string   `json:"project_path" validate:"required"`
	ContainerSock string   `json:"container_sock"`
	HiddenMenu    []string `json:"hidden_menu"`                      // 隐藏的菜单项
	IPDBType      string   `json:"ipdb_type"`                        // IPDB 来源类型: "" / "custom" / "subscribe"
	IPDBURL       string   `json:"ipdb_url"`                         // IPDB 订阅链接
	IPDBPath      string   `json:"ipdb_path"`                        // IPDB 地理位置库路径
	Port          uint     `json:"port" validate:"required|min:1|max:65535"`
	HTTPS         bool     `json:"https"`
	ACME          bool     `json:"acme"`
	PublicIP      []string `json:"public_ip"`
	Cert          string   `json:"cert" validate:"required"`
	Key           string   `json:"key" validate:"required"`
}

func (*SettingPanel) Rules

func (r *SettingPanel) Rules(_ *http.Request) map[string]string

type SystemctlService

type SystemctlService struct {
	Service string `json:"service" validate:"required"`
}

type TemplateCreate

type TemplateCreate struct {
	Slug         string     `json:"slug" validate:"required"`
	Name         string     `json:"name" validate:"required|regex:^[a-zA-Z0-9_-]+$"`
	Compose      string     `json:"compose"`
	Envs         []types.KV `json:"envs"`
	AutoFirewall bool       `json:"auto_firewall"`
}

type TemplateSlug

type TemplateSlug struct {
	Slug string `uri:"slug" validate:"required"`
}

type ToolboxBenchmarkTest

type ToolboxBenchmarkTest struct {
	Name string `json:"name" validate:"required|in:image,machine,compile,encryption,compression,physics,json,memory,disk"`
}

type ToolboxDiskDevice

type ToolboxDiskDevice struct {
	Device string `form:"device" json:"device" validate:"required"`
}

ToolboxDiskDevice 磁盘设备请求

type ToolboxDiskExtendLV

type ToolboxDiskExtendLV struct {
	Path   string `form:"path" json:"path" validate:"required|isUnixPath"`
	Size   int    `form:"size" json:"size" validate:"required|min:1"`
	Resize bool   `form:"resize" json:"resize"`
}

ToolboxDiskExtendLV 扩容逻辑卷请求

type ToolboxDiskFormat

type ToolboxDiskFormat struct {
	Device string `form:"device" json:"device" validate:"required"`
	FsType string `form:"fs_type" json:"fs_type" validate:"required|in:ext4,ext3,xfs,btrfs"`
}

ToolboxDiskFormat 格式化请求

type ToolboxDiskFstabDelete

type ToolboxDiskFstabDelete struct {
	MountPoint string `form:"mount_point" json:"mount_point" validate:"required"`
}

ToolboxDiskFstabDelete 删除 fstab 条目请求

type ToolboxDiskFstabEntry

type ToolboxDiskFstabEntry struct {
	Device     string `json:"device"`      // 设备(UUID=xxx 或 /dev/xxx)
	MountPoint string `json:"mount_point"` // 挂载点
	FsType     string `json:"fs_type"`     // 文件系统类型
	Options    string `json:"options"`     // 挂载选项
	Dump       string `json:"dump"`        // 备份标志
	Pass       string `json:"pass"`        // 检查顺序
}

ToolboxDiskFstabEntry fstab 条目结构

type ToolboxDiskInit

type ToolboxDiskInit struct {
	Device string `form:"device" json:"device" validate:"required"`
	FsType string `form:"fs_type" json:"fs_type" validate:"required|in:ext4,ext3,xfs,btrfs"`
}

ToolboxDiskInit 初始化磁盘请求

type ToolboxDiskLV

type ToolboxDiskLV struct {
	Name   string `form:"name" json:"name" validate:"required"`
	VGName string `form:"vg_name" json:"vg_name" validate:"required"`
	Size   int    `form:"size" json:"size" validate:"required|min:1"`
}

ToolboxDiskLV 逻辑卷请求

type ToolboxDiskLVPath

type ToolboxDiskLVPath struct {
	Path string `form:"path" json:"path" validate:"required|isUnixPath"`
}

ToolboxDiskLVPath 逻辑卷路径请求

type ToolboxDiskMount

type ToolboxDiskMount struct {
	Device      string `form:"device" json:"device" validate:"required"`
	Path        string `form:"path" json:"path" validate:"required|isUnixPath"`
	WriteFstab  bool   `form:"write_fstab" json:"write_fstab"`
	MountOption string `form:"mount_option" json:"mount_option"`
}

ToolboxDiskMount 挂载请求

type ToolboxDiskUmount

type ToolboxDiskUmount struct {
	Path string `form:"path" json:"path" validate:"required|isUnixPath"`
}

ToolboxDiskUmount 卸载请求

type ToolboxDiskVG

type ToolboxDiskVG struct {
	Name    string   `form:"name" json:"name" validate:"required"`
	Devices []string `form:"devices" json:"devices" validate:"required"`
}

ToolboxDiskVG 卷组请求

type ToolboxDiskVGName

type ToolboxDiskVGName struct {
	Name string `form:"name" json:"name" validate:"required"`
}

ToolboxDiskVGName 卷组名称请求

type ToolboxLogClean

type ToolboxLogClean struct {
	Type string `form:"type" json:"type" validate:"required|in:panel,website,mysql,docker,system"`
}

ToolboxLogClean 日志清理请求

type ToolboxMigrationConnection

type ToolboxMigrationConnection struct {
	URL     string `json:"url" validate:"required"`
	TokenID uint   `json:"token_id" validate:"required"`
	Token   string `json:"token" validate:"required"`
}

ToolboxMigrationConnection 迁移连接信息

type ToolboxMigrationDatabase

type ToolboxMigrationDatabase struct {
	Type     string `json:"type"` // mysql / postgresql
	Name     string `json:"name"`
	ServerID uint   `json:"server_id"`
	Server   string `json:"server"` // 服务器名称
}

ToolboxMigrationDatabase 迁移数据库项

type ToolboxMigrationDatabaseUser

type ToolboxMigrationDatabaseUser struct {
	ID       uint   `json:"id"`
	Username string `json:"username"`
	Password string `json:"password"`
	Host     string `json:"host"` // 仅 mysql
	ServerID uint   `json:"server_id"`
	Server   string `json:"server"` // 服务器名称
	Type     string `json:"type"`   // mysql / postgresql
}

ToolboxMigrationDatabaseUser 迁移数据库用户项

type ToolboxMigrationExec

type ToolboxMigrationExec struct {
	Command string `json:"command" validate:"required"`
}

ToolboxMigrationExec 远程执行命令请求

type ToolboxMigrationItems

type ToolboxMigrationItems struct {
	Websites      []ToolboxMigrationWebsite      `json:"websites"`
	Databases     []ToolboxMigrationDatabase     `json:"databases"`
	DatabaseUsers []ToolboxMigrationDatabaseUser `json:"database_users"`
	Projects      []ToolboxMigrationProject      `json:"projects"`
	StopOnMig     bool                           `json:"stop_on_mig"` // 迁移中是否停止服务
}

ToolboxMigrationItems 迁移选择项

type ToolboxMigrationProject

type ToolboxMigrationProject struct {
	ID   uint   `json:"id"`
	Name string `json:"name"`
	Path string `json:"path"` // 项目目录
}

ToolboxMigrationProject 迁移项目项

type ToolboxMigrationWebsite

type ToolboxMigrationWebsite struct {
	ID   uint   `json:"id"`
	Name string `json:"name"`
	Path string `json:"path"` // 网站目录
}

ToolboxMigrationWebsite 迁移网站项

type ToolboxNetworkList

type ToolboxNetworkList struct {
	Page    uint   `json:"page" form:"page" query:"page"`
	Limit   uint   `json:"limit" form:"limit" query:"limit"`
	Sort    string `json:"sort" form:"sort" query:"sort" validate:"in:type,pid,process"`
	Order   string `json:"order" form:"order" query:"order" validate:"in:asc,desc"`
	State   string `json:"state" form:"state" query:"state"`       // 逗号分隔多选: LISTEN,ESTABLISHED
	PID     string `json:"pid" form:"pid" query:"pid"`             // PID 搜索
	Process string `json:"process" form:"process" query:"process"` // 进程名称搜索
	Port    string `json:"port" form:"port" query:"port"`          // 端口搜索
}

ToolboxNetworkList 网络连接列表请求

type ToolboxSSHPasswordAuth

type ToolboxSSHPasswordAuth struct {
	Enabled bool `form:"enabled" json:"enabled"`
}

ToolboxSSHPasswordAuth SSH 密码认证设置

type ToolboxSSHPort

type ToolboxSSHPort struct {
	Port uint `form:"port" json:"port" validate:"required|min:1|max:65535"`
}

ToolboxSSHPort SSH 端口设置

type ToolboxSSHPubKeyAuth

type ToolboxSSHPubKeyAuth struct {
	Enabled bool `form:"enabled" json:"enabled"`
}

ToolboxSSHPubKeyAuth SSH 密钥认证设置

type ToolboxSSHRootLogin

type ToolboxSSHRootLogin struct {
	Mode string `form:"mode" json:"mode" validate:"required|in:yes,no,prohibit-password,forced-commands-only"`
}

ToolboxSSHRootLogin Root 登录设置

type ToolboxSSHRootPassword

type ToolboxSSHRootPassword struct {
	Password string `form:"password" json:"password" validate:"required|password"`
}

ToolboxSSHRootPassword Root 密码设置

type ToolboxSystemDNS

type ToolboxSystemDNS struct {
	DNS1 string `form:"dns1" json:"dns1" validate:"required"`
	DNS2 string `form:"dns2" json:"dns2" validate:"required"`
}

type ToolboxSystemHostname

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

type ToolboxSystemHosts struct {
	Hosts string `form:"hosts" json:"hosts"`
}

type ToolboxSystemNTPServers

type ToolboxSystemNTPServers struct {
	Servers []string `form:"servers" json:"servers" validate:"required"`
}

type ToolboxSystemPassword

type ToolboxSystemPassword struct {
	Password string `form:"password" json:"password" validate:"required|password"`
}

type ToolboxSystemSWAP

type ToolboxSystemSWAP struct {
	Size int64 `form:"size" json:"size" validate:"min:0"`
}

type ToolboxSystemSyncTime

type ToolboxSystemSyncTime struct {
	Server string `form:"server" json:"server"` // 可选的 NTP 服务器地址
}

type ToolboxSystemTime

type ToolboxSystemTime struct {
	Time time.Time `form:"time" json:"time" validate:"required"`
}

type ToolboxSystemTimezone

type ToolboxSystemTimezone struct {
	Timezone string `form:"timezone" json:"timezone" validate:"required"`
}

type UserCreate

type UserCreate struct {
	Username string `json:"username" validate:"required|notExists:users,username|regex:^[a-zA-Z0-9_-]+$"`
	Password string `json:"password" validate:"required|password"`
	Email    string `json:"email" validate:"required|email"`
}

type UserID

type UserID struct {
	ID uint `json:"id" validate:"required|exists:users,id"`
}

type UserIsTwoFA

type UserIsTwoFA struct {
	Username string `query:"username" validate:"required"`
}

type UserLogin

type UserLogin struct {
	Username    string `json:"username" validate:"required"` // encrypted with RSA-OAEP
	Password    string `json:"password" validate:"required"` // encrypted with RSA-OAEP
	SafeLogin   bool   `json:"safe_login"`
	PassCode    string `json:"pass_code"`    // 2FA
	CaptchaCode string `json:"captcha_code"` // 验证码
}

type UserTokenCreate

type UserTokenCreate struct {
	UserID    uint     `json:"user_id" validate:"required|exists:users,id"`
	IPs       []string `json:"ips"`
	ExpiredAt int64    `json:"expired_at" validate:"required"`
}

func (*UserTokenCreate) Rules

func (r *UserTokenCreate) Rules(_ *http.Request) map[string]string

type UserTokenList

type UserTokenList struct {
	UserID uint `query:"user_id"`
	Paginate
}

type UserTokenUpdate

type UserTokenUpdate struct {
	ID        uint     `uri:"id"`
	IPs       []string `json:"ips"`
	ExpiredAt int64    `json:"expired_at" validate:"required"`
}

func (*UserTokenUpdate) Rules

func (r *UserTokenUpdate) Rules(_ *http.Request) map[string]string

type UserUpdateEmail

type UserUpdateEmail struct {
	ID    uint   `json:"id" validate:"required|exists:users,id"`
	Email string `json:"email" validate:"required|email"`
}

type UserUpdatePassword

type UserUpdatePassword struct {
	ID       uint   `json:"id" validate:"required|exists:users,id"`
	Password string `json:"password" validate:"required|password"`
}

type UserUpdateTwoFA

type UserUpdateTwoFA struct {
	ID     uint   `uri:"id" validate:"required|exists:users,id"`
	Secret string `json:"secret"`
	Code   string `json:"code"`
}

type UserUpdateUsername

type UserUpdateUsername struct {
	ID       uint   `json:"id" validate:"required|exists:users,id"`
	Username string `json:"username" validate:"required|notExists:users,username|regex:^[a-zA-Z0-9_-]+$"`
}

type WebHookCreate

type WebHookCreate struct {
	Name   string `json:"name" form:"name" validate:"required"`
	Script string `json:"script" form:"script" validate:"required"`
	Raw    bool   `json:"raw" form:"raw"`
	User   string `json:"user" form:"user"`
}

type WebHookKey

type WebHookKey struct {
	Key string `json:"key" form:"key" uri:"key" validate:"required"`
}

type WebHookUpdate

type WebHookUpdate struct {
	ID     uint   `json:"id" form:"id" uri:"id" validate:"required|exists:web_hooks,id"`
	Name   string `json:"name" form:"name" validate:"required"`
	Script string `json:"script" form:"script" validate:"required"`
	Raw    bool   `json:"raw" form:"raw"`
	User   string `json:"user" form:"user" validate:"required"`
	Status bool   `json:"status" form:"status"`
}

type WebsiteCreate

type WebsiteCreate struct {
	Type       string   `json:"type" form:"type" validate:"required|in:proxy,static,php"`
	Name       string   `form:"name" json:"name" validate:"required|notExists:websites,name|not_in:phpmyadmin,default|regex:^[a-zA-Z0-9_-]+$"`
	Listens    []string `form:"listens" json:"listens" validate:"required|isSlice"`
	Domains    []string `form:"domains" json:"domains" validate:"required|isSlice"`
	Path       string   `form:"path" json:"path"`
	DB         bool     `form:"db" json:"db"`
	DBType     string   `form:"db_type" json:"db_type" validate:"requiredIf:DB,true"`
	DBName     string   `form:"db_name" json:"db_name" validate:"requiredIf:DB,true"`
	DBUser     string   `form:"db_user" json:"db_user" validate:"requiredIf:DB,true"`
	DBPassword string   `form:"db_password" json:"db_password" validate:"requiredIf:DB,true"`
	Remark     string   `form:"remark" json:"remark"`

	PHP   uint   `form:"php" json:"php" validate:"requiredIf:Type,php"`       // 仅 PHP 网站需要
	Proxy string `form:"proxy" json:"proxy" validate:"requiredIf:Type,proxy"` // 仅反向代理网站需要
}

func (*WebsiteCreate) Rules

func (r *WebsiteCreate) Rules(_ *http.Request) map[string]string

type WebsiteCustomConfig

type WebsiteCustomConfig struct {
	Name    string `json:"name" validate:"required|regex:^[a-zA-Z0-9_-]+$"` // 配置名称
	Scope   string `json:"scope" validate:"required|in:site,shared"`        // 作用域: site(此网站), shared(全局)
	Content string `json:"content"`                                         // 配置内容
}

WebsiteCustomConfig 网站自定义配置请求

type WebsiteDefaultConfig

type WebsiteDefaultConfig struct {
	Index        string   `json:"index" form:"index" validate:"required"`
	Stop         string   `json:"stop" form:"stop" validate:"required"`
	NotFound     string   `json:"not_found" form:"not_found"`
	TLSVersions  []string `json:"tls_versions" form:"tls_versions" validate:"required|isSlice"`
	CipherSuites string   `json:"cipher_suites" form:"cipher_suites" validate:"required"`
}

func (*WebsiteDefaultConfig) Rules

func (r *WebsiteDefaultConfig) Rules(_ *http.Request) map[string]string

type WebsiteDelete

type WebsiteDelete struct {
	ID   uint `form:"id" json:"id" validate:"required|exists:websites,id"`
	Path bool `form:"path" json:"path"`
	DB   bool `form:"db" json:"db"`
}

type WebsiteList

type WebsiteList struct {
	Type string `json:"type" form:"type" validate:"required|in:all,proxy,static,php"`
	Paginate
}

type WebsiteStatDateRange

type WebsiteStatDateRange struct {
	Start string `json:"start" form:"start" query:"start"`
	End   string `json:"end" form:"end" query:"end"`
	Sites string `json:"sites" form:"sites" query:"sites"`
}

WebsiteStatDateRange 统计日期范围查询参数

func (*WebsiteStatDateRange) Prepare

func (r *WebsiteStatDateRange) Prepare(_ *http.Request) error

func (*WebsiteStatDateRange) SiteList

func (r *WebsiteStatDateRange) SiteList() []string

SiteList 解析逗号分隔的站点列表

type WebsiteStatErrors

type WebsiteStatErrors struct {
	WebsiteStatPaginate
	Status int `json:"status" form:"status" query:"status"`
}

WebsiteStatErrors 错误日志查询参数

type WebsiteStatGeo

type WebsiteStatGeo struct {
	WebsiteStatDateRange
	GroupBy string `json:"group_by" form:"group_by" query:"group_by"`
	Country string `json:"country" form:"country" query:"country"`
	Limit   uint   `json:"limit" form:"limit" query:"limit"`
}

WebsiteStatGeo 地理位置统计查询参数

func (*WebsiteStatGeo) Prepare

func (r *WebsiteStatGeo) Prepare(req *http.Request) error

type WebsiteStatPaginate

type WebsiteStatPaginate struct {
	WebsiteStatDateRange
	Page  uint `json:"page" form:"page" query:"page"`
	Limit uint `json:"limit" form:"limit" query:"limit"`
}

WebsiteStatPaginate 统计分页查询参数

func (*WebsiteStatPaginate) Prepare

func (r *WebsiteStatPaginate) Prepare(req *http.Request) error

type WebsiteStatSetting

type WebsiteStatSetting struct {
	Days          uint `json:"days" validate:"required|min:1|max:365"`
	ErrBufMax     int  `json:"err_buf_max" validate:"min:0|max:1000000"`
	UVMaxKeys     int  `json:"uv_max_keys" validate:"min:0|max:100000000"`
	IPMaxKeys     int  `json:"ip_max_keys" validate:"min:0|max:100000000"`
	DetailMaxKeys int  `json:"detail_max_keys" validate:"min:0|max:100000000"`
	BodyEnabled   bool `json:"body_enabled"`
}

WebsiteStatSetting 网站统计设置

type WebsiteStatSlowURIs

type WebsiteStatSlowURIs struct {
	WebsiteStatPaginate
	Threshold uint `json:"threshold" form:"threshold" query:"threshold"`
}

WebsiteStatSlowURIs 慢请求统计查询参数

type WebsiteUpdate

type WebsiteUpdate struct {
	ID      uint           `form:"id" json:"id" validate:"required|exists:websites,id"`
	Listens []types.Listen `form:"listens" json:"listens" validate:"required|isSlice"`
	Domains []string       `form:"domains" json:"domains" validate:"required|isSlice"`
	Path    string         `form:"path" json:"path" validate:"required"` // 网站目录
	Root    string         `form:"root" json:"root" validate:"required"` // 运行目录
	Index   []string       `form:"index" json:"index" validate:"required|isSlice"`

	// SSL 相关
	SSL          bool     `form:"ssl" json:"ssl"`
	SSLCert      string   `json:"ssl_cert"`
	SSLKey       string   `json:"ssl_key"`
	HSTS         bool     `form:"hsts" json:"hsts"`
	OCSP         bool     `form:"ocsp" json:"ocsp"`
	HTTPRedirect bool     `form:"http_redirect" json:"http_redirect"`
	SSLProtocols []string `json:"ssl_protocols"`
	SSLCiphers   string   `json:"ssl_ciphers"`

	// PHP 相关
	PHP         uint   `form:"php" json:"php"`
	Rewrite     string `form:"rewrite" json:"rewrite"`
	OpenBasedir bool   `form:"open_basedir" json:"open_basedir"`

	// 反向代理
	Upstreams []types.Upstream `json:"upstreams"`
	Proxies   []types.Proxy    `json:"proxies"`

	// 重定向
	Redirects []types.Redirect `json:"redirects"`

	// 高级设置
	StatEnabled bool              `json:"stat_enabled"` // 是否启用访问统计
	AccessLog   string            `json:"access_log"`   // 访问日志路径
	ErrorLog    string            `json:"error_log"`    // 错误日志路径
	RateLimit   *types.RateLimit  `json:"rate_limit"`   // 限流限速配置
	RealIP      *types.RealIP     `json:"real_ip"`      // 真实 IP 配置
	BasicAuth   map[string]string `json:"basic_auth"`   // 基本认证配置

	// 自定义配置
	CustomConfigs []WebsiteCustomConfig `json:"custom_configs"`
}

func (*WebsiteUpdate) Rules

func (r *WebsiteUpdate) Rules(_ *http.Request) map[string]string

type WebsiteUpdateCert

type WebsiteUpdateCert struct {
	Name string `json:"name" validate:"required|exists:websites,name|regex:^[a-zA-Z0-9_-]+$"`
	Cert string `json:"cert" validate:"required"`
	Key  string `json:"key" validate:"required"`
}

type WebsiteUpdateRemark

type WebsiteUpdateRemark struct {
	ID     uint   `form:"id" json:"id" validate:"required|exists:websites,id"`
	Remark string `form:"remark" json:"remark"`
}

type WebsiteUpdateStatus

type WebsiteUpdateStatus struct {
	ID     uint `json:"id" form:"id" validate:"required|exists:websites,id"`
	Status bool `json:"status" form:"status"`
}

type WithAuthorize

type WithAuthorize interface {
	Authorize(r *http.Request) error
}

type WithFilters

type WithFilters interface {
	Filters(r *http.Request) map[string]string
}

type WithMessages

type WithMessages interface {
	Messages(r *http.Request) map[string]string
}

type WithPrepare

type WithPrepare interface {
	Prepare(r *http.Request) error
}

type WithRules

type WithRules interface {
	Rules(r *http.Request) map[string]string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL