5
0
mirror of https://github.com/cwinfo/yggdrasil-map synced 2024-11-14 03:50:27 +00:00
yggdrasil-map/mapper/start-mappers.sh
2014-03-30 14:34:08 +03:00

27 lines
735 B
Bash
Executable File

#!/bin/bash
source conf_sh.py
mkdir -p mapper-confs
for i in $(seq 1 $num_of_nodes)
do
echo "Starting mapper node $i/$num_of_nodes"
file=mapper-confs/node$i.conf
rpcport=$(($rpc_firstport + $i - 1))
$cjdns_path/cjdroute --genconf > $file
# Set peer credentials
sed -i 's/\/\/ Add connection credentials here to join the network/"'"${peer_ip}"':'"${peer_port}"'":{"password":"'"${peer_pw}"'","publicKey":"'"${peer_pk}"'"}/g' $file
# Set admin rpc credentials
sed -i 's/127.0.0.1:11234/'"${rpc_bind}"':'"${rpcport}"'/g' $file
sed -i 's/"password": ".*"/"password": "'"${rpc_pw}"'"/g' $file
# Disable tun interface
sed -i 's/"type": "TUNInterface"/\/\/"type": "TUNInterface"/g' $file
$cjdns_path/cjdroute < $file
done