Package com.biglybt.core.versioncheck
Class VersionCheckClient
java.lang.Object
com.biglybt.core.versioncheck.VersionCheckClient
Client for checking version information from a remote server.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static final int
private static final int
private static final long
private boolean
private final AEMonitor
private boolean
static final String
static final String
static final int
private static VersionCheckClient
private Map
private Map
private long
private long
private Throwable
private Throwable
private long
private long
private final CopyOnWriteList<VersionCheckClientListener>
private static final LogIDs
private boolean
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
private static boolean
static final String
static final String
static final int
static final String
static final String
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
constructVersionCheckMessage
(String reason) Construct the default version check message.boolean
Is the DHT plugin allowed to be enabled.boolean
Is the DHT allowed to be used by external plugins.private Map
executeHTTP
(Map data_to_send, boolean v6) private Map
executeTCP
(Map data_to_send, InetAddress bind_ip, int bind_port, boolean v6) private Map
executeUDP
(Map data_to_send, InetAddress bind_ip, int bind_port, boolean v6) long
getCacheTime
(boolean v6) getDHTBootstrap
(boolean ipv4) byte
getError()
getExternalIpAddress
(boolean only_if_cached, boolean v6) Get the ip address seen by the version check server.getExternalIpAddress
(boolean only_if_cached, boolean v6, boolean force) getExternalIpAddressHTTP
(boolean v6) getExternalIpAddressTCP
(InetAddress bind_ip, int bind_port, boolean v6) getExternalIpAddressUDP
(InetAddress bind_ip, int bind_port, boolean v6) long
protected String
getHTTPGetString
(boolean for_proxy, boolean v6) private String
getHTTPGetString
(Map content, boolean for_proxy, boolean v6) String[]
static VersionCheckClient
Get the singleton instance of the version check client.private String
getTestAddress
(boolean v6, String address) getVersionCheckInfo
(String reason) Get the version check reply info.getVersionCheckInfo
(String reason, int address_type) protected Map
getVersionCheckInfoSupport
(String reason, boolean only_if_cached, boolean force, boolean v6) void
private boolean
isVersionCheckDataValid
(int address_type) static void
private Map
performVersionCheck
(Map data_to_send, boolean use_az_message, boolean use_http, boolean v6) Perform the actual version check by connecting to the version server.protected void
preProcessReply
(Map reply, boolean v6) private static void
printDataMap
(Map map) void
-
Field Details
-
LOGID
-
REASON_UPDATE_CHECK_START
- See Also:
-
REASON_UPDATE_CHECK_PERIODIC
- See Also:
-
REASON_CHECK_SWT
- See Also:
-
REASON_DHT_FLAGS
- See Also:
-
REASON_DHT_EXTENDED_ALLOWED
- See Also:
-
REASON_DHT_ENABLE_ALLOWED
- See Also:
-
REASON_EXTERNAL_IP
- See Also:
-
REASON_RECOMMENDED_PLUGINS
- See Also:
-
REASON_SECONDARY_CHECK
- See Also:
-
REASON_PLUGIN_UPDATE
- See Also:
-
REASON_DHT_BOOTSTRAP
- See Also:
-
HTTP_SERVER_ADDRESS_V4
- See Also:
-
HTTP_SERVER_PORT
public static final int HTTP_SERVER_PORT- See Also:
-
TCP_SERVER_ADDRESS_V4
- See Also:
-
TCP_SERVER_PORT
public static final int TCP_SERVER_PORT- See Also:
-
UDP_SERVER_ADDRESS_V4
- See Also:
-
UDP_SERVER_PORT
public static final int UDP_SERVER_PORT- See Also:
-
HTTP_SERVER_ADDRESS_V6
- See Also:
-
TCP_SERVER_ADDRESS_V6
- See Also:
-
UDP_SERVER_ADDRESS_V6
- See Also:
-
CACHE_PERIOD
private static final long CACHE_PERIOD- See Also:
-
secondary_check_done
private static boolean secondary_check_done -
listeners
-
AT_V4
private static final int AT_V4- See Also:
-
AT_V6
private static final int AT_V6- See Also:
-
AT_EITHER
private static final int AT_EITHER- See Also:
-
instance
-
enable_v6
private boolean enable_v6 -
prefer_v6
private boolean prefer_v6 -
last_check_data_v4
-
last_check_data_v6
-
last_error_v4
-
last_error_v6
-
check_mon
-
last_check_time_v4
private long last_check_time_v4 -
last_check_time_v6
private long last_check_time_v6 -
last_feature_flag_cache
private long last_feature_flag_cache -
last_feature_flag_cache_time
private long last_feature_flag_cache_time -
check_has_worked
private volatile boolean check_has_worked
-
-
Constructor Details
-
VersionCheckClient
private VersionCheckClient()
-
-
Method Details
-
getSingleton
Get the singleton instance of the version check client.- Returns:
- version check client
-
initialise
public void initialise() -
getVersionCheckInfo
Get the version check reply info.- Returns:
- reply data, possibly cached, if the server was already checked within the last minute
-
getVersionCheckInfo
-
getVersionCheckInfoSupport
-
getMostRecentVersionCheckData
-
isVersionCheckDataValid
private boolean isVersionCheckDataValid(int address_type) -
getCacheTime
public long getCacheTime(boolean v6) -
clearCache
public void clearCache() -
getError
-
getFeatureFlags
public long getFeatureFlags() -
getDisabledPluginIDs
-
getAutoInstallPluginIDs
-
getExternalIpAddress
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
-
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
-
getDHTBootstrap
-
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
- Throws:
Exception
-
getHTTPGetString
-
getHTTPGetString
-
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
-
getExternalIpAddressHTTP
- 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
-
getTestAddress
-
constructVersionCheckMessage
Construct the default version check message.- Returns:
- message to send
-
addVersionCheckClientListener
-
removeVersionCheckClientListener
-
main
-
printDataMap
- Throws:
Exception
-