From ea86a6610bbf5df208dba5a85b4d7bff8510ee14 Mon Sep 17 00:00:00 2001 From: dnomd343 Date: Sun, 7 Aug 2022 22:02:54 +0800 Subject: [PATCH] fix: filter dnsproxy input --- Basis/DnsProxy.py | 8 ++++++-- env.yaml | 10 ++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Basis/DnsProxy.py b/Basis/DnsProxy.py index 3b738f9..276c3a4 100644 --- a/Basis/DnsProxy.py +++ b/Basis/DnsProxy.py @@ -15,12 +15,16 @@ def daemon(process: subprocess.Popen, command: list, gap: int = 2) -> None: # d while True: # start daemon time.sleep(gap) # check time gap if process.poll() is not None: # unexpected exit - logging.warning('dnsproxy unexpected exit') - logging.debug('output of dnsproxy\n%s' % process.stdout.read().decode('utf-8')) + logging.error('DnsProxy unexpected exit\n%s\n%s%s' % ( + '-' * 96, process.stdout.read().decode('utf-8'), '-' * 96) + ) process = run(command) def start(servers: list or None, port: int = 53, cache: int = 4194304) -> None: # default cache size -> 4MiB + if servers is not None and type(servers) != list: # invalid server content + logging.error('Invalid DNS server -> %s' % servers) + return if servers is None or len(servers) == 0: # use origin dns server logging.info('Skip dnsproxy process') return diff --git a/env.yaml b/env.yaml index 7432cd0..83407f9 100644 --- a/env.yaml +++ b/env.yaml @@ -1,10 +1,8 @@ version: 'v0.1' loglevel: 'INFO' dir: '/tmp/ProxyC' -dns: - - 223.5.5.5 - - 119.29.29.29 +dns: null api: - port: 17839 - path: '/v1' - token: 'dnomd343' + port: 7839 + path: '/' + token: ''