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

feat/v0.1.0 #9

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 libp2p
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Protocol Labs Inc


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.
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,38 @@
# js-libp2p-circuit
# <topic>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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://github.com/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://github.com/RichardLitt/standard-readme)

> <description>

<long description>

## Table of Contents

<ToC>

## Install

<install>

## Usage

<usage>

## Lead

- [<lead>](https://github.com/<lead>)

## Contribute

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

Check out our [contributing document](https://github.com/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://github.com/ipfs/community/blob/master/code-of-conduct.md).

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

## License

[MIT](LICENSE) © 2016 Protocol Labs Inc.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole README needs to be done.

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://github.com/libp2p/js-libp2p-circuit.git"
},
"keywords": [
"IPFS"
],
"author": "Dmitriy Ryajov <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/libp2p/js-libp2p-circuit/issues"
},
"homepage": "https://github.com/libp2p/js-libp2p-circuit#readme",
"eslintConfig": {
"extends": [
"./node_modules/aegir/config/eslintrc.yml"
],
"rules": {
"strict": "off"
}
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't monkey patch our codestyle, we want to use the same for every single module in the same way.

"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"
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deps need to be updated

}
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,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's take the priority out for now.

The way it will happen is:

When dialing to a peer:

  1. try first all the transports that are direct connections
  2. try any relay multiaddrs I know

We will always want direct connections if possible

DIALER: {
ONION: 'onion',
TELESCOPE: 'telescope'
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these values?

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