webui

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StaticAssets fs.FS
View Source
var TemplateAssets fs.FS

Functions

func AssetsFromEmbed

func AssetsFromEmbed(prefix string, dir fs.FS) fs.FS

func AssetsFromPath

func AssetsFromPath(path string) fs.FS

func ContextWithRemoteConfig

func ContextWithRemoteConfig(ctx context.Context, rc config.RemoteConfig) context.Context

func ContextWithTemplates

func ContextWithTemplates(ctx context.Context, t TemplateCache) context.Context

func NewHandler

func NewHandler(rc config.RemoteConfig, templates TemplateCache, staticAssets fs.FS) http.Handler

NewHandler returns the dashboard handler with rc and templates attached to every request context, for hosts (like the caddy plugin) that don't own the server's base context.

func RemoteConfigFromContext

func RemoteConfigFromContext(ctx context.Context) (config.RemoteConfig, error)

func RenderAndRespond

func RenderAndRespond(w http.ResponseWriter, r *http.Request, name string, data any, templates ...string)

func Router

func Router(staticAssets fs.FS) http.Handler

func TemplatesFromContext

func TemplatesFromContext(ctx context.Context, name ...string) (*template.Template, error)

Types

type AssetDir

type AssetDir struct {
	// contains filtered or unexported fields
}

func (*AssetDir) Open

func (ad *AssetDir) Open(name string) (fs.File, error)

type CacheStrategy

type CacheStrategy int
const (
	NoCache CacheStrategy = iota
	Cache
)

type ConfigPage

type ConfigPage struct {
	Ready       bool
	DefaultZone string
	// DefaultZoneMissing is set when the default zone isn't in Zones.
	DefaultZoneMissing bool
	Zones              []ZoneView
	Networks           []NetworkView
	Groups             []GroupView
	DefaultPolicy      []ControlView
	DefaultAction      string
}

func BuildConfigPage

func BuildConfigPage(rc config.RemoteConfig) ConfigPage

type ControlView

type ControlView struct {
	Action string
	Entity string
}

type GroupView

type GroupView struct {
	Name     string
	Networks []string
}

type NetworkView

type NetworkView struct {
	Name  string
	CIDRs []string
}

type ServiceStatus

type ServiceStatus string

ServiceStatus summarizes how a service is exposed.

const (
	// StatusRouted services get a reverse-proxy route (and DNS pointing at
	// the proxy).
	StatusRouted ServiceStatus = "proxied"
	// StatusDirect services bypass the proxy; only DNS publishes them,
	// pointing straight at their endpoints.
	StatusDirect ServiceStatus = "direct"
	// StatusUnpublished services carry the no-publish tag.
	StatusUnpublished ServiceStatus = "unpublished"
	// StatusInvalid services are published but can't be served, e.g. they
	// have no endpoints or no usable zones.
	StatusInvalid ServiceStatus = "invalid"
)

type ServiceView

type ServiceView struct {
	ID        string
	Name      string
	Type      string
	Status    ServiceStatus
	Hostnames []string
	Endpoints []string
	// Policy is the effective ACL policy; PolicyInherited is true when it
	// comes from the global default rather than the service's own meta.
	Policy          []ControlView
	PolicyInherited bool
	Warnings        []string
}

type ServicesPage

type ServicesPage struct {
	Ready    bool
	Services []ServiceView
	// Counts holds the number of services per status, in display order,
	// omitting statuses with no services.
	Counts []StatusCount
}

func BuildServicesPage

func BuildServicesPage(rc config.RemoteConfig) ServicesPage

type StatusCount

type StatusCount struct {
	Status ServiceStatus
	Count  int
}

type TemplateCache

type TemplateCache interface {
	Open(paths ...string) (*template.Template, error)
}
var EmbeddedTemplates TemplateCache

func NewTemplateCache

func NewTemplateCache(templates fs.FS, strategy CacheStrategy) TemplateCache

func TemplateCacheFromPath

func TemplateCacheFromPath(path string, strategy CacheStrategy) TemplateCache

type ZoneView

type ZoneView struct {
	Name     string
	Default  bool
	Services int
}

Jump to

Keyboard shortcuts

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