def load_config():
	fmt = '[%(asctime)s] %(levelname)s: %(message)s'
	logging.basicConfig(filename = os.path.join(os.getcwd(), 'dnslog.txt'), level = logging.DEBUG, format = fmt)
	console = logging.StreamHandler()
	console.setLevel(logging.DEBUG)
	formatter = logging.Formatter(fmt)
	console.setFormatter(formatter)
	logging.getLogger('').addHandler(console)

	bind = ("0.0.0.0", 53)
	dns_list = ["114.114.114.114", "114.114.115.115", "8.8.8.8", "8.8.4.4"]
	proxy = ("127.0.0.1", 1080)

	try:
		f = file(os.path.join(os.getcwd(), "config.json"), "r")
		config = json.loads(f.read())
		if config:
			local_address = config.get("local_address", None)
			local_port = config.get("local_port", None)
			dns = config.get("dns", None)
			proxy_address = config.get("proxy_address", None)
			proxy_port = config.get("proxy_port", None)
			if local_address is not None and local_port is not None:
				bind = (local_address, local_port)
				logging.info("bind %s:%d loaded" % (local_address, local_port))
			if proxy_address is not None and proxy_port is not None:
				proxy = (proxy_address, proxy_port)
				logging.info("proxy %s:%d loaded" % (proxy_address, proxy_port))
			if dns is not None:
				dns_list = []
				for item in dns:
					dns_list.append(encode(item))
				logging.info("dns %s loaded" % (dns_list,))

	except Exception as e:
		logging.error(e)
		pass

	return bind, dns_list, proxy
dataset/ETHPy150Open breakwa11/dnsproxy/test.py/load_config/original