This project is a simple UDP-based tracker for BitTorrent files. It connects to a torrent tracker, retrieves a list of peers, and can be extended to download files using the retrieved peers.
- Connects to a specified torrent tracker using UDP.
- Retrieves a list of peers for the given torrent file.
- Supports both single-file and multi-file torrents.
- Generates a unique peer ID for identification.
- Can be extended to download files from peers.
- Node.js (version 14 or later)
- npm (Node package manager)
-
Clone the repository:
git clone https://github.com/yourusername/torrent-peer-tracker.git cd torrent-peer-tracker -
Install the required dependencies:
npm install
-
Place your
.torrentfile in the root directory of the project. -
Run the tracker with the following command, replacing
yourfile.torrentwith the name of your torrent file:node index.js yourfile.torrent
-
The program will output the list of peers connected to the torrent.
- src/tracker.js: Contains the logic for connecting to the tracker, sending requests, and processing responses.
- src/utils.js: Provides utility functions, including generating a unique peer ID.
- src/torrent-parser.js: Handles parsing of the torrent file and extracting necessary information such as size and info hash.
- index.js: The entry point of the application that initializes the tracker and starts the peer retrieval process.
Contributions are welcome! If you have suggestions for improvements or new features, please open an issue or submit a pull request.