43 lines
2.0 KiB
Python
Executable File
43 lines
2.0 KiB
Python
Executable File
#!/usr/bin/env python
|
|
from twisted.internet import reactor
|
|
from twisted.internet.ssl import DefaultOpenSSLContextFactory
|
|
#from twisted.python import log
|
|
#from sys import stdout
|
|
#log.startLogging(stdout)
|
|
|
|
import main
|
|
|
|
main.initMain()
|
|
|
|
from utils.logging.log import *
|
|
from utils.loaders.command_loader import loadCommands
|
|
from core.helper import startBot
|
|
from core.server import Server, ServerFactory
|
|
from core.relay import Relay, RelayFactory
|
|
|
|
loadCommands()
|
|
|
|
if __name__ == "__main__":
|
|
listener = ServerFactory()
|
|
if main.config["Listener"]["UseSSL"] == True:
|
|
reactor.listenSSL(main.config["Listener"]["Port"], listener, DefaultOpenSSLContextFactory(main.certPath+main.config["Key"], main.certPath+main.config["Certificate"]), interface=main.config["Listener"]["Address"])
|
|
log("Threshold running with SSL on %s:%s" % (main.config["Listener"]["Address"], main.config["Listener"]["Port"]))
|
|
else:
|
|
reactor.listenTCP(main.config["Listener"]["Port"], listener, interface=main.config["Listener"]["Address"])
|
|
log("Threshold running on %s:%s" % (main.config["Listener"]["Address"], main.config["Listener"]["Port"]))
|
|
if main.config["Relay"]["Enabled"]:
|
|
relay = RelayFactory()
|
|
if main.config["Relay"]["UseSSL"] == True:
|
|
reactor.listenSSL(main.config["Relay"]["Port"], relay, DefaultOpenSSLContextFactory(main.certPath+main.config["Key"], main.certPath+main.config["Certificate"]), interface=main.config["Relay"]["Address"])
|
|
log("Threshold relay running with SSL on %s:%s" % (main.config["Relay"]["Address"], main.config["Relay"]["Port"]))
|
|
else:
|
|
reactor.listenTCP(main.config["Relay"]["Port"], relay, interface=main.config["Relay"]["Address"])
|
|
log("Threshold relay running on %s:%s" % (main.config["Relay"]["Address"], main.config["Relay"]["Port"]))
|
|
for i in main.pool.keys():
|
|
if not "enabled" in main.pool[i]:
|
|
continue
|
|
if main.pool[i]["enabled"] == True:
|
|
startBot(i)
|
|
|
|
reactor.run()
|