Change supscriptions in protocol.checkIPv4Address()

to have bytes in python3
This commit is contained in:
Dmitri Bogomolov 2021-07-26 23:18:14 +03:00
parent 805e4097e2
commit 1edb4822be
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -173,13 +173,13 @@ def checkIPv4Address(host, hostStandardFormat, private=False):
Returns hostStandardFormat if it is an IPv4 address,
otherwise returns False
"""
if host[0] == b'\x7F': # 127/8
if host[0:1] == b'\x7F': # 127/8
if not private:
logger.debug(
'Ignoring IP address in loopback range: %s',
hostStandardFormat)
return hostStandardFormat if private else False
if host[0] == b'\x0A': # 10/8
if host[0:1] == b'\x0A': # 10/8
if not private:
logger.debug(
'Ignoring IP address in private range: %s', hostStandardFormat)