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

feat: TLV support #9

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

feat: TLV support #9

wants to merge 4 commits into from

Conversation

g2p
Copy link

@g2p g2p commented Sep 27, 2021

I added support for TLV extensions, as documented in proxy-protocol.txt

Comes with tests.
This will be a version bump, because the Version2 struct now has extra fields.

(FWIW, I think switching the parse side from an "impl Buf" to either Bytes or &[u8] slices (since we probably don't need to support discontinuous data) would make the implementation better by allowing to pass subslices instead of having to add len arguments. But I didn't add that API change.)

Closes #5.

g2p added 4 commits September 27, 2021 16:37
The document is served without an encoding header.
This factors in common parts of address parsing.

There is a tweak to which errors are returned when
the buffer is both too small for its declared length
and for the minimum length of address data:
in this case, we now return an UnexpectedEof indicating
the first error, previously the second error was signaled.

Tests were updated with larger vectors so they could still
exercise InsufficientLengthSpecified error cases.
The ones supported are the ones documented in proxy-protocol.txt
as of 2020/03/05.
@g2p g2p changed the title TLV support feat: TLV support Sep 27, 2021
Copy link
Owner

@Proximyst Proximyst left a comment

Choose a reason for hiding this comment

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

This looks very good! Though it is very late, so I'll have to bookmark to re-read tomorrow.

@saiintbrisson
Copy link

Hi! I'm wondering whether there have been any updates here yet? I'm using proxy-protocol and TLV support would be really welcome at the moment.

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.

[PP2] Handle the Type-Length-Values
3 participants