-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tunneling over HTTP/2 #37
Comments
@mmatczuk This is so cool! I will definitely take a look soon! |
Hi @rjeczalik did you find time to have a closer look? |
@mmatczuk Yes sir, took a look. Really nice implementation, however I'm wondering how it'd be possible to use raw TCP/WebSocket without wrapping the stream with TLS handshake. In particular how we could e.g. |
@rjeczalik thanks for the effort. Addressing your concerns the problem might be that TLS client sees that server certificate and host do not match... On that front TCP and WS are quite a different beasts. For WS you can run SSH should work just fine as it seems not to care i.e.
On server you do Anyway I'd like to start making h2tun production ready (on elementary level) by:
Then I will add examples to cover your concerns as well. Have an awesome weekend! |
@mmatczuk Got it, on server side we use plain
Likewise! |
This is done to some extent see here, this allows for Note that host and URL path are separated in h2tunc control message (unlike in URI) this is to remove port. The current koding tunnel has some difficulties if you do not run server on default port or if you simultaneously run on http and https. H2tun ignores port as server is agnostic of how it's being run and client should know nothing about it. |
@rjeczalik I took your tip and did an experiment to replace yamux with HTTP/2. At first I wanted to make it a small change but it turned out that there were many incompatibilities so I decided to start fresh.
I did a POC that can proxy HTTP and TCP and uses
ProxyFunc
design (no default functions yet). It turns out that the implementation can be really short and concise withhttp2
package. Server is ~300LOC and client ~100LOC (mostly consumed by structs and comments). The code is available at https://github.com/mmatczuk/h2tun.Performance using HTTP/2 is slightly better than using yamux but I think the key benefit is improved stability, you can see a report that I wrote https://github.com/mmatczuk/h2tun/blob/master/benchmark/report/README.md.
This implementation follows a similar design that the current tunnel, I'd like to highlight some changes here
ProxyFunc
takesio.Writer
andio.Reader
instead ofnet.Conn
ControlMessage
is changed, protocol is a string, it has extra fields, in general it follows some version of Forwarded HTTP Extension https://tools.ietf.org/html/rfc7239.It's a POC, some things that exists in the tunnel should be migrated to make it truly usable. I also have some new ideas you can see in https://github.com/mmatczuk/h2tun/blob/master/TODO.md.
Please let me know what do you think.
I'd be really grateful for a review if find some time.
Cheers.
cc @cihangir
The text was updated successfully, but these errors were encountered: