NAME
Net::BitTorrent::Protocol::HandshakeOnly - Minimal PWP Handshake Handler
SYNOPSIS
use Net::BitTorrent::Protocol::HandshakeOnly;
my $proto = Net::BitTorrent::Protocol::HandshakeOnly->new(
on_handshake_cb => sub ( $ih, $id ) {
say "Received handshake for $ih from $id";
},
peer_id => $my_id
);
DESCRIPTION
Net::BitTorrent::Protocol::HandshakeOnly is a specialized subclass of Net::BitTorrent::Protocol::BEP03 used for protocol autodetection. It processes the initial BitTorrent handshake and then triggers a callback, allowing the client to upgrade the connection to a full protocol handler once the infohash is identified.
METHODS
new( %params )
Creates a new HandshakeOnly object.
Expected parameters:
on_handshake_cb-
A code reference that is called when a valid handshake is received. It receives the binary infohash and peer ID as arguments.
peer_id-
The local 20-byte binary peer ID.
handshake event
Emitted when a handshake is successfully received.
$proto->on( handshake => sub ( $self, $ih, $id ) { ... } );
Expected parameters:
SEE ALSO
Net::BitTorrent::Protocol::BEP03
AUTHOR
Sanko Robinson <sanko@cpan.org>
COPYRIGHT
Copyright (C) 2008-2026 by Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.