1234567891011121314151617181920212223242526272829303132 |
- #!/usr/bin/env python3
- import sys
- try:
- from twisted.internet import reactor
- except ImportError:
- print("\x1b[1mHey!\x1b[0m Activate your venv first!")
- sys.exit(2)
- from twisted.internet import protocol
- import logging
- import logging.config
- from twisted.python import log
- # from twisted.python.logfile import DailyLogFile
- from config import config, version
- from proxy import Player
- logger = logging.getLogger(__name__)
- log.PythonLoggingObserver().start()
- # if "logfile" in config and config["logfile"]:
- # log.startLogging(DailyLogFile("proxy.log", "."))
- # else:
- # log.startLogging(sys.stdout)
- logger.error("This is version: {0}".format(version))
- factory = protocol.Factory()
- factory.protocol = Player
- reactor.listenTCP(config["listen_port"], factory, interface=config["listen_on"])
- reactor.run()
|