Class PeerClassifier


  • public class PeerClassifier
    extends java.lang.Object
    Handles peer client identification and banning.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CACHE_LOGIC  
      private static java.util.Set platform_ips  
    • Constructor Summary

      Constructors 
      Constructor Description
      PeerClassifier()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean fullySupportsFE​(java.lang.String client_description)  
      static java.lang.String getClientDescription​(byte[] peer_id, java.lang.String net)
      Get a client description (name and version) from the given peerID byte array.
      static java.lang.String getPrintablePeerID​(byte[] peer_id)
      Get a printable representation of the given raw peerID byte array, i.e.
      static boolean isAzureusIP​(java.lang.String ip)
      This only works for ones that have been explicitly set as AZ ips
      static boolean isClientTypeAllowed​(java.lang.String client_description)
      Check if the client type is allowed to connect.
      static void setAzureusIP​(java.lang.String ip)  
      static boolean testIfAzureusIP​(java.lang.String ip)
      SYNC call!
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • platform_ips

        private static final java.util.Set platform_ips
    • Constructor Detail

      • PeerClassifier

        public PeerClassifier()
    • Method Detail

      • getClientDescription

        public static java.lang.String getClientDescription​(byte[] peer_id,
                                                            java.lang.String net)
        Get a client description (name and version) from the given peerID byte array.
        Parameters:
        peer_id - peerID sent in handshake
        Returns:
        description
      • getPrintablePeerID

        public static java.lang.String getPrintablePeerID​(byte[] peer_id)
        Get a printable representation of the given raw peerID byte array, i.e. filter out the first 32 non-printing ascii chars.
        Parameters:
        peer_id - peerID sent in handshake
        Returns:
        printable peerID
      • isClientTypeAllowed

        public static boolean isClientTypeAllowed​(java.lang.String client_description)
        Check if the client type is allowed to connect.
        Parameters:
        client_description - given by getClientDescription
        Returns:
        true if allowed, false if banned
      • fullySupportsFE

        public static boolean fullySupportsFE​(java.lang.String client_description)
      • isAzureusIP

        public static boolean isAzureusIP​(java.lang.String ip)
        This only works for ones that have been explicitly set as AZ ips
        Parameters:
        ip -
        Returns:
      • setAzureusIP

        public static void setAzureusIP​(java.lang.String ip)
      • testIfAzureusIP

        public static boolean testIfAzureusIP​(java.lang.String ip)
        SYNC call!
        Parameters:
        ip -
        Returns: