Documentation
¶
Overview ¶
Package gateway connects the yabber gateway to the other modules. Each adapter implements an interface the consuming module defines, so the modules never import one another:
- yabber.CertificateSource and yabber.HTTP01Store from the acme-go certificate manager: the gateway serves certificates acme-go issues and answers its HTTP-01 challenges on port 80.
- docker-go's apps.Exposer: installed apps get a gateway site for their domain, plus a certificate when an ACME account is available. Until the certificate exists the site is served on plain HTTP only (the gateway refuses TLS hosts without a certificate); Reconcile moves it onto every listener once it is issued. With Records set, the domain also gets an address record in DNS.
Index ¶
- func Certificates(certs *acmeapi.Service) yabber.CertificateSource
- func Challenges(certs *acmeapi.Service) yabber.HTTP01Store
- type AppExposer
- func (e *AppExposer) Expose(ctx context.Context, app apps.Exposure) error
- func (e *AppExposer) Reconcile(ctx context.Context) (int, error)
- func (e *AppExposer) RunReconcile(ctx context.Context, interval time.Duration, logger *slog.Logger)
- func (e *AppExposer) Unexpose(ctx context.Context, id string) error
- type Records
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Certificates ¶
func Certificates(certs *acmeapi.Service) yabber.CertificateSource
Certificates serves the certificate manager's active certificates.
func Challenges ¶
func Challenges(certs *acmeapi.Service) yabber.HTTP01Store
Challenges answers HTTP-01 challenges for issuances the certificate manager is running, on the gateway's plain HTTP listener.
Types ¶
type AppExposer ¶
type AppExposer struct {
Gateway *yabberapi.API // changes go through the management API's lock and are saved
Server *yabber.Server // the gateway, for reading its configuration
Certs *acmeapi.Service // optional: requests certificates for exposed domains
// Covered reports whether a usable certificate covers domain. Nil asks
// Certs.
Covered func(ctx context.Context, domain string) bool
// Records, optional, publishes app domains in DNS.
Records Records
}
AppExposer publishes docker-go apps through the gateway.
func (*AppExposer) Expose ¶
Expose routes the app's domain to its published port on this host. A domain no certificate covers yet is served on the plain HTTP listeners only, and a certificate is requested for it.
func (*AppExposer) Reconcile ¶
func (e *AppExposer) Reconcile(ctx context.Context) (int, error)
Reconcile moves app sites that were waiting for a certificate onto every listener once one covers their domain, and returns how many it moved.
func (*AppExposer) RunReconcile ¶
RunReconcile calls Reconcile every interval until ctx is done.
type Records ¶
type Records interface {
Publish(ctx context.Context, domain string, log func(string))
Unpublish(ctx context.Context, domain string) error
}
Records publishes the address of an app's domain in DNS (package dns implements it for dns-go). Publish reports what it did, or why it did nothing, through log; failing to publish never fails exposing the app.