Class VersionCheckClient

java.lang.Object
com.biglybt.core.versioncheck.VersionCheckClient

public class VersionCheckClient extends Object
Client for checking version information from a remote server.
  • Field Details

  • Constructor Details

    • VersionCheckClient

      private VersionCheckClient()
  • Method Details

    • getSingleton

      public static VersionCheckClient getSingleton()
      Get the singleton instance of the version check client.
      Returns:
      version check client
    • initialise

      public void initialise()
    • getVersionCheckInfo

      public Map getVersionCheckInfo(String reason)
      Get the version check reply info.
      Returns:
      reply data, possibly cached, if the server was already checked within the last minute
    • getVersionCheckInfo

      public Map getVersionCheckInfo(String reason, int address_type)
    • getVersionCheckInfoSupport

      protected Map getVersionCheckInfoSupport(String reason, boolean only_if_cached, boolean force, boolean v6)
    • getMostRecentVersionCheckData

      public Map getMostRecentVersionCheckData()
    • isVersionCheckDataValid

      private boolean isVersionCheckDataValid(int address_type)
    • getCacheTime

      public long getCacheTime(boolean v6)
    • clearCache

      public void clearCache()
    • getError

      public Throwable getError()
    • getFeatureFlags

      public long getFeatureFlags()
    • getDisabledPluginIDs

      public Set<String> getDisabledPluginIDs()
    • getAutoInstallPluginIDs

      public Set<String> getAutoInstallPluginIDs()
    • getExternalIpAddress

      public String getExternalIpAddress(boolean only_if_cached, boolean v6)
      Get the ip address seen by the version check server. NOTE: This information may be cached, see getVersionCheckInfo().
      Returns:
      external ip address, or empty string if no address information found
    • getExternalIpAddress

      public String getExternalIpAddress(boolean only_if_cached, boolean v6, boolean force)
    • DHTEnableAllowed

      public boolean DHTEnableAllowed()
      Is the DHT plugin allowed to be enabled.
      Returns:
      true if DHT can be enabled, false if it should not be enabled
    • DHTExtendedUseAllowed

      public boolean DHTExtendedUseAllowed()
      Is the DHT allowed to be used by external plugins.
      Returns:
      true if extended DHT use is allowed, false if not allowed
    • getDHTFlags

      public byte getDHTFlags()
    • getRecommendedPlugins

      public String[] getRecommendedPlugins()
    • getDHTBootstrap

      public List<InetSocketAddress> getDHTBootstrap(boolean ipv4)
    • getCountryInfo

      public Map<String,Object> getCountryInfo()
    • performVersionCheck

      private Map performVersionCheck(Map data_to_send, boolean use_az_message, boolean use_http, boolean v6) throws Exception
      Perform the actual version check by connecting to the version server.
      Parameters:
      data_to_send - version message
      Returns:
      version reply
      Throws:
      Exception - if the server check connection fails
    • executeHTTP

      private Map executeHTTP(Map data_to_send, boolean v6) throws Exception
      Throws:
      Exception
    • getHTTPGetString

      public String getHTTPGetString(boolean for_proxy, boolean v6)
    • getHTTPGetString

      private String getHTTPGetString(Map content, boolean for_proxy, boolean v6)
    • executeTCP

      private Map executeTCP(Map data_to_send, InetAddress bind_ip, int bind_port, boolean v6) throws Exception
      Throws:
      Exception
    • executeUDP

      private Map executeUDP(Map data_to_send, InetAddress bind_ip, int bind_port, boolean v6) throws Exception
      Throws:
      Exception
    • preProcessReply

      protected void preProcessReply(Map reply, boolean v6)
    • getExternalIpAddressHTTP

      public InetAddress getExternalIpAddressHTTP(boolean v6) throws Exception
      Throws:
      Exception
    • getExternalIpAddressTCP

      public InetAddress getExternalIpAddressTCP(InetAddress bind_ip, int bind_port, boolean v6) throws Exception
      Throws:
      Exception
    • getExternalIpAddressUDP

      public InetAddress getExternalIpAddressUDP(InetAddress bind_ip, int bind_port, boolean v6) throws Exception
      Throws:
      Exception
    • getHost

      protected String getHost(boolean v6, String v6_address, String v4_address)
    • getTestAddress

      private String getTestAddress(boolean v6, String address)
    • constructVersionCheckMessage

      public static Map<String,Object> constructVersionCheckMessage(String reason)
      Construct the default version check message.
      Returns:
      message to send
    • addVersionCheckClientListener

      public void addVersionCheckClientListener(VersionCheckClientListener l)
    • removeVersionCheckClientListener

      public void removeVersionCheckClientListener(VersionCheckClientListener l)
    • main

      public static void main(String[] args)
    • printDataMap

      private static void printDataMap(Map map) throws Exception
      Throws:
      Exception