types

package
v3.3.6 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppStatusRunning = "running" // 正在运行
	AppStatusStopped = "stopped" // 已停止
	AppStatusPartial = "partial" // 部分运行(多服务应用)
	AppStatusNA      = "n/a"     // 不适用(无 systemd 服务的应用)
)

应用运行状态

Variables

This section is empty.

Functions

func AggregateAppStatus added in v3.2.2

func AggregateAppStatus(running ...bool) string

AggregateAppStatus 根据各服务运行状态聚合应用状态

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)
	Status(ctx context.Context) string
}

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"`
	Status           string `json:"status"`
	CustomSupported  bool   `json:"custom_supported"`
}

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:"required_if:Type,s3 && in:virtual-hosted,path"` // virtual-hosted, path
	Region    string `json:"region"`                                                         // 地区
	Endpoint  string `json:"endpoint" validate:"required_if:Type,s3"`                        // 端点
	Scheme    string `json:"scheme" validate:"required_if:Type,s3 && in:http,https"`         // http, https
	Bucket    string `json:"bucket" validate:"required_if:Type,s3"`                          // 存储桶

	// SFTP / WebDAV
	URL        string `json:"url"`                                // 网址
	Host       string `json:"host"`                               // 主机
	Port       int    `json:"port" validate:"min:1 && max:65535"` // 端口
	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"`
	WebsiteIDs  []uint            `json:"website_ids"`
	DNSID       uint              `json:"dns_id"`
	Type        string            `json:"type"`
	Domains     []string          `json:"domains"`
	Alias       map[string]string `json:"alias"`
	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 ContainerDevice added in v3.3.2

type ContainerDevice struct {
	Host        string `form:"host" json:"host"`
	Container   string `form:"container" json:"container"`
	Permissions string `form:"permissions" json:"permissions"`
}

type ContainerHealthcheck added in v3.3.2

type ContainerHealthcheck struct {
	Test        []string      `form:"test" json:"test"`
	Interval    time.Duration `form:"interval" json:"interval"`
	Timeout     time.Duration `form:"timeout" json:"timeout"`
	StartPeriod time.Duration `form:"start_period" json:"start_period"`
	Retries     int           `form:"retries" json:"retries"`
}

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 ContainerUlimit added in v3.3.2

type ContainerUlimit struct {
	Name string `form:"name" json:"name"`
	Soft int64  `form:"soft" json:"soft"`
	Hard int64  `form:"hard" json:"hard"`
}

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/path;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"`
	CustomSupported  bool   `json:"custom_supported"`
}

EnvironmentDetail 环境详情

type EnvironmentPHPComposer added in v3.3.3

type EnvironmentPHPComposer struct {
	Installed bool   `json:"installed"`
	Version   string `json:"version"`
	Mirror    string `json:"mirror"` // 空为官方源
}

EnvironmentPHPComposer Composer 状态

type EnvironmentPHPModule

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

type EnvironmentPHPOpcache added in v3.3.3

type EnvironmentPHPOpcache struct {
	Enabled       bool    `json:"enabled"`
	MemoryUsed    string  `json:"memory_used"`
	MemoryFree    string  `json:"memory_free"`
	MemoryWasted  string  `json:"memory_wasted"`
	WastedPercent float64 `json:"wasted_percent"`
	HitRate       float64 `json:"hit_rate"`
	Hits          int64   `json:"hits"`
	Misses        int64   `json:"misses"`
	CachedScripts int64   `json:"cached_scripts"`
	CachedKeys    int64   `json:"cached_keys"`
	MaxCachedKeys int64   `json:"max_cached_keys"`
	OomRestarts   int64   `json:"oom_restarts"`
	JitEnabled    bool    `json:"jit_enabled"`
	JitBufferSize string  `json:"jit_buffer_size"`
	JitBufferFree string  `json:"jit_buffer_free"`
}

EnvironmentPHPOpcache OPcache 状态

type EnvironmentPHPProcess added in v3.3.3

