mirror of
https://gitea.invidious.io/iv-org/Invidious-quic-proxy.git
synced 2024-08-15 00:43:22 +00:00
Add ability to listen on Unix sockets
This commit is contained in:
parent
ca5627516a
commit
ecdff3a8bf
2 changed files with 12 additions and 2 deletions
|
@ -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
|
||||
```
|
||||
|
|
11
main.py
11
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)
|
||||
|
|
Loading…
Reference in a new issue