V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
levenwindy
V2EX  ›  Linux

有没办法动态限速?

  •  
  •   levenwindy · 2022-01-26 17:36:50 +08:00 · 1572 次点击
    这是一个创建于 792 天前的主题,其中的信息可能已经有所发展或是发生改变。
    设备是群晖,docker 里有好几个应用,例如 qbittorrent ,平时都满速上传( pt ),但是偶尔要通过 docker 中的 ssr-server 连回家里,如果不对 qb 限速就很卡,想着一用 ssr ,qbittorrent 动态限速,不用的时候就不限制
    会一点 linux ,python 编程,有没什么案例?或者思路的?对端口限速?
    目前是想用 python:一旦检测 ssr 有链接,就限速 qbittorrent (但是好像只能固定,如果能动态就最好了)
    6 条回复    2022-01-31 12:01:11 +08:00
    XiLingHost
        1
    XiLingHost  
       2022-01-26 17:47:36 +08:00
    这种情况我觉得你需要的是 QoS
    Qetesh
        2
    Qetesh  
       2022-01-27 17:19:35 +08:00
    感觉可以写个 shell ,去判断有没有会话,有的话通过 qbittorrent-cli 之类的设置限速
    leviathan0992
        3
    leviathan0992  
       2022-01-28 11:34:56 +08:00
    有一种思路,你自己写一个限速服务, 在本地将 qbittorrent 进行端口转发, 探测到连接就在端口转发的过程中流速降低.
    levenwindy
        4
    levenwindy  
    OP
       2022-01-29 00:41:35 +08:00
    @Qetesh @leviathan0992 是的,目前在用 netstat 判断$?的返回结果,再调用 py 的 qbittorrentapi 模块对其限速
    netstat -nat |grep 端口 |grep ESTABLISHED
    @XiLingHost 至于 Qos ,看了一些 traffic control (tc),没成功,不知道是不是群晖不支持,还是期待能弄成动态限速
    XiLingHost
        5
    XiLingHost  
       2022-01-29 09:08:46 +08:00
    @levenwindy 你需要的是在路由的层面上对 bt 的流量做 QoS ,来实现自动避让,这样可以充分利用带宽而不需要做限速
    levenwindy
        6
    levenwindy  
    OP
       2022-01-31 12:01:11 +08:00 via Android
    @XiLingHost 看了下路由器,没这功能...
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5694 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 01:48 · PVG 09:48 · LAX 18:48 · JFK 21:48
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.