webendpoints

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package webendpoints provides helpers for composing web-endpoint hostnames.

A web endpoint is a named HTTP tunnel that ShellHub exposes on behalf of a device. Each endpoint is reachable at an address that is formed by joining an address token (typically a short random slug) and a domain:

<address>.<domain>   e.g. abc123.tunnel.example.com

The domain itself can be configured at two levels: a per-namespace "preferred" override and a system-wide fallback. The helpers in this package centralise that logic so that every caller (nginx template generation, API responses, agent-side URL construction) derives the hostname the same way.

Note: the nginx-template duplication is by design — keeping the template and the Go logic in sync is easier than introducing an indirection layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Domain

func Domain(preferred, fallback string) string

Domain returns the effective domain for a web endpoint.

When preferred is non-empty it is returned as-is, giving namespace administrators the ability to customise the domain without changing the system-wide default. Otherwise fallback (the system-level default) is returned. Both values may be empty strings; callers must handle that case.

func Host

func Host(address, domain string) string

Host builds the full hostname for a web endpoint.

The result is "<address>.<domain>" when domain is non-empty, or just "<address>" when domain is empty. The trailing-dot regression guard ensures that an empty domain never produces a string ending in ".".

Types

This section is empty.

Jump to

Keyboard shortcuts

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