transport

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 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 transport connects pool machines. It carries byte streams; join pinning and mutual TLS are layered above it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialContext

func DialContext(ctx context.Context, network, addr string) (net.Conn, error)

DialContext adapts pool transports to net/http without moving TLS below the transport. Pool endpoints always use TCP.

func DialTLS

func DialTLS(ctx context.Context, addr string, cfg *tls.Config) (*tls.Conn, error)

DialTLS wraps a transport connection with the pool's existing TLS configuration. The caller's deadline covers dialing and the handshake.

Types

type Direct

type Direct struct{}

Direct uses the operating system's TCP sockets on the LAN.

func (Direct) Address

func (Direct) Address(_ context.Context, port string) (string, error)

func (Direct) Dial

func (Direct) Dial(ctx context.Context, addr string) (net.Conn, error)

func (Direct) Listen

func (Direct) Listen(ctx context.Context, addr string) (net.Listener, error)

type Tailscale

type Tailscale struct{ Direct }

Tailscale uses system tailscaled (including clients managed by Headscale). It shares Direct's sockets: the OS routes tailnet addresses through the installed client. Userspace-only tailscaled networking is not supported.

func (Tailscale) Address

func (Tailscale) Address(ctx context.Context, port string) (string, error)

func (Tailscale) CheckServe

func (Tailscale) CheckServe(ctx context.Context) (string, error)

CheckServe checks the head's connection, MagicDNS and HTTPS capability without changing its Serve configuration or prompting interactively.

func (Tailscale) Serve

func (Tailscale) Serve(ctx context.Context, port int) (string, error)

Serve has tailscaled serve https://<this machine's tailnet name>:port/ to the tailnet, with a certificate for that name, from http://127.0.0.1:port, until Unserve. It returns that URL.

func (Tailscale) Unserve

func (Tailscale) Unserve(ctx context.Context, port int) error

Unserve stops serving port.

type Transport

type Transport interface {
	Listen(ctx context.Context, addr string) (net.Listener, error)
	Dial(ctx context.Context, addr string) (net.Conn, error)
	Address(ctx context.Context, port string) (string, error)
}

Transport provides the head's listener, a node's outbound connections, and the local address advertised in join tokens. Closing a listener or connection releases it; cancelling ctx interrupts Listen and Dial setup.

func ForAddress

func ForAddress(addr string) Transport

ForAddress selects the socket transport for an endpoint. System tailscaled handles routing, including DNS aliases and custom Headscale prefixes that look like ordinary TCP addresses. Wildcard listeners serve both LAN and tailnet interfaces without changing the token wire format.

func New

func New(name string) (Transport, error)

New selects the transport named by token create's --transport flag.

Jump to

Keyboard shortcuts

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