meshtastic

package
v0.751.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package meshtastic decodes the Meshtastic LoRa-mesh radio packet header — the 16-byte plaintext header that prefixes every Meshtastic packet on the 868/915 MHz LoRa channel, before the AES-encrypted payload. Meshtastic is the dominant off-grid LoRa mesh-comms project, and the header is sent in the clear: decoding it from a Flipper Sub-GHz / SDR LoRa capture enumerates the nodes in mesh range (source and destination node IDs), reveals the channel hash (which channel a packet belongs to), and exposes the hop / want-ack / via-MQTT routing flags — passive mesh reconnaissance without touching the air.

Wrap-vs-native judgement

Native. The header is a fixed wire structure defined by the
Meshtastic firmware (RadioInterface.h PacketHeader, "has to exactly
match the wire layout when sent over the radio link"): little-endian
uint32 destination, uint32 source, uint32 packet ID, then a flags
byte, the channel-hash byte, and the next-hop / relay-node bytes.
Pure byte-field extraction and bit-masking — reimplemented from the
firmware, no new dependency, no shell-out.

What this covers

  • Destination and source node IDs (the !xxxxxxxx form Meshtastic displays; 0xFFFFFFFF is the broadcast address).
  • The packet ID.
  • The flags byte: hop limit (bits 0-2), want-ack (bit 3), via-MQTT (bit 4) and hop start (bits 5-7) — so hops-taken = start − limit.
  • The channel hash (the per-channel hint byte) and the next-hop / relay-node ID bytes.
  • The encrypted payload, surfaced as hex with its length.

Deliberately deferred

The payload is the AES-256-CTR-encrypted (or, for DMs, PKI-encrypted)
protobuf MeshPacket; decrypting it needs the channel pre-shared key
(or the node key pair), which is not on the wire, so it is surfaced
as ciphertext. The LoRa physical layer (CRC, coding rate, preamble)
is upstream — feed the decoded payload bytes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	To            string   `json:"to"`
	ToHex         string   `json:"to_hex"`
	Broadcast     bool     `json:"broadcast"`
	From          string   `json:"from"`
	FromHex       string   `json:"from_hex"`
	PacketID      uint32   `json:"packet_id"`
	HopLimit      int      `json:"hop_limit"`
	HopStart      int      `json:"hop_start"`
	HopsTaken     *int     `json:"hops_taken,omitempty"`
	WantAck       bool     `json:"want_ack"`
	ViaMQTT       bool     `json:"via_mqtt"`
	ChannelHash   string   `json:"channel_hash"`
	NextHop       string   `json:"next_hop"`
	RelayNode     string   `json:"relay_node"`
	PayloadLength int      `json:"payload_length"`
	PayloadHex    string   `json:"payload_hex,omitempty"`
	Notes         []string `json:"notes,omitempty"`
}

Result is the decoded Meshtastic packet header.

func Decode

func Decode(hexStr string) (*Result, error)

Decode parses a Meshtastic LoRa packet (16-byte header + encrypted payload) from hex. ':' / '-' / '_' / whitespace separators and a '0x' prefix are tolerated.

Jump to

Keyboard shortcuts

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