java.lang.Object
net.i2p.router.transport.StrictCountries

public abstract class StrictCountriesextends Object
Maintains list of countries with strict application restrictions. Maintain a list of countries that may have tight restrictions on applications like ours.

The country set is stored as a sorted array of case-normalized 2-letter integer keys so contains(String) performs no per-call String allocation (callers such as Router.isHidden check this on the hot path with GeoIP codes that are already lowercase).

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final int[]
    Sorted ascending for binary search; each key = ((c0 & 0xDF) << 8) | (c1 & 0xDF).
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Utility class, not intended for instantiation.
  • Method Summary

    All Methods
    Modifier and Type
    Method
    Description
    static boolean
    contains(String country)
    Whether the country is in the restricted set.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • _countries

      private static final int[] _countries
      Sorted ascending for binary search; each key = ((c0 & 0xDF) << 8) | (c1 & 0xDF).
  • Constructor Details

    • StrictCountries

      private StrictCountries()
      Utility class, not intended for instantiation.
  • Method Details

    • contains

      public static boolean contains(String country)
      Whether the country is in the restricted set.
      Parameters:
      country - two-letter code, case-independent; null or any other length is not restricted
      Returns:
      true if the code is in the restricted set