Commit Graph

634 Commits

Author SHA1 Message Date
Alexey 158eae8d2a
Antireplay Improvements + DC Ping
- Fix: LruCache::get type ambiguity in stats/mod.rs
  - Changed `self.cache.get(&key.into())` to `self.cache.get(key)` (key is already &[u8], resolved via Box<[u8]>: Borrow<[u8]>)
  - Changed `self.cache.peek(&key)` / `.pop(&key)` to `.peek(key.as_ref())` / `.pop(key.as_ref())` (explicit &[u8] instead of &Box<[u8]>)

- Startup DC ping with RTT display and improved health-check (all DCs, RTT tracking, EMA latency, 30s interval):
  - Implemented `LatencyEma` – exponential moving average (α=0.3) for RTT
  - `connect()` – measures RTT of each real connection and updates EMA
  - `ping_all_dcs()` – pings all 5 DCs via each upstream, returns `Vec<StartupPingResult>` with RTT or error
  - `run_health_checks(prefer_ipv6)` – accepts IPv6 preference parameter, rotates DC between cycles (DC1→DC2→...→DC5→DC1...), interval reduced to 30s from 60s, failed checks now mark upstream as unhealthy after 3 consecutive fails
  - `DcPingResult` / `StartupPingResult` – public structures for display
  - DC Ping at startup: calls `upstream_manager.ping_all_dcs()` before accept loop, outputs table via `println!` (always visible)
  - Health checks with `prefer_ipv6`: `run_health_checks(prefer_ipv6)` receives the parameter
  - Exported `StartupPingResult` and `DcPingResult`

- Summary: Startup DC ping with RTT, rotational health-check with EMA latency tracking, 30-second interval, correct unhealthy marking after 3 fails.

Co-Authored-By: brekotis <93345790+brekotis@users.noreply.github.com>
2026-02-07 20:18:25 +03:00
Alexey 92cedabc81
Zeroize for key + log refactor + fix tests
- Fixed tests that failed to compile due to mismatched generic parameters of HandshakeResult:
  - Changed `HandshakeResult<i32>` to `HandshakeResult<i32, (), ()>`
  - Changed `HandshakeResult::BadClient` to `HandshakeResult::BadClient { reader: (), writer: () }`

- Added Zeroize for all structures holding key material:
  - AesCbc – key and IV are zeroized on drop
  - SecureRandomInner – PRNG output buffer is zeroized on drop; local key copy in constructor is zeroized immediately after being passed to the cipher
  - ObfuscationParams – all four key‑material fields are zeroized on drop
  - HandshakeSuccess – all four key‑material fields are zeroized on drop

- Added protocol‑requirement documentation for legacy hashes (CodeQL suppression) in hash.rs (MD5/SHA‑1)

- Added documentation for zeroize limitations of AesCtr (opaque cipher state) in aes.rs

