From 408d03c556470d1d74fb0cbb5f833420dbfe2b8a Mon Sep 17 00:00:00 2001 From: Falseen Date: Thu, 2 Mar 2017 18:50:26 +0800 Subject: [PATCH] rename is_tunnel to _is_tunnel https://github.com/shadowsocks/shadowsocks/pull/759 --- shadowsocks/tcprelay.py | 10 +++++----- shadowsocks/tunnel.py | 4 ++-- shadowsocks/udprelay.py | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/shadowsocks/tcprelay.py b/shadowsocks/tcprelay.py index dbd9c3d..a61cba7 100644 --- a/shadowsocks/tcprelay.py +++ b/shadowsocks/tcprelay.py @@ -119,7 +119,7 @@ class TCPRelayHandler(object): self.tunnel_remote = config.get('tunnel_remote', "8.8.8.8") self.tunnel_remote_port = config.get('tunnel_remote_port', 53) self.tunnel_port = config.get('tunnel_port', 53) - self.is_tunnel = server.is_tunnel + self._is_tunnel = server._is_tunnel # TCP Relay works as either sslocal or ssserver # if is_local, this is sslocal @@ -297,7 +297,7 @@ class TCPRelayHandler(object): @shell.exception_handle(self_=True, destroy=True, conn_err=True) def _handle_stage_addr(self, data): if self._is_local: - if self.is_tunnel: + if self._is_tunnel: # add ss header to data tunnel_remote = self.tunnel_remote tunnel_remote_port = self.tunnel_remote_port @@ -359,7 +359,7 @@ class TCPRelayHandler(object): self._stage = STAGE_DNS if self._is_local: # jump over socks5 response - if not self.is_tunnel: + if not self._is_tunnel: # forward address to remote self._write_to_sock((b'\x05\x00\x00\x01' b'\x00\x00\x00\x00\x10\x10'), @@ -572,7 +572,7 @@ class TCPRelayHandler(object): return elif is_local and self._stage == STAGE_INIT: # jump over socks5 init - if self.is_tunnel: + if self._is_tunnel: self._handle_stage_addr(data) return else: @@ -715,7 +715,7 @@ class TCPRelay(object): self._closed = False self._eventloop = None self._fd_to_handlers = {} - self.is_tunnel = False + self._is_tunnel = False self._timeout = config['timeout'] self._timeouts = [] # a list for all the handlers diff --git a/shadowsocks/tunnel.py b/shadowsocks/tunnel.py index 2fa38c7..dbfb438 100644 --- a/shadowsocks/tunnel.py +++ b/shadowsocks/tunnel.py @@ -48,13 +48,13 @@ def main(): (_config['local_address'], _config['local_port'], _config['tunnel_remote'], _config['tunnel_remote_port'])) tunnel_tcp_server = tcprelay.TCPRelay(_config, dns_resolver, True) - tunnel_tcp_server.is_tunnel = True + tunnel_tcp_server._is_tunnel = True tunnel_tcp_server.add_to_loop(loop) logging.info("starting udp tunnel at %s:%d forward to %s:%d" % (_config['local_address'], _config['local_port'], _config['tunnel_remote'], _config['tunnel_remote_port'])) tunnel_udp_server = udprelay.UDPRelay(_config, dns_resolver, True) - tunnel_udp_server.is_tunnel = True + tunnel_udp_server._is_tunnel = True tunnel_udp_server.add_to_loop(loop) def handler(signum, _): diff --git a/shadowsocks/udprelay.py b/shadowsocks/udprelay.py index 426150b..68e7c55 100644 --- a/shadowsocks/udprelay.py +++ b/shadowsocks/udprelay.py @@ -98,7 +98,7 @@ class UDPRelay(object): self.tunnel_remote = config.get('tunnel_remote', "8.8.8.8") self.tunnel_remote_port = config.get('tunnel_remote_port', 53) self.tunnel_port = config.get('tunnel_port', 53) - self.is_tunnel = False + self._is_tunnel = False self._dns_resolver = dns_resolver self._password = common.to_bytes(config['password']) self._method = config['method'] @@ -156,7 +156,7 @@ class UDPRelay(object): if self._stat_callback: self._stat_callback(self._listen_port, len(data)) if self._is_local: - if self.is_tunnel: + if self._is_tunnel: # add ss header to data tunnel_remote = self.tunnel_remote tunnel_remote_port = self.tunnel_remote_port @@ -280,7 +280,7 @@ class UDPRelay(object): if header_result is None: return addrtype, dest_addr, dest_port, header_length = header_result - if self.is_tunnel: + if self._is_tunnel: # remove ss header response = data[header_length:] else: