bunnel
Version:
Websocket reverse tunnel
46 lines (33 loc) • 911 B
Markdown
```bash
npm install bunnel
npm install -g bunnel
```
```bash
bunnel client --local http://localhost:3000 --tunnel wss://example.com:4444
```
```javascript
import { TunnelClient } from 'bunnel';
const tunnel = new TunnelClient({
localServerUrl: 'http://localhost:3000',
tunnelServerUrl: 'wss://example.com:4444',
onClosed: () => console.log('Tunnel closed')
});
try {
const { subdomain, tunnelUrl, proxyUrl } = await tunnel.connect();
console.log(`Tunnel available on remote at: ${tunnelUrl} or ${proxyUrl}`);
// Later, to disconnect
tunnel.disconnect();
} catch (error) {
console.error('Tunnel error:', error);
}
```
- `--local, -l`: Local server URL)
- `--tunnel, -t`: Tunnel server URL)