Rework network config settings #1389

pull sipa wants to merge 1 commits into bitcoin:master from sipa:netopt changing 11 files +237 −164
  1. sipa commented at 5:05 pm on May 24, 2012: member

    Rework network config settings according to the specification in https://gist.github.com/2763381.

    The network base does no longer call GetArg directly. Instead, everything happens through a few globals and the SetProxy/SetNameProxy methods. These are called in init.cpp:AppInit2, and in Bitcoin-Qt’s optionsmodel.cpp.

  2. jgarzik commented at 5:10 pm on May 24, 2012: contributor

    ACK

    Tangentially related: it would be nice to move as much code from init.cpp into net*.cpp as possible, with init.cpp only calling NetParseConfig() or somesuch. Maybe that would help with qt/optionsmodel.cpp long term maintenance.

  3. sipa commented at 5:23 pm on May 24, 2012: member
    @jgarzik agree, I considered that, but wanted to postpone that until after tor hidden service support is merged, as that will extend the network config options further.
  4. sipa commented at 5:14 pm on May 26, 2012: member
    @laanwj ack on the optionsmodel changes? After tor hidden service support is merged, the network option panel should be extended, I think, but for now, this should do.
  5. in src/bitcoinrpc.cpp: in dc48b6e43b outdated
    529@@ -530,6 +530,9 @@ Value getinfo(const Array& params, bool fHelp)
    530             "getinfo\n"
    531             "Returns an object containing various state info.");
    532 
    533+    CService addrProxy;
    534+    GetProxy(NET_IPV4, addrProxy);
    


    luke-jr commented at 5:46 pm on May 26, 2012:
    Why does GetProxy have NET_IPV4 all over? do IPv6 proxies work?

    sipa commented at 5:52 pm on May 26, 2012:

    Internally, proxies can be selected separately for each network, and for hostname-based destination. The config and GUI right now are pinned to assume the IPv4 one is the only one, so they read NET_IPV4, and modify the NET_IPV4, NET_IPV6, and named ones simuitaneously.

    It’s just a temporary measure, I expect the GUI config panel will be extended with more proxy options, and for RPC maybe we can move to a “getnetconfig” command that returns this kind of information, including connected peers and some statistics?

  6. in src/init.cpp: in dc48b6e43b outdated
    216         "  -addnode=<ip>          " + _("Add a node to connect to and attempt to keep the connection open") + "\n" +
    217-        "  -connect=<ip>          " + _("Connect only to the specified node") + "\n" +
    218+        "  -connect=<ip>          " + _("Connect only to the specified node(s)") + "\n" +
    219         "  -seednode=<ip>         " + _("Connect to a node to retrieve peer addresses, and disconnect") + "\n" +
    220-        "  -externalip=<ip>       " + _("Specify your own public address") + "\n" +
    221+        "  -externalip=<ip>       " + _("Specify your own public address.") + "\n" +
    


    luke-jr commented at 5:46 pm on May 26, 2012:
    Nothing else ends with a full stop, why this one?

    sipa commented at 5:52 pm on May 26, 2012:
    Good catch. Will fix.
  7. in src/init.cpp: in dc48b6e43b outdated
    219         "  -seednode=<ip>         " + _("Connect to a node to retrieve peer addresses, and disconnect") + "\n" +
    220-        "  -externalip=<ip>       " + _("Specify your own public address") + "\n" +
    221+        "  -externalip=<ip>       " + _("Specify your own public address.") + "\n" +
    222         "  -onlynet=<net>         " + _("Only connect to nodes in network <net> (IPv4 or IPv6)") + "\n" +
    223-        "  -discover              " + _("Try to discover public IP address (default: 1)") + "\n" +
    224+        "  -discover              " + _("Discover own IP address (default on when listening and no -externalip)") + "\n" +
    


    luke-jr commented at 5:47 pm on May 26, 2012:
    Unless we accept -discover=on, this should read “default: 1 iff listening and no -externalip; 0 otherwise”

    sipa commented at 5:52 pm on May 26, 2012:
    Agree, wll change.
  8. sipa commented at 5:00 pm on May 27, 2012: member
    updated
  9. Rework network config settings 587f929c64
  10. sipa commented at 4:20 pm on May 31, 2012: member
    As asked by @gavinandresen: the parameter interactions are now done using SoftSetBoolArg, instead of complex boolean formulas. Also added some comments.
  11. laanwj commented at 10:32 am on June 1, 2012: member

    ACK on gui changes

    I wonder if “applyproxysettings” belongs in optionsmodel, though (or the ui code at all). It uses core settings to update core settings, wouldn’t it be just as applicable when proxy is changed through other means?

  12. sipa commented at 10:37 am on June 1, 2012: member
    Yes, and it is effectively duplicated code from init.cpp for now. That’s why Jeff already suggested a common NetParseConfig somehwere - I think that’s the right approach.
  13. gavinandresen commented at 6:54 pm on June 4, 2012: contributor
    ACK. Lightly tested on OSX.
  14. gavinandresen merged this on Jun 4, 2012
  15. gavinandresen closed this on Jun 4, 2012

  16. Diapolo commented at 8:58 pm on June 4, 2012: none

    @sipa This introduces a small display bug in the Qt GUI, it displays “localhost” as default Proxy-IP and it seems hostnames are not allowed there. If I enable the proxy and click apply it is changed to 127.0.0.1.

    I think this happens in CNetAddr::ToStringIP(), which resolves 127.0.0.1 to “localhost”, which is true, but currently not allowed in the GUI input field or in this line: https://github.com/bitcoin/bitcoin/pull/1389/files#L9R151

  17. suprnurd referenced this in commit fc7eca597d on Dec 5, 2017
  18. lateminer referenced this in commit 9dfc84a8d9 on Jan 22, 2019
  19. lateminer referenced this in commit f80888b770 on May 6, 2020
  20. lateminer referenced this in commit 104db7d7f3 on May 6, 2020
  21. 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: 2024-12-04 18:12 UTC

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