types

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: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KVToMap

func KVToMap(kvs []KV) map[string]string

KVToMap 将 key-value 切片转换为 map

func KVToSlice

func KVToSlice(kvs []KV) []string

KVToSlice 将 key-value 切片转换为 key=value 切片

Types

type App

type App interface {
	Route(r chi.Router)
}

App 应用接口

type AppDetail

type AppDetail struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Categories  []string `json:"categories"`
	Slug        string   `json:"slug"`
	Channels    []struct {
		Slug    string `json:"slug"`
		Name    string `json:"name"`
		Panel   string `json:"panel"`
		Version string `json:"version"`
		Log     string `json:"log"`
	} `json:"channels"`
	Installed        bool   `json:"installed"`
	InstalledChannel string `json:"installed_channel"`
	InstalledVersion string `json:"installed_version"`
	UpdateExist      bool   `json:"update_exist"`
	Show             bool   `json:"show"`
}

AppDetail 应用详情

type BackupFile

type BackupFile struct {
	Name string    `json:"name"`
	Path string    `json:"path"`
	Size string    `json:"size"`
	Time time.Time `json:"time"`
}

type BackupStorageInfo

type BackupStorageInfo struct {
	// S3
	AccessKey string `json:"access_key"`                             // 访问密钥
	SecretKey string `json:"secret_key"`                             // 私钥
	Style     string `json:"style" validate:"requiredIf:Type,s3"`    // virtual-hosted, path
	Region    string `json:"region"`                                 // 地区
	Endpoint  string `json:"endpoint" validate:"requiredIf:Type,s3"` // 端点
	Scheme    string `json:"scheme" validate:"requiredIf:Type,s3"`   // http, https
	Bucket    string `json:"bucket" validate:"requiredIf:Type,s3"`   // 存储桶

	// SFTP / WebDAV
	URL        string `json:"url"`         // 网址
	Host       string `json:"host"`        // 主机
	Port       int    `json:"port"`        // 端口
	Username   string `json:"username"`    // 用户名
	Password   string `json:"password"`    // 密码
	PrivateKey string `json:"private_key"` // 私钥

	Path string `json:"path"` // 路径
}

type CPU

type CPU struct {
	Percent []string `json:"percent"`
}

type CertList

