@@ -386,26 +386,27 @@ public static IpFilter getInstance() {
386
386
public boolean
387
387
isInRange (
388
388
String ipAddress ,
389
- String torrent_name ,
389
+ String name ,
390
390
byte [] torrent_hash )
391
391
{
392
- return ( isInRange ( ipAddress , torrent_name , torrent_hash , true ));
392
+ return ( isInRange ( ipAddress , name , torrent_hash , false , true ));
393
393
}
394
394
395
395
@ Override
396
396
public boolean
397
397
isInRange (
398
398
String ipAddress ,
399
- String torrent_name ,
399
+ String name ,
400
400
byte [] torrent_hash ,
401
+ boolean is_specific ,
401
402
boolean loggable )
402
403
{
403
- //In all cases, block banned ip addresses
404
-
405
- if ( ipBanner .isBanned (ipAddress )){
404
+ //In all cases, block banned ip addresses
405
+
406
+ if ( ipBanner .isBanned (ipAddress , is_specific ? torrent_hash : null )){
406
407
407
- return true ;
408
- }
408
+ return true ;
409
+ }
409
410
410
411
411
412
if ( !isEnabled ()){
@@ -488,7 +489,7 @@ public static IpFilter getInstance() {
488
489
return ( false );
489
490
}
490
491
491
- if ( addBlockedIP ( new BlockedIpImpl ( ipAddress , match , torrent_name , loggable ), torrent_hash , loggable )){
492
+ if ( addBlockedIP ( new BlockedIpImpl ( ipAddress , match , name , loggable ), torrent_hash , loggable )){
492
493
493
494
if (Logger .isEnabled ())
494
495
Logger .log (new LogEvent (LOGID_NWMAN , "Ip Blocked : "
@@ -517,7 +518,7 @@ public static IpFilter getInstance() {
517
518
return ( false );
518
519
}
519
520
520
- if ( addBlockedIP ( new BlockedIpImpl (ipAddress ,null , torrent_name , loggable ), torrent_hash , loggable )){
521
+ if ( addBlockedIP ( new BlockedIpImpl (ipAddress ,null , name , loggable ), torrent_hash , loggable )){
521
522
522
523
if (Logger .isEnabled ())
523
524
Logger .log (new LogEvent (LOGID_NWMAN , "Ip Blocked : "
@@ -543,13 +544,14 @@ public static IpFilter getInstance() {
543
544
public boolean
544
545
isInRange (
545
546
InetAddress ipAddress ,
546
- String torrent_name ,
547
+ String name ,
547
548
byte [] torrent_hash ,
549
+ boolean is_specific ,
548
550
boolean loggable )
549
551
{
550
552
//In all cases, block banned ip addresses
551
553
552
- if ( ipBanner .isBanned (ipAddress )){
554
+ if ( ipBanner .isBanned (ipAddress , is_specific ? torrent_hash : null )){
553
555
554
556
return true ;
555
557
}
@@ -617,7 +619,7 @@ public static IpFilter getInstance() {
617
619
618
620
if (!allow ) {
619
621
620
- if ( addBlockedIP ( new BlockedIpImpl (ipAddress .getHostAddress (),match , torrent_name , loggable ), torrent_hash , loggable )){
622
+ if ( addBlockedIP ( new BlockedIpImpl (ipAddress .getHostAddress (),match , name , loggable ), torrent_hash , loggable )){
621
623
622
624
if (Logger .isEnabled ())
623
625
Logger .log (new LogEvent (LOGID_NWMAN , "Ip Blocked : "
@@ -642,7 +644,7 @@ public static IpFilter getInstance() {
642
644
643
645
if ( allow ){
644
646
645
- if ( addBlockedIP ( new BlockedIpImpl (ipAddress .getHostAddress (),null , torrent_name , loggable ), torrent_hash , loggable )){
647
+ if ( addBlockedIP ( new BlockedIpImpl (ipAddress .getHostAddress (),null , name , loggable ), torrent_hash , loggable )){
646
648
647
649
if (Logger .isEnabled ())
648
650
Logger .log (new LogEvent (LOGID_NWMAN , "Ip Blocked : "
@@ -934,15 +936,32 @@ public static IpFilter getInstance() {
934
936
public boolean
935
937
ban (
936
938
String ipAddress ,
937
- String torrent_name ,
939
+ String name ,
938
940
boolean manual )
939
941
{
940
- return ( ban ( ipAddress , torrent_name , manual , 0 ));
942
+ return ( ban ( ipAddress , name , null , manual ));
943
+ }
944
+
945
+ @ Override
946
+ public boolean
947
+ ban (
948
+ String ipAddress ,
949
+ String name ,
950
+ byte [] specific_hash ,
951
+ boolean manual )
952
+ {
953
+ return ( ban ( ipAddress , name , specific_hash , manual , 0 ));
941
954
}
942
955
943
-
944
-
945
-
956
+ @ Override
957
+ public boolean
958
+ isBanned (
959
+ String ipAddress ,
960
+ byte [] specific_hash )
961
+ {
962
+ return ( ipBanner .isBanned ( ipAddress , specific_hash ));
963
+ }
964
+
946
965
@ Override
947
966
public BlockedIp []
948
967
getBlockedIps ()
@@ -1127,11 +1146,22 @@ public static IpFilter getInstance() {
1127
1146
public boolean
1128
1147
ban (
1129
1148
String ipAddress ,
1130
- String torrent_name ,
1149
+ String name ,
1150
+ boolean manual ,
1151
+ int for_mins )
1152
+ {
1153
+ return ( ban ( ipAddress , name , null , manual , for_mins ));
1154
+ }
1155
+
1156
+ private boolean
1157
+ ban (
1158
+ String ipAddress ,
1159
+ String name ,
1160
+ byte [] specific_hash ,
1131
1161
boolean manual ,
1132
1162
int for_mins )
1133
1163
{
1134
- return ( ipBanner .ban ( ipAddress , torrent_name , manual , for_mins ));
1164
+ return ( ipBanner .ban ( ipAddress , name , specific_hash , manual , for_mins ));
1135
1165
}
1136
1166
1137
1167
@ Override
0 commit comments