Example #1
0
 def __init__(self):
     certificate, key_file = init_certificates()
     self.ctx_factory = VerifyingClientContextFactory(certificate, key_file)
     self.factory = LobbyClientFactory()
Example #2
0
        log("TRYING TO WRITE:::", message)
        self.transport.write(str(message + self.delimiter))

class LobbyFactory(Factory):
    protocol = Lobby

if __name__ == '__main__':

    import os

    if os.getenv('LOBBY_SHOW_LOGS'):
        from twisted.python import log as twisted_log
        twisted_log.startLogging(sys.stdout)

    from lobby.utils import init_certificates
    from lobby.utils import get_client_certificates

    factory = LobbyFactory()

    certificate, key_file = init_certificates()
    ctxFactory = VerifyingServerContextFactory(certificate, key_file)

    # Only clients presenting this certificate are allowed
    # to connect to the server.
    for cert in get_client_certificates():
        ctxFactory.loadAllowedCertificate(cert)

    reactor.listenSSL(8000, factory, ctxFactory)
    reactor.run()