# this script contain your special code to launch daemons and configure firewall
# use helpers from "functions" file and "zapret" init script
# in case of upgrade keep this file only, do not modify others

zapret_custom_daemons()
{

	# stop logic is managed by procd

	local MODE_OVERRIDE=nfqws
#	local opt

	start_daemons_procd

#	opt="--qnum=$QNUM $NFQWS_OPT_BASE $NFQWS_OPT_DESYNC_HTTP"
#	run_daemon 100 $NFQWS "$opt"

}

zapret_custom_firewall()
{

	# $1 - 1 - run, 0 - stop

	local MODE_OVERRIDE=nfqws
	local f
	local first_packets_only="-m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 1:4"
	local desync="-m mark ! --mark $DESYNC_MARK/$DESYNC_MARK"

	#zapret_do_firewall_rules_ipt $1

	f="-p tcp -m multiport --dports 80,443"
	filter_apply_ipset_target4 f
	fw_nfqws_post4 $1 "$f $desync $first_packets_only" $QNUM

	f="-p udp -m multiport --dports 51820"
	filter_apply_ipset_target4 f
	fw_nfqws_post4 $1 "$f $desync $first_packets_only" $QNUM

}
