NAME
Net::BitTorrent::Tracker::HTTP - HTTP/HTTPS Tracker Protocol
SYNOPSIS
use Net::BitTorrent::Tracker::HTTP;
my $tracker = Net::BitTorrent::Tracker::HTTP->new(
url => 'https://tracker.example.com/announce'
);
# Perform synchronous announce
my $res = $tracker->perform_announce({
infohash => $ih,
peer_id => $id,
port => 6881,
downloaded => 0,
uploaded => 0,
left => 1024
});
say 'Interval: ' . $res->{interval};
DESCRIPTION
Net::BitTorrent::Tracker::HTTP implements the original BitTorrent tracker protocol over HTTP and HTTPS. It handles URL encoding of binary infohashes and parsing of bencoded responses.
METHODS
perform_announce( \%params, [$callback] )
Executes an HTTP GET request to the tracker.
Automatically handles compact peer lists (IPv4 and IPv6) and supports asynchronous mode if $params->{ua} is provided. For example, you could hand us a Mojo::UserAgent instance and the request will be non-blocking.
perform_scrape( \@infohashes, [$callback] )
Executes a tracker scrape (BEP 48) by converting the announce URL to a scrape URL and requesting statistics for the provided hashes.
build_announce_url( \%params )
Generates the full URL with query parameters. Correctly percent-encodes the binary info_hash and peer_id fields.
parse_response( $bencoded_data )
Parses and validates the tracker's response. Automatically expands compact peer lists into user-friendly hashrefs.
SPECIFICATIONS
BEP 03: The BitTorrent Protocol (HTTP Tracker)
BEP 23: Tracker Returns Compact Peer Lists
BEP 07: IPv6 Support (
peers6field)BEP 48: Tracker Scrape Convention
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.