diff --git a/asucks/server.py b/asucks/server.py index 4f87b12..7211382 100644 --- a/asucks/server.py +++ b/asucks/server.py @@ -2,25 +2,14 @@ from asucks.socket_api import SocketServer from typing import Optional +import argparse import asyncio -# pylint: disable=import-error -import click -# pylint: enable=import-error import logging logging.basicConfig(level=logging.INFO) log = logging.getLogger(__name__) -@click.command() -@click.option("--port", default=1080, help="Server port") -@click.option("--host", default="0.0.0.0", help="Network interface") -@click.option("--username", default=None, help="Username for user/pass auth") -@click.option("--password", default=None, help="Password for user/pass auth") -@click.option("--validator", default=None, help="External validator url") -@click.option("--cafile", default=None, help="Remote validator certificate file") -@click.option("--log-level", default="INFO", help="Log level visible") -@click.option("--use-sockets", default=False, help="Use the base socket server implementation") def main( username: Optional[str], password: Optional[str], validator: Optional[str], cafile: Optional[str], host: str, port: int, use_sockets: bool, log_level: str @@ -51,5 +40,23 @@ async def run_main(config: ServerConfig, use_sockets: bool, log_level: str): if __name__ == "__main__": - # pylint: disable=no-value-for-parameter - main() + parser = argparse.ArgumentParser(description="SOCKS5 server", prog="asucks.server") + parser.add_argument("--port", default=1080, help="Server port") + parser.add_argument("--host", default="0.0.0.0", help="Network interface") + parser.add_argument("--username", default=None, help="Username for user/pass auth") + parser.add_argument("--password", default=None, help="Password for user/pass auth") + parser.add_argument("--validator", default=None, help="External validator url") + parser.add_argument("--cafile", default=None, help="Remote validator certificate file") + parser.add_argument("--log-level", default="INFO", help="Log level visible") + parser.add_argument("--use-sockets", default=False, help="Use the base socket server implementation") + args = parser.parse_args(None) + main( + username=args.username, + password=args.password, + validator=args.validator, + port=args.port, + host=args.host, + cafile=args.cafile, + log_level=args.log_level, + use_sockets=args.use_sockets, + ) diff --git a/poetry.lock b/poetry.lock index 7a50e13..10f398f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -105,14 +105,6 @@ optional = false python-versions = "*" version = "3.0.4" -[[package]] -category = "main" -description = "Composable command line interface toolkit" -name = "click" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -version = "7.1.2" - [[package]] category = "dev" description = "Cross-platform colored terminal text." @@ -490,7 +482,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["pytest (>=3.5,<3.7.3 || >3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "jaraco.test (>=3.2.0)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] [metadata] -content-hash = "7206b6d42fcbca37668ef9c5443c83224fd7eccdf137027eff9d85e9ca828713" +content-hash = "0611df9de67cc40be298e1de4bca3b38e50cd52e0e9fc4829452f81222e330b0" python-versions = "^3.7" [metadata.files] @@ -561,10 +553,6 @@ chardet = [ {file = "chardet-3.0.4-py2.py3-none-any.whl", hash = "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"}, {file = "chardet-3.0.4.tar.gz", hash = "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"}, ] -click = [ - {file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"}, - {file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"}, -] colorama = [ {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"}, diff --git a/pyproject.toml b/pyproject.toml index 5c438a5..0af6ce3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,6 @@ authors = ["Gabriel Tincu "] [tool.poetry.dependencies] python = "^3.7" -click = "7.1.2" aiohttp = "3.7.2" diff --git a/requirements.txt b/requirements.txt index 874d28b..f1bf64e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1 @@ -click==7.1.2 aiohttp==3.7.2