Class BTPeerIDByteDecoderUtils
java.lang.Object
com.biglybt.core.peermanager.utils.BTPeerIDByteDecoderUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringdecodeAlphaNumericChar(char c) static StringdecodeAzStyleVersionNumber(String version_data, String version_scheme) static StringdecodeCustomVersionNumber(String version_data, String version_scheme) static StringdecodeMnemonic(char c) static StringdecodeNumericChar(char c) static StringdecodeNumericValueOfByte(byte b) static StringdecodeNumericValueOfByte(byte b, int min_digits) static StringLook at the peer ID and just grab as many readable characters to form the version substring as possible.static StringgetMainlineStyleVersionNumber(String peer_id) static StringgetShadowStyleVersionNumber(String peer_id) static StringgetTwoByteThreePartVersion(byte b1, byte b2) static Stringintchar(char c) static booleanstatic booleanisMainlineStyle(String peer_id) static booleanisPossibleSpoofClient(String peer_id) static booleanisShadowStyle(String peer_id) Checking whether a peer ID is Shadow style or not is a bit tricky.private static Stringprivate static StringjoinAsDotted(String a, String b) private static StringjoinAsDotted(String a, String b, String c)
-
Constructor Details
-
BTPeerIDByteDecoderUtils
BTPeerIDByteDecoderUtils()
-
-
Method Details
-
decodeMnemonic
-
decodeNumericValueOfByte
-
decodeNumericValueOfByte
-
decodeNumericChar
-
intchar
-
decodeAlphaNumericChar
-
isAzStyle
-
isShadowStyle
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
-
isPossibleSpoofClient
-
getMainlineStyleVersionNumber
-
getShadowStyleVersionNumber
-
decodeAzStyleVersionNumber
-
getTwoByteThreePartVersion
-
extractReadableVersionSubstringFromPeerID
-
decodeCustomVersionNumber
-
join
-
joinAsDotted
-
joinAsDotted
-