X-Git-Url: https://git.distorted.org.uk/~mdw/hippotat/blobdiff_plain/c55f394eb74d593bd5535ba3dc639473db69784d..034284c3d2f1bdc9c9c4e7762b40b34a9713f566:/client?ds=sidebyside diff --git a/client b/client index b9f8ce5..7684cf3 100755 --- a/client +++ b/client @@ -8,16 +8,57 @@ max_requests_outstanding = 4 [virtual] mtu = 1500 -# [host] } maybe computed from `network' (see server defaults) +# [server] # maybe computed from `network' (see server defaults) +# [routes] # default is none [server] -# url } maybe computed from `addrs' and `port' (see server defaults) +# url # maybe computed from `addrs' and `port' (see server defaults) # [] # password = ''' -def startup(): - common_startup(defcfg) +client_cs = None -startup() +def set_client(ci,cs,pw): + global client_cs + global password + assert(client_cs is None) + client_cs = cs + c.client = ci + c.max_outstanding = cfg.getint(cs, 'max_requests_outstanding') + password = pw + +def process_cfg(): + global url + global max_requests_outstanding + + process_cfg_common_always() + process_cfg_server() + + try: + c.url = cfg.get('server','url') + except NoOptionError: + process_cfg_saddrs() + sa = c.saddrs[0].url() + + process_cfg_clients(set_client) + + try: + c.routes = cfg.get('virtual','routes') + except NoOptionError: + c.routes = '' + + process_cfg_ipif(client_cs, + (('local', 'client'), + ('peer', 'server'), + ('rnets', 'routes'))) + +def outbound(packet, saddr, daddr): + print('OUT ', saddr, daddr, repr(packet)) + pass + +common_startup(defcfg) +process_cfg() +start_ipif(c.ipif_command, outbound) +common_run()