pep8
This commit is contained in:
parent
aae990a2fc
commit
f62a550e9f
1 changed files with 6 additions and 2 deletions
|
@ -100,9 +100,11 @@ BUF_SIZE = 32 * 1024
|
||||||
class BadSocksHeader(Exception):
|
class BadSocksHeader(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class NoAcceptableMethods(Exception):
|
class NoAcceptableMethods(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TCPRelayHandler(object):
|
class TCPRelayHandler(object):
|
||||||
def __init__(self, server, fd_to_handlers, loop, local_sock, config,
|
def __init__(self, server, fd_to_handlers, loop, local_sock, config,
|
||||||
dns_resolver, is_local):
|
dns_resolver, is_local):
|
||||||
|
@ -500,7 +502,8 @@ class TCPRelayHandler(object):
|
||||||
socks_version = common.ord(data[0])
|
socks_version = common.ord(data[0])
|
||||||
nmethods = common.ord(data[1])
|
nmethods = common.ord(data[1])
|
||||||
if socks_version != 5:
|
if socks_version != 5:
|
||||||
logging.warning('unsupported SOCKS protocol version ' + str(socks_version))
|
logging.warning('unsupported SOCKS protocol version ' +
|
||||||
|
str(socks_version))
|
||||||
raise BadSocksHeader
|
raise BadSocksHeader
|
||||||
if nmethods < 1 or len(data) != nmethods + 2:
|
if nmethods < 1 or len(data) != nmethods + 2:
|
||||||
logging.warning('NMETHODS and number of METHODS mismatch')
|
logging.warning('NMETHODS and number of METHODS mismatch')
|
||||||
|
@ -511,7 +514,8 @@ class TCPRelayHandler(object):
|
||||||
noauth_exist = True
|
noauth_exist = True
|
||||||
break
|
break
|
||||||
if not noauth_exist:
|
if not noauth_exist:
|
||||||
logging.warning('none of METHOD\'s requested by client is supported')
|
logging.warning('none of SOCKS METHOD\'s '
|
||||||
|
'requested by client is supported')
|
||||||
raise NoAcceptableMethods
|
raise NoAcceptableMethods
|
||||||
|
|
||||||
def _handle_stage_init(self, data):
|
def _handle_stage_init(self, data):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue