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:
- Parse serial port parameters (baud rate, parity, etc.) from the local connection address (e.g. "COM1,9600,even").
- 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.
- 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).
- If the router has NO chain (or no router at all), fall back to opening the serial port directly on the local machine.
- 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 ¶
Types ¶
This section is empty.