Browse Source

fix: filter dnsproxy input

master^2
dnomd343 2 years ago
parent
commit
ea86a6610b
  1. 8
      Basis/DnsProxy.py
  2. 10
      env.yaml

8
Basis/DnsProxy.py

@ -15,12 +15,16 @@ def daemon(process: subprocess.Popen, command: list, gap: int = 2) -> None: # d
while True: # start daemon while True: # start daemon
time.sleep(gap) # check time gap time.sleep(gap) # check time gap
if process.poll() is not None: # unexpected exit if process.poll() is not None: # unexpected exit
logging.warning('dnsproxy unexpected exit') logging.error('DnsProxy unexpected exit\n%s\n%s%s' % (
logging.debug('output of dnsproxy\n%s' % process.stdout.read().decode('utf-8')) '-' * 96, process.stdout.read().decode('utf-8'), '-' * 96)
)
process = run(command) process = run(command)
def start(servers: list or None, port: int = 53, cache: int = 4194304) -> None: # default cache size -> 4MiB 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 if servers is None or len(servers) == 0: # use origin dns server
logging.info('Skip dnsproxy process') logging.info('Skip dnsproxy process')
return return

10
env.yaml

@ -1,10 +1,8 @@
version: 'v0.1' version: 'v0.1'
loglevel: 'INFO' loglevel: 'INFO'
dir: '/tmp/ProxyC' dir: '/tmp/ProxyC'
dns: dns: null
- 223.5.5.5
- 119.29.29.29
api: api:
port: 17839 port: 7839
path: '/v1' path: '/'
token: 'dnomd343' token: ''

Loading…
Cancel
Save