epaddr

package
v1.170.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 5 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 epaddr is where an endpoint answers (#2822): the one computation of an endpoint's URLs, which manage_script handler_list's url and an application's environment cards both read, so the two cannot disagree.

An application endpoint answers in every environment of its application: on the platform's own host at /endpoints/<name> for the last environment and at /environments/<env>/endpoints/<name> for any other (#2696); on the application's page origin and the domains mapped to the application, for the last environment, at /endpoints/<name> and, for the endpoint named like the application, at the root (#2559); and on the address of each site environment that is a part of the application at /endpoints/<name>, running the application environment of the site environment's name (#2679, #2709).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForApplication

func ForApplication(ctx context.Context, s Source, a *application.Application) map[string][]Endpoint

ForApplication is, by environment name, the endpoints each environment of a serves and the URLs each answers at there; every environment is present, with an empty list when the application holds no endpoint. A script whose bindings cannot be read is left out.

func PlatformURL

func PlatformURL(baseURL string, b *epbinding.Binding, env string) string

PlatformURL is where a binding answers on the platform's own host in an application environment: env "" is the last, served at /endpoints/<name>. manage_script handler_list reports this as url.

func URLs

func URLs(b *epbinding.Binding, env string, last bool, h Hosts) []string

URLs is every URL a binding answers at in environment env; last says it is the application's last environment.

Types

type Endpoint

type Endpoint struct {
	Name     string   `json:"name" example:"research"`
	Script   string   `json:"script" example:"research-api"`
	Methods  []string `json:"methods" example:"GET"`
	AuthMode string   `json:"auth_mode" example:"public"`
	Path     string   `json:"path" example:"/{route...}"`
	URLs     []string `json:"urls"`
}

Endpoint is one endpoint an application environment serves, and every URL it answers at there.

type Hosts

type Hosts struct {
	// BaseURL is the platform's public address, "" for none.
	BaseURL string
	// App is the application's name: the endpoint of that name answers at
	// the root of its page origins.
	App string
	// PageOrigins are the application's page origin, when the deployment has
	// a pages domain, and the origins of the domains mapped to it. They run
	// the last environment.
	PageOrigins []string
	// Sites are the origins of the application's site environment parts, by
	// the site environment's name, which is the application environment they
	// run.
	Sites map[string][]string
}

Hosts is every origin an application's endpoints answer on.

type Source

type Source struct {
	// ByScript is a script's bindings.
	ByScript func(ctx context.Context, scriptID string) ([]epbinding.Binding, error)
	// ScriptName is a script's name, "" when unknown.
	ScriptName func(ctx context.Context, scriptID string) string
	// Hosts is the origins the application answers on.
	Hosts func(ctx context.Context, a *application.Application) Hosts
}

Source is what the endpoints of an application are read from.

Jump to

Keyboard shortcuts

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