Skip to main content

PingServer

PingServer is the server-side endpoint of Ping wire v2. It handles a peer Echo Request upstream and delivers the inner IPv4 packet upstream once. With send-replies: true, it first returns an exact Echo Reply downstream. Reply generation is disabled by default. Local data in the reverse direction starts a new Echo Request; it never modifies an unrelated Echo Reply.

After decoding an Echo Request, inner packets are forwarded upstream on the arrival worker. Correlation, replay checks and any generated Echo Reply also stay on that worker; the shared tracker does not require transport-flow affinity. Inner fragments are forwarded immediately with their bytes and boundaries intact, without waiting for the leading fragment. A later stateful consumer establishes its own flow ownership. Unrelated or unmatched ICMP retains its packet bytes.

TunDevice -> PingClient -> RawSocket
RawSocket -> PingServer -> TunDevice
PingServer callbackBehavior
upstream peer requestIf send-replies is true, build/send a type-0 reply downstream; strip and forward the request upstream once.
upstream matching replyConsume as acknowledgement.
downstream plain packetBuild a type-8 request; forward downstream.

This is a pure packet tunnel with no connection line state. One synchronized node-wide tracker owns a bounded 1024-entry outstanding ring and 1024-entry replay ring. Device worker affinity is not correlation identity, so a reply or duplicate request may match on a different packet-line WID.

False or omission of send-replies skips reply allocation, copying, and transmission. The endpoints choose this setting independently; request tracking and replay suppression remain active, and incoming correlated replies are consumed regardless of the local setting. Data delivery does not wait for a reply. Duplicate peer requests deliver their inner data once and get another reply only when send-replies is true.

Settings​

{
"name": "ping-server",
"type": "PingServer",
"settings": {
"local-ipv4": "203.0.113.20",
"peer-ipv4": "198.51.100.10",
"send-replies": false,
"identifier": "random",
"sequence-start": 1,
"ttl": 64,
"tos": 0
},
"next": "tun-in"
}
SettingRequiredDefaultDescription
local-ipv4yes—Local source of requests/replies.
peer-ipv4yes—Request destination and expected source of peer carrier traffic.
send-repliesnofalseBoolean. Send exact Echo Replies for received peer requests when true; false or omission skips reply generation.
identifierno"random"Stable local request-session ID. Integer 0..65535 is a deterministic override.
sequence-startno1First local request sequence, 0..65535; wrap is valid.
ttlno64Locally generated packet TTL. Integer 0..255.
tosno0Local request TOS. Integer 0..255; replies copy the peer request TOS.

Reverse local-ipv4 and peer-ipv4 on PingClient. The two configured identifiers are separate sessions; a reply always copies the request fields.

Echo v2 Wire Rules​

Every carrier is a fresh complete IPv4 header, ICMP Echo header, and one complete inner IPv4 packet.

  • Locally originated requests use type 8, code 0, DF set, IPv4 ID 0, and configured source/destination/TOS/TTL.
  • When send-replies is true, generated replies use type 0, code 0, reverse addresses, copy request identifier, sequence, ICMP payload length, payload bytes, and TOS; they use local TTL and clear fragmentation bits.
  • Reply IPv4 IDs are selected by a securely seeded tuple-scoped, Linux-like approximation with bounded idle perturbation. It is not a copy of a host kernel's global ID state.

Local input must be exact IPv4 and no larger than 1472 bytes. Valid inner IPv4 fragments remain supported. Fragmented/malformed/checksum-invalid outer carriers and unsupported/oversized input are dropped. Structurally valid traffic unrelated to the configured carrier tuple remains a same-direction pass-through.

The node advertises 28 bytes of left padding, produces at most 1500-byte carriers, and does not perform fragmentation, PMTU discovery, or MSS adjustment.

Packet rejection diagnostics use the network logger at ERROR level and identify the specific validation, checksum, size, headroom, or tracking failure. Each drop message includes the packet length, maximum inner/carrier lengths, wrapper overhead, and available/required left headroom, all in bytes. The five-second log gate is shared by all failure reasons, directions, and workers of each node, so it does not emit one message per rejected packet.

Breaking Migration From v1​

Ping v2 accepts only local-ipv4, peer-ipv4, send-replies, identifier, sequence-start, ttl, and tos. All v1 strategies, aliases, header reuse, ICMP-only and protocol-swap modes, source/dest, identifier-checking, XOR, roundup, and ipv4-id-start are removed and rejected with a migration error.

Update both peers together and reverse their configured addresses. Version 2 is not wire-compatible with the removed v1 formats.

Correct ICMP Echo structure does not make arbitrary high-rate tunnel traffic undetectable; timing, volume, payload properties, and network policy still matter.

Node Metadata​

Source-backed metadata:

PropertyValue
version2
node flagskNodeFlagNone
can_have_prevtrue
can_have_nexttrue
layer_groupkNodeLayer3
layer_group_prev_nodekNodeLayer3
layer_group_next_nodekNodeLayer3
required_padding_left28 bytes
line statenone