Commit Graph

84 Commits

Author SHA1 Message Date
SamNet-dev
5b6a5963ad fix: Locale-safe CPU value for snowflake docker --cpus flag (#38)
awk printf "%.2f" outputs "1,00" instead of "1.00" on systems with
comma-decimal locales (Turkish, German, etc.), causing docker to
reject the --cpus value. Force LC_ALL=C for the awk call.
2026-02-09 19:10:06 -06:00
SamNet-dev
a96c03dfe3 fix: Complete stdout suppression in restart_conduit() 2026-02-09 18:51:40 -06:00
SamNet-dev
19c17d1eac fix: Show docker errors on snowflake-proxy creation failure (#38)
- Capture and display docker run stderr instead of silently discarding it
- Suppress docker volume create / docker rm stdout leaks (snowflake-data)
- Auto-pull snowflake image if not cached locally before docker run
- Add Phase 4 to update flow: pull snowflake image alongside conduit image
- Fix same stdout leaks in start_conduit/restart_conduit/recreate_containers
2026-02-09 18:45:41 -06:00
SamNet-dev
aacaa36e88 perf: Optimize show_status() refresh — ~2x faster, 70% fewer forks
- Cache get_net_speed() every 2 cycles (saves 500ms on alternate refreshes)
- Single-pass awk for 6h/12h/24h connection snapshots (1 read instead of 3)
- Parallelize Snowflake Prometheus metric fetches across instances
- Cache systemctl init system detection per session
- Reuse running_count for service status instead of extra docker ps call
- Remove dead get_connection_snapshot() function
2026-02-09 18:29:53 -06:00
SamNet-dev
6c352b6d24 feat: v1.3 — Snowflake proxy, multi-server dashboard, non-root SSH, audit fixes
Major features:
- Snowflake proxy management with per-country stats and Prometheus metrics
- Multi-server dashboard TUI with live refresh, bulk actions, server management
- Non-root SSH support with automatic sudo prefix and passwordless sudo detection
- Data cap monitoring with per-direction (upload/download/total) enforcement
- Remote server table with CPU(temp), upload, download columns

Improvements:
- TB support in all byte formatters (format_bytes, _fmt_bytes, format_gb)
- Snowflake timeout display in detailed views, "connections served" labeling
- Stricter Docker container name matching in service status check
- check_alerts() now aggregates CPU/RAM across all containers
- Network interface detection uses keyword matching instead of fragile position
- Tracker stuck-container Telegram notification uses direct curl (standalone fix)
- Timeout exit code check corrected (SIGTERM=143, not SIGKILL=137)
- Hardened backup filename quoting in docker sh -c
- README updated for v1.3 with full English and Farsi changelogs
2026-02-09 16:31:09 -06:00
SamNet-dev
fd6ca7aaaf feat: Add system CPU, temperature, and RAM to Telegram reports
- Split CPU display into App CPU (containers) and System CPU (host)
- Added CPU temperature from hwmon (cross-platform)
- Added system RAM usage alongside app RAM
- Added get_container_stats() to telegram script for proper aggregation
- Fixed build_report() to aggregate all containers instead of head -1
2026-02-08 16:29:25 -06:00
SamNet-dev
241d946887 fix: Regenerate Telegram script on update for seamless fixes
Added regen-telegram to update-components so Telegram bot code gets
updated automatically when users run conduit update. No re-setup needed.
2026-02-06 15:48:55 -06:00
SamNet-dev
6992d8def0 fix: Prevent Telegram bot from repeating commands on file write failure
Use in-memory offset as primary tracker instead of relying solely on
last_update_id file. File is only read on first call for persistence
across restarts. Commands process correctly even if file is not writable.

Fixes #34
2026-02-06 15:44:29 -06:00
SamNet-dev
cd2827b3fe fix: Fix tracker container names, log parsing, and regeneration
- Tracker used wrong container names (intgpsiphonclient instead of conduit)
- Tracker parsed numClients instead of [STATS] Connected: format
- Tracker script was never regenerated on update (function was inside heredoc)
- Added regen-tracker command and --update-components now calls it
- Dashboard skips recording when tracker is active (no double entries)
2026-02-06 09:02:28 -06:00
SamNet-dev
e8b3dd8e9c fix: Load settings.conf in tracker for correct container count
Tracker was not loading settings.conf, so CONTAINER_COUNT defaulted to 1.
This caused connection history to record 0 for all entries, resulting in
wrong average and 6h/12h/24h snapshot values.
2026-02-06 08:32:37 -06:00
SamNet-dev
5cce34f649 fix: Improve CPU temp accuracy and optimize average calculation
- Read CPU temp from hwmon (coretemp/k10temp) instead of thermal_zone0
- Average all CPU core temperatures for accurate reading
- Support Intel, AMD, and ARM thermal drivers
- Cache average connections for 5 minutes to reduce file I/O
- Split dashboard footer into two lines for better readability
2026-02-05 16:31:37 -06:00
SamNet-dev
03f69f4b04 feat: Add peak, average, and connection history tracking (v1.2.1)
- Add peak connections tracking (persistent, resets on container restart)
- Add average connections display on dashboard
- Add 6h/12h/24h connection history snapshots
- Background tracker records connections 24/7 (not just when dashboard open)
- Implement temporal sampling: 15s capture, 15s sleep, 2x multiplier (~40-50% CPU reduction)
- Add info page [4] explaining Peak, Avg, and history stats
- Smart data reset: only resets when ALL containers restart
- Update README with v1.2.1 features (English & Farsi)
- Simplify RAM recommendations to focus on CPU
2026-02-05 15:39:12 -06:00
SamNet-dev
a2baa16a9b fix: Improve traffic tracking accuracy and reduce CPU usage
- Fix tracker double-counting by capturing only on external interface
  instead of all interfaces (-i any → -i $CAPTURE_IFACE)
- Increase docker logs tail from 30 to 200 for reliable stats capture
- Add stats caching to show last known values when logs are busy
- Reduce dashboard refresh interval from 4s to 10s for lower CPU load
- Add docker stats caching (refresh every 20s) to reduce docker overhead
2026-02-05 12:50:09 -06:00
SamNet-dev
80d06c520c feat: Add CPU temperature display next to system CPU load 2026-02-05 09:19:43 -06:00
SamNet-dev
bb56a77c37 fix: Improve container recommendations and health check reliability
- Simplify recommendation to 1 container per core, limited by RAM (1 per GB)
- Show [1-32] range so users know min/max limits
- Add rec_containers calculation in manage_containers() (was missing)
- Block adding containers when already at 32 maximum
- Use docker --filter for reliable health check instead of grep
2026-02-04 23:47:57 -06:00
Antoine
7515443563 feat: Remove fixed 5-container limit and enable scalable container management (#33)
- Allow unlimited container count with dynamic recommendations based on CPU/RAM
- Add hard cap of 32 containers to prevent excessive scaling
- Fix regex patterns for container/volume cleanup (conduit-2, conduit-data-2, etc.)
- Clean up stale per-container settings on scale-down
- Update README recommendations

Co-authored-by: Antoine <a.bayard@live.fr>
2026-02-04 23:23:17 -06:00
SamNet-dev
f17760ba5b feat: Add option to disable tracker for CPU savings
Adds toggle in Settings & Tools menu to enable/disable the traffic
tracker. When disabled, saves ~15-25% CPU on busy servers. Features
that depend on tracker (live peers, advanced stats, country breakdown)
show helpful messages directing users to re-enable.
2026-02-03 15:16:23 -06:00
SamNet-dev
8d86f0fd95 perf: Reduce tracker CPU overhead with snaplen and longer sync interval 2026-02-03 14:44:49 -06:00
SamNet-dev
8c7f944d84 docs: Add macOS support section with credit to @PouriaCh 2026-02-03 14:09:01 -06:00
SamNet-dev
6f498580f7 Only restart tracker on menu open if script changed
Compare md5 hash before/after regenerating tracker script to avoid
unnecessary restarts and traffic data loss on every menu open.
Also consolidate daemon-reload calls in show_menu auto-fix block.
2026-01-31 13:05:13 -06:00
SamNet-dev
28c137342e Fix dashboard service/tracker status flickering
Show service status based on actual container state instead of systemd
oneshot status. Remove systemctl calls from restart to prevent tracker
flip-flopping.
2026-01-31 12:52:03 -06:00
SamNet-dev
fcca48bd31 Fix 'Text file busy' error when opening menu from curl install
Write management script to temp file then atomic mv to avoid overwriting
a running script. Adds error handling for failed writes.
2026-01-31 12:40:14 -06:00
SamNet-dev
eedb61a22f Show bot token input when typing in Telegram setup wizard
Remove silent flag (-s) from read so users can see what they type.
2026-01-31 12:37:02 -06:00
SamNet-dev
fbd2176b85 Fix service inactive on dashboard after restart and update
Sync systemd service state after container restart so dashboard shows
Active. Patch conduit.service during update for existing snap Docker users.
2026-01-31 12:33:36 -06:00
SamNet-dev
749621ccfd Fix systemd services failing on snap Docker installs
Replace Requires=docker.service with Wants=docker.service so services
can start when Docker is installed via snap instead of apt. Auto-patch
existing service files on menu load for users upgrading from older versions.
2026-01-31 12:23:15 -06:00
SamNet-dev
d5b68a38fa Merge branch 'beta-releases' 2026-01-30 22:14:12 -06:00
SamNet-dev
78b96e3de5 Add available commands list to Telegram test message 2026-01-30 22:13:55 -06:00
SamNet-dev
f2e7986e78 Add missing Telegram commands to README (/status, /peers, /uptime) 2026-01-30 22:10:34 -06:00
SamNet-dev
69c12bdc6b Add TUI screenshots to README and remove old images 2026-01-30 17:21:29 -06:00
SamNet-dev
fb6fdac7c9 Update README for v1.2 stable release with Farsi translation 2026-01-30 17:13:00 -06:00
SamNet-dev
e1a04e065c Release v1.2: hardening, version bump, README update
- Atomic settings.conf writes (write to tmp, then mv)
- Secure temp dirs with mktemp (5 locations)
- Add set -eo pipefail for pipe failure detection
- Add timeout 10 to all docker stats calls
- Update version from 1.2-Beta to 1.2
- Update URL from beta-releases to main
- README updated for stable release
2026-01-30 16:56:34 -06:00
SamNet-dev
7bd32e0124 Fix Telegram report accuracy: increase log tail, add connecting count
- Increase --tail from 50 to 400 in all Telegram docker logs calls
- Add connecting peer count to match TUI format
- Format: "Clients: X connected, Y connecting" consistently
2026-01-30 16:29:02 -06:00
SamNet-dev
774acbaa4f Add /start reminder in Telegram bot setup wizard
Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-30 15:48:47 -06:00
SamNet-dev
8bf5e186fb Update README with resource limits, performance optimizations, and new Telegram commands
Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-30 15:41:52 -06:00
SamNet-dev
972dee6a3e Add per-container resource limits and optimize TUI performance
Features:
- Per-container CPU and memory limits via Settings menu
- Resource limit prompts when adding containers in Container Management
- Smart defaults based on system specs (cores, RAM)
- Limits persist in settings.conf and apply on container create/recreate
- Settings table shows CPU/Memory columns alongside max-clients/bandwidth
- Resource limit changes detected on restart/start, triggering container recreation

Performance optimizations:
- Parallelize all docker logs calls across containers (background jobs)
- Run docker stats, system stats, and net speed concurrently
- Batch docker inspect calls instead of per-container
- Parallel container stop/remove with -t 3 timeout (was 10s default)
- All screens optimized: Status, Container Management, Advanced Stats, Live Peers

Bug fixes:
- Normalize grep pattern to [STATS] across all screens
- Clean temp dirs before reuse to prevent stale data reads
- Check exit status on container remove operations

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-30 15:26:50 -06:00
SamNet-dev
5965874d3f Add Telegram container management, self-updating script, enhanced reports
- Add /containers command: per-container status with peers, data up/down
- Add /restart_N, /stop_N, /start_N commands for remote container control
- Add /uptime command: per-container uptime + 24h availability
- Self-updating script: menu option downloads latest conduit.sh from GitHub
- Add --update-components flag for script/tracker/telegram regeneration
- Extract recreate_containers() for reusable container recreation
- Interactive Docker image update with user confirmation
- 24h availability window instead of all-time percentage
- Uptime streak tracking in reports
- Container restart counts in reports
- Top countries by connected peers section
- Separate "Top by upload" vs "Top by peers" in reports
- Defensive variable defaults (CONTAINER_COUNT, DATA_CAP_GB)
- Fix get_container_name in Telegram script (conduit-N not conduitN)
2026-01-30 14:16:00 -06:00
SamNet-dev
3c36c0d23a Simplify peers view: show only current clients per country
- Rename Telegram "Active clients" to "Unique IPs served"
- Remove cumulative IP count from peers view columns
- Show only estimated current clients per country
2026-01-30 12:49:26 -06:00
SamNet-dev
a82f108760 Clarify traffic labels: current session vs cumulative
- Traffic header now says "current session" to indicate it resets on restart
- TOP 5 UPLOAD header now says "cumulative" to show it persists across restarts
2026-01-30 11:08:49 -06:00
SamNet-dev
381d1e4ed4 Fix input/output error infinite loop on broken /dev/tty
- Install menu: exit cleanly instead of looping forever when terminal unavailable
- Container management: detect instant read failures vs normal 5s timeout refresh
2026-01-30 10:54:25 -06:00
SamNet-dev
8d7fa411f9 Add server label, IP identification, and wall-clock report scheduling
- Prepend server label + public IP to all Telegram messages (multi-server support)
- Configurable server label via menu option 8 (defaults to hostname)
- Wall-clock aligned report scheduling with configurable start hour
- Start hour selection in both interval menu and setup wizard
- Markdown-escape server label in both main and standalone scripts
- Preserve start hour and server label on wizard cancel/failure paths
2026-01-30 10:37:47 -06:00
SamNet-dev
e5fcb6042a Phase 1: Telegram bot expansion, smart restart, bug fixes
New features:
- Uptime tracking with availability % in reports
- Alert system (CPU/RAM >90%, all containers down, zero peers 2h)
- Daily and weekly summary reports with bandwidth/peers/uptime stats
- Telegram bot commands (/status, /peers, /help)
- Toggle menu for alerts, daily/weekly summaries (options 5-7)
- Health check: tracker service, tcpdump, GeoIP, data validation
- Cumulative data log rotation with monthly archives (3-month retention)

Improvements:
- Smart restart: only recreate containers when settings change
- Stopped containers resumed with docker start instead of recreate
- Upgrade path regenerates Telegram script automatically
- Update conduit backs up tracker data and refreshes Telegram service
- Daily/weekly summary timestamps persist across service restarts

Bug fixes:
- Empty container list no longer triggers docker stats on all host containers
- process_commands recovers from malformed Telegram API responses
- Tracker service stopped before data backup to prevent write races
- Docker logs calls wrapped with timeout to prevent hangs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 10:12:25 -06:00
SamNet-dev
9a73ef5836 Add tracker restart option in settings, auto-regenerate tracker on upgrade 2026-01-30 08:48:24 -06:00
SamNet-dev
4defa70da0 Fix integer comparison error in Telegram report when no containers match 2026-01-30 00:58:54 -06:00
SamNet-dev
639e6fe6b1 v1.2-Beta: Telegram notifications, bug fixes, compact number display 2026-01-30 00:50:46 -06:00
SamNet-dev
35ea7bf256 Add auto-restart for stuck containers, tracker service fix, data cap signal 2026-01-29 20:15:48 -06:00
SamNet-dev
827c8d2e71 Fix false WAITING status in health check for connected containers without stats 2026-01-29 19:21:56 -06:00
SamNet-dev
72dee2fb3f Fix container management bugs: start/stop/restart logic
- Fix [s] Start in container menu to resume stopped containers with
  docker start instead of docker run (name already in use error)
- Add safety check in run_conduit_container() to remove existing
  containers before docker run to prevent conflicts
- Fix [t] Stop and [x] Restart to check exit codes and show accurate status
- Add warning in main menu Start (option 5) when recreating stopped containers
2026-01-29 19:04:35 -06:00
SamNet-dev
9680fad2e8 fix: Multiple bug fixes for TUI stability and correctness 2026-01-29 17:32:36 -06:00
8519627e54 Update QR code linking instructions in README 2026-01-29 10:52:26 -06:00
f4db8b859e Add rewards section to README
Added rewards section with QR code instructions for claiming OAT tokens.
2026-01-29 10:45:38 -06:00