models

package
v2.2.27 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SettingKeyName              = "name"
	SettingKeyVersion           = "version"
	SettingKeyMonitor           = "monitor"
	SettingKeyMonitorDays       = "monitor_days"
	SettingKeyBackupPath        = "backup_path"
	SettingKeyWebsitePath       = "website_path"
	SettingKeyMysqlRootPassword = "mysql_root_password"
	SettingKeySshHost           = "ssh_host"
	SettingKeySshPort           = "ssh_port"
	SettingKeySshUser           = "ssh_user"
	SettingKeySshPassword       = "ssh_password"
)
View Source
const (
	TaskStatusWaiting = "waiting"
	TaskStatusRunning = "running"
	TaskStatusSuccess = "finished"
	TaskStatusFailed  = "failed"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cert

type Cert struct {
	orm.Model
	UserID    uint     `gorm:"not null" json:"user_id"`    // 关联的 ACME 用户 ID
	WebsiteID uint     `gorm:"not null" json:"website_id"` // 关联的网站 ID
	DNSID     uint     `gorm:"not null" json:"dns_id"`     // 关联的 DNS ID
	Type      string   `gorm:"not null" json:"type"`       // 证书类型 (P256, P384, 2048, 4096)
	Domains   []string `gorm:"not null;serializer:json" json:"domains"`
	AutoRenew bool     `gorm:"not null" json:"auto_renew"` // 自动续签
	CertURL   string   `gorm:"not null" json:"cert_url"`   // 证书 URL (续签时使用)
	Cert      string   `gorm:"not null" json:"cert"`       // 证书内容
	Key       string   `gorm:"not null" json:"key"`        // 私钥内容

	Website *Website  `gorm:"foreignKey:WebsiteID" json:"website"`
	User    *CertUser `gorm:"foreignKey:UserID" json:"user"`
	DNS     *CertDNS  `gorm:"foreignKey:DNSID" json:"dns"`
}

type CertDNS

type CertDNS struct {
	orm.Model
	Name string        `gorm:"not null" json:"name"` // 备注名称
	Type string        `gorm:"not null" json:"type"` // DNS 提供商 (dnspod, tencent, aliyun, cloudflare)
	Data acme.DNSParam `gorm:"not null;serializer:json" json:"dns_param"`

	Certs []*Cert `gorm:"foreignKey:DNSID" json:"-"`
}

type CertUser

type CertUser struct {
	orm.Model
	Email       string `gorm:"not null" json:"email"`
	CA          string `gorm:"not null" json:"ca"` // CA 提供商 (letsencrypt, zerossl, sslcom, google, buypass)
	Kid         string `gorm:"not null" json:"kid"`
	HmacEncoded string `gorm:"not null" json:"hmac_encoded"`
	PrivateKey  string `gorm:"not null" json:"private_key"`
	KeyType     string `gorm:"not null" json:"key_type"`

	Certs []*Cert `gorm:"foreignKey:UserID" json:"-"`
}

type Cron

type Cron struct {
	orm.Model
	Name   string `gorm:"not null;unique" json:"name"`
	Status bool   `gorm:"not null" json:"status"`
	Type   string `gorm:"not null" json:"type"`
	Time   string `gorm:"not null" json:"time"`
	Shell  string `gorm:"not null" json:"shell"`
	Log    string `gorm:"not null" json:"log"`
}

type Database

type Database struct {
	orm.Model
	Name     string `gorm:"not null;unique" json:"name"`
	Type     string `gorm:"not null" json:"type"`
	Host     string `gorm:"not null" json:"host"`
	Port     int    `gorm:"not null" json:"port"`
	Username string `gorm:"not null" json:"username"`
	Password string `gorm:"not null" json:"password"`
	Remark   string `gorm:"not null" json:"remark"`
}

type Monitor

type Monitor struct {
	orm.Model
	Info tools.MonitoringInfo `gorm:"not null;serializer:json" json:"info"`
}

type Plugin

type Plugin struct {
	orm.Model
	Slug      string `gorm:"not null;unique" json:"slug"`
	Version   string `gorm:"not null" json:"version"`
	Show      bool   `gorm:"not null" json:"show"`
	ShowOrder int    `gorm:"not null" json:"show_order"`
}

type Setting

type Setting struct {
	orm.Model
	Key   string `gorm:"not null;unique" json:"key"`
	Value string `gorm:"not null" json:"value"`
}

type Task

type Task struct {
	orm.Model
	Name   string `gorm:"not null;index" json:"name"`
	Status string `gorm:"not null;default:'waiting'" json:"status"`
	Shell  string `gorm:"not null" json:"shell"`
	Log    string `gorm:"not null" json:"log"`
}

type User

type User struct {
	orm.Model
	Username string `gorm:"not null;unique" json:"username"`
	Password string `gorm:"not null" json:"password"`
	Email    string `gorm:"not null" json:"email"`
}

type Website

type Website struct {
	orm.Model
	Name   string `gorm:"not null;unique" json:"name"`
	Status bool   `gorm:"not null;default:true" json:"status"`
	Path   string `gorm:"not null" json:"path"`
	PHP    int    `gorm:"not null" json:"php"`
	SSL    bool   `gorm:"not null" json:"ssl"`
	Remark string `gorm:"not null" json:"remark"`

	Cert *Cert `gorm:"foreignKey:WebsiteID" json:"cert"`
}

Jump to

Keyboard shortcuts

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