linuxea:centos7.9使用trojan加速拉取代码

marksugar
2022-04-02 / 0 评论 / 1,087 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2022年06月20日,已超过231天没有更新,若内容或图片失效,请留言反馈。

我们经常使用github或者其他的仓库,特别慢的时候,可以使用其他的浏览器插件来解决。

但是,假设你已经购买了trojan,并且想在linux上使用,就可以考虑如下办法

首先,在trojan下载一个版本即可,而后参考trojan的方式将配置文件导入到config.json中

现在你有一个已经在页面生成好的配置文件,而后修改验证

修改verify和verify_hostname为false,这在trojan的github上并没有得到解决,于是我们就不验证即可

    "ssl": {
        "verify": false,
        "verify_hostname": false,
        "cert": "",

直接运行起来

~/trojan-1.15]# ./trojan -c config.json 
Welcome to trojan 1.15.1
[2022-04-02 11:38:01] [WARN] trojan service (client) started at 127.0.0.1:1080

而后配置一个privoxy

yum install privoxy -y

添加配置文件

listen-address 127.0.0.1:1081
toggle 0
show-on-task-bar 0
activity-animation 0
forward-socks5 / 127.0.0.1:1080 .
hide-console

并启动

systemctl start privoxy.service
export http_proxy=http://localhost:1081/
export https_proxy=http://localhost:1081/

打开一下谷歌

# curl -o /dev/null -s -w "%{http_code}" www.google.com  && echo
200

返回追踪下日志

# ./trojan -c config.json 
Welcome to trojan 1.15.1
[2022-04-02 11:38:01] [WARN] trojan service (client) started at 127.0.0.1:1080
[2022-04-02 11:39:21] [INFO] 127.0.0.1:42136 requested connection to www.google.com:80
[2022-04-02 11:39:22] [INFO] 127.0.0.1:42136 disconnected, 14790 bytes received, 78 bytes sent, lasted for 1 seconds
[2022-04-02 11:39:37] [INFO] 127.0.0.1:42302 requested connection to www.google.com:80
[2022-04-02 11:39:57] [ERROR] 127.0.0.1:42302 cannot resolve remote server hostname de1-1.nigirocloud.com: Host not found (authoritative)
[2022-04-02 11:39:57] [INFO] 127.0.0.1:42302 disconnected, 0 bytes received, 78 bytes sent, lasted for 20 seconds
[2022-04-02 11:40:54] [INFO] 127.0.0.1:43156 requested connection to www.google.com:80
[2022-04-02 11:41:04] [ERROR] 127.0.0.1:43156 cannot resolve remote server hostname de1-1.nigirocloud.com: Host not found (authoritative)
[2022-04-02 11:41:04] [INFO] 127.0.0.1:43156 disconnected, 0 bytes received, 78 bytes sent, lasted for 10 seconds
[2022-04-02 11:41:14] [INFO] 127.0.0.1:43380 requested connection to www.google.com:80
[2022-04-02 11:41:15] [INFO] 127.0.0.1:43380 disconnected, 14783 bytes received, 78 bytes sent, lasted for 1 seconds
[2022-04-02 11:41:32] [INFO] 127.0.0.1:43596 requested connection to www.google.com:80
[2022-04-02 11:41:33] [INFO] 127.0.0.1:43596 disconnected, 14806 bytes received, 78 bytes sent, lasted for 1 seconds
[2022-04-02 11:41:35] [INFO] 127.0.0.1:43626 requested connection to www.google.com:80
[2022-04-02 11:41:41] [INFO] 127.0.0.1:43626 disconnected, 14805 bytes received, 78 bytes sent, lasted for 6 seconds
[2022-04-02 11:41:44] [INFO] 127.0.0.1:43734 requested connection to www.google.com:80
[2022-04-02 11:41:45] [INFO] 127.0.0.1:43734 disconnected, 14823 bytes received, 78 bytes sent, lasted for 1 seconds
[2022-04-02 11:41:51] [INFO] 127.0.0.1:43830 requested connection to www.google.com:80
[2022-04-02 11:41:52] [INFO] 127.0.0.1:43830 disconnected, 14759 bytes received, 78 bytes sent, lasted for 1 seconds

image-20220402234308035.png
image-20220402234358337.png

现在就可以发起http的请求

0

评论

博主关闭了当前页面的评论