├── .cirrus.yml ├── .github ├── CONTRIBUTING.rst ├── FUNDING.yml ├── ISSUE_TEMPLATE.md ├── SECURITY.md ├── codecov.yml ├── stale.yml └── workflows │ ├── android.yml │ ├── cibuildwheel.yml │ ├── cifuzz.yml │ ├── codeql.yml │ ├── docs.yml │ ├── linux.yml │ ├── macos.yml │ ├── python.yml │ └── windows.yml ├── .gitignore ├── .gitmodules ├── .pre-commit-config.yaml ├── AUTHORS ├── CMakeLists.txt ├── COPYING ├── ChangeLog ├── Jamfile ├── Jamroot.jam ├── LICENSE ├── LibtorrentRasterbarConfig.cmake.in ├── Makefile ├── NEWS ├── README.rst ├── appveyor.yml ├── bindings ├── CMakeLists.txt ├── Makefile.am ├── README.txt ├── c │ ├── Jamfile │ ├── library.cpp │ ├── libtorrent.h │ └── simple_client.c └── python │ ├── CMakeLists.txt │ ├── Jamfile │ ├── client.py │ ├── dummy_data.py │ ├── make_torrent.py │ ├── setup.cfg │ ├── setup.py │ ├── setup.py.cmake.in │ ├── simple_client.py │ ├── src │ ├── alert.cpp │ ├── boost_python.hpp │ ├── bytes.hpp │ ├── converters.cpp │ ├── create_torrent.cpp │ ├── datetime.cpp │ ├── entry.cpp │ ├── error_code.cpp │ ├── fingerprint.cpp │ ├── gil.hpp │ ├── info_hash.cpp │ ├── ip_filter.cpp │ ├── load_torrent.cpp │ ├── magnet_uri.cpp │ ├── module.cpp │ ├── optional.hpp │ ├── peer_info.cpp │ ├── session.cpp │ ├── session_settings.cpp │ ├── sha1_hash.cpp │ ├── sha256_hash.cpp │ ├── string.cpp │ ├── torrent_handle.cpp │ ├── torrent_info.cpp │ ├── torrent_status.cpp │ ├── utility.cpp │ └── version.cpp │ └── test.py ├── clang_tidy.jam ├── cmake └── Modules │ ├── FindLibGcrypt.cmake │ ├── GeneratePkgConfig.cmake │ ├── GeneratePkgConfig │ ├── generate-pkg-config.cmake.in │ ├── pkg-config.cmake.in │ └── target-compile-settings.cmake.in │ ├── LibtorrentMacros.cmake │ └── ucm_flags.cmake ├── docs ├── 2020 Q4 Mozilla Libtorrent Report Public Report.pdf ├── build_version.sh ├── building.rst ├── client_test.rst ├── contributing.rst ├── dht_extensions.rst ├── dht_rss.rst ├── dht_sec.rst ├── dht_store.rst ├── examples.rst ├── extension_protocol.rst ├── features.rst ├── filter-rst.py ├── fuzzing.rst ├── gen_reference_doc.py ├── gen_settings_doc.py ├── gen_stats_doc.py ├── gen_todo.py ├── hacking.rst ├── header.rst ├── hunspell │ ├── en_US.aff │ ├── en_US.dic │ └── libtorrent.dic ├── img │ ├── bitcoin.png │ ├── complete_bit_prefixes.png │ ├── cwnd.png │ ├── delays.png │ ├── hacking.diagram │ ├── hash_distribution.png │ ├── ip_id_v4.png │ ├── ip_id_v6.png │ ├── logo-bw.svg │ ├── logo-color-text-vertical.svg │ ├── logo-color-text.png │ ├── logo-color-text.svg │ ├── logo-color.svg │ ├── logo.svg │ ├── our_delay_base.png │ ├── pp-acceptance-medium.png │ ├── read_disk_buffers.diagram │ ├── screenshot.png │ ├── storage.diagram │ ├── troubleshooting.dot │ ├── utp_stack.diagram │ └── write_disk_buffers.diagram ├── index.rst ├── makefile ├── manual.rst ├── projects.rst ├── python_binding.rst ├── security-audit.rst ├── streaming.rst ├── style.css ├── stylesheet ├── template.txt ├── template2.txt ├── troubleshooting.rst ├── troubleshooting_thumb.png ├── tuning.rst ├── tutorial.rst ├── udp_tracker_protocol.rst ├── upgrade_to_1.2.rst ├── upgrade_to_2.0.rst └── utp.rst ├── examples ├── CMakeLists.txt ├── Jamfile ├── Makefile.am ├── bt-get.cpp ├── bt-get2.cpp ├── bt-get3.cpp ├── check_files.cpp ├── client_test.cpp ├── cmake │ └── FindLibtorrentRasterbar.cmake ├── connection_tester.cpp ├── custom_storage.cpp ├── dump_bdecode.cpp ├── dump_torrent.cpp ├── magnet2torrent.cpp ├── make_torrent.cpp ├── print.cpp ├── print.hpp ├── run_benchmarks.py ├── session_view.cpp ├── session_view.hpp ├── simple_client.cpp ├── stats_counters.cpp ├── torrent2magnet.cpp ├── torrent_view.cpp ├── torrent_view.hpp └── upnp_test.cpp ├── fuzzers ├── Jamfile ├── LICENSE ├── README.rst ├── main.cpp ├── minimize.sh ├── run.sh ├── src │ ├── add_torrent.cpp │ ├── base32decode.cpp │ ├── base32encode.cpp │ ├── base64encode.cpp │ ├── bdecode_node.cpp │ ├── convert_from_native.cpp │ ├── convert_to_native.cpp │ ├── dht_node.cpp │ ├── escape_path.cpp │ ├── escape_string.cpp │ ├── file_storage_add_file.cpp │ ├── gzip.cpp │ ├── http_parser.cpp │ ├── http_tracker.cpp │ ├── idna.cpp │ ├── parse_int.cpp │ ├── parse_magnet_uri.cpp │ ├── parse_url.cpp │ ├── peer_conn.cpp │ ├── read_bits.hpp │ ├── resume_data.cpp │ ├── sanitize_path.cpp │ ├── session_params.cpp │ ├── torrent_info.cpp │ ├── upnp.cpp │ ├── utf8_codepoint.cpp │ ├── utp.cpp │ └── verify_encoding.cpp └── tools │ ├── generate_initial_corpus.py │ └── unify_corpus_names.py ├── include └── libtorrent │ ├── add_torrent_params.hpp │ ├── address.hpp │ ├── alert.hpp │ ├── alert_types.hpp │ ├── announce_entry.hpp │ ├── assert.hpp │ ├── aux_ │ ├── alert_manager.hpp │ ├── aligned_union.hpp │ ├── alloca.hpp │ ├── allocating_handler.hpp │ ├── announce_entry.hpp │ ├── apply_pad_files.hpp │ ├── array.hpp │ ├── bandwidth_limit.hpp │ ├── bandwidth_manager.hpp │ ├── bandwidth_queue_entry.hpp │ ├── bandwidth_socket.hpp │ ├── bind_to_device.hpp │ ├── buffer.hpp │ ├── byteswap.hpp │ ├── chained_buffer.hpp │ ├── container_wrapper.hpp │ ├── cpuid.hpp │ ├── deferred_handler.hpp │ ├── deprecated.hpp │ ├── deque.hpp │ ├── dev_random.hpp │ ├── directory.hpp │ ├── disable_deprecation_warnings_push.hpp │ ├── disable_warnings_pop.hpp │ ├── disable_warnings_push.hpp │ ├── disk_buffer_pool.hpp │ ├── disk_io_thread_pool.hpp │ ├── disk_job_fence.hpp │ ├── disk_job_pool.hpp │ ├── drive_info.hpp │ ├── ed25519.hpp │ ├── escape_string.hpp │ ├── export.hpp │ ├── ffs.hpp │ ├── file_descriptor.hpp │ ├── file_pointer.hpp │ ├── file_progress.hpp │ ├── file_view_pool.hpp │ ├── generate_peer_id.hpp │ ├── has_block.hpp │ ├── hasher512.hpp │ ├── heterogeneous_queue.hpp │ ├── instantiate_connection.hpp │ ├── invariant_check.hpp │ ├── io.hpp │ ├── ip_helpers.hpp │ ├── ip_notifier.hpp │ ├── keepalive.hpp │ ├── listen_socket_handle.hpp │ ├── lsd.hpp │ ├── merkle.hpp │ ├── merkle_tree.hpp │ ├── mmap.hpp │ ├── mmap_disk_job.hpp │ ├── netlink_utils.hpp │ ├── noexcept_movable.hpp │ ├── numeric_cast.hpp │ ├── open_mode.hpp │ ├── packet_buffer.hpp │ ├── packet_pool.hpp │ ├── path.hpp │ ├── polymorphic_socket.hpp │ ├── pool.hpp │ ├── portmap.hpp │ ├── posix_part_file.hpp │ ├── posix_storage.hpp │ ├── proxy_settings.hpp │ ├── range.hpp │ ├── receive_buffer.hpp │ ├── resolver.hpp │ ├── resolver_interface.hpp │ ├── route.h │ ├── scope_end.hpp │ ├── session_call.hpp │ ├── session_impl.hpp │ ├── session_interface.hpp │ ├── session_settings.hpp │ ├── session_udp_sockets.hpp │ ├── set_socket_buffer.hpp │ ├── set_traffic_class.hpp │ ├── sha512.hpp │ ├── socket_type.hpp │ ├── storage_free_list.hpp │ ├── storage_utils.hpp │ ├── store_buffer.hpp │ ├── string_ptr.hpp │ ├── strview_less.hpp │ ├── suggest_piece.hpp │ ├── throw.hpp │ ├── time.hpp │ ├── timestamp_history.hpp │ ├── torrent_impl.hpp │ ├── torrent_list.hpp │ ├── unique_ptr.hpp │ ├── utp_socket_manager.hpp │ ├── utp_stream.hpp │ ├── vector.hpp │ ├── win_cng.hpp │ ├── win_crypto_provider.hpp │ ├── win_file_handle.hpp │ ├── win_util.hpp │ └── windows.hpp │ ├── bdecode.hpp │ ├── bencode.hpp │ ├── bitfield.hpp │ ├── bloom_filter.hpp │ ├── bt_peer_connection.hpp │ ├── choker.hpp │ ├── client_data.hpp │ ├── close_reason.hpp │ ├── config.hpp │ ├── copy_ptr.hpp │ ├── crc32c.hpp │ ├── create_torrent.hpp │ ├── deadline_timer.hpp │ ├── debug.hpp │ ├── disabled_disk_io.hpp │ ├── disk_buffer_holder.hpp │ ├── disk_interface.hpp │ ├── disk_observer.hpp │ ├── download_priority.hpp │ ├── entry.hpp │ ├── enum_net.hpp │ ├── error.hpp │ ├── error_code.hpp │ ├── extensions.hpp │ ├── extensions │ ├── smart_ban.hpp │ ├── ut_metadata.hpp │ └── ut_pex.hpp │ ├── file.hpp │ ├── file_layout.hpp │ ├── file_storage.hpp │ ├── fingerprint.hpp │ ├── flags.hpp │ ├── fwd.hpp │ ├── gzip.hpp │ ├── hash_picker.hpp │ ├── hasher.hpp │ ├── hex.hpp │ ├── http_connection.hpp │ ├── http_parser.hpp │ ├── http_seed_connection.hpp │ ├── http_stream.hpp │ ├── http_tracker_connection.hpp │ ├── i2p_stream.hpp │ ├── identify_client.hpp │ ├── index_range.hpp │ ├── info_hash.hpp │ ├── io.hpp │ ├── io_context.hpp │ ├── io_service.hpp │ ├── ip_filter.hpp │ ├── ip_voter.hpp │ ├── kademlia │ ├── announce_flags.hpp │ ├── dht_observer.hpp │ ├── dht_settings.hpp │ ├── dht_state.hpp │ ├── dht_storage.hpp │ ├── dht_tracker.hpp │ ├── direct_request.hpp │ ├── dos_blocker.hpp │ ├── ed25519.hpp │ ├── find_data.hpp │ ├── get_item.hpp │ ├── get_peers.hpp │ ├── io.hpp │ ├── item.hpp │ ├── msg.hpp │ ├── node.hpp │ ├── node_entry.hpp │ ├── node_id.hpp │ ├── observer.hpp │ ├── put_data.hpp │ ├── refresh.hpp │ ├── routing_table.hpp │ ├── rpc_manager.hpp │ ├── sample_infohashes.hpp │ ├── traversal_algorithm.hpp │ └── types.hpp │ ├── libtorrent.hpp │ ├── link.hpp │ ├── load_torrent.hpp │ ├── lsd.hpp │ ├── magnet_uri.hpp │ ├── mmap_disk_io.hpp │ ├── mmap_storage.hpp │ ├── natpmp.hpp │ ├── netlink.hpp │ ├── operations.hpp │ ├── optional.hpp │ ├── parse_url.hpp │ ├── part_file.hpp │ ├── pe_crypto.hpp │ ├── peer.hpp │ ├── peer_class.hpp │ ├── peer_class_set.hpp │ ├── peer_class_type_filter.hpp │ ├── peer_connection.hpp │ ├── peer_connection_handle.hpp │ ├── peer_connection_interface.hpp │ ├── peer_id.hpp │ ├── peer_info.hpp │ ├── peer_list.hpp │ ├── peer_request.hpp │ ├── performance_counters.hpp │ ├── pex_flags.hpp │ ├── piece_block.hpp │ ├── piece_block_progress.hpp │ ├── piece_picker.hpp │ ├── platform_util.hpp │ ├── portmap.hpp │ ├── posix_disk_io.hpp │ ├── proxy_base.hpp │ ├── puff.hpp │ ├── random.hpp │ ├── read_resume_data.hpp │ ├── request_blocks.hpp │ ├── resolve_links.hpp │ ├── session.hpp │ ├── session_handle.hpp │ ├── session_params.hpp │ ├── session_settings.hpp │ ├── session_stats.hpp │ ├── session_status.hpp │ ├── session_types.hpp │ ├── settings_pack.hpp │ ├── sha1.hpp │ ├── sha1_hash.hpp │ ├── sha256.hpp │ ├── sliding_average.hpp │ ├── socket.hpp │ ├── socket_io.hpp │ ├── socket_type.hpp │ ├── socks5_stream.hpp │ ├── span.hpp │ ├── ssl.hpp │ ├── ssl_stream.hpp │ ├── stack_allocator.hpp │ ├── stat.hpp │ ├── stat_cache.hpp │ ├── storage.hpp │ ├── storage_defs.hpp │ ├── string_util.hpp │ ├── string_view.hpp │ ├── tailqueue.hpp │ ├── time.hpp │ ├── torrent.hpp │ ├── torrent_flags.hpp │ ├── torrent_handle.hpp │ ├── torrent_info.hpp │ ├── torrent_peer.hpp │ ├── torrent_peer_allocator.hpp │ ├── torrent_status.hpp │ ├── tracker_manager.hpp │ ├── truncate.hpp │ ├── udp_socket.hpp │ ├── udp_tracker_connection.hpp │ ├── union_endpoint.hpp │ ├── units.hpp │ ├── upnp.hpp │ ├── utf8.hpp │ ├── vector_utils.hpp │ ├── version.hpp │ ├── web_connection_base.hpp │ ├── web_peer_connection.hpp │ ├── write_resume_data.hpp │ └── xml_parse.hpp ├── project-config.jam ├── pyproject.toml ├── setup.cfg ├── setup.py ├── simulation ├── Jamfile ├── create_torrent.cpp ├── create_torrent.hpp ├── disk_io.cpp ├── disk_io.hpp ├── fake_peer.hpp ├── make_proxy_settings.hpp ├── setup_dht.cpp ├── setup_dht.hpp ├── setup_swarm.cpp ├── setup_swarm.hpp ├── test_auto_manage.cpp ├── test_checking.cpp ├── test_dht.cpp ├── test_dht_bootstrap.cpp ├── test_dht_rate_limit.cpp ├── test_dht_storage.cpp ├── test_error_handling.cpp ├── test_fast_extensions.cpp ├── test_file_pool.cpp ├── test_http_connection.cpp ├── test_ip_filter.cpp ├── test_metadata_extension.cpp ├── test_optimistic_unchoke.cpp ├── test_pause.cpp ├── test_pe_crypto.cpp ├── test_peer_connection.cpp ├── test_save_resume.cpp ├── test_session.cpp ├── test_socks5.cpp ├── test_super_seeding.cpp ├── test_swarm.cpp ├── test_thread_pool.cpp ├── test_timeout.cpp ├── test_torrent_status.cpp ├── test_tracker.cpp ├── test_transfer.cpp ├── test_transfer_full_invalid_files.cpp ├── test_transfer_no_files.cpp ├── test_transfer_partial_valid_files.cpp ├── test_utp.cpp ├── test_v2.cpp ├── test_web_seed.cpp ├── transfer_sim.cpp ├── transfer_sim.hpp ├── utils.cpp └── utils.hpp ├── src ├── add_torrent_params.cpp ├── alert.cpp ├── alert_manager.cpp ├── announce_entry.cpp ├── assert.cpp ├── bandwidth_limit.cpp ├── bandwidth_manager.cpp ├── bandwidth_queue_entry.cpp ├── bdecode.cpp ├── bitfield.cpp ├── bloom_filter.cpp ├── bt_peer_connection.cpp ├── chained_buffer.cpp ├── choker.cpp ├── close_reason.cpp ├── copy_file.cpp ├── cpuid.cpp ├── crc32c.cpp ├── create_torrent.cpp ├── directory.cpp ├── disabled_disk_io.cpp ├── disk_buffer_holder.cpp ├── disk_buffer_pool.cpp ├── disk_interface.cpp ├── disk_io_thread_pool.cpp ├── disk_job_fence.cpp ├── disk_job_pool.cpp ├── drive_info.cpp ├── ed25519 │ ├── LICENSE │ ├── add_scalar.cpp │ ├── fe.cpp │ ├── fe.h │ ├── fixedint.h │ ├── ge.cpp │ ├── ge.h │ ├── hasher512.cpp │ ├── key_exchange.cpp │ ├── keypair.cpp │ ├── precomp_data.h │ ├── sc.cpp │ ├── sc.h │ ├── sha512.cpp │ ├── sign.cpp │ └── verify.cpp ├── entry.cpp ├── enum_net.cpp ├── error_code.cpp ├── escape_string.cpp ├── ffs.cpp ├── file.cpp ├── file_progress.cpp ├── file_storage.cpp ├── file_view_pool.cpp ├── fingerprint.cpp ├── generate_peer_id.cpp ├── gzip.cpp ├── hash_picker.cpp ├── hasher.cpp ├── hex.cpp ├── http_connection.cpp ├── http_parser.cpp ├── http_seed_connection.cpp ├── http_tracker_connection.cpp ├── i2p_stream.cpp ├── identify_client.cpp ├── instantiate_connection.cpp ├── ip_filter.cpp ├── ip_helpers.cpp ├── ip_notifier.cpp ├── ip_voter.cpp ├── kademlia │ ├── dht_settings.cpp │ ├── dht_state.cpp │ ├── dht_storage.cpp │ ├── dht_tracker.cpp │ ├── dos_blocker.cpp │ ├── ed25519.cpp │ ├── find_data.cpp │ ├── get_item.cpp │ ├── get_peers.cpp │ ├── item.cpp │ ├── msg.cpp │ ├── node.cpp │ ├── node_entry.cpp │ ├── node_id.cpp │ ├── put_data.cpp │ ├── refresh.cpp │ ├── routing_table.cpp │ ├── rpc_manager.cpp │ ├── sample_infohashes.cpp │ └── traversal_algorithm.cpp ├── listen_socket_handle.cpp ├── load_torrent.cpp ├── lsd.cpp ├── magnet_uri.cpp ├── merkle.cpp ├── merkle_tree.cpp ├── mmap.cpp ├── mmap_disk_io.cpp ├── mmap_disk_job.cpp ├── mmap_storage.cpp ├── natpmp.cpp ├── packet_buffer.cpp ├── parse_url.cpp ├── part_file.cpp ├── path.cpp ├── pe_crypto.cpp ├── peer_class.cpp ├── peer_class_set.cpp ├── peer_connection.cpp ├── peer_connection_handle.cpp ├── peer_info.cpp ├── peer_list.cpp ├── performance_counters.cpp ├── piece_picker.cpp ├── platform_util.cpp ├── posix_disk_io.cpp ├── posix_part_file.cpp ├── posix_storage.cpp ├── proxy_base.cpp ├── proxy_settings.cpp ├── puff.cpp ├── random.cpp ├── read_resume_data.cpp ├── receive_buffer.cpp ├── request_blocks.cpp ├── resolve_links.cpp ├── resolver.cpp ├── session.cpp ├── session_call.cpp ├── session_handle.cpp ├── session_impl.cpp ├── session_params.cpp ├── session_settings.cpp ├── session_stats.cpp ├── settings_pack.cpp ├── sha1.cpp ├── sha1_hash.cpp ├── sha256.cpp ├── smart_ban.cpp ├── socket_io.cpp ├── socket_type.cpp ├── socks5_stream.cpp ├── ssl.cpp ├── stack_allocator.cpp ├── stat.cpp ├── stat_cache.cpp ├── storage_utils.cpp ├── string_util.cpp ├── time.cpp ├── timestamp_history.cpp ├── torrent.cpp ├── torrent_handle.cpp ├── torrent_info.cpp ├── torrent_peer.cpp ├── torrent_peer_allocator.cpp ├── torrent_status.cpp ├── tracker_manager.cpp ├── truncate.cpp ├── udp_socket.cpp ├── udp_tracker_connection.cpp ├── upnp.cpp ├── ut_metadata.cpp ├── ut_pex.cpp ├── utf8.cpp ├── utp_socket_manager.cpp ├── utp_stream.cpp ├── version.cpp ├── web_connection_base.cpp ├── web_peer_connection.cpp ├── write_resume_data.cpp └── xml_parse.cpp ├── test ├── CMakeLists.txt ├── Jamfile ├── bittorrent_peer.cpp ├── bittorrent_peer.hpp ├── broadcast_socket.cpp ├── broadcast_socket.hpp ├── corrupt.gz ├── dht_server.cpp ├── dht_server.hpp ├── enum_if.cpp ├── http_proxy.py ├── invalid1.gz ├── main.cpp ├── make_torrent.cpp ├── make_torrent.hpp ├── mutable_test_torrents │ ├── test1.torrent │ ├── test1_pad_files.torrent │ ├── test1_single.torrent │ ├── test1_single_padded.torrent │ ├── test2.torrent │ ├── test2_pad_files.torrent │ ├── test3.torrent │ └── test3_pad_files.torrent ├── peer_server.cpp ├── peer_server.hpp ├── print_alerts.cpp ├── print_alerts.hpp ├── root1.xml ├── root2.xml ├── root3.xml ├── settings.cpp ├── settings.hpp ├── setup_transfer.cpp ├── setup_transfer.hpp ├── socks.py ├── ssl │ ├── dhparams.pem │ ├── invalid_peer_certificate.pem │ ├── invalid_peer_private_key.pem │ ├── peer_certificate.pem │ ├── peer_private_key.pem │ ├── regenerate_test_certificate.sh │ ├── root_ca_cert.pem │ ├── root_ca_private.pem │ └── server.pem ├── swarm_suite.cpp ├── swarm_suite.hpp ├── test.cpp ├── test.hpp ├── test_add_torrent.cpp ├── test_alert_manager.cpp ├── test_alert_types.cpp ├── test_alloca.cpp ├── test_apply_pad.cpp ├── test_auto_unchoke.cpp ├── test_bandwidth_limiter.cpp ├── test_bdecode.cpp ├── test_bencoding.cpp ├── test_bitfield.cpp ├── test_bloom_filter.cpp ├── test_buffer.cpp ├── test_checking.cpp ├── test_copy_file.cpp ├── test_crc32.cpp ├── test_create_torrent.cpp ├── test_dht.cpp ├── test_dht_storage.cpp ├── test_direct_dht.cpp ├── test_dos_blocker.cpp ├── test_ed25519.cpp ├── test_enum_net.cpp ├── test_fast_extension.cpp ├── test_fence.cpp ├── test_ffs.cpp ├── test_file.cpp ├── test_file_progress.cpp ├── test_file_storage.cpp ├── test_flags.cpp ├── test_generate_peer_id.cpp ├── test_gzip.cpp ├── test_hash_picker.cpp ├── test_hasher.cpp ├── test_hasher512.cpp ├── test_heterogeneous_queue.cpp ├── test_http_connection.cpp ├── test_http_parser.cpp ├── test_identify_client.cpp ├── test_info_hash.cpp ├── test_io.cpp ├── test_ip_filter.cpp ├── test_ip_voter.cpp ├── test_listen_socket.cpp ├── test_lsd.cpp ├── test_magnet.cpp ├── test_merkle.cpp ├── test_merkle_tree.cpp ├── test_mmap.cpp ├── test_natpmp.cpp ├── test_packet_buffer.cpp ├── test_part_file.cpp ├── test_pe_crypto.cpp ├── test_peer_classes.cpp ├── test_peer_list.cpp ├── test_peer_priority.cpp ├── test_piece_picker.cpp ├── test_primitives.cpp ├── test_priority.cpp ├── test_privacy.cpp ├── test_read_piece.cpp ├── test_read_resume.cpp ├── test_receive_buffer.cpp ├── test_recheck.cpp ├── test_remap_files.cpp ├── test_remove_torrent.cpp ├── test_resolve_links.cpp ├── test_resume.cpp ├── test_session.cpp ├── test_session_params.cpp ├── test_settings_pack.cpp ├── test_sha1_hash.cpp ├── test_similar_torrent.cpp ├── test_sliding_average.cpp ├── test_socket_io.cpp ├── test_span.cpp ├── test_ssl.cpp ├── test_stack_allocator.cpp ├── test_stat_cache.cpp ├── test_storage.cpp ├── test_store_buffer.cpp ├── test_string.cpp ├── test_tailqueue.cpp ├── test_threads.cpp ├── test_time.cpp ├── test_time_critical.cpp ├── test_timestamp_history.cpp ├── test_torrent.cpp ├── test_torrent_info.cpp ├── test_torrent_list.cpp ├── test_torrents │ ├── absolute_filename.torrent │ ├── backslash_path.torrent │ ├── bad_name.torrent │ ├── base.torrent │ ├── collection.torrent │ ├── collection2.torrent │ ├── creation_date.torrent │ ├── dht_nodes.torrent │ ├── duplicate_files.torrent │ ├── duplicate_web_seeds.torrent │ ├── empty-files-1.torrent │ ├── empty-files-2.torrent │ ├── empty-files-3.torrent │ ├── empty-files-4.torrent │ ├── empty-files-5.torrent │ ├── empty_httpseed.torrent │ ├── empty_path.torrent │ ├── empty_path_multi.torrent │ ├── hidden_parent_path.torrent │ ├── httpseed.torrent │ ├── invalid_file_size.torrent │ ├── invalid_filename.torrent │ ├── invalid_filename2.torrent │ ├── invalid_info.torrent │ ├── invalid_name.torrent │ ├── invalid_name2.torrent │ ├── invalid_name3.torrent │ ├── invalid_path_list.torrent │ ├── invalid_piece_len.torrent │ ├── invalid_pieces.torrent │ ├── invalid_symlink.torrent │ ├── large.torrent │ ├── large_piece_size.torrent │ ├── long_name.torrent │ ├── many_pieces.torrent │ ├── missing_path_list.torrent │ ├── missing_piece_len.torrent │ ├── negative_file_size.torrent │ ├── negative_piece_len.torrent │ ├── negative_size.torrent │ ├── no_creation_date.torrent │ ├── no_files.torrent │ ├── no_name.torrent │ ├── overlapping_symlinks.torrent │ ├── pad_file.torrent │ ├── pad_file_no_path.torrent │ ├── parent_path.torrent │ ├── sample.torrent │ ├── similar.torrent │ ├── similar2.torrent │ ├── single_multi_file.torrent │ ├── slash_path.torrent │ ├── slash_path2.torrent │ ├── slash_path3.torrent │ ├── string.torrent │ ├── symlink1.torrent │ ├── symlink2.torrent │ ├── symlink_zero_size.torrent │ ├── unaligned_pieces.torrent │ ├── unordered.torrent │ ├── url_list.torrent │ ├── url_list2.torrent │ ├── url_list3.torrent │ ├── url_seed.torrent │ ├── url_seed_multi.torrent │ ├── url_seed_multi_single_file.torrent │ ├── url_seed_multi_space.torrent │ ├── url_seed_multi_space_nolist.torrent │ ├── v2.torrent │ ├── v2_bad_file_alignment.torrent │ ├── v2_deep_recursion.torrent │ ├── v2_empty_file.torrent │ ├── v2_empty_filename.torrent │ ├── v2_hybrid-missing-tailpad.torrent │ ├── v2_hybrid.torrent │ ├── v2_incomplete_piece_layer.torrent │ ├── v2_invalid_file.torrent │ ├── v2_invalid_filename.torrent │ ├── v2_invalid_filename2.torrent │ ├── v2_invalid_pad_file.torrent │ ├── v2_invalid_piece_layer.torrent │ ├── v2_invalid_piece_layer_root.torrent │ ├── v2_invalid_piece_layer_size.torrent │ ├── v2_invalid_root_hash.torrent │ ├── v2_large_file.torrent │ ├── v2_large_offset.torrent │ ├── v2_mismatching_metadata.torrent │ ├── v2_missing_file_root_invalid_symlink.torrent │ ├── v2_multipiece_file.torrent │ ├── v2_multiple_files.torrent │ ├── v2_no_piece_layers.torrent │ ├── v2_no_power2_piece.torrent │ ├── v2_non_multiple_piece_layer.torrent │ ├── v2_only.torrent │ ├── v2_overlong_integer.torrent │ ├── v2_piece_layer_invalid_file_hash.torrent │ ├── v2_piece_size.torrent │ ├── v2_symlinks.torrent │ ├── v2_unknown_piece_layer_entry.torrent │ ├── v2_unordered_files.torrent │ ├── v2_zero_root.torrent │ ├── v2_zero_root_small.torrent │ ├── whitespace_url.torrent │ ├── zero.torrent │ └── zero2.torrent ├── test_tracker.cpp ├── test_transfer.cpp ├── test_truncate.cpp ├── test_upnp.cpp ├── test_url_seed.cpp ├── test_utf8.cpp ├── test_utils.cpp ├── test_utils.hpp ├── test_utp.cpp ├── test_web_seed.cpp ├── test_web_seed_ban.cpp ├── test_web_seed_chunked.cpp ├── test_web_seed_http.cpp ├── test_web_seed_http_pw.cpp ├── test_web_seed_redirect.cpp ├── test_web_seed_socks4.cpp ├── test_web_seed_socks5.cpp ├── test_web_seed_socks5_no_peers.cpp ├── test_web_seed_socks5_pw.cpp ├── test_xml.cpp ├── udp_tracker.cpp ├── udp_tracker.hpp ├── utf8_test.txt ├── valgrind_suppressions.txt ├── web_seed_suite.cpp ├── web_seed_suite.hpp ├── web_server.py └── zeroes.gz └── tools ├── CMakeLists.txt ├── Jamfile ├── benchmark_checking.py ├── checking_benchmark.cpp ├── cibuildwheel ├── manylinux │ ├── build-openssl.sh │ ├── build_utils.sh │ ├── openssl-version.sh │ └── update-scripts.sh ├── setup_boost.sh ├── setup_ccache_on_manylinux.sh └── setup_openssl.sh ├── clean.py ├── copyright.py ├── dht_flood.py ├── dht_put.cpp ├── dht_sample.cpp ├── disk_io_stress_test.cpp ├── gen_convenience_header.py ├── gen_fwd.py ├── libtorrent_lldb.py ├── parse_dht_log.py ├── parse_dht_rtt.py ├── parse_dht_stats.py ├── parse_lookup_log.py ├── parse_peer_log.py ├── parse_sample.py ├── parse_session_stats.py ├── parse_utp_log.py ├── run_benchmark.py ├── run_tests.sh ├── sanitizer-blacklist.txt ├── session_log_alerts.cpp ├── set_version.py ├── test_coverage.sh ├── update_copyright.py └── vmstat.py /.cirrus.yml: -------------------------------------------------------------------------------- 1 | # since CirrusCI has limited compute resources for free open-source projects 2 | # we only use it for its unique feature, FreeBSD images 3 | 4 | freebsd_instance: 5 | image_family: freebsd-14-2 6 | 7 | task: 8 | env: 9 | CIRRUS_CLONE_DEPTH: 1 10 | CIRRUS_CLONE_SUBMODULES: true 11 | CIBW_BUILD_VERBOSITY: 3 12 | CIBW_SKIP: pp* cp38-* # cp38-* has problem with x86_64 / arm64 confusion 13 | CIBW_BUILD: cp39-* cp310-* cp311-* cp312-* 14 | install_script: | 15 | pkg install -y boost-build boost-libs openssl cmake ninja py311-pip 16 | echo "using clang ;" > ~/user-config.jam 17 | build_cmake_script: | 18 | cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_CXX_STANDARD=14 -Dbuild_tests=ON -Dbuild_examples=ON -Dbuild_tools=ON -Dpython-bindings=OFF -G Ninja . 19 | cmake --build . 20 | ./test/test_primitives 21 | tests_script: | 22 | cd test 23 | b2 -l250 warnings-as-errors=on warnings=all crypto=openssl deterministic-tests include=/usr/local/include library-path=/usr/local/lib 24 | enum_if_script: | 25 | cd test 26 | b2 -l250 warnings-as-errors=on warnings=all crypto=openssl stage_enum_if stage_dependencies include=/usr/local/include library-path=/usr/local/lib 27 | LD_LIBRARY_PATH=./dependencies ./enum_if 28 | # it appears cibuildwheel does not support FreeBSD (nor CirrusCI) 29 | # install_cibuildwheel_script: 30 | # - python -m pip install cibuildwheel==2.16.5 31 | # run_cibuildwheel_script: 32 | # - cibuildwheel 33 | # wheels_artifacts: 34 | # path: "wheelhouse/*" 35 | 36 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: arvidn 2 | custom: https://paypal.me/arvidno 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **Please provide the following information** 2 | 3 | libtorrent version (or branch): 4 | 5 | platform/architecture: 6 | 7 | compiler and compiler version: 8 | 9 | please describe what symptom you see, what you would expect to see instead and 10 | how to reproduce it. 11 | 12 | -------------------------------------------------------------------------------- /.github/SECURITY.md: -------------------------------------------------------------------------------- 1 | Report vulnerabilities to one of: 2 | 3 | * ``arvidn`` on keybase 4 | * arvid@libtorrent.org 5 | -------------------------------------------------------------------------------- /.github/codecov.yml: -------------------------------------------------------------------------------- 1 | codecov: 2 | require_ci_to_pass: yes 3 | 4 | coverage: 5 | precision: 2 6 | round: nearest 7 | range: "40...100" 8 | 9 | ignore: 10 | - test 11 | - simulation 12 | 13 | parsers: 14 | gcov: 15 | branch_detection: 16 | conditional: yes 17 | loop: yes 18 | method: no 19 | macro: no 20 | 21 | comment: 22 | layout: "diff,flags,tree" 23 | behavior: default 24 | require_changes: no 25 | after_n_builds: 2 26 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 90 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 20 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - security 9 | # Label to use when marking an issue as stale 10 | staleLabel: stale 11 | exemptMilestones: true 12 | # Comment to post when marking an issue as stale. Set to `false` to disable 13 | markComment: > 14 | This issue has been automatically marked as stale because it has not had 15 | recent activity. It will be closed if no further activity occurs. Thank you 16 | for your contributions. 17 | # Comment to post when closing a stale issue. Set to `false` to disable 18 | closeComment: false 19 | -------------------------------------------------------------------------------- /.github/workflows/cifuzz.yml: -------------------------------------------------------------------------------- 1 | name: CIFuzz 2 | on: [pull_request] 3 | jobs: 4 | Fuzzing: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - name: Build Fuzzers 8 | id: build 9 | uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master 10 | with: 11 | oss-fuzz-project-name: 'libtorrent' 12 | dry-run: false 13 | language: c++ 14 | - name: Run Fuzzers 15 | uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master 16 | with: 17 | oss-fuzz-project-name: 'libtorrent' 18 | fuzz-seconds: 300 19 | dry-run: false 20 | language: c++ 21 | - name: Upload Crash 22 | uses: actions/upload-artifact@v4 23 | if: failure() && steps.build.outcome == 'success' 24 | with: 25 | name: artifacts 26 | path: ./out/artifacts 27 | -------------------------------------------------------------------------------- /.github/workflows/codeql.yml: -------------------------------------------------------------------------------- 1 | name: "CodeQL" 2 | 3 | on: 4 | push: 5 | branches: [ "RC_2_0", "RC_1_0", "RC_1_1", "RC_1_2", "master" ] 6 | pull_request: 7 | branches: [ "RC_2_0" ] 8 | schedule: 9 | - cron: "3 12 * * 2" 10 | 11 | jobs: 12 | analyze: 13 | name: Analyze 14 | runs-on: ubuntu-latest 15 | permissions: 16 | actions: read 17 | contents: read 18 | security-events: write 19 | 20 | strategy: 21 | fail-fast: false 22 | matrix: 23 | language: [ cpp ] 24 | 25 | steps: 26 | - name: Checkout 27 | uses: actions/checkout@v4 28 | with: 29 | submodules: recursive 30 | fetch-depth: 1 31 | filter: tree:0 32 | 33 | - name: Install Packages (cpp) 34 | if: ${{ matrix.language == 'cpp' }} 35 | run: | 36 | sudo apt-get update 37 | sudo apt-get install --yes libboost-all-dev libssl-dev ninja-build 38 | 39 | - name: Initialize CodeQL 40 | uses: github/codeql-action/init@v3 41 | with: 42 | languages: ${{ matrix.language }} 43 | queries: +security-and-quality 44 | 45 | - name: Build cpp 46 | if: ${{ matrix.language == 'cpp' }} 47 | run: | 48 | cmake -Dbuild_examples=ON -Dbuild_tests=ON -Dbuild_tools=ON -GNinja . 49 | cmake --build . 50 | 51 | - name: Perform CodeQL Analysis 52 | uses: github/codeql-action/analyze@v3 53 | with: 54 | category: "/language:${{ matrix.language }}" 55 | -------------------------------------------------------------------------------- /.github/workflows/docs.yml: -------------------------------------------------------------------------------- 1 | name: Documentation 2 | 3 | on: 4 | push: 5 | branches: [ RC_1_2 RC_2_0 master ] 6 | pull_request: 7 | 8 | concurrency: 9 | group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }} 10 | cancel-in-progress: true 11 | 12 | jobs: 13 | 14 | docs: 15 | name: Docs 16 | runs-on: ubuntu-24.04 17 | 18 | steps: 19 | - name: checkout 20 | uses: actions/checkout@v4 21 | with: 22 | fetch-depth: 1 23 | filter: tree:0 24 | 25 | - name: update package lists 26 | continue-on-error: true 27 | run: | 28 | sudo apt update 29 | 30 | - name: install dependencies 31 | run: | 32 | sudo apt install python3-docutils python3-pygments python3-pil gsfonts inkscape icoutils graphviz hunspell imagemagick 33 | python3 -m pip install aafigure 34 | ~/.local/bin/aafigure --version 35 | 36 | - name: spell-check 37 | run: | 38 | cd docs 39 | make AAFIGURE=~/.local/bin/aafigure RST2HTML=rst2html spell-check html 40 | 41 | - name: build docs 42 | run: | 43 | cd docs 44 | make AAFIGURE=~/.local/bin/aafigure RST2HTML=rst2html 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | 19 | # Compiled Static libraries 20 | *.lai 21 | *.la 22 | *.a 23 | *.lib 24 | 25 | # Executables 26 | *.exe 27 | *.out 28 | *.app 29 | libtool 30 | 31 | # windows 32 | *.ilk 33 | *.pdb 34 | *.exp 35 | 36 | *.m4 37 | *.in 38 | *.pc 39 | *.libs 40 | *.deps 41 | *.cache 42 | *.dirstamp 43 | *.swp 44 | *.orig 45 | *.rej 46 | 47 | bin 48 | cmake-build-* 49 | CMakeLists.txt.user 50 | config* 51 | build-aux 52 | test_tmp_* 53 | libtool 54 | docs/reference* 55 | docs/*.html 56 | docs/*-ref.rst 57 | 58 | .DS_Store 59 | .idea 60 | *~ 61 | 62 | # Compile and link flag files 63 | bindings/python/*flags 64 | 65 | # Logs 66 | libtorrent_logs* 67 | *.log 68 | 69 | # Python related files and dirs 70 | *.pyc 71 | dist 72 | *.egg-info 73 | 74 | # python binary 75 | bindings/python/compile_cmd 76 | 77 | # binaries in the examples directory 78 | examples/bt_get 79 | examples/bt_get2 80 | examples/client_test 81 | examples/connection_tester 82 | examples/custom_storage 83 | examples/dump_torrent 84 | examples/make_torrent 85 | examples/simple_client 86 | examples/stats_counters 87 | examples/upnp_test 88 | 89 | # binaries in the tests directory 90 | tools/dht_put 91 | tools/session_log_alerts 92 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "simulation/libsimulator"] 2 | path = simulation/libsimulator 3 | url = https://github.com/arvidn/libsimulator.git 4 | [submodule "deps/try_signal"] 5 | path = deps/try_signal 6 | url = https://github.com/arvidn/try_signal.git 7 | [submodule "deps/asio-gnutls"] 8 | path = deps/asio-gnutls 9 | url = https://github.com/paullouisageneau/boost-asio-gnutls.git 10 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/AUTHORS -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2003-2020, Arvid Norberg 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the distribution. 13 | * Neither the name of Rasterbar Software nor the names of its 14 | contributors may be used to endorse or promote products derived 15 | from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | 29 | -------------------------------------------------------------------------------- /Jamroot.jam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/Jamroot.jam -------------------------------------------------------------------------------- /LibtorrentRasterbarConfig.cmake.in: -------------------------------------------------------------------------------- 1 | # - Config file for the @PROJECT_NAME@ package 2 | # It defines the LibtorrentRasterbar::torrent-rasterbar target to link against 3 | 4 | @PACKAGE_INIT@ 5 | 6 | include(CMakeFindDependencyMacro) 7 | @_find_dependency_calls@ 8 | 9 | include("${CMAKE_CURRENT_LIST_DIR}/LibtorrentRasterbarTargets.cmake") 10 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | See ChangeLog 2 | -------------------------------------------------------------------------------- /bindings/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (python-bindings) 2 | add_subdirectory(python) 3 | endif() 4 | -------------------------------------------------------------------------------- /bindings/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | SUBDIRS = python 3 | 4 | EXTRA_DIST = README.txt CMakeLists.txt 5 | -------------------------------------------------------------------------------- /bindings/README.txt: -------------------------------------------------------------------------------- 1 | Documentation covering building and using the python binding for libtorrent 2 | is located in the main doc directory. See docs/python_binding.html 3 | 4 | -------------------------------------------------------------------------------- /bindings/c/Jamfile: -------------------------------------------------------------------------------- 1 | use-project /torrent : ../.. ; 2 | 3 | rule libtorrent_linking ( properties * ) 4 | { 5 | local result ; 6 | 7 | if gcc in $(properties) && shared in $(properties) 8 | { 9 | result += on ; 10 | } 11 | 12 | # if gcc in $(properties) || darwin in $(properties) 13 | # { 14 | # result += hidden ; 15 | # } 16 | 17 | return $(result) ; 18 | } 19 | 20 | lib torrentc 21 | 22 | : # sources 23 | library.cpp 24 | 25 | : # requirements 26 | @libtorrent_linking 27 | /torrent//torrent/static 28 | . 29 | 30 | : # default build 31 | static 32 | 33 | : # usage-requirements 34 | . 35 | ; 36 | 37 | exe simple_client : simple_client.c torrentc ; 38 | 39 | -------------------------------------------------------------------------------- /bindings/python/dummy_data.py: -------------------------------------------------------------------------------- 1 | import libtorrent as lt 2 | 3 | import hashlib 4 | import random 5 | 6 | PIECE_LENGTH = 16384 7 | NAME = b"test.txt" 8 | LEN = PIECE_LENGTH * 9 + 1000 9 | # Use 7-bit data so we can test piece data as either bytes or str 10 | DATA = bytes(random.getrandbits(7) for _ in range(LEN)) 11 | PIECES = [DATA[i:i + PIECE_LENGTH] for i in range(0, LEN, PIECE_LENGTH)] 12 | 13 | INFO_DICT = { 14 | b"name": NAME, 15 | b"piece length": PIECE_LENGTH, 16 | b"length": len(DATA), 17 | b"pieces": b"".join(hashlib.sha1(p).digest() for p in PIECES), 18 | } 19 | 20 | DICT = { 21 | b"info": INFO_DICT, 22 | } 23 | 24 | 25 | def get_infohash_bytes(): 26 | return hashlib.sha1(lt.bencode(INFO_DICT)).digest() 27 | 28 | 29 | def get_infohash(): 30 | return get_infohash_bytes().hex() 31 | 32 | 33 | def get_sha1_hash(): 34 | return lt.sha1_hash(get_infohash_bytes()) 35 | -------------------------------------------------------------------------------- /bindings/python/make_torrent.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | 4 | import sys 5 | import os 6 | import libtorrent 7 | 8 | if len(sys.argv) < 3: 9 | print('usage make_torrent.py file tracker-url') 10 | sys.exit(1) 11 | 12 | input = os.path.abspath(sys.argv[1]) 13 | 14 | fs = libtorrent.file_storage() 15 | 16 | # def predicate(f): 17 | # print f 18 | # return True 19 | # libtorrent.add_files(fs, input, predicate) 20 | 21 | parent_input = os.path.split(input)[0] 22 | 23 | # if we have a single file, use it because os.walk does not work on a single files 24 | if os.path.isfile(input): 25 | size = os.path.getsize(input) 26 | fs.add_file(input, size) 27 | 28 | for root, dirs, files in os.walk(input): 29 | # skip directories starting with . 30 | if os.path.split(root)[1][0] == '.': 31 | continue 32 | 33 | for f in files: 34 | # skip files starting with . 35 | if f[0] == '.': 36 | continue 37 | 38 | # skip thumbs.db on windows 39 | if f == 'Thumbs.db': 40 | continue 41 | 42 | fname = os.path.join(root[len(parent_input) + 1:], f) 43 | size = os.path.getsize(os.path.join(parent_input, fname)) 44 | print('%10d kiB %s' % (size / 1024, fname)) 45 | fs.add_file(fname, size) 46 | 47 | if fs.num_files() == 0: 48 | print('no files added') 49 | sys.exit(1) 50 | 51 | t = libtorrent.create_torrent(fs, 0, 4 * 1024 * 1024) 52 | 53 | t.add_tracker(sys.argv[2]) 54 | t.set_creator('libtorrent %s' % libtorrent.__version__) 55 | 56 | libtorrent.set_piece_hashes(t, parent_input, lambda x: sys.stdout.write('.')) 57 | sys.stdout.write('\n') 58 | 59 | f = open('out.torrent', 'wb+') 60 | f.write(libtorrent.bencode(t.generate())) 61 | f.close() 62 | -------------------------------------------------------------------------------- /bindings/python/setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | version = 2.0.11 3 | 4 | [build_ext] 5 | cxxstd = 14 6 | -------------------------------------------------------------------------------- /bindings/python/setup.py.cmake.in: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | import platform 3 | 4 | setup( 5 | name='libtorrent', 6 | version='@libtorrent_VERSION@', 7 | author='Arvid Norberg', 8 | author_email='arvid@libtorrent.org', 9 | description='Python bindings for libtorrent-rasterbar', 10 | long_description='Python bindings for libtorrent-rasterbar', 11 | url='http://libtorrent.org', 12 | platforms=[platform.system() + '-' + platform.machine()], 13 | license='BSD', 14 | package_dir = {'': '@CMAKE_CURRENT_BINARY_DIR@'} 15 | ) 16 | -------------------------------------------------------------------------------- /bindings/python/simple_client.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright Arvid Norberg 2008. Use, modification and distribution is 3 | # subject to the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | from __future__ import print_function 6 | 7 | import libtorrent as lt 8 | import time 9 | import sys 10 | 11 | ses = lt.session({'listen_interfaces': '0.0.0.0:6881'}) 12 | 13 | info = lt.torrent_info(sys.argv[1]) 14 | h = ses.add_torrent({'ti': info, 'save_path': '.'}) 15 | s = h.status() 16 | print('starting', s.name) 17 | 18 | while (not s.is_seeding): 19 | s = h.status() 20 | 21 | print('\r%.2f%% complete (down: %.1f kB/s up: %.1f kB/s peers: %d) %s' % ( 22 | s.progress * 100, s.download_rate / 1000, s.upload_rate / 1000, 23 | s.num_peers, s.state), end=' ') 24 | 25 | alerts = ses.pop_alerts() 26 | for a in alerts: 27 | if a.category() & lt.alert.category_t.error_notification: 28 | print(a) 29 | 30 | sys.stdout.flush() 31 | 32 | time.sleep(1) 33 | 34 | print(h.status().name, 'complete') 35 | -------------------------------------------------------------------------------- /bindings/python/src/boost_python.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2006. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #ifndef BOOST_PYTHON_HPP 6 | #define BOOST_PYTHON_HPP 7 | 8 | #include 9 | #include 10 | // https://github.com/boostorg/system/issues/32#issuecomment-462912013 11 | #define HAVE_SNPRINTF 12 | #include 13 | 14 | #include 15 | 16 | // in boost 1.60, placeholders moved into a namespace, just like std 17 | #if BOOST_VERSION >= 106000 18 | using namespace boost::placeholders; 19 | #endif 20 | 21 | #include 22 | #include 23 | 24 | #include 25 | 26 | #include 27 | 28 | // something in here creates a define for this, presumably to make older 29 | // versions of msvc appear to support snprintf 30 | #ifdef snprintf 31 | #undef snprintf 32 | #endif 33 | 34 | #ifdef vsnprintf 35 | #undef vsnprintf 36 | #endif 37 | 38 | inline void python_deprecated(char const* msg) 39 | { 40 | if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1) == -1) 41 | boost::python::throw_error_already_set(); 42 | } 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /bindings/python/src/bytes.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Arvid Norberg 2006-2013. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #ifndef BYTES_HPP 6 | #define BYTES_HPP 7 | 8 | #include 9 | 10 | struct bytes 11 | { 12 | bytes(char const* s, std::size_t len): arr(s, len) {} 13 | bytes(std::string const& s): arr(s) {} 14 | bytes(std::string&& s): arr(std::move(s)) {} 15 | bytes(bytes const&) = default; 16 | bytes(bytes&&) noexcept = default; 17 | bytes& operator=(bytes&&) & noexcept = default; 18 | bytes() {} 19 | std::string arr; 20 | }; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /bindings/python/src/fingerprint.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2006. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "boost_python.hpp" 6 | #include "gil.hpp" 7 | #include 8 | 9 | void bind_fingerprint() 10 | { 11 | using namespace boost::python; 12 | using namespace lt; 13 | 14 | def("generate_fingerprint", &generate_fingerprint); 15 | 16 | #if TORRENT_ABI_VERSION == 1 17 | #include "libtorrent/aux_/disable_deprecation_warnings_push.hpp" 18 | 19 | class_("fingerprint", no_init) 20 | .def( 21 | init( 22 | (arg("id"), "major", "minor", "revision", "tag") 23 | ) 24 | ) 25 | .def("__str__", depr(&fingerprint::to_string)) 26 | .def_readonly("major_version", depr(&fingerprint::major_version)) 27 | .def_readonly("minor_version", depr(&fingerprint::minor_version)) 28 | .def_readonly("revision_version", depr(&fingerprint::revision_version)) 29 | .def_readonly("tag_version", depr(&fingerprint::tag_version)) 30 | ; 31 | 32 | #include "libtorrent/aux_/disable_warnings_pop.hpp" 33 | #endif // TORRENT_ABI_VERSION 34 | } 35 | -------------------------------------------------------------------------------- /bindings/python/src/info_hash.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Arvid Norberg 2020. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "boost_python.hpp" 6 | #include 7 | 8 | namespace { 9 | 10 | using namespace lt; 11 | 12 | long get_hash(info_hash_t const& ih) 13 | { 14 | return std::hash{}(ih); 15 | } 16 | 17 | } 18 | 19 | void bind_info_hash() 20 | { 21 | using namespace boost::python; 22 | using namespace lt; 23 | 24 | class_("info_hash_t") 25 | .def(init(arg("sha1_hash"))) 26 | .def(init(arg("sha256_hash"))) 27 | .def(init((arg("sha1_hash"), arg("sha256_hash")))) 28 | .def("__hash__", get_hash) 29 | .def("has_v1", &info_hash_t::has_v1) 30 | .def("has_v2", &info_hash_t::has_v2) 31 | .def("has", &info_hash_t::has) 32 | .def("get", &info_hash_t::get) 33 | .def("get_best", &info_hash_t::get_best) 34 | .add_property("v1", &info_hash_t::v1) 35 | .add_property("v2", &info_hash_t::v2) 36 | .def(self == self) 37 | .def(self != self) 38 | .def(self < self) 39 | ; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /bindings/python/src/ip_filter.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Andrew Resch 2008. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "boost_python.hpp" 6 | #include 7 | #include "gil.hpp" 8 | 9 | using namespace boost::python; 10 | using namespace lt; 11 | 12 | namespace 13 | { 14 | void add_rule(ip_filter& filter, std::string start, std::string end, int flags) 15 | { 16 | return filter.add_rule(make_address(start), make_address(end), flags); 17 | } 18 | 19 | int access0(ip_filter& filter, std::string addr) 20 | { 21 | return filter.access(make_address(addr)); 22 | } 23 | 24 | template 25 | list convert_range_list(std::vector> const& l) 26 | { 27 | list ret; 28 | for (auto const& r : l) 29 | ret.append(boost::python::make_tuple(r.first.to_string(), r.last.to_string())); 30 | return ret; 31 | } 32 | 33 | tuple export_filter(ip_filter const& f) 34 | { 35 | auto ret = f.export_filter(); 36 | list ipv4 = convert_range_list(std::get<0>(ret)); 37 | list ipv6 = convert_range_list(std::get<1>(ret)); 38 | return boost::python::make_tuple(ipv4, ipv6); 39 | } 40 | } 41 | 42 | void bind_ip_filter() 43 | { 44 | class_("ip_filter") 45 | .def("add_rule", &add_rule) 46 | .def("access", &access0) 47 | .def("export_filter", &export_filter) 48 | ; 49 | } 50 | -------------------------------------------------------------------------------- /bindings/python/src/load_torrent.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2006. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | // vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 6 | 7 | #include "boost_python.hpp" 8 | #include "bytes.hpp" 9 | #include "libtorrent/load_torrent.hpp" 10 | #include "libtorrent/torrent_info.hpp" // for load_torrent_limits 11 | #include "libtorrent/add_torrent_params.hpp" 12 | #include "libtorrent/bdecode.hpp" 13 | 14 | using namespace boost::python; 15 | 16 | // defined in torrent_info.cpp 17 | lt::load_torrent_limits dict_to_limits(dict limits); 18 | 19 | namespace { 20 | 21 | lt::add_torrent_params load_torrent_file1(std::string filename, dict cfg) 22 | { 23 | return lt::load_torrent_file(filename, dict_to_limits(cfg)); 24 | } 25 | 26 | lt::add_torrent_params load_torrent_buffer0(bytes b) 27 | { 28 | return lt::load_torrent_buffer(b.arr); 29 | } 30 | 31 | lt::add_torrent_params load_torrent_buffer1(bytes b, dict cfg) 32 | { 33 | return lt::load_torrent_buffer(b.arr, dict_to_limits(cfg)); 34 | } 35 | 36 | 37 | lt::add_torrent_params load_torrent_parsed1(lt::bdecode_node const& n, dict cfg) 38 | { 39 | return lt::load_torrent_parsed(n, dict_to_limits(cfg)); 40 | } 41 | 42 | } 43 | 44 | void bind_load_torrent() 45 | { 46 | lt::add_torrent_params (*load_torrent_file0)(std::string const&) = <::load_torrent_file; 47 | lt::add_torrent_params (*load_torrent_parsed0)(lt::bdecode_node const&) = <::load_torrent_parsed; 48 | 49 | def("load_torrent_file", load_torrent_file0); 50 | def("load_torrent_file", load_torrent_file1); 51 | def("load_torrent_buffer", load_torrent_buffer0); 52 | def("load_torrent_buffer", load_torrent_buffer1); 53 | def("load_torrent_parsed", load_torrent_parsed0); 54 | def("load_torrent_parsed", load_torrent_parsed1); 55 | } 56 | -------------------------------------------------------------------------------- /bindings/python/src/module.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2006. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #ifdef __GNUC__ 6 | #define BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY 1 7 | #endif 8 | 9 | #include 10 | #include "libtorrent/config.hpp" 11 | 12 | void bind_utility(); 13 | void bind_fingerprint(); 14 | void bind_sha1_hash(); 15 | void bind_sha256_hash(); 16 | void bind_info_hash(); 17 | void bind_session(); 18 | void bind_entry(); 19 | void bind_torrent_info(); 20 | void bind_unicode_string_conversion(); 21 | void bind_torrent_handle(); 22 | void bind_torrent_status(); 23 | void bind_session_settings(); 24 | void bind_version(); 25 | void bind_alert(); 26 | void bind_datetime(); 27 | void bind_peer_info(); 28 | void bind_ip_filter(); 29 | void bind_magnet_uri(); 30 | void bind_converters(); 31 | void bind_create_torrent(); 32 | void bind_error_code(); 33 | void bind_load_torrent(); 34 | 35 | BOOST_PYTHON_MODULE(libtorrent) 36 | { 37 | Py_Initialize(); 38 | 39 | bind_converters(); 40 | bind_unicode_string_conversion(); 41 | bind_error_code(); 42 | bind_utility(); 43 | bind_fingerprint(); 44 | bind_sha1_hash(); 45 | bind_sha256_hash(); 46 | bind_info_hash(); 47 | bind_entry(); 48 | bind_torrent_handle(); 49 | bind_session(); 50 | bind_torrent_info(); 51 | bind_torrent_status(); 52 | bind_session_settings(); 53 | bind_version(); 54 | bind_alert(); 55 | bind_datetime(); 56 | bind_peer_info(); 57 | bind_ip_filter(); 58 | bind_magnet_uri(); 59 | bind_create_torrent(); 60 | bind_load_torrent(); 61 | } 62 | -------------------------------------------------------------------------------- /bindings/python/src/optional.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2007. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #ifndef OPTIONAL_070108_HPP 6 | # define OPTIONAL_070108_HPP 7 | 8 | # include "boost_python.hpp" 9 | # include 10 | 11 | template 12 | struct optional_to_python 13 | { 14 | optional_to_python() 15 | { 16 | boost::python::to_python_converter< 17 | boost::optional, optional_to_python 18 | >(); 19 | } 20 | 21 | static PyObject* convert(boost::optional const& x) 22 | { 23 | if (!x) 24 | return boost::python::incref(Py_None); 25 | 26 | return boost::python::incref(boost::python::object(*x).ptr()); 27 | } 28 | }; 29 | 30 | #endif // OPTIONAL_070108_HPP 31 | 32 | -------------------------------------------------------------------------------- /bindings/python/src/sha1_hash.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2006. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "boost_python.hpp" 6 | #include 7 | #include 8 | 9 | #include "bytes.hpp" 10 | 11 | namespace { 12 | 13 | using namespace lt; 14 | 15 | long get_hash(sha1_hash const& s) 16 | { 17 | return std::hash{}(s); 18 | } 19 | 20 | bytes sha1_hash_bytes(const sha1_hash& bn) { 21 | return bytes(bn.to_string()); 22 | } 23 | 24 | } 25 | 26 | void bind_sha1_hash() 27 | { 28 | using namespace boost::python; 29 | using namespace lt; 30 | 31 | class_("sha1_hash") 32 | .def(self == self) 33 | .def(self != self) 34 | .def(self < self) 35 | .def(self_ns::str(self)) 36 | .def(init()) 37 | .def("clear", &sha1_hash::clear) 38 | .def("is_all_zeros", &sha1_hash::is_all_zeros) 39 | .def("to_string", sha1_hash_bytes) 40 | .def("__hash__", get_hash) 41 | .def("to_bytes", sha1_hash_bytes) 42 | ; 43 | 44 | scope().attr("peer_id") = scope().attr("sha1_hash"); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /bindings/python/src/sha256_hash.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2006. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "boost_python.hpp" 6 | #include 7 | #include 8 | 9 | #include "bytes.hpp" 10 | 11 | namespace { 12 | 13 | using namespace lt; 14 | 15 | long get_hash(sha256_hash const& s) 16 | { 17 | return std::hash{}(s); 18 | } 19 | 20 | bytes sha256_hash_bytes(const sha256_hash& bn) { 21 | return bytes(bn.to_string()); 22 | } 23 | 24 | } 25 | 26 | void bind_sha256_hash() 27 | { 28 | using namespace boost::python; 29 | using namespace lt; 30 | 31 | class_("sha256_hash") 32 | .def(self == self) 33 | .def(self != self) 34 | .def(self < self) 35 | .def(self_ns::str(self)) 36 | .def(init()) 37 | .def("clear", &sha256_hash::clear) 38 | .def("is_all_zeros", &sha256_hash::is_all_zeros) 39 | .def("to_string", sha256_hash_bytes) 40 | .def("__hash__", get_hash) 41 | .def("to_bytes", sha256_hash_bytes) 42 | ; 43 | } 44 | 45 | -------------------------------------------------------------------------------- /bindings/python/src/string.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2006. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "boost_python.hpp" 6 | #include 7 | 8 | using namespace boost::python; 9 | 10 | struct unicode_from_python 11 | { 12 | unicode_from_python() 13 | { 14 | converter::registry::push_back( 15 | &convertible, &construct, type_id() 16 | ); 17 | } 18 | 19 | static void* convertible(PyObject* x) 20 | { 21 | #if PY_VERSION_HEX >= 0x03020000 22 | return PyUnicode_Check(x) ? x : nullptr; 23 | #else 24 | return PyString_Check(x) ? x : PyUnicode_Check(x) ? x : nullptr; 25 | #endif 26 | } 27 | 28 | static void construct(PyObject* x, converter::rvalue_from_python_stage1_data* data) 29 | { 30 | void* storage = ((converter::rvalue_from_python_storage< 31 | std::string>*)data)->storage.bytes; 32 | 33 | #if PY_VERSION_HEX < 0x03000000 34 | if (PyString_Check(x)) 35 | { 36 | data->convertible = new (storage) std::string(PyString_AsString(x) 37 | , PyString_Size(x)); 38 | } 39 | else 40 | #endif 41 | { 42 | Py_ssize_t size = 0; 43 | char const* unicode = PyUnicode_AsUTF8AndSize(x, &size); 44 | data->convertible = new (storage) std::string(unicode, size); 45 | } 46 | } 47 | }; 48 | 49 | void bind_unicode_string_conversion() 50 | { 51 | unicode_from_python(); 52 | } 53 | 54 | -------------------------------------------------------------------------------- /bindings/python/src/version.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2006. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include "boost_python.hpp" 6 | #include 7 | 8 | using namespace boost::python; 9 | using lt::version; 10 | 11 | void bind_version() 12 | { 13 | scope().attr("__version__") = version(); 14 | 15 | #if TORRENT_ABI_VERSION == 1 16 | scope().attr("version") = lt::version_str; 17 | scope().attr("version_major") = LIBTORRENT_VERSION_MAJOR; 18 | scope().attr("version_minor") = LIBTORRENT_VERSION_MINOR; 19 | #endif 20 | } 21 | 22 | -------------------------------------------------------------------------------- /cmake/Modules/GeneratePkgConfig/pkg-config.cmake.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | libdir=${prefix}/@_INSTALL_LIBDIR@ 3 | 4 | Name: @_PROJECT_NAME@ 5 | Description: @_PROJECT_DESCRIPTION@ 6 | Version: @_PROJECT_VERSION@ 7 | Libs: -L${libdir} -l@_TARGET_OUTPUT_NAME@ @_interface_link_libraries@ 8 | Cflags: @_interface_compile_options@ @_interface_include_dirs@ @_interface_definitions@ 9 | -------------------------------------------------------------------------------- /cmake/Modules/GeneratePkgConfig/target-compile-settings.cmake.in: -------------------------------------------------------------------------------- 1 | set(_TARGET_INTERFACE_LINK_LIBRARIES "@_interface_link_libraries@") 2 | set(_TARGET_INTERFACE_COMPILE_OPTIONS "@_interface_compile_options@") 3 | set(_TARGET_INTERFACE_INCLUDE_DIRS "@_interface_include_dirs@") 4 | set(_TARGET_INTERFACE_DEFINITIONS "@_interface_definitions@") 5 | set(_TARGET_OUTPUT_NAME "@_output_name@") 6 | 7 | set(_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@") 8 | set(_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@") 9 | set(_SHARED_LIBRARY_PREFIX "@CMAKE_SHARED_LIBRARY_PREFIX@") 10 | 11 | set(_PROJECT_NAME "@PROJECT_NAME@") 12 | set(_PROJECT_DESCRIPTION "@PROJECT_DESCRIPTION@") 13 | set(_PROJECT_VERSION "@PROJECT_VERSION@") 14 | -------------------------------------------------------------------------------- /docs/2020 Q4 Mozilla Libtorrent Report Public Report.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/docs/2020 Q4 Mozilla Libtorrent Report Public Report.pdf -------------------------------------------------------------------------------- /docs/build_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -x 4 | 5 | # echo pull version from version header 6 | VERSION=$(grep "#define LIBTORRENT_VERSION " ../include/libtorrent/version.hpp | awk '{ print $3 }') 7 | # strip quotes 8 | VERSION=${VERSION%\"} 9 | VERSION=${VERSION#\"} 10 | mkdir -p version/${VERSION} 11 | TARGET=version/${VERSION} 12 | 13 | make stage WEB_PATH=${TARGET} 14 | 15 | -------------------------------------------------------------------------------- /docs/examples.rst: -------------------------------------------------------------------------------- 1 | .. include:: header.rst 2 | 3 | .. contents:: Table of contents 4 | :depth: 2 5 | :backlinks: none 6 | 7 | examples 8 | ======== 9 | 10 | Except for the example programs in this manual, there's also a bigger example 11 | of a (little bit) more complete client, ``client_test``. There are separate 12 | instructions for how to use it here__ if you'd like to try it. 13 | 14 | __ client_test.html 15 | 16 | simple client 17 | ------------- 18 | 19 | This is a simple client. It doesn't have much output to keep it simple: 20 | 21 | .. include:: ../examples/simple_client.cpp 22 | :code: c++ 23 | :tab-width: 2 24 | :start-after: */ 25 | 26 | make_torrent 27 | ------------ 28 | 29 | Shows how to create a torrent from a directory tree: 30 | 31 | .. include:: ../examples/make_torrent.cpp 32 | :code: c++ 33 | :tab-width: 2 34 | :start-after: */ 35 | 36 | dump_torrent 37 | ------------ 38 | 39 | This is an example of a program that will take a torrent-file as a parameter and 40 | print information about it to std out: 41 | 42 | .. include:: ../examples/dump_torrent.cpp 43 | :code: c++ 44 | :tab-width: 2 45 | :start-after: */ 46 | 47 | -------------------------------------------------------------------------------- /docs/filter-rst.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 3 | from __future__ import print_function 4 | 5 | import sys 6 | 7 | 8 | def indent(line): 9 | if line == '': 10 | return None 11 | end = 0 12 | for c in line: 13 | end += 1 14 | if " \t" not in c: 15 | return line[:end] 16 | return line 17 | 18 | 19 | start_block = False 20 | filter_indent = None 21 | 22 | for line in open(sys.argv[1]): 23 | 24 | if line == '\n': 25 | continue 26 | 27 | if filter_indent: 28 | if line.startswith(filter_indent): 29 | continue 30 | else: 31 | filter_indent = None 32 | 33 | if line.strip().startswith('.. '): 34 | start_block = True 35 | continue 36 | 37 | if line.endswith('::\n'): 38 | start_block = True 39 | continue 40 | 41 | if start_block: 42 | filter_indent = indent(line) 43 | start_block = False 44 | continue 45 | 46 | sys.stdout.write(line) 47 | -------------------------------------------------------------------------------- /docs/header.rst: -------------------------------------------------------------------------------- 1 | :Version: 2.0.11 2 | -------------------------------------------------------------------------------- /docs/hunspell/en_US.aff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/docs/hunspell/en_US.aff -------------------------------------------------------------------------------- /docs/hunspell/en_US.dic: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/docs/hunspell/en_US.dic -------------------------------------------------------------------------------- /docs/img/bitcoin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/docs/img/bitcoin.png -------------------------------------------------------------------------------- /docs/img/complete_bit_prefixes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/docs/img/complete_bit_prefixes.png -------------------------------------------------------------------------------- /docs/img/cwnd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/docs/img/cwnd.png -------------------------------------------------------------------------------- /docs/img/delays.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/docs/img/delays.png -------------------------------------------------------------------------------- /docs/img/hash_distribution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/docs/img/hash_distribution.png -------------------------------------------------------------------------------- /docs/img/ip_id_v4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/docs/img/ip_id_v4.png -------------------------------------------------------------------------------- /docs/img/ip_id_v6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/docs/img/ip_id_v6.png -------------------------------------------------------------------------------- /docs/img/logo-color-text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/docs/img/logo-color-text.png -------------------------------------------------------------------------------- /docs/img/our_delay_base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/docs/img/our_delay_base.png -------------------------------------------------------------------------------- /docs/img/pp-acceptance-medium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/docs/img/pp-acceptance-medium.png -------------------------------------------------------------------------------- /docs/img/read_disk_buffers.diagram: -------------------------------------------------------------------------------- 1 | 2 | "copy into peer's" "encrypt in place" 3 | +------------------+ "send buffer" +---------------+ "(no copy)" +---------------+ 4 | | "receive buffer" +----------------->| "send buffer" +------------------>| "encrypted" | 5 | | | | | | "send buffer" | 6 | +------------------+ +---------------+ +---------------+ 7 | ^ | 8 | | "read() from file" "write() to socket" | 9 | | "(copy)" "user space" "(copy)" | 10 | - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - 11 | | "kernel space" | 12 | | v 13 | +-------+-------------+ +-----------------+ 14 | | "kernel page cache" | | "socket kernel" | 15 | | | | "buffer" | 16 | +---------------------+ +-----------------+ 17 | -------------------------------------------------------------------------------- /docs/img/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/docs/img/screenshot.png -------------------------------------------------------------------------------- /docs/img/storage.diagram: -------------------------------------------------------------------------------- 1 | +------------------------+ 2 | | "disk_interface" | 3 | | | +-----------------+ 4 | | "customization point" |<--->| "counters" | 5 | | "for disk I/O for" | | "to keep stats" | 6 | | "whole session" | +-----------------+ 7 | | |<-- "async_read()" 8 | | |<-- "async_write()" 9 | | |<-- "async_hash()" 10 | | |<-- "async_hash2()" 11 | | |<-- "async_move_storage()" 12 | | |<-- "async_check_files()" 13 | | |<-- "async_stop_torrent()" 14 | | |<-- "remove_torrent()" 15 | | |<-- "async_rename_file()" 16 | | |<-- "async_set_file_priority()" 17 | | |<-- "async_delete_files()" 18 | | |<-- "async_clear_piece()" 19 | +------------------------+ 20 | ^ 21 | | 22 | | "new_torrent()" 23 | | "save-path, file_storage," 24 | | "info_hash, allocation_mode" 25 | | "file-priorities" 26 | | "returns storage_holder" 27 | | 28 | v 29 | +----------------------------+ 30 | | "storage_holder" |+ 31 | | "opaque handle to storage" || +-------------------+ 32 | | "for a torrent" |<---+ "file_storage" | 33 | +----------------------------+| | "standard piece" | 34 | +----------------------------+ | "to file mapping" | 35 | +-------------------+ 36 | -------------------------------------------------------------------------------- /docs/img/utp_stack.diagram: -------------------------------------------------------------------------------- 1 | +------------------------+ 2 | | "BitTorrent protocol" | 3 | +------------------------+ 4 | | "SSL" | 5 | +------------+-----------+ 6 | | "TCP" | "uTP" | 7 | | +-----------+ 8 | | | "UDP" | 9 | +------------+-----------+ 10 | -------------------------------------------------------------------------------- /docs/img/write_disk_buffers.diagram: -------------------------------------------------------------------------------- 1 | 2 | "decrypt in place" "move buffer ref." 3 | +------------------+ "(no copy)" +--------------+ "(no copy)" +----------------+ 4 | | "receive buffer" +--=------------>| "plain text" +--=------------->| "store buffer" | 5 | +------------------+ | "buffer" | +------+---------+ 6 | ^ +--------------+ | 7 | | "read() on socket" "write() to file" | 8 | | "(copy)" "(copy)" | 9 | ---=----|---------------------------------=---------------------------------|--=---- 10 | | "kernel space" memcpy() into | 11 | | mmap v 12 | +-------+---------+ +---------------------+ 13 | | "socket kernel" | | "kernel page cache" | 14 | | "buffer" | | | 15 | +-----------------+ +---------------------+ 16 | -------------------------------------------------------------------------------- /docs/template.txt: -------------------------------------------------------------------------------- 1 | 2 | %(head_prefix)s 3 | %(head)s 4 | 5 | 6 | 7 | 8 | %(stylesheet)s 9 | %(body_prefix)s 10 |
11 | 12 | libtorrent logo 13 | 14 |
15 | %(body_pre_docinfo)s 16 | %(docinfo)s 17 | %(body)s 18 | 19 |
20 |
21 |
22 | 41 | 42 | %(body_suffix)s 43 | -------------------------------------------------------------------------------- /docs/template2.txt: -------------------------------------------------------------------------------- 1 | 2 | %(head_prefix)s 3 | %(head)s 4 | 5 | 6 | 7 | 8 | %(stylesheet)s 9 | %(body_prefix)s 10 |
11 | 14 |
15 | %(body_pre_docinfo)s 16 | %(docinfo)s 17 |
18 | 19 |
20 | %(body)s 21 | 22 |
23 |
24 |
25 | 44 | 45 | %(body_suffix)s 46 | -------------------------------------------------------------------------------- /docs/troubleshooting.rst: -------------------------------------------------------------------------------- 1 | ================= 2 | libtorrent manual 3 | ================= 4 | 5 | .. include:: header.rst 6 | 7 | .. contents:: Table of contents 8 | :depth: 2 9 | :backlinks: none 10 | 11 | The following troubleshooting chart may help in finding out why torrents fail 12 | to download. It is not complete, please submit suggestions via pull requests at 13 | https://github.com/arvidn/libtorrent or to the `mailing list`_. Ideally in the 14 | form of patches against ``docs/troubleshooting.dot``. 15 | 16 | .. _`mailing list`: https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss 17 | 18 | .. image:: img/troubleshooting_thumb.png 19 | :target: img/troubleshooting.png 20 | 21 | -------------------------------------------------------------------------------- /docs/troubleshooting_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/docs/troubleshooting_thumb.png -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(libtorrent-examples) 2 | 3 | set(single_file_examples 4 | simple_client 5 | custom_storage 6 | stats_counters 7 | dump_torrent 8 | dump_bdecode 9 | make_torrent 10 | connection_tester 11 | upnp_test) 12 | 13 | if(CMAKE_CXX_COMPILER_ID MATCHES Clang) 14 | add_compile_options(-Wno-implicit-int-float-conversion) 15 | endif() 16 | 17 | foreach(example ${single_file_examples}) 18 | add_executable(${example} "${example}.cpp") 19 | target_link_libraries(${example} PRIVATE torrent-rasterbar) 20 | endforeach(example) 21 | 22 | add_executable(client_test 23 | client_test.cpp 24 | print.cpp 25 | torrent_view.cpp 26 | session_view.cpp) 27 | target_link_libraries(client_test PRIVATE torrent-rasterbar) 28 | -------------------------------------------------------------------------------- /examples/Makefile.am: -------------------------------------------------------------------------------- 1 | example_programs = \ 2 | client_test \ 3 | stats_counters \ 4 | dump_torrent \ 5 | make_torrent \ 6 | simple_client \ 7 | custom_storage \ 8 | upnp_test \ 9 | bt_get \ 10 | bt_get2 \ 11 | connection_tester 12 | 13 | if ENABLE_EXAMPLES 14 | bin_PROGRAMS = $(example_programs) 15 | endif 16 | 17 | EXTRA_PROGRAMS = $(example_programs) 18 | EXTRA_DIST = Jamfile CMakeLists.txt session_view.hpp torrent_view.hpp print.hpp cmake/FindLibtorrentRasterbar.cmake 19 | 20 | client_test_SOURCES = client_test.cpp print.cpp session_view.cpp torrent_view.cpp 21 | stats_counters_SOURCES = stats_counters.cpp 22 | bt_get_SOURCES = bt-get.cpp 23 | bt_get2_SOURCES = bt-get2.cpp 24 | dump_torrent_SOURCES = dump_torrent.cpp 25 | make_torrent_SOURCES = make_torrent.cpp 26 | simple_client_SOURCES = simple_client.cpp 27 | custom_storage_SOURCES = custom_storage.cpp 28 | connection_tester_SOURCES = connection_tester.cpp 29 | upnp_test_SOURCES = upnp_test.cpp 30 | 31 | LDADD = $(top_builddir)/src/libtorrent-rasterbar.la 32 | 33 | AM_CPPFLAGS = -ftemplate-depth-50 @DEBUGFLAGS@ 34 | AM_LDFLAGS = @BOOST_SYSTEM_LIB@ @OPENSSL_LDFLAGS@ @OPENSSL_LIBS@ 35 | DEFAULT_INCLUDES = -I$(top_srcdir)/include @OPENSSL_INCLUDES@ 36 | -------------------------------------------------------------------------------- /examples/print.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PRINT_HPP_ 2 | #define PRINT_HPP_ 3 | 4 | #include 5 | #include // for snprintf 6 | #include // for PRId64 et.al. 7 | #include "libtorrent/bitfield.hpp" 8 | #include "libtorrent/span.hpp" 9 | 10 | enum color_code 11 | { 12 | col_none = -1, 13 | col_black = 0, 14 | col_red = 1, 15 | col_green = 2, 16 | col_yellow = 3, 17 | col_blue = 4, 18 | col_magenta = 5, 19 | col_cyan = 6, 20 | col_white = 7 21 | }; 22 | 23 | char const* esc(char const* code); 24 | 25 | std::string to_string(int v, int width); 26 | 27 | std::string add_suffix_float(double val, char const* suffix); 28 | 29 | template std::string add_suffix(T val, char const* suffix = nullptr) { 30 | return add_suffix_float(double(val), suffix); 31 | } 32 | 33 | std::string color(std::string const& s, color_code c); 34 | 35 | enum { progress_invert = 1}; 36 | 37 | std::string const& progress_bar(int progress, int width, color_code c = col_green 38 | , char fill = '#', char bg = '-', std::string caption = "", int flags = 0); 39 | 40 | std::string const& piece_bar(lt::bitfield const& p, int width); 41 | 42 | std::string avail_bar(lt::span avail, int const width, int& pos); 43 | 44 | void set_cursor_pos(int x, int y); 45 | 46 | void clear_screen(); 47 | 48 | void clear_rows(int y1, int y2); 49 | 50 | std::pair terminal_size(); 51 | std::string piece_matrix(lt::bitfield const& p, int width, int* height); 52 | 53 | void print(char const* str); 54 | 55 | #endif // PRINT_HPP_ 56 | 57 | -------------------------------------------------------------------------------- /fuzzers/LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2017, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /fuzzers/README.rst: -------------------------------------------------------------------------------- 1 | libtorrent fuzzing 2 | ================== 3 | 4 | Fuzzing of various libtorrent APIs (both internal and external), 5 | inspired by Kostya Serebryany's `cppcon 2017 presentation`_ 6 | 7 | This project requires: 8 | 9 | .. _`cppcon 2017 presentation`: https://www.youtube.com/watch?v=k-Cv8Q3zWNQ&index=36&list=PLHTh1InhhwT6bwIpRk0ZbCA0N2p1taxd6 10 | 11 | clang 12 | ..... 13 | 14 | A very recent version of clang that supports libFuzzer. 15 | clang-5.0 may not be recent enough, you may have to build head from source. 16 | 17 | boost-build 18 | ........... 19 | 20 | Also known as ``b2``. To configure boost build with your fresh clang build, 21 | create a ``~/user-config.jam`` with something like this in it (example for macOS):: 22 | 23 | using darwin : 6.0 : ~/Documents/dev/clang/build/bin/clang++ ; 24 | 25 | Or on Linux:: 26 | 27 | using clang ; 28 | 29 | corpus 30 | ...... 31 | 32 | The corpus is the set of inputs that has been built by libFuzzer. It's the seed 33 | for testing more mutations. The corpus is not checked into the repository, 34 | before running the fuzzer it is advised to download and unzip the corpus 35 | associated with the latest release on github. 36 | 37 | https://github.com/arvidn/libtorrent/releases/download/libtorrent_1_2_0/corpus.zip 38 | 39 | Uzip the corpus in the fuzzers directory:: 40 | 41 | unzip corpus.zip 42 | 43 | building 44 | ........ 45 | 46 | To build the fuzzers:: 47 | 48 | b2 clang stage 49 | 50 | The fuzzers binaries are placed in a directory called `fuzzers`. 51 | 52 | running 53 | ....... 54 | 55 | To run the fuzzers, there's a convenience `run.sh` script that launches all 56 | fuzzers in parallel. By default, each fuzzer runs for 48 hours. This can be 57 | adjusted in the `run.sh` script. 58 | 59 | contribute 60 | .......... 61 | 62 | Please consider contributing back any updated corpuses (amended by more seed 63 | inputs) or fuzzers for more APIs in libtorrent. 64 | 65 | -------------------------------------------------------------------------------- /fuzzers/minimize.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | function minimize 5 | { 6 | mkdir corpus/${1} 7 | ./fuzzers/${1} -artifact_prefix=./${1}- -merge=1 corpus/${1} prev-corpus/${1} 8 | } 9 | 10 | mv corpus prev-corpus 11 | mkdir corpus 12 | 13 | for file in fuzzers/*; do 14 | minimize $(basename $file) & 15 | done 16 | 17 | wait 18 | 19 | -------------------------------------------------------------------------------- /fuzzers/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function run 4 | { 5 | # run for 48 hours 6 | nice ./fuzzers/${1} -max_total_time=172800 -timeout=10 -artifact_prefix=./${1}- corpus/${1} 7 | } 8 | 9 | for file in fuzzers/*; do 10 | run $(basename $file) & 11 | done 12 | 13 | wait 14 | -------------------------------------------------------------------------------- /fuzzers/src/base32decode.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2019, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/aux_/escape_string.hpp" 34 | 35 | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) 36 | { 37 | lt::base32decode({reinterpret_cast(data), size}); 38 | return 0; 39 | } 40 | 41 | -------------------------------------------------------------------------------- /fuzzers/src/base32encode.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2019, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/aux_/escape_string.hpp" 34 | 35 | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) 36 | { 37 | lt::base32encode_i2p({reinterpret_cast(data), static_cast(size)}); 38 | return 0; 39 | } 40 | 41 | -------------------------------------------------------------------------------- /fuzzers/src/base64encode.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2019, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/aux_/escape_string.hpp" 34 | 35 | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) 36 | { 37 | lt::base64encode({reinterpret_cast(data), size}); 38 | return 0; 39 | } 40 | 41 | -------------------------------------------------------------------------------- /fuzzers/src/bdecode_node.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2019, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/bdecode.hpp" 34 | 35 | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) 36 | { 37 | lt::error_code ec; 38 | lt::bdecode({reinterpret_cast(data), int(size)}, ec); 39 | return 0; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /fuzzers/src/convert_from_native.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2019, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/aux_/escape_string.hpp" 34 | 35 | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) 36 | { 37 | lt::convert_from_native({reinterpret_cast(data), size}); 38 | return 0; 39 | } 40 | 41 | -------------------------------------------------------------------------------- /fuzzers/src/convert_to_native.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2019, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/aux_/escape_string.hpp" 34 | 35 | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) 36 | { 37 | lt::convert_to_native({reinterpret_cast(data), size}); 38 | return 0; 39 | } 40 | 41 | -------------------------------------------------------------------------------- /fuzzers/src/escape_path.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2019, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/aux_/escape_string.hpp" 34 | 35 | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) 36 | { 37 | lt::escape_path({reinterpret_cast(data), size}); 38 | return 0; 39 | } 40 | 41 | -------------------------------------------------------------------------------- /fuzzers/src/escape_string.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2019, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/aux_/escape_string.hpp" 34 | 35 | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) 36 | { 37 | lt::escape_string({reinterpret_cast(data), size}); 38 | return 0; 39 | } 40 | 41 | -------------------------------------------------------------------------------- /fuzzers/src/file_storage_add_file.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2019-2020, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/file_storage.hpp" 34 | 35 | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) 36 | { 37 | lt::file_storage fs; 38 | // we expect this call to fail sometimes 39 | try { 40 | fs.add_file({reinterpret_cast(data), size}, 1); 41 | } 42 | catch (...) {} 43 | return 0; 44 | } 45 | 46 | -------------------------------------------------------------------------------- /fuzzers/src/gzip.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2019, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/gzip.hpp" 34 | 35 | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) 36 | { 37 | lt::error_code ec; 38 | std::vector out; 39 | lt::inflate_gzip({reinterpret_cast(data), int(size)}, out 40 | , 100000, ec); 41 | return 0; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /fuzzers/src/idna.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2020, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/parse_url.hpp" 34 | #include "libtorrent/string_view.hpp" 35 | 36 | #include 37 | 38 | extern "C" int LLVMFuzzerTestOneInput(std::uint8_t const* data, size_t size) 39 | { 40 | lt::is_idna(lt::string_view(reinterpret_cast(data), size)); 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /fuzzers/src/parse_int.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2019-2020, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | #include "libtorrent/bdecode.hpp" 33 | 34 | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) 35 | { 36 | lt::bdecode_errors::error_code_enum ec; 37 | std::int64_t val = 0; 38 | lt::parse_int(reinterpret_cast(data), reinterpret_cast(data) + size, ':', val, ec); 39 | return 0; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /fuzzers/src/parse_magnet_uri.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2019, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/magnet_uri.hpp" 34 | #include "libtorrent/add_torrent_params.hpp" 35 | 36 | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) 37 | { 38 | lt::error_code ec; 39 | lt::add_torrent_params params; 40 | lt::parse_magnet_uri({reinterpret_cast(data), size} 41 | , params, ec); 42 | return 0; 43 | } 44 | 45 | 46 | -------------------------------------------------------------------------------- /fuzzers/src/parse_url.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2020, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/parse_url.hpp" 34 | 35 | #include 36 | #include 37 | 38 | extern "C" int LLVMFuzzerTestOneInput(std::uint8_t const* data, size_t size) 39 | { 40 | lt::error_code ec; 41 | lt::parse_url_components(std::string(reinterpret_cast(data), size), ec); 42 | return 0; 43 | } 44 | -------------------------------------------------------------------------------- /fuzzers/src/sanitize_path.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2019, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/torrent_info.hpp" 34 | 35 | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) 36 | { 37 | std::string out; 38 | lt::aux::sanitize_append_path_element(out, {reinterpret_cast(data), size}); 39 | return 0; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /fuzzers/src/session_params.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2019, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include 34 | #include "libtorrent/session_params.hpp" 35 | 36 | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) 37 | { 38 | try { 39 | auto ret = lt::read_session_params({reinterpret_cast(data), int(size)}); 40 | } catch (...) {} 41 | return 0; 42 | } 43 | 44 | 45 | -------------------------------------------------------------------------------- /fuzzers/src/torrent_info.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2019, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/torrent_info.hpp" 34 | 35 | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) 36 | { 37 | lt::error_code ec; 38 | lt::torrent_info ti({reinterpret_cast(data), int(size)}, ec, lt::from_span); 39 | return 0; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /fuzzers/src/upnp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2019, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/upnp.hpp" 34 | #include "libtorrent/xml_parse.hpp" 35 | 36 | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) 37 | { 38 | using namespace std::placeholders; 39 | 40 | lt::parse_state s; 41 | lt::xml_parse({reinterpret_cast(data), size} 42 | , std::bind(<::find_control_url, _1, _2, std::ref(s))); 43 | return 0; 44 | } 45 | 46 | -------------------------------------------------------------------------------- /fuzzers/src/utf8_codepoint.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2019-2020, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/utf8.hpp" 34 | 35 | #include 36 | 37 | extern "C" int LLVMFuzzerTestOneInput(std::uint8_t const* data, size_t size) 38 | { 39 | if (size == 0) return 0; 40 | lt::parse_utf8_codepoint({reinterpret_cast(data), size}); 41 | return 0; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /fuzzers/src/verify_encoding.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2019-2020, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/torrent_info.hpp" 34 | 35 | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) 36 | { 37 | if (size == 0) return 0; 38 | std::string str{reinterpret_cast(data), size}; 39 | lt::aux::verify_encoding(str); 40 | return 0; 41 | } 42 | 43 | -------------------------------------------------------------------------------- /fuzzers/tools/unify_corpus_names.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | import string 4 | import hashlib 5 | 6 | if len(sys.argv) < 2: 7 | print('usage: unify_corpus_names.py \n') 8 | sys.exit(1) 9 | 10 | root = sys.argv[1] 11 | for name in os.listdir(root): 12 | f = os.path.join(root, name) 13 | 14 | # ignore directories 15 | if not os.path.isfile(f): 16 | continue 17 | 18 | # if the name already looks like a SHA-1 hash, ignore it 19 | if len(name) == 40 and all(c in string.hexdigits for c in name): 20 | continue 21 | 22 | new_name = hashlib.sha1(open(f, 'rb').read()).hexdigest() 23 | print('%s -> %s' % (f, new_name)) 24 | os.rename(f, os.path.join(root, new_name)) 25 | -------------------------------------------------------------------------------- /include/libtorrent/aux_/array.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2017, Alden Torres 4 | Copyright (c) 2018, 2020, Arvid Norberg 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | * Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in 15 | the documentation and/or other materials provided with the distribution. 16 | * Neither the name of the author nor the names of its 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | POSSIBILITY OF SUCH DAMAGE. 31 | 32 | */ 33 | 34 | #ifndef TORRENT_ARRAY_HPP 35 | #define TORRENT_ARRAY_HPP 36 | 37 | #include 38 | 39 | #include "libtorrent/aux_/container_wrapper.hpp" 40 | 41 | namespace libtorrent { namespace aux { 42 | 43 | template 44 | using array = container_wrapper>; 45 | 46 | }} 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /include/libtorrent/aux_/deque.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2017-2018, 2020, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_DEQUE_HPP 34 | #define TORRENT_DEQUE_HPP 35 | 36 | #include 37 | 38 | #include "libtorrent/aux_/container_wrapper.hpp" 39 | 40 | namespace libtorrent { namespace aux { 41 | 42 | template 43 | using deque = container_wrapper>; 44 | 45 | }} 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /include/libtorrent/aux_/disable_warnings_pop.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2015, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifdef _MSC_VER 34 | #pragma warning(pop) 35 | #endif 36 | 37 | #ifdef __clang__ 38 | #pragma clang diagnostic pop 39 | #endif 40 | 41 | #ifdef __GNUC__ 42 | #pragma GCC diagnostic pop 43 | #endif 44 | -------------------------------------------------------------------------------- /include/libtorrent/aux_/drive_info.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2022, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include 34 | 35 | namespace libtorrent { 36 | namespace aux { 37 | 38 | enum class drive_info 39 | { 40 | spinning, 41 | ssd_disk, 42 | ssd_dax, 43 | remote, 44 | }; 45 | 46 | drive_info get_drive_info(std::string const& path); 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /include/libtorrent/aux_/ed25519.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ED25519_HPP 2 | #define ED25519_HPP 3 | 4 | #include "libtorrent/aux_/export.hpp" // for TORRENT_EXPORT 5 | #include // for ptrdiff_t, size_t 6 | 7 | namespace libtorrent { 8 | namespace aux { 9 | 10 | void TORRENT_EXTRA_EXPORT ed25519_create_keypair(unsigned char *public_key, unsigned char *private_key, const unsigned char *seed); 11 | void TORRENT_EXTRA_EXPORT ed25519_sign(unsigned char *signature, const unsigned char *message, std::ptrdiff_t message_len, const unsigned char *public_key, const unsigned char *private_key); 12 | int TORRENT_EXTRA_EXPORT ed25519_verify(const unsigned char *signature, const unsigned char *message, std::ptrdiff_t message_len, const unsigned char *public_key); 13 | void TORRENT_EXTRA_EXPORT ed25519_add_scalar(unsigned char *public_key, unsigned char *private_key, const unsigned char *scalar); 14 | void TORRENT_EXTRA_EXPORT ed25519_key_exchange(unsigned char *shared_secret, const unsigned char *public_key, const unsigned char *private_key); 15 | 16 | } } 17 | 18 | #endif // ED25519_HPP 19 | -------------------------------------------------------------------------------- /include/libtorrent/aux_/generate_peer_id.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2018, 2020, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_GENERATE_PEER_ID_HPP_INCLUDED 34 | #define TORRENT_GENERATE_PEER_ID_HPP_INCLUDED 35 | 36 | #include "libtorrent/peer_id.hpp" 37 | #include "libtorrent/aux_/export.hpp" 38 | 39 | namespace libtorrent { namespace aux { 40 | 41 | struct session_settings; 42 | 43 | TORRENT_EXTRA_EXPORT peer_id generate_peer_id(session_settings const& sett); 44 | 45 | }} 46 | 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /include/libtorrent/aux_/sha512.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TORRENT_SHA512_HPP_INCLUDED 2 | #define TORRENT_SHA512_HPP_INCLUDED 3 | 4 | #include "libtorrent/config.hpp" 5 | 6 | #if !defined TORRENT_USE_LIBGCRYPT \ 7 | && !TORRENT_USE_COMMONCRYPTO \ 8 | && !TORRENT_USE_CNG \ 9 | && !TORRENT_USE_CRYPTOAPI_SHA_512 \ 10 | && !defined TORRENT_USE_LIBCRYPTO 11 | 12 | #include 13 | 14 | namespace libtorrent { 15 | namespace aux { 16 | 17 | struct sha512_ctx 18 | { 19 | std::uint64_t length; 20 | std::uint64_t state[8]; 21 | std::size_t curlen; 22 | std::uint8_t buf[128]; 23 | }; 24 | 25 | TORRENT_EXTRA_EXPORT int SHA512_init(sha512_ctx* md); 26 | TORRENT_EXTRA_EXPORT int SHA512_update(sha512_ctx* md 27 | , std::uint8_t const* data, std::size_t len); 28 | TORRENT_EXTRA_EXPORT int SHA512_final(std::uint8_t* digest, sha512_ctx* md); 29 | } 30 | } 31 | 32 | #endif 33 | #endif 34 | -------------------------------------------------------------------------------- /include/libtorrent/aux_/vector.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2016, 2018, 2020, Arvid Norberg 4 | Copyright (c) 2017, Alden Torres 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | * Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in 15 | the documentation and/or other materials provided with the distribution. 16 | * Neither the name of the author nor the names of its 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | POSSIBILITY OF SUCH DAMAGE. 31 | 32 | */ 33 | 34 | #ifndef TORRENT_VECTOR_HPP 35 | #define TORRENT_VECTOR_HPP 36 | 37 | #include 38 | 39 | #include "libtorrent/aux_/container_wrapper.hpp" 40 | 41 | namespace libtorrent { namespace aux { 42 | 43 | template 44 | using vector = container_wrapper>; 45 | 46 | }} 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /include/libtorrent/aux_/windows.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2018, Arvid Norberg, Steven Siloti 4 | Copyright (c) 2018, 2020, Arvid Norberg 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | * Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in 15 | the documentation and/or other materials provided with the distribution. 16 | * Neither the name of the author nor the names of its 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | POSSIBILITY OF SUCH DAMAGE. 31 | 32 | */ 33 | 34 | #ifndef TORRENT_WINDOWS_HPP_INCLUDED 35 | #define TORRENT_WINDOWS_HPP_INCLUDED 36 | 37 | #ifndef WIN32_LEAN_AND_MEAN 38 | #define WIN32_LEAN_AND_MEAN 39 | #endif 40 | #ifndef VC_EXTRALEAN 41 | #define VC_EXTRALEAN 42 | #endif 43 | #ifndef STRICT 44 | #define STRICT 45 | #endif 46 | #include 47 | 48 | #endif // TORRENT_WINDOWS_HPP_INCLUDED 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /include/libtorrent/crc32c.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2010, 2014, 2016-2020, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_CRC32C_HPP_INCLUDE 34 | #define TORRENT_CRC32C_HPP_INCLUDE 35 | 36 | #include 37 | #include "libtorrent/aux_/export.hpp" 38 | 39 | namespace libtorrent { 40 | 41 | // this is the crc32c (Castagnoli) polynomial 42 | TORRENT_EXTRA_EXPORT std::uint32_t crc32c_32(std::uint32_t); 43 | TORRENT_EXTRA_EXPORT std::uint32_t crc32c(std::uint64_t const*, int); 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /include/libtorrent/file_layout.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2022, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_FILE_LAYOUT_HPP_INCLUDED 34 | #define TORRENT_FILE_LAYOUT_HPP_INCLUDED 35 | 36 | #include "libtorrent/file_storage.hpp" 37 | 38 | namespace libtorrent { 39 | 40 | using file_layout = file_storage; 41 | } 42 | 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /include/libtorrent/peer_id.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2003, 2009, 2013, 2016-2017, 2019, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_PEER_ID_HPP_INCLUDED 34 | #define TORRENT_PEER_ID_HPP_INCLUDED 35 | 36 | #include "libtorrent/sha1_hash.hpp" 37 | 38 | namespace libtorrent { 39 | 40 | using peer_id = sha1_hash; 41 | } 42 | 43 | #endif // TORRENT_PEER_ID_HPP_INCLUDED 44 | -------------------------------------------------------------------------------- /include/libtorrent/platform_util.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TORRENT_PLATFORM_UTIL_HPP 2 | #define TORRENT_PLATFORM_UTIL_HPP 3 | 4 | #include 5 | 6 | namespace libtorrent { 7 | 8 | int max_open_files(); 9 | 10 | void set_thread_name(char const* name); 11 | 12 | } 13 | 14 | #endif // TORRENT_PLATFORM_UTIL_HPP 15 | -------------------------------------------------------------------------------- /include/libtorrent/puff.hpp: -------------------------------------------------------------------------------- 1 | /* puff.h 2 | Copyright (C) 2002, 2003 Mark Adler, all rights reserved 3 | version 1.7, 3 Mar 2002 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the author be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | Mark Adler madler@alumni.caltech.edu 22 | */ 23 | 24 | #ifndef PUFF_HPP_INCLUDED 25 | #define PUFF_HPP_INCLUDED 26 | 27 | /* 28 | * See puff.c for purpose and usage. 29 | */ 30 | int puff(unsigned char *dest, /* pointer to destination pointer */ 31 | unsigned long *destlen, /* amount of output space */ 32 | const unsigned char *source, /* pointer to source data pointer */ 33 | unsigned long *sourcelen); /* amount of input available */ 34 | 35 | #endif // PUFF_HPP_INCLUDED 36 | -------------------------------------------------------------------------------- /include/libtorrent/sha1.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | SHA-1 C++ conversion 3 | 4 | original version: 5 | 6 | SHA-1 in C 7 | By Steve Reid 8 | 100% Public Domain 9 | 10 | changelog at the end of sha1.cpp 11 | */ 12 | 13 | #ifndef TORRENT_SHA1_HPP_INCLUDED 14 | #define TORRENT_SHA1_HPP_INCLUDED 15 | 16 | #include "libtorrent/config.hpp" 17 | 18 | #if !defined TORRENT_USE_LIBGCRYPT \ 19 | && !TORRENT_USE_COMMONCRYPTO \ 20 | && !TORRENT_USE_CNG \ 21 | && !TORRENT_USE_CRYPTOAPI \ 22 | && !defined TORRENT_USE_LIBCRYPTO 23 | 24 | #include 25 | 26 | namespace libtorrent { 27 | 28 | struct sha1_ctx 29 | { 30 | std::uint32_t state[5]; 31 | std::uint32_t count[2]; 32 | std::uint8_t buffer[64]; 33 | }; 34 | 35 | // we don't want these to clash with openssl's libcrypto 36 | TORRENT_EXTRA_EXPORT void SHA1_init(sha1_ctx* context); 37 | TORRENT_EXTRA_EXPORT void SHA1_update(sha1_ctx* context 38 | , std::uint8_t const* data, size_t len); 39 | TORRENT_EXTRA_EXPORT void SHA1_final(std::uint8_t* digest, sha1_ctx* context); 40 | } 41 | 42 | #endif 43 | #endif 44 | -------------------------------------------------------------------------------- /include/libtorrent/sha256.hpp: -------------------------------------------------------------------------------- 1 | // SHA-256. Adapted from LibTomCrypt. This code is Public Domain 2 | 3 | #ifndef TORRENT_SHA256_HPP_INCLUDED 4 | #define TORRENT_SHA256_HPP_INCLUDED 5 | 6 | #include "libtorrent/config.hpp" 7 | 8 | #if !defined TORRENT_USE_LIBGCRYPT \ 9 | && !TORRENT_USE_COMMONCRYPTO \ 10 | && !TORRENT_USE_CNG \ 11 | && !TORRENT_USE_CRYPTOAPI_SHA_512 \ 12 | && !defined TORRENT_USE_LIBCRYPTO 13 | 14 | #include 15 | 16 | namespace libtorrent { 17 | 18 | struct sha256_ctx 19 | { 20 | std::uint64_t length; 21 | std::uint32_t state[8]; 22 | std::uint32_t curlen; 23 | std::uint8_t buf[64]; 24 | }; 25 | 26 | TORRENT_EXTRA_EXPORT void SHA256_init(sha256_ctx& md); 27 | TORRENT_EXTRA_EXPORT void SHA256_update(sha256_ctx& md 28 | , std::uint8_t const* in, size_t len); 29 | TORRENT_EXTRA_EXPORT void SHA256_final(std::uint8_t* digest, sha256_ctx& md); 30 | } 31 | 32 | #endif 33 | #endif 34 | -------------------------------------------------------------------------------- /include/libtorrent/storage.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef TORRENT_STORAGE_HPP_INCLUDED 3 | #define TORRENT_STORAGE_HPP_INCLUDED 4 | 5 | #error "the disk I/O subsystem has been overhauled in libtorrent 2.0. storage_interface is no longer a customization point, customize disk_interface instead" 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /project-config.jam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/project-config.jam -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [flake8] 2 | # https://black.readthedocs.io/en/stable/compatible_configs.html#flake8 3 | max-line-length = 88 4 | extend-ignore = E203, W503 5 | 6 | [mypy] 7 | warn_return_any = True 8 | warn_redundant_casts = True 9 | warn_unused_ignores = True 10 | warn_unreachable = True 11 | warn_unused_configs = True 12 | #disallow_any_unimported = True 13 | disallow_untyped_defs = True 14 | disallow_incomplete_defs = True 15 | mypy_path = bindings/python/install_data 16 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import os 3 | import runpy 4 | 5 | os.chdir("bindings/python") 6 | runpy.run_path("setup.py") 7 | -------------------------------------------------------------------------------- /simulation/Jamfile: -------------------------------------------------------------------------------- 1 | import testing ; 2 | import feature : feature ; 3 | 4 | use-project /torrent : .. ; 5 | use-project /libtorrent_test : ../test ; 6 | 7 | use-project /libsimulator : libsimulator ; 8 | 9 | project 10 | : requirements 11 | on 12 | on 13 | /torrent//torrent 14 | /libtorrent_test//libtorrent_test 15 | setup_swarm.cpp 16 | setup_dht.cpp 17 | create_torrent.cpp 18 | utils.cpp 19 | disk_io.cpp 20 | transfer_sim.cpp 21 | msvc:/wd4275 22 | msvc:/wd4005 23 | msvc:/wd4268 24 | : default-build 25 | multi 26 | full 27 | on 28 | on 29 | 14 30 | built-in 31 | ; 32 | 33 | run test_pause.cpp ; 34 | run test_socks5.cpp ; 35 | run test_checking.cpp ; 36 | run test_optimistic_unchoke.cpp ; 37 | run test_transfer.cpp ; 38 | run test_transfer_no_files.cpp ; 39 | run test_transfer_full_invalid_files.cpp ; 40 | run test_transfer_partial_valid_files.cpp ; 41 | run test_http_connection.cpp ; 42 | run test_web_seed.cpp ; 43 | run test_auto_manage.cpp ; 44 | run test_torrent_status.cpp ; 45 | run test_swarm.cpp ; 46 | run test_session.cpp ; 47 | run test_super_seeding.cpp ; 48 | run test_utp.cpp ; 49 | run test_dht.cpp ; 50 | run test_dht_bootstrap.cpp ; 51 | run test_dht_storage.cpp ; 52 | run test_pe_crypto.cpp ; 53 | run test_metadata_extension.cpp ; 54 | run test_tracker.cpp ; 55 | run test_thread_pool.cpp ; 56 | run test_ip_filter.cpp ; 57 | run test_dht_rate_limit.cpp ; 58 | run test_fast_extensions.cpp ; 59 | run test_v2.cpp ; 60 | # TODO figure out what to do with this 61 | # since v2 support was added re-mapped files are required to be piece aligned 62 | # but test_file_pool requires mapping more files than there are pieces 63 | #run test_file_pool.cpp ; 64 | run test_save_resume.cpp ; 65 | run test_error_handling.cpp ; 66 | run test_timeout.cpp ; 67 | run test_peer_connection.cpp ; 68 | 69 | -------------------------------------------------------------------------------- /simulation/create_torrent.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2015, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_SIM_CREATE_TORRENT_HPP_INCLUDED 34 | #define TORRENT_SIM_CREATE_TORRENT_HPP_INCLUDED 35 | 36 | #include 37 | #include "libtorrent/add_torrent_params.hpp" 38 | #include "libtorrent/create_torrent.hpp" 39 | 40 | std::string save_path(int idx); 41 | lt::add_torrent_params create_torrent(int idx, bool seed = true 42 | , int num_pieces = 9, lt::create_flags_t flags = {}); 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /simulation/test_transfer_full_invalid_files.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2021, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "transfer_sim.hpp" 34 | 35 | TORRENT_TEST(transfer_matrix) 36 | { 37 | using fm = existing_files_mode; 38 | 39 | run_all_combinations([] (test_transfer_flags_t const flags) { 40 | return run_matrix_test(flags, fm::full_invalid); 41 | }); 42 | } 43 | 44 | -------------------------------------------------------------------------------- /simulation/test_transfer_no_files.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2021, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "transfer_sim.hpp" 34 | 35 | TORRENT_TEST(transfer_matrix) 36 | { 37 | using fm = existing_files_mode; 38 | 39 | run_all_combinations([] (test_transfer_flags_t const flags) { 40 | return run_matrix_test(flags, fm::no_files); 41 | }); 42 | } 43 | 44 | -------------------------------------------------------------------------------- /simulation/test_transfer_partial_valid_files.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2021, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "transfer_sim.hpp" 34 | 35 | TORRENT_TEST(transfer_matrix) 36 | { 37 | using fm = existing_files_mode; 38 | 39 | run_all_combinations([] (test_transfer_flags_t const flags) { 40 | return run_matrix_test(flags, fm::partial_valid); 41 | }); 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/ed25519/LICENSE: -------------------------------------------------------------------------------- 1 | Derived from https://ed25519.cr.yp.to/software.html which is public domain 2 | 3 | Additional contributions are placed in the public domain by 4 | Arvid Norberg 5 | 6 | Copyright (c) 2015 Orson Peters 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no event will the 9 | authors be held liable for any damages arising from the use of this software. 10 | 11 | Permission is granted to anyone to use this software for any purpose, including commercial 12 | applications, and to alter it and redistribute it freely, subject to the following restrictions: 13 | 14 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the 15 | original software. If you use this software in a product, an acknowledgment in the product 16 | documentation would be appreciated but is not required. 17 | 18 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 19 | being the original software. 20 | 21 | 3. This notice may not be removed or altered from any source distribution. 22 | 23 | -------------------------------------------------------------------------------- /src/ed25519/fe.h: -------------------------------------------------------------------------------- 1 | #ifndef FE_H 2 | #define FE_H 3 | 4 | #include "fixedint.h" 5 | 6 | 7 | /* 8 | fe means field element. 9 | Here the field is \Z/(2^255-19). 10 | An element t, entries t[0]...t[9], represents the integer 11 | t[0]+2^26 t[1]+2^51 t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9]. 12 | Bounds on each t[i] vary depending on context. 13 | */ 14 | 15 | 16 | typedef i32 fe[10]; 17 | 18 | 19 | void fe_0(fe h); 20 | void fe_1(fe h); 21 | 22 | void fe_frombytes(fe h, const unsigned char *s); 23 | void fe_tobytes(unsigned char *s, const fe h); 24 | 25 | void fe_copy(fe h, const fe f); 26 | int fe_isnegative(const fe f); 27 | int fe_isnonzero(const fe f); 28 | void fe_cmov(fe f, const fe g, unsigned int b); 29 | void fe_cswap(fe f, fe g, unsigned int b); 30 | 31 | void fe_neg(fe h, const fe f); 32 | void fe_add(fe h, const fe f, const fe g); 33 | void fe_invert(fe out, const fe z); 34 | void fe_sq(fe h, const fe f); 35 | void fe_sq2(fe h, const fe f); 36 | void fe_mul(fe h, const fe f, const fe g); 37 | void fe_mul121666(fe h, fe f); 38 | void fe_pow22523(fe out, const fe z); 39 | void fe_sub(fe h, const fe f, const fe g); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/ed25519/fixedint.h: -------------------------------------------------------------------------------- 1 | #ifndef FIXEDINT_H_INCLUDED 2 | #define FIXEDINT_H_INCLUDED 3 | 4 | #include 5 | 6 | typedef std::uint64_t u64; 7 | typedef std::int64_t i64; 8 | typedef std::int32_t i32; 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/ed25519/ge.h: -------------------------------------------------------------------------------- 1 | #ifndef GE_H 2 | #define GE_H 3 | 4 | #include "fe.h" 5 | 6 | 7 | /* 8 | ge means group element. 9 | 10 | Here the group is the set of pairs (x,y) of field elements (see fe.h) 11 | satisfying -x^2 + y^2 = 1 + d x^2y^2 12 | where d = -121665/121666. 13 | 14 | Representations: 15 | ge_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z 16 | ge_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT 17 | ge_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T 18 | ge_precomp (Duif): (y+x,y-x,2dxy) 19 | */ 20 | 21 | typedef struct { 22 | fe X; 23 | fe Y; 24 | fe Z; 25 | } ge_p2; 26 | 27 | typedef struct { 28 | fe X; 29 | fe Y; 30 | fe Z; 31 | fe T; 32 | } ge_p3; 33 | 34 | typedef struct { 35 | fe X; 36 | fe Y; 37 | fe Z; 38 | fe T; 39 | } ge_p1p1; 40 | 41 | typedef struct { 42 | fe yplusx; 43 | fe yminusx; 44 | fe xy2d; 45 | } ge_precomp; 46 | 47 | typedef struct { 48 | fe YplusX; 49 | fe YminusX; 50 | fe Z; 51 | fe T2d; 52 | } ge_cached; 53 | 54 | void ge_p3_tobytes(unsigned char *s, const ge_p3 *h); 55 | void ge_tobytes(unsigned char *s, const ge_p2 *h); 56 | int ge_frombytes_negate_vartime(ge_p3 *h, const unsigned char *s); 57 | 58 | void ge_add(ge_p1p1 *r, const ge_p3 *p, const ge_cached *q); 59 | void ge_sub(ge_p1p1 *r, const ge_p3 *p, const ge_cached *q); 60 | void ge_double_scalarmult_vartime(ge_p2 *r, const unsigned char *a, const ge_p3 *A, const unsigned char *b); 61 | void ge_madd(ge_p1p1 *r, const ge_p3 *p, const ge_precomp *q); 62 | void ge_msub(ge_p1p1 *r, const ge_p3 *p, const ge_precomp *q); 63 | void ge_scalarmult_base(ge_p3 *h, const unsigned char *a); 64 | 65 | void ge_p1p1_to_p2(ge_p2 *r, const ge_p1p1 *p); 66 | void ge_p1p1_to_p3(ge_p3 *r, const ge_p1p1 *p); 67 | void ge_p2_0(ge_p2 *h); 68 | void ge_p2_dbl(ge_p1p1 *r, const ge_p2 *p); 69 | void ge_p3_0(ge_p3 *h); 70 | void ge_p3_dbl(ge_p1p1 *r, const ge_p3 *p); 71 | void ge_p3_to_cached(ge_cached *r, const ge_p3 *p); 72 | void ge_p3_to_p2(ge_p2 *r, const ge_p3 *p); 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /src/ed25519/keypair.cpp: -------------------------------------------------------------------------------- 1 | // ignore warnings in this file 2 | #include "libtorrent/aux_/disable_warnings_push.hpp" 3 | 4 | #include "libtorrent/aux_/ed25519.hpp" 5 | #include "libtorrent/aux_/hasher512.hpp" 6 | #include "ge.h" 7 | 8 | namespace libtorrent { 9 | namespace aux { 10 | 11 | void ed25519_create_keypair(unsigned char *public_key, unsigned char *private_key, const unsigned char *seed) { 12 | ge_p3 A; 13 | 14 | hasher512 hash({reinterpret_cast(seed), 32}); 15 | std::memcpy(private_key, hash.final().data(), 64); 16 | private_key[0] &= 248; 17 | private_key[31] &= 63; 18 | private_key[31] |= 64; 19 | 20 | ge_scalarmult_base(&A, private_key); 21 | ge_p3_tobytes(public_key, &A); 22 | } 23 | 24 | } } 25 | -------------------------------------------------------------------------------- /src/ed25519/sc.h: -------------------------------------------------------------------------------- 1 | #ifndef SC_H 2 | #define SC_H 3 | 4 | /* 5 | The set of scalars is \Z/l 6 | where l = 2^252 + 27742317777372353535851937790883648493. 7 | */ 8 | 9 | void sc_reduce(unsigned char *s); 10 | void sc_muladd(unsigned char *s, const unsigned char *a, const unsigned char *b, const unsigned char *c); 11 | 12 | #endif 13 | 14 | -------------------------------------------------------------------------------- /src/ed25519/sign.cpp: -------------------------------------------------------------------------------- 1 | // ignore warnings in this file 2 | #include "libtorrent/aux_/disable_warnings_push.hpp" 3 | 4 | #include "libtorrent/aux_/ed25519.hpp" 5 | #include "libtorrent/aux_/hasher512.hpp" 6 | #include "ge.h" 7 | #include "sc.h" 8 | 9 | namespace libtorrent { 10 | namespace aux { 11 | 12 | void ed25519_sign(unsigned char *signature, const unsigned char *message, std::ptrdiff_t message_len, const unsigned char *public_key, const unsigned char *private_key) { 13 | ge_p3 R; 14 | 15 | hasher512 hash; 16 | hash.update({reinterpret_cast(private_key) + 32, 32}); 17 | hash.update({reinterpret_cast(message), message_len}); 18 | sha512_hash r = hash.final(); 19 | 20 | sc_reduce(reinterpret_cast(r.data())); 21 | ge_scalarmult_base(&R, reinterpret_cast(r.data())); 22 | ge_p3_tobytes(signature, &R); 23 | 24 | hash.reset(); 25 | hash.update({reinterpret_cast(signature), 32}); 26 | hash.update({reinterpret_cast(public_key), 32}); 27 | hash.update({reinterpret_cast(message), message_len}); 28 | sha512_hash hram = hash.final(); 29 | 30 | sc_reduce(reinterpret_cast(hram.data())); 31 | sc_muladd(signature + 32 32 | , reinterpret_cast(hram.data()) 33 | , private_key 34 | , reinterpret_cast(r.data())); 35 | } 36 | 37 | } } 38 | -------------------------------------------------------------------------------- /src/ed25519/verify.cpp: -------------------------------------------------------------------------------- 1 | // ignore warnings in this file 2 | #include "libtorrent/aux_/disable_warnings_push.hpp" 3 | 4 | #include "libtorrent/aux_/ed25519.hpp" 5 | #include "libtorrent/aux_/hasher512.hpp" 6 | #include "ge.h" 7 | #include "sc.h" 8 | 9 | namespace libtorrent { 10 | namespace aux { 11 | 12 | static int consttime_equal(const unsigned char *x, const unsigned char *y) { 13 | unsigned char r = 0; 14 | 15 | r = x[0] ^ y[0]; 16 | #define F(i) r |= x[i] ^ y[i] 17 | F(1); 18 | F(2); 19 | F(3); 20 | F(4); 21 | F(5); 22 | F(6); 23 | F(7); 24 | F(8); 25 | F(9); 26 | F(10); 27 | F(11); 28 | F(12); 29 | F(13); 30 | F(14); 31 | F(15); 32 | F(16); 33 | F(17); 34 | F(18); 35 | F(19); 36 | F(20); 37 | F(21); 38 | F(22); 39 | F(23); 40 | F(24); 41 | F(25); 42 | F(26); 43 | F(27); 44 | F(28); 45 | F(29); 46 | F(30); 47 | F(31); 48 | #undef F 49 | 50 | return !r; 51 | } 52 | 53 | int ed25519_verify(const unsigned char *signature, const unsigned char *message, std::ptrdiff_t message_len, const unsigned char *public_key) { 54 | unsigned char checker[32]; 55 | ge_p3 A; 56 | ge_p2 R; 57 | 58 | if (signature[63] & 224) { 59 | return 0; 60 | } 61 | 62 | if (ge_frombytes_negate_vartime(&A, public_key) != 0) { 63 | return 0; 64 | } 65 | 66 | hasher512 hash; 67 | hash.update({reinterpret_cast(signature), 32}); 68 | hash.update({reinterpret_cast(public_key), 32}); 69 | hash.update({reinterpret_cast(message), message_len}); 70 | sha512_hash h = hash.final(); 71 | 72 | sc_reduce(reinterpret_cast(h.data())); 73 | ge_double_scalarmult_vartime(&R, reinterpret_cast(h.data()) 74 | , &A, signature + 32); 75 | ge_tobytes(checker, &R); 76 | 77 | if (!consttime_equal(checker, signature)) { 78 | return 0; 79 | } 80 | 81 | return 1; 82 | } 83 | 84 | } } 85 | -------------------------------------------------------------------------------- /src/stat.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2003, 2008-2010, 2019, Arvid Norberg 4 | Copyright (c) 2016, Alden Torres 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | * Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in 15 | the documentation and/or other materials provided with the distribution. 16 | * Neither the name of the author nor the names of its 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | POSSIBILITY OF SUCH DAMAGE. 31 | 32 | */ 33 | 34 | #include "libtorrent/stat.hpp" 35 | 36 | namespace libtorrent { 37 | 38 | void stat_channel::second_tick(int tick_interval_ms) 39 | { 40 | std::int64_t sample = std::int64_t(m_counter) * 1000 / tick_interval_ms; 41 | TORRENT_ASSERT(sample >= 0); 42 | m_5_sec_average = std::int32_t(std::int64_t(m_5_sec_average) * 4 / 5 + sample / 5); 43 | m_counter = 0; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/version.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2015, 2020, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/version.hpp" 34 | 35 | namespace libtorrent { 36 | 37 | char const* version() 38 | { 39 | return version_str; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /test/corrupt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/corrupt.gz -------------------------------------------------------------------------------- /test/dht_server.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2013, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "test.hpp" // for EXPORT 34 | 35 | // returns the port the DHT is running on 36 | int EXPORT start_dht(); 37 | 38 | // the number of DHT messages received 39 | int EXPORT num_dht_hits(); 40 | 41 | void EXPORT stop_dht(); 42 | 43 | -------------------------------------------------------------------------------- /test/invalid1.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/invalid1.gz -------------------------------------------------------------------------------- /test/mutable_test_torrents/test1.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/mutable_test_torrents/test1.torrent -------------------------------------------------------------------------------- /test/mutable_test_torrents/test1_pad_files.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/mutable_test_torrents/test1_pad_files.torrent -------------------------------------------------------------------------------- /test/mutable_test_torrents/test1_single.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/mutable_test_torrents/test1_single.torrent -------------------------------------------------------------------------------- /test/mutable_test_torrents/test1_single_padded.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/mutable_test_torrents/test1_single_padded.torrent -------------------------------------------------------------------------------- /test/mutable_test_torrents/test2.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/mutable_test_torrents/test2.torrent -------------------------------------------------------------------------------- /test/mutable_test_torrents/test2_pad_files.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/mutable_test_torrents/test2_pad_files.torrent -------------------------------------------------------------------------------- /test/mutable_test_torrents/test3.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/mutable_test_torrents/test3.torrent -------------------------------------------------------------------------------- /test/mutable_test_torrents/test3_pad_files.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/mutable_test_torrents/test3_pad_files.torrent -------------------------------------------------------------------------------- /test/peer_server.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2013, 2016, 2019, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef PEER_SERVER_HPP 34 | #define PEER_SERVER_HPP 35 | 36 | #include "test.hpp" // for EXPORT 37 | 38 | // returns the port the peer is running on 39 | EXPORT int start_peer(); 40 | 41 | // the number of incoming connections to this peer 42 | EXPORT int num_peer_hits(); 43 | 44 | EXPORT void stop_peer(); 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /test/print_alerts.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2016-2017, 2019, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef PRINT_ALERTS_HPP 34 | #define PRINT_ALERTS_HPP 35 | 36 | #include "libtorrent/time.hpp" 37 | #include "libtorrent/session.hpp" 38 | #include "test.hpp" // for EXPORT 39 | 40 | EXPORT void print_alerts(lt::session* ses, lt::time_point start_time); 41 | 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /test/settings.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2015, 2017, 2019, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/settings_pack.hpp" 34 | #include "test.hpp" 35 | 36 | lt::settings_pack EXPORT settings(); 37 | 38 | -------------------------------------------------------------------------------- /test/ssl/dhparams.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN DH PARAMETERS----- 2 | MIICCAKCAgEAusZ496/9z7kgXOTCwhmv+teCvMey0fPRxNBi9UdarAah5mU5i0O7 3 | 2PVQ/WgrBpGTCNoN3mj8U4ZFUUrnyLTl5rEcyoICseZOefpCmKUMYQSDy18i0B0V 4 | rRPTTrApfYmAmvapLAHIDaWVImnOccIg05Ou++C5qv+xnJv3zk6D+RiR/tahB035 5 | wZH1+EpP5fuZTw2RaOb5t/pojWhVACGIzH/xCcJWEOzSE1RQSk0MNx1ntRcwwvBY 6 | hhLikp878h24iLNvbRuk4K/AwnwahpmHs8FkfEzC0NeLJIkN9j1O+jeLzhl6zNZm 7 | cgplMe8A0FlF5ukqEBG9ON5VkWiR1Z4P0iMaTcxVHZ3rlGCs4AkBRlnaZ5vaZYHg 8 | SMqSDaJ/KGEA/ioRMDBR8YG5rl2XZD/Ap105Z7/mVbdVmCtpAUGtSBXXprqp5XuL 9 | wNFGiCOwuWmtenz+SNgQTpyK+GbpIZ980/wM/plakyywOw5sg0G0LSAJGe2Ktn/G 10 | 2qfCAk374cqvuT5WdF3TueQvTpDZlgeqGK3K/l9MSVh7pfxrGb9kOYOwQVKihX8L 11 | PtyiBofaH54NjM9BJMmXcAk2PlQwL+UUDzOpPRZKnrgG38idNHIGoTSedPnv3x5m 12 | QErBNFVyGHaWC+Fs3vrqtkoafPeNy4OXXyWQQo2bfwB02ubqUZzLT6cCAQI= 13 | -----END DH PARAMETERS----- 14 | -------------------------------------------------------------------------------- /test/ssl/invalid_peer_private_key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN ENCRYPTED PRIVATE KEY----- 2 | MIIFHDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIMmDN+9v+64ECAggA 3 | MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECPgER24ZRktJBIIEyOnZQ6QUnkmD 4 | 5VWYpD3faPQTe92SBFEeaW+ds41DNzy5ePbLuLFMzfBC4ZgYUCfNen8bRDVeAP2U 5 | Ln51cODpkISManaIXm2yvMywyvexf5f7bKm4MmmYcM1y2P0PtC74nxz5yr9c5H4z 6 | wxGNE/cI1ACt2/B7RyA3CyHVQ1J1uR1OMJj5HshUqiWG+0DoduKP+kJGMdkO0RX5 7 | u6trqfP3iVCmBf0B6zFlXsn9Fre19VEP35ABMuiem9FnLoPx2z4G25txHMspf9+B 8 | tQvvBWMf+HZs73//RzL1or1AVJCBT42LAuBHcrswvqwQfuz3lc5JTK54vKrB+8Zf 9 | 50hnc9T7YC3CJ3GqijaY7rB+3gcfUiD/IcP2jn9zYYRbg7HklHoSacyd4mu52C7d 10 | DS2Hj4kBM7IDa1xrpSiYNeyr+7wPwGqg0odjfRYOzNVP0MtbwRh1AGgKsWOyH06T 11 | h4G9hP8fjYkJG6wzr64jh078aAINk+2SgN0Tbiejdm5D/6R2Mbdm9adogf7ONGfl 12 | +f+NJShWrheaOGdKX28YLeErIZvSNgVgKA3m0bR7+6lTB7ncXQanTE4ps5g4nZcr 13 | RRJJp1XwXQhL/GWpCNiV3DuEVLtGYiLnG9kUootILOGTpdX6HL/VK1G3v2bM03LL 14 | QaSJ69wgNcPErxB4l4ak3u5DliNLugZqmC7MfRFZcbBtKspAmAtQpgDcitnfqq7H 15 | OnYXzsXJKMOnOTTA0kJNb2mT83YZZM/myoyjE9IpwuLSZXwlVvTixNLnYieBpy/E 16 | hbybop1o8YGIGg1Ynt6XkmEBDA2LzYKw0TLFIsfm3poy5H4+BK36IwlfmEWv3/5V 17 | L5+VVt5t+lfdQptx/092u/aa1OnmHlOz6wROQ3MqWIrW1RoEgF+5K2T5m1CBWz9h 18 | 6ND9wgbtFbh/aWMFsA1dbHZWFIhCpD+q7WzvB0mUOt4aa5Pncx93XwHzKjfdVjZo 19 | wFipujTnKalA7AB1dQDVnU9+a7BD6s88SvCFKMisObT+3+RRHRnrc9UqX2zJpi8D 20 | 1sTE08kVZSrVhQU1Os2iSDOZZNJUWOSGNjwjTQLma93TVO4FNky3rxCMR1Y/iU7R 21 | 8PfiSrf/rlFfTtqZQvrVEw/a7q8Bb0tyCVU/ZWS2wcZRxzJ7Zny7H44wX+Ay6JsT 22 | joq0qR5gU7iLOH9ZfW5EBSYtSVmBskb3XO+pDKLx8U8wruLllClSbKGe3h8MjP8K 23 | VnPWAornhr9mtZx7vvXrYauLPH1+WIISVQMIsEXPgX79JLr2Nxu8prAN0sTo+eeW 24 | jaCa961Rx1LPyqhNwozkk+9oa8MajCXmXtHmCRT0l3AkUPQmwdxDE63jn0k6sEJh 25 | 5HlNfMnjgkI79KyMs0cfrKV5DWgT1tOWQ5Zf2a5HjYXokN98PqSmDrSoLIm98gU1 26 | rkhiaSzXw6IUbNfv6e0dcb0N+JHKvWmA4N695hqMI0ve+1uuzFuWkace5Xvvnr8i 27 | vh9YqlvozsOQ46cu2xgtfyg/Y+l5t8mMJmeolwKpOwkoIJPQ9StgJFinczeLIkau 28 | jnEgSRaRE3Hi3G9cTr48dI7k1CHxhTRKWLUUxSYbXCJ2QxWXbPjMjr/TN1ZeUrU1 29 | SIECgFXULAt+uyV9IKeViA== 30 | -----END ENCRYPTED PRIVATE KEY----- 31 | -------------------------------------------------------------------------------- /test/ssl/peer_private_key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN ENCRYPTED PRIVATE KEY----- 2 | MIIFHDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIHmqJct6HZWoCAggA 3 | MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECP8EUPBMpHYmBIIEyB+/NB/Ga2qL 4 | 8nfOM+ZmdmFgOFynpoSU97ovySTEppvwVkQhWqTS4FhWuUMPzLbeDUfH+F0fSSLr 5 | T9xcMeAERuUTm3+JKwOvvoyZWJ8uJYIgXbNnQdjKNNOMxotukFZQJS3J6URsLxQq 6 | eqyv30NNHTy08PI6vQ4HFi27kYlOzGo+M2Q/ZPrfjcEeFUYDwLWvo0WAtdbHe2bJ 7 | dMTSAkag3R12utFZn9m4x9px2LHZf0ha7ZwTx5quxzNM5yDU0qU/87XXaqToph4p 8 | rTOoekMBf5kOhcp7TdwcnFzeooVfdRp9ccK3u5ynygHI4DMObqjGRFhD99uv/O29 9 | mn92rI2+ZiYrfT6R1auvSPzz8Ip7a+WO9vaWYepPJaQMIm4g5dBLz8r94tw4L/2t 10 | Ke0wq7KExyH9KgpVA07A5WaDm827Ng6YHz18+hVL/vZQQy2BPBHQgfqdiR6M5WN+ 11 | Tb2U8rifF+seBG13ml7DaXRQkBVMWgW8grE+XCNWP/2O78XFu6/+HDikIgMDiWbI 12 | YoYsPrD1n+NnvpbXSwdzI+IRU/s4kD7X5ALX1sXHrHAeBIyIpg1uKJl/sY7HtHbR 13 | DI4WKfRH16QV0aty3w+G4zM+nPwV4POQQw7o2LmkpeYm+6unpjEwGWvyWNImqNbS 14 | Ivyexi4pV2EvJN9y0iAxHpYb3yMFfu7Wfe2eWaiOsW7j33O/xRYJJG8nFvSkTXdZ 15 | Rb5YOs16+N+RXY3WfYve/5WxVa5cfsyx7pGDKm4s2VguwP7E7UZwFmkc5vCdeZNO 16 | E6f1ZUwBpHiEG5tZOEjgG9JSuXZe6vI2QldKLTFpRNv4P15AkVAxgEKaGGhrtnVV 17 | Osxzsu6t0UtpKfpfbUomm+qsJkT84R0jTvK8A4kQ7MZYWMeB0utFODWdAC2R0YWP 18 | ZQ7ocItjjB2s41kXBFiwMHjEFQgo1h/r0GF0cLTV7SqH68XNY6KnkzS2V8zIzQx3 19 | M4rVpPYzt90Nintr/Gji3fXNekbk1GS7zVFGju2/EbH9raXj4KvYLAq570XYQ1Jg 20 | Uw4lXMn57WvDH3FtdJJW9xqlMRNrv74ahRf4MfWENmXaqlfKYkras0gyNmRs2ckA 21 | fen02UAVsXwsyMwWuD1+5YohPC5ffMM6cBHc7an1OMEpj0QVJFMkN2vpNtlFi+Gc 22 | zC3XfZ3Ni3ehqEbGURYqZbU0/RhDXLDMrc5fHybDZRgkUsXLYRD+pTOAwq9AXVrj 23 | ix+9Ds1UliNk4+QATfbfNaWm8sR2DNLqNsQT21lNIOMniNBiPKMkKu5IE1+O+MZT 24 | tV20kz9ZEnCClvWpLdi+3600p6ZMy/2EKpsbu4MdrPQP/yEABbEilgImdQzRoXbf 25 | w/3duG3mc6njd0hcx77Ry4uqiVVyjkX6SSC0sczD6uzVpYjM5ne0uVws4Xhr4d1Q 26 | GcyH2XEJ8tyCWL3Tf1z8RPr7Ion7qZ/r353CKCq1GKUccccG5jdtRAycsOm+QFvi 27 | usx3lmHiXeH0wapWLvzU5VEYbK6dybgsg1YJfO6oNKyk9m01QWYgelyqN8VL+ZbM 28 | M/YnwZVvVr/72mRxZulVx85d9GozGN5fD8tX7WyWta5Z8SdLlfwdl1ER0lEW5URa 29 | Tsc86Gg3p6K/lJBJUJOhWQ== 30 | -----END ENCRYPTED PRIVATE KEY----- 31 | -------------------------------------------------------------------------------- /test/ssl/regenerate_test_certificate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | printf "\n\n ======== \e[33muse common name: * \e[0m=========\n\n" 6 | 7 | openssl req -newkey rsa:4096 -nodes -keyout server_key.pem -x509 -days 99999 -out server_cert.pem 8 | cat server_key.pem server_cert.pem >server.pem 9 | 10 | rm -rf demoCA 11 | mkdir demoCA 12 | mkdir demoCA/private 13 | mkdir demoCA/newcerts 14 | touch demoCA/index.txt 15 | 16 | printf "\n\n ======== \e[33muse common name: \"test\" \e[0m=========\n\n" 17 | 18 | openssl req -new -keyout ./demoCA/private/cakey.pem -out ./demoCA/careq.pem -passout pass:test 19 | openssl ca -create_serial -out ./demoCA/cacert.pem -days 99999 -batch -keyfile ./demoCA/private/cakey.pem -selfsign -extensions v3_ca -passin pass:test -infiles ./demoCA/careq.pem 20 | 21 | cp ./demoCA/cacert.pem root_ca_cert.pem 22 | cp ./demoCA/private/cakey.pem root_ca_private.pem 23 | 24 | printf "\n\n ======== \e[33muse common name: * \e[0m=========\n\n" 25 | 26 | openssl req -new -keyout newkey.pem -out newreq.pem -passin pass:test -passout pass:test 27 | 28 | cp newkey.pem peer_private_key.pem 29 | 30 | openssl ca -policy policy_anything -out newcert.pem -days 99999 -passin pass:test -infiles newreq.pem 31 | 32 | cp newcert.pem peer_certificate.pem 33 | 34 | openssl dhparam -outform PEM -out dhparams.pem 4096 35 | 36 | printf "\n\nSUCCESS!\n" 37 | 38 | -------------------------------------------------------------------------------- /test/ssl/root_ca_private.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN ENCRYPTED PRIVATE KEY----- 2 | MIIFHDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIkbi/eMIrF0ECAggA 3 | MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECHdI2UTK7bScBIIEyLxxQR9wz6N6 4 | d/1UA6Y8uFU7gGm53D4ixEe6dJAOQ1djCEs0gt1Ehtf5raKQf+D1KuFSqX4R9ywx 5 | yFwI6Q9IzaUFfYAJmtYmnQszwJqca8Ws3S5ITxd6XQ5iDKwwZL1AxGv+yd3kOZWm 6 | rWogAPI7KkdEZ3YRc//SUFkpHjxVk9HKlwJ3L7SlWbUM/MEeqK2TeG9TEd4xkmcS 7 | Sk5qweO/S2Oe74ry50RnVNTiE7ELraUdlESAdmuTk2POw8/wQBRvmz4m+tHDAyEK 8 | c3A8Qq/oNR30zkSVg7IUgCU6Y0RMtjun6ej9L3pgPQEove+K72QLoi2bfM5HwUeh 9 | DV6PsLH+RSO9cpbJhkObQk3bhTBjlBZGj75BPPmM8ngzWxC/EKD77kdjUF8arBnn 10 | vryymO97Y+I01Z7Y/1abq/uGRmlLVIZRWJ5m8Uwg1tfQFCkS2EyB5efxFzr+C0uU 11 | GKjWFFLCXM+wY4hmhAljcb9UgayNevA0bsvyHuEkE4fbZnyNMnpQj7u/YJv30Jhs 12 | jKe1VmHkJxUrn6m+zoQgBAy+JxLwdPMdU5YaIwSc7n+m4ISQCnZa9E9CE5g/UjYI 13 | wrY9S4CF2sL0oP1mOoWVYngrAtQOITkDdRuP70xSxTt8hQJv99EmKqUP/AtqFBGr 14 | iNkuJJZGqrEiHAFNWRzUd3p4qvpINVuNj3lqeUx1PO0mcZgbIR8H6NTbSLfoHkCl 15 | Vx9wmOa0dqfdqa4yYw6do4iVo7pg7IgE+SRHVETAK/QOgZhcsMkWUiq5mPckMnrV 16 | cRhJYVrqlf5f2zCcCV139AxpDwIpwOHUJC8I1W9PLoVFDP6n7TWzCy9uXdwJ0eLn 17 | M2qC44zig2n5gJApgik9x4awvQD8/6erF9YhiGyjuDrqCDjRlpalB+KZ26rw1Zd/ 18 | jug6DsfRgfDAjRonQVxOy/HVPN+dI5ZZetCQSk5NFmGbGUaYTNwEdyZ3PuRkeTh6 19 | 6F8IaKE/nk1HUialpQryDflmKUI9w/5ry2RruKLj5lTBm1D49DnpRJcaCN3ziDgs 20 | A47vNJa4NjHuc9rDDJC/tw/InCmpv0tDvAtRaYPbQuP9bklcVI0nSw1FcTzyQuQv 21 | 2L5mMQD3cmyGOFSDIW3ux/6EqmPHttrxECrxJppmAv1L18UufT8RNCIgUxaqFdMy 22 | JEiM7WbrcLJXShfdrbfp/gvUxBqDsWHRlg1QPkOzJS6zT5+mbBMMoLctfWt7UQ9v 23 | NV7mZ9GuMF55+qKvliBZ9tzKVNNoVXsSlL6VIEQjs++o7cEG9RPi4hCgpq8U8/j8 24 | 5L63T2mc9kWyQ4e/BNzIp/LjFgaOJNM8lza6JFSHnv/FPdsF58EnihCtYL9a3ryE 25 | a+IVF3GmUOFz32wlr175xpI+kwrzwUMW8o5s7t0UjyKBYbArkCSO8nvlqFQB2aYQ 26 | rVK21AkuPV3py0a/XJ4gKdzea989NX2xCpeB3L5pM6O1+9soCj7PrkuCk5GdM8ys 27 | FbfgCkIBjGO4Lyh75B8/khldbCGVraIGVfO6uvuczYedxa1PEeA2q/c33Jr+Ur1J 28 | DTykLnUa6xV+TYmlbH7+jcmiKV1tugMeeyZ32+OEdwjhdZXvkT+UawfJ/gu7sl3l 29 | VgNSbCQrENnh1ZIV/41s9Q== 30 | -----END ENCRYPTED PRIVATE KEY----- 31 | -------------------------------------------------------------------------------- /test/test_torrents/absolute_filename.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/absolute_filename.torrent -------------------------------------------------------------------------------- /test/test_torrents/backslash_path.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/backslash_path.torrent -------------------------------------------------------------------------------- /test/test_torrents/bad_name.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/bad_name.torrent -------------------------------------------------------------------------------- /test/test_torrents/base.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/base.torrent -------------------------------------------------------------------------------- /test/test_torrents/collection.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/collection.torrent -------------------------------------------------------------------------------- /test/test_torrents/collection2.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/collection2.torrent -------------------------------------------------------------------------------- /test/test_torrents/creation_date.torrent: -------------------------------------------------------------------------------- 1 | d10:created by10:libtorrent13:creation datei1234567e4:infod5:filesld6:lengthi425e4:pathl3:foo7:bar.txteed6:lengthi425e4:pathl3:foo7:var.txteee4:name4:temp12:piece lengthi16384e6:pieces20:01234567890123456789ee -------------------------------------------------------------------------------- /test/test_torrents/dht_nodes.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/dht_nodes.torrent -------------------------------------------------------------------------------- /test/test_torrents/duplicate_files.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/duplicate_files.torrent -------------------------------------------------------------------------------- /test/test_torrents/duplicate_web_seeds.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/duplicate_web_seeds.torrent -------------------------------------------------------------------------------- /test/test_torrents/empty-files-1.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/empty-files-1.torrent -------------------------------------------------------------------------------- /test/test_torrents/empty-files-2.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/empty-files-2.torrent -------------------------------------------------------------------------------- /test/test_torrents/empty-files-3.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/empty-files-3.torrent -------------------------------------------------------------------------------- /test/test_torrents/empty-files-4.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/empty-files-4.torrent -------------------------------------------------------------------------------- /test/test_torrents/empty-files-5.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/empty-files-5.torrent -------------------------------------------------------------------------------- /test/test_torrents/empty_httpseed.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/empty_httpseed.torrent -------------------------------------------------------------------------------- /test/test_torrents/empty_path.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/empty_path.torrent -------------------------------------------------------------------------------- /test/test_torrents/empty_path_multi.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/empty_path_multi.torrent -------------------------------------------------------------------------------- /test/test_torrents/hidden_parent_path.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/hidden_parent_path.torrent -------------------------------------------------------------------------------- /test/test_torrents/httpseed.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/httpseed.torrent -------------------------------------------------------------------------------- /test/test_torrents/invalid_file_size.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/invalid_file_size.torrent -------------------------------------------------------------------------------- /test/test_torrents/invalid_filename.torrent: -------------------------------------------------------------------------------- 1 | d10:created by10:libtorrent13:creation datei1419490173e4:infod5:filesld6:lengthi51200e4:pathl1:feed6:lengthi14336e4:pathl1:.eee4:name5:\est212:piece lengthi16384e6:pieces80:01234567890123456789012345678901234567890123456789012345678901234567890123456789ee -------------------------------------------------------------------------------- /test/test_torrents/invalid_filename2.torrent: -------------------------------------------------------------------------------- 1 | d10:created by10:libtorrent13:creation datei1419490173e4:infod5:filesld6:lengthi51200e4:pathl1:feed6:lengthi14335e4:pathl1:.1:.eed6:lengthi1e4:pathl1:/1:.eee4:name5:\est212:piece lengthi16384e6:pieces80:01234567890123456789012345678901234567890123456789012345678901234567890123456789ee -------------------------------------------------------------------------------- /test/test_torrents/invalid_info.torrent: -------------------------------------------------------------------------------- 1 | d10:created by10:libtorrent13:creation datei1359599503e4:info5:filese -------------------------------------------------------------------------------- /test/test_torrents/invalid_name.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/invalid_name.torrent -------------------------------------------------------------------------------- /test/test_torrents/invalid_name2.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/invalid_name2.torrent -------------------------------------------------------------------------------- /test/test_torrents/invalid_name3.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/invalid_name3.torrent -------------------------------------------------------------------------------- /test/test_torrents/invalid_path_list.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/invalid_path_list.torrent -------------------------------------------------------------------------------- /test/test_torrents/invalid_piece_len.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/invalid_piece_len.torrent -------------------------------------------------------------------------------- /test/test_torrents/invalid_pieces.torrent: -------------------------------------------------------------------------------- 1 | d10:created by10:libtorrent13:creation datei1359599503e4:infod5:filesld6:lengthi425e4:pathl3:foo7:bar.txteed6:lengthi425e4:pathl3:foo7:var.txteee4:name4:temp12:piece lengthi16384e6:piecesi-23eee -------------------------------------------------------------------------------- /test/test_torrents/invalid_symlink.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/invalid_symlink.torrent -------------------------------------------------------------------------------- /test/test_torrents/large.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/large.torrent -------------------------------------------------------------------------------- /test/test_torrents/large_piece_size.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/large_piece_size.torrent -------------------------------------------------------------------------------- /test/test_torrents/long_name.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/long_name.torrent -------------------------------------------------------------------------------- /test/test_torrents/many_pieces.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/many_pieces.torrent -------------------------------------------------------------------------------- /test/test_torrents/missing_path_list.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/missing_path_list.torrent -------------------------------------------------------------------------------- /test/test_torrents/missing_piece_len.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/missing_piece_len.torrent -------------------------------------------------------------------------------- /test/test_torrents/negative_file_size.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/negative_file_size.torrent -------------------------------------------------------------------------------- /test/test_torrents/negative_piece_len.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/negative_piece_len.torrent -------------------------------------------------------------------------------- /test/test_torrents/negative_size.torrent: -------------------------------------------------------------------------------- 1 | d10:created by10:libtorrent13:creation datei1359599503e4:infod6:lengthi-425e4:name4:temp12:piece lengthi16384e6:pieces20:cdcdcdcdcdcdcdcdcdcdee -------------------------------------------------------------------------------- /test/test_torrents/no_creation_date.torrent: -------------------------------------------------------------------------------- 1 | d10:created by10:libtorrent4:infod5:filesld6:lengthi425e4:pathl3:foo7:bar.txteed6:lengthi425e4:pathl3:foo7:var.txteee4:name4:temp12:piece lengthi16384e6:pieces20:01234567890123456789ee -------------------------------------------------------------------------------- /test/test_torrents/no_files.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/no_files.torrent -------------------------------------------------------------------------------- /test/test_torrents/no_name.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/no_name.torrent -------------------------------------------------------------------------------- /test/test_torrents/overlapping_symlinks.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/overlapping_symlinks.torrent -------------------------------------------------------------------------------- /test/test_torrents/pad_file.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/pad_file.torrent -------------------------------------------------------------------------------- /test/test_torrents/pad_file_no_path.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/pad_file_no_path.torrent -------------------------------------------------------------------------------- /test/test_torrents/parent_path.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/parent_path.torrent -------------------------------------------------------------------------------- /test/test_torrents/sample.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/sample.torrent -------------------------------------------------------------------------------- /test/test_torrents/similar.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/similar.torrent -------------------------------------------------------------------------------- /test/test_torrents/similar2.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/similar2.torrent -------------------------------------------------------------------------------- /test/test_torrents/single_multi_file.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/single_multi_file.torrent -------------------------------------------------------------------------------- /test/test_torrents/slash_path.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/slash_path.torrent -------------------------------------------------------------------------------- /test/test_torrents/slash_path2.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/slash_path2.torrent -------------------------------------------------------------------------------- /test/test_torrents/slash_path3.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/slash_path3.torrent -------------------------------------------------------------------------------- /test/test_torrents/string.torrent: -------------------------------------------------------------------------------- 1 | 10:libtorrent -------------------------------------------------------------------------------- /test/test_torrents/symlink1.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/symlink1.torrent -------------------------------------------------------------------------------- /test/test_torrents/symlink2.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/symlink2.torrent -------------------------------------------------------------------------------- /test/test_torrents/symlink_zero_size.torrent: -------------------------------------------------------------------------------- 1 | d10:created by10:libtorrent13:creation datei1359599503e4:infod5:filesld6:lengthi425e4:pathl1:a1:b3:bareed4:attr1:l4:pathl1:a1:b3:fooe12:symlink pathl1:a1:b3:bareee4:name4:temp12:piece lengthi16384e6:pieces20:aaaaaaaaaaaaaaaaaaaaee -------------------------------------------------------------------------------- /test/test_torrents/unaligned_pieces.torrent: -------------------------------------------------------------------------------- 1 | d10:created by10:libtorrent13:creation datei1359599503e4:infod5:filesld6:lengthi425e4:pathl3:foo7:bar.txteed6:lengthi425e4:pathl3:foo7:var.txteee4:name4:temp12:piece lengthi16384e6:pieces24:012345678901234567890123ee -------------------------------------------------------------------------------- /test/test_torrents/unordered.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/unordered.torrent -------------------------------------------------------------------------------- /test/test_torrents/url_list.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/url_list.torrent -------------------------------------------------------------------------------- /test/test_torrents/url_list2.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/url_list2.torrent -------------------------------------------------------------------------------- /test/test_torrents/url_list3.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/url_list3.torrent -------------------------------------------------------------------------------- /test/test_torrents/url_seed.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/url_seed.torrent -------------------------------------------------------------------------------- /test/test_torrents/url_seed_multi.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/url_seed_multi.torrent -------------------------------------------------------------------------------- /test/test_torrents/url_seed_multi_single_file.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/url_seed_multi_single_file.torrent -------------------------------------------------------------------------------- /test/test_torrents/url_seed_multi_space.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/url_seed_multi_space.torrent -------------------------------------------------------------------------------- /test/test_torrents/url_seed_multi_space_nolist.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/url_seed_multi_space_nolist.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_bad_file_alignment.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_bad_file_alignment.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_deep_recursion.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_deep_recursion.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_empty_file.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_empty_file.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_empty_filename.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_empty_filename.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_hybrid-missing-tailpad.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_hybrid-missing-tailpad.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_hybrid.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_hybrid.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_incomplete_piece_layer.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_incomplete_piece_layer.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_invalid_file.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_invalid_file.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_invalid_filename.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_invalid_filename.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_invalid_filename2.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_invalid_filename2.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_invalid_pad_file.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_invalid_pad_file.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_invalid_piece_layer.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_invalid_piece_layer.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_invalid_piece_layer_root.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_invalid_piece_layer_root.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_invalid_piece_layer_size.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_invalid_piece_layer_size.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_invalid_root_hash.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_invalid_root_hash.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_large_file.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_large_file.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_large_offset.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_large_offset.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_mismatching_metadata.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_mismatching_metadata.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_missing_file_root_invalid_symlink.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_missing_file_root_invalid_symlink.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_multipiece_file.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_multipiece_file.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_multiple_files.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_multiple_files.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_no_piece_layers.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_no_piece_layers.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_no_power2_piece.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_no_power2_piece.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_non_multiple_piece_layer.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_non_multiple_piece_layer.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_only.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_only.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_overlong_integer.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_overlong_integer.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_piece_layer_invalid_file_hash.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_piece_layer_invalid_file_hash.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_piece_size.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_piece_size.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_symlinks.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_symlinks.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_unknown_piece_layer_entry.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_unknown_piece_layer_entry.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_unordered_files.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_unordered_files.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_zero_root.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/v2_zero_root.torrent -------------------------------------------------------------------------------- /test/test_torrents/v2_zero_root_small.torrent: -------------------------------------------------------------------------------- 1 | d8:announce27:http://example.com/announce4:infod9:file treed7:test1MBd0:d6:lengthi32768e11:pieces root32:eee12:meta versioni2e4:name7:test1MB12:piece lengthi65536ee12:piece layersdee -------------------------------------------------------------------------------- /test/test_torrents/whitespace_url.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/test_torrents/whitespace_url.torrent -------------------------------------------------------------------------------- /test/test_torrents/zero.torrent: -------------------------------------------------------------------------------- 1 | d10:created by10:libtorrent13:creation datei1359599503e4:infod6:lengthi0e4:name4:temp12:piece lengthi16384e6:pieces0:ee -------------------------------------------------------------------------------- /test/test_torrents/zero2.torrent: -------------------------------------------------------------------------------- 1 | d8:announce41:udp://tracker.opentracker.com:80/announce13:announce-listll41:udp://tracker.opentracker.com:80/announceel32:tracker.publicbt.com:80/announceee7:comment14:sample comment10:created by10:libtorrent13:creation datei1418787579e4:infod5:filesld6:lengthi0e4:pathl14:text_file2.txteed4:attr1:p6:lengthi0e4:pathl17:.____padding_file1:0eed6:lengthi0e4:pathl13:text_file.txte4:sha120:ababababababababababee4:name6:sample12:piece lengthi16384e6:pieces0:ee -------------------------------------------------------------------------------- /test/udp_tracker.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2014, 2017, 2019, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "test.hpp" // for EXPORT 34 | #include "libtorrent/address.hpp" 35 | 36 | // returns the port the udp tracker is running on 37 | int EXPORT start_udp_tracker(lt::address iface 38 | = lt::address_v4::any()); 39 | 40 | // the number of udp tracker announces received 41 | int EXPORT num_udp_announces(); 42 | 43 | void EXPORT stop_udp_tracker(); 44 | 45 | -------------------------------------------------------------------------------- /test/valgrind_suppressions.txt: -------------------------------------------------------------------------------- 1 | { 2 | openssl_asn_uninitialized_length 3 | Memcheck:Cond 4 | fun:ASN1_STRING_set 5 | fun:ASN1_mbstring_ncopy 6 | fun:ASN1_mbstring_copy 7 | fun:ASN1_STRING_to_UTF8 8 | } 9 | -------------------------------------------------------------------------------- /test/zeroes.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arvidn/libtorrent/2e16847613497a033d005076330adc264471b3fa/test/zeroes.gz -------------------------------------------------------------------------------- /tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(dht dht_put.cpp) 2 | target_link_libraries(dht PRIVATE torrent-rasterbar) 3 | 4 | add_executable(dht_sample dht_sample.cpp) 5 | target_link_libraries(dht_sample PRIVATE torrent-rasterbar) 6 | 7 | add_executable(session_log_alerts session_log_alerts.cpp) 8 | target_link_libraries(session_log_alerts PRIVATE torrent-rasterbar) 9 | -------------------------------------------------------------------------------- /tools/Jamfile: -------------------------------------------------------------------------------- 1 | import modules ; 2 | 3 | BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ; 4 | 5 | use-project /torrent : .. ; 6 | 7 | if $(BOOST_ROOT) 8 | { 9 | use-project /boost : $(BOOST_ROOT) ; 10 | } 11 | 12 | rule link_libtorrent ( properties * ) 13 | { 14 | local result ; 15 | if shared in $(properties) 16 | { 17 | result += 18 | /torrent//torrent/shared/shared ; 19 | } 20 | else 21 | { 22 | result += 23 | /torrent//torrent/static/static ; 24 | } 25 | return $(result) ; 26 | } 27 | 28 | project tools 29 | : requirements 30 | multi 31 | # disable warning C4275: non DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' 32 | msvc:/wd4275 33 | # C4268: 'identifier' : 'const' static/global data initialized 34 | # with compiler generated default constructor fills the object with zeros 35 | msvc:/wd4268 36 | @link_libtorrent 37 | : default-build 38 | static 39 | 14 40 | 64 41 | ; 42 | 43 | exe dht : dht_put.cpp : ../ed25519/src ; 44 | exe dht-sample : dht_sample.cpp : ../ed25519/src ; 45 | exe session_log_alerts : session_log_alerts.cpp ; 46 | exe disk_io_stress_test : disk_io_stress_test.cpp ; 47 | exe checking_benchmark : checking_benchmark.cpp ; 48 | 49 | -------------------------------------------------------------------------------- /tools/cibuildwheel/manylinux/build-openssl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Top-level build script called from Dockerfile 3 | 4 | # Stop at any error, show all commands 5 | set -exuo pipefail 6 | 7 | # Get script directory 8 | MY_DIR=$(dirname "${BASH_SOURCE[0]}") 9 | 10 | # Get build utilities 11 | source $MY_DIR/build_utils.sh 12 | 13 | # Install a more recent openssl 14 | check_var ${OPENSSL_ROOT} 15 | check_var ${OPENSSL_HASH} 16 | check_var ${OPENSSL_DOWNLOAD_URL} 17 | 18 | OPENSSL_VERSION=${OPENSSL_ROOT#*-} 19 | OPENSSL_MIN_VERSION=1.1.1 20 | 21 | # || test $? -eq 141 is there to ignore SIGPIPE with set -o pipefail 22 | # c.f. https://stackoverflow.com/questions/22464786/ignoring-bash-pipefail-for-error-code-141#comment60412687_33026977 23 | INSTALLED=$((openssl version | head -1 || test $? -eq 141) | awk '{ print $2 }') 24 | SMALLEST=$(echo -e "${INSTALLED}\n${OPENSSL_MIN_VERSION}" | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n | head -1 || test $? -eq 141) 25 | 26 | # Ignore letters in version numbers 27 | if [ "${SMALLEST}" = "${OPENSSL_MIN_VERSION}" ]; then 28 | echo "skipping installation of openssl ${OPENSSL_VERSION}, system provides openssl ${INSTALLED} which is newer than openssl ${OPENSSL_MIN_VERSION}" 29 | exit 0 30 | fi 31 | 32 | if which yum; then 33 | yum erase -y openssl-devel 34 | elif which apk; then 35 | apk del openssl-dev 36 | else 37 | apt-get remove -y libssl-dev 38 | fi 39 | 40 | fetch_source ${OPENSSL_ROOT}.tar.gz ${OPENSSL_DOWNLOAD_URL} 41 | check_sha256sum ${OPENSSL_ROOT}.tar.gz ${OPENSSL_HASH} 42 | tar -xzf ${OPENSSL_ROOT}.tar.gz 43 | pushd ${OPENSSL_ROOT} 44 | ./config no-shared --prefix=/usr/local/ssl --openssldir=/usr/local/ssl CPPFLAGS="${MANYLINUX_CPPFLAGS}" CFLAGS="${MANYLINUX_CFLAGS} -fPIC" CXXFLAGS="${MANYLINUX_CXXFLAGS} -fPIC" LDFLAGS="${MANYLINUX_LDFLAGS} -fPIC" > /dev/null 45 | make > /dev/null 46 | make install_sw > /dev/null 47 | popd 48 | rm -rf ${OPENSSL_ROOT} ${OPENSSL_ROOT}.tar.gz 49 | 50 | 51 | /usr/local/ssl/bin/openssl version 52 | -------------------------------------------------------------------------------- /tools/cibuildwheel/manylinux/openssl-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export OPENSSL_ROOT=openssl-1.1.1l 4 | export OPENSSL_HASH=0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1 5 | export OPENSSL_DOWNLOAD_URL=https://www.openssl.org/source 6 | -------------------------------------------------------------------------------- /tools/cibuildwheel/manylinux/update-scripts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | set -x 5 | 6 | D=$(dirname $0) 7 | 8 | curl -o "$D/build_utils.sh" https://raw.githubusercontent.com/pypa/manylinux/main/docker/build_scripts/build_utils.sh 9 | chmod +x "$D/build_utils.sh" 10 | curl -o "$D/build-openssl.sh" https://raw.githubusercontent.com/pypa/manylinux/main/docker/build_scripts/build-openssl.sh 11 | chmod +x "$D/build-openssl.sh" 12 | curl https://raw.githubusercontent.com/pypa/manylinux/main/docker/Dockerfile | { 13 | echo "#!/bin/bash" 14 | echo 15 | grep OPENSSL_ | sed 's/.*\(OPENSSL_[^=]*=[^ ]*\).*/export \1/g' 16 | } > "$D/openssl-version.sh" 17 | -------------------------------------------------------------------------------- /tools/cibuildwheel/setup_boost.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script is meant to be called by cibuildwheel. It should run on github 4 | # actions Linux, Mac and Windows. 5 | 6 | set -ex 7 | 8 | VERSION="$1" 9 | BOOST_ROOT="$2" 10 | 11 | VUNDER="${VERSION//./_}" 12 | 13 | TEMP_ARCHIVE="$(mktemp)" 14 | 15 | mkdir -p "$BOOST_ROOT" 16 | 17 | curl -L -o "$TEMP_ARCHIVE" "https://archives.boost.io/release/${VERSION}/source/boost_${VUNDER}.tar.gz" 18 | 19 | tar -z -x -C "$BOOST_ROOT" -f "$TEMP_ARCHIVE" --strip-components 1 20 | rm "$TEMP_ARCHIVE" 21 | 22 | cd "$BOOST_ROOT" 23 | 24 | ./bootstrap.sh 25 | 26 | cat ./project-config.jam 27 | 28 | ./b2 headers 29 | -------------------------------------------------------------------------------- /tools/cibuildwheel/setup_ccache_on_manylinux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -xe 4 | 5 | if [ $(uname -m) != x86_64 -a $(uname -m) != aarch64 ] 6 | then 7 | echo "ccache isn't known to exist on $(uname -m). skipping ccache setup" 8 | exit 0 9 | fi 10 | 11 | yum install -y epel-release # overlay containing ccache 12 | yum install -y ccache 13 | 14 | # The symlinks in /usr/lib64/ccache are auto-managed by rpm postinstall 15 | # scripts. They are only created if appropriate packages are installed. However 16 | # this management only knows about the standard gcc* packages, not the 17 | # devtoolset packages, so they don't get created correctly on manylinux. We try 18 | # to create them ourselves. 19 | mkdir -p /usr/local/ccache/bin 20 | for path in /opt/rh/devtoolset-*/root/usr/bin/*cc /opt/rh/devtoolset-*/root/usr/bin/*cc-[0-9]* /opt/rh/devtoolset-*/root/usr/bin/*++ /opt/rh/devtoolset-*/root/usr/bin/*++-[0-9]* /opt/rh/devtoolset-*/root/usr/bin/*cpp /opt/rh/devtoolset-*/root/usr/bin/*cpp-[0-9]* 21 | do 22 | ln -s /usr/bin/ccache "/usr/local/ccache/bin/$(basename "$path")" 23 | done 24 | -------------------------------------------------------------------------------- /tools/cibuildwheel/setup_openssl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -xe 4 | 5 | TOOLS=$(dirname "$(readlink -f "$0")") 6 | 7 | . "$TOOLS/manylinux/openssl-version.sh" 8 | manylinux-entrypoint "$TOOLS/manylinux/build-openssl.sh" 9 | 10 | # If the build script finds a new enough openssl on the system, it will skip building. 11 | 12 | if [ -d /usr/local/ssl ] 13 | then 14 | ln -s /usr/local/ssl/include/openssl /usr/local/include 15 | ln -s /usr/local/ssl/lib/libcrypto.a /usr/local/lib 16 | ln -s /usr/local/ssl/lib/libssl.a /usr/local/lib 17 | fi 18 | -------------------------------------------------------------------------------- /tools/dht_flood.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 3 | 4 | import socket 5 | import sys 6 | from types import StringType, IntType, LongType, DictType, ListType, TupleType 7 | import random 8 | 9 | port = int(sys.argv[1]) 10 | 11 | # from BitTorrent 4.3.0 12 | 13 | 14 | def encode_bencached(x, r): 15 | r.append(x.bencoded) 16 | 17 | 18 | def encode_int(x, r): 19 | r.extend(('i', str(x), 'e')) 20 | 21 | 22 | def encode_string(x, r): 23 | r.extend((str(len(x)), ':', x)) 24 | 25 | 26 | def encode_list(x, r): 27 | r.append('l') 28 | for i in x: 29 | encode_func[type(i)](i, r) 30 | r.append('e') 31 | 32 | 33 | def encode_dict(x, r): 34 | r.append('d') 35 | ilist = sorted(x.items()) 36 | for k, v in ilist: 37 | r.extend((str(len(k)), ':', k)) 38 | encode_func[type(v)](v, r) 39 | r.append('e') 40 | 41 | 42 | encode_func = {} 43 | encode_func[IntType] = encode_int 44 | encode_func[LongType] = encode_int 45 | encode_func[StringType] = encode_string 46 | encode_func[ListType] = encode_list 47 | encode_func[TupleType] = encode_list 48 | encode_func[DictType] = encode_dict 49 | 50 | 51 | def bencode(x): 52 | r = [] 53 | encode_func[type(x)](x, r) 54 | return ''.join(r) 55 | 56 | 57 | def send_dht_message(msg): 58 | s.sendto(bencode(msg), 0, ('127.0.0.1', port)) 59 | 60 | 61 | def random_key(): 62 | ret = '' 63 | for i in range(0, 20): 64 | ret += chr(random.randint(0, 255)) 65 | return ret 66 | 67 | 68 | s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 69 | node_id = '1' * 20 70 | query = 'get_peers' 71 | 72 | print('test random info-hashes') 73 | for i in range(1, 30000): 74 | send_dht_message({'a': {'id': node_id, 'info_hash': random_key()}, 'q': query, 'y': 'q', 't': '%d' % i}) 75 | 76 | print('test random peer-ids') 77 | for i in range(1, 30000): 78 | send_dht_message({'a': {'id': random_key(), 'info_hash': random_key()}, 'q': query, 'y': 'q', 't': '%d' % i}) 79 | -------------------------------------------------------------------------------- /tools/gen_convenience_header.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 3 | 4 | import os 5 | from pathlib import Path 6 | 7 | excludes = ['libtorrent.hpp', 'storage.hpp', 'io_service.hpp'] 8 | 9 | os.remove('include/libtorrent/libtorrent.hpp') 10 | with open('include/libtorrent/libtorrent.hpp', 'w+') as f: 11 | f.write(''' 12 | // This header is generated by tools/gen_convenience_header.py 13 | 14 | ''') 15 | 16 | for fn in os.popen('git ls-files include/libtorrent/*.hpp include/libtorrent/kademlia/*.hpp include/libtorrent/extensions/*.hpp'): 17 | 18 | fn = Path(fn.strip()) 19 | 20 | if fn.name in excludes: continue 21 | 22 | f.write('#include "%s"\n' % fn.relative_to('include')) 23 | -------------------------------------------------------------------------------- /tools/parse_dht_rtt.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 3 | 4 | from __future__ import print_function 5 | 6 | import sys 7 | import os 8 | 9 | quantize = 100 10 | max_rtt = 5000 11 | 12 | f = open(sys.argv[1]) 13 | distribution = {} 14 | num_messages = 0 15 | 16 | for i in range(0, max_rtt, quantize): 17 | distribution[i] = 0 18 | 19 | for line in f: 20 | time = int(line.split('\t')[1]) 21 | if (time < 0 or time > max_rtt - quantize): 22 | continue 23 | num_messages += 1 24 | time //= quantize 25 | time *= quantize 26 | distribution[time] += 1 27 | 28 | f = open('round_trip_distribution.log', 'w+') 29 | 30 | for k, v in list(distribution.items()): 31 | print('%f %d' % ((k + (quantize / 2)) / 1000.0, v), file=f) 32 | f.close() 33 | 34 | f = open('round_trip_distribution.gnuplot', 'w+') 35 | 36 | f.write(''' 37 | set term png size 1200,700 38 | set title "Message round trip times" 39 | set terminal postscript 40 | set ylabel "# of requests" 41 | set xlabel "Round trip time (seconds)" 42 | set xrange [0:*] 43 | set grid 44 | set style fill solid border -1 pattern 2 45 | set output "round_trip_distribution.ps" 46 | set boxwidth %f 47 | plot "round_trip_distribution.log" using 1:2 title "requests" with boxes 48 | 49 | set terminal png small 50 | set output "round_trip_distribution.png" 51 | replot 52 | ''' % (float(quantize) / 1000.0)) 53 | f.close() 54 | 55 | os.system('gnuplot round_trip_distribution.gnuplot') 56 | -------------------------------------------------------------------------------- /tools/run_tests.sh: -------------------------------------------------------------------------------- 1 | set -ex 2 | 3 | cd test 4 | b2 -l300 link=static deprecated-functions=on,off crypto=openssl,built-in 5 | 6 | cd ../simulation 7 | b2 -l300 link=static 8 | 9 | cd ../examples 10 | b2 link=static deprecated-functions=on,off crypto=openssl 11 | 12 | cd ../tools 13 | b2 link=static deprecated-functions=on,off crypto=openssl 14 | 15 | cd ../docs 16 | make spell-check 17 | 18 | cd ../bindings/python 19 | b2 stage_module stage_dependencies 20 | LD_LIBRARY_PATH=./dependencies python3 test.py 21 | 22 | -------------------------------------------------------------------------------- /tools/sanitizer-blacklist.txt: -------------------------------------------------------------------------------- 1 | # this function relies on implicit integer truncation 2 | fun:_ZN5boost6detail10crc_helper*index* 3 | fun:_ZN3std*mersenne_twister_engine* 4 | 5 | -------------------------------------------------------------------------------- /tools/update_copyright.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 3 | 4 | import glob 5 | import copyright 6 | import os 7 | 8 | 9 | def update_file(name): 10 | if os.path.split(name)[1] in ['puff.cpp', 'puff.hpp', 'sha1.cpp', 'sha1.hpp', 'route.h']: 11 | return 12 | 13 | new_header = copyright.get_authors(name) 14 | subst = '' 15 | f = open(name) 16 | 17 | substitution_state = 0 18 | added = False 19 | found = False 20 | for line in f: 21 | if line.strip() == '/*': 22 | substitution_state += 1 23 | elif substitution_state == 1: 24 | if line.strip().lower().startswith('copyright'): 25 | # remove the existing copyright 26 | found = True 27 | existing_author = line.split(',')[-1] 28 | if existing_author in new_header or existing_author.strip() == 'Not Committed Yet': 29 | continue 30 | print('preserving: %s' % line) 31 | elif not added and found: 32 | subst += new_header 33 | added = True 34 | elif line.strip() == '*/': 35 | substitution_state += 1 36 | 37 | subst += line 38 | 39 | f.close() 40 | open(name, 'w+').write(subst) 41 | 42 | 43 | for i in glob.glob('src/*.cpp') + \ 44 | glob.glob('include/libtorrent/*.hpp') + \ 45 | glob.glob('include/libtorrent/aux_/*.hpp') + \ 46 | glob.glob('include/libtorrent/extensions/*.hpp') + \ 47 | glob.glob('include/libtorrent/kademlia/*.hpp') + \ 48 | glob.glob('src/kademlia/*.cpp') + \ 49 | glob.glob('examples/*.cpp') + \ 50 | glob.glob('examples/*.hpp') + \ 51 | glob.glob('tools/*.cpp') + \ 52 | glob.glob('test/*.cpp') + \ 53 | glob.glob('test/*.hpp') + \ 54 | glob.glob('fuzzers/src/*.cpp') + \ 55 | glob.glob('fuzzers/src/*.hpp'): 56 | update_file(i) 57 | --------------------------------------------------------------------------------