siterouting

package
v1.164.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package siterouting is the Site routing integration's items (#2659): every hostname the platform serves for sites and applications, computed from what is stored, never from what a call site says it changed. Each environment's address on the pages domain, each application's page origin, and each added domain, as the request's hosts entries.

Index

Constants

View Source
const (
	KindPages       = "pages"
	KindApplication = "application"
	KindDomain      = "domain"
)

The kinds of hostname.

Variables

View Source
var ErrNoRouting = errors.New("no site routing script is chosen")

ErrNoRouting is a retry with no routing script chosen.

Functions

This section is empty.

Types

type Lookup

type Lookup struct {
	Service    *integration.Service
	Addressing func() site.Addressing
}

Lookup is the Site routing integration as the places that show a hostname read it: each hostname's status while a script is chosen, and a retry. Its Service is set once the integrations are wired; nil, or a Lookup with no Service, shows nothing and retries nothing.

func (*Lookup) Domains

func (l *Lookup) Domains(ctx context.Context, admin bool, domains []site.Domain) []site.Domain

Domains is domains with each one's status, as they are when no script is chosen. The caller's slice is not changed.

func (*Lookup) Of

func (l *Lookup) Of(ctx context.Context, admin bool, hosts []string) map[string]*site.Routing

Of is each host's status, nil when no script is chosen. An administrator reads the run error of a host the script itself failed; anyone else reads one sentence. A read that fails shows nothing rather than failing the page.

func (*Lookup) Origin

func (l *Lookup) Origin(ctx context.Context, admin bool, address string) *site.Routing

Origin is the status of an address's hostname, nil for none.

func (*Lookup) Refusal

func (*Lookup) Refusal(err error) (status int, message string)

Refusal is the HTTP status and sentence a retry Retry refused is answered with.

func (*Lookup) Retry

func (l *Lookup) Retry(ctx context.Context, admin bool, st *site.Site, domains []site.Domain) error

Retry asks the Site routing script to run again for someone who can see st and domains: at once for an administrator; for anyone else only when one of the site's hostnames failed, and not just after a run started (integration.Service.RetryFailed).

func (*Lookup) Site

func (l *Lookup) Site(ctx context.Context, admin bool, st *site.Site, domains []site.Domain) (routed []site.Domain, byEnv map[string]*site.Routing)

Site is a site's domains with each one's status, and each environment's pages address status by environment, the second nil when no script is chosen.

type Source

type Source struct {
	Sites      func(ctx context.Context) ([]site.Site, error)
	Domains    func(ctx context.Context) ([]site.Domain, error)
	Apps       func(ctx context.Context) ([]application.Application, error)
	Addressing func() site.Addressing
}

Source reads what the hostnames are computed from.

func (Source) Items

func (s Source) Items(ctx context.Context) ([]integration.Item, error)

Items implements integration.Source: every hostname served now, sorted by hostname. A hostname reached two ways (a domain equal to a pages address, which the claim rules refuse) is listed once, as the first way it was met.

Jump to

Keyboard shortcuts

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