mirror of
https://gitea.invidious.io/iv-org/Invidious-quic-proxy.git
synced 2024-08-15 00:43:22 +00:00
Finalize for release
This commit is contained in:
parent
12206c14c6
commit
45b6f4e5d2
3 changed files with 26 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,3 @@
|
|||
venv
|
||||
.idea
|
||||
__pycache__
|
||||
*.log
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
# [WIP] Quic proxy built in Python for the Invidious project.
|
||||
# Quic proxy built in Python for the Invidious project.
|
||||
|
||||
## Installation
|
||||
1. Clone the repository
|
||||
2. Create a python virtual environment
|
||||
3. Install dependencies through pip `pip install -r requirements.txt`
|
||||
|
||||
## Usage
|
||||
|
||||
|
|
23
main.py
23
main.py
|
@ -1,5 +1,6 @@
|
|||
import pathlib
|
||||
import logging
|
||||
import argparse
|
||||
import asyncio
|
||||
|
||||
import pytomlpp
|
||||
|
@ -9,8 +10,6 @@ from aiohttp import web
|
|||
|
||||
import quicclient
|
||||
|
||||
logging.basicConfig(filename="test.log", level=logging.INFO)
|
||||
|
||||
APP_NAME = "QUICProxy"
|
||||
APP_AUTHOR = "syeopite"
|
||||
|
||||
|
@ -28,6 +27,24 @@ if not config:
|
|||
routes = web.RouteTableDef()
|
||||
|
||||
|
||||
def process_cli_args():
|
||||
# Taken from https://stackoverflow.com/a/20663028
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
'-d', '--debug',
|
||||
help="Print lots of debugging statements",
|
||||
action="store_const", dest="loglevel", const=logging.DEBUG,
|
||||
default=logging.WARNING,
|
||||
)
|
||||
parser.add_argument(
|
||||
'-v', '--verbose',
|
||||
help="Be verbose",
|
||||
action="store_const", dest="loglevel", const=logging.INFO,
|
||||
)
|
||||
args = parser.parse_args()
|
||||
logging.basicConfig(level=args.loglevel)
|
||||
|
||||
|
||||
@routes.post("/")
|
||||
async def post(request):
|
||||
arguments = await request.json()
|
||||
|
@ -59,6 +76,6 @@ async def main():
|
|||
|
||||
|
||||
request_processor = quicclient.RequestProcessor()
|
||||
|
||||
if __name__ == '__main__':
|
||||
process_cli_args()
|
||||
web.run_app(main(), port=config.get("port", 7912), host=config.get("host", "0.0.0.0"))
|
||||
|
|
Loading…
Reference in a new issue