Class BTPeerIDByteDecoderUtils


  • class BTPeerIDByteDecoderUtils
    extends java.lang.Object
    • Constructor Detail

      • BTPeerIDByteDecoderUtils

        BTPeerIDByteDecoderUtils()
    • Method Detail

      • decodeMnemonic

        public static java.lang.String decodeMnemonic​(char c)
      • decodeNumericValueOfByte

        public static java.lang.String decodeNumericValueOfByte​(byte b)
      • decodeNumericValueOfByte

        public static java.lang.String decodeNumericValueOfByte​(byte b,
                                                                int min_digits)
      • decodeNumericChar

        public static java.lang.String decodeNumericChar​(char c)
      • intchar

        public static java.lang.String intchar​(char c)
      • decodeAlphaNumericChar

        public static java.lang.String decodeAlphaNumericChar​(char c)
      • isAzStyle

        public static boolean isAzStyle​(java.lang.String peer_id)
      • isShadowStyle

        public static boolean isShadowStyle​(java.lang.String peer_id)
        Checking whether a peer ID is Shadow style or not is a bit tricky. The BitTornado peer ID convention code is explained here: http://forums.degreez.net/viewtopic.php?t=7070 The main thing we are interested in is the first six characters. Although the other characters are base64 characters, there's no guarantee that other clients which follow that style will follow that convention (though the fact that some of these clients use BitTornado in the core does blur the lines a bit between what is "style" and what is just common across clients). So if we base it on the version number information, there's another problem - there isn't the use of absolute delimiters (no fixed dash character, for example). There are various things we can do to determine how likely the peer ID is to be of that style, but for now, I'll keep it to a relatively simple check. We'll assume that no client uses the fifth version digit, so we'll expect a dash. We'll also assume that no client has reached version 10 yet, so we expect the first two characters to be "letter,digit". We've seen some clients which don't appear to contain any version information, so we need to allow for that.
      • isMainlineStyle

        public static boolean isMainlineStyle​(java.lang.String peer_id)
      • isPossibleSpoofClient

        public static boolean isPossibleSpoofClient​(java.lang.String peer_id)
      • getMainlineStyleVersionNumber

        public static java.lang.String getMainlineStyleVersionNumber​(java.lang.String peer_id)
      • getShadowStyleVersionNumber

        public static java.lang.String getShadowStyleVersionNumber​(java.lang.String peer_id)
      • decodeAzStyleVersionNumber

        public static java.lang.String decodeAzStyleVersionNumber​(java.lang.String version_data,
                                                                  java.lang.String version_scheme)
      • getTwoByteThreePartVersion

        public static java.lang.String getTwoByteThreePartVersion​(byte b1,
                                                                  byte b2)
      • extractReadableVersionSubstringFromPeerID

        public static java.lang.String extractReadableVersionSubstringFromPeerID​(java.lang.String peer_id)
        Look at the peer ID and just grab as many readable characters to form the version substring as possible.
      • decodeCustomVersionNumber

        public static java.lang.String decodeCustomVersionNumber​(java.lang.String version_data,
                                                                 java.lang.String version_scheme)
      • join

        private static java.lang.String join​(java.lang.String a,
                                             java.lang.String b)
      • joinAsDotted

        private static java.lang.String joinAsDotted​(java.lang.String a,
                                                     java.lang.String b)
      • joinAsDotted

        private static java.lang.String joinAsDotted​(java.lang.String a,
                                                     java.lang.String b,
                                                     java.lang.String c)