Compact mode is a way to return peer list as a compact binary string :
Client give :
Code:
&info_hash=info_hash_here&peer_id=peer_id_here&port=54360&uploaded=0&downloaded=0&left=0&corrupt=0&key=D662A77D&numwant=200&compact=1&no_peer_id=1&ipv6=an_ipv6_address
Some tracker response with compact (binary in BBCode xD but I try to show you):
Code:
d8:intervali3600e12:min intervali3600e8:completei15e10:incompletei0e5:peers102:RZ¿Rþí¢{§^Kä!lîU±«/Zh/)ÔLýs7Z6K gß\ñ²¼X©=Sz÷dWZß#zvÂX©=\ñ²ÿÿÿ7SÀÀ1VØ.g¸e
Code:
d8:intervali2400e12:min intervali2400e8:completei18e10:incompletei0e5:peers102:RCZ9¡ÿZ¿R@v·{§U± H¿UÞh/)ÔLýs7Z6K gß\ñ²¼Sz÷dWZß#zvÂX©=\ñ²ÿÿÿ7SÀÀ1VØ.g¸VD2ÿÿÿp}e
Tracker must respond with a peer list in binary format :
peers<string lenght>:<binary (lenght = 6) for IP:PORT of peer1><binary (lenght = 6) for IP:PORT of peer2>etc...
Compare to "classic" method, just removed the "peersl<peer list>"
Here is my php function to create peer pack list :
Code:
$resp = 'd8:intervali' . $annintval . 'e12:min intervali' . $annintval . 'e8:completei' . $torrent['seeders'] . 'e10:incompletei' . $torrent['leechers'] . 'e5:peers';
while ($row = mysql_fetch_assoc($res)){
$peer_ip = explode('.', long2ip($row["ipv4"]));
$peer_ip = pack("C*", $peer_ip[0], $peer_ip[1], $peer_ip[2], $peer_ip[3]);
$peer_port = pack("n*", (int)$row["port"]);
if($left == 0) {
$time += 128;
}
$time = pack("C", $time);
$peer[] = $time . $peer_ip . $peer_port;
$pnum++;
}
$o = '';
for($i=0;$i<$pnum;$i++) {
$o .= substr($peer[$i], 1, 6);
}
$resp .= strlen($o) . ':' . $o . 'e';
Edit:
Personaly, I use also the KEY param given into the URL, I don't know witch parameter give BitTornado. An I hope some params could be added (like Azureus) for :
require/suport Crypto
ipv6= IPv6 adress : if tracker haven't got IPv6 support, he cans return a peer list with IPv6
no_peer_id : I'm not sure about this but : if compact is set to 1, no_peer_id is set to 1 too.
I put the notifs to on.