@gibme/port-forwarder
v1.0.10
Published
A simple port forward helper/service
Downloads
3
Readme
Simple TCP Port Forwarding Server
Documentation
https://gibme-npm.github.io/port-forwarder/
Sample Code
Static Forwarding
import PortForwarder from '@gibme/port-forwarder';
(async () => {
const server = new PortForwarder({
port: 12345,
remote: {
ip: 'remotehost',
port: 22
}
});
await server.start();
})()
Dynamic Forwarding
import PortForwarder from '@gibme/port-forwarder';
(async () => {
const server = new PortForwarder({ port: 12345 });
server.on('connection', async (socket) => {
if (await server.forward(socket, 'remotehost', 22)) {
console.log('ok');
} else {
console.log('failed');
}
});
await server.start();
})()