一次解决所有代理问题

栏目: 编程工具 · 发布时间: 5年前

内容简介:之前公众号上有人说,我回大陆了会有一波科学上网的教程,今天的推文算一个吧。真的是被你们言中了!做为Bioconductor包作者,而代理其实也挺恼火的,因为各种协议啊,你要各种设置啊,

之前公众号上有人说,我回大陆了会有一波科学上网的教程,今天的推文算一个吧。真的是被你们言中了!

做为Bioconductor包作者,而 git push 传代码到Bioconductor上是被封的。这很是恼火,随着10月份将迎来新一版本的Bioconductor发布,不能够push代码是多么惨的一件事。

代理其实也挺恼火的,因为各种协议啊,你要各种设置啊, http/https/ssh/git 都是各种配置,其实我只要有一个 socks5 的代理,然后你们所有需要走代理的程序都通过它就好了。

谁特么有空天天在琢磨怎么配置各种不同协议的代理!只要我们想得到的,一般都有人做了。

于是万能的github上找到了 proxychains , https://github.com/haad/proxychains

A hook preloader that allows to redirect TCP traffic of existing
dynamically linked programs through one or more SOCKS or HTTP
proxies

它强制给定程序发起的TCP连接通过事先配置的代理。可以涵盖所有需要代理的情景。就以git为例,没有proxychains的话,就必须为每个协议( https , git , ssh )按照git文档的要求分别设置代理,过程复杂且不稳定。有了 proxychains ,这些完全可以不用管,当然应用场景不限于 git ,任何一个需要代理的命令行程序都是一样在运行的指令前面加 proxychains 完事。

Arch安装很容易:

yay -S proxychains-ng

安装之后,打开 /etc/proxychains.conf ,注释掉下面这行(disable远程DNS解析,有DNS污染风险)。 proxy_dns

最后添加如下行: socks5 127.0.0.1 32997

上面这个代理是我自己机器上跑了某著名软件,用于每日科学上网。

我平时是同时 push 到Bioconductor和github上的,所以我不会跑完一个 git push 再跑一个,而是写在 Makefile 里,自动化这个过程,我只需要 make push 指令就OK。

所以此处我用的指令是:

proxychains make push

这样就加了代理。

$ proxychains make push
####
#### 实际的指令,有两条,分别push到两个服务器
####          
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.13
[proxychains] DLL init: proxychains-ng 4.13
[proxychains] DLL init: proxychains-ng 4.13
[proxychains] DLL init: proxychains-ng 4.13
[proxychains] DLL init: proxychains-ng 4.13
[proxychains] DLL init: proxychains-ng 4.13
[proxychains] DLL init: proxychains-ng 4.13
git push upstream master;\
git push origin master
####
#### 第一条指令,push到Bioconductor
####    
[proxychains] DLL init: proxychains-ng 4.13
[proxychains] DLL init: proxychains-ng 4.13
[proxychains] DLL init: proxychains-ng 4.13
[proxychains] Strict chain  ...  127.0.0.1:32997  ...  34.192.48.227:22  ...  OK
[proxychains] DLL init: proxychains-ng 4.13
Enumerating objects: 56, done.
Counting objects: 100% (56/56), done.
Delta compression using up to 4 threads
Compressing objects: 100% (34/34), done.
Writing objects: 100% (41/41), 4.87 KiB | 4.87 MiB/s, done.
Total 41 (delta 32), reused 11 (delta 7)
To git.bioconductor.org:packages/ggtree.git
   c372741..e84c1f7  master -> master
####
#### 第二条指令,push到github
####       
[proxychains] DLL init: proxychains-ng 4.13
[proxychains] DLL init: proxychains-ng 4.13
[proxychains] Strict chain  ...  127.0.0.1:32997  ...  192.30.253.112:22  ...  OK
[proxychains] DLL init: proxychains-ng 4.13
Enumerating objects: 11, done.
Counting objects: 100% (11/11), done.
Delta compression using up to 4 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 843 bytes | 843.00 KiB/s, done.
Total 6 (delta 5), reused 0 (delta 0)
remote: Resolving deltas: 100% (5/5), completed with 5 local objects.
To github.com:GuangchuangYu/ggtree.git
   92847e8..e84c1f7  master -> master

整个世界清静了,没法 pushBioconductor 困扰我多时。而且经过了这个事件,以后打命令,只要需要代理的,都可以直接加 proxychains 搞定了,没有各种配置的烦恼。


以上所述就是小编给大家介绍的《一次解决所有代理问题》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Hive编程指南

Hive编程指南

卡普廖洛 (Edward Capriolo)、万普勒 (Dean Wampler)、卢森格林 (Jason Rutherglen) / 曹坤 / 人民邮电出版社 / 2013-12-1 / 69

市场中第一本Hive图书。 Hive在Hadoop系统中的应用趋势比较可观。一起来看看 《Hive编程指南》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具