chiark / gitweb /
b3556471e489642caeff34c8bcc91f85ec80aeba
[hippotat.git] / client
1 #!/usr/bin/python3
2
3 from hippotat import *
4
5 defcfg = '''
6 [DEFAULT]
7 max_requests_outstanding = 4
8
9 [virtual]
10 mtu = 1500
11 # [server]  } maybe computed from `network' (see server defaults)
12
13 [server]
14 # url     } maybe computed from `addrs' and `port' (see server defaults)
15
16 # [<my ip address>]
17 # password = <password>
18 '''
19
20 c.clientv = None
21
22 def set_client(ci,cs,pw):
23   global password
24   assert(c.clientv is None)
25   c.clientv = ci
26   c.max_outstanding = cfg.getint(cs, 'max_requests_outstanding')
27   password = pw
28
29 def process_cfg():
30   global url
31   global max_requests_outstanding
32
33   process_cfg_common_always()
34   process_cfg_server()
35
36   try:
37     c.url = cfg.get('server','url')
38   except NoOptionError:
39     process_cfg_saddrs()
40     sa = c.saddrs[0].url()
41
42   process_cfg_clients(set_client)
43
44 common_startup(defcfg)
45 process_cfg()