Documentation ¶
Index ¶
- type App
- type AppRepo
- type BackupRepo
- type BackupType
- type Cache
- type CacheKey
- type CacheRepo
- type Cert
- type CertAccount
- type CertAccountRepo
- type CertDNS
- type CertDNSRepo
- type CertRepo
- type ContainerImageRepo
- type ContainerNetworkRepo
- type ContainerRepo
- type ContainerVolumeRepo
- type Cron
- type CronRepo
- type Database
- type DatabaseRepo
- type DatabaseServer
- type DatabaseServerRepo
- type DatabaseServerStatus
- type DatabaseType
- type DatabaseUser
- type DatabaseUserRepo
- type DatabaseUserStatus
- type Monitor
- type MonitorRepo
- type SSH
- type SSHRepo
- type SafeRepo
- type Setting
- type SettingKey
- type SettingRepo
- type Task
- type TaskRepo
- type TaskStatus
- type User
- type UserRepo
- type Website
- type WebsiteRepo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { ID uint `gorm:"primaryKey" json:"id"` Slug string `gorm:"not null;unique" json:"slug"` Channel string `gorm:"not null" json:"channel"` Version string `gorm:"not null" json:"version"` Show bool `gorm:"not null" json:"show"` ShowOrder int `gorm:"not null" json:"show_order"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type AppRepo ¶
type AppRepo interface { All() api.Apps Get(slug string) (*api.App, error) UpdateExist(slug string) bool Installed() ([]*App, error) GetInstalled(slug string) (*App, error) GetInstalledAll(query string, cond ...string) ([]*App, error) GetHomeShow() ([]map[string]string, error) IsInstalled(query string, cond ...string) (bool, error) Install(channel, slug string) error UnInstall(slug string) error Update(slug string) error UpdateShow(slug string, show bool) error }
type BackupRepo ¶
type BackupRepo interface { List(typ BackupType) ([]*types.BackupFile, error) Create(typ BackupType, target string, path ...string) error Delete(typ BackupType, name string) error Restore(typ BackupType, backup, target string) error ClearExpired(path, prefix string, save int) error CutoffLog(path, target string) error GetPath(typ BackupType) (string, error) FixPanel() error UpdatePanel(version, url, checksum string) error }
type BackupType ¶
type BackupType string
const ( BackupTypePath BackupType = "path" BackupTypeWebsite BackupType = "website" BackupTypeMySQL BackupType = "mysql" BackupTypePostgres BackupType = "postgres" BackupTypeRedis BackupType = "redis" BackupTypePanel BackupType = "panel" )
type Cert ¶
type Cert struct { ID uint `gorm:"primaryKey" json:"id"` AccountID uint `gorm:"not null" json:"account_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, 3072, 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"` // 私钥内容 CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Website *Website `gorm:"foreignKey:WebsiteID" json:"website"` Account *CertAccount `gorm:"foreignKey:AccountID" json:"account"` DNS *CertDNS `gorm:"foreignKey:DNSID" json:"dns"` }
type CertAccount ¶
type CertAccount struct { ID uint `gorm:"primaryKey" json:"id"` 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"` // 密钥类型 (P256, P384, 2048, 3072, 4096) CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Certs []*Cert `gorm:"foreignKey:AccountID" json:"-"` }
type CertAccountRepo ¶
type CertAccountRepo interface { List(page, limit uint) ([]*CertAccount, int64, error) GetDefault(userID uint) (*CertAccount, error) Get(id uint) (*CertAccount, error) Create(req *request.CertAccountCreate) (*CertAccount, error) Update(req *request.CertAccountUpdate) error Delete(id uint) error }
type CertDNS ¶
type CertDNS struct { ID uint `gorm:"primaryKey" json:"id"` Name string `gorm:"not null" json:"name"` // 备注名称 Type string `gorm:"not null" json:"type"` // DNS 提供商 (tencent, aliyun, cloudflare) Data acme.DNSParam `gorm:"not null;serializer:json" json:"dns_param"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Certs []*Cert `gorm:"foreignKey:DNSID" json:"-"` }
type CertDNSRepo ¶
type CertRepo ¶
type CertRepo interface { List(page, limit uint) ([]*types.CertList, int64, error) Get(id uint) (*Cert, error) GetByWebsite(WebsiteID uint) (*Cert, error) Upload(req *request.CertUpload) (*Cert, error) Create(req *request.CertCreate) (*Cert, error) Update(req *request.CertUpdate) error Delete(id uint) error ObtainAuto(id uint) (*acme.Certificate, error) ObtainManual(id uint) (*acme.Certificate, error) ObtainSelfSigned(id uint) error Renew(id uint) (*acme.Certificate, error) ManualDNS(id uint) ([]acme.DNSRecord, error) Deploy(ID, WebsiteID uint) error }
type ContainerImageRepo ¶
type ContainerImageRepo interface { List() ([]types.ContainerImage, error) Pull(req *request.ContainerImagePull) error Remove(id string) error Prune() error }
type ContainerNetworkRepo ¶
type ContainerNetworkRepo interface { List() ([]types.ContainerNetwork, error) Create(req *request.ContainerNetworkCreate) (string, error) Remove(id string) error Prune() error }
type ContainerRepo ¶
type ContainerRepo interface { ListAll() ([]types.Container, error) ListByName(name string) ([]types.Container, error) Create(req *request.ContainerCreate) (string, error) Remove(id string) error Start(id string) error Stop(id string) error Restart(id string) error Pause(id string) error Unpause(id string) error Kill(id string) error Rename(id string, newName string) error Logs(id string) (string, error) Prune() error }
type ContainerVolumeRepo ¶
type ContainerVolumeRepo interface { List() ([]types.ContainerVolume, error) Create(req *request.ContainerVolumeCreate) (string, error) Remove(id string) error Prune() error }
type Cron ¶
type Cron struct { ID uint `gorm:"primaryKey" json:"id"` 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"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type DatabaseRepo ¶
type DatabaseServer ¶
type DatabaseServer struct { ID uint `gorm:"primaryKey" json:"id"` Name string `gorm:"not null;unique" json:"name"` Type DatabaseType `gorm:"not null" json:"type"` Host string `gorm:"not null" json:"host"` Port uint `gorm:"not null" json:"port"` Username string `gorm:"not null" json:"username"` Password string `gorm:"not null" json:"password"` Status DatabaseServerStatus `gorm:"-:all" json:"status"` Remark string `gorm:"not null" json:"remark"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func (*DatabaseServer) BeforeSave ¶
func (r *DatabaseServer) BeforeSave(tx *gorm.DB) error
type DatabaseServerRepo ¶
type DatabaseServerRepo interface { Count() (int64, error) List(page, limit uint) ([]*DatabaseServer, int64, error) Get(id uint) (*DatabaseServer, error) GetByName(name string) (*DatabaseServer, error) Create(req *request.DatabaseServerCreate) error Update(req *request.DatabaseServerUpdate) error UpdateRemark(req *request.DatabaseServerUpdateRemark) error Delete(id uint) error ClearUsers(id uint) error Sync(id uint) error }
type DatabaseServerStatus ¶
type DatabaseServerStatus string
const ( DatabaseServerStatusValid DatabaseServerStatus = "valid" DatabaseServerStatusInvalid DatabaseServerStatus = "invalid" )
type DatabaseType ¶
type DatabaseType string
const ( DatabaseTypeMysql DatabaseType = "mysql" DatabaseTypePostgresql DatabaseType = "postgresql" DatabaseTypeMongoDB DatabaseType = "mongodb" DatabaseSQLite DatabaseType = "sqlite" DatabaseTypeRedis DatabaseType = "redis" )
type DatabaseUser ¶
type DatabaseUser struct { ID uint `gorm:"primaryKey" json:"id"` ServerID uint `gorm:"not null" json:"server_id"` Username string `gorm:"not null" json:"username"` Password string `gorm:"not null" json:"password"` Host string `gorm:"not null" json:"host"` // 仅 mysql Status DatabaseUserStatus `gorm:"-:all" json:"status"` // 仅显示 Privileges []string `gorm:"-:all" json:"privileges"` // 仅显示 Remark string `gorm:"not null" json:"remark"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Server *DatabaseServer `gorm:"foreignKey:ServerID;references:ID" json:"server"` }
func (*DatabaseUser) BeforeSave ¶
func (r *DatabaseUser) BeforeSave(tx *gorm.DB) error
type DatabaseUserRepo ¶
type DatabaseUserRepo interface { Count() (int64, error) List(page, limit uint) ([]*DatabaseUser, int64, error) Get(id uint) (*DatabaseUser, error) Create(req *request.DatabaseUserCreate) error Update(req *request.DatabaseUserUpdate) error UpdateRemark(req *request.DatabaseUserUpdateRemark) error Delete(id uint) error DeleteByNames(serverID uint, names []string) error }
type DatabaseUserStatus ¶
type DatabaseUserStatus string
const ( DatabaseUserStatusValid DatabaseUserStatus = "valid" DatabaseUserStatusInvalid DatabaseUserStatus = "invalid" )
type MonitorRepo ¶
type SSH ¶
type SSH struct { ID uint `gorm:"primaryKey" json:"id"` Name string `gorm:"not null" json:"name"` Host string `gorm:"not null" json:"host"` Port uint `gorm:"not null" json:"port"` Config ssh.ClientConfig `gorm:"not null;serializer:json" json:"config"` Remark string `gorm:"not null" json:"remark"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type SettingKey ¶
type SettingKey string
const ( SettingKeyName SettingKey = "name" SettingKeyVersion SettingKey = "version" SettingKeyMonitor SettingKey = "monitor" SettingKeyMonitorDays SettingKey = "monitor_days" SettingKeyBackupPath SettingKey = "backup_path" SettingKeyWebsitePath SettingKey = "website_path" SettingKeyMySQLRootPassword SettingKey = "mysql_root_password" SettingKeyOfflineMode SettingKey = "offline_mode" )
type SettingRepo ¶
type SettingRepo interface { Get(key SettingKey, defaultValue ...string) (string, error) GetBool(key SettingKey, defaultValue ...bool) (bool, error) Set(key SettingKey, value string) error Delete(key SettingKey) error GetPanelSetting(ctx context.Context) (*request.PanelSetting, error) UpdatePanelSetting(ctx context.Context, setting *request.PanelSetting) (bool, error) }
type Task ¶
type Task struct { ID uint `gorm:"primaryKey" json:"id"` Name string `gorm:"not null;index" json:"name"` Status TaskStatus `gorm:"not null;default:'waiting'" json:"status"` Shell string `gorm:"not null" json:"-"` Log string `gorm:"not null" json:"log"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type TaskStatus ¶
type TaskStatus string
const ( TaskStatusWaiting TaskStatus = "waiting" TaskStatusRunning TaskStatus = "running" TaskStatusSuccess TaskStatus = "finished" TaskStatusFailed TaskStatus = "failed" )
type User ¶
type User struct { ID uint `gorm:"primaryKey" json:"id"` Username string `gorm:"not null;unique" json:"username"` Password string `gorm:"not null" json:"password"` Email string `gorm:"not null" json:"email"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"` }
type Website ¶
type Website struct { ID uint `gorm:"primaryKey" json:"id"` Name string `gorm:"not null;unique" json:"name"` Status bool `gorm:"not null;default:true" json:"status"` Path string `gorm:"not null" json:"path"` Https bool `gorm:"not null" json:"https"` Remark string `gorm:"not null" json:"remark"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Cert *Cert `gorm:"foreignKey:WebsiteID" json:"cert"` }
type WebsiteRepo ¶
type WebsiteRepo interface { GetRewrites() (map[string]string, error) UpdateDefaultConfig(req *request.WebsiteDefaultConfig) error Count() (int64, error) Get(id uint) (*types.WebsiteSetting, error) GetByName(name string) (*types.WebsiteSetting, error) List(page, limit uint) ([]*Website, int64, error) Create(req *request.WebsiteCreate) (*Website, error) Update(req *request.WebsiteUpdate) error Delete(req *request.WebsiteDelete) error ClearLog(id uint) error UpdateRemark(id uint, remark string) error ResetConfig(id uint) error UpdateStatus(id uint, status bool) error ObtainCert(ctx context.Context, id uint) error }
Click to show internal directories.
Click to hide internal directories.