Extended the demo-inspired design system from system-hub to all SecuBox modules for complete visual consistency across the entire platform. 🎨 Design System v0.3.0 Applied ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 📦 Modules Updated (15 total): - ✅ luci-app-auth-guardian - ✅ luci-app-bandwidth-manager - ✅ luci-app-cdn-cache - ✅ luci-app-client-guardian - ✅ luci-app-crowdsec-dashboard - ✅ luci-app-ksm-manager - ✅ luci-app-media-flow - ✅ luci-app-netdata-dashboard - ✅ luci-app-netifyd-dashboard - ✅ luci-app-network-modes - ✅ luci-app-secubox - ✅ luci-app-system-hub - ✅ luci-app-traffic-shaper - ✅ luci-app-vhost-manager - ✅ luci-app-wireguard-dashboard 🎨 Design System Features ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Dark Mode Palette (Demo-inspired): - Background: #0a0a0f → #12121a → #1a1a24 - Text: #fafafa / #a0a0b0 - Borders: #2a2a35 - Primary gradient: #6366f1 → #8b5cf6 (Indigo-Violet) Typography: - Body: Inter (Google Fonts) - Monospace: JetBrains Mono (for metrics, IDs, code) Components: - Compact stats badges (130px min) - Gradient text titles with background-clip - Cards with gradient border hover effects - Sticky navigation tabs with backdrop-filter - Filter tabs with gradient active state - Buttons with cubic-bezier transitions - Status badges (success/danger/warning/info) Responsive Grid Layouts: - Stats: repeat(auto-fit, minmax(130px, 1fr)) - Metrics: repeat(auto-fit, minmax(240px, 1fr)) - Cards: repeat(auto-fit, minmax(300px, 1fr)) 📄 Files Added (14 new): ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Created common.css for each module: - templates/common-css-template.css (master template) - */resources/*/common.css (14 modules) 📝 Files Modified (42): ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Makefiles (13 modules): - Updated PKG_VERSION from 0.0.9 → 0.2.2 - auth-guardian, bandwidth-manager, cdn-cache, client-guardian - crowdsec-dashboard, ksm-manager, media-flow, netdata-dashboard - netifyd-dashboard, network-modes, traffic-shaper, vhost-manager - wireguard-dashboard API.js files (14 modules): - Added "// Version: 0.2.2" comment - Consistent version tracking across all modules Dashboard CSS (13 modules): - Added "Version: 0.3.0" in file headers - Updated to use Design System variables SecuBox CSS (6 files): - alerts.css, dashboard.css, modules.css - monitoring.css, secubox.css - All updated to version 0.3.0 🔧 CSS Variables System ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ All modules now use consistent --sh-* CSS variables: - --sh-text-primary / --sh-text-secondary - --sh-bg-primary / --sh-bg-secondary / --sh-bg-tertiary / --sh-bg-card - --sh-border / --sh-hover-bg / --sh-hover-shadow - --sh-primary / --sh-primary-end (for gradients) - --sh-success / --sh-danger / --sh-warning / --sh-info - --sh-shadow Benefits: ✓ Instant theme switching (light/dark mode) ✓ Easy color customization via CSS variables ✓ Consistent branding across all modules ✓ Reduced CSS duplication ✓ Better maintainability 📊 Statistics ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Files changed: 56 total - New files: 14 (common.css + template) - Modified files: 42 - 13 Makefiles (version updates) - 14 API.js (version tracking) - 13 dashboard.css (version headers) - 6 secubox CSS files - 1 settings.local.json Total lines added: ~8,000+ (common.css templates) Common CSS size: ~420 lines per module Design system coverage: 100% (all 15 modules) ✅ Validation ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Validation script passed successfully: - ✓ Check 1: RPCD naming (15 modules) - ✓ Check 2: Menu paths (100+ views) - ✓ Check 3: View files (2 warnings - debug files) - ✓ Check 4: Permissions (15 RPCD scripts) - ✓ Check 5: JSON syntax (30 files) - ✓ Check 6: ubus naming (17 objects) 🎯 Migration Notes ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Developers: 1. Import common.css in your HTML/views 2. Use --sh-* CSS variables instead of hardcoded colors 3. Leverage pre-built components (.sh-card, .sh-btn-primary, etc.) 4. Follow responsive grid patterns 5. Test in both light and dark modes Users: - All modules now have consistent modern design - Unified color scheme across entire SecuBox platform - Better accessibility with improved contrast ratios - Smooth animations and transitions - Responsive design for mobile/tablet/desktop 📚 Documentation ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Reference: - Design demo: https://cybermind.fr/apps/system-hub/demo.html - Template: templates/common-css-template.css - Guidelines: DEVELOPMENT-GUIDELINES.md - Quick start: QUICK-START.md Next Steps: - Deploy modules to test environment - Verify visual consistency - Collect user feedback - Fine-tune responsive breakpoints if needed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| htdocs/luci-static/resources | ||
| root | ||
| Makefile | ||
| README.md | ||
Traffic Shaper - Advanced QoS Control
LuCI application for advanced traffic shaping and Quality of Service (QoS) management using Linux Traffic Control (TC) and CAKE qdisc.
Features
- Traffic Class Management: Create and manage bandwidth allocation classes with guaranteed (rate) and maximum (ceil) limits
- Priority-Based Scheduling: 8-level priority system for fine-grained traffic prioritization
- Classification Rules: Flexible rule system to classify traffic by:
- Port numbers (source/destination)
- IP addresses (source/destination)
- DSCP markings
- Protocol type
- Real-Time Statistics: Monitor per-class packet counts, byte counts, and drop statistics
- Quick Presets: One-click application of optimized configurations:
- Gaming & Low-Latency
- Video Streaming
- Work From Home
- Balanced (Default)
- Visual Dashboard: Traffic flow diagram with priority color coding
- Multi-Interface Support: Configure QoS on WAN, LAN, or any network interface
Installation
opkg update
opkg install luci-app-traffic-shaper
/etc/init.d/rpcd restart
/etc/init.d/uhttpd restart
Dependencies
luci-base: LuCI web interface frameworkrpcd: RPC daemon for backend communicationtc: Linux traffic control utilitykmod-sched-core: Kernel traffic scheduling moduleskmod-sched-cake: CAKE qdisc kernel module
Usage
Access the Interface
Navigate to: Network → Traffic Shaper
The interface provides 5 main views:
- Overview: Dashboard with status cards and traffic flow visualization
- Traffic Classes: CRUD interface for bandwidth classes
- Classification Rules: CRUD interface for traffic matching rules
- Statistics: Real-time statistics for all traffic classes
- Presets: Quick-apply optimized configurations
Creating Traffic Classes
- Go to Network → Traffic Shaper → Traffic Classes
- Click Add to create a new class
- Configure:
- Name: Descriptive name (e.g., "Video Streaming")
- Priority: 1 (highest) to 8 (lowest)
- Guaranteed Rate: Minimum bandwidth (e.g., "5mbit")
- Maximum Rate (Ceil): Maximum allowed bandwidth (e.g., "50mbit")
- Interface: Network interface (wan, lan, etc.)
- Enable: Activate the class
- Click Save & Apply
Priority Guidelines
- Priority 1-2: Critical traffic (VoIP, gaming, real-time applications)
- Priority 3-4: Important traffic (video streaming, VPN)
- Priority 5-6: Normal traffic (web browsing, email)
- Priority 7-8: Bulk traffic (downloads, backups)
Creating Classification Rules
- Go to Network → Traffic Shaper → Classification Rules
- Click Add to create a new rule
- Configure:
- Traffic Class: Select destination class
- Match Type: Port, IP, DSCP, or Protocol
- Match Value: Value to match
- Enable: Activate the rule
- Click Save & Apply
Example Rules
| Match Type | Match Value | Description |
|---|---|---|
| Destination Port | 80,443 |
HTTP/HTTPS web traffic |
| Destination Port | 22 |
SSH connections |
| Destination Port | 53 |
DNS queries |
| Source IP | 192.168.1.0/24 |
All traffic from LAN subnet |
| Destination IP | 8.8.8.8 |
Traffic to Google DNS |
| DSCP | EF |
Expedited Forwarding (VoIP) |
| Protocol | udp |
All UDP traffic |
Using Presets
- Go to Network → Traffic Shaper → Presets
- Review available presets and their configurations
- Click Apply This Preset on your desired profile
- Confirm the action (this will replace existing configuration)
Configuration
UCI Configuration
Configuration is stored in /etc/config/traffic-shaper:
config class 'gaming'
option name 'Gaming Traffic'
option priority '1'
option rate '10mbit'
option ceil '50mbit'
option interface 'wan'
option enabled '1'
config rule 'gaming_ports'
option class 'gaming'
option match_type 'dport'
option match_value '3074,27015,25565'
option enabled '1'
Traffic Class Options
name: Display name for the classpriority: Priority level (1-8)rate: Guaranteed minimum bandwidth (format:<number>[kmg]bit)ceil: Maximum allowed bandwidth (format:<number>[kmg]bit)interface: Network interface nameenabled: Enable/disable the class (0/1)
Classification Rule Options
class: Traffic class ID (UCI section name)match_type: Type of matching (dport,sport,dst,src,dscp,protocol)match_value: Value to match againstenabled: Enable/disable the rule (0/1)
Backend API
The RPCD backend (luci.traffic-shaper) provides these methods:
Status Methods
status(): Get current QoS system statuslist_classes(): List all traffic classeslist_rules(): List all classification rulesget_stats(): Get per-class statistics from TC
Management Methods
add_class(name, priority, rate, ceil, interface): Create new classupdate_class(id, name, priority, rate, ceil, interface, enabled): Update classdelete_class(id): Delete classadd_rule(class, match_type, match_value): Create classification ruledelete_rule(id): Delete rule
Preset Methods
list_presets(): Get available presetsapply_preset(preset_id): Apply preset configuration
Technical Details
Traffic Control Implementation
The module uses Linux Traffic Control (TC) with the following hierarchy:
- Root qdisc: CAKE (Common Applications Kept Enhanced)
- Class hierarchy: HTB (Hierarchical Token Bucket) for bandwidth allocation
- Filters: U32 filters for traffic classification based on rules
CAKE Features
- Smart queuing: Automatically manages queue sizes
- Flow isolation: Prevents single flows from monopolizing bandwidth
- Latency reduction: Minimizes bufferbloat
- Per-host fairness: Ensures fair bandwidth distribution
Statistics Collection
Statistics are collected using tc -s class show and parsed to provide:
- Packet counts per class
- Byte counts per class
- Drop counts (packets dropped due to rate limiting)
Data is refreshed every 5 seconds in the Statistics view.
Architecture
Directory Structure
luci-app-traffic-shaper/
├── Makefile # OpenWrt package definition
├── README.md # This file
├── htdocs/luci-static/resources/
│ ├── view/traffic-shaper/ # JavaScript views
│ │ ├── overview.js # Dashboard view
│ │ ├── classes.js # Class management
│ │ ├── rules.js # Rule management
│ │ ├── stats.js # Statistics view
│ │ └── presets.js # Preset selection
│ └── traffic-shaper/
│ ├── api.js # RPC API client
│ └── dashboard.css # UI styles
└── root/
├── etc/config/
│ └── traffic-shaper # UCI configuration
└── usr/
├── libexec/rpcd/
│ └── luci.traffic-shaper # RPCD backend
└── share/
├── luci/menu.d/ # Menu definition
│ └── luci-app-traffic-shaper.json
└── rpcd/acl.d/ # ACL permissions
└── luci-app-traffic-shaper.json
Frontend Components
- Views: LuCI views using
form.Mapand custom DOM rendering - API Client: Wrapper for RPC calls with utility functions
- Polling: Auto-refresh for statistics (5-second interval)
- Styling: Custom CSS with priority color coding
Backend Components
- RPCD Script: Shell script using jshn for JSON handling
- UCI Integration: Configuration stored in UCI format
- TC Integration: Direct TC commands for qdisc/class/filter management
Troubleshooting
Traffic Shaping Not Working
-
Verify CAKE module is loaded:
lsmod | grep sch_cake -
Check TC configuration:
tc qdisc show tc class show dev wan tc filter show dev wan -
Verify interface name:
ip link show
Classes Not Appearing
-
Restart RPCD:
/etc/init.d/rpcd restart -
Check UCI configuration:
uci show traffic-shaper -
Verify class is enabled:
uci get traffic-shaper.<class_id>.enabled
Statistics Not Updating
-
Check TC statistics:
tc -s class show dev wan -
Verify polling is active (check browser console)
-
Ensure classes are enabled and interface is correct
Permission Errors
-
Verify ACL file is installed:
ls -la /usr/share/rpcd/acl.d/luci-app-traffic-shaper.json -
Check user permissions:
ubus -v list luci.traffic-shaper
Examples
Example 1: Home Office Setup
Classes:
- Video Calls: Priority 1, 8mbit guaranteed, 50mbit max
- VPN Traffic: Priority 2, 10mbit guaranteed, 60mbit max
- Web Browsing: Priority 4, 5mbit guaranteed, 40mbit max
Rules:
- Zoom ports (8801-8810) → Video Calls
- Port 443 with VPN IP range → VPN Traffic
- Ports 80,443 → Web Browsing
Example 2: Gaming + Streaming
Classes:
- Gaming: Priority 1, 5mbit guaranteed, 40mbit max
- Streaming: Priority 3, 15mbit guaranteed, 70mbit max
- Downloads: Priority 7, 2mbit guaranteed, 30mbit max
Rules:
- Gaming ports (3074, 27015, etc.) → Gaming
- Port 443 to Netflix/YouTube IPs → Streaming
- Port 80 → Downloads
Example 3: Multi-User Household
Use the Balanced preset or create custom classes:
- High Priority: 10mbit → 60mbit (Priority 2)
- Normal: 15mbit → 80mbit (Priority 5)
- Bulk: 5mbit → 50mbit (Priority 7)
Performance Considerations
- CPU Usage: TC processing uses minimal CPU on modern routers
- Memory: Each class uses ~1-2KB of kernel memory
- Latency: CAKE significantly reduces latency for interactive traffic
- Throughput: Minimal impact on total throughput (<1% overhead)
License
Apache License 2.0
Maintainer
SecuBox Project secubox@example.com
Version
1.0.0