Flokk is Norwegian for "flock": many radios acting as one, each talking to its neighbours.
flokk is a single-binary Go CLI for administering a local Meshtastic® radio node over serial, TCP or BLE. It works with the Meshtastic firmware and replaces the Python meshtastic CLI for node configuration and inspection. It is an independent project; see Trademark.
Requires node firmware 2.5 or newer.
Install
With Homebrew (macOS and Linux):
brew install --cask fiskeben/tap/flokk
Or download an archive for your platform from Releases.
From source
make build # ./flokk for this machine, version stamped from git
Other targets: make test, make race, make vet, make check (vet + race tests), make build-all (binaries for every platform in dist/; the macOS one only when run on a Mac), make release-check and make snapshot (see docs/releasing.md), make clean. Plain go build ./cmd/flokk also works.
Platforms
All three platforms build, including BLE support (tinygo bluetooth is compiled on every target):
| Target | Build |
|---|---|
| macOS | go build ./cmd/flokk (needs cgo, which the BLE stack and serial-port detection use) |
| Linux amd64 | CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ./cmd/flokk |
| Linux arm64 | CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build ./cmd/flokk |
| Windows amd64 | CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build ./cmd/flokk |
All four builds were verified to succeed. None has been run against real hardware yet; see docs/smoke-test.md for the hardware checklist.
Connecting
Pick one transport with a global flag. With none, flokk looks for a serial port.
--port <path>serial port--host <host[:port]>TCP (default port 4403)--ble <name or address>Bluetooth LE--device <name>a named device (below)
Named and current devices
To avoid passing a flag on every command, name the nodes you use and pick one as the current device:
$ flokk device add home --host 192.168.1.40
$ flokk device add hill --ble Hill_1234
$ flokk use home
Commands now connect to home (tcp:192.168.1.40).
$ flokk info # connects to home
$ flokk --device hill info # just this once
use --host 192.168.1.40(or--port,--ble) saves a current device without naming it.usealone shows which node commands connect to and why;use --clearforgets it.- Commands pick the node from, in order:
--port/--host/--ble/--device; thenFLOKK_DEVICE,FLOKK_PORT,FLOKK_HOSTorFLOKK_BLE(one of them, handy per terminal or in scripts); then the current device; then a single serial port. - When the node came from the environment or the current device, commands that change it (or
send) say which one on stderr first:using home (tcp:192.168.1.40) — the current device. Confirmation prompts start with the node they act on. - If the current device can't be reached, the command fails and says so; it never falls back to another node.
- Devices are kept in
devices.yamlin your config directory (~/Library/Application Support/flokkon macOS,~/.config/flokkon Linux), or at$FLOKK_DEVICES. A folder left by meshtastik, as flokk used to be called, is moved there on first run.
Other global flags: --json, --yes (skip confirmations), --debug, --timeout <duration> (bounds the handshake and each request, not the whole operation; 0 = per-transport default), --no-daemon (see below), --dest <node> (see Remote admin).
The daemon
Commands connect to the node through a background daemon. The first command starts it, and it keeps the node connection open between commands, so later commands start at once instead of waiting for the node's config dump. Several commands can use a node at the same time (listen -f in one terminal, send in another), and messages that arrive between listen runs are kept for the next one (up to 256). listen also shows text that other commands send through the daemon, as sent by your node.
- One daemon per user holds a connection to each node you've used (one per
--port/--host/--blevalue). A connection with no commands using it is closed after 30 minutes, and the daemon exits once it has none left. - It listens on a socket only you can open:
$FLOKK_SOCKET, else$XDG_RUNTIME_DIR/flokk.sock, elseflokk-<uid>.sockin the temporary directory. Its log sits next to the socket (.log);daemon statusshows both paths. --no-daemon, orFLOKK_NO_DAEMON=1, connects directly as before. A serial port the daemon holds can't be opened directly at the same time; runflokk daemon stopfirst.- After upgrading flokk, commands note that the daemon runs the old version until you run
flokk daemon restart.
IRC (ircmesh)
ircmesh is a second program in the same install. It serves your node as an IRC server, so you can chat on the mesh from any IRC client (irssi, WeeChat, HexChat, …). Like a bouncer, it stays connected while no client is, and you can attach several clients at once.
Then connect your IRC client to 127.0.0.1 port 6667 (/connect 127.0.0.1 6667 in irssi). It picks the node the same way flokk does (--device, --host, --port, --ble, the FLOKK_* variables, or the current device), and goes through the daemon, starting one itself if none is running.
- You are the node. Your nick is the node's long name (spaces become
_, up to 32 characters), and can't be changed from IRC. Other nodes are named the same way. A node falls back to its short name when its long name has nothing IRC allows in a nick, or is still the firmware's default (Meshtastic 1d2fshows up as_1d2f). With--long-nicks=false, nicks are short names instead, or the long name when the short name is an emoji. - Channels are the node's channels. The primary channel is named after its preset when it has no name (
#LongFast). You join every channel on connect./parthides a channel for that client only. - Other nodes are users. A node shows up in a channel once it has been heard using that channel's key: a message, a waypoint, its position or telemetry, or a direct message that isn't PKI-encrypted. It leaves all its channels after 6 hours without being heard at all (
--active), so a node that only sends position and telemetry on its primary channel stays in the secondary channels it has talked in./whois <nick>shows when it was last heard, and you can/msgany node the node knows, even an offline one. &AllNodeslists every node in the node's database, heard lately or not, except the ones it ignores. A node joins when the node first hears it and leaves when it's removed from the node DB; it doesn't age out. Like&Favorites, it exists only in ircmesh and takes no messages. Since every node you hear is in it, a node that stops being heard leaves its channels rather than quitting;/part &AllNodesbrings back the quits.- Favourites: nodes marked as favourites on the node (
flokk nodes favorite, or in the app) are voiced (+AS02) in every channel they're in, and are the members of&Favorites, a channel that exists only in ircmesh. It lists every favourite, heard lately or not, and takes no messages./mode <channel> +v <nick>or/invite <nick> &Favoritesmakes a node a favourite on the node;/mode <channel> -v <nick>or/kick &Favorites <nick>makes it stop being one. A change made in the app shows up within 10 minutes. - Messages:
/msg <nick>sends a direct message and tells you if it isn't acknowledged. In a client that shows IRCv3 reactions (message-tags), such as gamja or Goguma, a direct message also gets a ✅ when the other node acknowledges it, or a ❌ when it doesn't. A channel message gets a ✅ once the node hears a neighbour relay it (delivered to mesh); with no relay heard there is no ✅, since neighbours may still have received it without relaying. Channel messages are reliable broadcasts, so the node retries them while no neighbour relays. Long messages are split into up to three packets; anything longer is refused./meis sent as* <nick> …. Reactions and replies from the apps show up quoted. Reacting to a message in a client that sends IRCv3 reactions (+draft/react), such as gamja or Goguma, sends the reaction to the mesh as the apps' tapback on that message, even one from before a restart; the other IRC clients see it too. Meshtastic can't take a reaction back. - Mentions: a mention token from the apps (
@!<hex>) shows up as the node's current nick, as<nick>:at the start of a message so your client highlights it. Starting a message with<nick>:(any case) sends it as an app mention, as does using the nick exactly as shown later in the message. Replayed history uses the current nick too. - History: the last 100 messages per channel and per person are kept, yours included (
--historychanges how many;0keeps none). Every client that connects gets them replayed, with their original times if it supportsserver-time(irssi, WeeChat and HexChat do). A client that supports IRCv3draft/chathistory, such as gamja or Goguma, gets no replay and loads history itself instead. History is kept in memory, so it's lost when ircmesh restarts. - Traceroute:
/trace <nick>(or/quote TRACE <nick>in clients without the command) traces the route to a node and back, asflokk traceroutedoes, and answers in your server window:traceroute to AS02: Ricco → RLY1 (6.25 dB) → AS02 (-3.5 dB), then aback:line. It takes seconds to a minute; one runs at a time, as the node rate-limits them. - Telemetry: every hour (
--telemetry,0turns it off) the node's own battery, channel and air utilisation and uptime, plus its packet counts, nodes online and noise floor when the firmware reports them, are posted to your client's server window, e.g.node: battery 87% (4.05 V) · channel util 12.3% · air util tx 1.8% · uptime 3d 4h. The latest report is also in the MOTD (/motd). What the node doesn't report is left out. - Logging: ircmesh logs to stderr only when it starts and when something goes wrong.
--verboseadds a line per event (clients connecting and leaving, the node link, messages sent and their result, messages received without their text, nodes joining and leaving channels), suitable for keeping in a service log.--debugadds every IRC line and every packet, including message contents (passwords are masked). - Off this machine: with
--listen 0.0.0.0:6667or any address that isn't loopback, set a password withFLOKK_IRC_PASSWORDor--password-file, and consider--tls-cert/--tls-key.
Known gaps: messages you send from the phone app over Bluetooth don't show up in IRC (the node doesn't pass them on), but ones sent with flokk send do. While ircmesh runs the daemon, flokk daemon stop stops it only until ircmesh starts it again.
Remote admin
With --dest <node>, admin commands act on another node over the mesh instead of the one you are connected to: a solar repeater on a roof, a node at a cabin. <node> is a !hex id, a number or a name from the connected node's node list.
Setup, once per remote node:
- On the node you connect to,
flokk infoshows its public key (base64:…). - Connect to the remote node locally (USB, WiFi or Bluetooth) and allow that key:
flokk admin-key add <the key, or the name of your node>. - From then on, through your own node:
$ flokk --dest HIL1 config set lora.hop_limit 5
reaching !00000099 (Hill) over the mesh — this can take a while
Applied 1 change(s); verified.
- Supported by
info,config get/set/export/import,owner set,channel list/add/set/del/url,reboot,shutdown,factory-reset,nodes remove/favorite/unfavorite/ignore/unignore/resetandadmin-key …. Other commands refuse--dest. - The remote node must run firmware 2.5 or newer and list your node's public key in its
security.admin_key; otherwise the error says so and how to fix it. Your node must have heard the remote node's node info (it needs its public key to encrypt). - Every answer is waited for 30 seconds (
--timeoutchanges that) and each message is tried up to 3 times. Commands read only what they need (config get lora.regionreads the LoRa section); a fullconfig getorconfig exportreads every section and channel one by one, which takes a while on LoRa. - Writes are verified by reading them back, waiting for the node if it reboots. If a message needed retries, the edit is reopened and sent again, so a slow mesh cannot split it (firmware 2.8 closes an edit idle for 60 seconds). A commit that was sent but never acknowledged is reported as such: check with
config get --dest. Two things cannot be read back from a remote node, and the output says so: the coordinates of a fixed position, and its node list (nodes …reportssent). - A private key never goes over the air: a remote
config exporthas none (nor alocation, which cannot be read either), andconfig import --keys --destandconfig set --dest security.private_key|public_keyare refused. Writing a remote node's security section (admin-key,config set security.…) needs firmware 2.8 or newer on it; older firmware would replace or clear its keys. - Changes that could cut the remote node off ask first: its LoRa link settings (region, preset, frequency, channel number,
tx_enabled), its primary channel, and an admin key list without your node's key.shutdownandfactory-resetsay the node cannot be reached remotely afterwards, andnodes reset --destwithout--keep-favoriteswarns that the node forgets your node's key. Ignoring or removing your own node on a remote node is refused.
Commands
| Command | What it does |
|---|---|
info |
Show the connected node's identity and basics, including its public key (what other nodes need in their admin keys) |
nodes |
List nodes known to the connected node (FLAGS shows fav and ignored) |
nodes remove/favorite/unfavorite/ignore/unignore <node>... |
Change entries in the node list; each change is verified by re-reading it (remove of several nodes asks first) |
nodes reset [--keep-favorites] |
Clear the node list; the node reboots (nodes in a router or base role always keep favourites) |
config get [path] |
Show the whole configuration, a section, or one field (e.g. lora.region) |
config set <path> <value> [...] |
Set one or more fields in a single verified edit |
config export [-o file] |
Write a Python-compatible YAML backup |
config import <file> [--keys] |
Apply a YAML backup in a single verified edit |
channel list |
List the node's channels |
channel add <name> [--psk ...] |
Add a secondary channel in the first free slot |
channel set <index> <field> <value> |
Set a channel settings field |
channel del <index> |
Delete a secondary channel; later channels shift down |
channel url [--no-qr] [--set URL] |
Show the channel URL and QR code, or replace all channels from a URL (add-style ?add=true URLs are refused; use channel add) |
owner set <long-name> [--short X] |
Set the owner's long name, and optionally the short name |
reboot |
Ask the node to reboot (it restarts in ~5 seconds) |
shutdown |
Ask the node to power off (it shuts down in ~5 seconds) |
factory-reset [--full] |
Erase the node's configuration (--full also erases device state) |
send <text> [--to node] [--channel n] [--ack-timeout d] |
Send a text message; --to takes a !hex id, number or name (default: broadcast) |
listen [-f] [--channel n] [--json [--raw]] [--all] [--count n] |
Print the next received message and exit; -f/--follow keeps printing (the node's queued backlog, then new ones) until Ctrl-C; --all adds other packet types, --count exits after n messages, --raw adds the whole FromRadio message to each JSON line under raw |
admin-key list |
List the public keys allowed to administer the node remotely, with the node each belongs to |
admin-key add <key|node> |
Allow a key (base64:…, or a node whose public key the node list knows); at most 3 |
admin-key remove <key|node|index> |
Remove an admin key |
traceroute <node> [--hop-limit n] |
Trace the route to a node and back with the SNR of each hop (default hop limit: the node's lora.hop_limit) |
request position <node> |
Ask a node for its position |
request telemetry <node> [--type device|environment|power|local-stats] |
Ask a node for its telemetry |
ble scan [--duration d] |
Scan for nearby Meshtastic devices over BLE (directly, never through the daemon) |
device add <name> --port/--host/--ble X |
Name a node connection, for --device and use (an existing name is replaced) |
device list |
List the named devices; * marks the current one |
device remove <name> |
Forget a named device |
use [name | --port/--host/--ble X | --clear] |
Choose the node commands connect to when none is given; without arguments, show it |
daemon status |
Show whether the daemon runs, its socket and log, and the node connections it holds (with their device names) |
daemon start [--idle-timeout d] |
Start the daemon in the background unless it is running (it also starts on demand) |
daemon stop |
Stop the daemon, closing its node connections |
daemon restart [--idle-timeout d] |
Stop the daemon, then start it (e.g. after an upgrade) |
daemon run [--idle-timeout d] |
Run the daemon in the foreground, logging to the terminal |
version |
Print the version |
Run flokk <command> --help for details.
Notes
- Negative values need
--so they are not read as flags:flokk config set -- lora.tx_power -5. config getshows zero values (e.g.enabled: false) and printssecurity.private_keyas<redacted; use config export>. Ask for the field itself (config get security.private_key) to see it.config exportwrites the node's private key. The file is created with mode 0600; keep it safe.config importleaves the node's own private and public keys alone unless you pass--keys. Even with--keys, neither key is applied if either is empty or not 32 bytes in the file, because the node would then generate a new identity.config importrestoreslocationonly when the backup's merged config hasposition.fixed_position: true; Python backups of GPS nodes carry a location that is otherwise ignored (with a note).- A node with
security.is_managedset ignores local configuration, so flokk refuses changes to it, except turningsecurity.is_managedoff. - Changes that could cut the link in use (Bluetooth off or WiFi on over BLE, WiFi/network changes over TCP, the serial console off or taken over by the serial module over serial) ask for confirmation first.
listenhas no history beyond what the daemon has kept: it shows the messages that arrived while nolistenwas running (or, with--no-daemon, the few the node queued while no client was connected), then live traffic. The node hands each message to one connected client only, so if another client (an app or a home automation system) is connected at the same time they split the traffic. If the connection keeps dropping soon after each reconnect (another client taking the node's one TCP slot),listengives up with an error.tracerouteandrequestmake one attempt and wait 60 seconds for the answer (twice--timeoutwhen it is set). The firmware limits them: one traceroute per 30 seconds and one position or telemetry request per 10 seconds from a connection (flokk reports the node's refusal at once), and a node answers position requests at most every 3 minutes. A node without the asked-for sensor, or without a position to share, says it received the request but did not answer it.- Ctrl-C during a change: before the commit, flokk reports that the node may hold a partial edit (firmware 2.8 and newer saves the partial edit after 60 seconds; older firmware discards it on reboot); after the commit, it reports that the changes were committed but could not be verified. A second Ctrl-C exits at once.
Bluetooth
- On macOS the terminal app is prompted for Bluetooth permission on first BLE use. Allow it, then run the command again if needed.
- On macOS, addresses shown by
ble scanare CoreBluetooth UUIDs, not MAC addresses. Pass the name or that UUID to--ble.
Trademark
Meshtastic® is a registered trademark of Meshtastic LLC. Meshtastic software components are released under various licenses, see GitHub for details. No warranty is provided - use at your own risk.
flokk is not affiliated with or endorsed by the Meshtastic project.
Licence
GPL-3.0. See LICENSE.