示例#1
0
  static void readConfig() {
    tracker_ip = COConfigurationManager.getStringParameter("Tracker IP", "");

    tracker_ip = UrlUtils.expandIPV6Host(tracker_ip);

    String override_ips = COConfigurationManager.getStringParameter("Override Ip", "");

    StringTokenizer tok = new StringTokenizer(override_ips, ";");

    Map new_override_map = new HashMap();

    while (tok.hasMoreTokens()) {

      String ip = tok.nextToken().trim();

      if (ip.length() > 0) {

        new_override_map.put(AENetworkClassifier.categoriseAddress(ip), ip);
      }
    }

    override_map = new_override_map;

    InetAddress bad = NetworkAdmin.getSingleton().getSingleHomedServiceBindAddress();

    if (bad == null || bad.isAnyLocalAddress()) {

      bind_ip = "";

    } else {

      bind_ip = bad.getHostAddress();
    }
  }
示例#2
0
  public static String getPublicIPOverride() {
    String explicit_ips = COConfigurationManager.getStringParameter("Override Ip", "");

    if (explicit_ips.length() > 0) {

      StringTokenizer tok = new StringTokenizer(explicit_ips, ";");

      while (tok.hasMoreTokens()) {

        String this_address = tok.nextToken().trim();

        if (this_address.length() > 0) {

          String cat = AENetworkClassifier.categoriseAddress(this_address);

          if (cat == AENetworkClassifier.AT_PUBLIC) {

            return (this_address);
          }
        }
      }
    }

    return (null);
  }
示例#3
0
  protected static List stringToPorts(String str) {
    str = str.replace(',', ';');

    StringTokenizer tok = new StringTokenizer(str, ";");

    List res = new ArrayList();

    while (tok.hasMoreTokens()) {

      try {
        res.add(new Integer(tok.nextToken().trim()));

      } catch (Throwable e) {

        Debug.out("Invalid port entry in '" + str + "'", e);
      }
    }

    return (res);
  }