Merge branch 'master' into commercial
This commit is contained in:
commit
2b2a0021aa
|
@ -5,7 +5,7 @@
|
||||||
var pkg = require('../package.json');
|
var pkg = require('../package.json');
|
||||||
|
|
||||||
var argv = process.argv.slice(2);
|
var argv = process.argv.slice(2);
|
||||||
var telebitd = require('../');
|
var relay = require('../');
|
||||||
var Greenlock = require('greenlock');
|
var Greenlock = require('greenlock');
|
||||||
|
|
||||||
var confIndex = argv.indexOf('--config');
|
var confIndex = argv.indexOf('--config');
|
||||||
|
@ -168,7 +168,7 @@ function applyConfig(config) {
|
||||||
};
|
};
|
||||||
|
|
||||||
var net = require('net');
|
var net = require('net');
|
||||||
var netConnHandlers = telebitd.create(state); // { tcp, ws }
|
var netConnHandlers = relay.create(state); // { tcp, ws }
|
||||||
var WebSocketServer = require('ws').Server;
|
var WebSocketServer = require('ws').Server;
|
||||||
var wss = new WebSocketServer({ server: (state.httpTunnelServer || state.httpServer) });
|
var wss = new WebSocketServer({ server: (state.httpTunnelServer || state.httpServer) });
|
||||||
wss.on('connection', netConnHandlers.ws);
|
wss.on('connection', netConnHandlers.ws);
|
||||||
|
|
|
@ -114,13 +114,11 @@ module.exports.create = function (state) {
|
||||||
//
|
//
|
||||||
// To ADMIN / CONTROL PANEL of the Tunnel Server Itself
|
// To ADMIN / CONTROL PANEL of the Tunnel Server Itself
|
||||||
//
|
//
|
||||||
var serveAdmin = require('serve-static')(__dirname + '/admin', { redirect: true });
|
var serveAdmin = require('serve-static')(__dirname + '/../admin', { redirect: true });
|
||||||
var finalhandler = require('finalhandler');
|
var finalhandler = require('finalhandler');
|
||||||
state.httpTunnelServer = http.createServer(function (req, res) {
|
state.httpTunnelServer = http.createServer(function (req, res) {
|
||||||
res.setHeader('connection', 'close');
|
res.setHeader('connection', 'close');
|
||||||
serveAdmin(req, res, function () {
|
serveAdmin(req, res, finalhandler(req, res));
|
||||||
finalhandler(req, res)
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
Object.keys(state.tlsOptions).forEach(function (key) {
|
Object.keys(state.tlsOptions).forEach(function (key) {
|
||||||
tunnelAdminTlsOpts[key] = state.tlsOptions[key];
|
tunnelAdminTlsOpts[key] = state.tlsOptions[key];
|
||||||
|
@ -152,7 +150,7 @@ module.exports.create = function (state) {
|
||||||
//
|
//
|
||||||
// First time setup
|
// First time setup
|
||||||
//
|
//
|
||||||
var serveSetup = require('serve-static')(__dirname + '/admin/setup', { redirect: true });
|
var serveSetup = require('serve-static')(__dirname + '/../admin/setup', { redirect: true });
|
||||||
var finalhandler = require('finalhandler');
|
var finalhandler = require('finalhandler');
|
||||||
state.httpSetupServer = http.createServer(function (req, res) {
|
state.httpSetupServer = http.createServer(function (req, res) {
|
||||||
if (req.socket.encrypted) {
|
if (req.socket.encrypted) {
|
||||||
|
|
Loading…
Reference in New Issue