## New Features - secubox-app-yggdrasil-discovery: Mesh peer discovery via gossip protocol - yggctl CLI: status, self, peers, announce, discover, bootstrap - Auto-peering with trust verification (master-link fingerprint) - Daemon for periodic announcements ## Bug Fixes - tor-shield: Fix opkg downloads failing when Tor active - DNS over Tor disabled by default - Auto-exclude public DNS servers from iptables rules - Excluded domains bypass list (openwrt.org, pool.ntp.org, etc.) - haproxy: Fix portal 503 "End of Internet" error - Corrected malformed vhost backend configuration - Regenerated HAProxy config from UCI - luci-app-nextcloud: Fix users list showing empty - RPC expect clause was extracting array, render expected object ## Updated - Bonus feed: All IPKs rebuilt - Documentation: HISTORY.md, WIP.md, TODO.md updated Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
109 lines
2.2 KiB
Bash
109 lines
2.2 KiB
Bash
#!/bin/sh
|
|
# Yggdrasil Discovery Daemon
|
|
# Periodically announces this node and discovers peers
|
|
|
|
. /usr/lib/yggdrasil-discovery/core.sh
|
|
|
|
PIDFILE="/var/run/yggdrasil-discovery.pid"
|
|
LOGFILE="/var/log/yggdrasil-discovery.log"
|
|
|
|
log() {
|
|
echo "$(date '+%Y-%m-%d %H:%M:%S') $1" >> "$LOGFILE"
|
|
logger -t yggdrasil-discovery "$1"
|
|
}
|
|
|
|
# Check if already running
|
|
is_running() {
|
|
[ -f "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE")" 2>/dev/null
|
|
}
|
|
|
|
# Start daemon
|
|
start() {
|
|
if is_running; then
|
|
echo "Daemon already running (PID $(cat "$PIDFILE"))"
|
|
return 1
|
|
fi
|
|
|
|
local enabled
|
|
enabled=$(uci -q get yggdrasil-discovery.main.enabled)
|
|
if [ "$enabled" != "1" ]; then
|
|
echo "Yggdrasil discovery is disabled"
|
|
return 1
|
|
fi
|
|
|
|
echo $$ > "$PIDFILE"
|
|
log "Daemon started (PID $$)"
|
|
|
|
# Main loop
|
|
while true; do
|
|
# Check if Yggdrasil is running
|
|
local ipv6
|
|
ipv6=$(get_ygg_ipv6)
|
|
|
|
if [ -z "$ipv6" ]; then
|
|
log "Waiting for Yggdrasil..."
|
|
sleep 30
|
|
continue
|
|
fi
|
|
|
|
# Auto-announce if enabled
|
|
local auto_announce
|
|
auto_announce=$(uci -q get yggdrasil-discovery.main.auto_announce)
|
|
|
|
if [ "$auto_announce" = "1" ]; then
|
|
log "Announcing node..."
|
|
/usr/sbin/yggctl announce >/dev/null 2>&1
|
|
fi
|
|
|
|
# Get announce interval
|
|
local interval
|
|
interval=$(uci -q get yggdrasil-discovery.main.announce_interval)
|
|
interval="${interval:-300}"
|
|
|
|
sleep "$interval"
|
|
done
|
|
}
|
|
|
|
# Stop daemon
|
|
stop() {
|
|
if [ -f "$PIDFILE" ]; then
|
|
local pid
|
|
pid=$(cat "$PIDFILE")
|
|
kill "$pid" 2>/dev/null
|
|
rm -f "$PIDFILE"
|
|
log "Daemon stopped"
|
|
echo "Daemon stopped"
|
|
else
|
|
echo "Daemon not running"
|
|
fi
|
|
}
|
|
|
|
# Status
|
|
status() {
|
|
if is_running; then
|
|
echo "Running (PID $(cat "$PIDFILE"))"
|
|
else
|
|
echo "Stopped"
|
|
fi
|
|
}
|
|
|
|
case "${1:-}" in
|
|
start)
|
|
start &
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
restart)
|
|
stop
|
|
sleep 1
|
|
start &
|
|
;;
|
|
status)
|
|
status
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart|status}"
|
|
;;
|
|
esac
|