cjdns-core.md 3.3 KB

Cjdns Core Notes

Introduction

A number of us have begun the task of documenting and reverse engineering the cjdns core. The "core" refers to the core functionality required to implement a cjdns-compatible router.

To speak with those involved, join HypeIRC/#documentation

Status

ansuz has re-implemented the xor metric and key generation process, along with the support functions involved, notably the implementation of Base32 used by cjdns.

jph is experimenting with writing a minimal, linux first implementation in golang, along with deconstructing everything involved in making that happen. He is also investigating TUN support in other languages (notably Python and ocaml).

Note to contributors:

  • If you think of additional core functions to document, please add them below
  • Please provide either pseudo-code or working code examples inline. Longer code examples should be linked to, and preferably hosted on gitboria

TUN device support

Overview

Cjdns uses TUN devices to create a virtual network interface and enable routable peer to peer connections. Therefore, TUN support is a critical requirement for implement a cjdns router.

At this time, the following languages have built-in or third-party TUN support:

  • C
  • Golang
  • Python
  • Ruby
  • Ocaml

Please note that "TUN support" may not have the full functionality required by a cjdns router. As this section is expanded, we will describe what that functionality is.

In addition, be aware that TUN implementation varies across operating system implementations. Multiplatform router implementations need to keep this in mind.

Creating a TUN device

TBC

Configuring a TUN device

TBC

Cryptography

Cryptography provides core functionality within cjdns. Here we will describe some of the cryptographic functions performed within cjdns and implementation details.

Public Keys

  • Cryptographic algorithms required
  • Creating a private/public key pair
  • Encoding private/public keys into a string
  • Decoding private/public keys from a string
  • Format for sharing public keys (peering credentials)

Utility Functions

Instead of relying on external libraries, some utility functions have been re-implemented within cjdns. We will describe those functions that differ from standard implementations to ensure compatibility with existing cjdns routers.

JSON

cjdns config files are typically stored as what the community often refers to as cjdson. As finn has pointed out, comments in json are not unheard of.

In any case, we're going to try to add some functionality to that repo that the others lack, such as inserting fields without deleting comments.

Base32

This Javascript library is a direct translation of the cjdns base32 encoder written in C