Enhance traffic capture testing with longer timeouts and additional checks
This commit is contained in:
@@ -187,12 +187,15 @@ class ProtocolBlockingService {
|
||||
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', [
|
||||
'3',
|
||||
'10', // Longer timeout to catch browsing traffic
|
||||
'tcpdump',
|
||||
'-i', 'wg0',
|
||||
'-c', '1',
|
||||
'-c', '5', // Capture multiple packets
|
||||
'-v', // Verbose output
|
||||
'host $peerIP',
|
||||
]);
|
||||
|
||||
@@ -205,11 +208,36 @@ class ProtocolBlockingService {
|
||||
process.kill();
|
||||
|
||||
if (exitCode == 0 && output.isNotEmpty) {
|
||||
print('✅ Can see traffic from peer $peerIP on wg0');
|
||||
print(' Sample: ${output.join().trim()}');
|
||||
print('✅ LIVE TRAFFIC DETECTED from peer $peerIP:');
|
||||
print('${output.join().trim()}');
|
||||
print('───────────────────────────────────────');
|
||||
} else {
|
||||
print('❌ No traffic detected from peer $peerIP on wg0 in 3 seconds');
|
||||
print(' This suggests the peer is inactive or traffic routing issue');
|
||||
print('❌ No traffic detected from peer $peerIP in 10 seconds');
|
||||
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) {
|
||||
print('❌ Error testing peer $peerIP connectivity: $e');
|
||||
|
||||
Reference in New Issue
Block a user