For those interested in torrenting this is a place to share information about the new v2 implementation.
This can be links, wikis, videos, code snippets anything and is here to help keep update for connecting to clients in PHP.
Few Links
libtorrent https://blog.libtorrent.org/2020/09/bittorrent-v2/
BEP52 http://bittorrent.org/beps/bep_0052.html
The first things that stuck out to me are:
The hash is now SHA-256 this still needs to be 20 bytes long (bytes not characters at moment the sha1 is 40bytes but we use hexbin to 20 this should be the same using a limit on a custom hex_bin function like on bitstorm - after having a quick look at this we don't send the hash back to the client ist just to identify in our dB that id to the id of the client it's connecting to that should be just a case of changing table column length and change for sh256
A integer with any leading zeros (except 0 itself). e.g. “i0004e” are not allowed - this bit had me puzzled at first until i read my notes on bencoding, this will be extremely uncommon if at all bencode is string length say eg 5 followed by the string eg hello so that would be i5ehello so the torrent string should never start with 0
In the future all old torrents will be obsolete, but for now we can do hybrid torrents so saving the new hash and data is a good idea to start on now
The structure of the torrent file array is different filetree, but also how pieces & paths work this needs live test
Here is a few test v2 torrents https://github.com/arvidn/libtorrent/tree/RC_2_0/test/test_torrents
If anyone has anything to add or has any progress please can you post here and ill update the post as we go. Progress might be slow but if everyone shares there work and knowledge we can keep up to date 👍
At moment qbit crashes for me so cant make a v2 torrent with my own announce but i have tried decoding one of the test ones from above, when i try upload to TT i get a few things come back null from the parser function, if someone knows how to set qbit to create v2 torrent that would be a big help i think i can grab the data but until qbit 4.4 works for me i cant test that much
here is link to test - first two dumps are v2 & last one is v1 so far it looks like its just the parse function (upload & import) and announce will need changing
https://torrenttrader.uk/atest
code used for testing page ive attached my bencode class, im using not sure if its working as it should for v2 but ive been using it for v1 for some time
This can be links, wikis, videos, code snippets anything and is here to help keep update for connecting to clients in PHP.
Few Links
libtorrent https://blog.libtorrent.org/2020/09/bittorrent-v2/
BEP52 http://bittorrent.org/beps/bep_0052.html
The first things that stuck out to me are:
The hash is now SHA-256 this still needs to be 20 bytes long (bytes not characters at moment the sha1 is 40bytes but we use hexbin to 20 this should be the same using a limit on a custom hex_bin function like on bitstorm - after having a quick look at this we don't send the hash back to the client ist just to identify in our dB that id to the id of the client it's connecting to that should be just a case of changing table column length and change for sh256
A integer with any leading zeros (except 0 itself). e.g. “i0004e” are not allowed - this bit had me puzzled at first until i read my notes on bencoding, this will be extremely uncommon if at all bencode is string length say eg 5 followed by the string eg hello so that would be i5ehello so the torrent string should never start with 0
In the future all old torrents will be obsolete, but for now we can do hybrid torrents so saving the new hash and data is a good idea to start on now
The structure of the torrent file array is different filetree, but also how pieces & paths work this needs live test
Here is a few test v2 torrents https://github.com/arvidn/libtorrent/tree/RC_2_0/test/test_torrents
If anyone has anything to add or has any progress please can you post here and ill update the post as we go. Progress might be slow but if everyone shares there work and knowledge we can keep up to date 👍
At moment qbit crashes for me so cant make a v2 torrent with my own announce but i have tried decoding one of the test ones from above, when i try upload to TT i get a few things come back null from the parser function, if someone knows how to set qbit to create v2 torrent that would be a big help i think i can grab the data but until qbit 4.4 works for me i cant test that much
here is link to test - first two dumps are v2 & last one is v1 so far it looks like its just the parse function (upload & import) and announce will need changing
https://torrenttrader.uk/atest
code used for testing page ive attached my bencode class, im using not sure if its working as it should for v2 but ive been using it for v1 for some time
echo '<br><br>v2 torrent<br><br>';
$torrent_dir = UPLOADDIR."/torrents/2.torrent";
$test = Bencode::load($torrent_dir);
var_dump($test);
echo '<br><br>another v2 torrent<br><br>';
$torrent_dir = UPLOADDIR."/torrents/16.torrent";
$test = Bencode::load($torrent_dir);
var_dump($test);
echo '<br><br>original v1 torrent<br><br>';
$torrent_dir = UPLOADDIR."/torrents/1.torrent";
$test = Bencode::load($torrent_dir);
var_dump($test);
Last edited by M-jay
on 2022-01-14 17:55:11
on 2022-01-14 17:55:11