tAdd support for multiple hostnames, e.g. Tor hidden service. - obelisk - Electrum server using libbitcoin as its backend
 (HTM) git clone https://git.parazyd.org/obelisk
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 82ce1faffe224f34f490d96c3b658216c5a60316
 (DIR) parent f40c874ad0015bcacce35680e6ee8d49cb0bb0ad
 (HTM) Author: parazyd <parazyd@dyne.org>
       Date:   Fri, 16 Apr 2021 12:24:59 +0200
       
       Add support for multiple hostnames, e.g. Tor hidden service.
       
       Diffstat:
         M obelisk/obelisk                     |       3 ++-
         M obelisk/protocol.py                 |      11 +++++------
         M res/obelisk.cfg                     |       1 +
       
       3 files changed, 8 insertions(+), 7 deletions(-)
       ---
 (DIR) diff --git a/obelisk/obelisk b/obelisk/obelisk
       t@@ -58,7 +58,8 @@ async def run_electrum_server(config, chain):
            endpoints["trans"] = config.get("obelisk", "trans")
        
            server_cfg = {}
       -    server_cfg["server_hostname"] = config.get("obelisk", "hostname")
       +    hostname_list = config.get("obelisk", "hostname").split(",")
       +    server_cfg["server_hostnames"] = hostname_list
            server_cfg["server_port"] = port
        
            global PROTOCOL
 (DIR) diff --git a/obelisk/protocol.py b/obelisk/protocol.py
       t@@ -653,15 +653,14 @@ class ElectrumProtocol(asyncio.Protocol):  # pylint: disable=R0904,R0902
                Return a list of features and services supported by the server.
                """
                cfg = self.server_cfg
       +        hosts = {}
       +        for host in cfg["server_hostnames"]:
       +            hosts[host] = {"tcp_port": cfg["server_port"]}
       +
                return {
                    "result": {
                        "genesis_hash": self.genesis,
       -                "hosts": {
       -                    cfg["server_hostname"]: {
       -                        "tcp_port": cfg["server_port"],
       -                        "ssl_port": None,
       -                    },
       -                },
       +                "hosts": hosts,
                        "protocol_max": SERVER_PROTO_MAX,
                        "protocol_min": SERVER_PROTO_MIN,
                        "pruning": None,
 (DIR) diff --git a/res/obelisk.cfg b/res/obelisk.cfg
       t@@ -4,6 +4,7 @@
        host = 127.0.0.1
        port = 50003
        # Public hostname for the server, ideally a valid domain or reachable IP
       +# (comma-separated if there are more, e.g. Tor hidden service)
        hostname = localhost
        
        # Which chain should this instance of obelisk be using (mainnet/testnet)