vpn-deploy-playbook
vpn-deploy-playbook copied to clipboard
shadowsocks 流量统计
方案1:
- 修改 ss-server 吐出对应的日志 或者 udp 包
- 发送到统计服务器
方案2:
- 使用IPTABLE 统计流量
- 定期发送到统计服务器
问题: 是否可以统计 连接到服务器 / 客户端IP ? 来检测/限制客户端数目。
方案1的实现: shadowsocks 修改 https://github.com/mengskysama/shadowsocks/tree/manyuser 对应的前端 https://github.com/wzxjohn/moeSS 对应的前端 https://github.com/orvice/ss-panel
方案2的实现: https://github.com/GameXG/shadowsocks_admin
我更喜欢iptables的那种,实现起来更加灵活。可以将用户管理和shaodowsocks配置,流量管理解藕。 可以用shadowsocks的多端口模式运行,再在user model里面将一个具体的配置(ip,port,password)和一个user绑定。
在shadowsocks slave node上用iptables实现对端口的流量信息统计,再通过rabbitmq之类的直接加密发送至统计服务器master node。基本就是一个custom的radius实现。。。大概也可以在客户端通过端口反查出用户,然后直接用radius客户端发送用户和流量信息至radius服务器。
我现在也在设计一套简单可用的shadowsocks服务设施,希望可以和你多多交流,呵呵
我也觉得不要修改ss, 即使要修改也要保证协议兼容。
@ftao 第二个方案的坏处也很明显,isp 会对非常用端口进行限速,所以都用一个常用的端口,流量上更有保障一些
https://github.com/shadowsocks/shadowsocks/wiki/Manage-Multiple-Users If you want to build a user management system, Shadowsocks provides an API that allows you to add/remove ports on the fly, as well as get transfer statistics from Shadowsocks.
cool. I was not aware of this feature .. @jackjm thanks for the link .
@jackjm Thanks for mentioning it. It's really cool. Seems libev implementation has this feature too.