[tor-commits] [stem/master] Omit our address from NETINFO
atagar at torproject.org
atagar at torproject.org
Wed Feb 7 19:44:51 UTC 2018
commit cfadcde5a08af28e2e39eb467c0ba81aace662ef
Author: Damian Johnson <atagar at torproject.org>
Date: Tue Feb 6 11:41:02 2018 -0800
Omit our address from NETINFO
We already weren't providing it so this just adjusts the comment talking about
why. There's a few issues...
1. Getting our address with python is clunky. Simplest approach is...
socket.gethostbyname(socket.gethostname())
... but I suspect what we really want is our external address, which I'm
unsure how best to get.
2. We don't have a usecase at present where it helps. Tor is quite happy to not
receive one, and seems if I provide junk data it's happy to accept that too.
For now just opting to exclude it until we have a concrete use case, which in
turn will inform if the internal address is acceptable or we must resolve
something else.
---
stem/client/__init__.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/stem/client/__init__.py b/stem/client/__init__.py
index b743a0eb..f4fc718b 100644
--- a/stem/client/__init__.py
+++ b/stem/client/__init__.py
@@ -103,7 +103,9 @@ class Relay(object):
conn.close()
raise stem.SocketError('Unable to find a common link protocol. We support %s but %s:%i supports %s.' % (', '.join(link_protocols), address, port, ', '.join(versions_reply.versions)))
- # TODO: we should fill in our address, right?
+ # Establishing connections requires sending a NETINFO, but including our
+ # address is optional. We can revisit including it when we have a usecase
+ # where it would help.
link_protocol = max(common_protocols)
conn.send(stem.client.cell.NetinfoCell(Address(address), []).pack(link_protocol))
More information about the tor-commits
mailing list