Throttling
Throttling feature
General overview
Throttling feature depends on two entities: Session
and Speed Limit
.
Session
is a group of packages between local process and remote servers. For TCP
protocol Session is the same with TCP
connection and rules will be applied when application is establishing the connection but UPD
protocol works a bit different. UDP
protocol has no determined session and Netfilter
groups packages by the pair of the local and remote IP address
plus Port
. It works by this way for performance reasons and this approach is available because applications with UPD
communication listen the same local port for NAT passthrough
from the server side.
All Sessions
can be applied to the one of pre-registered Speed Limits
. SDK
assigns Speed Limit
on the Session
start and all other work occurs on the Netfilter
kernel driver level.
Throttling is applied independent with bypass and route via rules.
Throttling is applied to the new Sessions
only. Existed Sessions
will not be affected.
Additional info about common mistakes can be found on the page Common issues.
Commands
Requests presented below are used for configuring throttling:
RemoveProcess - removes process from throttling list
var throttlingRequest = new ThrottlingRequest
{
RemoveProcess = new List<RemoveProcessRequest>
{
new RemoveProcessRequest { Process = "processName" },
},
};
RemoveAllProcesses - removes all processes from throttling list
var throttlingRequest = new ThrottlingRequest
{
RemoveAllProcesses = EmptyRequest.Empty,
};
ClearSpeedLimits - clears speed limits
var throttlingRequest = new ThrottlingRequest
{
ClearSpeedLimits = new List<ClearSpeedLimitRequest>
{
new ClearSpeedLimitRequest { SpeedLimitId = id },
},
};
RemoveSpeedLimit - removes speed limits
var throttlingRequest = new ThrottlingRequest
{
RemoveSpeedLimit = new List<RemoveSpeedLimitRequest>
{
new RemoveSpeedLimitRequest { SpeedLimitId = id },
},
};
RemoveAllSpeedLimits - removes speed limits
var throttlingRequest = new ThrottlingRequest
{
RemoveAllSpeedLimits = EmptyRequest.Empty,
};
DefaultSpeedLimit - sets the default speed limit
var throttlingRequest = new ThrottlingRequest
{
DefaultSpeedLimit = new DefaultSpeedLimitRequest
{
DownloadSpeed = RxSpeedValue,
UploadSpeed = TxSpeedValue,
},
};
SetSpeedLimit - sets the speed limit
var throttlingRequest = new ThrottlingRequest
{
DefaultSpeedLimit = new List<SetSpeedLimitRequest>
{
new SetSpeedLimitRequest
{
DownloadSpeed = RxSpeedValue,
UploadSpeed = TxSpeedValue,
SpeedLimitId = speedLimitId,
},
},
};
AddProcesses - sets the process list
var throttlingRequest = new ThrottlingRequest
{
AddProcesses = new List<AddProcessesRequest>
{
new AddProcessesRequest
{
Processes = new List { "processName" },
LimitId = speedLimitId,
},
},
};
Enable - enables throttling
var throttlingRequest = new ThrottlingRequest
{
Enable = EmptyRequest.Empty,
};
Disable - disables throttling
var throttlingRequest = new ThrottlingRequest
{
Disable = EmptyRequest.Empty,
};
ConfigureThrottling
Sends throttling configuration to the service. Important: Throttling feature can be applied only thru the connected tunnel.
var sdk = new SDK();
var speedReq = new List<Core.Model.SpeedLimit>().Select(p => new SetSpeedLimitRequest()
{
SpeedLimitId = p.ClientId,
DownloadSpeed = p.In,
UploadSpeed = p.Out,
}).ToList();
var procReq = new List<Core.Model.SpeedLimit>().Select(p =>
new AddProcessesRequest()
{
LimitId = p.ClientId,
Processes = p.ProcessesList.Select(p2 => p2.ProcessName).ToList(),
}).ToList();
var throttlingRequest = new ThrottlingRequest()
{
AddProcesses = procReq,
SetSpeedLimit = speedReq,
DefaultSpeedLimit = new DefaultSpeedLimitRequest() { DownloadSpeed = 1024, UploadSpeed = 1024 },
RemoveAllProcesses = new Core.RPC.EmptyRequest(),
ClearSpeedLimits = new List<ClearSpeedLimitRequest>(),
Enable = new Core.RPC.EmptyRequest(),
Disable = null,
};
var configureThrottlingResponse = sdk.ConfigureThrottling(throttlingRequest);
Console.WriteLine(configureThrottlingResponse.AddProcesses);
Last updated
Was this helpful?