type CertList struct {
	ID          uint      `json:"id"`
	AccountID   uint      `json:"account_id"`
	WebsiteID   uint      `json:"website_id"`
	DNSID       uint      `json:"dns_id"`
	Type        string    `json:"type"`
	Domains     []string  `json:"domains"`
	AutoRenewal bool      `json:"auto_renewal"`
	NextRenewal time.Time `json:"next_renewal"`
	Cert        string    `json:"cert"`
	Key         string    `json:"key"`
	CertURL     string    `json:"cert_url"`
	Script      string    `json:"script"`
	NotBefore   time.Time `json:"not_before"`
	NotAfter    time.Time `json:"not_after"`
	Issuer      string    `json:"issuer"`
	OCSPServer  []string  `json:"ocsp_server"`
	DNSNames    []string  `json:"dns_names"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

type Container

type Container struct {
	ID        string          `json:"id"`
	Name      string          `json:"name"`
	Image     string          `json:"image"`
	ImageID   string          `json:"image_id"`
	Command   string          `json:"command"`
	State     string          `json:"state"`
	Status    string          `json:"status"`
	CreatedAt time.Time       `json:"created_at"`
	Ports     []ContainerPort `json:"ports"`
	Labels    []KV            `json:"labels"`
}

type ContainerCompose

type ContainerCompose struct {
	Name      string    `json:"name"`
	Path      string    `json:"path"`
	Status    string    `json:"status"`
	CreatedAt time.Time `json:"created_at"`
}

type ContainerComposeRaw

type ContainerComposeRaw struct {
	Name        string `json:"Name"`
	Status      string `json:"Status"`
	ConfigFiles string `json:"ConfigFiles"`
}

ContainerComposeRaw docker compose ls 命令原始输出

type ContainerContainerNetwork

type ContainerContainerNetwork struct {
	Enabled bool   `form:"enabled" json:"enabled"`
	Gateway string `form:"gateway" json:"gateway"`
	IPRange string `form:"ip_range" json:"ip_range"`
	Subnet  string `form:"subnet" json:"subnet"`
}

type ContainerContainerVolume

type ContainerContainerVolume struct {
	Host      string `form:"host" json:"host"`
	Container string `form:"container" json:"container"`
	Mode      string `form:"mode" json:"mode"`
}

type ContainerImage

type ContainerImage struct {
	ID          string    `json:"id"`
	Containers  int64     `json:"containers"`
	RepoTags    []string  `json:"repo_tags"`
	RepoDigests []string  `json:"repo_digests"`
	Size        string    `json:"size"`
	Labels      []KV      `json:"labels"`
	CreatedAt   time.Time `json:"created_at"`
}

type ContainerNetwork

type ContainerNetwork struct {
	ID         string               `json:"id"`
	Name       string               `json:"name"`
	Driver     string               `json:"driver"`
	IPv6       bool                 `json:"ipv6"`
	Internal   bool                 `json:"internal"`
	Attachable bool                 `json:"attachable"`
	Ingress    bool                 `json:"ingress"`
	Scope      string               `json:"scope"`
	CreatedAt  time.Time            `json:"created_at"`
	IPAM       ContainerNetworkIPAM `json:"ipam"`
	Options    []KV                 `json:"options"`
	Labels     []KV                 `json:"labels"`
}

type ContainerNetworkIPAM

type ContainerNetworkIPAM struct {
	Driver  string                       `json:"driver"`
	Options []KV                         `json:"options"`
	Config  []ContainerNetworkIPAMConfig `json:"config"`
}

ContainerNetworkIPAM represents IP Address Management

type ContainerNetworkIPAMConfig

type ContainerNetworkIPAMConfig struct {
	Subnet     netip.Prefix          `json:"subnet"`
	IPRange    netip.Prefix          `json:"ip_range"`
	Gateway    netip.Addr            `json:"gateway"`
	AuxAddress map[string]netip.Addr `json:"aux_address"`
}

ContainerNetworkIPAMConfig represents IPAM configurations

type ContainerPort

type ContainerPort struct {
	ContainerStart uint       `form:"container_start" json:"container_start"`
	ContainerEnd   uint       `form:"container_end" json:"container_end"`
	Host           netip.Addr `form:"host" json:"host"`
	HostStart      uint       `form:"host_start" json:"host_start"`
	HostEnd        uint       `form:"host_end" json:"host_end"`
	Protocol       string     `form:"protocol" json:"protocol"`
}

type ContainerVolume

type ContainerVolume struct {
	Name       string    `json:"name"`
	Driver     string    `json:"driver"`
	Scope      string    `json:"scope"`
	MountPoint string    `json:"mount_point"`
	CreatedAt  time.Time `json:"created_at"`
	Labels     []KV      `json:"labels"`
	Options    []KV      `json:"options"`
	RefCount   int64     `json:"ref_count"`
	Size       string    `json:"size"`
}

type CronConfig

type CronConfig struct {
	Type    string   `json:"type"`    // 子类型:backup 时为 website/mysql/postgres;cutoff 时为 website/container
	Flock   bool     `json:"flock"`   // 进程锁
	Targets []string `json:"targets"` // 目标列表
	Storage uint     `json:"storage"` // 存储 ID(0=本地)
	Keep    uint     `json:"keep"`    // 保留份数
	// URL 任务专用
	URL      string            `json:"url"`
	Method   string            `json:"method"`   // GET/POST/PUT/DELETE/PATCH/HEAD
	Headers  map[string]string `json:"headers"`  // 自定义请求头
	Body     string            `json:"body"`     // 请求体
	Timeout  uint              `json:"timeout"`  // 超时时间(秒)
	Insecure bool              `json:"insecure"` // 忽略证书校验
	Retries  uint              `json:"retries"`  // 失败重试次数
}

CronConfig 计划任务结构化配置

type CurrentInfo

type CurrentInfo struct {
	Cpus         []cpu.InfoStat         `json:"cpus"`
	Percent      float64                `json:"percent"`  // 总使用率
	Percents     []float64              `json:"percents"` // 每个核心使用率
	Load         *load.AvgStat          `json:"load"`
	Host         *host.InfoStat         `json:"host"`
	Mem          *mem.VirtualMemoryStat `json:"mem"`
	Swap         *mem.SwapMemoryStat    `json:"swap"`
	Net          []net.IOCountersStat   `json:"net"`
	DiskIO       []disk.IOCountersStat  `json:"disk_io"`
	Disk         []disk.PartitionStat   `json:"disk"`
	DiskUsage    []disk.UsageStat       `json:"disk_usage"`
	Time         time.Time              `json:"time"`
	TopProcesses TopProcesses           `json:"top_processes"`
}

CurrentInfo 监控信息

type DiskIO

type DiskIO struct {
	Name       string   `json:"name"`
	ReadBytes  []string `json:"read_bytes"`
	WriteBytes []string `json:"write_bytes"`
	ReadSpeed  []string `json:"read_speed"`
	WriteSpeed []string `json:"write_speed"`
}

DiskIO 磁盘IO数据

type EnvironmentDetail

type EnvironmentDetail struct {
	Type             string `json:"type"`
	Name             string `json:"name"`
	Description      string `json:"description"`
	Slug             string `json:"slug"`
	Version          string `json:"version"`
	InstalledVersion string `json:"installed_version"`
	Installed        bool   `json:"installed"`
	HasUpdate        bool   `json:"has_update"`
}

EnvironmentDetail 环境详情

type EnvironmentPHPModule

type EnvironmentPHPModule struct {
	Name        string `json:"name"`
	Slug        string `json:"slug"`
	Description string `json:"description"`
	Installed   bool   `json:"installed"`
}

type KV

type KV struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

func MapToKV

func MapToKV(m map[string]string) []KV

MapToKV 将 map 转换为 key-value 切片

func SliceToKV

func SliceToKV(s []string) []KV

SliceToKV 将 key=value 切片转换为 key-value 切片

type LV

type LV struct {
	Label string `json:"label"`
	Value string `json:"value"`
}

type LVInt

type LVInt struct {
	Label string `json:"label"`
	Value int    `json:"value"`
}

type Load

type Load struct {
	Load1  []float64 `json:"load1"`
	Load5  []float64 `json:"load5"`
	Load15 []float64 `json:"load15"`
}

type Mem

type Mem struct {
	Total     string   `json:"total"`
	Available []string `json:"available"`
	Used      []string `json:"used"`
}

type MigrationItemResult

type MigrationItemResult struct {
	Type      string              `json:"type"`       // website / database / project
	Name      string              `json:"name"`       // 名称
	Status    MigrationItemStatus `json:"status"`     // 状态
	Error     string              `json:"error"`      // 失败原因
	StartedAt *time.Time          `json:"started_at"` // 开始时间
	EndedAt   *time.Time          `json:"ended_at"`   // 结束时间
	Duration  float64             `json:"duration"`   // 耗时(秒)
}

MigrationItemResult 单个迁移项的结果

type MigrationItemStatus

type MigrationItemStatus string

MigrationItemStatus 迁移项状态

const (
	MigrationItemPending MigrationItemStatus = "pending"
	MigrationItemRunning MigrationItemStatus = "running"
	MigrationItemSuccess MigrationItemStatus = "success"
	MigrationItemFailed  MigrationItemStatus = "failed"
	MigrationItemSkipped MigrationItemStatus = "skipped"
)

type MigrationStep

type MigrationStep string

MigrationStep 迁移步骤

const (
	MigrationStepIdle     MigrationStep = "idle"     // 空闲
	MigrationStepConnect  MigrationStep = "connect"  // 连接信息
	MigrationStepPreCheck MigrationStep = "precheck" // 预检查
	MigrationStepSelect   MigrationStep = "select"   // 选择迁移项
	MigrationStepRunning  MigrationStep = "running"  // 迁移中
	MigrationStepDone     MigrationStep = "done"     // 迁移完成
)

type MonitorDetail

type MonitorDetail struct {
	Times        []string       `json:"times"`
	Load         Load           `json:"load"`
	CPU          CPU            `json:"cpu"`
	Mem          Mem            `json:"mem"`
	SWAP         SWAP           `json:"swap"`
	Net          []Network      `json:"net"`
	DiskIO       []DiskIO       `json:"disk_io"`
	TopProcesses []TopProcesses `json:"top_processes"`
}

type NV

type NV struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type Network

type Network struct {
	Name string   `json:"name"`
	Sent []string `json:"sent"`
	Recv []string `json:"recv"`
	Tx   []string `json:"tx"`
	Rx   []string `json:"rx"`
}

Network 网卡数据

type ProcessData

type ProcessData struct {
	PID        int32   `json:"pid"`
	Name       string  `json:"name"`
	PPID       int32   `json:"ppid"`
	Username   string  `json:"username"`
	Status     string  `json:"status"`
	Background bool    `json:"background"`
	StartTime  string  `json:"start_time"`
	NumThreads int32   `json:"num_threads"`
	CPU        float64 `json:"cpu"`

	DiskRead  uint64 `json:"disk_read"`
	DiskWrite uint64 `json:"disk_write"`

	CmdLine string `json:"cmd_line"`
	Exe     string `json:"exe"` // 可执行文件路径
	Cwd     string `json:"cwd"` // 工作目录

	RSS    uint64 `json:"rss"`
	VMS    uint64 `json:"vms"`
	HWM    uint64 `json:"hwm"`
	Data   uint64 `json:"data"`
	Stack  uint64 `json:"stack"`
	Locked uint64 `json:"locked"`
	Swap   uint64 `json:"swap"`

	Envs []string `json:"envs"`

	OpenFiles   []process.OpenFilesStat `json:"open_files"`
	Connections []net.ConnectionStat    `json:"connections"`
}

type ProcessStat

type ProcessStat struct {
	PID      int32   `json:"pid"`
	Name     string  `json:"name"`
	Username string  `json:"username"`
	Command  string  `json:"command"`
	Value    float64 `json:"value"`           // 主指标值:CPU%、内存MB、IO字节
	Read     float64 `json:"read,omitempty"`  // 仅磁盘IO:读取字节
	Write    float64 `json:"write,omitempty"` // 仅磁盘IO:写入字节
}

ProcessStat 进程统计快照

type ProjectDetail

type ProjectDetail struct {
	ID              uint        `json:"id"`                // 项目 ID
	Name            string      `json:"name"`              // 项目名称
	Type            ProjectType `json:"type"`              // 项目类型
	Description     string      `json:"description"`       // 项目描述
	RootDir         string      `json:"root_dir"`          // 项目路径
	WorkingDir      string      `json:"working_dir"`       // 运行目录
	ExecStartPre    string      `json:"exec_start_pre"`    // 启动前命令
	ExecStartPost   string      `json:"exec_start_post"`   // 启动后命令
	ExecStart       string      `json:"exec_start"`        // 启动命令
	ExecStop        string      `json:"exec_stop"`         // 停止命令
	ExecReload      string      `json:"exec_reload"`       // 重载命令
	User            string      `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    []KV        `json:"environments"`      // 环境变量
	StandardOutput  string      `json:"standard_output"`   // 标准输出 journal/file:/path
	StandardError   string      `json:"standard_error"`    // 标准错误 journal/file:/path
	Requires        []string    `json:"requires"`          // 依赖服务(强依赖)
	Wants           []string    `json:"wants"`             // 依赖服务(弱依赖)
	After           []string    `json:"after"`             // 启动顺序(在...之后启动)
	Before          []string    `json:"before"`            // 启动顺序(在...之前启动)

	// 运行状态
	Status      string  `json:"status"`       // 运行状态
	Enabled     bool    `json:"enabled"`      // 是否自启动
	PID         int     `json:"pid"`          // 进程ID
	Memory      int64   `json:"memory"`       // 内存使用(字节)
	CPU         float64 `json:"cpu"`          // CPU使用率
	Uptime      string  `json:"uptime"`       // 运行时间
	MemoryLimit float64 `json:"memory_limit"` // 内存限制(字节)
	CPUQuota    float64 `json:"cpu_quota"`    // CPU限制(百分比)

	// 安全相关
	NoNewPrivileges bool     `json:"no_new_privileges"` // 无新特权
	ProtectTmp      bool     `json:"protect_tmp"`       // 保护临时目录
	ProtectHome     bool     `json:"protect_home"`      // 保护主目录
	ProtectSystem   string   `json:"protect_system"`    // 保护系统 full/strict
	ReadWritePaths  []string `json:"read_write_paths"`  // 读写路径
	ReadOnlyPaths   []string `json:"read_only_paths"`   // 只读路径
}

