implement proxy server connection-test on client startup #1760

pull Diapolo wants to merge 1 commits into bitcoin:master from Diapolo:proxy_connection_test changing 3 files +28 −4
  1. Diapolo commented at 9:00 PM on August 30, 2012: none
    • add ConnectionTest() to netbase.h to do a connection-test for a present -proxy address on client init and warn on failure

    This is informing users about a failure to connect to a supplied proxy, current timeout is 1sec, which we can discuss.

    Fixes: #763

  2. laanwj commented at 2:53 AM on August 31, 2012: member

    Good idea, some comments though if we're going to add this:

    • We should loop over all configured proxies (IPV4, IPV6 and .onion) and try to connect to them
    • It should still set the proxy even though it doesn't manage to connect to it. Keep it at a warning, assume the user knows what they're doing. It can be an enormous security breach to connect directly outside the proxy.
      • Also remember that proxies can suffer from intermittent failures. One failed connection attempt doesn't tell that much. But a pop-up / warning in log is nice.
    • Should this be in the init() or in the network thread, or even in its own thread? After all, I'm don't think that a slow proxy should hold up the startup process
    • Talking of slow proxies: is there a timeout? Or will specifying a non-existent host hold up the initialization forever?
  3. Diapolo commented at 5:46 AM on August 31, 2012: none

    @laanwj Thanks for your feedback.

    • You are right, we should test every supplied proxy, but tell me how would I pass (command-line wise) more than 1 proxy as in current init code there is no loop for more than 1 proxy.
    • Yes it should leave the option active and just warn the user, to don't breach privacy, I'll change that. I see the current implementation just as a startup check, which could be extended to a proactive meassurement thread or sth.
    • As to init(), network or own thread I have no final belief, where this is suited best ...
    • There currently is just a 1sec timeout and if that passed the warning is shown.
  4. implement proxy server connection-test on client startup
    - add ConnectionTest() to netbase.h to do a connection-test for a present
      -proxy address on client init and warn on failure
    0b1e73d1e1
  5. Diapolo commented at 9:33 AM on August 31, 2012: none

    Updated to not disable the proxy, even if it is not reachable, which could be a temporary problem and to not leak information a user does not want to get leaked :).

    I'm still asking myself, how I could supply a normal IPv4 proxy and one for IPv6 peers via -proxy? Take a look at init.cpp there is no loop so as far as I can tell we can only supply a single proxy via -proxy currently, which is used for IPv4 and IPv6 (if support is enabled).

  6. sipa commented at 11:31 AM on August 31, 2012: member

    @Diapolo A separate proxy server for IPv6 was never implemented :)

  7. Diapolo commented at 11:03 PM on August 31, 2012: none

    @sipa Not yet, but as you know #1769 just does that. Are you fine with the ConnectionTest() function?

  8. gmaxwell commented at 12:05 AM on September 1, 2012: contributor

    Is there a need to explicitly test? Why not just observe where the failure happens when an outgoing connection happens? (e.g. did we fail connecting to the proxy, or did it return an error?). Also, simply opening up a tcp connection to the proxy isn't enough to know that it's actually working. E.g. if you have a webserver on 80 and a proxy on 8080 and I erroneously specify 80 then it'll connect but not actually work.

  9. Diapolo commented at 8:52 AM on September 1, 2012: none

    @gmaxwell Currently, when using or supplying a non working proxy, the client simply does not connect and tells the user nothing about it (which is worst case IMO). This one at least checks if a connection to the supplied IP:port combination can be made on startup.

    You are right the connection is not used as proxy connection currently, but I guess ConnectionTest() can be extended. I did not intend it as watchdog, but just to fix #763. I like your idea though and @laanwj suggested something similar.

  10. laanwj commented at 9:01 AM on September 1, 2012: member

    I like @gmaxwell's test-as-we-go approach. When the proxy is used, and it fails to connect to the proxy, show and log a warning (only once!).

    For this to work you'd need to isolate cannot-connect-to-proxy problems from the-proxy-cannot-connect-to-target errors.

  11. Diapolo commented at 3:53 PM on September 1, 2012: none

    I'll close this for now and perhaps re-open in the future, when a better approach is ready :).

  12. Diapolo closed this on Sep 1, 2012

  13. owlhooter referenced this in commit 4802a1fb71 on Oct 10, 2018
  14. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 18:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me