Skip to content

Commit

Permalink
handle unknown ips, e.g. from unix sockets
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbers committed Mar 5, 2020
1 parent 8f48e9e commit 37d570f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mtprotoproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1235,9 +1235,11 @@ async def handle_handshake(reader, writer):
return False

peer = writer.get_extra_info("peername")[:2]
if not peer:
peer = ("unknown ip", 0)

if config.PROXY_PROTOCOL:
ip = peer[0] if peer else "unknown address"
ip = peer[0] if peer else "unknown ip"
peer = await handle_proxy_protocol(reader, peer)
if not peer:
print_err("Client from %s sent bad proxy protocol headers" % ip)
Expand Down

0 comments on commit 37d570f

Please sign in to comment.