BitTorrent client for P2P filesharing¶
Download desired contents:
A
LocalFileDataSourcecreated 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. Atorrentis used to locate files on the File System [ BEP 3 ]. ADataSourcedefines attributes about the contents that it represents.
Module
tdescribes theDataSourceattributes: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
DataSourcecan be created and stored on the local graph with:$ owm save t
The
DataSourceidentifier 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
DataSourceDirLoaderand overrides itsload ()method. Google Drive stores thetorrentsuploaded by other researchers.load()fetches thetorrentrefered to intorrent_file_nameof theDataSource, performsDataTranslatorfrom one form to another and then adds thetorrentto the BitTorrent Client for downloading its contents.
This
BitTorrent Clientis 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
DataSourceDirLoaderattribute -base_directory, which is set in theBitTorrentDataSourceDirLoaderconstructor is where both thetorrentand 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_secretrequired bycredentials.jsonwill only be shared by owmeta maintainers.
The
torrentfile name is the MD5 message digest of its contents. If the hash of the downloaded contents is the same as itstorrentname 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
torrentandseedyour contents in parts, to other peers on the BitTorrent network. Content can then be downloaded as described above.