serial

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 19 Imported by: ? 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 serial implements a handler for serial port connections in TNET.

The serial handler operates in two distinct modes:

Mode 1 — Hop-based forwarding (h.hop != nil)

When a hop is configured (typically via the -F CLI flag for forward proxies), the handler selects a target node from the hop and forwards traffic through that target's serial port. The forwarding path is:

  1. Parse serial port parameters (baud rate, parity, etc.) from the local connection address (e.g. "COM1,9600,even").
  2. Override the port NAME with the target node's address — the target specifies WHICH serial device to use, while the local address specifies HOW to configure it.
  3. Attempt to dial through the router's chain using network "serial". If a chain IS configured, it handles the actual transport (e.g. TCP/TLS/WS to a remote host, then a serial connector at the far end).
  4. If the router has NO chain (or no router at all), fall back to opening the serial port directly on the local machine.
  5. Bidirectional data pipe between the client connection and the serial port.

Mode 2 — Direct proxy (h.hop == nil)

Without a hop, the handler acts as a simple pass-through: it dials the router with the sentinel address "@" (meaning "local"), then pipes data between the client connection and the router connection.

Traffic recording

Raw traffic is recorded per-packet via recorderConn. Each successful Read/Write is logged with optional direction markers, timestamps, and hex dumps (controlled by RecorderOptions).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(opts ...handler.Option) handler.Handler

NewHandler creates a new serial handler with the given options. The handler must be initialized via Init() before use.

Types

This section is empty.

Jump to

Keyboard shortcuts

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