Macos v1.1 porting (please ignore the version in branch name)#35
Open
PouriaCh wants to merge 9 commits intoSamNet-dev:macos-editionfrom
Open
Macos v1.1 porting (please ignore the version in branch name)#35PouriaCh wants to merge 9 commits intoSamNet-dev:macos-editionfrom
PouriaCh wants to merge 9 commits intoSamNet-dev:macos-editionfrom
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>
Author
|
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>
Owner
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.