Fix test output for speed limit and streamline traffic marking in iptables

This commit is contained in:
ImBenji
2025-08-05 13:48:59 +01:00
parent 2d692e0bc0
commit 0346d60a8a
2 changed files with 5 additions and 5 deletions

View File

@@ -79,7 +79,7 @@ class ApiTester {
print(' IP: $peerIP');
// Test 2: Set speed limit
e print('\n📋 TEST 2: Set speed limit (62500 bytes/s = 500 kbps)');
print('\n📋 TEST 2: Set speed limit (62500 bytes/s = 500 kbps)');
final speedResponse = await makeRequest('POST', '/api/peers/speed-limit', {
'publicKey': publicKey,
'bytesPerSecond': 62500, // 500 kbps = 500000 bits/s = 62500 bytes/s

View File

@@ -29,16 +29,16 @@ class TrafficControlService {
}
}
// Create separate classes for upload and download
final uploadMark = mark;
final downloadMark = mark + 1000; // Offset to avoid conflicts
print('Running iptables MARK commands for $peerIP...');
// Mark upload traffic (FROM peer) with uploadMark
await _runIptablesCommand(['-I', 'FORWARD', '-s', peerIP, '-j', 'MARK', '--set-mark', uploadMark.toString()]);
// Mark download traffic (TO peer) with downloadMark
await _runIptablesCommand(['-I', 'FORWARD', '-d', peerIP, '-j', 'MARK', '--set-mark', downloadMark.toString()]);
// Create separate classes for upload and download
final uploadMark = mark;
final downloadMark = mark + 1000; // Offset to avoid conflicts
print('Running tc class add/change commands for upload and download...');
// Upload class (traffic FROM peer)