twgs-proxy.py 715 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env python3
  2. import sys
  3. from twisted.internet import reactor
  4. from twisted.internet import protocol
  5. import logging
  6. import logging.config
  7. from twisted.python import log
  8. # from twisted.python.logfile import DailyLogFile
  9. from config import config, version
  10. from proxy import Player
  11. logger = logging.getLogger(__name__)
  12. log.PythonLoggingObserver().start()
  13. # if "logfile" in config and config["logfile"]:
  14. # log.startLogging(DailyLogFile("proxy.log", "."))
  15. # else:
  16. # log.startLogging(sys.stdout)
  17. logger.error("This is version: {0}".format(version))
  18. factory = protocol.Factory()
  19. factory.protocol = Player
  20. reactor.listenTCP(config["listen_port"], factory, interface=config["listen_on"])
  21. reactor.run()