This repository has been archived by the owner on May 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9a292d7
Showing
35 changed files
with
9,891 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
_build | ||
*.native | ||
*.byte | ||
setup.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
align_ops=false | ||
strict_with=auto | ||
syntax=bitstring | ||
syntax=lwt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
(* The MIT License (MIT) | ||
|
||
Copyright (c) 2014 Nicolas Ojeda Bar <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# OASIS_START | ||
# DO NOT EDIT (digest: a3c674b4239234cbbe53afe090018954) | ||
|
||
SETUP = ocaml setup.ml | ||
|
||
build: setup.data | ||
$(SETUP) -build $(BUILDFLAGS) | ||
|
||
doc: setup.data build | ||
$(SETUP) -doc $(DOCFLAGS) | ||
|
||
test: setup.data build | ||
$(SETUP) -test $(TESTFLAGS) | ||
|
||
all: | ||
$(SETUP) -all $(ALLFLAGS) | ||
|
||
install: setup.data | ||
$(SETUP) -install $(INSTALLFLAGS) | ||
|
||
uninstall: setup.data | ||
$(SETUP) -uninstall $(UNINSTALLFLAGS) | ||
|
||
reinstall: setup.data | ||
$(SETUP) -reinstall $(REINSTALLFLAGS) | ||
|
||
clean: | ||
$(SETUP) -clean $(CLEANFLAGS) | ||
|
||
distclean: | ||
$(SETUP) -distclean $(DISTCLEANFLAGS) | ||
|
||
setup.data: | ||
$(SETUP) -configure $(CONFIGUREFLAGS) | ||
|
||
configure: | ||
$(SETUP) -configure $(CONFIGUREFLAGS) | ||
|
||
.PHONY: build doc test all install uninstall reinstall clean distclean configure | ||
|
||
# OASIS_STOP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# ocaml-dht | ||
|
||
OCaml-DHT is a small BitTorrent DHT implementation. It is shamelessly based in the one found in [MLdonkey](http://mldonkey.sourceforge.net), but adapated to work with [Lwt](http://ocsigen.org/lwt/). | ||
|
||
This is a preliminary release. | ||
|
||
## Installation | ||
|
||
The easiest way is to use [OPAM](http://opam.ocaml.org). | ||
```sh | ||
opam install dht | ||
``` | ||
|
||
Alternatively, clone from git and install manually: | ||
```sh | ||
cd ~/tmp | ||
git clone https://github.com/nojb/ocaml-dht | ||
cd ocaml-dht | ||
make | ||
make install | ||
``` | ||
|
||
Either way the end-result will be a OCaml library (findlib name: `dht`) and a executable `find_ih`. | ||
|
||
### Documentation | ||
|
||
Look in `DHT.mli`, `Kademlia.mli`, and `KRPC.mli`. | ||
|
||
### Usage | ||
|
||
First, one needs to bootstrap using `DHT.auto_bootstrap`. Then one can query for peers using | ||
`DHT.query_peers`. To see how it works, get a nice info hash | ||
you are interested in (e.g., 4D753474429D817B80FF9E0C441CA660EC5D2450 for Ubuntu 14.04) and execute: | ||
|
||
```sh | ||
$ find_ih 4D753474429D817B80FF9E0C441CA660EC5D2450 | ||
``` | ||
|
||
You will see a lot of debug output which explains (if you know what it means) what is going on. | ||
|
||
## Comments | ||
|
||
Comments, bug reports and feature requests are very welcome: [email protected]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
OASISFormat: 0.4 | ||
Name: bt | ||
Version: 0.1.0 | ||
Synopsis: BitTorrent DHT library for Lwt | ||
Authors: Nicolas Ojeda Bar <[email protected]> | ||
License: MIT | ||
Plugins: META (0.4), DevFiles (0.4) | ||
BuildTools: ocamlbuild | ||
|
||
Library dht | ||
Path: lib | ||
Pack: false | ||
Install: true | ||
FindlibName: dht | ||
Modules: Bcode, SHA1, KRPC, Addr, UDP, DHT, Kademlia, Log, Util | ||
BuildDepends: lwt, lwt.unix, cryptokit, zarith, qcheck, bitstring, bitstring.syntax | ||
|
||
Executable find_ih | ||
Path: lib_test | ||
MainIs: find_ih.ml | ||
Build$: true | ||
Custom: true | ||
CompiledObject: best | ||
Install: false | ||
BuildDepends: dht |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# OASIS_START | ||
# DO NOT EDIT (digest: 224e0ec4e529dd26b219b55fb1278f1b) | ||
# Ignore VCS directories, you can use the same kind of rule outside | ||
# OASIS_START/STOP if you want to exclude directories that contains | ||
# useless stuff for the build process | ||
<**/.svn>: -traverse | ||
<**/.svn>: not_hygienic | ||
".bzr": -traverse | ||
".bzr": not_hygienic | ||
".hg": -traverse | ||
".hg": not_hygienic | ||
".git": -traverse | ||
".git": not_hygienic | ||
"_darcs": -traverse | ||
"_darcs": not_hygienic | ||
# Library dht | ||
"lib/dht.cmxs": use_dht | ||
<lib/*.ml{,i}>: pkg_bitstring | ||
<lib/*.ml{,i}>: pkg_bitstring.syntax | ||
<lib/*.ml{,i}>: pkg_cryptokit | ||
<lib/*.ml{,i}>: pkg_lwt | ||
<lib/*.ml{,i}>: pkg_lwt.unix | ||
<lib/*.ml{,i}>: pkg_qcheck | ||
<lib/*.ml{,i}>: pkg_zarith | ||
# Executable find_ih | ||
<lib_test/find_ih.{native,byte}>: pkg_bitstring | ||
<lib_test/find_ih.{native,byte}>: pkg_bitstring.syntax | ||
<lib_test/find_ih.{native,byte}>: pkg_cryptokit | ||
<lib_test/find_ih.{native,byte}>: pkg_lwt | ||
<lib_test/find_ih.{native,byte}>: pkg_lwt.unix | ||
<lib_test/find_ih.{native,byte}>: pkg_qcheck | ||
<lib_test/find_ih.{native,byte}>: pkg_zarith | ||
<lib_test/find_ih.{native,byte}>: use_dht | ||
<lib_test/*.ml{,i}>: pkg_bitstring | ||
<lib_test/*.ml{,i}>: pkg_bitstring.syntax | ||
<lib_test/*.ml{,i}>: pkg_cryptokit | ||
<lib_test/*.ml{,i}>: pkg_lwt | ||
<lib_test/*.ml{,i}>: pkg_lwt.unix | ||
<lib_test/*.ml{,i}>: pkg_qcheck | ||
<lib_test/*.ml{,i}>: pkg_zarith | ||
<lib_test/*.ml{,i}>: use_dht | ||
<lib_test/find_ih.{native,byte}>: custom | ||
# OASIS_STOP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/sh | ||
|
||
# OASIS_START | ||
# DO NOT EDIT (digest: dc86c2ad450f91ca10c931b6045d0499) | ||
set -e | ||
|
||
FST=true | ||
for i in "$@"; do | ||
if $FST; then | ||
set -- | ||
FST=false | ||
fi | ||
|
||
case $i in | ||
--*=*) | ||
ARG=${i%%=*} | ||
VAL=${i##*=} | ||
set -- "$@" "$ARG" "$VAL" | ||
;; | ||
*) | ||
set -- "$@" "$i" | ||
;; | ||
esac | ||
done | ||
|
||
ocaml setup.ml -configure "$@" | ||
# OASIS_STOP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DHT library for Lwt |
Oops, something went wrong.