Add ability to listen on Unix sockets
This commit is contained in:
parent
ca5627516a
commit
ecdff3a8bf
|
@ -22,6 +22,9 @@ The port and address can be changed in config.toml, located in the default OS co
|
||||||
```toml
|
```toml
|
||||||
# Host address to listen on
|
# Host address to listen on
|
||||||
listen = "0.0.0.0:7192"
|
listen = "0.0.0.0:7192"
|
||||||
|
# It also supports UNIX Sockets!
|
||||||
|
# listen = "/tmp/quicproxysocket"
|
||||||
|
|
||||||
# Amount of workers to process quic requests
|
# Amount of workers to process quic requests
|
||||||
open_connections = 5
|
open_connections = 5
|
||||||
```
|
```
|
||||||
|
|
11
main.py
11
main.py
|
@ -1,3 +1,4 @@
|
||||||
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import logging
|
import logging
|
||||||
import argparse
|
import argparse
|
||||||
|
@ -78,6 +79,12 @@ async def main():
|
||||||
request_processor = quicclient.RequestProcessor()
|
request_processor = quicclient.RequestProcessor()
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
process_cli_args()
|
process_cli_args()
|
||||||
|
listen_address = config.get("listen", "0.0.0.0:7912")
|
||||||
|
|
||||||
address, port = config.get("listen", "0.0.0.0:7912").split(":")
|
# Detect UNIX socket
|
||||||
web.run_app(main(), port=port, host=address)
|
# 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 New Issue