|
NAMENet::BitTorrent::Notes - Annotated Guide to the Ins and Outs of Net::BitTorrentDescriptionThis is a first draft attempt at defining a road map for future "Net::BitTorrent" development and a behavioral reference for third-party client developers. A few bits for users might slip in too.Net::BitTorrent's Way-too-Obvious Class Hierarchy.---- N::B::T::T::UDP / .-------- N::B::T::Tracker / \ / .-- N::B::T::File `--- N::B::T::T::HTTP / / .---- Net::BitTorrent::Torrent / / .--- Net::BitTorrent::DHT / / Net::BitTorrent \ `---- Net::BitTorrent::Peer The following utility modules also come with the distribution and will be of great use if you decide to whip together your own BitTorrent module.
To pick and choose which functions will be exported into your namespace from these modules, see their POD documentation for more information. InstallationThis distribution uses "Module::Build" for installation, so use the following procedure:perl Build.PL ./Build ./Build test ./Build install See also: Automated Test Reports Prerequisites"Net::BitTorrent" requires version and Digest::SHA. On Win32, we try to use Win32API::File and Encode to handle extended charset filenames[1]. As of perl 5.10, all of these modules are are CORE; they come bundled with the distribution.I have listed these modules as prerequisites in Build.PL so, unless you answer 'no' when prompted, the CPAN shell should automagically install them for you. We also use the internal "utf8()" functions which didn't appear until perl 5.8.1. How Do I...Parts that aren't handled internally are described here (eventually) with sample code to get you started.Get basic info from a .torrent without adding it to a clientNet::BitTorrent::Torrent objects can be created directly without a parent client. While functionally limited (obvious things like an inability to serve data, etc.) basic information is available and some 'advanced' functions still work (hashchecking, for example). See Net::BitTorrent::Torrent for more.Pause and Resume a .torrent SessionSee Net::BitTorrent::Torrent::pause( ) and Net::BitTorrent::Torrent::start( )Stop and Resume a .torrent SessionSee See Net::BitTorrent::Torrent::stop( ) and Net::BitTorrent::Torrent::start( )Quick Resume a .torrent Session Between Client SessionsNote: This section describes resume functionality as of "v0.045"."Net::BitTorrent" is capable of restoring the state of single torrents between sessions. To store resume data, use the save_resume_data( ) To resume a single torrent, use a variation of the following to save the data... my $torrent = $bt->add_torrent( { Path=> 'some.torrent', Resume = '.resume' }); # later... $torrent->save_resume_data(); ...and unless "Net::BitTorrent::Torrent" decides the resume data is bad, you'll start right were you left off. I would suggest storing resume data on a regular basis while the client runs and again on exit. To view a fully functioning example, see "/tatoeba/004-resume.pl". For more on what exactly you're saving and the structure of the data, see Resume API in the <Net::BitTorrent Internals|/"Net::BitTorrent Internals"> section. Save and Restore Client-wide State and DHT DataUnless you've hard coded everything, being able to restore client-wide state is a necessary feature. Besides, DHT can be very slow to boot without a good set of initial nodes and the spec states that the local nodeID should not change very often, so resume is a useful thing.I would use a hash with the following keys:
A list of nodes with this format is obtained from nodes ( ). To reload these later, use the add_node ( ) method.
I would save a bencoded version of this data in a file for later. For now, putting all of this into practice is an exercise for the reader. Note: Reloading the data may require using otherwise private methods (specifically the private "Net::BitTorrent::DHT->_set_node_id( )" method). Changes to private methods are not listed in the changelog found in this distribution but they are noted in the public git repository's log. Set File Download PrioritiesSee Net::BitTorrent::Torrent::File.Implement My Own Event Loop[TODO]Net::BitTorrent InternalsThis section describes all the behind the scenes stuff that makes "Net::BitTorrent" work. Or not work. It depends.Peer ID SpecificationPlease see Net::BitTorrent::Version.IPv6-Related InformationSocket6 does not seem to work with Win32 so... no plans for IPv6 right now.Implemented ExtensionsThe BitTorrent Community Forum coordinates the development of the BitTorrent protocol suite, its reference implementation, and BitTorrent Enhancement Proposals (BEPs). For more information, see BEP 0: Index of BitTorrent Enhancement Proposals http://bittorrent.org/beps/bep_0000.htmlThis is the list of extensions used by this release of Net::BitTorrent sorted by their progress toward standardization.
Resume API"Net::BitTorrent::Torrent"'s resume data is bencoded and stored in a file. To restore this data, use the "Resume" parameter when calling Net::BitTorrent::Torrent->new( ) or Net::BitTorrent->add_torrent( ).Note: The structure and data held in the resume data is subject to change in future versions. Data Structure Parsed resume data is a simple hash containing the following keys:
Development Policy
Compatibility NotesThis section lists recent major changes in API or behavior between stable releases. For older news see the Changes file included with this distribution. For detail see the commit logs.
Giving backIf you're interested in assisting with Net::BitTorent's development but don't know where to begin, here are a few ideas.Joining the Project"Net::BitTorrent" is too large for just one person to hack on. If you're Perl adept and would like to help, you can start by forking the project on github: http://github.com/sanko/net-bittorrent/. When ready, send me a pull request, I'll look over your changes and get back to you. Minor patches get your name in the changelog. Major patches get your name in the Acknowledgments section and an invitation to be a trusted collaborator. Oooo. Ahhh.THIS PROJECT IS ACTIVELY SEEKING DEVELOPERS. If you're interested in helping clear things out of the TODO list or if you have a suggestion and are willing to see it through to completion, contact me or, better yet, go ahead and fork the project on github: http://github.com/sanko/net-bittorrent. In general, N::B could use a second or third pair of eyes. So, if you're interested in BitTorrent, p2p, or just Perl in general, let me know. Bug ReportingFound bugs should be reported through "Net::BitTorrent"'s Issue Tracker. Before creating a new report through "Net::BitTorrent"'s Issue Tracker, please review the following list:
Automated Test ReportsBecoming a CPAN Tester is an easy, automatic way to contribute to the quality of your favorite module and CPAN in general. If you would like to contribute automated test reports for "Net::BitTorrent", install "CPAN::Reporter" from the CPAN shell first:$ cpan cpan> install CPAN::Reporter cpan> reload cpan cpan> o conf init test_report [...follow the CPAN::Reporter setup prompts...] cpan> o conf commit cpan> install Net::BitTorrent For more on becoming a CPAN Tester and why this is useful, see the CPAN::Reporter documentation and http://cpantesters.org/. See AlsoSupport and Information Links for "Net::BitTorrent"
Other Recommend Open Source BitTorrent Clients
Related Information
AuthorSanko Robinson <sanko@cpan.org> - http://sankorobinson.com/CPAN ID: SANKO License and LegalCopyright (C) 2008-2009 by Sanko Robinson <sanko@cpan.org>This program is free software; you can redistribute it and/or modify it under the terms of The Artistic License 2.0. See the LICENSE file included with this distribution or http://www.perlfoundation.org/artistic_license_2_0. For clarification, see http://www.perlfoundation.org/artistic_2_0_notes. When separated from the distribution, all POD documentation is covered by the Creative Commons Attribution-Share Alike 3.0 License. See http://creativecommons.org/licenses/by-sa/3.0/us/legalcode. For clarification, see http://creativecommons.org/licenses/by-sa/3.0/us/. Neither this module nor the Author is affiliated with BitTorrent, Inc.
Visit the GSP FreeBSD Man Page Interface. |