本地端口转发,80端口的请求直接转发到8080
process.on('uncaughtException', e=>console.log(e))
const net=require('net')
net.createServer(c=>{
const ws=net.createConnection(8080)
c.pipe(ws)
ws.pipe(c)
}).listen(80)
windows上,保存代码到 c:\windows\system32\port2port.bat
/*
@echo off
cls
node "%0" %1 %2
*/
const [,,from,to]=process.argv
console.log(`port transferring: ${from} => ${to}`)
process.on('uncaughtException', e=>console.log(e))
const net=require('net')
net.createServer(c=>{
const ws=net.createConnection(to)
c.pipe(ws)
ws.pipe(c)
}).listen(from)
可使用Win+R
命令行快速启动端口转发
port2port 80 8080
相关文档
暂无
随便看看
畅言模块加载中