-
Notifications
You must be signed in to change notification settings - Fork 13
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
Support for PROXY protocol v1 and v2 #920
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It is ingested because go mod failed $ go mod tidy go: finding module for package github.com/mailgun/influx/proxyproto go: github.com/saucelabs/forwarder/proxyproto imports github.com/mailgun/proxyproto tested by github.com/mailgun/proxyproto.test imports github.com/mailgun/influx/proxyproto: cannot find module providing package github.com/mailgun/influx/proxyproto: module github.com/mailgun/influx/proxyproto: git ls-remote -q origin in /Users/michal/go/pkg/mod/cache/vcs/305ad51dbd40a25626bb1b1b54a6123e638813e336c601d6c4da5bb43e5b0e43: exit status 128: fatal: could not read Username for 'https://github.com': terminal prompts disabled Confirm the import path was entered correctly. If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.
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.
--proxy-protocol-enabled <value> (default false) (env FORWARDER_PROXY_PROTOCOL_ENABLED) The PROXY protocol is used to correctly read the client's IP address. When enabled the proxy will expect the client to send the PROXY protocol header before the actual request. It is still possible to connect to the proxy without the PROXY protocol header when this flag is enabled. --proxy-protocol-read-header-timeout <duration> (default 10s) (env FORWARDER_PROXY_PROTOCOL_READ_HEADER_TIMEOUT) The amount of time to wait for PROXY protocol header. Zero means no limit.
Enable proxy protocol by default in tests. Add tests to check if XFF header is properly updated.
Choraden
reviewed
Sep 24, 2024
Comment on lines
+179
to
+182
ll = &proxyproto.Listener{ | ||
Listener: ll, | ||
ReadHeaderTimeout: l.ProxyProtocolConfig.ReadHeaderTimeout, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use constructor? It's from different package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the other hand, this is handy
LGTM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.