Commit Graph

111 Commits

Author SHA1 Message Date
SamNet-dev
3654565b52 Update URLs to self-hosted Gitea 2026-02-20 23:35:17 -06:00
SamNet-dev
973d7b6749 fix: clarify firewall ports in About section — no inbound ports needed for Conduit/Snowflake 2026-02-18 16:55:00 -06:00
SamNet-dev
880f3d18a9 feat: v1.3.4 — Shir o Khorshid client mode, dpkg lock fix, pipe install fix
Add Conduit client mode menu (s) to switch between serving official
Psiphon clients and Shir o Khorshid users via --compartment flag.
Supports global toggle or per-container configuration. Status dashboard
and JSON output show active client mode. Installer now waits for dpkg
lock and menu opens correctly when run via curl | bash.
2026-02-14 17:48:29 -06:00
SamNet-dev
784956796d fix: wait for dpkg lock and fix menu not opening via curl pipe
install_package() now waits up to 60s for unattended-upgrades to
release the dpkg lock instead of failing immediately. Also redirect
stdin from /dev/tty when exec'ing the menu so the terminal check
passes when the installer was invoked via curl | bash.
2026-02-13 00:29:32 -06:00
SamNet-dev
b6e729cced feat: add port forwarding tip to MTProto initial setup 2026-02-12 15:16:21 -06:00
SamNet-dev
e07f400ed6 fix: uninstall telegram service error and add MTProto port tip
- Inline telegram_disable_service in uninstall() since the function
  is defined inside the MANAGEMENT heredoc and not available in the
  outer script scope
- Add port forwarding tip on MTProto proxy settings page
2026-02-12 15:08:58 -06:00
SamNet-dev
b887b72361 docs: update README for v1.3.3 2026-02-12 00:41:10 -06:00
SamNet-dev
bd9a34c2fe feat: v1.3.3 — Iran connectivity monitoring, network testing, and Psiphon stats
- Iran Connectivity Status: real-time monitoring with IODA, OONI,
  irinter.net, and Cloudflare Radar data with 7-day charts
- Iran Connectivity Test: diagnostics across 88 servers in 24 cities
  with quick test, full report, stability test, and MTU discovery
- Psiphon Network Stats: global analytics with daily users, bytes
  transferred, running proxies, and country distribution charts
