tcpin

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 13 Imported by: 1 module, 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 tcpin contains the tcpIn node implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TCPInConfig

type TCPInConfig struct {
	// Mode selects "listen" (accept connections on port) or
	// "connect" (dial out to host:port) — legacy alias of the
	// Node-RED "server" field; Server wins when set.
	Mode string `json:"mode"`
	// Server is the Node-RED connection selector: "server" listens
	// on Port, "client" dials Host:Port.
	Server string `json:"server"`
	// Host is the remote host for connect mode (default 127.0.0.1).
	Host string `json:"host"`
	// Port is the listen port (listen mode) or remote port (connect).
	Port int `json:"port"`
	// Datamode selects the output framing: "stream" (default —
	// emit each chunk, or each delimited part for utf8 with a
	// delimiter), "single" (one message with the whole buffer at
	// connection close), "length" (emit every Length bytes) or
	// "timeout" (flush the buffered data after FlushMS ms idle).
	Datamode string `json:"datamode"`
	// Datatype selects the payload type: "utf8" (string — default,
	// matching the previous always-string behavior), "buffer"
	// (raw []byte) or "base64" (base64-encoded string).
	Datatype string `json:"datatype"`
	// Newline is the stream delimiter for utf8 payloads — a pointer
	// so a blank-but-explicit "" (Node-RED 'no delimiter — emit each
	// chunk') is distinct from unset (legacy "\n" line mode).
	Newline *string `json:"newline"`
	// Trim re-attaches the delimiter to each emitted part
	// (Node-RED 're-attach' checkbox).
	Trim bool `json:"trim"`
	// Topic is stamped on emitted messages as metadata "topic".
	Topic string `json:"topic"`
	// Length is the fixed chunk size for datamode "length".
	Length int `json:"length"`
	// FlushMS is the idle flush interval (milliseconds) for
	// datamode "timeout".
	FlushMS int `json:"flushms"`
	// Base64 is a deprecated Node-RED field — decoded, unused.
	Base64 bool `json:"base64"`
	// TLS names a tlsConfig node in the same workflow; in connect
	// mode the dialed connection is upgraded to TLS with that material.
	TLS string `json:"tls"`
}

TCPInConfig holds configuration for the tcpIn node.

type TCPInNode

type TCPInNode struct {
	*nodebase.BaseNode
	// contains filtered or unexported fields
}

TCPInNode receives raw TCP data — either by listening for inbound connections or by connecting to a remote host. Received data is framed per the datamode (stream/single/length/timeout) and emitted downstream with the remote ip/port in Metadata. Accepted connections are registered in the workflow's shared tcpSessions map for tcpOut reply mode.

func NewTCPInNode

func NewTCPInNode(node nodestore.NodeInterface, config *TCPInConfig, host nodebase.NodeHost) *TCPInNode

NewTCPInNode creates a new tcpIn node

func (*TCPInNode) Execute

Execute activates the node: listen mode binds a socket and spawns an accept loop; connect mode dials and starts one reader goroutine.

func (*TCPInNode) Stop

func (n *TCPInNode) Stop() error

Stop shuts down the listener / outbound connection and every accepted session registered by this workflow's tcpIn nodebase.

func (*TCPInNode) Validate

func (n *TCPInNode) Validate() error

Validate checks the tcpIn node configuration

Jump to

Keyboard shortcuts

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