-
Notifications
You must be signed in to change notification settings - Fork 214
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
[WIP] Implement proxy-protocol v1 support for TCP server #101
Conversation
That's a very nice feature, @thetechnick thanks for the pull request! |
@yyyar Sure, just write what you want changed. I also noticed that there is config validation in https://github.com/yyyar/gobetween/blob/master/src/manager/manager.go, so I will add a validation check for the Should the v2 protocol be also implemented or is this a feature we implement in a second PR? |
I vote for a 0.5.0 "GA" release with proxy v1 support. 👍 😀 |
@thetechnick I think we can go with v1 only in next gobetween release (v0.5.0) and then add v2 later. But for further compatibility, I'd better make configuration like this: [servers.sample]
protocol="tcp"
bind="0.0.0.0:3000"
[servers.sample.proxy_protocol] # <- separate section
version="1" # string, required
[servers.sample.discovery]
# ....
So we could put more options in 'servers.sample.proxyprotocol' object later for version 2 (maybe custom TLVs or some advanced configuration). If this section is not specified at all, we ignore proxy protocol.
Yes it would be good addiction. Thank you! |
e7c4f7b
to
bbce846
Compare
I've actually gone ahead and done some modifications mentioned before, so it's ready for merge. @thetechnick thank you for a great feature! It would be cool to have v2 in future too, but we'll need to think how to merge it with our 'sni' implementation since these two features overlap. |
@yyyar Great, thanks! |
I have thrown together a small patch to include proxy-protocol v1 support for TCP.
This is not meant as a final implementation, but more a working proof of concept.
TODO
Testing
To test it, I have deployed the echoheaders application in my kubernetes cluster and setup gobetween to direct traffic to the same ports haproxy does now.
I than checked if the
x-forwarded-for
header is set to the same client IP as reported for the haproxy setup.Gobetween config (Note the added
proxy_protocol
setting)You can see the output of the haproxy setup here:
http://headers.cluster.thetechnick.ninja/
Why I did not implement v2 yet:
It seems that nginx does not support v2 and HAProxy have no UDP support at all.
The proxy-protocol v1 spec () does not cover UDP:
While the binary v2 protocol header does allow UDP, I do not have a use case for it right now.
The great lib would support the v2 protocol header though.
Edit:
Link to issue: #100