Open AdamISZ opened 3 years ago
Thanks for the clear report! This does indeed sound like a bug.
(Sorry for the delay responding. I believe I now have a better way to pay attention to github notifications...)
If you're up for trying a PR, that'd be great!
Hi, I have previously used this codebase to start up ephemeral onion services with no issues, however I encountered an issue when using it to start a persistent onion service. In my
torrc
I have configuredHiddenServicePort
in the usual way; 80 for the public port, and a specific chosen port is entered (say 8080) for the local port.When I ran a test using the example code, but setting my endpoint string like this:
... I found that the local port is generated randomly, rather than being 8080. In the code for
TCPHiddenServiceEndpoint.listen()
it's clear why:https://github.com/meejah/txtorcon/blob/0c416cc8fe18b913cd0c7422935885a1bfecf4c0/txtorcon/endpoints.py#L562-L569
The variable
self.local_port
was set in the constructor as intended (here, to 8080) but the string used in theserverFromString
call just puts 0 so we get a fresh port. I verified that this could be fixed with something like:... not that that is more than a testing patch, but just to concretize the point. It works fine after that (i.e. the hidden service is accessible).