[Twisted-Python] Notification when SSHConnectForwardingChannel is ready for traffic?

Naveen Michaud-Agrawal naveen.michaudagrawal at gmail.com
Tue Dec 1 09:30:20 MST 2015


Yes it does. It looks like endpoints will also help in implementing the
next piece which is to support connections over SSL (instead of SSH
tunnelling). I haven't really used twisted since 8.0 - looks like I have a
lot of catching up to do! Thanks for the quick response.

Regards,
Naveen

On Tue, Dec 1, 2015 at 3:30 AM, Glyph Lefkowitz <glyph at twistedmatrix.com>
wrote:

>
> On Nov 30, 2015, at 4:17 PM, Naveen Michaud-Agrawal <
> naveen.michaudagrawal at gmail.com> wrote:
>
> Hi,
>
> I've managed to implement ssh tunneling using this answer on SO -
> http://stackoverflow.com/a/23549091/5605324, and the tunnel can be used
> from another app. However I would like to use it from within the twisted
> application, but I'm not sure what to wire up so that I can get a callback
> when the SSHConnectForwardingChannel is ready for traffic. It looks like I
> can attach a callback to channel's _channelOpenDeferred, but that seems a
> bit hacky. Any suggestions?
>
>
> Don't use listenTCP. Use endpoints:
> https://twistedmatrix.com/documents/15.5.0/core/howto/endpoints.html
>
> Once you have adopted endpoints, it (hopefully) becomes clear that one way
> to do what you want is to create your own in-process IStreamServerEndpoint
> implementation, and pass 'factory' in that answer to its 'listen' method,
> you can deliver data for it to relay to the remote port by calling its
> '.dataReceived' method, and implement your own '.write' method on your
> transport in order to deliver data to your application.  There's nothing
> magical about these methods, after all, they're just Python functions - and
> forwarding.SSHListenForwardingFactory just expects to talk to a transport,
> it shouldn't matter what kind it is.  (It might need to implement other
> interfaces, like ITCPTransport; not everything in Twisted is scrupulously
> careful about declaring what exact interface it needs, and there are often
> bugs in edge-cases like this.  But those are also just a few more methods
> you can implement, if necessary.)
>
> Does this make sense?
>
> -glyph
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>


-- 
-----------------------------------
Naveen Michaud-Agrawal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20151201/12ecb3d9/attachment-0002.html>


More information about the Twisted-Python mailing list