type EnvironmentPHPProcess struct {
	PID             int64   `json:"pid"`
	State           string  `json:"state"`
	StartSince      int64   `json:"start_since"`
	Requests        int64   `json:"requests"`
	RequestDuration int64   `json:"request_duration"` // 微秒
	Method          string  `json:"method"`
	URI             string  `json:"uri"`
	Script          string  `json:"script"`
	LastRequestCPU  float64 `json:"last_request_cpu"`
	LastRequestMem  int64   `json:"last_request_memory"`
}

EnvironmentPHPProcess PHP-FPM 工作进程信息

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 MigrationDatabase added in v3.3.2

type MigrationDatabase struct {
	Type     string // mysql / postgresql
	Version  string
	Name     string
	Username string
	Password string
	Host     string
}

MigrationDatabase 数据库详情

type MigrationDatabaseUser added in v3.3.2

type MigrationDatabaseUser struct {
	Type     string // mysql / postgresql
	Username string
	Password string
	Host     string
}

MigrationDatabaseUser 数据库用户详情

type MigrationDetail added in v3.3.2

type MigrationDetail struct {
	Item         MigrationItem
	Website      *MigrationWebsite
	Database     *MigrationDatabase
	DatabaseUser *MigrationDatabaseUser
	Project      *MigrationProject
}

MigrationDetail 迁移执行前重新读取的资源详情

type MigrationItem added in v3.3.2

type MigrationItem struct {
	Key       string   `json:"key"`      // 前端选择用的唯一标识
	Type      string   `json:"type"`     // website / database / database_user / project
	Subtype   string   `json:"subtype"`  // 网站为 static/php/proxy,数据库为 mysql/postgresql 等
	Name      string   `json:"name"`     // 来源名称
	Status    string   `json:"status"`   // running / stopped
	Size      int64    `json:"size"`     // 占用空间,0 为未知
	Blockers  []string `json:"blockers"` // 非空则该项无法迁移
	Warnings  []string `json:"warnings"` // 迁移前提示
	DependsOn []string `json:"depends_on"`

	TargetName string `json:"target_name"`
	TargetPath string `json:"target_path"`
	TargetUser string `json:"-"` // 项目运行用户,由前端指定

	// 以下字段仅服务端内部使用
	SourceID    string `json:"-"` // 来源主键
	SourcePath  string `json:"-"` // 来源目录
	SourceGroup string `json:"-"` // 来源分组:项目模块名 / 数据库服务名
	Version     string `json:"-"` // 运行时版本
}

MigrationItem 来源面板上的一个可迁移资源

type MigrationProgress added in v3.3.2

type MigrationProgress func(transferred, total int64)

MigrationProgress 传输进度回调

type MigrationProject added in v3.3.2

type MigrationProject struct {
	Type         ProjectType
	Version      string
	Path         string
	WorkingDir   string
	ExecStart    string
	User         string
	Port         uint
	Domains      []string
	Listens      []string
	Environments []KV
	Enabled      bool
	Running      bool
}

MigrationProject 项目详情

type MigrationProxy added in v3.3.2

type MigrationProxy struct {
	Location string
	Pass     string
	Host     string
	Replaces map[string]string
}

MigrationProxy 网站反向代理规则

type MigrationRedirect added in v3.3.2

type MigrationRedirect struct {
	Type       string // host / url
	From       string
	To         string
	KeepURI    bool
	StatusCode int
}

MigrationRedirect 网站重定向规则

type MigrationResult added in v3.3.2

type MigrationResult struct {
	Key       string          `json:"key"`
	Type      string          `json:"type"`
	Name      string          `json:"name"`
	Status    MigrationStatus `json:"status"`
	Stage     MigrationStage  `json:"stage"`
	Error     string          `json:"error"`
	Warnings  []string        `json:"warnings"`
	StartedAt *time.Time      `json:"started_at"`
	EndedAt   *time.Time      `json:"ended_at"`
	Duration  float64         `json:"duration"` // 耗时(秒)
}

