v1.0.5: dual-stack IPv6, pure AmneziaWG, scrub leaks, verifySession fix

This commit is contained in:
esefxdz committed 2026-07-16 20:02:37 +03:00
1 parent d6bdef4d89
commit 259db2f386
9 files changed
+97 -64

No files matched your search

+17 -14
View File
@@ -10,25 +10,28 @@ class AppConfig {
static const String serverIp = '127.0.0.1'; // REPLACE WITH REAL IP
// ── STEP 2: WireGuard UDP traffic port (default: 51820) ───────────────────
static const String wgPort = '4433';
static const String wgPort = '51820'; // REPLACE WITH REAL PORT
// ── STEP 3: AmneziaWG DPI Obfuscation Settings ───────────────────────────
// These parameters must match exactly what your amnezia-wg-easy server expects.
static const int awgJc = 4;
static const int awgJmin = 20;
static const int awgJmax = 100;
static const int awgS1 = 15;
static const int awgS2 = 23;
static const int awgH1 = 1;
static const int awgH2 = 2;
static const int awgH3 = 3;
static const int awgH4 = 4;
// Copy these from your real app_config.dart or your amnezia-wg-easy server.
// All zeros = AmneziaWG obfuscation disabled (no DPI protection).
static const int awgJc = 0; // REPLACE
static const int awgJmin = 0; // REPLACE
static const int awgJmax = 0; // REPLACE
static const int awgS1 = 0; // REPLACE
static const int awgS2 = 0; // REPLACE
static const int awgH1 = 0; // REPLACE
static const int awgH2 = 0; // REPLACE
static const int awgH3 = 0; // REPLACE
static const int awgH4 = 0; // REPLACE
// ── STEP 4: AdMob Rewarded Video ID ──────────────────────────────────────
static const String adUnitId = 'ca-app-pub-0000000000000000/0000000000'; // REPLACE WITH REAL AD UNIT
// ── STEP 4: AdMob IDs ───────────────────────────────────────────────────
// Also create android/admob.properties from the template in that folder.
static const String admobAppId = 'ca-app-pub-0000000000000000~0000000000'; // REPLACE
static const String adUnitId = 'ca-app-pub-0000000000000000/0000000000'; // REPLACE
// ── STEP 5: Network & Tunnel Settings ────────────────────────────────────
static const String dnsServers = '1.1.1.1, 1.0.0.1';
static const String dnsServers = '1.1.1.1, 1.0.0.1, 2606:4700:4700::1111, 2606:4700:4700::1001';
static const String allowedIps = '0.0.0.0/0, ::/0';
static const int mtu = 1280;
static const int persistentKeepalive = 25;
+7 -2
View File
@@ -51,14 +51,19 @@ class HivemindService {
if (data['active'] == true && data['client_ip'] != null && data['server_pubkey'] != null) {
final clientIp = data['client_ip'];
final clientIpv6 = data['client_ipv6'] ?? '';
final serverPubkey = data['server_pubkey'];
// Build dual-stack Address: IPv4/16 + optional IPv6/80
final addresses = clientIpv6.isNotEmpty
? '$clientIp/16, $clientIpv6/80'
: '$clientIp/16';
// Construct the WireGuard config locally
// I CHANGED IPS MAY BREAK STUFF
final configText = '''
[Interface]
PrivateKey = $privKey
Address = $clientIp/16
Address = $addresses
DNS = ${AppConfig.dnsServers}
MTU = ${AppConfig.mtu}
Jc = ${AppConfig.awgJc}
+16 -4
View File
@@ -215,11 +215,23 @@ class VpnConnection extends ChangeNotifier {
);
// ── Step 3: Verify the server session is alive ──────────────────
// The tunnel is up but the server might not have a session yet.
// Do a quick one-shot status check before telling the UI we're
// connected — if the session doesn't exist, tear down and fail.
// The tunnel just came up — give it a moment to stabilise before
// making an HTTP call through it, otherwise DNS/resolution can fail.
_setStatus(VpnStatus.connecting, 'Verifying session…');
final sessionOk = await HivemindService.verifySession();
await Future.delayed(const Duration(seconds: 1));
// Retry once if the first attempt fails — the tunnel may need a
// moment to settle before outbound HTTP works reliably.
bool sessionOk = false;
for (int attempt = 0; attempt < 2; attempt++) {
sessionOk = await HivemindService.verifySession();
if (sessionOk) break;
if (attempt == 0) {
debugPrint('[VPN] verifySession attempt 1 failed, retrying…');
await Future.delayed(const Duration(seconds: 2));
}
}
if (!sessionOk) {
debugPrint('[VPN] Tunnel started but no server session — tearing down.');
try {