pires / go-proxyproto

A Go library implementation of the PROXY protocol, versions 1 and 2.
Apache License 2.0
478 stars 107 forks source link

Add support for GCP extensions #81

Closed igor-kupczynski closed 3 years ago

igor-kupczynski commented 3 years ago
The support is modeled on azure.go under tlvparse. The GCP spec is similar but
encodes uint64. There's no subtype. Since zero value of uint64 is technically
a valid header value, I've opted for an extra boolean to indicate if it was
found (same as with Azure).

Given that we already have AWS, and Azure in tlvparse I thought it will be a good idea to add the GCP support as well.

We use it with GCP in our pre-prod env and all seems to be working well.

Let me know if you think it makes sense to have this with the upstream lib.

coveralls commented 3 years ago

Coverage Status

Coverage remained the same at 94.353% when pulling 9f25ec7d5bb2234fad444e83654972652d8e666b on igor-kupczynski:gcp-tlv-parser into 3aa7ea95a821cf534fae576651e2ca11f222a4e3 on pires:main.

igor-kupczynski commented 3 years ago

I've noticed a naming inconsistency and force-pushed a fixed version. Hope that OK -- my thinking was that a simple rename doesn't add a lot to the history.

igor-kupczynski commented 3 years ago

Nice, thanks for merging :) and thanks for maintaining the library.

func names tied to PP2 type, eg PP2GCP.ExtractPSCConnectionID, or maybe have tlvparse/{aws,azure,gcp}

Agree, it would be nice to improve the consistency here. I'll think about it for a bit.

pires commented 3 years ago

Released in https://github.com/pires/go-proxyproto/releases/tag/v0.6.1