udp over tcp

This commit is contained in:
breakwa11
2015-06-09 23:59:03 +08:00
parent e001f1818c
commit 62dca9d3cd
7 changed files with 516 additions and 22 deletions
+5 -3
View File
@@ -144,6 +144,8 @@ def parse_header(data):
dest_addr = None
dest_port = None
header_length = 0
connecttype = (addrtype & 8) and 1 or 0
addrtype &= ~8
if addrtype == ADDRTYPE_IPV4:
if len(data) >= 7:
dest_addr = socket.inet_ntoa(data[1:5])
@@ -171,11 +173,11 @@ def parse_header(data):
else:
logging.warn('header is too short')
else:
logging.warn('unsupported addrtype %d, maybe wrong password or '
'encryption method' % addrtype)
logging.warn('unsupported addrtype %d, maybe wrong password' %
addrtype)
if dest_addr is None:
return None
return addrtype, to_bytes(dest_addr), dest_port, header_length
return connecttype, to_bytes(dest_addr), dest_port, header_length
class IPNetwork(object):