5 ms·
This should work pretty well for tc/iptables shaping where you count the bytes in the connection and move to a lower class. But I guess most of the time someth
by nisa 10y ago
This should work pretty well for tc/iptables shaping where you count the bytes in the connection and move to a lower class.
But I guess most of the time something like aria2[1] works better for real downloads - if you shape only for a single tcp stream this should also defeat this or at least speedup the download enough that the rate limit doesn't matter.
On the server side it's probably easy to stop this - nginx seems to have all you need[2],[3]. Just set a unique cookie for the download and deny access otherwise - not sure what the shared hosters are doing but likely something similar (mandatory waiting time before the cookie or url-hash is set, limit access based on connections/hash)
limit_conn_zone $uid_got zone=cookie:10m;
server {
mp4;
limit_conn cookie 1;
limit_rate_after 10m;
limit_rate 512k;
}
On the other hand it probably screws users for mostly no reason most of the time.
1: https://aria2.github.io/ https://aria2.github.io/
2: http://nginx.org/en/docs/http/ngx_http_limit_conn_module.html#limit_conn_zone http://nginx.org/en/docs/http/ngx_http_limit_conn_module.htm...
3: http://nginx.org/en/docs/http/ngx_http_userid_module.html http://nginx.org/en/docs/http/ngx_http_userid_module.html
- sleepychu 10y agoCan you use aria2 to abuse the network shaping for something like SFTP? Or does the handshake dwarf the performance benefit?