typo fixes and pass serviceport
This commit is contained in:
parent
8f7dec1df1
commit
05cb157cfc
|
@ -154,7 +154,7 @@ function applyConfig(config) {
|
|||
state.tcp[port].listen(port, function () {
|
||||
console.log('listening plain TCP on ' + port);
|
||||
});
|
||||
state.tcp[port].on('connection', netConnHandlers.tcp);
|
||||
state.tcp[port].on('connection', function (conn) { netConnHandlers.tcp(conn, port); });
|
||||
});
|
||||
//});
|
||||
}
|
||||
|
|
|
@ -3,11 +3,13 @@
|
|||
var Packer = require('proxy-packer');
|
||||
var sni = require('sni');
|
||||
|
||||
function pipeWs(servername, service, conn, remote) {
|
||||
function pipeWs(servername, service, conn, remote, serviceport) {
|
||||
console.log('[pipeWs] servername:', servername, 'service:', service);
|
||||
|
||||
var browserAddr = Packer.socketToAddr(conn);
|
||||
browserAddr.service = service;
|
||||
browserAddr.serviceport = serviceport;
|
||||
browserAddr.name = servername;
|
||||
var cid = Packer.addrToId(browserAddr);
|
||||
conn.tunnelCid = cid;
|
||||
console.log('[pipeWs] browser is', cid, 'home-cloud is', Packer.socketToId(remote.upgradeReq.socket));
|
||||
|
@ -51,7 +53,8 @@ function pipeWs(servername, service, conn, remote) {
|
|||
module.exports.createTcpConnectionHandler = function (copts) {
|
||||
var Devices = copts.Devices;
|
||||
|
||||
return function onTcpConnection(conn) {
|
||||
return function onTcpConnection(conn, serviceport) {
|
||||
console.log('[new conn] from port', serviceport);
|
||||
// this works when I put it here, but I don't know if it's tls yet here
|
||||
// httpsServer.emit('connection', socket);
|
||||
//tls3000.emit('connection', socket);
|
||||
|
@ -124,7 +127,7 @@ module.exports.createTcpConnectionHandler = function (copts) {
|
|||
|
||||
console.log("pipeWs(servername, service, socket, deviceLists['" + servername + "'])");
|
||||
deferData();
|
||||
pipeWs(servername, service, conn, nextDevice);
|
||||
pipeWs(servername, service, conn, nextDevice, serviceport);
|
||||
}
|
||||
|
||||
if (copts.config.vhost) {
|
||||
|
@ -175,7 +178,7 @@ module.exports.createTcpConnectionHandler = function (copts) {
|
|||
// HTTP
|
||||
if (Devices.exist(copts.deviceLists, servername)) {
|
||||
deferData();
|
||||
pipeWs(servername, service, conn, Devices.next(copts.deviceLists, servername));
|
||||
pipeWs(servername, service, conn, Devices.next(copts.deviceLists, servername), serviceport);
|
||||
return;
|
||||
}
|
||||
deferData('handleHttp');
|
||||
|
|
|
@ -261,7 +261,7 @@ module.exports.create = function (state) {
|
|||
}
|
||||
|
||||
, onmessage: function (tun) {
|
||||
var cid = packer.addrToId(tun);
|
||||
var cid = Packer.addrToId(tun);
|
||||
console.log("remote '" + logName() + "' has data for '" + cid + "'", tun.data.byteLength);
|
||||
|
||||
var browserConn = getBrowserConn(cid);
|
||||
|
|
Loading…
Reference in New Issue