Documentation
¶
Index ¶
- type Config
- type HTTPSBackendMatcher
- func (HTTPSBackendMatcher) CaddyModule() caddy.ModuleInfo
- func (m *HTTPSBackendMatcher) Cleanup() error
- func (m *HTTPSBackendMatcher) Match(r *http.Request) bool
- func (m *HTTPSBackendMatcher) MatchWithError(r *http.Request) (bool, error)
- func (m *HTTPSBackendMatcher) Provision(ctx caddy.Context) error
- func (m *HTTPSBackendMatcher) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
- type LocalMatcher
- func (LocalMatcher) CaddyModule() caddy.ModuleInfo
- func (m *LocalMatcher) Cleanup() error
- func (m *LocalMatcher) Match(r *http.Request) bool
- func (m *LocalMatcher) MatchWithError(r *http.Request) (bool, error)
- func (m *LocalMatcher) Provision(ctx caddy.Context) error
- func (m *LocalMatcher) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
- type ModuleConfig
- type RemoteMatcher
- func (RemoteMatcher) CaddyModule() caddy.ModuleInfo
- func (m *RemoteMatcher) Cleanup() error
- func (m *RemoteMatcher) Match(r *http.Request) bool
- func (m *RemoteMatcher) MatchWithError(r *http.Request) (bool, error)
- func (m *RemoteMatcher) Provision(ctx caddy.Context) error
- func (m *RemoteMatcher) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
- type Upstreams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Endpoint is the base URL of the Pangolin integration API.
Endpoint string
// APIKey is the bearer token in the form "<id>.<secret>".
APIKey string
// OrgID is the Pangolin organization to list resources from.
OrgID string
// Refresh is the poll interval.
Refresh time.Duration
MethodRefresh time.Duration
MaxStale time.Duration
InitialTimeout time.Duration
// InsecureSkipVerify disables TLS verification for API requests.
InsecureSkipVerify bool
AllowHTTP bool
// Sites restricts which Pangolin sites' targets are considered locally
// reachable. Matches site name or niceId, case-insensitive. Empty means
// all sites are considered local.
Sites []string
// Resolvers are DNS server addresses used to resolve the Pangolin
// endpoint, bypassing the system resolver (useful with split-horizon
// DNS where the endpoint hostname would resolve back to this Caddy).
// Port 53 is assumed if not specified. Empty means system resolver.
Resolvers []string
}
Config is the resolved configuration for a shared Pangolin poller. Modules with identical configs share a single poller instance.
type HTTPSBackendMatcher ¶
type HTTPSBackendMatcher struct {
ModuleConfig
}
HTTPSBackendMatcher matches requests whose Pangolin resource has at least one locally reachable target with method "https". Use it to route those hosts through a reverse_proxy with an HTTPS transport.
func (HTTPSBackendMatcher) CaddyModule ¶
func (HTTPSBackendMatcher) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*HTTPSBackendMatcher) Cleanup ¶
func (m *HTTPSBackendMatcher) Cleanup() error
Cleanup implements caddy.CleanerUpper.
func (*HTTPSBackendMatcher) Match ¶
func (m *HTTPSBackendMatcher) Match(r *http.Request) bool
Match implements caddyhttp.RequestMatcher.
func (*HTTPSBackendMatcher) MatchWithError ¶
func (m *HTTPSBackendMatcher) MatchWithError(r *http.Request) (bool, error)
MatchWithError reports whether the request's host maps to a Pangolin resource with at least one locally reachable HTTPS target.
func (*HTTPSBackendMatcher) Provision ¶
func (m *HTTPSBackendMatcher) Provision(ctx caddy.Context) error
Provision implements caddy.Provisioner.
func (*HTTPSBackendMatcher) UnmarshalCaddyfile ¶
func (m *HTTPSBackendMatcher) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
UnmarshalCaddyfile implements caddyfile.Unmarshaler.
type LocalMatcher ¶ added in v0.3.0
type LocalMatcher struct {
ModuleConfig
}
func (LocalMatcher) CaddyModule ¶ added in v0.3.0
func (LocalMatcher) CaddyModule() caddy.ModuleInfo
func (*LocalMatcher) Cleanup ¶ added in v0.3.0
func (m *LocalMatcher) Cleanup() error
func (*LocalMatcher) MatchWithError ¶ added in v0.3.0
func (m *LocalMatcher) MatchWithError(r *http.Request) (bool, error)
func (*LocalMatcher) Provision ¶ added in v0.3.0
func (m *LocalMatcher) Provision(ctx caddy.Context) error
func (*LocalMatcher) UnmarshalCaddyfile ¶ added in v0.3.0
func (m *LocalMatcher) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
type ModuleConfig ¶
type ModuleConfig struct {
// Base URL of the Pangolin integration API, e.g. https://pangolin-api.example.com
Endpoint string `json:"endpoint,omitempty"`
// API key in the form "<id>.<secret>" (sent as Authorization: Bearer).
APIKey string `json:"api_key,omitempty"`
// The Pangolin organization ID to list resources from.
OrgID string `json:"org_id,omitempty"`
// How often to refresh the resource map. Default: 60s.
Refresh caddy.Duration `json:"refresh,omitempty"`
MethodRefresh caddy.Duration `json:"method_refresh,omitempty"`
MaxStale caddy.Duration `json:"max_stale,omitempty"`
InitialTimeout caddy.Duration `json:"initial_timeout,omitempty"`
// Skip TLS verification when talking to the Pangolin API.
InsecureSkipVerify bool `json:"insecure_skip_verify,omitempty"`
AllowHTTP bool `json:"allow_http,omitempty"`
// Sites whose targets are locally reachable (name or niceId,
// case-insensitive). Targets on other sites are treated as remote.
// Empty means all sites are local.
Sites []string `json:"sites,omitempty"`
// Resolvers are DNS server addresses (port 53 assumed) used to resolve
// the Pangolin endpoint instead of the system resolver. Set this when
// split-horizon DNS would resolve the endpoint back to this Caddy.
Resolvers []string `json:"resolvers,omitempty"`
// contains filtered or unexported fields
}
ModuleConfig holds the user-facing configuration shared by all caddy-pangolin modules.
type RemoteMatcher ¶
type RemoteMatcher struct {
ModuleConfig
}
RemoteMatcher matches requests whose Pangolin resource exists but has no locally reachable targets (all its targets live on sites excluded by the `sites` filter). Use it to route those hosts back through the public Pangolin instance.
func (RemoteMatcher) CaddyModule ¶
func (RemoteMatcher) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*RemoteMatcher) Cleanup ¶
func (m *RemoteMatcher) Cleanup() error
Cleanup implements caddy.CleanerUpper.
func (*RemoteMatcher) Match ¶
func (m *RemoteMatcher) Match(r *http.Request) bool
Match implements caddyhttp.RequestMatcher.
func (*RemoteMatcher) MatchWithError ¶
func (m *RemoteMatcher) MatchWithError(r *http.Request) (bool, error)
MatchWithError reports whether the request's host maps to a Pangolin resource that has no locally reachable targets.
func (*RemoteMatcher) Provision ¶
func (m *RemoteMatcher) Provision(ctx caddy.Context) error
Provision implements caddy.Provisioner.
func (*RemoteMatcher) UnmarshalCaddyfile ¶
func (m *RemoteMatcher) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
UnmarshalCaddyfile implements caddyfile.Unmarshaler.
type Upstreams ¶
type Upstreams struct {
ModuleConfig
}
Upstreams is a dynamic upstream source that resolves the backend for a request by matching its Host against Pangolin resources.
func (Upstreams) CaddyModule ¶
func (Upstreams) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*Upstreams) GetUpstreams ¶
GetUpstreams implements reverseproxy.UpstreamSource by resolving the request's host against the current Pangolin resource map.