transport

package
v1.17.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TransportSideUnknown  = SideUnknown
	TransportSideProvider = SideProvider
	TransportSideSSH      = SideSSH
	TransportSideParent   = SideParent
)
View Source
const (
	TransportCloseUnknown           = CloseUnknown
	TransportClosePeerEOF           = ClosePeerEOF
	TransportCloseContextCancelled  = CloseContextCancelled
	TransportCloseLocalShutdown     = CloseLocalShutdown
	TransportCloseProviderExit      = CloseProviderExit
	TransportCloseProviderError     = CloseProviderError
	TransportCloseSSHTransportError = CloseSSHTransportError
	TransportCloseSessionExit       = CloseSessionExit
	TransportCloseKeepaliveTimeout  = CloseKeepaliveTimeout
)

Variables

This section is empty.

Functions

func LogClose

func LogClose(info CloseInfo, metadata LogMetadata)

func RunManaged

func RunManaged(opts RunManagedOptions) error

Types

type Addr

type Addr struct {
	NetworkName string
	RemoteName  string
}

Addr is a stable diagnostic address for a synthetic connection.

func NewAddr

func NewAddr(remote string) Addr

func (Addr) Network

func (a Addr) Network() string

func (Addr) String

func (a Addr) String() string

type Callback

type Callback func(ctx context.Context, stdin io.Reader, stdout io.Writer) error

type CallbackConnOptions

type CallbackConnOptions struct {
	LocalAddr  net.Addr
	RemoteAddr net.Addr
}

type CloseInfo

type CloseInfo struct {
	Reason CloseReason
	Err    error
	Side   Side
}

func Classify

func Classify(side Side, err error, parent context.Context) CloseInfo

type CloseReason

type CloseReason string
const (
	CloseUnknown           CloseReason = "unknown"
	ClosePeerEOF           CloseReason = "peer_eof"
	CloseContextCancelled  CloseReason = "context_cancelled"
	CloseLocalShutdown     CloseReason = "local_shutdown"
	CloseProviderExit      CloseReason = "provider_exit"
	CloseProviderError     CloseReason = "provider_error"
	CloseSSHTransportError CloseReason = "ssh_transport_error"
	CloseSessionExit       CloseReason = "session_exit"
	CloseKeepaliveTimeout  CloseReason = "keepalive_timeout"
)

type CloseWriter

type CloseWriter interface {
	CloseWrite() error
}

CloseWriter is optionally implemented by transports that support half-close.

type LogMetadata

type LogMetadata struct {
	Provider      string
	Mode          string
	Workspace     string
	TransportImpl string
}

type ManagedConn

type ManagedConn interface {
	net.Conn
	Wait() error
}

ManagedConn is a net.Conn with an observable terminal result.

func OpenCallbackConn

func OpenCallbackConn(
	ctx context.Context,
	callback Callback,
	opts CallbackConnOptions,
) (ManagedConn, error)

func StartProcessConn

func StartProcessConn(ctx context.Context, spec ProcessSpec) (ManagedConn, error)

type PersistentLifecycle

type PersistentLifecycle struct {
	// contains filtered or unexported fields
}

func NewPersistentLifecycle

func NewPersistentLifecycle(parent context.Context) (*PersistentLifecycle, context.Context)

NewPersistentLifecycle derives a cancellable context from parent and returns it alongside the lifecycle that controls it.

func (*PersistentLifecycle) Close

func (l *PersistentLifecycle) Close(info CloseInfo)

func (*PersistentLifecycle) CloseInfo

func (l *PersistentLifecycle) CloseInfo() CloseInfo

func (*PersistentLifecycle) Done

func (l *PersistentLifecycle) Done() <-chan struct{}

type ProcessInfo

type ProcessInfo interface {
	PID() int
}

ProcessInfo is optionally implemented by process-backed transports.

type ProcessSpec

type ProcessSpec struct {
	Command []string
	Env     []string
	Dir     string
	Stderr  io.Writer

	LocalAddr  net.Addr
	RemoteAddr net.Addr
}

type RunManagedOptions

type RunManagedOptions struct {
	Parent        context.Context
	Conn          ManagedConn
	Handler       func(context.Context) error
	Metadata      LogMetadata
	TransportSide Side
}

type Side

type Side string
const (
	SideUnknown  Side = "unknown"
	SideProvider Side = "provider"
	SideSSH      Side = "ssh"
	SideParent   Side = "parent"
)

Jump to

Keyboard shortcuts

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