40 Commits

Author SHA1 Message Date
Daniel Pupius
26a2bba441 Fix network map mobile overflow and infer MQTT hops from SNR=0 (#2)
* Fix network map mobile overflow and infer MQTT hops from SNR=0

- Add min-h-0 and flex-shrink-0 to map layout so legend/actions don't
  overflow the viewport on mobile
- Infer viaMqtt=true for traceroute hops with SNR exactly 0
- Change MQTT hop color from purple to orange across map, legend, and
  node detail badges

https://claude.ai/code/session_01Ffqq7YPCJE28uUFR88eK7C

* Revert MQTT color to purple; keep SNR=0 MQTT inference

The color change was unintended — MQTT hops should stay purple. The
SNR=0 inference in traceroute processing correctly marks those hops
as viaMqtt so they render as purple dashed lines.

https://claude.ai/code/session_01Ffqq7YPCJE28uUFR88eK7C

* Fix test setup: mock URL.createObjectURL for maplibre-gl

maplibre-gl calls URL.createObjectURL during import for its worker
setup, which doesn't exist in jsdom. Add the mock to test setup.

https://claude.ai/code/session_01Ffqq7YPCJE28uUFR88eK7C

* Run go fmt on unformatted files

https://claude.ai/code/session_01Ffqq7YPCJE28uUFR88eK7C

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-15 23:06:20 -07:00
Daniel Pupius
8130158c1e feat(cache): priority-based eviction with age protection and Bélády approximation
Replace the flat circular buffer with NodeAwareCache, a smarter eviction
strategy for historical mesh packet data:

- Packets younger than 1 hour are never evicted (recent traffic preserved)
- Under pressure, evict from the lowest-priority type first (neighbor-info
  outlasts node-info; chat messages outlast everything)
- Within a priority tier, evict from the most recently active source node —
  that node will resend soonest, so its old packet is cheapest to lose
  (Bélády approximation; protects flaky/distant node history)
- Node retention window still applies: silent nodes' packets are excluded
  from GetAll and pruned proactively before priority eviction runs

Also:
- Add --cache-retention flag (default 3h) and raise --cache-size default to 5000
- Fix decoder error strings (replace verbose Go errors with short codes)
- Add HTTP security headers middleware to server
- Fix broker dispatchLoop deadlock on source channel close
- Fix make gen-proto scanning web/node_modules for .proto files
- Fix tools target always reinstalling protoc-gen-go (handles stale arch binary)
- Move server port from 8080 to 5446; update Dockerfile, docker-compose, moat.yaml

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 20:23:50 +00:00
Daniel Pupius
1d61a89505 fix: remove dead code, SSE error handling, bounded dedup maps
- Remove unused mustParseDuration from main.go
- Replace http.Error calls after SSE headers with plain returns;
  skip bad packets instead of killing the stream on marshal error
- Change processedPackets/seenPackets from boolean to timestamp values
  and prune entries older than 24h on each packet to prevent unbounded
  memory growth in long-running sessions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 16:27:57 +00:00
Daniel Pupius
69a31ca406 Split routers and extend mesh traffic retention (#1)
* Split routers on dashboard and extend retention periods

- Add Router node type with 12-hour stale timeout (vs 30 min for regular nodes)
- Create RouterList component to display router nodes separately
- Update NodeList to filter out routers (similar to gateways)
- Add yellow color scheme for router nodes to distinguish from gateways (green) and nodes (blue)
- Extend mesh traffic retention across the board:
  - Client-side packet age filter: 12h → 24h
  - Broker cache size: 50 → 200 packets
  - Messages per channel: 100 → 500

* Update regular node activity threshold to 60 minutes

* Fix TypeScript errors in router filtering logic

* Fix docker-build to use buildx explicitly with --load flag

* Add default empty value for MESHSTREAM_GOOGLE_MAPS_API_KEY in docker-build

* Restructure docker buildx command to fix path argument parsing

* Remove trailing backslash before build context path in docker-build

* Quote build args and separate path argument in docker-build
2026-01-06 12:25:34 -08:00
Daniel Pupius
0feb2591ef Remove stats listener since it is noisy in prod 2025-05-19 11:00:10 -07:00
Daniel Pupius
df7df6dbd6 Unique client id and fix graceful shutdown 2025-05-04 13:26:13 -07:00
Daniel Pupius
3ce8889786 Debugging prod failures 2025-05-04 10:15:42 -07:00
Daniel Pupius
ba9c8d9221 Channel name cleanup 2025-05-02 15:21:50 -07:00
Daniel Pupius
e9fa0104e3 Docker set up and fixes for build 2025-05-01 15:34:16 -07:00
Daniel Pupius
68fc353673 Info page 2025-04-30 15:08:03 -07:00
Daniel Pupius
64b026646d Use env and flags for configuration 2025-04-30 10:36:45 -07:00
Daniel Pupius
f83e6a9c31 Consistent colors and activity status 2025-04-30 09:16:44 -07:00
Daniel Pupius
b2b94d7204 Fix node types 2025-04-29 12:12:41 -07:00
Daniel Pupius
81892a5793 Cache recent packets and send to client when it connects 2025-04-25 17:22:36 -07:00
Daniel Pupius
5b5dad7a68 Fixes for gateway display 2025-04-25 09:54:36 -07:00
Daniel Pupius
86e6f45d5e Fixes for node links and early stream connection 2025-04-25 08:46:30 -07:00
Daniel Pupius
0184cba1ef Updates to node details 2025-04-24 20:10:56 -07:00
Daniel Pupius
0f151c31b9 Improve structured logging for better log aggregation
- Add message type prefix in brief mode for quick identification
- Include GatewayID in brief mode summary
- Remove formatted output from structured fields
- Use proper structured fields for each message type
- Add common fields like hopLimit and ID for all messages
- Extract specific data for position, telemetry, and text messages
- Format structured data for better log aggregation compatibility
2025-04-21 11:52:40 -07:00
Daniel Pupius
56a14fff61 Simplify MessageLogger to use structured logging only
- Remove file-based logging completely
- Add brief mode for concise log output
- Add full mode with complete message details
- Use structured logging fields for all information
- Keep console output option for readability
- Add intelligent summary handling for different message types
2025-04-21 11:19:53 -07:00
Daniel Pupius
c6d94b10d1 Inject loggers from main.go instead of creating them locally
- Update all components to accept a logger parameter
- Add default fallbacks when logger is not provided
- Ensure consistent logger naming with parent.Named() pattern
- Create a proper logger hierarchy originating from main.go
- Update MessageLogger to pass logger to BaseSubscriber
2025-04-21 11:09:27 -07:00
Daniel Pupius
9447f44139 Update logging to use prefab/logging package
- Replace standard log package with prefab/logging
- Add context-aware logging in HTTP handlers
- Add structured logging with fields and levels
- Improve logging hierarchy and namespaces
- Implement named loggers for components
2025-04-21 11:01:45 -07:00
Daniel Pupius
ed1e719bca Add SSE endpoint for streaming MQTT messages to web browsers 2025-04-21 10:01:05 -07:00
Daniel Pupius
758aaa0dc0 Add web server using prefab framework 2025-04-21 09:53:04 -07:00
Daniel Pupius
ef660b2025 Consolidate display and logging functionality in MessageLogger 2025-04-21 08:52:15 -07:00
Daniel Pupius
c129be3be6 Update MessageLogger to log all packet types 2025-04-20 20:13:04 -07:00
Daniel Pupius
a4be4caa55 "Add message broker for distributing packets to multiple consumers 2025-04-20 20:08:19 -07:00
Daniel Pupius
4eb98b7455 Simplify MQTT package API by embedding TopicInfo
- Created Packet to combine DecodedPacket and TopicInfo
- Updated MQTT client to return Packet instead of wrapper type
- Modified main.go to use the simplified structure
- Updated tests to use the new Packet type

This change simplifies the API and reduces the cognitive load
for consumers of the MQTT package.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-04-20 19:08:01 -07:00
Daniel Pupius
879877fa53 Refactor MQTT handling into separate package
- Created new mqtt package with simple client interface
- Implemented buffered channel for decoded messages
- Updated main.go to use the new MQTT client
- Added tests for the MQTT client
- Simplified message handling to focus on 'e' and 'map' formats
- Added TODO for handling JSON format messages

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-04-20 18:11:15 -07:00
Daniel Pupius
5bc956af55 Switch and handling of "c" messages 2025-04-20 17:58:45 -07:00
Daniel Pupius
f10111e37d Better handling of map reports 2025-04-20 17:18:26 -07:00
Daniel Pupius
2f8ee3c9e1 Use DecodeMessage for map format packets
- Simplify design by using DecodeMessage for map format too
- Remove redundant DecodeMapReport function
- Update FormatTopicAndMapData to format decoded packets
- Improve handling of map format packets

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-04-20 16:53:51 -07:00
Daniel Pupius
42304465a3 Add support for map format messages
- Added handling for topics with "map" format (2/map)
- Display map data as readable text rather than hex
- Added new FormatTopicAndMapData function to formatter.go
- Added map format condition in main.go message handler

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-04-20 16:00:35 -07:00
Daniel Pupius
0c92ace2fa Separate decoding and formatting into dedicated files
- Created new formatter.go file with all formatting functions
- Replaced deprecated FormatData with improved FormatDataMessage
- Updated main.go to separate decoding and formatting steps
- Created specialized formatting functions for different message types
- Better separation of concerns for improved maintainability

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-04-20 15:32:44 -07:00
Daniel Pupius
ef3cd1a931 Separating decoder and formatter 2025-04-20 15:04:07 -07:00
Daniel Pupius
cd648508c1 Beginning of message decryption 2025-04-18 18:40:30 -07:00
Daniel Pupius
044e229ab8 Implement channel-based encryption/decryption using XOR and AES 2025-04-18 17:58:24 -07:00
Daniel Pupius
93c0e9e94f Refactor decoder to use protocol buffers directly for ServiceEnvelope decoding 2025-04-18 17:48:21 -07:00
Daniel Pupius
5537556d22 Update decoder to match correct Meshtastic MQTT topic structure 2025-04-18 16:28:09 -07:00
Daniel Pupius
af958ff295 Add protocol buffer generation and packet decoder 2025-04-18 16:13:41 -07:00
Daniel Pupius
d09bfb320f Initial commit: MQTT client for monitoring Meshtastic packets 2025-04-18 16:03:47 -07:00