Files: 86f5769a00db127133716ec9974e5a973b58e8bd / inject.js
1529 bytesRaw
1 | var path = require('path') |
2 | var home = require('os-homedir') |
3 | |
4 | var nonPrivate = require('non-private-ip') |
5 | var merge = require('deep-extend') |
6 | |
7 | var RC = require('rc') |
8 | |
9 | var SEC = 1e3 |
10 | var MIN = 60*SEC |
11 | |
12 | module.exports = function (name, override) { |
13 | name = name || 'ssb' |
14 | var HOME = home() || 'browser' //most probably browser |
15 | return 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 | path: path.join(HOME, '.' + name), |
37 | timers: { |
38 | connection: 0, |
39 | reconnect: 5*SEC, |
40 | ping: 5*MIN, |
41 | handshake: 5*SEC |
42 | }, |
43 | //change these to make a test network that will not connect to the main network. |
44 | caps: { |
45 | //this is the key for accessing the ssb protocol. |
46 | //this will be updated whenever breaking changes are made. |
47 | //(see secret-handshake paper for a full explaination) |
48 | //(generated by crypto.randomBytes(32).toString('base64')) |
49 | shs: '1KHLiKZvAvjbY1ziZEHMXawbCEIM6qwjCDm3VYRan/s=', |
50 | |
51 | //used to sign messages |
52 | sign: null |
53 | }, |
54 | master: [], |
55 | logging: { level: 'notice' }, |
56 | party: true //disable quotas |
57 | }, override || {})) |
58 | } |
59 | |
60 | |
61 | |
62 | |
63 | |
64 | |
65 | |
66 | |
67 | |
68 | |
69 | |
70 | |
71 |
Built with git-ssb-web