tor-chanmgr: add experimental `ChanMgr::handle_incoming`
The current plan is that relay code will be able to call ChanMgr::handle_incoming
and pass it a byte stream (TransportImplHelper::Stream
, which is effectively <R as TcpProvider>::TcpStream
) and peer address. The ChanMgr
can decide whether to establish a channel using that stream or return an error (for example dos subsystem prevents the connection). The ChanMgr
passes the stream/sockaddr through to the ChanBuilder
, which builds a channel from them. There are two main TODOs: (1) Actually building the channel, and (2) adding the channel to the ChanMgr
. This PR is mostly just to add the code we need in order to start connecting those pieces. The functions are behind the experimental "relay" flag for now until the TODOs are handled.
(An alternative design could be for ChanMgr::handle_incoming
to take a Channel
instead, and build the incoming channel entirely outside of ChanMgr
. But I think it's better to keep all of the channel construction inside ChanMgr
unless there's a reason to do it another way.)