I am sitting behind an absolutely terrible router (NVG589, NVG599 is no better) mandated by my ISP, AT&T. The problem is that it has an abysmal limit of 2056 simultaneous connections. Since my connections are so limited, I want to be able to kill the connections that are the slowest. I can think of two applications where this would actually benefit me.
1) Torrenting: There are 20,000 people leeching, and I'm seeding 2056 of them. But 99% of them can only download at < 10kbs. I want to kill all those connections and only seed to people who can eat up my 1000Mbps line.
2) Tor relay: I've got 3,000,000 people who may need my relay, but 99% of them only want < 10kbps of traffic. I want to kill all those connections so that I can donate my bandwidth to high bandwidth users.
Note: in both cases my total number of connections is upper bounded at 2056. So the amount of bandwidth I can donate is upper bounded by 2056*(average bandwidth of user). Thus, I'm trying to maximize the average bandwidth usage of a user connected to me by killing low bandwidth connections. I'm not saying low bandwidth users don't deserve to download, I'm saying that my specific setup is best suited to handle high bandwidth users who otherwise have few or no alternatives.
Ideally I'm looking for a simple script (or one-liner) to find and (gracefully) kill all connections that don't use enough bandwidth (say at least 10kbps). I would expect the solution to use something like cutter
.