portfwd icon indicating copy to clipboard operation
portfwd copied to clipboard

A low performance port forwarding implementation

Results 6 portfwd issues
Sort by recently updated
recently updated
newest added

如题。。用的sstap,很奇怪。 端口段也能用了,TCP能跑起来了,很棒,一点都不低性能。就是UDP无法转发 已经关了firewalld、iptables、宝塔了 ``` [53:22] 测试已开始. [53:22] 正在测试TCP数据传递... [53:22] 测试TCP数据传递...通过! [53:22] 延迟: 31 ms [53:22] 测试完成! [53:22] ////////////////////////////////////////////// [53:22] 测试已开始. [53:22] 正在测试UDP转发... [53:34] 测试UDP转发...未通过! [53:34] 测试完成! [53:34] ////////////////////////////////////////////// ```

例如在 config.json 中 加入一个 secret 字段 ``` [root@xxx portfwd]# cat config.json { "proxy": { "5000": "47.xxx.xxx.xxx:5000", "5001/8000": "47.xxx.xxx.xxx:5001" }, "APIPort": ":3001", "secret": "这里是访问密码" } ``` 如果secret密码错了,则api请求报错,因为我发现我portfwd部署到线上,经常受到僵尸网络和爬虫的骚扰

首先感谢采纳可以自定义config文件地址的建议,其次报一个BUG: config.json 配置如下 ``` [root@xxx portfwd]# cat config.json { "proxy": { "5000": "47.xxx.xxx.xxx:5000", "5001/8000": "47.xxx.xxx.xxx:5001" }, "APIPort": ":3001" } ``` 单端口访问是正常的:http://portfwd.xxx:3001/proxy/5000 端口段访问失败的/:http://portfwd.xxx:3001/proxy/5001/8000 ** 建议端口段通过-分隔而不是通过/

因为portfwd是用来中转的,目前我的操作方式是:安装vnstat ,用vnstat -l查看流量是否有进出判断是否中转成功,如果可以在程序里记录中转进来的请求日志,想必是极好的。 我自己写了一个logrun.sh ,用来输出 portfwd的日志,内容如下: ``` [root@xxx portfwd]# cat logrun.sh #!/bin/bash cd `dirname $0` ulimit -n 512000 ps -ef|grep 'portfwd' if [ $? -ne 0 ] then nohup ./portfwd...

比如config.json 里proxy加一条 `"5000-8000":"47.xxx.xxx.xxx:5000"` (此处原本是 5000/8000,我个人建议用 - 分隔,不然有BUG,详情见 #5 ) 虽然大佬你已经解释说写上结束的端口号没有意义,但是 通过api读取出来的值就是一脸懵逼了,所以还是建议 配置可以写成:`"5000-8000":"47.xxx.xxx.xxx:5000-8000"`,并且在程序里判断,如果配置写错了,则启动portfwd时报错 例如我把 `"5000-8000":"47.xxx.xxx.xxx:5000-8000"` 写错写成了:`"5000-8000":"47.xxx.xxx.xxx:5000-8001"`

这样写是可以的: ``` [root@xxx portfwd]# cat config.json { "proxy": { "5000": "47.xxx.xxx.xxx:5000", "5001/8000": "47.xxx.xxx.xxx:5001" }, "APIPort": ":3001" } ``` 这样写会挂掉: ``` [root@xxx portfwd]# cat config.json { "proxy": { "5001/8000": "47.xxx.xxx.xxx:5001", "5000":...