feat: Split firmware into Bee (L2 transport) and Bumblebee (L3 gateway) roles
Bee (wr3000, ar300m16): minimal batman-adv mesh relay with gw_mode=client, no yggdrasil/GRE6/VPN/SQM/DoH, Parahub_Free bridged to private network. Bumblebee (axt1800, mt3000, mt6000, ax6s, ax53u): full stack with gw_mode=server, yggdrasil overlay, GRE6 tunnel, guest isolation, SQM, DoH. Build creates /etc/parahub/role marker; heartbeat reports firmware_role and mesh_ip; Bee uses public URL, Bumblebee tries yggdrasil with fallback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
#!/bin/sh
|
||||
# Phone-home heartbeat to Parahub cloud via Yggdrasil
|
||||
PARAHUB_API="http://[200:abb9:5810:37d3:8a4c:98a6:b82b:969a]/api/v1/iot/mesh/heartbeat"
|
||||
# Phone-home heartbeat to Parahub cloud
|
||||
PARAHUB_API_YGG="http://[200:abb9:5810:37d3:8a4c:98a6:b82b:969a]/api/v1/iot/mesh/heartbeat"
|
||||
PARAHUB_API_PUBLIC="https://parahub.io/api/v1/iot/mesh/heartbeat"
|
||||
HEARTBEAT_KEY="IqPosrcpTQKSbLHxOG3iLTl_K2MsDxvd"
|
||||
|
||||
# Check Yggdrasil connectivity first
|
||||
ping6 -c 1 -W 3 200:abb9:5810:37d3:8a4c:98a6:b82b:969a >/dev/null 2>&1 || exit 0
|
||||
# Read firmware role
|
||||
ROLE=$(cat /etc/parahub/role 2>/dev/null || echo "unknown")
|
||||
|
||||
# Read identity from /etc/parahub/keys
|
||||
. /etc/parahub/keys 2>/dev/null
|
||||
@@ -14,18 +15,45 @@ YGG_ADDR="${YGGDRASIL_ADDRESS:-unknown}"
|
||||
SSID="${PRIVATE_SSID:-unknown}"
|
||||
UPTIME="$(cut -d. -f1 /proc/uptime)"
|
||||
|
||||
# Get mesh IP (br-private address)
|
||||
MESH_IP=$(ip -4 addr show br-private 2>/dev/null | grep -o 'inet [0-9.]*' | cut -d' ' -f2)
|
||||
MESH_IP="${MESH_IP:-unknown}"
|
||||
|
||||
# Detect hardware from board_name
|
||||
HW=$(cat /tmp/sysinfo/board_name 2>/dev/null)
|
||||
case "$HW" in
|
||||
glinet,gl-axt1800) HW="axt1800" ;;
|
||||
glinet,gl-mt3000) HW="mt3000" ;;
|
||||
glinet,gl-mt6000) HW="mt6000" ;;
|
||||
xiaomi,redmi-router-ax6s) HW="ax6s" ;;
|
||||
asus,rt-ax53u) HW="ax53u" ;;
|
||||
glinet,gl-ar300m16) HW="ar300m16" ;;
|
||||
cudy,wr3000-v1) HW="wr3000" ;;
|
||||
*) HW="${HW:-unknown}" ;;
|
||||
esac
|
||||
|
||||
curl -s -m 10 -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer ${HEARTBEAT_KEY}" \
|
||||
-d "{\"mac\":\"${MAC}\",\"hostname\":\"${HOSTNAME}\",\"yggdrasil_address\":\"${YGG_ADDR}\",\"firmware_version\":\"25.12.0-rc4\",\"hardware_profile\":\"${HW}\",\"uptime\":${UPTIME},\"private_ssid\":\"${SSID}\"}" \
|
||||
"${PARAHUB_API}" >/dev/null 2>&1
|
||||
PAYLOAD="{\"mac\":\"${MAC}\",\"hostname\":\"${HOSTNAME}\",\"yggdrasil_address\":\"${YGG_ADDR}\",\"firmware_version\":\"25.12.0-rc4\",\"hardware_profile\":\"${HW}\",\"uptime\":${UPTIME},\"private_ssid\":\"${SSID}\",\"firmware_role\":\"${ROLE}\",\"mesh_ip\":\"${MESH_IP}\"}"
|
||||
|
||||
if [ "$ROLE" = "bee" ]; then
|
||||
# Bee: no yggdrasil, use public URL only
|
||||
curl -s -m 10 -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer ${HEARTBEAT_KEY}" \
|
||||
-d "$PAYLOAD" \
|
||||
"${PARAHUB_API_PUBLIC}" >/dev/null 2>&1
|
||||
else
|
||||
# Bumblebee: try yggdrasil first, fallback to public
|
||||
if ping6 -c 1 -W 3 200:abb9:5810:37d3:8a4c:98a6:b82b:969a >/dev/null 2>&1; then
|
||||
curl -s -m 10 -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer ${HEARTBEAT_KEY}" \
|
||||
-d "$PAYLOAD" \
|
||||
"${PARAHUB_API_YGG}" >/dev/null 2>&1
|
||||
else
|
||||
curl -s -m 10 -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer ${HEARTBEAT_KEY}" \
|
||||
-d "$PAYLOAD" \
|
||||
"${PARAHUB_API_PUBLIC}" >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user