Package org.apache.nutch.protocol.okhttp

# Class IPFilterRules

java.lang.Object
org.apache.nutch.protocol.okhttp.IPFilterRules

public class IPFilterRules extends Object
Optionally limit or block connections to IP address ranges (localhost/loopback or site-local addresses, subnet ranges given in CIDR notation, or single IP addresses). IP filter rules are built from two Nutch properties:

- `http.filter.ipaddress.include` defines all allowed IP ranges. If not defined or empty all IP addresses (and not explicitly excluded) are allowed.
- `http.filter.ipaddress.exclude` defines excluded IP address ranges.

IP ranges can be defined as

- IP address, e.g. `127.0.0.1` or `::1` (IPv6)
- CIDR notation, e.g. `192.168.0.0/16` or `fd00::/8`
- `localhost` or `loopback` applies to all IP addresses for which `InetAddress.isLoopbackAddress()` is true
- `sitelocal` applies to all IP addresses for which `InetAddress.isSiteLocalAddress()` is true

Multiple IP ranges are separated by a comma, e.g. `loopback,sitelocal,fd00::/8`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final org.slf4j.Logger`
  `LOG`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `IPFilterRules(Configuration conf)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `accept(InetAddress address)`
  `boolean`
  `isEmpty()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### LOG

    protected static final org.slf4j.Logger LOG

- ## Constructor Details

  - ### IPFilterRules

    public IPFilterRules(Configuration conf)

- ## Method Details

  - ### isEmpty

    public boolean isEmpty()

  - ### accept

    public boolean accept(InetAddress address)