예제 #1
0
  /**
   * @param uuid
   * @param relayIP
   * @param relayPort
   * @param token
   */
  public static void changeRelay(String uuid, String relayIP, String relayPort, String token) {
    relayIP = HCURLUtil.convertIPv46(relayIP);

    retry(
        CALL_STR
            + chngrelay_STR
            + ID_STR
            + encryptePara(uuid, token)
            + "&"
            + IP_STR
            + relayIP
            + "&"
            + PORT_STR
            + relayPort
            + "&"
            + TOKEN_STR
            + token
            + "&"
            + ENCRYPTER_STR
            + "true",
        true);
  }
예제 #2
0
  /**
   * IPV6 最长IPv6形式 X:X:X:X:X:X:d.d.d.d 3组16进制整数,每组4个16进制数的字符形态; 6个冒号; 一个IPv4地址(不算末尾的NULL,就是15位)
   * 还有一个NULL结束符。 因此, 最大可能长度 = 6 * 4 + 6 + 15 + 1 = 46 所以, INET6_ADDRSTRLEN定义为46
   * homecenter.mobi存储包括[X:X:X:X:X:X:d.d.d.d] 48 = 46 + 2(][) RFC 2396 [URL]. It defines a syntax
   * for IPv6 addresses and allows the use of "[" and "]" within a URI
   *
   * @param uuid
   * @param hostAddress
   * @param port
   * @param nattype
   * @param agent
   * @param upnp_ip
   * @param upnp_port
   * @param token
   * @param serverNum
   * @return 如果同ID已被其它服务器正占用,则返回'e';正常上线返回空串,返回d,表示donate
   */
  public static String lineOn(
      String uuid,
      String hostAddress,
      int port,
      int nattype,
      int agent,
      String upnp_ip,
      int upnp_port,
      String relayip,
      int relayport,
      String token,
      boolean hideIP,
      String hideToken) {
    if (hostAddress == null) {
      hostAddress = "";
    }
    if (upnp_ip == null) {
      upnp_ip = "";
    }
    if (relayip == null) {
      relayip = "";
    }

    hostAddress = HCURLUtil.convertIPv46(hostAddress);
    upnp_ip = HCURLUtil.convertIPv46(upnp_ip);
    relayip = HCURLUtil.convertIPv46(relayip);

    // 初始化本值
    isDelLineInfo = false;

    return retry(
        CALL_STR
            + lineon_STR
            + ID_STR
            + encryptePara(uuid, token)
            + "&"
            + IP_STR
            + encryptePara(hostAddress, token)
            + "&"
            + PORT_STR
            + port
            + "&"
            + nattype_STR
            + nattype
            + "&"
            + agent_STR
            + agent
            + "&"
            + upnpip_STR
            + upnp_ip
            + "&"
            + upnpport_STR
            + upnp_port
            + "&"
            + relayip_STR
            + relayip
            + "&"
            + relayport_STR
            + relayport
            + "&"
            + TOKEN_STR
            + token
            + "&"
            + HIDE_IP_STR
            + hideIP
            + "&"
            + HIDE_TOKEN_STR
            + hideToken
            + "&"
            + ENCRYPTER_STR
            + "true",
        true);
  }