Commit e9c39ad310d8b1e80181c27d4852fc235a60b385
Merge branch 'master' of https://github.com/arj03/ssb-client into tor
Dominic Tarr committed on 10/2/2016, 7:13:35 AMParent: 5e25721cf49edb99a5a6c9c1c02a43a255e49a2f
Parent: e66a0e6adee402fb45653a6d80fff9bc929c719a
Files changed
index.js | changed |
index.js | |||
---|---|---|---|
@@ -7,8 +7,9 @@ | |||
7 | 7 … | ||
8 | 8 … | var MultiServer = require('multiserver') | |
9 | 9 … | var WS = require('multiserver/plugins/ws') | |
10 | 10 … | var Net = require('multiserver/plugins/net') | |
11 … | +var Onion = require('multiserver/plugins/onion') | ||
11 | 12 … | var Shs = require('multiserver/plugins/shs') | |
12 | 13 … | ||
13 | 14 … | var muxrpc = require('muxrpc') | |
14 | 15 … | var pull = require('pull-stream') | |
@@ -55,9 +56,12 @@ | |||
55 | 56 … | var host = opts.host || 'localhost' | |
56 | 57 … | var port = opts.port || config.port || 8008 | |
57 | 58 … | var key = opts.key || keys.id | |
58 | 59 … | ||
59 | - remote = 'net:'+host+':'+port+'~shs:'+key.substring(1).replace('.ed25519', '') | ||
60 … | + var protocol = 'net:' | ||
61 … | + if (host.endsWith(".onion")) | ||
62 … | + protocol = 'onion:' | ||
63 … | + remote = protocol+host+':'+port+'~shs:'+key.substring(1).replace('.ed25519', '') | ||
60 | 64 … | } | |
61 | 65 … | ||
62 | 66 … | var manifest = opts.manifest || (function () { | |
63 | 67 … | try { | |
@@ -79,8 +83,9 @@ | |||
79 | 83 … | }) | |
80 | 84 … | ||
81 | 85 … | var ms = MultiServer([ | |
82 | 86 … | [Net({}), shs], | |
87 … | + [Onion({}), shs], | ||
83 | 88 … | [WS({}), shs] | |
84 | 89 … | ]) | |
85 | 90 … | ||
86 | 91 … | ms.client(remote, function (err, stream) { |
Built with git-ssb-web