Skip to content

Commit c818983

Browse files
committed
Add websockets as transport by default
1 parent 0d97bb0 commit c818983

4 files changed

Lines changed: 98 additions & 14 deletions

File tree

index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const Bundler = require("./bundle")
44
const TCP = require('libp2p-tcp')
5+
const WS = require("libp2p-websockets")
56
module.exports = Bundler({
67
name: "ZeroNetNodeJSBundle",
78
modules: {
@@ -31,9 +32,10 @@ module.exports = Bundler({
3132
libp2p: {
3233
listen: [],
3334
transports: [
34-
new TCP()
35-
]/*,
36-
mdns: false,
35+
new TCP(),
36+
new WS()
37+
],
38+
mdns: true/*,
3739
dht: false*/
3840
}
3941
}

package-lock.json

Lines changed: 85 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"dependencies": {
1212
"colors": "^1.1.2",
1313
"libp2p-tcp": "^0.11.0",
14+
"libp2p-websockets": "^0.10.1",
1415
"merge-recursive": "0.0.3",
1516
"mkdirp": "^0.5.1",
1617
"mockery": "^2.1.0",

zeronet.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ mkdirp.sync(path.join(dir, "logs"))
2626
let cm
2727

2828
const TCP = require('libp2p-tcp')
29+
const WS = require("libp2p-websockets")
2930

3031
const defaults = {
3132
id_expire: 1000 * 60 * 60 * 24 * 7, //approx 1 week
@@ -39,7 +40,8 @@ const defaults = {
3940
"/ip4/0.0.0.0/tcp/15543"
4041
],
4142
transports: [
42-
new TCP()
43+
new TCP(),
44+
new WS()
4345
],
4446
trackers: [
4547
//"zero://boot3rdez4rzn36x.onion:15441",
@@ -61,8 +63,10 @@ const defaults = {
6163
libp2p: {
6264
listen: [
6365
"/ip4/0.0.0.0/tcp/15542",
64-
"/ip6/::1/tcp/15542",
65-
"/p2p-websocket-star"
66+
"/ip6/::/tcp/15542",
67+
"/p2p-websocket-star",
68+
"/ip4/0.0.0.0/tcp/15541/ws",
69+
"/ip6/::/tcp/15541/ws"
6670
],
6771
transports: [
6872
new TCP()

0 commit comments

Comments
 (0)