Skip to content
This repository has been archived by the owner on Aug 23, 2019. It is now read-only.

Commit

Permalink
feat: initial implementation of circuit relaying
Browse files Browse the repository at this point in the history
chore: adding default readme

feat: reworking as a transport

feat: getting peers communicating over relay (wip)

feat: address in swarm [wip]

feat: adding onion dial

feat: adding onion dialing and tests

feat: make circuit a full fledged transport

refactor: split transport dialer and circuit logic

test: adding dial tests

feat: adding passive/active dialing test

test: adding relay tests

fix: several isues

feat: consolidate and cleanup dialing

feat: handle listenning circuit addresses correctly

feat: make utils a factory

feat: adding StreamHandler to aid with pull-stream read/write

refactor: clean up and refactor relay and listener

tests: adding more relay and listener tests

tests: moving long multiaddr to a fixture
  • Loading branch information
dmitriy ryajov authored and dryajov committed Apr 18, 2017
1 parent b2bd6c9 commit 01f58e1
Show file tree
Hide file tree
Showing 24 changed files with 2,067 additions and 2 deletions.
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
node_modules

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# Vim editor swap files
*.swp

dist

.history
.vscode
35 changes: 35 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
test

# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
node_modules

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history
38 changes: 38 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
sudo: false
language: node_js

matrix:
include:
- node_js: 4
env: CXX=g++-4.8
- node_js: 6
env:
- SAUCE=true
- CXX=g++-4.8
- node_js: "stable"
env:
- CXX=g++-4.8

# Make sure we have new NPM.
before_install:
- npm install -g npm

script:
- npm run lint
- npm test
- npm run coverage

before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

after_success:
- npm run coverage-publish

addons:
firefox: latest
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,38 @@
# js-libp2p-circuit
Circuit Switching for libp2p
# <topic>

[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
[![](https://img.shields.io/badge/project-libp2p-blue.svg?style=flat-square)](http:/libp2p/libp2p)
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
[![](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https:/RichardLitt/standard-readme)

> <description>
<long description>

## Table of Contents

<ToC>

## Install

<install>

## Usage

<usage>

## Lead

- [<lead>](https:/<lead>)

## Contribute

Please contribute! [Look at the issues](https:/libp2p/<repoName>/issues)!

Check out our [contributing document](https:/libp2p/community/blob/master/CONTRIBUTE.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to libp2p are subject to the IPFS [Code of Conduct](https:/ipfs/community/blob/master/code-of-conduct.md).

Small note: If editing the README, please conform to the [standard-readme](https:/RichardLitt/standard-readme) specification.

## License

[MIT](LICENSE) © 2016 Protocol Labs Inc.
12 changes: 12 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
machine:
node:
version: stable

dependencies:
pre:
- google-chrome --version
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
- sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
- sudo apt-get update
- sudo apt-get --only-upgrade install google-chrome-stable
- google-chrome --version
66 changes: 66 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"name": "libp2p-circuit",
"version": "0.0.2",
"description": "JavaScript implementation of circuit/switch relaying",
"main": "src/index.js",
"scripts": {
"lint": "aegir-lint",
"build": "aegir-build",
"test": "aegir-test --env node",
"release": "aegir-release",
"release-minor": "aegir-release --type minor",
"release-major": "aegir-release --type major",
"coverage": "aegir-coverage",
"coverage-publish": "aegir-coverage publish"
},
"pre-commit": [
"lint",
"test"
],
"repository": {
"type": "git",
"url": "git+https:/libp2p/js-libp2p-circuit.git"
},
"keywords": [
"IPFS"
],
"author": "Dmitriy Ryajov <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https:/libp2p/js-libp2p-circuit/issues"
},
"homepage": "https:/libp2p/js-libp2p-circuit#readme",
"eslintConfig": {
"extends": [
"./node_modules/aegir/config/eslintrc.yml"
],
"rules": {
"strict": "off"
}
},
"devDependencies": {
"aegir": "^10.0.0",
"chai": "^3.5.0",
"multihashes": "^0.4.5",
"pre-commit": "^1.2.2",
"proxyquire": "^1.7.11",
"pull-pushable": "^2.0.1",
"sinon": "^2.1.0"
},
"contributors": [],
"dependencies": {
"async": "^2.1.5",
"debug": "^2.6.1",
"interface-connection": "^0.3.1",
"lodash": "^4.17.4",
"multiaddr": "^2.2.1",
"multistream-select": "^0.13.4",
"peer-id": "^0.8.2",
"peer-info": "^0.8.3",
"pull-abortable": "^4.1.0",
"pull-handshake": "^1.1.4",
"pull-stream": "^3.5.0",
"safe-buffer": "^5.0.1",
"setimmediate": "^1.0.5"
}
}
30 changes: 30 additions & 0 deletions src/circuit/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict'

module.exports = {
PRIOIRY: 100,
DIALER: {
ONION: 'onion',
TELESCOPE: 'telescope'
},
RESPONSE: {
SUCCESS: 100,
FAILURE: 500,
HOP: {
SRC_ADDR_TOO_LONG: 220,
DST_ADDR_TOO_LONG: 221,
SRC_MULTIADDR_INVALID: 250,
DST_MULTIADDR_INVALID: 251,
NO_CONN_TO_DST: 260,
CANT_DIAL_DST: 261,
CANT_OPEN_DST_STREAM: 262,
CANT_SPEAK_RELAY: 270,
CANT_CONNECT_TO_SELF: 280
},
STOP: {
SRC_ADDR_TOO_LONG: 320,
DST_ADDR_TOO_LONG: 321,
SRC_MULTIADDR_INVALID: 350,
DST_MULTIADDR_INVALID: 351
}
}
}
Loading

0 comments on commit 01f58e1

Please sign in to comment.