1# #-- ip_ratelimit.pre--#
2# source the master var file when it's there
3[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
4# use .tpkg.var.test for in test variable passing
5[ -f .tpkg.var.test ] && source .tpkg.var.test
6
7PRE="../.."
8. ../common.sh
9get_random_port 2
10UNBOUND_PORT=$RND_PORT
11CONTROL_PORT=$(($RND_PORT + 1))
12echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test
13echo "CONTROL_PORT=$CONTROL_PORT" >> .tpkg.var.test
14
15# make config file
16sed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@CONTROL_PORT\@/'$CONTROL_PORT'/' < ip_ratelimit.conf > ub.conf
17# start unbound in the background
18$PRE/unbound -d -c ub.conf >unbound.log 2>&1 &
19UNBOUND_PID=$!
20echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test
21
22wait_unbound_up unbound.log
23
24cat .tpkg.var.test
25