Skip to content

Commit

Permalink
Insert exactly 16 bytes of encoded remote host name into version message
Browse files Browse the repository at this point in the history
  • Loading branch information
g1itch committed May 24, 2019
1 parent df16f50 commit d0d0b2e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ def assembleVersionMessage(remoteHost, remotePort, participatingStreams, server=
payload += encodeHost('127.0.0.1')
payload += pack('>H', 8444)
else:
payload += encodeHost(remoteHost)
# use first 16 bytes if host data is longer
# for example in case of onion v3 service
payload += encodeHost(remoteHost)[:16]
payload += pack('>H', remotePort) # remote IPv6 and port

# bitflags of the services I offer.
Expand Down

0 comments on commit d0d0b2e

Please sign in to comment.