console

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultEscapeChar byte = 0x1D // Ctrl+]

Variables

This section is empty.

Functions

func FormatEscapeChar

func FormatEscapeChar(b byte) string

FormatEscapeChar returns a human-readable representation of the escape byte.

func HandleResize

func HandleResize(localFd, remoteFd uintptr) func()

HandleResize propagates the initial terminal size from localFd to remoteFd and listens for SIGWINCH to relay subsequent resize events. Returns a cleanup function that stops the signal handler.

func ParseEscapeChar

func ParseEscapeChar(s string) (byte, error)

ParseEscapeChar parses the --escape-char flag value. It accepts:

  • Caret notation for control characters: "^]", "^A", "^C", etc.
  • A single printable or control character (raw byte).

func Relay

func Relay(rw io.ReadWriter, escapeKeys []byte) error

Relay runs bidirectional I/O between the user terminal and the remote. rw can be a PTY (*os.File) or a Unix socket (net.Conn) — any io.ReadWriter. escapeKeys is the byte sequence that triggers a detach (e.g. {0x1D, '.'}). Returns nil on clean disconnect (escape sequence, EOF, or EIO).

The caller is responsible for closing the underlying connection after Relay returns, which unblocks the remaining goroutine.

Types

This section is empty.

Jump to

Keyboard shortcuts

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