socks4a pylint fixes

This commit is contained in:
lakshyacis 2019-09-10 14:51:02 +05:30
parent 8f848609ef
commit 79d1b1b9e2
No known key found for this signature in database
GPG Key ID: D2C539C8EC63E9EB
2 changed files with 8 additions and 5 deletions

View File

@ -1,3 +1,8 @@
"""
src/network/socks4a.py
=================================
"""
# pylint: disable=attribute-defined-outside-init
import socket
import struct
@ -82,7 +87,7 @@ class Socks4aConnection(Socks4a):
self.append_write_buf(self.ipaddr)
except socket.error:
# Well it's not an IP number, so it's probably a DNS name.
if Proxy._remote_dns:
if self._remote_dns:
# Resolve remotely
rmtrslv = True
self.ipaddr = None
@ -118,6 +123,7 @@ class Socks4aResolver(Socks4a):
Socks4a.__init__(self, address=(self.host, self.port))
def state_auth_done(self):
"""Request connection to be made"""
# Now we can request the actual connection
self.append_write_buf(
struct.pack('>BBH', 0x04, 0xF0, self.destination[1]))

View File

@ -124,10 +124,7 @@ class UDPSocket(BMProto):
self.destination = state.Peer(*addr)
encodedAddr = protocol.encodeHost(addr[0])
if protocol.checkIPAddress(encodedAddr, True):
self.local = True
else:
self.local = False
self.local = bool(protocol.checkIPAddress(encodedAddr, True))
# overwrite the old buffer to avoid mixing data and so that
# self.local works correctly
self.read_buf[0:] = recdata