The Gandalf Proxy - unified traffic interception with 5 pillars: New packages: - secubox-cookie-tracker: HTTP cookie classification with mitmproxy addon - SQLite database for cookie tracking - 100+ known tracker domains (Google Analytics, Facebook, etc.) - CLI: cookie-trackerctl status/list/block/report - luci-app-interceptor: Unified dashboard aggregating all pillars - Health score (0-100%) based on active pillars - Status cards: WPAD, mitmproxy, CDN Cache, Cookie Tracker, API Failover Enhanced modules: - luci-app-network-tweaks: WPAD enforcement via iptables redirect - setWpadEnforce/getWpadEnforce RPCD methods - Catches clients ignoring WPAD auto-discovery - luci-app-cdn-cache: API failover and offline mode - stale-if-error patterns for /api/ and .json endpoints - WAN hotplug script (99-cdn-offline) toggles offline mode - collapsed_forwarding for duplicate request handling Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
40 lines
1.1 KiB
Bash
40 lines
1.1 KiB
Bash
#!/bin/sh
|
|
# CDN Cache Offline Mode - Auto-detect WAN connectivity
|
|
# Enables offline mode (serve stale) when WAN goes down
|
|
# Disables offline mode when WAN comes back up
|
|
|
|
# Only handle WAN interface events
|
|
[ "$INTERFACE" = "wan" ] || [ "$INTERFACE" = "wan6" ] || exit 0
|
|
|
|
# Check if API failover is enabled
|
|
api_enabled=$(uci -q get cdn-cache.api_failover.enabled)
|
|
[ "$api_enabled" = "1" ] || exit 0
|
|
|
|
case "$ACTION" in
|
|
ifdown)
|
|
# WAN went down - enable offline mode
|
|
logger -t cdn-cache "WAN down ($INTERFACE) - enabling offline mode"
|
|
uci set cdn-cache.api_failover.offline_mode='1'
|
|
uci commit cdn-cache
|
|
|
|
# Reload Squid to apply offline mode
|
|
if [ -x /etc/init.d/cdn-cache ]; then
|
|
/etc/init.d/cdn-cache reload 2>/dev/null &
|
|
fi
|
|
;;
|
|
|
|
ifup)
|
|
# WAN came back up - disable offline mode
|
|
logger -t cdn-cache "WAN up ($INTERFACE) - disabling offline mode"
|
|
uci set cdn-cache.api_failover.offline_mode='0'
|
|
uci commit cdn-cache
|
|
|
|
# Reload Squid to disable offline mode
|
|
if [ -x /etc/init.d/cdn-cache ]; then
|
|
/etc/init.d/cdn-cache reload 2>/dev/null &
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
exit 0
|