- Add ProxyHost, CaddyConfig, RemoteServer, SSL, AccessList, User, Setting, ImportSession models - Implement ProxyHostService and RemoteServerService with domain/name uniqueness validation - Add Caddyfile import handler with conflict detection and user review workflow - Create ProxyHostHandler and RemoteServerHandler with full CRUD operations - Wire up Gin/GORM/SQLite dependencies and create missing internal packages - Add database connection layer, server routing, and version info - Update routes to register all new handlers and auto-migrate models - Configure import environment variables and mount points Addresses Issue #5 (data persistence) and Issue #43 (remote servers) Backend now compiles cleanly with go build
30 lines
1.0 KiB
Go
30 lines
1.0 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// ProxyHost represents a reverse proxy configuration for a single domain.
|
|
type ProxyHost struct {
|
|
ID uint `json:"id" gorm:"primaryKey"`
|
|
UUID string `json:"uuid" gorm:"uniqueIndex"`
|
|
Name string `json:"name"`
|
|
Domain string `json:"domain" gorm:"uniqueIndex"`
|
|
TargetScheme string `json:"target_scheme"` // http/https
|
|
TargetHost string `json:"target_host"`
|
|
TargetPort int `json:"target_port"`
|
|
EnableTLS bool `json:"enable_tls" gorm:"default:false"`
|
|
EnableWS bool `json:"enable_websockets" gorm:"default:false"`
|
|
Enabled bool `json:"enabled" gorm:"default:true"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
// CaddyConfig stores the generated Caddy JSON configuration.
|
|
type CaddyConfig struct {
|
|
ID uint `json:"id" gorm:"primaryKey"`
|
|
Config string `json:"config" gorm:"type:text"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|