-
-
Notifications
You must be signed in to change notification settings - Fork 610
--enable-proxy-protocol
: HAProxy Protocol v1
#735
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0cc368d
Introduce `--haproxy-protocol` flag
abhinavsingh ac5f78f
Complete proxy protocol v1 implementation, enable using `--enable-pro…
abhinavsingh 9400189
link checks
abhinavsingh ad54132
Advertise support for haproxy protocol in readme
abhinavsingh 35b643c
Add make target `lib-scm-version`
abhinavsingh 18a52ff
`make lib-version` is now `make lib-check`
abhinavsingh 795e817
Dont enforce -dev part of version within README
abhinavsingh 55d95dd
Add provision to update readme flags using check
abhinavsingh 9c19e6d
Wrap help text within console
abhinavsingh cb69386
Add closing ticks
abhinavsingh 7ec7871
Remove verbose logging and update homebrew formulae (may be fixed?)
abhinavsingh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
proxy.py | ||
~~~~~~~~ | ||
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on | ||
Network monitoring, controls & Application development, testing, debugging. | ||
|
||
:copyright: (c) 2013-present by Abhinav Singh and contributors. | ||
:license: BSD, see LICENSE for more details. | ||
""" | ||
import sys | ||
import subprocess | ||
|
||
from pathlib import Path | ||
from proxy.common.version import __version__ as lib_version | ||
|
||
# This script ensures our versions never run out of sync. | ||
# | ||
# 1. TODO: Version is hardcoded in homebrew stable package | ||
# installer file, but it only needs to match with lib | ||
# versions if current git branch is master | ||
|
||
PY_FILE_PREFIX = b'# -*- coding: utf-8 -*-\n' + \ | ||
b'"""\n' + \ | ||
b' proxy.py\n' + \ | ||
b' ~~~~~~~~\n' + \ | ||
b' \xe2\x9a\xa1\xe2\x9a\xa1\xe2\x9a\xa1 Fast, Lightweight, Pluggable, TLS interception capable' + \ | ||
b' proxy server focused on\n' + \ | ||
b' Network monitoring, controls & Application development, testing, debugging.\n' + \ | ||
b'\n' + \ | ||
b' :copyright: (c) 2013-present by Abhinav Singh and contributors.\n' + \ | ||
b' :license: BSD, see LICENSE for more details.\n' | ||
|
||
REPO_ROOT = Path(__file__).parent | ||
ALL_PY_FILES = ( | ||
list(REPO_ROOT.glob('*.py')) + | ||
list((REPO_ROOT / 'proxy').rglob('*.py')) + | ||
list((REPO_ROOT / 'examples').rglob('*.py')) + | ||
list((REPO_ROOT / 'tests').rglob('*.py')) | ||
) | ||
|
||
# Ensure all python files start with licensing information | ||
for py_file in ALL_PY_FILES: | ||
if py_file.is_file() and py_file.name != '_scm_version.py': | ||
with open(py_file, 'rb') as f: | ||
code = f.read(len(PY_FILE_PREFIX)) | ||
if code != PY_FILE_PREFIX: | ||
print( | ||
'Expected license not found in {0}'.format( | ||
str(py_file), | ||
), | ||
) | ||
sys.exit(1) | ||
|
||
# Update README.md flags section to match current library --help output | ||
# lib_help = subprocess.check_output( | ||
# ['python', '-m', 'proxy', '-h'] | ||
# ) | ||
# with open('README.md', 'rb+') as f: | ||
# c = f.read() | ||
# pre_flags, post_flags = c.split(b'# Flags') | ||
# help_text, post_changelog = post_flags.split(b'# Changelog') | ||
# f.seek(0) | ||
# f.write(pre_flags + b'# Flags\n\n```console\n\xe2\x9d\xaf proxy -h\n' + lib_help + b'```' + | ||
# b'\n# Changelog' + post_changelog) | ||
|
||
# Version is also hardcoded in README.md flags section | ||
readme_version_cmd = 'cat README.md | grep "proxy.py v" | tail -2 | head -1 | cut -d " " -f 2 | cut -c2-' | ||
readme_version_output = subprocess.check_output( | ||
['bash', '-c', readme_version_cmd], | ||
) | ||
# Doesn't contain "v" prefix | ||
readme_version = readme_version_output.decode().strip() | ||
|
||
if readme_version != lib_version[1:].split('-')[0]: | ||
print( | ||
'Version mismatch found. {0} (readme) vs {1} (lib).'.format( | ||
readme_version, lib_version, | ||
), | ||
) | ||
sys.exit(1) |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
proxy.py | ||
~~~~~~~~ | ||
|
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
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.
This misses out on the
tuple_version
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.
Can you expand, per
_scm_version.pyi
So I simply dumped this version string in there. It seems to work. Are we missing something here?