全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 2214|回复: 15

[疑问] wget/curl 命令使用代理

  [复制链接]
发表于 2021-1-2 18:34:25 | 显示全部楼层 |阅读模式
国内机器跑分的时候,有些脚本下载不下来,这时候可以通过使用代理来下载

设置环境变量:

不带口令

  1. export http_proxy=http://your-ip-address:port
  2. export https_proxy=https://your-ip-address:port
复制代码


带口令

  1. export http_proxy=http://user:password@your-proxy-ip-address:port
  2. export https_proxy=https://user:password@your-proxy-ip-address:port
复制代码


取消代理

  1. unset http_proxy
  2. unset https_proxy
复制代码


curl 使用命令行参数:[]内可选部分

  1. protocol: http https socks5

  2. curl -x '<[protocol://][user:password@]proxyhost[:port]>' url
复制代码


wget 使用命令行参数:

  1. wget --proxy=on --proxy-user "username" --proxy-password "password" url
复制代码


wget 使用~/.wgetrc 优先级高于环境变量:

  1. use_proxy = on
  2. proxy_user=username
  3. proxy_password=password
  4. http_proxy =  http://proxy.server.address:port/
  5. https_proxy =  http://proxy.server.address:port/
复制代码


或者

  1. use_proxy = on
  2. http_proxy =  http://username:password@proxy.server.address:port/
  3. https_proxy =  http://username:password@proxy.server.address:port/
复制代码


wget 不使用代理命令行参数:

  1. wget --no-proxy FILE_URL
复制代码
发表于 2021-1-3 00:16:25 | 显示全部楼层
proxychains wget https://www.google.com.hk
proxychains curl https://www.google.com.hk
发表于 2021-1-2 19:54:19 | 显示全部楼层
到时候转载了
发表于 2021-1-2 19:59:50 来自手机 | 显示全部楼层
不错,先收藏
发表于 2021-1-3 00:11:31 | 显示全部楼层
马克


​​​​​​​
发表于 2021-1-3 00:15:21 | 显示全部楼层
国内nat必须啊,收藏了
 楼主| 发表于 2021-1-16 01:48:03 | 显示全部楼层
使用 Dante Server 创建 Socks 服务器

  1. apt install --assume-yes --no-install-recommends dante-server

  2. cat << "EOF" > /etc/danted.conf
  3. logoutput: /var/log/socks.log
  4. internal: eth0 port = 1080
  5. external: eth0
  6. clientmethod: none
  7. socksmethod: none
  8. user.privileged: root
  9. user.notprivileged: nobody

  10. client pass {
  11.   from: 0.0.0.0/0 to: 0.0.0.0/0
  12.   log: error connect disconnect
  13. }
  14. client block {
  15.   from: 0.0.0.0/0 to: 0.0.0.0/0
  16.   log: connect error
  17. }
  18. socks pass {
  19.   from: 0.0.0.0/0 to: 0.0.0.0/0
  20.   log: error connect disconnect
  21. }
  22. socks block {
  23.   from: 0.0.0.0/0 to: 0.0.0.0/0
  24.   log: connect error
  25. }
  26. EOF
  27. systemctl restart danted
复制代码

  1. curl -x socks5://dante_server_ip:1080 ifconfig.co
复制代码

发表于 2021-1-16 03:19:08 | 显示全部楼层
前些天这功能非常刚需
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-4-26 10:33 , Processed in 0.066088 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表