BitTorrent client for P2P filesharing¶
Download desired contents:
A
LocalFileDataSource
created and stored within the local graph store contains a torrent_file_nameInformational
. This refers to the torrent containing the location of the desired contents on the BitTorrent. Atorrent
is used to locate files on the File System [ BEP 3 ]. ADataSource
defines attributes about the contents that it represents.
Module
t
describes theDataSource
attributes:def owm_data(ns): ns.context.add_import(ConnectomeCSVDataSource.definition_context) ns.context(ConnectomeCSVDataSource)( key = '2000_connections', csv_file_name = 'connectome.csv', torrent_file_name = 'd9da5ce947c6f1c127dfcdc2ede63320.torrent' )
The
DataSource
can be created and stored on the local graph with:$ owm save t
The
DataSource
identifier can be used to see contents stored in the local graph with:$ owm source show ConnectomeCSVDataSource:2000_connections
- ConnectomeCSVDataSource
CSV file name: ‘connectome.csv’
File name: ‘connectome.csv’
Torrent file name: ‘d9da5ce947c6f1c127dfcdc2ede63320.torrent’
The BitTorrentDataSourceDirLoader class inherits from the
DataSourceDirLoader
and overrides itsload ()
method. Google Drive stores thetorrents
uploaded by other researchers.load()
fetches thetorrent
refered to intorrent_file_name
of theDataSource
, performsDataTranslator
from one form to another and then adds thetorrent
to the BitTorrent Client for downloading its contents.
This
BitTorrent Client
is available on PyPI and is included in the owmeta_core setup.
To install separately:
$ pip install torrent-clientFor reference, use the torrent-client repository and its usage information with:
$ torrent_cli.py -h
The
DataSourceDirLoader
attribute -base_directory
, which is set in theBitTorrentDataSourceDirLoader
constructor is where both thetorrent
and its contents are downloaded:content = BitTorrentDataSourceDirLoader("./")
Within the .owm directory we have the credentials.json and token.pickle these are for authentication of the Google Drive. For the purpose of access control the
client_secret
required bycredentials.json
will only be shared by owmeta maintainers.
The
torrent
file name is the MD5 message digest of its contents. If the hash of the downloaded contents is the same as itstorrent
name the data is unaltered.
Data-Integrity is to be checked after 100% download completion:
$ python3 integrity.py 'd9da5ce947c6f1c127dfcdc2ede63320.torrent' 'Merged_Nuclei_Stained_Worm.zip'
Upload your contents:
On an AWS EC2 instance is running a Nginx WSGI and a Flask Server to accept .zip content file uploads. Visit this Elastic IP address [13.235.204.78] to upload your files by browsing through your filesystem and then clicking the
Submit Query button
.This will create a
torrent
andseed
your contents in parts, to other peers on the BitTorrent network. Content can then be downloaded as described above.