[Twisted-Python] getPeer() inside conch
glyph at twistedmatrix.com
Tue Sep 29 01:58:37 EDT 2009
On Mon, Sep 28, 2009 at 8:10 PM, Benjamin Rutt <rutt.4 at osu.edu> wrote:
> But, it seems the recvline.HistoricRecvLine class wants me to use
> self.terminal rather than self.transport to talk to the client. That's
> fine, but it seems that self.terminal lacks a getPeer() method. How do I
> find out the IP address of the client inside a conch ssh server? (For
> starters, I wish to log all successful client connections so I know who's
So, after reading through the code a bit, self.terminal should be an
ITerminalTransport. There are only a few ITerminalTransport
implementations, several of which are also Protocol subclasses and therefore
have a 'transport' attribute.
I'm not 100% sure what the eventual composiiton of your application will be,
but you could try self.terminal.transport.getPeer(); it might work.
Technically speaking, ITerminalTransport is a subclass of ITransport, which
has a getPeer method. Therefore any classes which implement
ITerminalTransport without providing getPeer are buggy. It would be really
helpful if you could provide a patch that addressed the issue you mention
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-Python