loopbackhost

package
v0.179.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package loopbackhost is the one rule for a Host header that names the loopback interface (cockpit#req:host-header-check). Cockpit's guard and the dashboard's own routes on the same listener both ask it, so that a page which rebinds DNS to the loopback address is refused by one rule and not by two that could drift apart.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Named

func Named(host string) bool

Named reports whether a host (a Host header's host part, or the host of a listen address) names the loopback interface: exactly the name localhost (in any case, with no trailing dot), any IPv4 address of 127.0.0.0/8, and the IPv6 address ::1 in any spelling. The one rule serves the Host check and the daemon's own --listen check, so a daemon cannot listen on a loopback form that its own health check then refuses. Anything else, including a trailing dot name, is refused.

func Request

func Request(request *http.Request) bool

Request reports whether request's Host header names a loopback host.

func Split

func Split(value string) (host, port string)

Split separates a Host header into its host name and optional port. A bracketed IPv6 literal loses its brackets. An empty or malformed value yields an empty host, which Named refuses, as does a port that is present but not a number.

Types

This section is empty.

Jump to

Keyboard shortcuts

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