loopback

package
v0.264.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 3 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 loopback is THE rule for "this address is this machine": the one predicate every part of muster uses to treat plain http to the loopback interface as safe to use, and nothing else.

A request to http://localhost, http://127.0.0.1 (any of 127.0.0.0/8) or http://[::1] never leaves the machine, so a token sent over it is not in cleartext on any network, and browsers already treat such an origin as a secure context. Everything else that is plain http — a LAN address, a private range, a hostname that merely STARTS with "localhost" — is not this machine, and every caller keeps refusing it.

One rule, one place: the mirror's URL checks (internal/mirrorhost, cmd/muster-mirror), the CLI's doctor (cmd/muster) and the server's cookie policy (internal/api) all ask this package, so they cannot disagree about which addresses count.

🔴 NAMES ARE NOT RESOLVED. "localhost" is accepted by name (RFC 6761 reserves it for the loopback interface, and browsers treat it so); no other name is, however it resolves — not "localhost.", not "foo.localhost", not "localhost.example.com". An IP literal counts only when it IS a loopback address (an IPv4-mapped IPv6 one is unmapped first).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPURL

func HTTPURL(raw string) bool

HTTPURL reports whether raw is a plain http:// URL whose host is this machine's loopback interface (Host). An https URL is NOT one: callers accept https on its own terms, and this predicate answers only "is this the plain http that is safe anyway".

func Host

func Host(h string) bool

Host reports whether h names this machine's loopback interface. h is a host as a URL or a Host header carries it: a name or an IP literal, with or without a port, an IPv6 literal with or without its brackets ("[::1]:8105", "[::1]", "::1").

Types

This section is empty.

Jump to

Keyboard shortcuts

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