V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
workwonder
V2EX  ›  程序员

[viaproxy] 我基于 graftcp 封装了一个命令行代理 helper

  •  
  •   workwonder ·
    wonderbeyond · 2022-02-15 16:03:16 +08:00 · 1440 次点击
    这是一个创建于 772 天前的主题,其中的信息可能已经有所发展或是发生改变。

    之前一直用 proxychains/proxychains-ng,后来发现了兼容静态连接程序的 graftcp。为了方便在命令行灵活选用不同的代理后端,我做了一个封装程序,支持通过简洁的参数指定代理服务(免除配置文件):

    $ viaproxy socks5://127.0.0.1:1080 run curl -L https://www.google.com
    
    $ viaproxy http://192.168.1.9:8888 run psql ...
    
    $ viaproxy socks5://127.0.0.1:1080 run bash
    # Got into a new shell
    $ curl -L https://www.google.com
    

    项目地址: https://github.com/wonderbeyond/viaproxy

    6 条回复    2022-02-15 18:19:27 +08:00
    Kasumi20
        1
    Kasumi20  
       2022-02-15 16:14:36 +08:00
    用 redsocks+iptables 实现全局代理的路过
    workwonder
        2
    workwonder  
    OP
       2022-02-15 17:52:40 +08:00
    @Kasumi20 这种全局代理的方法我也用,比较复杂,我还记录了一个笔记,方便在新的机器上配置: https://gist.github.com/wonderbeyond/3289a073c26e5b5c8ee56dc459f91dd9
    gleport
        3
    gleport  
       2022-02-15 18:07:33 +08:00
    很不错!不过发现首层目录缺少 Makefile 导致不能执行 `make -C graftcp`,是否忘提交了?
    workwonder
        4
    workwonder  
    OP
       2022-02-15 18:15:31 +08:00
    @gleport `make -C` 表示切换到另外一个目录执行 make ,我这边不需要外边有 Makefile 唉。

    ---

    $ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 20.04.3 LTS
    Release: 20.04
    Codename: focal

    $ make --version
    GNU Make 4.2.1
    Built for x86_64-pc-linux-gnu
    Copyright (C) 1988-2016 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    workwonder
        5
    workwonder  
    OP
       2022-02-15 18:18:23 +08:00
    @gleport 不好意思,可能是 “Build & Install” 少写了一个前提步骤:`git submodule init`,我补充一下 README
    gleport
        6
    gleport  
       2022-02-15 18:19:27 +08:00 via Android
    忘了 makefile 写法了,请忽略😅
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3017 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 15:00 · PVG 23:00 · LAX 08:00 · JFK 11:00
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.