type ProjectType

type ProjectType string
const (
	ProjectTypeGeneral ProjectType = "general"
	ProjectTypePHP     ProjectType = "php"
	ProjectTypeJava    ProjectType = "java"
	ProjectTypeGo      ProjectType = "go"
	ProjectTypePython  ProjectType = "python"
	ProjectTypeNodejs  ProjectType = "nodejs"
	ProjectTypeDotnet  ProjectType = "dotnet"
)

type SSHLoginLog

type SSHLoginLog struct {
	Time   string `json:"time"`
	User   string `json:"user"`
	IP     string `json:"ip"`
	Port   string `json:"port"`
	Method string `json:"method"`
	Status string `json:"status"`
}

SSHLoginLog SSH 登录日志条目

type SWAP

type SWAP struct {
	Total string   `json:"total"`
	Used  []string `json:"used"`
	Free  []string `json:"free"`
}

type TaskRunner

type TaskRunner interface {
	Run(ctx context.Context)
	Notify()
}

TaskRunner 任务运行器接口

type TopProcesses

type TopProcesses struct {
	CPU    []ProcessStat `json:"cpu"`
	Memory []ProcessStat `json:"memory"`
	DiskIO []ProcessStat `json:"disk_io"`
}

TopProcesses 各指标 Top 5 进程

