Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

feat: Circuit Relay #1063

Merged
merged 27 commits into from
Mar 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
58e0863
docs: adding circuit relay tutorial (wip)
dryajov Feb 13, 2018
448cf0e
wip
dryajov Feb 27, 2018
7c03194
(wip) relay tutorial improvements
dryajov Feb 28, 2018
c31be9b
test: rework with new ipfsd-ctl
dryajov Dec 6, 2017
e3ba300
feat: add circuit test
dryajov Jan 30, 2018
2376246
feat: name circuit relay test
dryajov Jan 30, 2018
c01a979
docs: adding circuit docs
dryajov Jan 30, 2018
b3d71c2
docs: adding circuit relay tutorial (wip)
dryajov Feb 13, 2018
7de9de2
feat: latest libp2p + other deps. Fix bugs in tests along the way
daviddias Feb 15, 2018
11e3b4f
tutorial
dryajov Feb 28, 2018
5dbe97c
tutorial lint
dryajov Feb 28, 2018
8af1f78
feat: read relay config from options and config file
dryajov Mar 5, 2018
64fc128
docs: tutorial
dryajov Mar 6, 2018
9973578
docs: clarifying specific relay addrs
dryajov Mar 7, 2018
2425ae4
docs: more clarifications
dryajov Mar 7, 2018
0483091
docs: more clarifications
dryajov Mar 7, 2018
1fa52f8
docs: more clarifications
dryajov Mar 7, 2018
80a0b7d
docs: changes based on robs review
dryajov Mar 7, 2018
3b47e5d
Add minor grammar/spelling fixes to relay doc
Mr0grog Mar 7, 2018
e0edd66
docs: small change
dryajov Mar 7, 2018
d1b0180
docs: expanded closing section
dryajov Mar 7, 2018
c9705b1
docs: more suggestions from Mr0grog
dryajov Mar 9, 2018
5cee7e6
docs: more improvements and typos
dryajov Mar 13, 2018
1a99d65
doc: minor corrections
dryajov Mar 14, 2018
4dba67c
Revert "docs: adding circuit relay tutorial (wip)"
dryajov Mar 14, 2018
9f51067
wip
dryajov Mar 14, 2018
f265445
docs: tutorial fixes
dryajov Mar 16, 2018
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
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,13 @@ const node = new IPFS({
EXPERIMENTAL: { // enable experimental features
pubsub: true,
sharding: true, // enable dir sharding
dht: true // enable KadDHT, currently not interopable with go-ipfs
dht: true, // enable KadDHT, currently not interopable with go-ipfs
relay: {
enabled: true, // enable circuit relay dialer and listener
hop: {
enabled: true // enable circuit relay HOP (make this node a relay)
}
}
Copy link
Member

Choose a reason for hiding this comment

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

👍

},
config: { // overload the default IPFS node config, find defaults at https://github.com/ipfs/js-ipfs/tree/master/src/core/runtime
Addresses: {
Expand Down
2 changes: 2 additions & 0 deletions examples/circuit-relaying/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
.vscode/
349 changes: 349 additions & 0 deletions examples/circuit-relaying/README.md

Large diffs are not rendered by default.

Binary file added examples/circuit-relaying/img/img1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/circuit-relaying/img/img2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/circuit-relaying/img/img3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/circuit-relaying/img/img4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/circuit-relaying/img/img5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/circuit-relaying/img/img6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/circuit-relaying/img/img7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 61 additions & 0 deletions examples/circuit-relaying/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>IPFS simple messaging</title>
<meta name="description" content="Simple chat app on ipfs">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="./main.css">

<body>
<header>
<h1>IPFS Simple Messaging</h1>
</header>
<main>
<div class="columns box">
<div class="row">
<div class="box">
<label>Room (double click to change):</label>
<span id="room"></span>
<input type="text" id="room-id" style="display: none">
</div>
<div class="box msgs-box">
<ul id="msgs"></ul>
</div>
<div>
<label>message:</label>
<input type="text" id="message"></input>
<button id="send">Send</button>
</div>
</div>
<div class="row">
<div class="box peers-box">
<label>Peers Joined Room:</label>
<ul id="peers"></ul>
</div>
<div class="box peers-box">
<label>Peers Connected:</label>
<ul id="peers-addrs"></ul>
</div>
<div>
<label>Connect to Peer:</label>
<input type="text" id="peer"></input>
<button id="connect">Connect</button>
</div>
</div>
<div class="row">
<div class="box row">
<label>Peer id:</label>
<ul id="peer-id"></ul>
</div>
<div class="box addrs-box">
<label>Addresses:</label>
<ul id="addrs"></ul>
</div>
</div>
</div>
</main>
<script src="src/app.js"></script>
</body>

</html>
253 changes: 253 additions & 0 deletions examples/circuit-relaying/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
* {
box-sizing: border-box;
}

body {
height: 100%;
}

body {
font-family: sans-serif;
color: white;
background: linear-gradient(to bottom, #041727 0%, #062b3f 100%);
pointer-events: auto;
}

h1,
h2,
h3 {
margin: 0;
}

h1 {
font-size: 2em;
font-weight: 300;
}

h2 {
font-size: 1.25em;
font-weight: 700;
}

h3 {
font-size: 1.0em;
font-weight: 700;
}

main,
header {
filter: none;
}

.dragover-popup {
position: fixed;
top: 0.5em;
left: 0.5em;
width: calc(100% - 1em);
height: calc(100% - 1em);
background-color: rgba(0, 0, 0, 0.5);
display: none;
pointer-events: none;
}

.dragover-popup h1 {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%)
}

body.dragging main,
body.dragging header {
filter: blur(5px);
}

body.dragging .dragover-popup {
display: block;
}

header {
text-align: center;
display: flex;
justify-content: center;
align-items: center;
padding: 3em 0;
}

ul {
margin: 0;
padding: 0;
list-style: none;
}

ul li {
margin: 1em 0;
font-size: 1em;
font-family: monospace;
word-wrap: break-word;
}

button {
background-color: rgba(0, 0, 0, 0.2);
color: #6acad1;
border: 2px solid #6acad1;
font-size: 1em;
padding: 0.625em 1.5em;
border-radius: 0.125em;
margin: .5em 0;
}

button.full {
margin-right: 0;
margin-left: 0;
width: 100%;
}

button:hover {
color: white;
border: 2px solid white;
cursor: pointer;
}

.address {
font-family: monospace
}

.disabled *,
input:disabled,
button:disabled {
opacity: 0.2;
}

input {
width: 100%;
border: 2px solid rgba(0, 0, 0, 0.2);
color: black;
padding: 0.7em;
border-radius: 2px;
}

input:hover,
input:focus,
input:active {
border-color: #6acad1;
}

input,
button {
outline: none;
}

main {
width: 90%;
margin: 0 auto;
}

.buttons,
.columns {
display: flex;
flex-direction: row;
justify-content: space-between;
height: 100%;
}

.msgs-box {
flex: 1 1 0px;
overflow-y: scroll;
min-height: 250px;
}

.peers-box {
flex: 1 1 0px;
overflow-y: scroll;
min-height: 182px;
}

.addrs-box {
flex: 1;
overflow-y: scroll;
max-height: 273px;
}

.row {
display: flex;
flex-direction: column;
}

.buttons>button,
.columns>div {
width: calc(33% - 0.5em);
}

.buttons>button {
margin: 0 0 1em;
}

.box {
background-color: rgba(255, 255, 255, 0.05);
padding: 1em;
margin-bottom: 1em;
}

.box>h2 {
display: block;
border-bottom: 2px solid rgba(255, 255, 255, 0.1);
border-right: 0;
border-left: 0;
text-align: center;
padding-bottom: 0.5em;
margin-bottom: 1em;
}

.errors {
grid-area: errors;
color: red;
font-style: italic;
font-size: 1.125em;
display: block;
margin: 0 0 1em;
}

.errors.hidden {
display: none;
}

table {
width: 100%;
margin: 1em 0;
word-break: break-all;
border-collapse: collapse;
}

table thead {
background-color: rgba(255, 255, 255, 0.1);
font-weight: normal
}

table th,
table td {
padding: 0.5em 0;
}

table td:last-child,
table th:last-child {
width: 20%;
text-align: center;
}

table td:first-child {
width: 45%;
}

table td:nth-child(2) {
width: 35%;
font-family: monospace;
}

table tr:hover {
background-color: rgba(0, 0, 0, 0.2)
}

table a {
color: inherit;
}
27 changes: 27 additions & 0 deletions examples/circuit-relaying/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "ipfs-quick-msg",
"version": "0.0.1",
"description": "IPFS quick msg",
"main": "index.js",
"scripts": {
"clean": "rm -rf dist/*",
"build": "parcel build index.html --public-url '.'",
"start": "parcel index.html",
"test": "echo \"Error: no test specified\" && exit 1",
"deploy": "ipfs add -r --quieter dist",
"lint": "aegir lint"
},
"author": "Dmitriy Ryajov <dryajov@gmail.com>",
"license": "MIT",
"dependencies": {
"ipfs": "file:../../",
"ipfs-pubsub-room": "~0.3.0"
},
"devDependencies": {
"aegir": "^13.0.5",
"http-server": "^0.10.0",
"ipfs-css": "^0.2.0",
"parcel-bundler": "^1.6.2",
"tachyons": "^4.9.1"
}
}
Loading