domain

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 12 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 domain handles the platform's base domain (§5.0.2): public IP detection, sslip.io/nip.io names and the hostnames derived from the base.

Index

Constants

This section is empty.

Variables

View Source
var WildcardServices = []string{"sslip.io", "nip.io"}

Wildcard DNS services that resolve "<a-b-c-d>.<service>" to a.b.c.d.

Functions

func GitHost

func GitHost(base string) string

GitHost is the built-in Git server's hostname (§5.8).

func IsPublic

func IsPublic(a netip.Addr) bool

IsPublic reports whether ip is routable on the internet.

func Normalize

func Normalize(d string) (string, error)

Normalize lowercases d, strips a trailing dot and validates it as a DNS name with at least two labels.

func RegistryHost

func RegistryHost(base string) string

RegistryHost is the registry's hostname for a base domain.

func Resolves

func Resolves(ctx context.Context, host, ip string) (bool, []string)

Resolves reports whether host resolves to ip (for warnings on custom domains).

func Wildcard

func Wildcard(ip, service string) string

Wildcard returns the zero-config domain for ip on service, e.g. Wildcard("203.0.113.10", "sslip.io") = "203-0-113-10.sslip.io".

func WildcardService

func WildcardService(base string) (string, bool)

WildcardService reports whether base is exactly "<a-b-c-d>.<service>" and returns the service.

Types

type Detector

type Detector struct {
	// Override is used as-is when set (--public-ip).
	Override string
	// Endpoints return the caller's address as plain text.
	Endpoints []string
	Client    *http.Client
	TTL       time.Duration
	// contains filtered or unexported fields
}

Detector finds the host's public IPv4 address and caches it.

func NewDetector

func NewDetector(override string) *Detector

func (*Detector) PublicIP

func (d *Detector) PublicIP(ctx context.Context) (string, error)

PublicIP returns the cached address, detecting it when stale.

type Endpoints

type Endpoints struct {
	BaseDomain   string `json:"baseDomain"`
	DashboardURL string `json:"dashboardUrl"`
	RegistryHost string `json:"registryHost"`
}

Endpoints are the public addresses derived from the base domain.

type Service

type Service struct {

	// HTTPSPort is appended to URLs when it is not 443 (development).
	HTTPSPort string
	// DevURL is the dashboard URL before a base domain exists.
	DevURL string
	// DevRegistryHost is the registry hostname before a base domain exists.
	DevRegistryHost string
	// contains filtered or unexported fields
}

Service owns the base domain setting and tells listeners when it changes.

func NewService

func NewService(st *store.Store, httpsPort, devURL, devRegistryHost string) *Service

func (*Service) Base

func (s *Service) Base() string

Base returns the base domain ("" until set).

func (*Service) Endpoints

func (s *Service) Endpoints() Endpoints

func (*Service) Load

func (s *Service) Load(ctx context.Context) error

func (*Service) OnChange

func (s *Service) OnChange(fn func(Endpoints))

OnChange registers fn, called after every successful Set.

func (*Service) Set

func (s *Service) Set(ctx context.Context, base string) (Endpoints, error)

Set validates, stores and announces a new base domain.

Jump to

Keyboard shortcuts

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