Unfortunately, the problem was not revealed, since the EqualsTo function, which is used by the tests to compare actual and expected headers, straightly returns true when the command is LOCAL, and the command is not being compared.
Coverage increased (+0.007%) to 94.223% when pulling 43ce4efcec8621dbb090ce8c68ef042a2c678c5f on bohanyang:fix-v1-command into b6f440c01c68bf65792f463adcc71eb620fb0484 on pires:main.
The changes in #61 overrides all
header.Command
toLOCAL
(which was set toPROXY
byinitVersion1
) unconditionally.https://github.com/pires/go-proxyproto/blob/b6f440c01c68bf65792f463adcc71eb620fb0484/v1.go#L55-L60
This makes these functions returning the original addresses rather than the addresses contained in the proxy header.
https://github.com/pires/go-proxyproto/blob/b6f440c01c68bf65792f463adcc71eb620fb0484/protocol.go#L127-L155
Unfortunately, the problem was not revealed, since the
EqualsTo
function, which is used by the tests to compare actual and expected headers, straightly returns true when the command is LOCAL, and the command is not being compared.https://github.com/pires/go-proxyproto/blob/b6f440c01c68bf65792f463adcc71eb620fb0484/header.go#L150-L170
This PR also updated the condition that checks the token length, made it to make sense.
The comments for ProtocolVersionAndCommand are also updated, made it less confusing.