researching bootstrap nodes of libtorrent

master
nkls 2 years ago
parent f76247995f
commit 3736479f5e

Binary file not shown.

Binary file not shown.

@ -107,27 +107,37 @@ class mix
lt::settings_pack p;
p.set_int(lt::settings_pack::alert_mask,lt::alert_category::status | lt::alert_category::error);
lt::session ses(p);
lt::add_torrent_params atp = lt::parse_magnet_uri("magnet:?xt=urn:btih:D540FC48EB12F2833163EED6421D449DD8F1CE1F&dn=Ubuntu%20desktop%2019.04%20(64bit)");
atp.save_path=".";
lt::torrent_handle h = ses.add_torrent(std::move(atp));
for (;;)
{
std::vector<lt::alert*> alerts;
ses.pop_alerts(&alerts);
for (lt::alert const* a : alerts)
{
std::cout << a->message() << std::endl;
if (lt::alert_cast<lt::torrent_finished_alert>(a))
{
std::cout << "Torrent finished" << std::endl;
}
if (lt::alert_cast<lt::torrent_error_alert>(a))
{
std::cout << "Torrent error" << std::endl;
}
}
}
std::cout << "libtorrent version: " << lt::version() << std::endl;
std::cout << "announce ip: " << p.announce_ip << std::endl;
std::cout << "user agent: " << p.user_agent << std::endl;
std::cout << "listen interfaces: " << p.listen_interfaces << std::endl;
std::cout << "peer fingerprint: " << p.peer_fingerprint << std::endl;
p.set_str(lt::settings_pack::dht_bootstrap_nodes, "dht.bootstrap.de:12345");
std::cout << "dht bootstrap nodes: " << p.get_str(11) << std::endl;
// lt::add_torrent_params atp = lt::parse_magnet_uri("magnet:?xt=urn:btih:D540FC48EB12F2833163EED6421D449DD8F1CE1F&dn=Ubuntu%20desktop%2019.04%20(64bit)");
// atp.save_path=".";
// lt::torrent_handle h = ses.add_torrent(std::move(atp));
// for (;;)
// {
// std::vector<lt::alert*> alerts;
// ses.pop_alerts(&alerts);
// for (lt::alert const* a : alerts)
// {
// std::cout << a->message() << std::endl;
// if (lt::alert_cast<lt::torrent_finished_alert>(a))
// {
// std::cout << "Torrent finished" << std::endl;
// }
// if (lt::alert_cast<lt::torrent_error_alert>(a))
// {
// std::cout << "Torrent error" << std::endl;
// }
// }
// }

Loading…
Cancel
Save