Passthrough Documentation

Passthrough is a lightweight bridge application that connects a Terminal Node Controller (TNC) to multiple TCP clients. The application can connect to the TNC using either TCP or serial interfaces. Any data received from the TNC is broadcast to all connected clients, while data sent by clients is forwarded to the TNC.

An optional --send-delay flag introduces a turnaround delay before client data is forwarded to the TNC after a received frame. This feature is especially useful for preventing data collisions in environments where precise timing is critical.

In addition, the --tcp-broadcast-port flag allows you to open a dedicated one‑way broadcast port. When set, all frames passing through the bridge are also sent out via this port. Note that clients connecting to the broadcast port will only receive data – any data sent to this port is ignored.

Table of Contents

Overview

The Passthrough application serves as a bidirectional bridge between a TNC device and TCP clients. It supports two primary connection methods to the TNC:

Data received from the TNC is forwarded to all connected TCP clients. Similarly, any data received from a client is sent to the TNC. If a frame is just received from the TNC, a configurable turnaround delay (using --send-delay) is applied before sending new frames from a client to the TNC.

Additionally, using the --tcp-broadcast-port option, you can enable a dedicated one‑way broadcast channel. All frames passing through the bridge are also sent out on the specified broadcast port.

KISS Framing

Passthrough uses the KISS (Keep It Simple, Stupid) protocol for framing data. Each frame is delimited by a special flag byte (0xC0). The application extracts complete frames – those that start and end with the flag – and buffers incomplete data until the frame is complete.

Installation & Build

To build the Passthrough application, ensure that you have Go installed on your system. Then, compile the program using the following command:

go build -o passthrough passthrough.go
  

Command‑Line Options

The table below lists all available command‑line options, their descriptions, and default values:

Flag Description Default Value
--tnc-connection-type Connection type for the TNC (tcp or serial). tcp
--tnc-host TCP host for the TNC (used when --tnc-connection-type is tcp). 127.0.0.1
--tnc-port TCP port for the TNC (used when --tnc-connection-type is tcp). 9001
--tnc-serial-port Serial port for the TNC (used when --tnc-connection-type is serial, e.g. /dev/ttyUSB0 or COM3). empty
--tnc-baud Baud rate for the TNC serial connection. 115200
--client-listen-port TCP port on which the application listens for client connections. 5010
--send-delay Delay (in milliseconds) before sending frames to the TNC after a frame has been received (i.e. turnaround delay). Specifies the minimum time that must elapse before client data is forwarded. 0
--tcp-read-deadline For TCP TNC connections only: the maximum time (in seconds) to wait for a complete frame from the TNC. If no complete frame is received within this period, the connection is considered stalled and will be reestablished. 600
--tcp-broadcast-port TCP port to broadcast all frames in a one‑way fashion. If set (non‑zero), all frames passing through the bridge are additionally sent out on this port. Clients connecting to this port will only receive data. none (disabled)

Examples

Example 1: TCP Connection with Default Settings

Run Passthrough using a TCP connection to the TNC with default host/port options, while listening for client connections on port 5010:

go run passthrough.go
  

Example 2: Serial Connection to TNC

In this example, the TNC is accessed via a serial interface (e.g. /dev/ttyUSB0 on Unix or COM3 on Windows) at 115200 baud:

go run passthrough.go --tnc-connection-type=serial --tnc-serial-port=/dev/ttyUSB0 --tnc-baud=115200
  

Example 3: Enabling a Turnaround Delay

The following command configures a 100 millisecond delay before sending any client data to the TNC after receiving a frame:

go run passthrough.go --send-delay=100
  

Example 4: Setting a Custom TCP Read Deadline

This command sets a custom TCP read deadline of 300 seconds. If no complete frame is received from the TCP TNC within this time, the connection will be reset:

go run passthrough.go --tcp-read-deadline=300
  

Example 5: Enabling the TCP Broadcast Port

The following command opens a dedicated one‑way broadcast port on 7000. All frames passing through the bridge are also sent to any clients connected on port 7000:

go run passthrough.go --tcp-broadcast-port=7000
  

Additional Notes

Contact & Support

For further questions, bug reports, or to contribute to the Passthrough project, please contact the project maintainer or visit the source repository.