gateway

package
v0.0.0-...-4c003e4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 11 Imported by: 1 module, 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 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

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

func (e *AppExposer) Expose(ctx context.Context, app apps.Exposure) error

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

func (e *AppExposer) RunReconcile(ctx context.Context, interval time.Duration, logger *slog.Logger)

RunReconcile calls Reconcile every interval until ctx is done.

func (*AppExposer) Unexpose

func (e *AppExposer) Unexpose(ctx context.Context, id string) error

Unexpose removes the app's gateway site and its DNS record. Its certificate is kept; the certificate manager shows it and it can be deleted there.

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.

Jump to

Keyboard shortcuts

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