Closed asapach closed 10 years ago
Right now I don't think we should drop ip
dependency from torrent-stream. And certainly not move it to peerflix (meaning changing the engine.block()
API to receive number, seems odd). IPv4 string representations are used all around torrent-stream. Using integer representation is only related to blocklist interval checking.
I think IPv4 parsing should rather be restricted inside blocklist.js along with a nice API to the blocklist component. Making something we can ultimately move out of torrent-stream in its own ip-blocklist
module.
var list = blocklist(inital)
list.add(ip)
list.add(first, last)
// This one could be omitted since append-only list is acceptable for this
// If implementation of removal is harder than insertion
list.remove(ip)
list.remove(first, last)
list.contains(ip)
But yes, parsing IPs every lookup is stupid and could be fixed right now. But this is related to blocklist internal optimization.
I think #67 pretty much settle this issue. The blocklist module can now be pulled out of torrent-stream along with the ip
dependency.
As discussed in #63, we should move computationally intensive IPv4 parsing out of the inner loop in
lib/blocklist.js
, preferably altogether into peerflix.