本文へ移動
AI NEWS JOURNAL
Hacker News Show HNAI NEWS / JOURNAL

Show HN: An IRC Bouncer for Meshtastic

I made an IRC bouncer that acts as a proxy to Meshtastic so that I can send and receive messages with an IRC client.Disclaimer: yes, this project makes heavy use of LLM in development. That's besides the point.It started out as a spur of the moment idea to let Claude replicate the Meshtastic CLI in Go to avoid running Python. Then a friend and I started talking and got ideas to more features and suddenly ended up with a way to chat over Meshtastic with IRC.Some highlights:- The CLI and bouncer run a daemon that keeps the connection to the node, that way multiple clients can connect to the same node. - The bouncer attempts to map IRC features to Meshtastic, so your user is your node, channels are channels, DMs are DMS. +v is favorites, reactions are tapbacks, and more. - Pseudo channels (in lack of a better word) are used for listing your favorites and all known nodes in the mesh. In the favorites channel you can /invite and /kick users to add or remove favorites.It's incredibly satisfying to slap folks around a bit with a large trout again. Comments URL: https://news.ycombinator.com/item?id=50691436 Points: 1 # Comments: 0

翻訳サービスが停止中のため原文を表示しています。

meshtastik is a single-binary Go CLI for administering a local Meshtastic radio node over serial, TCP or BLE. It replaces the Python meshtastic CLI for node configuration and inspection. Requires node firmware 2.5 or newer. With Homebrew (macOS and Linux): brew install --cask fiskeben/tap/meshtastik Or download an archive for your platform from Releases. From source make build # ./meshtastik 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/meshtastik also works. Platforms All three platforms build, including BLE support (tinygo bluetooth is compiled on every target): 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, meshtastik looks for a serial port. --port serial port --host TCP (default port 4403) --ble Bluetooth LE --device 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: $ meshtastik device add home --host 192.168.1.40 $ meshtastik device add hill --ble Hill_1234 $ meshtastik use home Commands now connect to home (tcp:192.168.1.40). $ meshtastik info # connects to home $ meshtastik --device hill info # just this once use --host 192.168.1.40 (or --port, --ble) saves a current device without naming it. use alone shows which node commands connect to and why; use --clear forgets it. Commands pick the node from, in order: --port/--host/--ble/--device; then MESHTASTIK_DEVICE, MESHTASTIK_PORT, MESHTASTIK_HOST or MESHTASTIK_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.yaml in your config directory (~/Library/Application Support/meshtastik on macOS, ~/.config/meshtastik on Linux), or at $MESHTASTIK_DEVICES. Other global flags: --json, --yes (skip confirmations), --debug, --timeout (bounds the handshake and each request, not the whole operation; 0 = per-transport default), --no-daemon (see below), --dest (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/--ble value). 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: $MESHTASTIK_SOCKET, else $XDG_RUNTIME_DIR/meshtastik.sock, else meshtastik-.sock in the temporary directory. Its log sits next to the socket (.log); daemon status shows both paths. --no-daemon, or MESHTASTIK_NO_DAEMON=1, connects directly as before. A serial port the daemon holds can't be opened directly at the same time; run meshtastik daemon stop first. After upgrading meshtastik, commands note that the daemon runs the old version until you run meshtastik 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. ircmesh --device home 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 meshtastik does (--device, --host, --port, --ble, the MESHTASTIK_* 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 1d2f shows 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. /part hides a channel for that client only. Other nodes are users. A node shows up in a channel once it has been heard there, and leaves after 6 hours without being heard there (--active). /whois shows when it was last heard, and you can /msg any node the node knows, even an offline one. &AllNodes lists 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 &AllNodes brings back the quits. Favourites: nodes marked as favourites on the node (meshtastik 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 +v or /invite &Favorites makes a node a favourite on the node; /mode -v or /kick &Favorites makes it stop being one. A change made in the app shows up within 10 minutes. Messages: /msg 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. /me is sent as * …. 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 (@!) shows up as the node's current nick, as : at the start of a message so your client highlights it. Starting a message with : (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 (--history changes how many; 0 keeps none). Every client that connects gets them replayed, with their original times if it supports server-time (irssi, WeeChat and HexChat do). A client that supports IRCv3 draft/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 (or /quote TRACE in clients without the command) traces the route to a node and back, as meshtastik traceroute does, and answers in your server window: traceroute to AS02: Ricco → RLY1 (6.25 dB) → AS02 (-3.5 dB), then a back: line. It takes seconds to a minute; one runs at a time, as the node rate-limits them. Telemetry: every hour (--telemetry, 0 turns 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. --verbose adds 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. --debug adds every IRC line and every packet, including message contents (passwords are masked). Off this machine: with --listen 0.0.0.0:6667 or any address that isn't loopback, set a password with MESHTASTIK_IRC_PASSWORD or --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 meshtastik send do. While ircmesh runs the daemon, meshtastik daemon stop stops it only until ircmesh starts it again. Remote admin With --dest , 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. 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, meshtastik info shows its public key (base64:…). Connect to the remote node locally (USB, WiFi or Bluetooth) and allow that key: meshtastik admin-key add . From then on, through your own node: $ meshtastik --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/reset and admin-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 (--timeout changes that) and each message is tried up to 3 times. Commands read only what they need (config get lora.region reads the LoRa section); a full config get or config export reads 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 … reports sent). A private key never goes over the air: a remote config export has none (nor a location, which cannot be read either), and config import --keys --dest and config set --dest security.private_key|public_key are 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. shutdown and factory-reset say the node cannot be reached remotely afterwards, and nodes reset --dest without --keep-favorites warns that the node forgets your node's key. Ignoring or removing your own node on a remote node is refused. Commands Run meshtastik --help for details. Negative values need -- so they are not read as flags: meshtastik config set -- lora.tx_power -5. config get shows zero values (e.g. enabled: false) and prints security.private_key as . Ask for the field itself (config get security.private_key) to see it. config export writes the node's private key. The file is created with mode 0600; keep it safe. config import leaves 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 import restores location only when the backup's merged config has position.fixed_position: true; Python backups of GPS nodes carry a location that is otherwise ignored (with a note). A node with security.is_managed set ignores local configuration, so meshtastik refuses changes to it, except turning security.is_managed off. 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. listen has no history beyond what the daemon has kept: it shows the messages that arrived while no listen was 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), listen gives up with an error. traceroute and request make one attempt and wait 60 seconds for the answer (twice --timeout when it is set). The firmware limits them: one traceroute per 30 seconds and one position or telemetry request per 10 seconds from a connection (meshtastik 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, meshtastik 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 scan are CoreBluetooth UUIDs, not MAC addresses. Pass the name or that UUID to --ble. GPL-3.0. See LICENSE.

出典

原文を読む ↗

関連テーマ

← すべてのニュースへ