- CLI Commands Reference page and reorganized Info & Help menu
- Updated license and screenshots
2026-02-12 00:40:22 -06:00
SamNet-dev
baee4cbfdb fix: public IP detection with validation and fallbacks 2026-02-11 12:07:14 -06:00
Mehrad Mahmoudian
051d238df8 fix the info box boundries (#43) 2026-02-11 08:36:00 -06:00
Mehrad Mahmoudian
baaee867b3 Fix alpine docker installation (#42)
* adds enabling the community repo in Alpine

* make the setup-apkrepos non-interactive
2026-02-11 08:29:31 -06:00
SamNet-dev
4924fa469c fix: post-install menu opens help instead of interactive menu 2026-02-11 01:44:13 -06:00
SamNet-dev
5884dfe284 fix: update badge not displaying on menu 2026-02-11 00:03:25 -06:00
SamNet-dev
73b51834d1 perf: optimize show_advanced_stats() — replace subshell loops with awk
- Container stats: single awk pass replaces ~10 echo|sed/cut/awk pipes per container
- Container logs: single awk per log file replaces ~8 subshell pipes per container
- Tracker data: awk pre-processing replaces bash while-read loops (slow on large files)
- Bar charts: printf+sed replaces character-by-character loops
- Network info: single ip route call instead of two
- Byte accumulation: bash arithmetic replaces awk subshells
2026-02-10 23:49:15 -06:00
SamNet-dev
b06b6b70ac fix: simplify update checker to SHA-only, add hex validation
Replace 70-line two-method checker (API + 530KB download fallback)
with 20-line SHA-only approach. Self-heals missing baseline on first
menu open. Add hex validation and --connect-timeout to all SHA saves.
2026-02-10 23:20:38 -06:00
SamNet-dev
be4aab13bd fix: Telegram bot multi-server — route /status and /peers via inline keyboard (#41)
When multiple servers share the same bot token, /status and /peers now
show a per-server inline button instead of responding immediately.
Only the server whose label matches the tapped callback responds;
others silently ignore. Fixes duplicate/endless responses.
2026-02-10 23:03:42 -06:00
SamNet-dev
685a72216c fix: update checker baseline — save SHA during install, never during menu check
Root cause: after update, .update_sha was deleted. First menu open stored
whatever the remote SHA was as baseline, silently swallowing any commits
pushed between the update and first menu open.

Fix: save commit SHA via GitHub API during install/update (baseline = what
was installed). Menu checker only compares, never establishes baseline.
Falls through to Method 2 (md5) if .update_sha is missing.
2026-02-10 22:33:28 -06:00
SamNet-dev
92267d037d perf: show_peers() — replace bash while-read loops with awk
- cumulative_data: single awk pass for per-country bytes + grand totals
- tracker_snapshot: single awk pass for bytes, unique IP counts, and totals
- Remove unused cumulative_ips parsing (dead code — populated but never displayed)
- Fix awk dedup bug: ft++/tt++ were outside if-block, counting total lines instead of unique IPs
2026-02-10 22:24:52 -06:00
SamNet-dev
8bf2f8c640 fix: update checker — lightweight API check with full-file fallback
Primary check uses GitHub API (Accept: application/vnd.github.sha)
for a ~40-byte response instead of downloading the full ~530KB file.
Falls back to full-file hash comparison if API is unreachable.

- Hex validation prevents false positives from proxy/CDN HTML responses
- All badge writes guarded with 2>/dev/null (no terminal noise)
- Separate connect-timeout (5s) from max-time for fast failure detection
- SHA baseline reset on install/update for clean re-establishment
2026-02-10 22:09:40 -06:00
SamNet-dev
34dc53615b fix: Telegram peer stats — scale to connected count with percentages
Match the dashboard's estimation logic: use snapshot country distribution
proportionally scaled to the actual connected client count, instead of
showing raw snapshot counts that don't align with the connected total.
2026-02-10 21:44:11 -06:00
SamNet-dev
6a977a487a fix: update checker — proper badge logic for missing hash baseline
When no .update_hash exists, compare VERSION strings to distinguish
fresh installs (same version = save baseline, no badge) from old
installs pre-hash-support (different version = show badge).
2026-02-10 21:25:44 -06:00
SamNet-dev
3ce0903955 fix: Telegram report — deduplicate peer counts, correct lifetime IPs source, add MTProxy status
- Top by peers: count unique IPs instead of lines (was 2x inflated from FROM+TO entries)
- Total lifetime IPs: use cumulative_ips file instead of tracker_snapshot (was showing last 15s cycle count)
- Add MTProxy status + traffic to both Telegram report functions when enabled and running
2026-02-10 21:11:30 -06:00
SamNet-dev
4043d176ca feat: v1.3.1 — MTProto proxy, auto-update checker, dashboard improvements
- Add Telegram MTProto Proxy (mtg v2) with TOML config, fake-TLS,
  share link & QR code, send to Telegram bot, resource management
- Add background auto-update checker with menu badge and optional
  48h cron-based automatic updates (--auto flag)
- Add MTProxy status line in main live dashboard when enabled
- Pin mtg image to nineseconds/mtg:2.1.7 for stability
- Add flock concurrency guard to prevent simultaneous updates
- Fix MTProto container startup (switch from CLI flags to TOML config)
- Clean up orphaned config on MTProto remove and full uninstall
- Gate initial setup QR/link display on successful container start
- Remove duplicate session traffic line from MTProto submenu
- Remove extra blank line in status display for better screen fit
- Move screenshots to screenshots/ folder
- Update README with v1.3.1 features (English + Farsi)
- Bump version badge to 1.3.1
2026-02-10 17:41:52 -06:00
SamNet-dev
814084b051 fix: Guard interactive menu against non-TTY invocation (#40)
If `conduit` is launched without arguments in a non-interactive context
(no terminal), show help and exit instead of entering the TUI menu
which could spin as a stray process.
2026-02-10 12:20:15 -06:00
SamNet-dev
d8331203a9 fix: Clear webhook before polling getUpdates in Telegram setup
If a bot token previously had a webhook configured (e.g. from a prior
install), getUpdates returns nothing and chat ID detection fails.
Adding deleteWebhook call before polling fixes fresh installs that
reuse an existing bot token.
2026-02-10 11:41:55 -06:00
SamNet-dev
258ff99109 fix: CPU alert uses system-wide /proc/stat instead of Docker container CPU
The Telegram bot's CPU alert was reading from docker stats (per-container
CPU), producing nonsensical values like 183%, 228%, 297% on multi-core
systems. Replaced with /proc/stat delta-based system-wide CPU — the same
method the TUI dashboard uses.

Changes:
- CPU alert now reads system-wide CPU from /proc/stat (0-100% range)
- Threshold raised from 90% to 96%
- Added TELEGRAM_CPU_ALERT toggle (option 6 in Telegram settings menu)
- RAM alert kept separate, still uses docker stats (per-container memory)
- /settings Telegram command now shows CPU alert status
2026-02-10 11:00:50 -06:00
SamNet-dev
f7f2ae3047 fix: load_servers() clobbering caller's local variables (#39)
load_servers() used `label`, `conn`, `auth_type` as while-read loop
variables, which clobbered identically-named locals in
add_server_interactive() due to bash dynamic scoping. This caused the
server label to be empty when adding a 2nd+ server.

Rename loop variables to `_l`, `_c`, `_a` to avoid the collision.

Closes #39
2026-02-10 01:30:13 -06:00
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