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 ¶
- Variables
- func GitHost(base string) string
- func IsPublic(a netip.Addr) bool
- func IsWildcardHost(h string) bool
- func Normalize(d string) (string, error)
- func NormalizeHost(d string) (host string, wildcard bool, err error)
- func RegistryHost(base string) string
- func Resolves(ctx context.Context, host, ip string) (bool, []string)
- func Wildcard(ip, service string) string
- func WildcardService(base string) (string, bool)
- type Detector
- type Endpoints
- type Service
Constants ¶
This section is empty.
Variables ¶
var WildcardServices = []string{"sslip.io", "nip.io"}
Wildcard DNS services that resolve "<a-b-c-d>.<service>" to a.b.c.d.
Functions ¶
func IsWildcardHost ¶ added in v0.5.0
IsWildcardHost reports whether a host is *.name.
func Normalize ¶
Normalize lowercases d, strips a trailing dot and validates it as a DNS name with at least two labels.
func NormalizeHost ¶ added in v0.5.0
NormalizeHost is Normalize for the host of a service's domain, which may be a wildcard: one leading "*." label and a name below it, so *.example.com and *.sub.example.com. A wildcard covers exactly one label (as its certificate does): *.example.com is not example.com or a.b.example.com.
func RegistryHost ¶
RegistryHost is the registry's hostname for a base domain.
func Wildcard ¶
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 ¶
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 ¶
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.