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

proxyproto: PROXY protocol net.Conn and net.Listener impl #919

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mmatczuk
Copy link
Contributor

Use github.com/pires/go-proxyproto header parsing and provide better (safer) net.Conn and net.Listener implementations.

Use github.com/pires/go-proxyproto header parsing and provide better (safer) net.Conn and net.Listener implementations.
The Conn type is designed after tls.Conn.

We never read more than header bytes from connection.
This allows to eliminate any 3rd party readers,
and to use the connection ReadFrom() and WriteTo() functions if provided.
The underlying connection is available via Conn.NetConn().

On context cancellation the connection is closed to terminate the paring go routine,
and to avoid unspecified behaviour caused by double reads from header parsing and user code.
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.

1 participant