class TrackerInfo extends Object
Compact format 1 - a list of hashes - early format for testing. Compact format 2 - One big string of concatenated hashes - official format.
| Constructor and Description |
|---|
TrackerInfo(InputStream in,
byte[] my_id,
byte[] infohash,
MetaInfo metainfo,
I2PSnarkUtil util)Create tracker info for the metainfo. |
TrackerInfo(Set<Hash> hashes,
int interval,
int complete,
int incomplete,
int downloaders,
String error,
byte[] my_id,
byte[] infohash,
MetaInfo metainfo,
I2PSnarkUtil util)To convert returned UDPTracker data to the standard structure |
| Modifier and Type | Method and Description |
|---|---|
String | getFailureReason()Not HTML escaped. |
int | getInterval()Interval in seconds. |
int | getLeechCount()The leech count. |
int | getPartialSeedCount()The partial seed count, derived from the BEP 21 downloaders scrape field. |
int | getPeerCount()Peer count including seeds and leeches from the tracker response. |
(package private) static int | getPeerCount(Set<Hash> peers,
int complete,
int incomplete)Compute peer count from tracker response data. |
Set<Peer> | getPeers()Peers returned by the tracker, or an empty set if none. |
int | getSeedCount()The seed count. |
String | toString()String form of the tracker info. |
public TrackerInfo(InputStream in, byte[] my_id, byte[] infohash, MetaInfo metainfo, I2PSnarkUtil util) throws IOException
metainfo - may be nullIOExceptionpublic TrackerInfo(Set<Hash> hashes, int interval, int complete, int incomplete, int downloaders, String error, byte[] my_id, byte[] infohash, MetaInfo metainfo, I2PSnarkUtil util)
hashes - may be nulldownloaders - the active downloader count, 0 if unknown (BEP 21)error - may be nullpublic String getFailureReason()
public int getInterval()
public int getLeechCount()
public int getPartialSeedCount()
Partial seeds have some files but download nothing more; trackers report them separately from active downloaders. Zero when the tracker omits the field.
public int getPeerCount()
static int getPeerCount(Set<Hash> peers, int complete, int incomplete)
peers - the peer set from the tracker, may be nullcomplete - the seed countincomplete - the leech countpublic Set<Peer> getPeers()
public int getSeedCount()