예제 #1
0
파일: main.py 프로젝트: JustLin/fqrouter
def run():
    iptables.init_fq_chains()
    shutdown_hook.add(iptables.flush_fq_chain)
    if config.read().get('comp_wifi_enabled', True):
        start_components(comp_wifi, comp_lan)
    else:
        LOGGER.info('wifi component disabled by config')
        comp_wifi.setup_lo_alias()
        start_components(comp_lan)
    httpd.HANDLERS[('GET', 'ping')] = handle_ping
    httpd.HANDLERS[('POST', 'free-internet/connect')] = handle_free_internet_connect
    httpd.HANDLERS[('POST', 'free-internet/disconnect')] = handle_free_internet_disconnect
    httpd.HANDLERS[('GET', 'free-internet/is-connected')] = handle_free_internet_is_connected
    httpd.serve_forever()
예제 #2
0
def run():
    iptables.init_fq_chains()
    shutdown_hook.add(iptables.flush_fq_chain)
    if config.read().get('comp_wifi_enabled', True):
        start_components(comp_wifi, comp_lan)
    else:
        LOGGER.info('wifi component disabled by config')
        comp_wifi.setup_lo_alias()
        start_components(comp_lan)
    httpd.HANDLERS[('GET', 'ping')] = handle_ping
    httpd.HANDLERS[('POST', 'free-internet/connect')] = handle_free_internet_connect
    httpd.HANDLERS[('POST', 'free-internet/disconnect')] = handle_free_internet_disconnect
    httpd.HANDLERS[('GET', 'free-internet/is-connected')] = handle_free_internet_is_connected
    gevent.spawn(check_ping)
    httpd.serve_forever()