#!/bin/sh /etc/rc.common

START=95

SERVICE_USE_PID=1
SERVICE_WRITE_PID=1
SERVICE_DAEMONIZE=1

CONFIG=/etc/shadowsocks.json

start() {
	#service_start /usr/bin/ss-local -c $CONFIG -b 0.0.0.0
	service_start /usr/bin/ss-redir -c $CONFIG -b 0.0.0.0
	#service_start /usr/bin/ss-tunnel -c $CONFIG -b 0.0.0.0 -l 5353 -L 8.8.8.8:53 -u

	ipset -N gfwlist iphash
	iptables -t nat -A PREROUTING -p tcp -m set --match-set gfwlist dst -j REDIRECT --to-port 1080
}

stop() {
	#service_stop /usr/bin/ss-local
	service_stop /usr/bin/ss-redir
	#service_stop /usr/bin/ss-tunnel
}
