Class RemoteUrlPolicy.AllowedRanges

java.lang.Object
org.apache.juneau.http.remote.RemoteUrlPolicy.AllowedRanges
Enclosing class:
RemoteUrlPolicy

public static final class RemoteUrlPolicy.AllowedRanges extends Object
A validated, parsed per-client allow-list of special-purpose address ranges, the per-client counterpart of the "RestClient.allowAddressRanges" system property.

It has exactly the property's narrow semantics: every entry must lie entirely inside 192.0.0.0/24, 198.18.0.0/15, 224.0.0.0/4, 240.0.0.0/4 or ff00::/8 (anything else is rejected with an IllegalArgumentException), entries are parsed as literals without any DNS lookup, and the ranges never re-permit loopback, link-local/metadata, private, CGNAT or any other denied address. Instances are immutable; two instances holding the same set of ranges are equal.

Since:
10.0.0
  • Field Details

  • Method Details

    • of

      public static RemoteUrlPolicy.AllowedRanges of(String... specs)
      Parses and validates allow-list entries.
      Parameters:
      specs - The entries; each element may itself hold several comma- or whitespace-separated CIDR ranges or single addresses. null or empty yields NONE.
      Returns:
      The parsed allow-list. Never null.
      Throws:
      IllegalArgumentException - If any entry is malformed or not entirely inside one of the five special-purpose ranges.
    • isEmpty

      public boolean isEmpty()
      Returns true if this allow-list re-permits nothing.
      Returns:
      true if empty.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object