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

如何让 websocket 连接走代理?

  •  
  •   ob · 2020-09-08 00:56:51 +08:00 · 7004 次点击
    这是一个创建于 1326 天前的主题,其中的信息可能已经有所发展或是发生改变。
    请教下,目前有一台 centos 服务器,装了 ss 客户端,配置好 http_proxy 和 https_proxy,所有的 http 请求,目前可以访问被墙网站,现在的问题是,怎么让 websocket 也通过代理来请求被墙的服务地址?
    把 all_proxy 都设置上了,也是不管用。搜了很多资料没找到解决办法,特来请求帮助,谢谢。
    12 条回复    2020-09-08 08:25:58 +08:00
    liuminghao233
        1
    liuminghao233  
       2020-09-08 01:19:23 +08:00 via iPhone   ❤️ 1
    用 proxychains4 来 hook 一下
    Yourshell
        2
    Yourshell  
       2020-09-08 01:31:13 +08:00   ❤️ 1
    让 websocket 走本地的 socket5 就行了,走 http 是不行的。
    Yourshell
        3
    Yourshell  
       2020-09-08 01:32:23 +08:00
    是 socks5,老打错
    ob
        4
    ob  
    OP
       2020-09-08 01:53:23 +08:00
    @Yourshell 需要单独再装一个吗?
    ob
        5
    ob  
    OP
       2020-09-08 01:54:54 +08:00
    @liuminghao233 这个也支持在代码里面跑的请求?
    liuminghao233
        6
    liuminghao233  
       2020-09-08 02:13:46 +08:00 via iPhone
    @ob 反过来 你需要用 proxychains4 来跑你的程序
    interim
        7
    interim  
       2020-09-08 05:51:44 +08:00 via Android   ❤️ 1
    用 clash 客户端,可以走代理。
    interim
        8
    interim  
       2020-09-08 05:59:58 +08:00
    补一下图,我也是玩贪吃蛇不卡了才发现 ws 走了代理,补一下图 https://imgchr.com/i/wKRyz4
    interim
        9
    interim  
       2020-09-08 06:03:39 +08:00
    这年头没必要用 ss 了...直接 docker 部署 trojan 几分钟的事情 https://ssu.tw/index.php/archives/40/
    ob
        10
    ob  
    OP
       2020-09-08 07:16:48 +08:00
    @liuminghao233
    我装了这个: https://github.com/rofl0r/proxychains-ng
    在 /etc/proxychains.conf 底部配置了我原本可以用的代理:
    socks5 127.0.0.1 8118
    http 127.0.0.1 8118
    -------------------------------
    前面有装 privoxy,上面的端口用 8118 和 1080 都不起作用
    $ proxychains4 curl ip.sb
    [proxychains] config file found: /etc/proxychains.conf
    [proxychains] preloading /usr/lib/libproxychains4.so
    [proxychains] DLL init: proxychains-ng 4.14-git-12-gacf2f47
    [proxychains] Strict chain ... 127.0.0.1:1080 ... 127.0.0.1:1080 ... ip.sb:80 <--socket error or timeout!
    curl: (7) Failed to connect to 224.0.0.1: 拒绝连接

    是我配置错了吗?
    VsevenMagic
        11
    VsevenMagic  
       2020-09-08 08:15:05 +08:00 via iPhone
    走 http 的话配置 v2ray 应该可以
    supermoonie
        12
    supermoonie  
       2020-09-08 08:25:58 +08:00 via iPhone
    @Yourshell websocket 是可以有 http 代理的哦
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4573 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 10:02 · PVG 18:02 · LAX 03:02 · JFK 06:02
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.