Class PeerUtils

java.lang.Object
com.biglybt.core.peer.util.PeerUtils

public class PeerUtils extends Object
Varies peer connection utility methods.
  • Field Details

    • CC_UNKNOWN

      public static final String CC_UNKNOWN
      See Also:
    • CONFIG_MAX_CONN_PER_TORRENT

      private static final String CONFIG_MAX_CONN_PER_TORRENT
      See Also:
    • CONFIG_MAX_CONN_TOTAL

      private static final String 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

      private static final NetworkAdmin 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

      private static final Set<Integer> ignore_peer_ports
    • chars

      static final String chars
      See Also:
    • country_provider

      private static volatile LocationProvider country_provider
    • country_provider_last_check

      private static long country_provider_last_check
    • country_key

      private static final Object country_key
    • net_key

      private static final Object net_key
    • ni_key

      private static final Object ni_key
    • ni_null

      private static final Object ni_null
    • ni_address_key

      private static final Object ni_address_key
    • asn_key

      private static final Object asn_key
    • asn_pending

      private static final Object asn_pending
    • asn_failed

      private static final String[] asn_failed
  • Constructor Details

    • PeerUtils

      public PeerUtils()
  • Method Details

    • initialise

      public static void initialise()
    • getPeerPriority

      public static int getPeerPriority(String address, int port)
    • getPeerPriority

      public static int getPeerPriority(InetAddress address, int peer_port)
    • 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

      public 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.
      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

      private static LocationProvider getCountryProvider()
    • hasCountryProvider

      public static boolean hasCountryProvider()
    • getCountryDetails

      public static String[] getCountryDetails(Peer peer)
    • getCountryDetails

      public static String[] getCountryDetails(PEPeer peer)
    • getCountryDetails

      public static String[] getCountryDetails(InetAddress address)
    • getNetwork

      public static String getNetwork(PEPeer peer)
    • getLocalNetworkInterface

      public static NetworkInterface getLocalNetworkInterface(PEPeer peer)
    • getLocalAddress

      public static InetAddress getLocalAddress(PEPeer peer)
    • getASN

      public static String getASN(PEPeer peer)
      Parameters:
      peer -
      Returns:
      null if lookup pending, "" or ASN otherwise
    • getASandASN

      public static String[] getASandASN(PEPeer peer)
      Parameters:
      peer -
      Returns:
      null if pending, String[] of { as, asn } or { "", "" } if unavailable