Files: 99c877616015d77c9b56ab43e89e74f38c18e7fe / inject.js
1712 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 | connections: { |
37 | incoming: { |
38 | net: [{ port: 8008, scope: "private", "transform": "shs" }] |
39 | }, |
40 | outgoing: { |
41 | net: [{ transform: "shs" }] |
42 | } |
43 | }, |
44 | path: path.join(HOME, '.' + name), |
45 | timers: { |
46 | connection: 0, |
47 | reconnect: 5*SEC, |
48 | ping: 5*MIN, |
49 | handshake: 5*SEC |
50 | }, |
51 | //change these to make a test network that will not connect to the main network. |
52 | caps: { |
53 | //this is the key for accessing the ssb protocol. |
54 | //this will be updated whenever breaking changes are made. |
55 | //(see secret-handshake paper for a full explaination) |
56 | //(generated by crypto.randomBytes(32).toString('base64')) |
57 | shs: '1KHLiKZvAvjbY1ziZEHMXawbCEIM6qwjCDm3VYRan/s=', |
58 | |
59 | //used to sign messages |
60 | sign: null |
61 | }, |
62 | master: [], |
63 | logging: { level: 'notice' }, |
64 | party: true //disable quotas |
65 | }, override || {})) |
66 | } |
67 | |
68 | |
69 | |
70 | |
71 | |
72 | |
73 | |
74 | |
75 | |
76 | |
77 | |
78 | |
79 |
Built with git-ssb-web