|
349 | 349 | return( support_experimental_extensions );
|
350 | 350 | }
|
351 | 351 |
|
352 |
| - protected final IpFilter ip_filter = IpFilterManagerFactory.getSingleton().getIPFilter(); |
| 352 | + private final IpFilter ip_filter = IpFilterManagerFactory.getSingleton().getIPFilter(); |
353 | 353 |
|
354 | 354 | private long current_announce_retry_interval;
|
355 | 355 | private long current_scrape_retry_interval;
|
|
361 | 361 | private final TRTrackerServerStatsImpl stats = new TRTrackerServerStatsImpl( this );
|
362 | 362 |
|
363 | 363 | private final String name;
|
| 364 | + private final boolean apply_ip_filter; |
| 365 | + |
364 | 366 | private final Map<String,Object> properties;
|
365 | 367 |
|
366 | 368 | private final boolean reverse_proxy;
|
|
398 | 400 | public
|
399 | 401 | TRTrackerServerImpl(
|
400 | 402 | String _name,
|
| 403 | + boolean _apply_ip_filter, |
401 | 404 | boolean _start_up_ready,
|
402 | 405 | Map<String,Object> _properties )
|
403 | 406 | {
|
404 |
| - name = _name==null?DEFAULT_NAME:_name; |
405 |
| - is_ready = _start_up_ready; |
406 |
| - properties = _properties==null?new HashMap<>():_properties; |
| 407 | + name = _name==null?DEFAULT_NAME:_name; |
| 408 | + apply_ip_filter = _apply_ip_filter; |
| 409 | + is_ready = _start_up_ready; |
| 410 | + properties = _properties==null?new HashMap<>():_properties; |
407 | 411 |
|
408 | 412 | Boolean b_rp = (Boolean)properties.get( Tracker.PR_REVERSE_PROXY );
|
409 | 413 |
|
|
473 | 477 |
|
474 | 478 | key_enabled = COConfigurationManager.getBooleanParameter("Tracker Key Enable Server");
|
475 | 479 | }
|
476 |
| - |
| 480 | + |
477 | 481 | @Override
|
478 | 482 | public void
|
479 | 483 | setReady()
|
|
515 | 519 | return( keep_alive_enabled );
|
516 | 520 | }
|
517 | 521 |
|
| 522 | + protected boolean |
| 523 | + isIPFiltered( |
| 524 | + String ip ) |
| 525 | + { |
| 526 | + if ( apply_ip_filter && ip_filter.isInRange( ip, "Tracker", null )){ |
| 527 | + |
| 528 | + return( true ); |
| 529 | + |
| 530 | + }else{ |
| 531 | + |
| 532 | + return( false ); |
| 533 | + } |
| 534 | + } |
| 535 | + |
518 | 536 | public TRTrackerServerTorrent
|
519 | 537 | addLink(
|
520 | 538 | String link,
|
|
0 commit comments