Skip to content

Add support for HA Proxy Protocol TLV's#5972

Merged
vietj merged 1 commit intoeclipse-vertx:masterfrom
damianorenfer:master
Mar 18, 2026
Merged

Add support for HA Proxy Protocol TLV's#5972
vietj merged 1 commit intoeclipse-vertx:masterfrom
damianorenfer:master

Conversation

@damianorenfer
Copy link
Contributor

Motivation:

TLV's are supported in netty, but currently not accessible to vert.x users.
Here the TLV's are exposed in NetSocket#tlvs

This also answers to #5452

Conformance:
ECA signed

@vietj
Copy link
Member

vietj commented Feb 15, 2026

I'd rather expose that has a Map<Buffer, Buffer> instead (that map can be ordered if needed)

@damianorenfer
Copy link
Contributor Author

Sure, I just updated the code accordingly

* the value contains the TLV value, mainly used for HA Proxy Protocol v2
*/
@GenIgnore()
Map<Buffer, Buffer> tlvs();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need that ? Quic does not yet support proxying at the moment and we are not sure it makes sense

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that seems at the moment to be a TCP concern only

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you see a better place to put this one ? The goal is to access TLV's in NetServer#connectHandler

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, it is fine here, I meant actually on QuicConnection it should apply to.

* the value contains the TLV value, mainly used for HA Proxy Protocol v2
*/
@GenIgnore()
Map<Buffer, Buffer> tlvs();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should return null when it does not apply, e.g. HTTP/3

@tmonney
Copy link

tmonney commented Feb 16, 2026

The protocol technically allows for multiple occurrences of TLVs with the same type. It's probably not that common, but I am wondering if it makes sense to add unnecessary constraints. The underlying Netty decoder also uses a List, presumably for that reason.

@damianorenfer
Copy link
Contributor Author

The protocol technically allows for multiple occurrences of TLVs with the same type. It's probably not that common, but I am wondering if it makes sense to add unnecessary constraints. The underlying Netty decoder also uses a List, presumably for that reason.

@vietj I was also not able to find anything about TLV uniqueness based on type here.
What do you think ?

@vietj
Copy link
Member

vietj commented Feb 19, 2026

The protocol technically allows for multiple occurrences of TLVs with the same type. It's probably not that common, but I am wondering if it makes sense to add unnecessary constraints. The underlying Netty decoder also uses a List, presumably for that reason.

@vietj I was also not able to find anything about TLV uniqueness based on type here. What do you think ?

I think we can use an Iterable<Map.Entry<Buffer, Buffer>> instead

@damianorenfer damianorenfer force-pushed the master branch 4 times, most recently from c9094eb to c36e061 Compare February 20, 2026 09:09
@damianorenfer
Copy link
Contributor Author

The protocol technically allows for multiple occurrences of TLVs with the same type. It's probably not that common, but I am wondering if it makes sense to add unnecessary constraints. The underlying Netty decoder also uses a List, presumably for that reason.

@vietj I was also not able to find anything about TLV uniqueness based on type here. What do you think ?

I think we can use an Iterable<Map.Entry<Buffer, Buffer>> instead

Sure, done!

@vietj vietj added this to the 5.1.0 milestone Mar 2, 2026
@damianorenfer damianorenfer force-pushed the master branch 2 times, most recently from 3ff869f to a77685a Compare March 2, 2026 15:24
* This is mainly used for HA Proxy Protocol v2
*/
@GenIgnore()
default Iterable<Map.Entry<Buffer, Buffer>> tlvs() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the name should be more clear about what is provided, those are coming from HA proxy protocol, e.g. proxyProtocolV2HeaderTLVs seems more descriptive.

Copy link
Contributor Author

@damianorenfer damianorenfer Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, should we rename it everywhere ? also in NetSocket etc ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it should be consistently renamed I think

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@damianorenfer damianorenfer force-pushed the master branch 2 times, most recently from c292362 to c2c136e Compare March 15, 2026 15:59
@damianorenfer damianorenfer requested a review from vietj March 15, 2026 15:59
* This is mainly used for HA Proxy Protocol v2
*/
@GenIgnore()
default Iterable<Map.Entry<Buffer, Buffer>> proxyProtocolV2HeaderTLVs() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually we could use List here as a better type since everything is buffered, no need to use a weaker collection type ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There you go

TLV's are supported in netty, but currently not accessible to vert.x
users.
Here the TLV's are exposed in `NetSocket#proxyProtocolV2HeaderTLVs`
@damianorenfer damianorenfer requested a review from vietj March 16, 2026 09:44
@vietj vietj merged commit 291fadc into eclipse-vertx:master Mar 18, 2026
1 check passed
@vietj
Copy link
Member

vietj commented Mar 18, 2026

thanks @damianorenfer

@drenferwl
Copy link

drenferwl commented Mar 18, 2026

@vietj Do you think we can backport this to 4.x ?
Would be really appreciated to have it in Quarkus 3

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

Successfully merging this pull request may close these issues.

4 participants