Package com.biglybt.core.peer.util
Class PeerUtils
java.lang.Object
com.biglybt.core.peer.util.PeerUtils
Varies peer connection utility methods.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String[]
private static final Object
private static final Object
static final String
(package private) static final String
private static final String
private static final String
private static final Object
private static LocationProvider
private static long
static int
static int
private static byte[]
private static long
private static byte[]
private static long
private static int
private static final Object
private static final NetworkAdmin
private static final Object
private static final Object
private static final Object
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
static byte[]
static String[]
getASandASN
(PEPeer peer) static String
static String[]
getCountryDetails
(PEPeer peer) static String[]
getCountryDetails
(Peer peer) static String[]
getCountryDetails
(InetAddress address) private static LocationProvider
static InetAddress
getLocalAddress
(PEPeer peer) static NetworkInterface
static String
getNetwork
(PEPeer peer) static int
getPeerPriority
(byte[] peer_address, int peer_port) private static int
getPeerPriority
(byte[] a1, int port1, byte[] a2, int port2) static int
getPeerPriority
(byte[] peer_address, short peer_port) static int
getPeerPriority
(String address, int port) static int
getPeerPriority
(InetAddress address, int peer_port) static boolean
static boolean
ignorePeerPort
(int port) static void
static int
numNewConnectionsAllowed
(PeerIdentityDataID data_id, int specific_max) Get the number of new peer connections allowed for the given data item, within the configured per-torrent and global connection limits.private static void
-
Field Details
-
CC_UNKNOWN
- See Also:
-
CONFIG_MAX_CONN_PER_TORRENT
- See Also:
-
CONFIG_MAX_CONN_TOTAL
- See Also:
-
MAX_CONNECTIONS_PER_TORRENT
public static int MAX_CONNECTIONS_PER_TORRENT -
MAX_CONNECTIONS_TOTAL
public static int MAX_CONNECTIONS_TOTAL -
network_admin
-
na_last_ip4_time
private static volatile long na_last_ip4_time -
na_last_ip6_time
private static volatile long na_last_ip6_time -
na_last_ip4
private static volatile byte[] na_last_ip4 -
na_last_ip6
private static volatile byte[] na_last_ip6 -
na_tcp_port
private static int na_tcp_port -
ignore_peer_ports
-
chars
- See Also:
-
country_provider
-
country_provider_last_check
private static long country_provider_last_check -
country_key
-
net_key
-
ni_key
-
ni_null
-
ni_address_key
-
asn_key
-
asn_pending
-
asn_failed
-
-
Constructor Details
-
PeerUtils
public PeerUtils()
-
-
Method Details
-
initialise
public static void initialise() -
getPeerPriority
-
getPeerPriority
-
getPeerPriority
public static int getPeerPriority(byte[] peer_address, short peer_port) -
getPeerPriority
public static int getPeerPriority(byte[] peer_address, int peer_port) -
getPeerPriority
private static int getPeerPriority(byte[] a1, int port1, byte[] a2, int port2) -
numNewConnectionsAllowed
Get the number of new peer connections allowed for the given data item, within the configured per-torrent and global connection limits.- Returns:
- max number of new connections allowed, or -1 if there is no limit
-
readIgnorePeerPorts
private static void readIgnorePeerPorts() -
ignorePeerPort
public static boolean ignorePeerPort(int port) -
createPeerID
public static byte[] createPeerID() -
createWebSeedPeerID
public static byte[] createWebSeedPeerID() -
getCountryProvider
-
hasCountryProvider
public static boolean hasCountryProvider() -
getCountryDetails
-
getCountryDetails
-
getCountryDetails
-
getNetwork
-
getLocalNetworkInterface
-
getLocalAddress
-
getASN
- Parameters:
peer
-- Returns:
- null if lookup pending, "" or ASN otherwise
-
getASandASN
- Parameters:
peer
-- Returns:
- null if pending, String[] of { as, asn } or { "", "" } if unavailable
-