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 ¶
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 ¶
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 ¶
IsForwardedByMountProxy reports whether the request arrived through a mount proxy, i.e. it carries the hop header.
func ValidateURL ¶
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.