Browse Source

add protocol_param

dev
BreakWa11 9 years ago
parent
commit
c83341da9b
  1. 1
      config.json
  2. 19
      shadowsocks/tcprelay.py

1
config.json

@ -8,6 +8,7 @@
"timeout": 120, "timeout": 120,
"method": "aes-256-cfb", "method": "aes-256-cfb",
"protocol": "auth_sha1_compatible", "protocol": "auth_sha1_compatible",
"protocol_param": "",
"obfs": "http_simple_compatible", "obfs": "http_simple_compatible",
"obfs_param": "", "obfs_param": "",
"dns_ipv6": false, "dns_ipv6": false,

19
shadowsocks/tcprelay.py

@ -274,15 +274,13 @@ class TCPRelayHandler(object):
return True return True
else: else:
try: try:
if self._is_local: if self._encrypt_correct:
pass
else:
if sock == self._remote_sock: if sock == self._remote_sock:
if self._encrypt_correct: self._server.server_transfer_ul += len(data)
self._server.server_transfer_ul += len(data) self._update_activity(len(data))
elif self._encrypt_correct and (self._obfs is not None): elif not self._is_local and self._obfs is not None:
obfs_encode = self._obfs.server_encode(data) obfs_encode = self._obfs.server_encode(data)
data = obfs_encode data = obfs_encode
if data: if data:
l = len(data) l = len(data)
s = sock.send(data) s = sock.send(data)
@ -597,7 +595,6 @@ class TCPRelayHandler(object):
self.destroy() self.destroy()
return return
ogn_data = data ogn_data = data
self._update_activity(len(data))
if not is_local: if not is_local:
if self._encryptor is not None: if self._encryptor is not None:
if self._encrypt_correct: if self._encrypt_correct:
@ -667,8 +664,6 @@ class TCPRelayHandler(object):
self.destroy() self.destroy()
return return
if self._encryptor is not None: if self._encryptor is not None:
self._server.server_transfer_dl += len(data)
self._update_activity(len(data))
if self._is_local: if self._is_local:
obfs_decode = self._obfs.client_decode(data) obfs_decode = self._obfs.client_decode(data)
if obfs_decode[1]: if obfs_decode[1]:
@ -683,6 +678,8 @@ class TCPRelayHandler(object):
if self._encrypt_correct: if self._encrypt_correct:
data = self._protocol.server_pre_encrypt(data) data = self._protocol.server_pre_encrypt(data)
data = self._encryptor.encrypt(data) data = self._encryptor.encrypt(data)
self._update_activity(len(data))
self._server.server_transfer_dl += len(data)
else: else:
return return
try: try:

Loading…
Cancel
Save