src/client.js
// create the control socket that spawns more sockets on demand
create the control socket that spawns more sockets on demand
create the control socket that spawns more sockets on demand
async function expose(host, requestedPublicPort, localPort) {
	const {ctrlPort, pubPort} = await fetch(
		`http://${host}:3000/create-tunnel/${requestedPublicPort || ''}`
	).then(r => r.json())
	debug('ctrlPort is', ctrlPort)
	console.log('Public port is', pubPort)
	const sock = net.createConnection({
		host,
		port: ctrlPort,
	})
	sock.on('data', d => {
		const hubPort = parseInt(d.toString('utf-8'))
		createLocalForwarder(host, hubPort, localPort)
	})
}
async function expose ( host , requestedPublicPort , localPort ) { const { ctrlPort , pubPort } = await fetch ( ` ${ host } ${ requestedPublicPort || '' } ` ) . then ( r => r . json ( ) ) debug ( 'ctrlPort is' , ctrlPort ) console . log ( 'Public port is' , pubPort ) const sock = net . createConnection ( { host , port : ctrlPort , } ) sock . on ( 'data' , d => { const hubPort = parseInt ( d . toString ( 'utf-8' ) ) createLocalForwarder ( host , hubPort , localPort ) } ) }
create the control socket that spawns more sockets on demand
create the control socket that spawns more sockets on demand