Fix test output for speed limit and streamline traffic marking in iptables
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user