Example #1
0
	def __init__(self, access_key, version, settings=None):
		if settings:
			self.settings = settings.copy()
		else:
			self.settings = Settings()
		self.settings.set("server.access_key", access_key)
		self.settings.set("server.version", version)
		
		self.auth_client = authentication.AuthenticationClient(self)
		self.secure_client = secure.SecureClient(self)
		
		if self.settings.get("kerberos.key_derivation") == 0:
			self.key_derivation = kerberos.KeyDerivationOld(65000, 1024)
		else:
			self.key_derivation = kerberos.KeyDerivationNew(1, 1)
		
		self.nat_traversal_server = nat.NATTraversalServer()
		self.notification_server = notification.NotificationServer()
		self.nintendo_notification_server = nintendo_notification.NintendoNotificationServer()

		self.protocol_map = {
			self.nat_traversal_server.PROTOCOL_ID: self.nat_traversal_server,
			self.notification_server.PROTOCOL_ID: self.notification_server,
			self.nintendo_notification_server.PROTOCOL_ID: self.nintendo_notification_server
		}
Example #2
0
async def test_simple():
    s = settings.default()

    servers = [AuthenticationServer()]
    async with rmc.serve(s, servers, HOST, 12345):
        async with rmc.connect(s, HOST, 12345) as client:
            assert client.remote_address() == (HOST, 12345)

            auth = authentication.AuthenticationClient(client)
            result = await auth.get_name(12345)
            assert result == "12345"
Example #3
0
async def test_unimplemented_protocol(anyio_backend):
    s = settings.default()

    servers = []
    async with rmc.serve(s, servers, HOST, 12345):
        async with rmc.connect(s, HOST, 12345) as client:
            assert client.remote_address() == (HOST, 12345)

            auth = authentication.AuthenticationClient(client)
            try:
                result = await auth.get_name(12345)
            except common.RMCError as e:
                assert e.result().name() == "Core::NotImplemented"
    def __init__(self, settings, client, host, port):
        self.settings = settings
        self.auth_client = client
        self.auth_host = host
        self.auth_port = port

        if settings["nex.version"] < 40000:
            self.auth_proto = authentication.AuthenticationClient(client)
        else:
            self.auth_proto = authentication.AuthenticationClientNX(client)

        if self.settings["kerberos.key_derivation"] == 0:
            self.key_derivation = kerberos.KeyDerivationOld(65000, 1024)
        else:
            self.key_derivation = kerberos.KeyDerivationNew(1, 1)
Example #5
0
	def __init__(self, access_key, version, settings=None):
		if settings:
			self.settings = settings.copy()
		else:
			self.settings = Settings()
		self.settings.set("server.access_key", access_key)
		self.settings.set("server.version", version)
		
		self.auth_client = authentication.AuthenticationClient(self)
		self.secure_client = secure.SecureClient(self)
		
		self.nat_traversal_server = nat.NATTraversalServer()
		self.notification_server = notification.NotificationServer()
		self.nintendo_notification_server = nintendo_notification.NintendoNotificationServer()

		self.protocol_map = {
			self.nat_traversal_server.PROTOCOL_ID: self.nat_traversal_server,
			self.notification_server.PROTOCOL_ID: self.notification_server,
			self.nintendo_notification_server.PROTOCOL_ID: self.nintendo_notification_server
		}
Example #6
0
    def __init__(self, settings=None):
        if isinstance(settings, Settings):
            self.settings = settings.copy()
        else:
            self.settings = Settings(settings)

        self.auth_client = service.RMCClient(self.settings)
        self.secure_client = service.RMCClient(self.settings)

        self.auth_proto = authentication.AuthenticationClient(self.auth_client)
        self.secure_proto = secure.SecureConnectionClient(self.secure_client)

        if self.settings.get("kerberos.key_derivation") == 0:
            self.key_derivation = kerberos.KeyDerivationOld(65000, 1024)
        else:
            self.key_derivation = kerberos.KeyDerivationNew(1, 1)

        self.pid = None
        self.local_station = None
        self.public_station = None
Example #7
0
    def __init__(self, access_key, version, settings=None):
        if settings:
            self.settings = settings.copy()
        else:
            self.settings = Settings()
        self.settings.set("server.access_key", access_key)
        self.settings.set("server.version", version)

        self.auth_client = service.RMCClient(self.settings)
        self.secure_client = service.RMCClient(self.settings)

        self.auth_proto = authentication.AuthenticationClient(self.auth_client)
        self.secure_proto = secure.SecureConnectionClient(self.secure_client)

        if self.settings.get("kerberos.key_derivation") == 0:
            self.key_derivation = kerberos.KeyDerivationOld(65000, 1024)
        else:
            self.key_derivation = kerberos.KeyDerivationNew(1, 1)

        self.my_pid = None
        self.local_station = None
        self.public_station = None
Example #8
0
 def connect(self, host, port):
     self.auth_addr = host, port
     self.auth_client = authentication.AuthenticationClient(self)
     self.auth_client.connect(host, port)