diff --git a/shadowsocks/encrypt.py b/shadowsocks/encrypt.py index 91f7439..336f455 100644 --- a/shadowsocks/encrypt.py +++ b/shadowsocks/encrypt.py @@ -204,4 +204,4 @@ def encrypt_all(password, method, op, data): data = data[iv_len:] cipher = m(method, key, iv, op) result.append(cipher.update(data)) - return ''.join(result) + return b''.join(result) diff --git a/shadowsocks/udprelay.py b/shadowsocks/udprelay.py index b4951be..2b8b12f 100644 --- a/shadowsocks/udprelay.py +++ b/shadowsocks/udprelay.py @@ -229,7 +229,7 @@ class UDPRelay(object): if header_result is None: return # addrtype, dest_addr, dest_port, header_length = header_result - response = '\x00\x00\x00' + data + response = b'\x00\x00\x00' + data client_addr = self._client_fd_to_server_addr.get(sock.fileno()) if client_addr: self._server_socket.sendto(response, client_addr)