Update clashservice

This commit is contained in:
juewuy 2020-07-22 19:24:34 +08:00
parent ea3775bf7e
commit e34dda5861

View File

@ -7,21 +7,14 @@ START=99
start_service() {
#创建clash后台进程
procd_open_instance
procd_set_param respawn
procd_set_param stderr 1
procd_set_param stdout 1
procd_set_param command /etc/clash/clash -d /etc/clash
procd_close_instance
procd_open_instance
procd_set_param respawn
procd_set_param stderr 1
procd_set_param stdout 1
procd_set_param command /etc/clash/clash -d /etc/clash
procd_close_instance
#修改iptables规则使流量进入clash
iptables -t nat -N Clash
iptables -t nat -A Clash -d 192.168.0.0/16 -j RETURN
iptables -t nat -A Clash -p tcp -j REDIRECT --to-ports 7892
iptables -t nat -A PREROUTING -p tcp -j Clash
iptables -t nat -A PREROUTING -p tcp -j REDIRECT --to-ports 7892
}
stop_service() {
#清空iptables clash相关规则
iptables -t nat -F Clash
iptables -t nat -N clash
iptables -t nat -A clash -p tcp -j REDIRECT --to-ports 7892
iptables -t nat -A PREROUTING -p tcp -j clash
}