Insert exactly 16 bytes of encoded remote host name into version message

This commit is contained in:
Dmitri Bogomolov 2019-05-22 00:37:00 +03:00
parent df16f5047c
commit d0d0b2ec84
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -262,7 +262,9 @@ def assembleVersionMessage(remoteHost, remotePort, participatingStreams, server=
payload += encodeHost('127.0.0.1') payload += encodeHost('127.0.0.1')
payload += pack('>H', 8444) payload += pack('>H', 8444)
else: 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 payload += pack('>H', remotePort) # remote IPv6 and port
# bitflags of the services I offer. # bitflags of the services I offer.