Proxy protocol

Protocol stores raw data in channel messages and/or proxies raw data to target servers via TCP.
flespi parses the Proxy protocol messages into a JSON object with the fields listed below in the Parameters tab.

Protocol by Gurtam that proxies raw data to target servers (up to 3 destinations) via TCP and/or stores raw data in channel messages (read more in a dedicated article). Also, the proxy channel has a nice binary/text traffic viewer integrated into Toolbox.

Note: the proxy channel does not work over UDP.

Be aware that idents assigned by the proxy protocol for incoming connections are random for each connection and do not correspond to real device IMEI or serial number.

Proxy mode

To enable the proxy mode add one or more targets. Targets are marked mandatory by default.

For mandatory targets: if a connection fails, the channel throws an error and drops an input connection.

For non-mandatory targets: if a connection fails, the channel continues data transmission to other targets.

The 'Proxy Replies Back' option is enabled by default. It means that the proxy channel will transmit replies from the corresponding target to the channel's input connection.

Store mode

If enabled, raw data packets are saved in channel messages as the 'proxy.payload.hex' parameter. If the payload size exceeds 2MB, the parameter is not registered. If target replies are enabled, then target response packets are also saved as the 'proxy.payload.hex' parameter in channel messages.

Troubleshooting

If neither store mode nor proxy mode is enabled, the proxy channel simply skips the data from the input connection. However, the channel will always save diagnostic messages about each connection opened/closed event.

The following parameters are registered in channel messages and may be used to diagnose channel issues:

peer — the channel's incoming connection ip:port.

proxy.event — the channel event:

  • 0 — data received (if store mode enabled, messages of this type will include data in 'proxy.payload.hex')
  • 1 — connection established
  • 2 — connection dropped

proxy.source — attributes a message to a particular connection:

  • 0 — event in the channel's incoming connection
  • 1 — event in target 1
  • 2 — event in target 2, etc.
channel.id
number
ID of channel that received a message
device.id
number
ID of device that received a message
device.name
string
Name of device that received a message
device.type.id
number
ID of device type of device that received a message
ident
string
Device unique identifier like serial number, IMEI, etc
peer
string
IP:port from which device connecting to the channel
protocol.id
number
ID of protocol
proxy.event
number
Channel event type: 0 - data received, 1 - connect, 2 - disconnect
proxy.payload.hex
string
Data received, in HEX format
proxy.payload.size
number
bytes
Size of data packet
proxy.source
number
Message source: 0 - channel incoming connection, 1 - target1, 2 - target2, etc
server.timestamp
number
seconds
Timestamp when server received a message
timestamp
number
seconds
Message timestamp