src/client.js
// to a local port on this computer
to a local port on this computer
to a local port on this computer
function createLocalForwarder(host, hubPort, localPort) {
	debug(`Creating forwarder at hub:${hubPort}`)
	const hub = net.createConnection({host, port: hubPort})
	const local = net.createConnection({port: localPort})
	const cleanup = _.once(function() {
		debug(`Closing forwarder at hub:${hubPort}`)
		hub.destroy()
		local.destroy()
	})
	hub.on('data', d => local.write(d))
	hub.on('close', () => cleanup())
	local.on('data', d => hub.write(d))
	local.on('close', () => cleanup())
}
function createLocalForwarder ( host , hubPort , localPort ) { debug ( ` ${ hubPort } ` ) const hub = net . createConnection ( { host , port : hubPort } ) const local = net . createConnection ( { port : localPort } ) const cleanup = _ . once ( function ( ) { debug ( ` ${ hubPort } ` ) hub . destroy ( ) local . destroy ( ) } ) hub . on ( 'data' , d => local . write ( d ) ) hub . on ( 'close' , ( ) => cleanup ( ) ) local . on ( 'data' , d => hub . write ( d ) ) local . on ( 'close' , ( ) => cleanup ( ) ) }
to a local port on this computer
to a local port on this computer