HAProxy community

Proxy Protocol V2


I’m writing a parser for v1 and v2 of the proxy protocol and I’m having difficulty understanding how to parse UNIX domain sockets. The protocol documentation just states that there are 216 bytes that represent the src and dest but does not go into any detail about how they are encoded. I’ve done a bit of research but I don’t know if what I think is correct and I still have some gaps that need to be filled in.

From what I’ve read on the subject it looks like there are two different naming schemes. The value should resolve to a real path or an abstract path with the difference being that an abstract value begins with a null byte.

For real paths, I believe that each byte should directly translate to ascii and the string should terminate on the first null byte that you encounter.

For abstract paths I am unsure whether they must take up all 108 bytes or if there is some sort of delimiter or length specified in the protocol that I’m missing.

Can anyone clarify what you should do to handle these cases?


I know you registered here for this specific question, but those code-specific question are better discussed on the mailing list. You can just send this to (no need to register):

haproxy at formilux dot org

You are probably already aware of the proxy protocol documentation in doc/proxy-protocol.txt at: