diff --git a/README.md b/README.md index 3bb044e..d94cb3e 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,9 @@ The port and address can be changed in config.toml, located in the default OS co ```toml # Host address to listen on listen = "0.0.0.0:7192" +# It also supports UNIX Sockets! +# listen = "/tmp/quicproxysocket" + # Amount of workers to process quic requests open_connections = 5 ``` diff --git a/main.py b/main.py index b0c1c45..86c58be 100644 --- a/main.py +++ b/main.py @@ -1,3 +1,4 @@ +import os import pathlib import logging import argparse @@ -78,6 +79,12 @@ async def main(): request_processor = quicclient.RequestProcessor() if __name__ == '__main__': process_cli_args() + listen_address = config.get("listen", "0.0.0.0:7912") - address, port = config.get("listen", "0.0.0.0:7912").split(":") - web.run_app(main(), port=port, host=address) + # Detect UNIX socket + # https://github.com/iv-org/invidious/pull/2111#issuecomment-846454891 + if os.sep in listen_address or ":" not in listen_address: + web.run_app(main(), path=listen_address) + else: + host, port = config.get("listen", "0.0.0.0:7912").split(":") + web.run_app(main(), port=port, host=host)