Giter Site home page Giter Site logo

Comments (12)

zfl9 avatar zfl9 commented on May 26, 2024

这个应该和 ss-tproxy 没关系,建议查看 代理程序 的日志和配置,以及内核相关网络参数,可以优化下。

有很多因素:

  • 代理程序的配置,如 nofile 设置不当,导致同时允许打开的文件数量(socket 数量)受到限制。
  • 代理程序自身的处理能力,针对这种情况,可以多开几个代理进程(利用 so_reuseport 特性)。
  • ss-tproxy 主机的内核参数,比如 nr_open、file-max,可能限制了同时可打开的文件数。
  • 代理节点(VPS)的承载能力,代理进程多开时,不要只用一个节点,多用几个,将流量分散。
  • 还有其他因素,如代理协议本身的抗干扰能力,在流量大、连接数多的时候是否抵得住GFW、ISP的干扰。

from ss-tproxy.

zfl9 avatar zfl9 commented on May 26, 2024

总之,需要结合 ss-tproxy 主机的内核参数/配置、dmesg日志、代理进程的日志、配置信息 等分析。

from ss-tproxy.

zfl9 avatar zfl9 commented on May 26, 2024

ss-tproxy 这边只是设置代理环境、代理规则,真正的运行过程,特别是处理能力,取决于代理自身。

from ss-tproxy.

sophauer avatar sophauer commented on May 26, 2024

抱歉,是我没说清楚.
同一台软路由上.,
跑的是Naive代理.socket端口在1080.SS-TPROXY在60080
当连接重置发生时.
电脑A直接配置经过socket 1080端口上网,没问题,
电脑B,DNS,Gateway指向旁路由IP,.浏览器报连接重置,但多刷几次,可以刷出来

另一个部门,windows机器配置代理http://软路由IP/gfw.pac上网,一切正常,不管多少线程都稳住
这个pac指向的,也是软路由socket 1080端口

也就是说,只要不走ss-tproxy规则及处理的,就没问题

from ss-tproxy.

zfl9 avatar zfl9 commented on May 26, 2024

那就要看看 ss-tproxy 主机自身的内核参数配置、特别是要结合日志分析,要看是什么原因导致链接重置,只看现象没帮助。

看你描述,你的代理是跑在其他主机上(native)上吗?也就是说,ss-tproxy 主机和你的 native 主机不是同一个?

这种情况下,你是在 ss-tproxy 主机上使用了 ipt2socks 对接 native 主机上的 socks5 端口么?

from ss-tproxy.

sophauer avatar sophauer commented on May 26, 2024

ss-tproxy 主机和native 主机是同一个,
是的,用了ipt2socks对接socks5 端口

from ss-tproxy.

zfl9 avatar zfl9 commented on May 26, 2024

那就检查 ipt2socks 日志,估计是 nofile 达到 limit 了。可以使用 ipt2socks 的 --nofile-limit 100000 提高下(需要 root 权限)

$ ipt2socks --help
 -j, --thread-nums <num>            number of the worker threads, default: 1
 -n, --nofile-limit <num>           set nofile limit, may need root privilege

另外建议指定 -j 选项,启用多线程(SO_REUSEPORT)。

from ss-tproxy.

sophauer avatar sophauer commented on May 26, 2024

hi,感谢回覆
但我有点困惑,
不管是执行
ipt2socks -j4 -n100000 -r
或是ipt2socks -j4 -n 100000 -r
得到的都是
2024-03-07 22:31:56 INF: [main] server address: 127.0.0.1#1080
2024-03-07 22:31:56 INF: [main] listen address: 127.0.0.1#60080
2024-03-07 22:31:56 INF: [main] listen address: ::1#60080
2024-03-07 22:31:56 INF: [main] udp cache maximum size: 256
2024-03-07 22:31:56 INF: [main] udp socket idle timeout: 60
2024-03-07 22:31:56 INF: [main] number of worker threads: 4
2024-03-07 22:31:56 INF: [main] enable tcp transparent proxy
2024-03-07 22:31:56 INF: [main] enable udp transparent proxy
2024-03-07 22:31:56 INF: [main] always enable reuseport feature

似乎nofile-limit配置不起作用?

from ss-tproxy.

zfl9 avatar zfl9 commented on May 26, 2024

nofile-limit 不会显示出来的。

from ss-tproxy.

zfl9 avatar zfl9 commented on May 26, 2024

可以使用 prlimit -p ipt2socks进程ID 来检查 NOFILE 行(SOFT 列),是否设置生效。

通常来说,如果设置失败,ipt2socks 会打印一条错误信息的,如果没有错误(比如你这个),就是成功了。

from ss-tproxy.

sophauer avatar sophauer commented on May 26, 2024

感谢,配置好之后,问题解决了

from ss-tproxy.

cattyhouse avatar cattyhouse commented on May 26, 2024

也可以这样查看 limits :

cat /proc/$(pgrep -x ipt2socks)/limits

from ss-tproxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.