Merge branch 'master' into path-1
This commit is contained in:
commit
fb7af45d53
3 changed files with 10 additions and 5 deletions
|
@ -153,7 +153,7 @@ def encrypt_all_m(key, iv, m, method, data):
|
||||||
return b''.join(result)
|
return b''.join(result)
|
||||||
|
|
||||||
|
|
||||||
def dencrypt_all(password, method, data):
|
def decrypt_all(password, method, data):
|
||||||
result = []
|
result = []
|
||||||
method = method.lower()
|
method = method.lower()
|
||||||
(key_len, iv_len, m) = method_supported[method]
|
(key_len, iv_len, m) = method_supported[method]
|
||||||
|
@ -228,7 +228,7 @@ def test_encrypt_all_m():
|
||||||
logging.warn(method)
|
logging.warn(method)
|
||||||
key, iv, m = gen_key_iv(b'key', method)
|
key, iv, m = gen_key_iv(b'key', method)
|
||||||
cipher = encrypt_all_m(key, iv, m, method, plain)
|
cipher = encrypt_all_m(key, iv, m, method, plain)
|
||||||
plain2, key, iv = dencrypt_all(b'key', method, cipher)
|
plain2, key, iv = decrypt_all(b'key', method, cipher)
|
||||||
assert plain == plain2
|
assert plain == plain2
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -197,6 +197,8 @@ def check_config(config, is_local):
|
||||||
if os.name != 'posix':
|
if os.name != 'posix':
|
||||||
logging.error('user can be used only on Unix')
|
logging.error('user can be used only on Unix')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
if config.get('dns_server', None) is not None:
|
||||||
|
logging.info('Specified DNS server: %s' % config['dns_server'])
|
||||||
|
|
||||||
encrypt.try_cipher(config['password'], config['method'])
|
encrypt.try_cipher(config['password'], config['method'])
|
||||||
|
|
||||||
|
@ -310,10 +312,13 @@ def get_config(is_local):
|
||||||
config['one_time_auth'] = config.get('one_time_auth', False)
|
config['one_time_auth'] = config.get('one_time_auth', False)
|
||||||
config['prefer_ipv6'] = config.get('prefer_ipv6', False)
|
config['prefer_ipv6'] = config.get('prefer_ipv6', False)
|
||||||
config['server_port'] = config.get('server_port', 8388)
|
config['server_port'] = config.get('server_port', 8388)
|
||||||
|
|
||||||
config['tunnel_remote'] = \
|
config['tunnel_remote'] = \
|
||||||
to_str(config.get('tunnel_remote', '8.8.8.8'))
|
to_str(config.get('tunnel_remote', '8.8.8.8'))
|
||||||
config['tunnel_remote_port'] = config.get('tunnel_remote_port', 53)
|
config['tunnel_remote_port'] = config.get('tunnel_remote_port', 53)
|
||||||
config['tunnel_port'] = config.get('tunnel_port', 53)
|
config['tunnel_port'] = config.get('tunnel_port', 53)
|
||||||
|
config['dns_server'] = config.get('dns_server', None)
|
||||||
|
|
||||||
|
|
||||||
logging.getLogger('').handlers = []
|
logging.getLogger('').handlers = []
|
||||||
logging.addLevelName(VERBOSE_LEVEL, 'VERBOSE')
|
logging.addLevelName(VERBOSE_LEVEL, 'VERBOSE')
|
||||||
|
|
|
@ -170,9 +170,9 @@ class UDPRelay(object):
|
||||||
else:
|
else:
|
||||||
data = data[3:]
|
data = data[3:]
|
||||||
else:
|
else:
|
||||||
data, key, iv = encrypt.dencrypt_all(self._password,
|
data, key, iv = encrypt.decrypt_all(self._password,
|
||||||
self._method,
|
self._method,
|
||||||
data)
|
data)
|
||||||
# decrypt data
|
# decrypt data
|
||||||
if not data:
|
if not data:
|
||||||
logging.debug(
|
logging.debug(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue