Skip to content
Salehen Shovon Rahman edited this page Jan 15, 2015 · 35 revisions

What?

libcage is a C++ library that implements the Kademlia distributed hash table (DHT) algorithm. Relies on libevent, Boost, and libcrypto; works on Linux, MacOS X, *BSD.

There already exists several DHT libraries, such as OpenDHT, Bamboo DHT, Overlay Weaver, Khashmir, etc. However most implementations don’t consider NATs. Therefore, even though these DHT libraries can potentially allow us to build peer-2-peer Internet application, they aren’t widely used yet, because they aren’t practical to implement. libcage is tackling this problem and is intended for the next generation of peer-to-peer networks having billions of peers.

Features

  • distributed key-value storage
  • NAT traversal
  • churn resilience
  • application-level reliable data transfer
  • open source under BSD license

Compiling and Installation

Getting The Source Code from GitHub

First of all, download the source code using git, and checkout libev, which is the latest branch of libcage.

$ git clone git@github.com:ytakano/libcage.git
$ cd libcage
$ git checkout libev

Compiling

libcage depends on Boost and libevent, so be sure you have it installed before compiling. Furthermore libcage uses OMake to build.

Once you’ve made sure that you’ve installed all the required tools, you should be able to compile by running:

$ omake

If you want to enable debugging, use the DEBUG flag:

$ omake DEBUG=TRUE

If you’d like to use libev instead of libevent, use the EV flag

$ omake EV=TRUE

libcage internally includes event.h, so be sure it is available, before compiling. If you have installed libev from MacPorts, there must be /opt/local/include/ev-event.h. Thus, you should create a symbolic link to ev-event.h on a include path, such as /usr/local/include/event.h.

(if you use libev from MacPorts)
# ln -s /opt/local/include/ev-event.h /usr/local/include/event.h

Installation

Finally you can install libcage as though

# omake install

libcage will be installed to /usr/local after typing the above. If you want to install to any other place, please use PREFIX option as though

# omake PREFIX=/sw/local

libcage will be installed to /sw/local after the above.

Uninstallation

You can uninstall libcage as though

# omake

or

# omake PREFIX=/sw/local

or

# rm -rf /usr/local/include/libcage
# rm /usr/local/lib/libcage*

Getting Started with libcage

under construction…

for the Internet of IPv4

for isolated environments behind the firewall

for the Internet of IPv6