Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if args.daemon:
try:
__import__('daemon').DaemonContext().open()
except ModuleNotFoundError:
print("Missing library: pip3 install python-daemon")
return
# Try to use uvloop instead of the default event loop
try:
__import__('uvloop').install()
print('Using uvloop')
except ModuleNotFoundError:
pass
loop = asyncio.get_event_loop()
if args.v:
from . import verbose
verbose.setup(loop, args)
servers = []
for option in args.listen:
print('Serving on', option.bind, 'by', ",".join(i.name for i in option.protos) + ('(SSL)' if option.sslclient else ''), '({}{})'.format(option.cipher.name, ' '+','.join(i.name() for i in option.cipher.plugins) if option.cipher and option.cipher.plugins else '') if option.cipher else '')
try:
server = loop.run_until_complete(option.start_server(vars(args)))
servers.append(server)
except Exception as ex:
print('Start server failed.\n\t==>', ex)
for option in args.ulisten:
print('Serving on UDP', option.bind, 'by', ",".join(i.name for i in option.protos), f'({option.cipher.name})' if option.cipher else '')
try:
server, protocol = loop.run_until_complete(option.start_udp_server(vars(args)))
servers.append(server)
except Exception as ex:
print('Start server failed.\n\t==>', ex)
for option in args.rserver: