예제 #1
0
파일: client.py 프로젝트: gokmen/Lobby
 def __init__(self):
     certificate, key_file = init_certificates()
     self.ctx_factory = VerifyingClientContextFactory(certificate, key_file)
     self.factory = LobbyClientFactory()
예제 #2
0
파일: server.py 프로젝트: gokmen/Lobby
        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()