adrian-bl / bitflu

Bitflu BitTorrent Client
http://bitflu.workaround.ch
32 stars 6 forks source link

I've added ipfilter.dat support to Bitflu::Network #15

Open d5ve opened 11 years ago

d5ve commented 11 years ago

Hi Adrian,

As discussed on https://github.com/adrian-bl/bitflu/issues/14 I have ipfilter.dat support to Bitflu::Network

I added a new config option "ipfilter_dat_file" which is to hold the filename of any filter file.

If the config option is set, Bitflu::Network->new() now checks to see if Net::IPAddress::Filter::IPFilterDat is installed, and that the filter file exists.

Then init() instantiates a filter, and loads the rules from the filter file into it.

Then there is a new method IpIsFiltered() which is checked every place that IpIsBlacklisted() currently is.

I've run this changed version of bitflu.pl and performed a bunch of downloads successfully. I also tested that any IP addresses which were blocked were in my filter file.

I'm more than happy to perform any clean-ups you think are necessary to the code. I tried to match the existing style as much as possible.

Cheers,

Dave