proxy

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildInfo added in v0.4.0

type BuildInfo struct {
	Version string `json:"version"`
	Commit  string `json:"commit"`
	Date    string `json:"date"`
	BuiltBy string `json:"built_by"`
}

BuildInfo contains build metadata

type CertInfo

type CertInfo struct {
	Exists        bool       `json:"exists"`
	ValidUntil    *time.Time `json:"valid_until,omitempty"`
	DaysRemaining *int       `json:"days_remaining,omitempty"`
	Subject       string     `json:"subject,omitempty"`
	DNSNames      []string   `json:"dns_names,omitempty"` // server cert only
}

CertInfo contains details about a specific certificate

type CertificateStatus

type CertificateStatus struct {
	AutoGenerated bool      `json:"auto_generated"`
	Directory     string    `json:"directory"`
	CA            *CertInfo `json:"ca"`
	Server        *CertInfo `json:"server"`
}

CertificateStatus contains information about TLS certificates

type DockerStatus

type DockerStatus struct {
	Connected  bool   `json:"connected"`
	Network    string `json:"network"`
	APIVersion string `json:"api_version,omitempty"`
}

DockerStatus contains Docker connection information

type Handler

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

Handler is the main HTTP handler for the reverse proxy

func NewHandler

func NewHandler(router *Router, dashboardHost string, baseDomain string, statusConfig *StatusConfig, projectStore *project.Store) *Handler

NewHandler creates a new proxy handler

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler

type ProxyStatus

type ProxyStatus struct {
	RoutesCount    int    `json:"routes_count"`
	DashboardHost  string `json:"dashboard_host"`
	BaseDomain     string `json:"base_domain"`
	HTTPPort       int    `json:"http_port"`
	HTTPSPort      int    `json:"https_port"`
	SSESubscribers int    `json:"sse_subscribers"`
}

ProxyStatus contains proxy configuration and state

type RedirectHandler

type RedirectHandler struct {
	HTTPSPort int
}

RedirectHandler redirects HTTP to HTTPS

func (*RedirectHandler) ServeHTTP

func (h *RedirectHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler for HTTP->HTTPS redirect

type Route

type Route struct {
	Hostname   string
	PathPrefix string
	Backend    *docker.Backend
}

Route represents a single route configuration

type RouteEvent added in v0.4.0

type RouteEvent struct {
	Type   string      `json:"type"`   // "routes"
	Routes []RouteInfo `json:"routes"` // Current route list
}

RouteEvent represents a route change event for SSE subscribers

type RouteInfo

type RouteInfo struct {
	Hostname      string
	PathPrefix    string
	Target        string
	ContainerName string
	ServiceName   string
}

RouteInfo is a display-friendly route representation

func (RouteInfo) String

func (ri RouteInfo) String() string

type Router

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

Router manages routes and provides thread-safe access

func NewRouter

func NewRouter() *Router

NewRouter creates a new route manager

func (*Router) AddBackend

func (r *Router) AddBackend(backend *docker.Backend)

AddBackend adds or updates a route for a backend

func (*Router) ListRoutes

func (r *Router) ListRoutes() []RouteInfo

ListRoutes returns all current routes for display

func (*Router) Lookup

func (r *Router) Lookup(hostname, path string) *Route

Lookup finds a route for a given hostname and path

func (*Router) RemoveBackend

func (r *Router) RemoveBackend(containerID string)

RemoveBackend removes routes for a container

func (*Router) RemoveProject

func (r *Router) RemoveProject(projectName string)

RemoveProject removes all routes for a given project

func (*Router) Subscribe added in v0.4.0

func (r *Router) Subscribe(ctx context.Context) (<-chan RouteEvent, func())

Subscribe creates a new SSE subscriber and returns the event channel and cleanup function. The cleanup function must be called when the subscriber disconnects.

func (*Router) SubscriberCount added in v0.4.0

func (r *Router) SubscriberCount() int

SubscriberCount returns the number of active SSE subscribers

type StatusConfig

type StatusConfig struct {
	Version       string
	Commit        string
	Date          string
	BuiltBy       string
	StartTime     time.Time
	CertsDir      string
	AutoGenerated bool
	Network       string
	BaseDomain    string
	HTTPPort      int
	HTTPSPort     int
}

StatusConfig contains configuration for the status endpoint

type StatusResponse

type StatusResponse struct {
	Build         BuildInfo         `json:"build"`
	UptimeSeconds int64             `json:"uptime_seconds"`
	Certificates  CertificateStatus `json:"certificates"`
	Docker        DockerStatus      `json:"docker"`
	Proxy         ProxyStatus       `json:"proxy"`
	Health        string            `json:"health"`
}

StatusResponse represents the overall status of roji

type Subscriber added in v0.4.0

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

Subscriber represents an SSE subscriber

Jump to

Keyboard shortcuts

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