Clash for Linux 工具
参考:
https://little-star.love/posts/f2114751/
https://www.cnblogs.com/liuziyan0511/p/15829751.html
https://199604.com/2001
mkdir clash && cd clash
wget https://github.com/Kuingsmile/clash-core/releases/download/1.18/clash-linux-amd64-v1.18.0.gz
gunzip clash-linux-amd64-v1.18.0.gz
mv clash-linux-amd64-v1.18.0 clash
chmod +x clash
wget -O config.yaml [订阅地址] --no-check-certificate
由于香港节点会屏蔽chatgpt,可以用sed -i '/香港/d' config.yaml 命令去除香港的节点。
#无法解析就在hosts里加,或者去https://acl4ssr-sub.github.io/转换
./clash -d . &
#添加变量使得科学上网,其他客户端也是如此,只是把地址改为服务端地址而已,第三条不用
export http_proxy="127.0.0.1:7890"
export https_proxy="127.0.0.1:7890"
export no_proxy="localhost, 127.0.0.1"
取消:
unset http_proxy
unset https_proxy
config.yaml 参数说明
# HTTP 代理端口
port: 7890
# SOCKS5 代理端口
socks-port: 7891
# Linux 和 macOS 的 redir 代理端口
redir-port: 7892
# 允许局域网的连接
allow-lan: true
ipv6: true
# 规则模式:Rule(规则) / Global(全局代理)/ Direct(全局直连)
mode: rule
# 设置日志输出级别 (默认级别:silent,即不输出任何内容,以避免因日志内容过大而导致程序内存溢出)。
# 5 个级别:silent / info / warning / error / debug。级别越高日志输出量越大,越倾向于调试,若需要请自行开启。
log-level: silent
# Clash 的 RESTful API
external-controller: '0.0.0.0:9090'
# RESTful API 的口令
secret: ''
# 您可以将静态网页资源(如 clash-dashboard)放置在一个目录中,clash 将会服务于 `RESTful API/ui`
# 参数应填写配置目录的相对路径或绝对路径。
# external-ui: folder
设置开机自启动vi /etc/systemd/system/cla[Unit]
Description=Clash Service
After=network.target
[Service]
Type=simple
ExecStart=/raid1/科学上网/clash -d /raid1/科学上网
Restart=always
[Install]
WantedBy=multi-user.target
sh.service
systemctl daemon-reloadsystemctl enable clash