caddy

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACMEConfig

type ACMEConfig struct {
	// CA is the URL of the ACME service to request certificates from.
	CA string `yaml:"ca"`
	// Email is the address that should be provided to the acme service for
	// contacting us.
	Email string `yaml:"email"`
}

type AdditionalBackendConfig added in v0.9.0

type AdditionalBackendConfig struct {
	Hostnames []string `yaml:"hostnames"`
	Path      string   `yaml:"path"`
	Upstreams []string `yaml:"upstreams"`
}

type AdminAPIClient added in v0.8.6

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

AdminAPIClient wraps access to the Caddy Admin API.

func NewAdminAPIClient added in v0.8.6

func NewAdminAPIClient(log *zap.Logger) *AdminAPIClient

type Config

type Config struct {
	// Image is the container image that should be deployed as caddy
	Image string `yaml:"image"`
	// ListenIP is the IP that the caddy listener should bind to. By default,
	// this will bind to all interfaces/IPs.
	ListenIP           string                             `yaml:"listenIP"`
	ACME               ACMEConfig                         `yaml:"acme"`
	Ports              PortsConfig                        `yaml:"ports"`
	AdditionalBackends map[string]AdditionalBackendConfig `yaml:"additionalBackends"`
}

type Manager

type Manager struct {
	Log *zap.Logger

	// CaddyConfigurator is used by manager for making changes to a caddy
	// configuration
	CaddyConfigurator caddyConfigurator
	// Docker is the implementation of Docker that the manager should use to
	// create and query containers.
	Docker docker.APIClient
	// Config controls how the manager behaves.
	Config Config
	// ContainerLabels is a map of labels to add to any containers created by
	// the manager.
	ContainerLabels map[string]string
}

Manager creates and manages a Caddy container. It provides a Init() method for creating the container, and reconciling its initial configuration, and methods for reconciling Guvnor services in the caddy configuration.

func (*Manager) ConfigureBackend

func (cm *Manager) ConfigureBackend(
	ctx context.Context,
	backendName string,
	hostNames []string,
	upstreams []string,
	path string,
) error

ConfigureBackend sets up the appropriate routes in Caddy for a specific process/service

func (*Manager) Init

func (cm *Manager) Init(ctx context.Context) error

Init ensures a caddy container is running and configured to accept config at the expected path.

type PortsConfig

type PortsConfig struct {
	// HTTP is the port Caddy should listen on for unencrypted HTTP traffic.
	// By default this is 80.
	HTTP int `yaml:"http"`
	// HTTPS is the port Caddy should listen on for encrypted HTTPS traffic.
	// By default this is 443.
	HTTPS int `yaml:"https"`
}

Jump to

Keyboard shortcuts

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