opts -> copts
This commit is contained in:
parent
09a98f6b3a
commit
8840319094
14
wstunneld.js
14
wstunneld.js
|
@ -9,7 +9,7 @@ var jwt = require('jsonwebtoken');
|
||||||
var packer = require('tunnel-packer');
|
var packer = require('tunnel-packer');
|
||||||
var WebSocketServer = require('ws').Server;
|
var WebSocketServer = require('ws').Server;
|
||||||
|
|
||||||
module.exports.create = function (opts) {
|
module.exports.create = function (copts) {
|
||||||
|
|
||||||
function onWsConnection(ws) {
|
function onWsConnection(ws) {
|
||||||
var location = url.parse(ws.upgradeReq.url, true);
|
var location = url.parse(ws.upgradeReq.url, true);
|
||||||
|
@ -285,7 +285,7 @@ module.exports.create = function (opts) {
|
||||||
console.log('servername', servername);
|
console.log('servername', servername);
|
||||||
if (/HTTP\//i.test(str)) {
|
if (/HTTP\//i.test(str)) {
|
||||||
service = 'http';
|
service = 'http';
|
||||||
if (/\/\.well-known\/acme-challenge\//.test(str)) {
|
if (/^\/\.well-known\/acme-challenge\//.test(str)) {
|
||||||
// HTTP
|
// HTTP
|
||||||
if (remotes[servername]) {
|
if (remotes[servername]) {
|
||||||
pipeWs(servername, service, browser, remotes[servername]);
|
pipeWs(servername, service, browser, remotes[servername]);
|
||||||
|
@ -315,12 +315,12 @@ module.exports.create = function (opts) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var tlsOpts = opts.tlsOptions;
|
var tlsOpts = copts.tlsOptions;
|
||||||
//var store = opts.store;
|
//var store = copts.store;
|
||||||
|
|
||||||
var remotes = {};
|
var remotes = {};
|
||||||
var selfnames = opts.servernames;
|
var selfnames = copts.servernames;
|
||||||
var secret = opts.secret;
|
var secret = copts.secret;
|
||||||
|
|
||||||
var httpServer = http.createServer(function (req, res) {
|
var httpServer = http.createServer(function (req, res) {
|
||||||
console.log('req.socket.encrypted', req.socket.encrypted);
|
console.log('req.socket.encrypted', req.socket.encrypted);
|
||||||
|
@ -335,7 +335,7 @@ module.exports.create = function (opts) {
|
||||||
|
|
||||||
wss.on('connection', onWsConnection);
|
wss.on('connection', onWsConnection);
|
||||||
|
|
||||||
opts.ports.forEach(function (port) {
|
copts.ports.forEach(function (port) {
|
||||||
var tcp3000 = net.createServer();
|
var tcp3000 = net.createServer();
|
||||||
tcp3000.listen(port, function () {
|
tcp3000.listen(port, function () {
|
||||||
console.log('listening on ' + port);
|
console.log('listening on ' + port);
|
||||||
|
|
Loading…
Reference in New Issue