[tor-dev] channel_t to IP Address

Andrea Shepard andrea at torproject.org
Thu Jul 24 12:46:44 UTC 2014

On Thu, Jul 24, 2014 at 12:20:52PM +0100, Gareth Owen wrote:
> Hi all
> Quick question, how does one turn channel_t into an IP address, e.g. given
> a circuit_t how do I get the IP address of the previous and next hop
> (noting that they might not be in the consensus so I cant use the identity
> hash).  I can see the information is in the connection_t struct but I don't
> know how to get that from the channel/circuit.

The IP address (and the fact that the channel_t even is over IP) are
specific to particular transport; you'll have to downcast it to a
channel_tls_t using the BASE_CHAN_TO_TLS macro and then look at the
or_connection_t pointer in that structure.

Andrea Shepard
<andrea at torproject.org>
PGP fingerprint (ECC): BDF5 F867 8A52 4E4A BECF  DE79 A4FF BC34 F01D D536
PGP fingerprint (RSA): 3611 95A4 0740 ED1B 7EA5  DF7E 4191 13D9 D0CF BDA5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 328 bytes
Desc: not available
URL: <http://lists.torproject.org/pipermail/tor-dev/attachments/20140724/bdb54361/attachment.sig>

More information about the tor-dev mailing list