type WebsiteCustomConfig

type WebsiteCustomConfig struct {
	Name    string `json:"name"`    // 配置名称
	Scope   string `json:"scope"`   // 作用域: site(此网站), shared(全局)
	Content string `json:"content"` // 配置内容
}

WebsiteCustomConfig 网站自定义配置

type WebsiteListen

type WebsiteListen struct {
	Address string `form:"address" json:"address" validate:"required"` // 监听地址 e.g. 80 0.0.0.0:80 [::]:80
	HTTPS   bool   `form:"https" json:"https"`                         // 是否启用HTTPS
	QUIC    bool   `form:"quic" json:"quic"`                           // 是否启用QUIC
}

WebsiteListen 网站监听配置

type WebsiteSetting

type WebsiteSetting struct {
	ID      uint           `json:"id"`
	Name    string         `json:"name"`
	Type    string         `json:"type"`
	Listens []types.Listen `form:"listens" json:"listens" validate:"required"`
	Domains []string       `json:"domains"`
	Path    string         `json:"path"` // 网站目录
	Root    string         `json:"root"` // 运行目录
	Index   []string       `json:"index"`

	// SSL 相关
	SSL           bool     `json:"ssl"`
	SSLCert       string   `json:"ssl_cert"`
	SSLKey        string   `json:"ssl_key"`
	HSTS          bool     `json:"hsts"`
	OCSP          bool     `json:"ocsp"`
	HTTPRedirect  bool     `json:"http_redirect"`
	SSLProtocols  []string `json:"ssl_protocols"`
	SSLCiphers    string   `json:"ssl_ciphers"`
	SSLNotBefore  string   `json:"ssl_not_before"`
	SSLNotAfter   string   `json:"ssl_not_after"`
	SSLDNSNames   []string `json:"ssl_dns_names"`
	SSLIssuer     string   `json:"ssl_issuer"`
	SSLOCSPServer []string `json:"ssl_ocsp_server"`

	AccessLog string `json:"access_log"`
	ErrorLog  string `json:"error_log"`

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

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

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

	// 高级设置
	StatEnabled bool              `json:"stat_enabled"` // 是否启用访问统计
	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"`
}

WebsiteSetting 网站设置

Jump to

Keyboard shortcuts

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