Skip to content
This repository has been archived by the owner on Nov 20, 2022. It is now read-only.

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mjp0 committed Mar 6, 2019
0 parents commit 94f3d05
Show file tree
Hide file tree
Showing 8 changed files with 389 additions and 0 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:11

ADD . /src
WORKDIR /src
RUN npm i

EXPOSE 10000/udp

CMD npm start
15 changes: 15 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Datagram Open Discovery Index
Copyright (C) 2019 Machian Collective

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
88 changes: 88 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
![Datagram Open Discovery Index](media/header.png)
> Datagram Open Discovery Index is a decentralized discovery database for datagrams. Non-logging public service available at datagram.network
[![license](https://img.shields.io/badge/license-AGPL_3.0-brightgreen.svg)](LICENSE) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmachianists%2Fdatagram-odi.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmachianists%2Fdatagram-odi?ref=badge_shield) [![web-datagram](https://img.shields.io/badge/web-datagramjs.com-blue.svg)](https://datagramjs.com) [![twitter-machianists](https://img.shields.io/badge/[email protected])](https://twitter.com/machianists)

- [💡 What is Datagram Open Discovery Index?](#-what-is-datagram-open-discovery-index)
- [👀 Privacy in ODI](#-privacy-in-odi)
- [📡 Datagram.Network public service](#-datagramnetwork-public-service)
- [🔌 Getting started](#-getting-started)
- [🐳 Docker](#-docker)
- [🛠 Node.js](#-nodejs)
- [⚙️ Options](#️-options)
- [☕️ Roadmap](#️-roadmap)
- [🛠 The team](#-the-team)
- [📝 License](#-license)

## 💡 What is Datagram Open Discovery Index?
Open Discovery Index is an integral part of the Datagram project which enables you to create secure shared databases and data structures with anyone. Open Discovery Index, ODI for short, is the system that enables you and other users to find each other on the internet.

When you share your datagram with someone, their computer needs to know your computer's Internet address. ODI is a database for storing and finding this information.

### 👀 Privacy in ODI
ODI is a decentralized and distributed database. Anyone can participate in hosting ODI to help to keep it decentralized and become "a node" in datagram.network. This means that when you search for a datagram, your request will be routed to the nearest node. This means faster connection times, but it also means that the node host can see your IP address and which datagram address you searched for.

We are constantly evaluating more private ways to build ODI. In the meantime, we are doing everything we can to preserve users' privacy.

For example, the node host can see what you search for, but because the data in ODI is encrypted, they can't read the datagram you searched for.

If the user is willing to run their own node, they can set their datagram searches to go to their own node. If the node is hosted on a 3rd party server, it will act as a proxy for all datagram searches.

### 📡 Datagram.Network public service
Machian Collective offers a free, non-logging and non-censored public ODI at odi.datagram.network. We don't keep any logs of searches, and we don't censor who can utilize odi.datagram.network.

## 🔌 Getting started
### 🐳 Docker
The fastest way to get started is to go with the pre-built Docker image.

> Note that `LOGGING=1` is optional and added to show how to use options with Docker.
```shell
$ docker run -e LOGGING=1 -p 10000:10000/udp -it machian/datagram-odi

-> Datagram Open Discovery Index Server instance listening on 10000...
-> Datagram Open Discovery Index Database started and listening for connections...
```

### 🛠 Node.js
You can start ODI via npm scripts.

> Note that `LOGGING=1` is optional and added to show how to use options with Node.js.
>
```shell
$ LOGGING=1 npm start

-> Datagram Open Discovery Index Server instance listening on 10000...
-> Datagram Open Discovery Index Database started and listening for connections...
```

### ⚙️ Options
ODI has few options you can set via environment variables.

```
LOGGING = 1 // enable logging IPs and action types
PORT = 10000 // which port to listen
MODE = full|server // server mode starts only the server
```

Please refer to Docker and Node.js examples above how to use variables.

## ☕️ Roadmap
Currently, Datagram Open Discovery Index uses a Kademlia based distributed hash table.

Kademlia was chosen due to mature implementations available, but the next steps in ODI projects should focus on research & development of more privacy-friendly solutions.

## 🛠 The team

Datagram Open Discovery Index is a user-driven project maintained by [Machian Collective](https://machian.com), an open-source collective focused on solving human digitalization.

Current primary maintainer is [Marko Polojärvi](https://twitter.com/markopolojarvi). Significant direct and indirect contributions have come from Mathias Buus and Paul Frazee.

> **If you are interested in working with peer-to-peer technologies and solving the hardest & most fascinating issues with digital privacy and security, contact [Marko Polojärvi](https://twitter.com/markopolojarvi).**

## 📝 License

We consider Datagram Open Discovery Index as a public utility project and public utilities should be available to all regardless of their status, skills or resources.

All Datagram Open Discovery Index code is licensed under AGPL v3.0 (AGPL-3.0-or-later).
52 changes: 52 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const DHT = require('dht-rpc')
const Node = require('@hyperswarm/dht')

const pkg = require('./package.json')

const port = process.env['PORT'] || 10000
const servers = process.env['SERVERS'] ? process.env['SERVERS'].split(',') : [
'odi.datagram.network:10000'
]
const logging = process.env['LOGGING'] || false

function startServer(){
const server = DHT({ ephemeral: true })

server.on('ready', function () {
console.log(`Datagram Open Discovery Index Server ${pkg.version} instance listening on ${port}...`)
})

server.listen(port)
}

function startNode() {
servers.push('127.0.0.1:10000')
startServer()

const node = Node({ bootstrap: servers })

node.on('ready', function () {
console.log(`Datagram Open Discovery Index Database ${pkg.version} started and listening for connections...`)
})

node.on('announce', function (target, peer) {
if(logging) console.log({ host: peer.host, type: 'announce'})
})

node.on('unannounce', function (target, peer) {
if(logging) console.log({ host: peer.host, type: 'unannounce'})
})

node.on('lookup', function (target, peer) {
if(logging) console.log({ host: peer.host, type: 'lookup'})
})
}

if(!process.env['MODE']) {
if(!process.argv[2]) throw new Error("NO_COMMAND")
if(process.argv[2] === 'server') startServer()
if(process.argv[2] === 'full') startNode()
} else {
if (process.env['MODE'] === 'server') startServer()
if (process.env['MODE'] === 'full') startNode()
}
Binary file added media/header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
207 changes: 207 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 94f3d05

Please sign in to comment.