NAME

Net::BitTorrent::Protocol::BEP23 - Compact Peer Lists (IPv4 and IPv6)

SYNOPSIS

use Net::BitTorrent::Protocol::BEP23;

my $packed_v4 = Net::BitTorrent::Protocol::BEP23::pack_peers_ipv4(
    { ip => '127.0.0.1', port => 6881 }
);

my $packed_v6 = Net::BitTorrent::Protocol::BEP23::pack_peers_ipv6(
    { ip => '::1', port => 6881 }
);

DESCRIPTION

This module implements the compact peer list format defined in BEP 23 (IPv4) and BEP 07 (IPv6).

FUNCTIONS

pack_peers_ipv4(@peers)

Returns a binary string of packed IPv4 addresses and ports.

unpack_peers_ipv4($data)

Returns an array reference of peer hashes from a binary string.

pack_peers_ipv6(@peers)

Returns a binary string of packed IPv6 addresses and ports.

unpack_peers_ipv6($data)

Returns an array reference of peer hashes from a binary string.