Enhance traffic capture testing with longer timeouts and additional checks

This commit is contained in:
ImBenji
2025-08-29 01:48:45 +01:00
parent b03378c99d
commit aa5b609d09

View File

@@ -187,12 +187,15 @@ class ProtocolBlockingService {
return; return;
} }
// Test very basic traffic capture from peer print('🔍 Testing live traffic capture for peer $peerIP...');
// Test very basic traffic capture from peer - longer timeout
final process = await Process.start('timeout', [ final process = await Process.start('timeout', [
'3', '10', // Longer timeout to catch browsing traffic
'tcpdump', 'tcpdump',
'-i', 'wg0', '-i', 'wg0',
'-c', '1', '-c', '5', // Capture multiple packets
'-v', // Verbose output
'host $peerIP', 'host $peerIP',
]); ]);
@@ -205,11 +208,36 @@ class ProtocolBlockingService {
process.kill(); process.kill();
if (exitCode == 0 && output.isNotEmpty) { if (exitCode == 0 && output.isNotEmpty) {
print('Can see traffic from peer $peerIP on wg0'); print('LIVE TRAFFIC DETECTED from peer $peerIP:');
print(' Sample: ${output.join().trim()}'); print('${output.join().trim()}');
print('───────────────────────────────────────');
} else { } else {
print('❌ No traffic detected from peer $peerIP on wg0 in 3 seconds'); print('❌ No traffic detected from peer $peerIP in 10 seconds');
print(' This suggests the peer is inactive or traffic routing issue'); print(' Try browsing a website now...');
// Also test ANY traffic on wg0
print('🔍 Testing if wg0 interface has ANY traffic...');
final anyTrafficProcess = await Process.start('timeout', [
'5',
'tcpdump',
'-i', 'wg0',
'-c', '3',
]);
final anyOutput = <String>[];
await for (final data in anyTrafficProcess.stdout) {
anyOutput.add(String.fromCharCodes(data));
}
final anyExitCode = await anyTrafficProcess.exitCode;
anyTrafficProcess.kill();
if (anyExitCode == 0 && anyOutput.isNotEmpty) {
print('✅ wg0 has traffic, but not from expected peer IP:');
print('${anyOutput.join().trim()}');
} else {
print('❌ No traffic at all on wg0 interface');
}
} }
} catch (e) { } catch (e) {
print('❌ Error testing peer $peerIP connectivity: $e'); print('❌ Error testing peer $peerIP connectivity: $e');