Skip to content
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

Proxy protocol support #121

Open
thijsc opened this issue Nov 4, 2022 · 4 comments
Open

Proxy protocol support #121

thijsc opened this issue Nov 4, 2022 · 4 comments

Comments

@thijsc
Copy link

thijsc commented Nov 4, 2022

We run some services behind Haproxy and Nginx which use proxy protocol to preserve the clients ip address. It would be really nice if we could do this using Tokio directly too. Is it possible to do this somehow? If not this is something I'd be interested in help figure out or write.

@djc
Copy link
Contributor

djc commented Nov 4, 2022

It's probably possible, but it's not obvious to me that these crates are the place to add it? Why couldn't it be a wrapper around a tokio-rustls (or tokio-native-tls) stream?

@thijsc
Copy link
Author

thijsc commented Nov 5, 2022

Why couldn't it be a wrapper around a tokio-rustls (or tokio-native-tls) stream?

Good question. I was assuming as much because I see a TlsAcceptor being used in the examples. For proxy protocol support it would have to read some bytes off the connection before initiating the handshake. So it seems like some option on this acceptor would make sense. Or do you think it should be in another place?

@djc
Copy link
Contributor

djc commented Nov 7, 2022

Ahh, okay, that makes sense. I'm still not very familiar with the proxy protocol and unlikely to have much time to learn it. @hawkw do you have experience with it? In any case, I think it couldn't hurt to write some code for protocol support and then figure out how best to incorporate/publish it on crates.io.

@thijsc
Copy link
Author

thijsc commented Nov 7, 2022

I will do some experimentation as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants