Updated README.md and added travis CI file

master
Fred Stober 2016-01-21 14:53:09 +01:00
parent 06dd22bec7
commit 692b84c6ea
4 changed files with 29 additions and 4 deletions

18
.travis.yml 100644
View File

@ -0,0 +1,18 @@
language: python
sudo: false
python:
- "2.7"
- "3.3"
- "3.4"
- "3.5"
- "pypy"
before_install:
- pip install codecov
- pip install 'coverage<4'
script:
- coverage run -a bencode.py
- coverage run -a crc32c.py
- coverage run -a krpc.py
- coverage run -a dht.py
after_success:
- codecov

View File

@ -1,3 +1,6 @@
[![Build Status](https://travis-ci.org/FredStober/tinyBT.svg?branch=master)](https://travis-ci.org/FredStober/tinyBT)
[![Coverage](https://codecov.io/github/FredStober/tinyBT/coverage.svg?branch=master)](https://codecov.io/github/FredStober/tinyBT?branch=master)
tiny Bittorrent client tiny Bittorrent client
====================== ======================
@ -55,11 +58,15 @@ a user specified timeout:
The final three functions are used to start and shutdown the local DHT Peer The final three functions are used to start and shutdown the local DHT Peer
and allow access to the discovered external connection infos: and allow access to the discovered external connection infos:
- __init__(listen_connection, bootstrap_connection = ('router.bittorrent.com', 6881), - __init__(listen_connection, bootstrap_connection = ('router.bittorrent.com', 6881),
setup = {'report_t': 10, 'check_t': 30, 'check_N': 10, 'discover_t': 180}) user_setup = {}, user_router = None)
The constructor needs to know what address and port to listen on and which node to use The constructor needs to know what address and port to listen on and which node to use
as a bootstrap node. The run interval and some other parameters of the maintainance as a bootstrap node. The run interval and some other parameters of the maintainance
threads can be configured as well. threads can be configured as well via the user_setup parameter. The default values are:
{'discover_t': 180, 'check_t': 30, 'check_N': 10}.
It is possible to provide a user implemntation for the DHT node router with the user_router
parameter
- shutdown() - shutdown()
Start shutdown of the local DHT peer and all associated maintainance threads. Start shutdown of the local DHT peer and all associated maintainance threads.
- get_external_connection() - get_external_connection()

View File

@ -28,7 +28,7 @@ class BTFailure(Exception):
# Encoding functions ############################################## # Encoding functions ##############################################
import sys import sys
if sys.version_info.major >= 3: if sys.version_info[0] >= 3:
str_to_bytes = lambda x: x.encode('ascii') str_to_bytes = lambda x: x.encode('ascii')
else: else:
str_to_bytes = lambda x: x str_to_bytes = lambda x: x

2
dht.py
View File

@ -468,7 +468,7 @@ if __name__ == '__main__':
break break
import binascii import binascii
info_hash = binascii.unhexlify('cb84ccc10f296df72d6c40ba7a07c178a4323a14') # Ubuntu 14.04 info hash info_hash = binascii.unhexlify('ae3fa25614b753118931373f8feae64f3c75f5cd') # Ubuntu 15.10 info hash
log.critical('starting "get_peers" test') log.critical('starting "get_peers" test')
for idx, peer in enumerate(dht5.dht_get_peers(info_hash)): for idx, peer in enumerate(dht5.dht_get_peers(info_hash)):