git ssb

1+

punkmonk.termux / mvd



forked from ev / mvd

Tree: 7ede3c7a935ddf6b575e9a503f49956005a87a3d

Files: 7ede3c7a935ddf6b575e9a503f49956005a87a3d / config / inject.js

1841 bytesRaw
1var path = require('path')
2var home = require('os-homedir')
3
4var nonPrivate = require('non-private-ip')
5var merge = require('deep-extend')
6
7var RC = require('rc')
8
9var SEC = 1e3
10var MIN = 60*SEC
11
12module.exports = function (name, override) {
13 name = name || 'ssb'
14 var HOME = home() || 'browser' //most probably browser
15 var result = RC(name || 'ssb', merge({
16 //just use an ipv4 address by default.
17 //there have been some reports of seemingly non-private
18 //ipv6 addresses being returned and not working.
19 //https://github.com/ssbc/scuttlebot/pull/102
20 party: true,
21 host: nonPrivate.v4 || '',
22 port: 8008,
23 timeout: 0,
24 pub: true,
25 local: true,
26 friends: {
27 dunbar: 150,
28 hops: 3
29 },
30 ws: {
31 port: 8989
32 },
33 gossip: {
34 connections: 3
35 },
36 connections: {
37 outgoing: {
38 net: [{ transform: "shs" }]
39 }
40 },
41 path: path.join(HOME, '.' + name),
42 timers: {
43 connection: 0,
44 reconnect: 5*SEC,
45 ping: 5*MIN,
46 handshake: 5*SEC
47 },
48 //change these to make a test network that will not connect to the main network.
49 caps: {
50 //this is the key for accessing the ssb protocol.
51 //this will be updated whenever breaking changes are made.
52 //(see secret-handshake paper for a full explaination)
53 //(generated by crypto.randomBytes(32).toString('base64'))
54 shs: '1KHLiKZvAvjbY1ziZEHMXawbCEIM6qwjCDm3VYRan/s=',
55
56 //used to sign messages
57 sign: null
58 },
59 master: [],
60 logging: { level: 'notice' }
61 }, override || {}))
62
63 if (!result.connections.incoming) {
64 result.connections.incoming = {
65 net: [{ host: result.host, port: result.port, scope: "public", "transform": "shs" }],
66 ws: [{ host: result.host, scope: "device", "transform": "shs" }]
67 }
68 }
69 return result
70}
71

Built with git-ssb-web