Moposx的部落阁

設置終端代理後yay無法查找AUR軟件包的解決方案

字数统计: 309阅读时长: 1 min
2020/05/14 Share

如题,在.zshrc中設置代理:

1
2
export http_proxy="socks://127.0.0.1:10808"
export https_proxy="socks://127.0.0.1:10808"

然後執行 AUR 軟件包搜索:

1
2
3
4
5
6
7
8
9
10
11
...
3 core/minizip 1:1.2.11-4 (26.2 KiB 85.6 KiB) (Installed)
Mini zip and unzip based on zlib
2 core/gzip 1.10-3 (77.8 KiB 156.9 KiB) base-devel
GNU compression utility
1 core/bzip2 1.0.8-3 (53.4 KiB 144.0 KiB) (Installed)
A high-quality data compression program
Error during AUR search: Get "https://aur.archlinux.org/rpc.php?arg=zip&by=name-desc&type=search&v=5": proxyconnect tcp: dial tcp: lookup socks: no such host
Showing repo packages only
==> Packages to install (eg: 1 2 3, 1-3 or ^4)
==>

出現了這個錯誤。Google 了一下发现有关的issue,找到了解决方案:

The proxy string may be prefixed with [scheme]:// to specify which kind
of proxy is used. Use socks4://, socks4a://, socks5:// or socks5h://
(the last one to enable socks5 and asking the proxy to do the resolving,
also known as CURLPROXY_SOCKS5_HOSTNAME type) to request the specific
SOCKS version to be used. Otherwise SOCKS4 is used as default.

我用的是 QV2Ray,支持設置 SOCKS5 和 HTTP 代理,按照這段話的描述, 應該設置proxy scheme 為 socks5,因此正確的配置是(加入 .zshrc):

1
2
export http_proxy="socks5://127.0.0.1:10808"
export https_proxy="socks5://127.0.0.1:10808"

之後刷新環境變量即可。

CATALOG