proxy

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package proxy turns the routing table into Caddy configuration. The gateway never implements local HTTP proxying itself: Caddy does.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildConfig

func BuildConfig(snap registry.Snapshot, opt Options) ([]byte, error)

BuildConfig renders a complete Caddy JSON config for the snapshot.

func CARootPath

func CARootPath(stateDir string) string

CARootPath is where Caddy's internal CA root certificate lives.

Types

type Embedded

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

Embedded runs Caddy inside the wtg daemon process.

func (*Embedded) Apply

func (e *Embedded) Apply(_ context.Context, cfg []byte) error

Apply loads cfg with zero downtime; Caddy rolls back on failure.

func (*Embedded) Embedded

func (e *Embedded) Embedded() bool

func (*Embedded) Name

func (e *Embedded) Name() string

func (*Embedded) Stop

func (e *Embedded) Stop() error

type External

type External struct {
	AdminURL string
	Client   *http.Client
	// contains filtered or unexported fields
}

External pushes configuration to an already running Caddy through its admin API. That Caddy instance should be dedicated to the gateway: /load replaces its whole configuration.

func (*External) Apply

func (x *External) Apply(ctx context.Context, cfg []byte) error

func (*External) Embedded

func (x *External) Embedded() bool

func (*External) Name

func (x *External) Name() string

func (*External) Stop

func (x *External) Stop() error

type Options

type Options struct {
	Global   config.Global
	StateDir string
	// Embedded adds process-local settings (storage, logging, admin off)
	// that must not be pushed into a user's external Caddy.
	Embedded bool
}

Options controls config generation.

type Provider

type Provider interface {
	Name() string
	// Embedded reports whether process-local settings should be generated.
	Embedded() bool
	Apply(ctx context.Context, cfg []byte) error
	Stop() error
}

Provider applies generated configuration to a running proxy.

func NewProvider

func NewProvider(name, adminURL string) (Provider, error)

NewProvider returns the configured provider.

Jump to

Keyboard shortcuts

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