remove ss_header from tcprelay.py and update the "header_length" to udprelay.py
1. Remove unnecessary "add ss_header" from tcprelay.py 2. update "data[7:]" to "data[header_length:]"
This commit is contained in:
parent
19027aeba8
commit
57f55bf347
2 changed files with 1 additions and 13 deletions
|
@ -256,12 +256,6 @@ class TCPRelayHandler(object):
|
|||
else:
|
||||
self._data_to_write_to_remote.append(data)
|
||||
return
|
||||
if self.is_tunnel:
|
||||
# add ss header to data
|
||||
tunnel_remote = self.tunnel_remote
|
||||
tunnel_remote_port = self.tunnel_remote_port
|
||||
data = common.add_header(tunnel_remote,
|
||||
tunnel_remote_port, data)
|
||||
if self._ota_enable_session:
|
||||
data = self._ota_chunk_data_gen(data)
|
||||
data = self._encryptor.encrypt(data)
|
||||
|
@ -504,12 +498,6 @@ class TCPRelayHandler(object):
|
|||
|
||||
def _handle_stage_stream(self, data):
|
||||
if self._is_local:
|
||||
if self.is_tunnel:
|
||||
# add ss header to data
|
||||
tunnel_remote = self.tunnel_remote
|
||||
tunnel_remote_port = self.tunnel_remote_port
|
||||
data = common.add_header(tunnel_remote,
|
||||
tunnel_remote_port, data)
|
||||
if self._ota_enable_session:
|
||||
data = self._ota_chunk_data_gen(data)
|
||||
data = self._encryptor.encrypt(data)
|
||||
|
|
|
@ -283,7 +283,7 @@ class UDPRelay(object):
|
|||
addrtype, dest_addr, dest_port, header_length = header_result
|
||||
if self.is_tunnel:
|
||||
# remove ss header
|
||||
response = data[7:]
|
||||
response = data[header_length:]
|
||||
else:
|
||||
response = b'\x00\x00\x00' + data
|
||||
client_addr = self._client_fd_to_server_addr.get(sock.fileno())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue