Commit 15996107 authored by Antoine Millet's avatar Antoine Millet
Browse files

Added forward function in cli handler

parent ac7ed26c
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -712,6 +712,20 @@ class CliHandler(RegisteredCCHandler):
        stun.close()
        return rcode

    @listed
    def forward(self, label, login, port, destination='127.0.0.1'):
        """ Forward a TCP port to the client.
        """
        # Create the tunnel to the node:
        try:
            host_client = self.server.get_client(login)
        except KeyError:
            raise KeyError('Specified client is not connected')
        s2n_tun = host_client.forward(port, destination)

        # Create tunnel to the CLI
        self.client.register_tunnel('forward', host_client, s2n_tun)

    def forward_call(self, login, func, *args, **kwargs):
        """ Forward a call to a connected client and return result.