proxy

package
v0.4.1-beta.8 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package proxy provides types and handlers for managing reverse proxy applications. It defines the core interfaces and configuration for reverse proxying, with concrete runtime integration (currently using Caddy, see https://github.com/caddyserver/caddy) implemented in the internal/proxy package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Domain   string       `json:"domain"`
	Upstream string       `json:"upstream"`
	Root     string       `json:"root,omitempty"`
	Template TemplateType `json:"template"` // static, reverse_proxy, or php_fastcgi
}

type HandleProxy

type HandleProxy interface {
	// Setup generates a Caddyfile from templates and persists app configuration state.
	// It creates the config directory if needed and saves all apps to apps.json for
	// later modification operations.
	Setup(apps map[string]App) error

	// Status returns the current status of the proxy service
	Status() ProxyStatusResponse

	// Restart reloads Caddy with the current Caddyfile configuration.
	Restart() error

	// Add merges new apps with existing configuration, regenerates the Caddyfile,
	// and reloads Caddy. Duplicate domains are replaced with new configurations.
	Add(apps map[string]App) error

	// Remove deletes apps by domain, regenerates the Caddyfile, and reloads Caddy.
	Remove(domains []string) error
}

type Proxier

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

func NewProxier

func NewProxier(a map[string]App, p HandleProxy) *Proxier

type ProxyHandler

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

func NewProxyHandler

func NewProxyHandler(p *Proxier, l *shared.Logger) *ProxyHandler

func (*ProxyHandler) GetStatus

func (h *ProxyHandler) GetStatus(w http.ResponseWriter, r *http.Request)

func (*ProxyHandler) HandleAdd

func (h *ProxyHandler) HandleAdd(w http.ResponseWriter, r *http.Request)

func (*ProxyHandler) HandleRemove

func (h *ProxyHandler) HandleRemove(w http.ResponseWriter, r *http.Request)

func (*ProxyHandler) HandleRestart

func (h *ProxyHandler) HandleRestart(w http.ResponseWriter, r *http.Request)

type ProxyRoute

type ProxyRoute struct {
	Domain   string `json:"domain"`
	Upstream string `json:"upstream"`
}

type ProxyStatus

type ProxyStatus struct {
	Status string `json:"status"`
}

type ProxyStatusResponse

type ProxyStatusResponse struct {
	Status service.SvcState `json:"status"`
}

type TemplateType

type TemplateType string
const (
	TemplateStatic       TemplateType = "static"
	TemplateReverseProxy TemplateType = "reverse_proxy"
	TemplatePHPFastCGI   TemplateType = "php_fastcgi"
)

Jump to

Keyboard shortcuts

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