अपना खुद का BitTorrent बनाएं
(app.codecrafters.io)- CodeCrafters का BitTorrent challenge P2P फ़ाइल शेयरिंग प्रोटोकॉल को खुद implement करके सार्वजनिक रूप से उपलब्ध फ़ाइल डाउनलोड करने की प्रक्रिया कवर करता है
- सीखने का flow bencode decoding से शुरू होकर .torrent फ़ाइल parsing, info hash calculation, peer discovery, handshake और piece download तक जाता है
- यह बेसिक BitTorrent के 11 steps और Magnet Links के 8 steps मिलाकर कुल 19 steps से बना है
- Step structure और instructions मुफ्त में देखे जा सकते हैं, लेकिन code submission और solutions देखने के लिए CodeCrafters Membership चाहिए
- अगर पहले मुफ्त में try करना चाहते हैं, तो इस महीने का free challenge Build your own Shell चुन सकते हैं
BitTorrent client implementation का लक्ष्य
- Build your own BitTorrent BitTorrent को बड़े पैमाने पर data distribution के लिए P2P फ़ाइल शेयरिंग प्रोटोकॉल के रूप में देखते हुए, उसे खुद implement करने वाला CodeCrafters challenge है
- अंतिम लक्ष्य BitTorrent protocol से सार्वजनिक रूप से उपलब्ध फ़ाइलें डाउनलोड कर सकने वाला BitTorrent client बनाना है
- इस प्रक्रिया में BitTorrent protocol और .torrent फ़ाइल के काम करने का तरीका भी सीखते हैं
Steps की संरचना और difficulty
-
बेसिक BitTorrent steps
- bencode decoding से लेकर torrent file processing, peer connection और file download तक क्रम से implement किया जाता है
- Decode bencoded strings: Very easy
- Decode bencoded integers: Easy
- Decode bencoded lists: Easy
- Decode bencoded dictionaries: Easy
- Parse torrent file: Easy
- Calculate info hash: Medium
- Piece hashes: Easy
- Discover peers: Medium
- Peer handshake: Medium
- Download a piece: Hard
- Download the whole file: Hard
-
Magnet Links steps
- magnet link parsing से शुरू होकर extension handshake, metadata exchange, piece और पूरी file download तक कवर करता है
- Parse magnet link: Easy
- Announce extension support: Easy
- Send extension handshake: Easy
- Receive extension handshake: Easy
- Request metadata: Easy
- Receive metadata: Easy
- Download a piece: Hard
- Download the whole file: Hard
उपयोग की शर्तें
- इस challenge के लिए CodeCrafters Membership चाहिए
- पूरी challenge structure और step instructions मुफ्त में सीखी जा सकती हैं
- code submission और solutions देखने के लिए membership चाहिए
- अगर आप free challenge चाहते हैं, तो इस महीने मुफ्त में उपलब्ध Build your own Shell try कर सकते हैं
1 टिप्पणियां
Hacker News की राय
नमस्ते! मैं Sarp हूं, Codecrafters का Build your own BitTorrent challenge बनाने वाला
थोड़ा background बताऊं तो, FAANG वाली नौकरी से layoff होने के बाद वापस जाने की इच्छा लगभग नहीं थी, और मैंने coding में रुचि फिर से जगाने के लिए मजेदार programming projects ढूंढने शुरू किए
digital nomad lifestyle के दौरान Nomadlist पर Codecrafters मिला, और code को Git में push करके step-by-step tests पास करने का तरीका मुझे पसंद आया। gamified progression ने focus करने में मदद की, और SQLite, Git, Redis जैसे इस्तेमाल किए हुए software को और गहराई से समझ पाया। challenge करने के लिए मैंने Go भी नए सिरे से सीखा
site के सारे challenges खत्म करने के बाद जब करने को कुछ नहीं बचा, तो बहुत votes मिले ideas में से एक, BitTorrent client, बनाने का फैसला किया
BitTorrent client बनाते हुए BitTorrent protocol, torrent file structure, encoding issues, network request pipelining, binary values की URL encoding, Go के channels का इस्तेमाल आदि बहुत कुछ सीखा
challenge पर feedback लेना चाहता हूं, और सवालों के जवाब देने में भी खुशी होगी
ऐसा कुछ post हुआ है, यह रोचक है, और आगे बढ़ने में शायद मदद भी करे
Cargo.tomlमें dependencies add न कर पाने से थोड़ी निराशा हुईbencode challenge के कुछ हिस्सों को nom से हल करके देखना चाहता था; शायद यह overkill choice होती, लेकिन मजे के लिए try करना था, और फिलहाल यह संभव नहीं है
अगर remote builder के load या runtime की चिंता है, तो इस issue से बचने के लिए test cases locally run करने का तरीका मिल जाए तो अच्छा होगा
Jon Gjengset[1] अभी अपने YT channel[2] पर वही challenge Rust में live coding कर रहे हैं
[1]: https://thesquareplanet.com/
[2]: https://www.youtube.com/watch?v=jSTkEPPiULs
बेहतर link https://www.youtube.com/watch?v=jf_ddGnum_4 है, इसमें chapters हैं और बीच वाला power outage वाला हिस्सा भी काट दिया गया है :p
[0] https://www.twitch.tv/videos/1954769913
समझ नहीं आता login की जरूरत क्यों है। क्या यह paid tutorial है?
free tutorials यहां हैं
JS - https://allenkim67.github.io/programming/2016/05/04/how-to-m...
GO - https://blog.jse.li/posts/torrent/
Python - https://markuseliasson.se/article/bittorrent-in-python/
https://github.com/codecrafters-io/build-your-own-x
आखिर बिना किसी explanation के मेरे GitHub account access permission क्यों मांगे जा रहे हैं, समझ नहीं आता
फिर भी इसकी जरूरत क्यों है, यह explain करना चाहिए
अजीब बात है कि upload वाला हिस्सा गायब है। अगर यह peer है, तो बराबर का participant होने के नाते data दोनों दिशाओं में बहना चाहिए। वरना BitTorrent काम नहीं करेगा
upload feature को challenge extension के रूप में जोड़ने की योजना है, और यह community में सबसे ज़्यादा votes पाने वाले extension ideas में से एक है
अभी supported नहीं है, लेकिन जल्द उपलब्ध होगा, और नए extensions user votes के आधार पर जोड़े जा रहे हैं
अगर आप JavaScript इस्तेमाल करते हैं, तो Feross का बनाया WebTorrent है, जिसने protocol को browser tab के अंदर ला दिया
codebase पढ़ने में सचमुच अच्छा है। कई developers code पढ़ने की तुलना में code लिखने में बेहतर होते हैं; अगर आप code reading skill को ट्रेन करना चाहते हैं, तो शुरुआत के लिए WebTorrent codebase जितनी अच्छी जगहें मैंने कम देखी हैं। पढ़ने के मज़े के मामले में मैं इसे redis जैसी league में रखता हूँ
https://github.com/webtorrent/webtorrent
यह idea मुझे बहुत पसंद आया! पहले मैं Erlang सीखना चाहता था और मेरा दोस्त Crystal सीखना चाहता था, तो हमने सोचा कि पूरी तरह custom clients बनाकर एक-दूसरे के साथ files share कर सकें
जब basic protocol और कुछ extensions के साथ files भेजना-पाना संभव हुआ, तो बहुत मज़ा आया। उन extensions को BEP कहना सही है न?
नई language सीखने के तरीकों में शायद यह मेरा सबसे पसंदीदा तरीका है, क्योंकि यह समझने और implement करने के लिए पर्याप्त सरल है
साल दर साल मुझे excite करने वाले छोटे project ideas कम होते जा रहे हैं, और यह उनमें से एक है
CodeCrafters के बारे में पहली बार सुना, लेकिन database बनाने जैसे academic challenge ideas मुझे पसंद आए। compiler बनाना भी शामिल हो जाए तो अच्छा होगा
https://twitter.com/codecraftersio/status/168850373608654028...
Go में BitTorrent client बनाने वाला article याद आया: https://blog.jse.li/posts/torrent/
कुछ साल पहले पिछली job में, हमने कर्मचारियों के लिए सस्ते netbooks पर इस्तेमाल करने योग्य custom Linux live OS बनाया और support किया था
updates distribute करने के लिए हमने internal torrent server scratch से बनाया, और image updates distribute करने में उसका इस्तेमाल किया
standards के मुताबिक software बनाने और उसे default clients के साथ काम कराने का यह मेरे शुरुआती अनुभवों में से एक था, इसलिए यह अच्छा learning process था