Compare commits
No commits in common. "986102c79e3be5db169e4b357a754e907fbc38ce" and "7f3c8ee96db4414ff2f6bc64d7158ce4f393fae1" have entirely different histories.
986102c79e
...
7f3c8ee96d
|
@ -1,4 +0,0 @@
|
||||||
#!/usr/bin/env node
|
|
||||||
'use strict'
|
|
||||||
|
|
||||||
console.log(require('crypto').randomBytes(16).toString('hex'));
|
|
|
@ -1,13 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
rm -rf ./node-installer.sh
|
|
||||||
curl -fsSL bit.ly/node-installer -o ./node-installer.sh
|
|
||||||
bash ./node-installer.sh --dev-deps
|
|
||||||
|
|
||||||
git clone https://git.coolaj86.com/coolaj86/tunnel-server.js.git
|
|
||||||
pushd tunnel-server.js/
|
|
||||||
npm install
|
|
||||||
my_secret=$(node bin/generate-secret.js)
|
|
||||||
echo "Your secret is:\n\n\t"$my_secret
|
|
||||||
echo "node bin/server.js --servernames tunnel.example.com --secret $my_secret"
|
|
||||||
popd
|
|
|
@ -96,7 +96,7 @@ program.ports.forEach(function (port) {
|
||||||
|
|
||||||
program.servernames = Object.keys(servernamesMap);
|
program.servernames = Object.keys(servernamesMap);
|
||||||
if (!program.servernames.length) {
|
if (!program.servernames.length) {
|
||||||
throw new Error('You must give this server at least one servername for its admin interface. Example:\n\n\t--servernames tunnel.example.com,tunnel.example.net');
|
throw new Error('must specify at least one server or servername');
|
||||||
}
|
}
|
||||||
|
|
||||||
program.ports = Object.keys(portsMap);
|
program.ports = Object.keys(portsMap);
|
||||||
|
@ -145,8 +145,8 @@ if (!program.email || !program.agreeTos) {
|
||||||
else {
|
else {
|
||||||
program.greenlock = greenlock.create({
|
program.greenlock = greenlock.create({
|
||||||
|
|
||||||
version: 'draft-11'
|
//server: 'staging'
|
||||||
, server: 'https://acme-v02.api.letsencrypt.org/directory'
|
server: 'https://acme-v01.api.letsencrypt.org/directory'
|
||||||
|
|
||||||
, challenges: {
|
, challenges: {
|
||||||
// TODO dns-01
|
// TODO dns-01
|
||||||
|
|
13
wstunneld.js
13
wstunneld.js
|
@ -72,9 +72,8 @@ module.exports.create = function (copts) {
|
||||||
var activityTimeout = copts.activityTimeout || 2*60*1000;
|
var activityTimeout = copts.activityTimeout || 2*60*1000;
|
||||||
var pongTimeout = copts.pongTimeout || 10*1000;
|
var pongTimeout = copts.pongTimeout || 10*1000;
|
||||||
|
|
||||||
function onWsConnection(ws, upgradeReq) {
|
function onWsConnection(ws) {
|
||||||
console.log(ws);
|
var socketId = packer.socketToId(ws.upgradeReq.socket);
|
||||||
var socketId = packer.socketToId(upgradeReq.socket);
|
|
||||||
var remotes = {};
|
var remotes = {};
|
||||||
|
|
||||||
function logName() {
|
function logName() {
|
||||||
|
@ -179,7 +178,6 @@ module.exports.create = function (copts) {
|
||||||
// domains and the list of all this websocket's remotes.
|
// domains and the list of all this websocket's remotes.
|
||||||
token.deviceId = (token.device && (token.device.id || token.device.hostname)) || token.domains.join(',');
|
token.deviceId = (token.device && (token.device.id || token.device.hostname)) || token.domains.join(',');
|
||||||
token.ws = ws;
|
token.ws = ws;
|
||||||
token.upgradeReq = upgradeReq;
|
|
||||||
token.clients = {};
|
token.clients = {};
|
||||||
|
|
||||||
token.pausedConns = [];
|
token.pausedConns = [];
|
||||||
|
@ -223,7 +221,6 @@ module.exports.create = function (copts) {
|
||||||
Devices.remove(deviceLists, domainname, remote);
|
Devices.remove(deviceLists, domainname, remote);
|
||||||
});
|
});
|
||||||
remote.ws = null;
|
remote.ws = null;
|
||||||
remote.upgradeReq = null;
|
|
||||||
|
|
||||||
// Close all of the existing browser connections associated with this websocket connection.
|
// Close all of the existing browser connections associated with this websocket connection.
|
||||||
Object.keys(remote.clients).forEach(function (cid) {
|
Object.keys(remote.clients).forEach(function (cid) {
|
||||||
|
@ -235,7 +232,7 @@ module.exports.create = function (copts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var firstToken;
|
var firstToken;
|
||||||
var authn = (upgradeReq.headers.authorization||'').split(/\s+/);
|
var authn = (ws.upgradeReq.headers.authorization||'').split(/\s+/);
|
||||||
if (authn[0] && 'basic' === authn[0].toLowerCase()) {
|
if (authn[0] && 'basic' === authn[0].toLowerCase()) {
|
||||||
try {
|
try {
|
||||||
authn = new Buffer(authn[1], 'base64').toString('ascii').split(':');
|
authn = new Buffer(authn[1], 'base64').toString('ascii').split(':');
|
||||||
|
@ -243,7 +240,7 @@ module.exports.create = function (copts) {
|
||||||
} catch (err) { }
|
} catch (err) { }
|
||||||
}
|
}
|
||||||
if (!firstToken) {
|
if (!firstToken) {
|
||||||
firstToken = url.parse(upgradeReq.url, true).query.access_token;
|
firstToken = url.parse(ws.upgradeReq.url, true).query.access_token;
|
||||||
}
|
}
|
||||||
if (firstToken) {
|
if (firstToken) {
|
||||||
var err = addToken(firstToken);
|
var err = addToken(firstToken);
|
||||||
|
@ -444,7 +441,7 @@ module.exports.create = function (copts) {
|
||||||
browserAddr.service = service;
|
browserAddr.service = service;
|
||||||
var cid = packer.addrToId(browserAddr);
|
var cid = packer.addrToId(browserAddr);
|
||||||
conn.tunnelCid = cid;
|
conn.tunnelCid = cid;
|
||||||
console.log('[pipeWs] browser is', cid, 'home-cloud is', packer.socketToId(remote.upgradeReq.socket));
|
console.log('[pipeWs] browser is', cid, 'home-cloud is', packer.socketToId(remote.ws.upgradeReq.socket));
|
||||||
|
|
||||||
function sendWs(data, serviceOverride) {
|
function sendWs(data, serviceOverride) {
|
||||||
if (remote.ws && (!conn.tunnelClosing || serviceOverride)) {
|
if (remote.ws && (!conn.tunnelClosing || serviceOverride)) {
|
||||||
|
|
Loading…
Reference in New Issue