how can i use pac proxy in terminal ? - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
0139
V2EX    Linux

how can i use pac proxy in terminal ?

  •  
  •   0139 2016-01-08 14:25:13 +08:00 9882 次点击
    这是一个创建于 3567 天前的主题,其中的信息可能已经有所发展或是发生改变。

    Sorry,I haven't install Chinese language in my system yet.
    After installing lantern,chrome can surf Internet now,but in terminal
    i can't ping google.com.

    第 1 条附言    2016-01-09 09:50:05 +08:00
    vim ~/.bashrc
    add:
    export http_proxy='http://localhost:8787'
    export ftp_proxy='http://localhost:8787'
    export https_proxy='http://localhost:8787'
    #的确, lantern 的端口是 8787 ,这里写了:/home/*/.lantern/lantern-2.0.10.yaml
    source .bashrc
    ps.
    如果在终端直接输这段话仅当前终端窗口有效,所以写文件里了。
    一开始是发现 apt-get update 时不能连接到 dl.google.com ,
    虽然这样做还不能 ping google.com ,但可以完整更新源了:
    92% [10 Packages bzip2 0 B] [12 Packages 0 B/1,361 kB 0%] [Connecting to dl.google.com (216.58.197.110)] 520 kB/s
    proxychains 还没看,等最近考完试再弄,谢谢大家~
    18 条回复    2016-01-20 19:20:10 +08:00
    AtlantisZ
        1
    AtlantisZ  
       2016-01-08 14:32:03 +08:00 via Android
    层次不一样..ping 不是应用层的吧..
    Tink
        2
    Tink  
    PRO
       2016-01-08 14:33:49 +08:00
    proxychains
    AtlantisZ
        3
    AtlantisZ  
       2016-01-08 14:35:21 +08:00 via Android
    @AtlantisZ 不对.是应用层直接调用网络层..
    xcodebuild
        4
    xcodebuild  
       2016-01-08 14:50:09 +08:00
    proxychains ,而且你得找出 pac 里真正的 http proxy
    knightdf
        5
    knightdf  
       2016-01-08 14:59:49 +08:00
    直接网络连接里设置代理不就得了
    Guenlay
        6
    Guenlay  
       2016-01-08 15:13:10 +08:00
    proxychains 是全过代理 如果一定要用 PAC 的自动功能 那还得找一个支持 PAC 的程序 然后 proxychains 接上级代理
    好残的解决方案
    master13
        7
    master13  
       2016-01-08 15:23:51 +08:00
    Does "in terminal i can't ping google.com." mean "connection to google.com via terminal remains unavailable." ?
    raysonx
        8
    raysonx  
       2016-01-08 15:24:00 +08:00
    pac is just a simple script to configure proxy logic for a browser, not a proxy protocol.
    If you are using a SOCKS proxy, note that SOCKS only supports for TCP/UDP protocol while `ping` is based on ICMP protocol. As a result, `ping` doesn't work through those kinds of proxy.
    qinxi
        9
    qinxi  
       2016-01-08 15:31:56 +08:00
    我没用 pac 模式. ss 的 windows 下 `set http_proxy=http://localhost:1080/`
    nbndco
        10
    nbndco  
       2016-01-08 15:40:05 +08:00
    1.你永远也不可能通过代理服务器 ping ,用什么软件都没用
    2.你需要一个能够解析 PAC 的代理服务器然后直接把 http_proxy/https_proxy 设上去,而不是一个只能甩出一个 pac 文件的服务器。
    sammo
        11
    sammo  
       2016-01-08 15:58:17 +08:00
    你不需要 pac ,你只需要设置当前终端实例(就是当前终端窗口)的 http_proxy

    打开终端,键入
    export http_proxy='http://localhost:8118'
    export https_proxy='https://localhost:8118'
    ping google.com
    只对当前终端窗口有效。

    此外,如果你用的不是 蓝灯,而是 Shadowsocks 那么需要把 ss 代理转换为 http 代理(通过 Privoxy ),再用以上方法
    imn1
        12
    imn1  
       2016-01-08 15:59:14 +08:00
    ~/.bashrc
    export http_proxy="http://127.0.0.1:1080"
    export https_proxy="http://127.0.0.1:1080"

    suggest 1080 --> privoxy
    sammo
        13
    sammo  
       2016-01-08 16:01:02 +08:00
    把 8118 那行命令换成 8787 ,这是 Lantern 的端口。
    " 蓝灯默认会在 [本机地址] 上开启一个 HTTP 代理的端口,端口号是 8787 "

    通过我的经验, PAC 这个东西其实并不好用 ... 所以尽量避免用 PAC 吧,手动配置
    MyFaith
        14
    MyFaith  
       2016-01-08 17:47:23 +08:00
    go stackoverflow plz :)
    SoloCompany
        15
    SoloCompany  
       2016-01-09 03:14:48 +08:00
    思路大概就是双重代理吧,第一重供 http proxy ,解释 pac 然后提连后端的代理或直连
    cow / 3proxy 就是类似的服务软件但本身自己做智能路由而并不直接支持第三方 pac
    然后配置 proxychain 走这个本地代理

    其实如果是 mac 或 win 的话, proxifier 是更好的解决方案,但 proxifier 也是没有 pac 支持,要自己配置路由(app/域名)
    szpunk
        16
    szpunk  
       2016-01-09 12:20:22 +08:00
    Privoxy, 有脚本转把 autoproxy 转为它的规则
    gccplus
        17
    gccplus  
       2016-01-16 16:58:00 +08:00
    gconftool-2 -R /system/http_proxy
    gconftool-2 -s /system/http_proxy/use_http_proxy -t bool true
    gconftool-2 -s /system/http_proxy/autoconfig_url -t string http://server.com/proxy.pac
    hhrmatata
        18
    hhrmatata  
       2016-01-20 19:20:10 +08:00
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2985 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 30ms UTC 13:40 PVG 21:40 LAX 06:40 JFK 09:40
    Do have faith in what you're doing.
    ubao snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86