forked from ProPorygon/TheOgreProtocol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlauncher.py
35 lines (28 loc) · 1.06 KB
/
launcher.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import sys
import subprocess
import os
import argparse
import random
import time
import signal
import utils
signal.signal(signal.SIGINT, utils.signal_handler)
num_relays = 3
num_exits = 2
parser = argparse.ArgumentParser()
parser.add_argument("dir_auth_port", type=int, help="the port number of the directory authority")
parser.add_argument("dest_port", type=int, help="the port number of the client's destination")
args = parser.parse_args()
os.system("python directory_authority.py " + str(args.dir_auth_port) + " &")
#wait for directory authority to spin up
time.sleep(1)
port_range = range(7000,9000)
ports = random.sample(port_range,num_relays+num_exits)
exit_port = "6666"
for port in ports[:num_relays]:
os.system("python node.py " + str(port) + " 127.0.0.1 " + str(args.dir_auth_port) + " &")
time.sleep(1)
for port in ports[-1*num_exits:]:
os.system("python node.py " + str(port) + " 127.0.0.1 " + str(args.dir_auth_port) + " --exit &")
time.sleep(1)
os.system("python client.py " + "127.0.0.1 " + str(args.dir_auth_port) + " 127.0.0.1 " +str(args.dest_port))#+ " &")