爱意满满的作品展示区。
120267583

写了个多网卡聚合的小小工具

  •  1
     
  •   120267583 · Apr 25, 2022 · 5617 views
    This topic created in 1653 days ago, the information mentioned may be changed or developed.

    由于自己平时有多网卡并发的需求,但是 window 系统好像默认只会走一个出口联网,

    网上看了下也没找到合适的工具,干脆自己写了个小工具来实现了

    https://github.com/iptop/multi-wan-socks5

    目前已经能实现我自己同时调用多个网卡下载的需求,希望可以起到抛砖引玉的作用

    其实原理也很简单,创建 TCP 套接字的时候如果指定了 localaddr.IP ,就会优先从对应的网卡走了,不过绝大多数的应用程序是不会指定的

    21 replies  •  2022-04-25 23:28:28 +08:00
    anshigm
    anshigm
    Apr 25, 2022
    1
    效果等于是 windows 上面的 load-balancing 吗?
    120267583
    120267583
    OP
    Apr 25, 2022
    2
    @anshigm 实际上在 mac 和 Linux 上应该也能工作
    missdeer
    missdeer
    Apr 25, 2022
    3
    只能下载用吗?
    asilin
    asilin
    Apr 25, 2022
    4
    @120267583 Linux 4.15 环境下无法正常运行
    cs8425
    cs8425
    Apr 25, 2022❤️1
    5
    linux 下绑定 LocalAddr 会被路由影响而失效
    要使用特别的 system call
    code 可以参考: https://github.com/cs8425/go-smalltools/blob/master/network/socks.go#L149-L162
    前几天也有 V 友问过类似的问题: https://www.v2ex.com/t/848821
    littlewing
    littlewing
    Apr 25, 2022
    6
    网速可以叠加吗
    120267583
    120267583
    OP
    Apr 25, 2022
    7
    @missdeer 如果你要用这个来看网页负载均衡应该也可以
    120267583
    120267583
    OP
    Apr 25, 2022
    8
    @asilin 我自己试了下 Linux5.3 内核是可以的,你这个错误应该和内核版本没关系,应该是哪个情况我还没考虑到
    120267583
    120267583
    OP
    Apr 25, 2022
    9
    @cs8425 长见识了
    120267583
    120267583
    OP
    Apr 25, 2022
    10
    @littlewing 可以的,主要就是为了这个目的做的
    cs8425
    cs8425
    Apr 25, 2022
    11
    @asilin #4
    @120267583 #8
    看了下 code
    应该是界面没位址或是只有一个位址
    NLight
    NLight
    Apr 25, 2022
    12
    和梯子如何结合?比如 clash
    120267583
    120267583
    OP
    Apr 25, 2022
    13
    @NSDont 不懂你的场景,不过估计得改造源码了
    120267583
    120267583
    OP
    Apr 25, 2022
    14
    @cs8425 因为主力开发语言不是 go ,异常处理的不够严谨
    NLight
    NLight
    Apr 25, 2022
    15
    v mac 下执行报错了
    120267583
    120267583
    OP
    Apr 25, 2022
    16
    @NSDont 看来得用 mac 调试一波了
    120267583
    120267583
    OP
    Apr 25, 2022
    17
    @NSDont @asilin 暂时加了个数组长度的判断应该稳了
    github2020
    github2020
    Apr 25, 2022
    18
    可以用现成的工具: https://github.com/nadoo/glider
    glider -verbose -listen :8443 -forward=direct://#interface=eth0 -forward=direct://#interface=eth1
    0x5e
    0x5e
    Apr 25, 2022
    19
    最近也在研究 win 链路聚合的事情,分享两个方案
    1. 把 windows server 的 lbfo 模块移植过来
    https://github.com/gsuberland/lbfo_win10
    2. 使用 intel 网卡驱动中自带的链路聚合功能( win11 需要下旧版本的驱动大概是 26.4 之前的,新的不提供此功能了)
    120267583
    120267583
    OP
    Apr 25, 2022
    20
    @github2020 长见识了,没想到还有这样集大成者
    120267583
    120267583
    OP
    Apr 25, 2022
    21
    @0x5e 你这个技术路线我没太听懂,但是听着感觉难度挺大的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1416 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 78ms · UTC 18:48 · PVG 02:48 · LAX 10:48 · JFK 13:48
    ♥ Do have faith in what you're doing.