loopbackhost

package
v0.175.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 header's host part names the loopback interface. Only the three names localhost, 127.0.0.1 and ::1 (written [::1] in a Host header) qualify; an address such as 127.0.0.2 is refused like any other host.

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