GithubHelp home page GithubHelp logo

fiav1 / bugtorrent Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 2.0 104 KB

BugTorrent - P2P UNIFE Network Project based on BitTorrent

License: MIT License

Python 100.00%
p2p unife bugtorrent bittorrent p2p-network

bugtorrent's Introduction

BugTorrent

📚 Reti Peer To Peer - Università degli Studi di Ferrara 📚

A peer-to-peer server based on BitTorrent's approach:

Efficient fetching, preventing flooding

Parallel parts

  • Focused on efficient fetching, not searching
  • Preventing free-loading
  • Divide large file into many pieces
  • Allows simultaneous downloading

Peers

  • Peers login to a tracker in order to share and download a file

Tracker

  • Handle connected peers, giving infos about the file and who got the parts peers are interested in

Chunks

Solution to chunk request: random selection and rarest chunk first:

  • Avoid starvation when some peers depart
  • Avoid starvation across all peers wanting a file
  • Balance load by equalizing # of copies of chunks

Free-riding

Vast majority of users are free-riders (download and leave the system / limited bandwidth); solution:

  • Peer has limited upload bandwidth and must share it among multiple peers
  • Prioritizing the upload bandwidth
  • A few "peers" essentially act as servers
  • Allow the fastest peers to download from you and occasionally let some free loaders download

Usage

python3 BugTorrent.py

Note: Python 3.6 or above is required

Peer's supported commands:

[xxxB] = the parameter length in bytes

# Login
LOGI[4B].IPP2P[55B].PP2P[5B]
# Response will be
ALGI[4B].SessionID[16B]

# Add a file
ADDR[4B].SessionID[16B].LenFile[10B].LenPart[6B].Filename[100B].Filemd5[32B]
# Response will be
AADR[4B].#part[8B]

# Find a file
1) LOOK[4B].SessionID[16B].Ricerca[20B]
2) FCHU[4B].SessionID[16B].Filemd5[32B]
# Response will be
1) ALOO[4B].\#idmd5[3B].{Filemd5_i[32B].Filename_i[100B].LenFile[10B].LenPart[6B]}(i=1..\#idmd5)
2) AFCH[4B].\#hitpeer[3B].{IPP2P_i[55B].PP2P_i[5B].PartList_i[8bit][\#part8]}(i=1..\#hitpeer)

# Search a file
QUER[4B].Pktid[16B].IPP2P[55B].PP2P[5B].TTL[2B].Ricerca[20B]
# Response will be
AQUE[4B].Pktid[16B].IPP2P[55B].PP2P[5B].Filemd5[32B].Filename[100B]

# Download a file
1) RETP[4B].Filemd5[32B].PartNum[8B]
2) RPAD[4B].SessionID[16B].Filemd5[32B].PartNum[8B]
# Response will be
1) AREP[4B].\#chunk[6B].{Lenchunk_i[5B].data[LB]}(i=1..\#chunk)
2) APAD[4B].\#Part[8B]

# Logout
LOGO[4B].SessionID[16B]
# Response will be
1) NLOG[4B].\#partdown[10B]
2) ALOG[4B].\#partown[10B]

Authors 🚀

Enjoy 😎

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.