warp icon indicating copy to clipboard operation
warp copied to clipboard

No run_incoming or serve_incoming on TlsServer

Open sbstp opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. I want to use an AddrIncoming to be able grab the server's IP address before I spawn it. I'm creating servers on port 0 so the OS takes care of finding a free port. AddrIncoming allows me to do this. However, at the moment the warp API does not allow a TlsServer to be spawned on top of an arbitrary Incoming.

Describe the solution you'd like I'd like TlsServer to get a run_incoming(...) and serve_incoming(...) method, just like Server. That way I can use an AddrIncoming whose address I can access.

Describe alternatives you've considered I tried fiddling with the lower level primitives in hyper, but hyper doesn't support TLS on its own, so it's not obvious how to get there. I could also see the Server/TlsServer get an address method (although not all Incoming types have an address), or a way to borrow the inner Incoming to call methods on it.

sbstp avatar Aug 14 '22 21:08 sbstp

Hi, have you seen the Filter to Service conversion? with that you can then re-create your own run_incoming and serve_incoming, see also the Hyper Rustls server example.

jxs avatar Aug 16 '22 11:08 jxs