blob: 22a190078844db4ea5a49653ed3fba3ceaef9bc6 (
plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
import json
import sys
import subprocess
conf=json.load(open(sys.argv[1]))
if conf['runmode']=="server":
args="-s"
elif conf['runmode']=="client":
args="-c"
else:
raise Exception("runmode must be server or client")
args=args+" -l "+conf['local']
args=args+" -r "+conf['remote']
if conf['key']!="":
args=args+" --key "+conf['key']
for key in ['fec','timeout']:
args=args+" --"+key+" "+conf[key]
if conf["report"]>0:
args=args+" --report "+str(conf['report'])
for key in ['mode','mtu','jitter','interval','random-drop']:
args=args+" --"+key+" "+conf[key]
if conf['disable-obscure']==True:
args=args+" --disable-obscure"
if conf['disable-checksum']==True:
args=args+" --disable-checksum"
if conf["fifo"]!="":
args=args+" --fifo "+conf["fifo"]
for key in ['queue-len','decode-buf','delay-capacity']:
args=args+" --"+key+" "+conf[key]
if conf['disable-fec']==True:
args=args+" --disable-fec"
args=args+" --sock-buf "+conf['sock-buf']
if conf["out-addr"]!="":
args=args+" --out-addr "+conf["out-addr"]
if conf["out-interface"]!="":
args=args+" --out-interface "+conf["out-interface"]
args=args+" --log-level "+conf['log-level']
if conf["log-position"]==True:
args=args+" --log-position"
if conf['disable-color']==True:
args=args+" --disable-color"
subprocess.call("speederv2 "+args,shell=True)
|