Browse Source

fix black_hostname_list work error issue when config black_hostname_list is empty

akkariiin/master
Akkariiin 7 years ago
parent
commit
94cb1aaaa3
  1. 2
      shadowsocks/asyncdns.py
  2. 2
      shadowsocks/shell.py

2
shadowsocks/asyncdns.py

@ -276,7 +276,7 @@ class DNSResolver(object):
self._hostname_to_cb = {} self._hostname_to_cb = {}
self._cb_to_hostname = {} self._cb_to_hostname = {}
self._cache = lru_cache.LRUCache(timeout=300) self._cache = lru_cache.LRUCache(timeout=300)
# TODO read black_hostname_list from config # read black_hostname_list from config
if type(black_hostname_list) != list: if type(black_hostname_list) != list:
self._black_hostname_list = [] self._black_hostname_list = []
else: else:

2
shadowsocks/shell.py

@ -262,6 +262,8 @@ def get_config(is_local):
else: else:
config['server'] = to_str(config.get('server', '0.0.0.0')) config['server'] = to_str(config.get('server', '0.0.0.0'))
config['black_hostname_list'] = to_str(config.get('black_hostname_list', '')).split(',') config['black_hostname_list'] = to_str(config.get('black_hostname_list', '')).split(',')
if len(config['black_hostname_list']) == 1 and config['black_hostname_list'][0] == '':
config['black_hostname_list'] = []
try: try:
config['forbidden_ip'] = \ config['forbidden_ip'] = \
IPNetwork(config.get('forbidden_ip', '127.0.0.0/8,::1/128')) IPNetwork(config.get('forbidden_ip', '127.0.0.0/8,::1/128'))

Loading…
Cancel
Save