-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for --externalip flag #38
Comments
There are more use cases for --externalip than just Tor. For example, in certain firewall configurations the externally reachable port might not match the internal listen port. If the host is using a dynamic IP address, it should be possible to specify a hostname as --externalip |
This still doesn't quite work right in 0.4.0 I need to pass a domain name to --externalip because my public IP is dynamic. This is what my client should advertise to other peers so they know how to contact me, but it's not a local address that I can open an listening socket on. |
I've reopened this for further review. |
As an example, the test node I am running is behind a firewall that translates incoming ports. My node is externally reachable at btcd.airdns.org:17189. The node is internally reachable on an address in the 192.168.0.0/16 range on port 8333. When I add --externalip=btcd.airdns.org:17189 to the command line it looks like the node attempts to open a listening socket on that IP/port and fails. This works with the Satoshi client because it allows the list of IP/port combinations on which to open listening sockets to be completely independent of the list of IP(doman name)/port combinations which the node advertises to its peers. |
--externalip will do lookups on dns. if you use split horizon dns then it will of course lookup on the internal ip. What you may perhaps be missing is thay the advertised address in the bitcoind protocol is - it is a NetAddress which contains an ip (there is a hack in use for .onion addresses using a ipv6 private range) - therefore we can only advertise an ip, and that ip is the one that we have managed to look up via DNS. You can see at least some of this behaviour by using -d AMGR=debug Testing locallyconfirms that this works as expected. |
Also, if --externalip is used then btcd will not use any of the addresses that are listened on to advertise, this behaviour mirrors bitcoind. Once again, local testing confirms this seems to be working as planned. |
IP lookups are not a problem. As long as btcd doesn't actually attempt to open a listening socket on the IP/port listed in --externalup then it will work successfully. |
It will not atempt to do so, there is no logic to do this anywhere. |
I think i can see what your problem is though. It does fail to use the string in question because it looks up the hostname without first removing the port. I will commit a fix shortly. The log message may have been misconstrued as attempting to listen on the port. |
I just noticed that part of my problem was that I had a typo on the command line. When I fix that, the port issue you already mentioned showed up. I think once you remove the port number from the DNS lookup, and when I use the correct command line, it will work. |
I should have a fix for this commited in a few hours. In future please provide the relevant log messages with the bug report, this would have avoided the confusion as to what was happening here. |
Also, fix two gosimple finds.
blockchain: Add invalidateblock method to BlockChain
In addition to obtaining the external IP per issue #35 an
--externalip
flag should be provided to allow the user to override it. The will also enable specifying an onion address as the external IP for proper tor hidden service support.The text was updated successfully, but these errors were encountered: