Skip to content

Commit

Permalink
Remove click dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Tincu committed Nov 12, 2020
1 parent f6ec994 commit 7f5171f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 29 deletions.
35 changes: 21 additions & 14 deletions asucks/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
)
14 changes: 1 addition & 13 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ authors = ["Gabriel Tincu <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.7"
click = "7.1.2"
aiohttp = "3.7.2"


Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
click==7.1.2
aiohttp==3.7.2

0 comments on commit 7f5171f

Please sign in to comment.