Skip to content

Write bindings for libssh2_channel_direct_streamlocal #40

Open
@imgurbot12

Description

@imgurbot12

I noticed this has been added recently added to the libssh2 library and was wondering if it could be wrapped and accessible through this as well.

Here is the pull request to show the changes in libssh2: libssh2/libssh2#216

I have never worked with cpython before, otherwise i would make a pull request with the changes myself but i imagine the code in session.pyx would look something like this:

def channel_direct_streamlocal(self, socket_path not None, shost not None, int sport):
        cdef c_ssh2.LIBSSH2_CHANNEL *channel
        cdef bytes b_shost = to_bytes(shost)
        cdef bytes b_socket_path = to_bytes(socket_path)
        cdef char *_shost = b_shost
        cdef char *_socket_path = b_socket_path
        with nogil:
            channel = c_ssh2.libssh2_channel_direct_streamlocal(
                self._session, _socket_path, _shost, sport)
        if channel is NULL:
            return handle_error_codes(c_ssh2.libssh2_session_last_errno(
                self._session))
        return PyChannel(channel, self)

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions