tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

make_hosts_file.py (606B)


      1 # mypy: allow-untyped-defs
      2 
      3 import argparse
      4 import os
      5 
      6 from ..localpaths import repo_root
      7 
      8 from ..serve.serve import build_config, make_hosts_file
      9 
     10 
     11 def create_parser():
     12    parser = argparse.ArgumentParser()
     13    parser.add_argument("address", default="127.0.0.1", nargs="?",
     14                        help="Address that hosts should point at")
     15    return parser
     16 
     17 
     18 def run(**kwargs):
     19    config_builder = build_config(os.path.join(repo_root, "config.json"),
     20                                  ssl={"type": "none"})
     21 
     22    with config_builder as config:
     23        print(make_hosts_file(config, kwargs["address"]))