- Implemented silent‑mode logging and refactored initialization:
  - Added LogLevel enum to config and CLI flags --silent / --log-level
  - Added parse_cli() to handle --silent, --log-level, --help
  - Restructured main.rs initialization order: CLI → config load → determine log level → init tracing
  - Errors before tracing initialization are printed via eprintln!
  - Proxy links (tg://) are printed via println! – always visible regardless of log level
  - Configuration summary and operational messages are logged via info! (suppressed in silent mode)
  - Connection processing errors are lowered to debug! (hidden in silent mode)
  - Warning about default tls_domain moved to main (after tracing init)

Co-Authored-By: brekotis <93345790+brekotis@users.noreply.github.com>
2026-02-07 19:49:41 +03:00
Alexey b9428d9780
Antireplay on sliding window + SecureRandom 2026-02-07 18:26:44 +03:00
Alexey 5876f0c4d5
Update rust.yml 2026-02-07 17:58:10 +03:00
Alexey 94750a2749
Update README.md 2026-01-22 03:33:13 +03:00
Alexey cf4b240913
Update README.md 2026-01-22 03:26:34 +03:00
Alexey 1424fbb1d5
Update README.md 2026-01-22 03:19:50 +03:00
Alexey 97f4c0d3b7
Update README.md 2026-01-22 03:17:37 +03:00
Alexey 806536fab6
Update README.md 2026-01-22 03:14:39 +03:00
Alexey df8cfe462b
Update README.md 2026-01-22 03:13:08 +03:00
Alexey a5f1521d71
Update README.md 2026-01-22 03:07:38 +03:00
Alexey 8de7b7adc0
Update README.md 2026-01-22 03:03:19 +03:00
Alexey cde1b15ef0
Update config.toml 2026-01-22 02:45:30 +03:00
Alexey 46e4c06ba6
Update README.md 2026-01-22 01:59:18 +03:00
Alexey b7673daf0f
Update README.md 2026-01-22 01:57:44 +03:00
Alexey 397ed8f193
Update README.md 2026-01-22 01:56:42 +03:00
Alexey d90b2fd300
Update README.md 2026-01-22 01:55:31 +03:00
Alexey d62136d9fa
Update README.md 2026-01-22 01:53:05 +03:00
Alexey 0f8933b908
Update README.md 2026-01-22 01:48:37 +03:00
Alexey 0ec87974d1
Update README.md 2026-01-22 01:47:43 +03:00
Alexey c8446c32d1
Update README.md 2026-01-22 01:46:28 +03:00
Alexey f79a2eb097
Update README.md 2026-01-22 01:26:36 +03:00
Alexey dea1a3b5de
Update README.md 2026-01-22 01:16:46 +03:00
Alexey 97ce235ae4
Update README.md 2026-01-22 01:16:35 +03:00
Alexey d04757eb9c
Update README.md 2026-01-20 11:13:33 +03:00
Alexey 2d7901a978
Update README.md 2026-01-20 11:09:24 +03:00
Alexey 3881ba9bed
1.1.1.0 2026-01-20 02:09:56 +03:00
Alexey 5ac9089ccb
Update README.md 2026-01-20 01:39:59 +03:00
Alexey eb8b991818
Update README.md 2026-01-20 01:32:39 +03:00
Alexey 2ce8fbb2cc
1.1.0.0 2026-01-20 01:20:02 +03:00
Alexey 038f0cd5d1
Update README.md 2026-01-19 23:52:31 +03:00
Alexey efea3f981d
Update README.md 2026-01-19 23:51:43 +03:00
Alexey 42ce9dd671
Update README.md 2026-01-12 22:11:21 +03:00
Alexey 4fa6867056
Merge pull request #7 from telemt/1.0.3.0
1.0.3.0
2026-01-12 00:49:31 +03:00
Alexey 54ea6efdd0
Global rewrite of AES-CTR + Upstream Pending + to_accept selection 2026-01-12 00:46:51 +03:00
brekotis 27ac32a901
Fixes in TLS for iOS 2026-01-12 00:32:42 +03:00
Alexey 829f53c123
Fixes for iOS 2026-01-11 22:59:51 +03:00
Alexey 43eae6127d
Update README.md 2026-01-10 22:17:03 +03:00
Alexey a03212c8cc
Update README.md 2026-01-10 22:15:02 +03:00
Alexey 2613969a7c
Update rust.yml 2026-01-09 23:15:52 +03:00
Alexey be1b2db867
Update README.md 2026-01-08 02:10:34 +03:00
Alexey 8fbee8701b
Update README.md 2026-01-08 02:10:02 +03:00
Alexey 952d160870
Update README.md 2026-01-08 02:03:30 +03:00
Alexey 91ae6becde
Update README.md 2026-01-08 02:01:50 +03:00
Alexey e1f576e4fe
Update README.md 2026-01-08 02:00:27 +03:00
Alexey a7556cabdc
Update README.md 2026-01-07 19:12:16 +03:00
Alexey b2e8d16bb1
Update README.md 2026-01-07 19:10:04 +03:00
Alexey d95e762812
Update README.md 2026-01-07 19:07:08 +03:00
Alexey 384f927fc3
Update README.md 2026-01-07 19:06:28 +03:00
Alexey 1b7c09ae18
Update README.md 2026-01-07 18:54:44 +03:00