有些时候,启动的一些前端服务需要请求国外资源。我们在电脑挂着vpn?from_column=20065&from=20065" target="_blank" class="rno-markdown__textlink-new" track-click="{"areaId":2000,"objectId":779,"positionId":779,"objectName":"VPN","objectType":"link"}" track-exposure="{"areaId":2000,"objectId":779,"positionId":779,"objectName":"VPN","objectType":"link"}" style="overflow-wrap: break-word; text-decoration-line: none; padding: 0px 10px 0px 0px; margin: 0px 4px; box-sizing: border-box; list-style: inherit; word-break: break-all; color: rgb(0, 82, 217); cursor: pointer; background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI4IiBoZWlnaHQ9IjgiIGZpbGw9Im5vbmUiPjxwYXRoIGQ9Ik00LjMwMyA1LjAxbC0uNzA3LjcwN2ExLjUgMS41IDAgMDEtMi4xMjEtMi4xMjFsLjcwNy0uNzA3LS43MDctLjcwNy0uNzA3LjcwN2EyLjUgMi41IDAgMTAzLjUzNSAzLjUzNWwuNzA4LS43MDctLjcwOC0uNzA3ek01LjAxIDQuMzAzbC43MDguNzA3LjcwNy0uNzA3QTIuNSAyLjUgMCAwMDIuODg5Ljc2N2wtLjcwNy43MDcuNzA3LjcwOC43MDctLjcwOGExLjUgMS41IDAgMDEyLjEyMiAyLjEyMmwtLjcwNy43MDd6IiBmaWxsPSIjMDA1MkQ5Ii8+PHBhdGggZD0iTTQuMzAzIDIuMTgybC43MDguNzA3LTIuMTIyIDIuMTItLjcwNy0uNzA2IDIuMTIxLTIuMTIxeiIgZmlsbD0iIzAwNTJEOSIvPjwvc3ZnPg=="); background-position: right 2px; background-repeat: no-repeat; background-size: 8px 8px; box-shadow: none;">VPN,在终端的内容依旧不能访问相关网络。即便ClashX提供命令给终端提供工具,前端开的通过终端开的服务也不支持。此时我们就需要Proxychains-ng服务的支持了
本来用brew install proxychains-ng 就可以了的,但是受限于Mac的环境,brew安装的proxychains-ng不能正常使用。所以还得本次从源码开始编译!
Proxychains-ng下载地址:https://github.com/rofl0r/proxychains-ng/releases/tag/v4.16
Mac M系列芯片需要关闭SIP模式才能使用proxychains-ng,教材在:https://cloud.tencent.com/developer/article/2168658
常规系统安装proxychains-ng(Apple 芯片必须此方式不可用)
我把官方的README.md文件拿来,不傻的都能看懂
# needs a working C compiler, preferably gcc ./configure --prefix=/usr --sysconfdir=/etc make [optional] sudo make install [optional] sudo make install-config (installs proxychains.conf) if you dont install, you can use proxychains from the build directory like this: ./proxychains4 -f src/proxychains.conf telnet google.com 80
Mac M芯片安装proxychains-ng
解压压缩包并进入文件夹
# 这里我是模拟的命令,你可以直接解压,然后在终端进入解压后的文件夹 unzip proxychains-ng-4.16.zip && cd proxychains-ng-4.16
第一次编译 arm64e 环境
cd proxychains-ng-4.16make cleanCFLAGS="-arch arm64e" LDFLAGS="-arch arm64e" ./configure make # 创建bak文件,将arm64e环境编译的文件带过去 mkdir bak cp libproxychains4.dylib ./bak
第二次编译 也是arm64e环境
make cleanCFLAGS="-arch arm64e" LDFLAGS="-arch arm64e" ./configure make # 复制文件过去 cp libproxychains4.dylib ./bak
第三次编译 arm64环境
make cleanCFLAGS="-arch arm64" LDFLAGS="-arch arm64" ./configure sudo make install
使用install.sh拷贝./bak/libproxychains4.dylib 到/usr/local/lib/目录
sudo ./tools/install.sh -D -m 644 bak/libproxychains4.dylib /usr/local/lib/libproxychains4.dylib
参考于:https://blog.csdn.net/sanqima/article/details/123158915
修改Proxychains-ng的配置文件
sudo vi /etc/proxychains.conf
一般只需要修改最下面文件即可,比如我本地ClashX的代理端口是:7890
最后一个配置填入(修改 socks5那个就行):
[ProxyList]# add proxy here ...# meanwile # defaults set to "tor"socks5 127.0.0.1 7890
由于本教程是做本地搭建ChatGPT-Next-Web需要用的:我在附上额外修改这个前端项目所需的配置文件
原本配置文件是注释掉的,放开注释即可!
使用命令
# 正常命令是 curl cip.cc # 使用proxychains-ng如下 proxychain4 curl cip.cc
推荐本站淘宝优惠价购买喜欢的宝贝:
本文链接:https://hqyman.cn/post/6630.html 非本站原创文章欢迎转载,原创文章需保留本站地址!
休息一下~~