fix udp ota
This commit is contained in:
parent
77b2a22055
commit
ca99abff89
1 changed files with 3 additions and 3 deletions
|
@ -69,7 +69,7 @@ import errno
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from shadowsocks import encrypt, eventloop, lru_cache, common, shell
|
from shadowsocks import encrypt, eventloop, lru_cache, common, shell
|
||||||
from shadowsocks.common import parse_header, pack_addr, \
|
from shadowsocks.common import parse_header, pack_addr, onetimeauth_verify, onetimeauth_gen, \
|
||||||
ONETIMEAUTH_BYTES, ONETIMEAUTH_CHUNK_BYTES, ONETIMEAUTH_CHUNK_DATA_LEN, ADDRTYPE_AUTH
|
ONETIMEAUTH_BYTES, ONETIMEAUTH_CHUNK_BYTES, ONETIMEAUTH_CHUNK_DATA_LEN, ADDRTYPE_AUTH
|
||||||
|
|
||||||
|
|
||||||
|
@ -180,12 +180,12 @@ class UDPRelay(object):
|
||||||
if self._one_time_auth_enable or addrtype & ADDRTYPE_AUTH:
|
if self._one_time_auth_enable or addrtype & ADDRTYPE_AUTH:
|
||||||
if len(data) < header_length + ONETIMEAUTH_BYTES:
|
if len(data) < header_length + ONETIMEAUTH_BYTES:
|
||||||
logging.warn('UDP one time auth header is too short')
|
logging.warn('UDP one time auth header is too short')
|
||||||
return None
|
return
|
||||||
if onetimeauth_verify(data[-ONETIMEAUTH_BYTES:],
|
if onetimeauth_verify(data[-ONETIMEAUTH_BYTES:],
|
||||||
data[header_length: -ONETIMEAUTH_BYTES],
|
data[header_length: -ONETIMEAUTH_BYTES],
|
||||||
self._encryptor.decipher_iv + self._encryptor.key) is False:
|
self._encryptor.decipher_iv + self._encryptor.key) is False:
|
||||||
logging.warn('UDP one time auth fail')
|
logging.warn('UDP one time auth fail')
|
||||||
return None
|
return
|
||||||
self._one_time_authed = True
|
self._one_time_authed = True
|
||||||
header_length += ONETIMEAUTH_BYTES
|
header_length += ONETIMEAUTH_BYTES
|
||||||
addrs = self._dns_cache.get(server_addr, None)
|
addrs = self._dns_cache.get(server_addr, None)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue