services -> domains

This commit is contained in:
2026-07-10 20:46:22 +00:00
parent 3c99d26830
commit 79c0c32b98
45 changed files with 1447 additions and 1270 deletions

View File

@@ -30,9 +30,9 @@ type Config struct {
CredentialsDir string `yaml:"credentialsDir" json:"credentialsDir"`
}
// PublicService describes a service that should be exposed through the tunnel.
type PublicService struct {
Name string // service name (used as subdomain)
// PublicDomain describes a domain that should be exposed through the tunnel.
type PublicDomain struct {
Name string // domain name (used as subdomain)
Subdomain string // explicit subdomain override (defaults to Name)
}
@@ -79,7 +79,7 @@ type cloudflaredConfig struct {
// GenerateConfig renders the cloudflared config.yml for the given public services.
// Returns the YAML string, or empty string if tunnel is not configured or no services are public.
func (m *Manager) GenerateConfig(cfg Config, services []PublicService) string {
func (m *Manager) GenerateConfig(cfg Config, services []PublicDomain) string {
if !cfg.Enabled || cfg.TunnelID == "" || cfg.PublicDomain == "" || cfg.GatewayDomain == "" {
return ""
}
@@ -131,7 +131,7 @@ func (m *Manager) GenerateConfig(cfg Config, services []PublicService) string {
}
// WriteConfig generates and writes the cloudflared config to disk.
func (m *Manager) WriteConfig(cfg Config, services []PublicService) error {
func (m *Manager) WriteConfig(cfg Config, services []PublicDomain) error {
content := m.GenerateConfig(cfg, services)
if content == "" {
// Remove config if tunnel is disabled or no public services