MigrationResult 单个迁移项的执行结果

type MigrationSource added in v3.3.2

type MigrationSource struct {
	Panel   string `json:"panel"`
	Version string `json:"version"`
}

MigrationSource 来源面板信息

type MigrationStage added in v3.3.2

type MigrationStage string

MigrationStage 单个迁移项的当前阶段

const (
	MigrationStageBackup   MigrationStage = "backup"   // 在来源侧生成备份
	MigrationStageTransfer MigrationStage = "transfer" // 传输备份
	MigrationStageImport   MigrationStage = "import"   // 导入到目标
	MigrationStageDone     MigrationStage = "done"
)

type MigrationStatus added in v3.3.2

type MigrationStatus string

MigrationStatus 单个迁移项的状态

const (
	MigrationPending MigrationStatus = "pending"
	MigrationRunning MigrationStatus = "running"
	MigrationSuccess MigrationStatus = "success"
	MigrationPartial MigrationStatus = "partial" // 迁移完成但有告警
	MigrationFailed  MigrationStatus = "failed"
	MigrationSkipped MigrationStatus = "skipped"
)

type MigrationStep

type MigrationStep string

MigrationStep 迁移流程所处步骤

const (
	MigrationStepIdle     MigrationStep = "idle"     // 空闲
	MigrationStepPreCheck MigrationStep = "precheck" // 已连接来源
	MigrationStepSelect   MigrationStep = "select"   // 选择迁移项
	MigrationStepRunning  MigrationStep = "running"  // 迁移中
	MigrationStepDone     MigrationStep = "done"     // 迁移结束
)

type MigrationWebsite added in v3.3.2

type MigrationWebsite struct {
	Type         string // static / php / proxy
	Path         string // 来源网站根目录
	Root         string // 运行目录
	Domains      []string
	Listens      []string
	SSLListens   []string
	Index        []string
	PHP          uint
	Rewrite      string
	OpenBasedir  bool
	Remark       string
	ExpireAt     *time.Time
	Enabled      bool
	SSL          bool
	SSLCert      string
	SSLKey       string
	SSLProtocols []string
	HSTS         bool
	OCSP         bool
	HTTPRedirect bool
	Proxies      []MigrationProxy
	Redirects    []MigrationRedirect
}

MigrationWebsite 网站详情

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)
	Wait(ctx context.Context)
	Notify()
	Cancel(id uint) bool
}

TaskRunner 任务运行器接口

type TemplateData added in v3.1.5

type TemplateData struct {
	Name          map[string]string                  `yaml:"name"`
	Description   map[string]string                  `yaml:"description"`
	Website       string                             `yaml:"website"`
	Categories    []string                           `yaml:"categories"`
	Architectures []string                           `yaml:"architectures"`
	Environments  map[string]TemplateDataEnvironment `yaml:"environments"`
}

TemplateData data.yml 的 YAML 结构

type TemplateDataEnvironment added in v3.1.5

type TemplateDataEnvironment struct {
	Description map[string]string `yaml:"description"`
	Type        string            `yaml:"type"`
	Options     map[string]string `yaml:"options,omitempty"`
	Default     any               `yaml:"default,omitempty"`
}

TemplateDataEnvironment 模板环境变量定义

type TopProcesses

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

TopProcesses 各指标 Top 5 进程

type WebsiteBasicAuth added in v3.3.4

type WebsiteBasicAuth struct {
	Path  string            `json:"path"`  // 生效路径,空或 "/" 表示整站
	Users map[string]string `json:"users"` // 用户名 -> 密码
}

WebsiteBasicAuth 网站基本认证规则

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"`
	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"` // 是否启用访问统计
	LSCache     bool               `json:"lscache"`      // LiteSpeed 页面缓存
	RateLimit   *types.RateLimit   `json:"rate_limit"`   // 限流限速配置
	RealIP      *types.RealIP      `json:"real_ip"`      // 真实 IP 配置
	BasicAuth   []WebsiteBasicAuth `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