-
Notifications
You must be signed in to change notification settings - Fork 33
Macos v1.1 porting (please ignore the version in branch name) #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: macos-edition
Are you sure you want to change the base?
Conversation
Adds multi-container support with per-container settings, dashboards, and syncs settings from running containers to keep status consistent. Also ports connection history/peak tracking and improves macOS system CPU + node ID handling.
Adds tracker script generation, toggle command, and auto-start after install/settings changes. Persists tracker settings and PID/log paths for consistent history collection. Co-authored-by: Cursor <cursoragent@cursor.com>
The zero-peers alert generates false positives on macOS because the background notifier (running via nohup) cannot reliably get peer counts from docker logs. This is the same root cause as the /peers and /containers commands showing 0/0 or "No stats available yet". Changes: - Skip zero-peers alert entirely on macOS (OS check in notifier) - Remove /peers command from Telegram help and test messages on macOS - Update README to document zero-peers alert is disabled on macOS - Other alerts (CPU, RAM, down) continue to work normally This prevents users from receiving continuous "Zero peers for 2+ hours" alerts when they actually have 100+ connected peers. Co-authored-by: Cursor <cursoragent@cursor.com>
Remove trailing newline after conditional /peers command to prevent blank line between /status and /uptime in the Available Commands list. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Hi @SamNet-dev. This PR is for v1.1-Mac. I started breaking down the features from v1.2 tag and porting them in smaller pieces into macos. Still 3000 lines of code is too much, but it would get smaller as it gets closer to the main branch :) My goal in this PR is not necessarily match the branch v1.1 tag. It's just a step towards achieving parity. Hope that makes sense. Please let me know if there is anything missing. Thanks. |
Major improvements to tracker functionality on macOS: - **Remove tcpdump/sudo requirement**: Rewrite tracker to use Docker's /proc/net/tcp inspection for IP extraction (no sudo needed) - **Fix GeoIP database detection**: Auto-detect database in multiple paths including ~/.conduit/geoip/ directory - **Fix bash compatibility**: Use Homebrew bash for associative arrays (macOS system bash 3.2 doesn't support them) - **Add file ownership fixes**: Prevent permission issues when running commands with sudo by auto-correcting ownership to SUDO_USER - **Update Live Map**: Show informative message on macOS directing users to working alternatives (Telegram /status, Dashboard) Technical changes: - Tracker shebang: #!/bin/bash → #!/opt/homebrew/bin/bash - IP extraction: tcpdump → docker exec <container> cat /proc/net/tcp - GeoIP path: hardcoded → multi-path detection with fallback - Added fix_file_ownership() helper throughout tracker/telegram scripts - Load settings.conf in tracker for proper CONTAINER_COUNT detection Telegram reports now show accurate country breakdown: - 📡 Total served with proper traffic tracking - 👤 Total lifetime IPs served (actual count) - 🗺 Top by peers (United States, Canada, etc.) - 🌍 Top by upload (percentage per country) Co-authored-by: Cursor <cursoragent@cursor.com>
Implement show_peers_macos() to display live peer traffic by country without requiring sudo/tcpdump: - **Reads from tracker data**: Uses background tracker's cumulative_data and tracker_snapshot files instead of real-time packet capture - **Display format**: Matches Linux version with TOP 10 countries by traffic (FROM/TO) and active client counts - **Auto-refresh**: Display refreshes every 5s, tracker updates every 60s - **No privileges needed**: Works without sudo by leveraging existing tracker infrastructure Display shows: - 📥 TOP 10 TRAFFIC FROM (download from peers) - 📤 TOP 10 TRAFFIC TO (upload to peers) - Country name, total traffic, and active client count per country - Live update timestamp with [LIVE] indicator - Clear exit instructions: "Press any key to exit" This completes feature parity with Linux for peer traffic visualization on macOS without requiring elevated privileges. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Hi @PouriaCh , thanks for putting up with this and updating. I will take a look as soon as I get a chance. Thank you again. You just make sure it's all good to go, and there are no bugs. |
|
Hey Pouria, thanks for the solid work on this PR — really appreciate the effort. I'm heads-down on the Linux version right now so I ran your code through some AI review tools to speed things up. They flagged a few things and I wanted to run them by you before we merge. Can you confirm whether these are actual issues or false positives? If you can confirm, we can move forward. --- HIGH (must-fix before merge) ---
--- MEDIUM (should fix) ---
--- LOW (nice to have) ---
Let me know what you think. If these check out I'll get this merged. Thanks! |
Conduit Manager v1.1 - macOS Edition
Summary
This PR introduces v1.1 of Conduit Manager for macOS, bringing feature parity with the Linux edition while implementing macOS-specific optimizations. The implementation eliminates the need for sudo/tcpdump through innovative use of Docker container inspection via
/proc/net/tcp.Key Features
✅ Multi-Container Support
✅ Background Tracker Service
/proc/net/tcpinspection (no sudo required)✅ Telegram Bot Integration
Remote Management Commands:
/status— Full status report with active clients and top upload countries/peers— Show connected & connecting clients (now working on macOS)/uptime— Per-container uptime and 24h availability/containers— List all containers with detailed stats/restart_N,/stop_N,/start_N— Container management✅ Live Dashboard & Status Display
✅ Live Peers by Country (Interactive Map)
macOS-Specific Optimizations
Technical Implementation
1. Docker
/proc/net/tcpInspection (Eliminates sudo/tcpdump)2. Modern Bash via Homebrew
#!/opt/homebrew/bin/bash) in generated scripts3. File Ownership Management
fix_file_ownership()helper ensures proper permissionssudo4. macOS Command Compatibility
timeoutcommand dependency (not available by default on macOS)greppatterns for Docker STATS logs:grep "\[STATS\]"(with brackets)nohupusage with explicit bash interpreter pathBug Fixes from Initial PR
Critical Fixes
grep "STATS"togrep "\[STATS\]"timeoutcommand causing hangs on macOS (not in default PATH)settings.conf(container count was defaulting to 1)sudoTelegram Bot Fixes
/containerscommand showing "No stats available yet"/peerscommand (now working on macOS via Docker inspection)/peersin command list (was incorrectly disabled for macOS)UI/UX Fixes
║characters from Live Map header text linesTesting Performed
Comprehensive testing on macOS with Apple Silicon (M4):
/status,/peers,/uptime,/containers,/restart_N,/stop_N,/start_NDocumentation Updates
README.md
/peersto Telegram bot commands/proc/net/tcpoptimizationCode Comments
Platform Differences (macOS vs Linux)
--network=host-p)/proc/net/tcpVersion Information
Current: v1.1.0-Mac
Target Branch:
macos-edition(upstream)Base Branch:
macos-v1.2-porting(development)This release achieves feature parity with the Linux v1.1 edition while optimizing for macOS platform constraints.
Breaking Changes
None. This is purely additive. Existing v1.0.2 macOS installations will seamlessly upgrade to v1.1.
Future Work (v1.2+)
Planned enhancements for future releases:
Ready for merge - All features tested and working on macOS Apple Silicon.