def do_start_edge(port, use_ssl, asynchronous=False): try: # start local DNS server, if present from localstack_ext.services import dns_server dns_server.start_servers() except Exception: pass # get port and start Edge print('Starting edge router (http%s port %s)...' % ('s' if use_ssl else '', port)) # use use=True here because our proxy allows both, HTTP and HTTPS traffic proxy = start_proxy_server(port, use_ssl=True, update_listener=ProxyListenerEdge()) if not asynchronous: proxy.join() return proxy
def start_dns_server(asynchronous=False): try: # start local DNS server, if present from localstack_ext import config as config_ext from localstack_ext.services import dns_server if config_ext.DNS_ADDRESS in config.FALSE_STRINGS: return if is_port_open(PORT_DNS): return if is_root(): result = dns_server.start_servers() if not asynchronous: sleep_forever() return result # note: running in a separate process breaks integration with Route53 (to be fixed for local dev mode!) return run_process_as_sudo("dns", PORT_DNS, asynchronous=asynchronous) except Exception: pass