git ssb

1+

Daan Patchwork / manyverse



Commit 1653af13df494cb4bb13fc8e9a91d6ca90a53817

ux: fix Wi-Fi discovery and sync on some devices

Andre Staltz committed on 11/28/2018, 2:14:13 PM
Parent: ee1dde87181047cbb0cec440db95a4fba72135a8

Files changed

src/nodejs-project/index.tschanged
src/nodejs-project/package.jsonchanged
src/nodejs-project/index.tsView
@@ -10,8 +10,10 @@
1010 const mkdirp = require('mkdirp');
1111 const DHT = require('multiserver-dht');
1212 const rnBridge = require('rn-bridge');
1313 const rnChannelPlugin = require('multiserver-rn-channel');
14+const npip = require('non-private-ip');
15+const injectSsbConfig = require('ssb-config/inject');
1416 import syncingPlugin = require('./plugins/syncing');
1517 import blobsFromPathPlugin = require('./plugins/blobsFromPath');
1618 import manifest = require('./manifest');
1719
@@ -22,24 +24,30 @@
2224 }
2325 const keysPath = path.join(ssbPath, '/secret');
2426 const keys = ssbKeys.loadOrCreateSync(keysPath);
2527
26-const config = require('ssb-config/inject')();
27-config.path = ssbPath;
28-config.keys = keys;
29-config.manifest = manifest;
30-config.friends.hops = 2;
31-config.connections = {
32- incoming: {
33- net: [{scope: 'private', transform: 'shs', port: 26831}],
34- dht: [{scope: 'public', transform: 'shs', port: 26832}],
35- channel: [{scope: 'device', transform: 'noauth'}],
36- },
37- outgoing: {
38- net: [{transform: 'shs'}],
39- dht: [{transform: 'shs'}],
40- },
41-};
28+const config = (() => {
29+ const c = injectSsbConfig();
30+ const NET_PORT = 26831;
31+ const DHT_PORT = 26832;
32+ const host = npip.private(); // Avoid (public) rmnet IP addresses
33+ c.path = ssbPath;
34+ c.keys = keys;
35+ c.manifest = manifest;
36+ c.friends.hops = 2;
37+ c.connections = {
38+ incoming: {
39+ net: [{scope: 'private', transform: 'shs', host, port: NET_PORT}],
40+ dht: [{scope: 'public', transform: 'shs', port: DHT_PORT}],
41+ channel: [{scope: 'device', transform: 'noauth'}],
42+ },
43+ outgoing: {
44+ net: [{transform: 'shs'}],
45+ dht: [{transform: 'shs'}],
46+ },
47+ };
48+ return c;
49+})();
4250
4351 function rnChannelTransport(_sbot: any) {
4452 _sbot.multiserver.transport({
4553 name: 'channel',
src/nodejs-project/package.jsonView
@@ -14,8 +14,9 @@
1414 "ip": "1.1.5",
1515 "leveldown": "4.0.1",
1616 "multiserver-dht": "4.0.0",
1717 "multiserver-rn-channel": "~1.2.0",
18+ "non-private-ip": "1.4.4",
1819 "pull-cat": "1.1.11",
1920 "pull-stream": "3.6.9",
2021 "pull-pushable": "2.2.0",
2122 "pull-file": "1.1.0",

Built with git-ssb-web