NAME
Net::BitTorrent::Protocol::BEP23 - Packet Utilities for BEP10: Extension Protocol
Synopsis
use Net::BitTorrent::Protocol::BEP10 qw[all];
my $index = build_extended(
build_extended(
0,
{m => {'ut_pex' => 1, "\xC2\xB5T_PEX" => 2},
p => 30,
reqq => 30,
v => "Net::BitTorrent r0.30",
yourip => "\x7F\0\0\1",
}
)
);
Description
The intention of this protocol is to provide a simple and thin transport for extensions to the bittorrent protocol. Supporting this protocol makes it easy to add new extensions without interfering with the standard BitTorrent protocol or clients that don't support this extension or the one you want to add.
Importing from Net::BitTorrent::Protocol::BEP10
There are three tags available for import. To get them all in one go, use the :all
tag.
:types
-
Packet types
For more on what these packets actually mean, see the Extension Protocol spec. This is a list of the currently supported packet types.
:build
-
These create packets ready-to-send to remote peers. See Building Functions.
:parse
-
These are used to parse unknown data into sensible packets. The same packet types we can build, we can also parse. See Parsing Functions.
Building Functions
build_extended ( $msgID, $data )
-
Creates an extended protocol packet.
$msgID
should be0
if you are creating a handshake packet,>0
if an extended message as specified by the handshake is being created.$data
should be a HashRef of appropriate data.
Parsing Functions
These are the parsing counterparts for the build_
functions.
When the packet is invalid, a hash reference is returned with a single key: error
. The value is a string describing what went wrong.
Return values for valid packets are explained below.
See Also
http://bittorrent.org/beps/bep_0010.html - Fast Extension
Author
Sanko Robinson <sanko@cpan.org> - http://sankorobinson.com/
CPAN ID: SANKO
License and Legal
Copyright (C) 2008-2012 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 notes on the Artistic License 2.0 for clarification.
When separated from the distribution, all original POD documentation is covered by the Creative Commons Attribution-Share Alike 3.0 License. See the clarification of the CCA-SA3.0.
Neither this module nor the Author is affiliated with BitTorrent, Inc.