tailnet

package
v0.36.0-next.internal.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package tailnet implements the client side of the platform tailnet used by `vcluster platform connect slurm --stdio`. It starts an ephemeral, in-process userspace tsnet node, waits for the Slurm login proxy peer to become visible on the tailnet, dials its ssh port and pipes the connection between stdin and stdout so it can be used as an SSH ProxyCommand.

The tsnet setup mirrors loft-enterprise's pkg/agent/tailscale StartTSServer; it cannot import loft-enterprise, so the ~30 lines are replicated here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildClientHostname

func BuildClientHostname(user string) (string, error)

BuildClientHostname returns a unique per-session tailnet hostname of the form "<sanitized-os-hostname>-<rand8>.<sanitized-user>.client.slurm". A fresh random suffix per invocation is mandatory: the platform keys peer create-vs-update on hostname alone, so two live sessions sharing a hostname would steal each other's peer identity.

func RunStdio

func RunStdio(ctx context.Context, opts Options) error

RunStdio starts an ephemeral tsnet node, waits for the login proxy peer, dials its ssh port and pipes the connection between os.Stdin and os.Stdout until one side closes or ctx is cancelled. Nothing is ever written to os.Stdout except the raw SSH byte stream.

Types

type Options

type Options struct {
	// Host is the platform host (e.g. https://my.loft.host). "/coordinator/" is
	// appended to derive the tsnet control URL.
	Host string
	// AccessKey is the stored platform access key, reused verbatim as the tsnet
	// auth key. The platform appends the slurm-client group to it at creation.
	AccessKey string
	// Hostname is the unique per-session client hostname on the tailnet.
	Hostname string
	// LoginHostname is the login proxy peer to dial, e.g.
	// "ssh.<instance>.<project>.slurm".
	LoginHostname string
	// Timeout bounds how long we wait for the login peer to appear. Zero means
	// defaultPeerTimeout.
	Timeout time.Duration
	// Insecure makes the tsnet control-plane connection tolerate the platform's
	// self-signed certificate.
	Insecure bool
	// Debug emits tailnet/tsnet logs to stderr. When false all tsnet output is
	// discarded so a plain `ssh <alias>` stays quiet.
	Debug bool
}

Options configures a stdio proxy session.

Jump to

Keyboard shortcuts

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