mounts

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 5 Imported by: ? 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 mounts holds helpers shared by the components that handle workspace mounts: admission, the mounts controller, the index and the proxies that forward requests to a mount target.

Index

Constants

View Source
const (
	// HopsHeader counts how many mount targets a request has already been
	// forwarded to. A mount target may be kcp itself (that is how a workspace is
	// mounted onto another workspace), so a mount can be pointed at a path that
	// resolves back to a mount, directly or through a chain. Without a bound such
	// a request would be forwarded shard to target to shard indefinitely, holding
	// a connection at every hop.
	//
	// The mount proxy replaces this header on every hop, so a value a client sends
	// is overwritten on the first hop and can only ever deny that client's own
	// request. A value arriving from kcp is therefore the real hop count. A mount
	// target that is not kcp can strip the header, which only permits loops that
	// pass through that target.
	//
	// Components that are never a legitimate mount target reject any request
	// carrying this header outright.
	HopsHeader = "X-Kcp-Mount-Hops"

	// MaxHops is how many mount hops a single request may take. Chaining a mount
	// onto a mounted workspace is legitimate, so this allows a short chain and
	// rejects anything longer as a loop.
	MaxHops = 3
)

Variables

This section is empty.

Functions

func HopsFrom

func HopsFrom(header http.Header) int

HopsFrom returns how many mount targets the request has already been forwarded to. A missing or unparsable value counts as none, which is what a request that has not passed through a mount proxy yet looks like.

func IsForwardedByMountProxy

func IsForwardedByMountProxy(header http.Header) bool

IsForwardedByMountProxy reports whether the request arrived through a mount proxy, i.e. it carries the hop header.

func ValidateURL

func ValidateURL(raw string) (*url.URL, error)

ValidateURL parses raw as the target of a workspace mount and returns the parsed URL.

A mount target receives the identity of every caller that enters the mounted workspace, and kcp connects to it from the shard's network position. Only absolute https URLs with a host and without user info, query or fragment are therefore accepted. TLS verification against the target is mandatory and not part of this check; it is enforced by the transport.

Types

This section is empty.

Jump to

Keyboard shortcuts

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