proxy.py/Makefile

82 lines
2.3 KiB
Makefile
Raw Normal View History

2018-12-22 15:08:04 +00:00
SHELL := /bin/bash
NS ?= abhinavsingh
IMAGE_NAME ?= proxy.py
VERSION ?= v$(shell python proxy.py --version)
LATEST_TAG := $(NS)/$(IMAGE_NAME):latest
2018-12-22 15:08:04 +00:00
IMAGE_TAG := $(NS)/$(IMAGE_NAME):$(VERSION)
HTTPS_KEY_FILE_PATH := https-key.pem
HTTPS_CERT_FILE_PATH := https-cert.pem
CA_KEY_FILE_PATH := ca-key.pem
CA_CERT_FILE_PATH := ca-cert.pem
CA_SIGNING_KEY_FILE_PATH := ca-signing-key.pem
.PHONY: all clean test package test-release release coverage lint autopep8
.PHONY: container run-container release-container https-certificates ca-certificates
Chrome Devtool Integration first steps (#109) * Initialize skeleton electron app * Attempt to open devtools * Electron free * Initialize public/devtools * Add basic support for static file serving and chrome devtools. 1. No cache header management for static file serving yet. 2. No chunked encoded responses for static files yet. 3. Chrome Devtool initialization. * Fix static serving with query params * profile using py-spy * Complete websocket client loop * lint check * Add support for building websocket frames * Remove redundant CDT params * Lint check * Refactor web server base plugin name * Devtools integrated, need more polish * Add START_TIME global var * lint fix * Remove outdated chrome rdp * Add FAQs * Add FAQs * socket_connection decorator + context manager * Defer SSL handshake and plugin initialize until protocol handler thread has started. This is a follow up to this PR https://github.com/abhinavsingh/proxy.py/pull/111 * Add tests for new_socket_connection and its friend socket_connection * Address an issue which came back after being fixed in https://github.com/abhinavsingh/proxy.py/pull/92 * Lint fixes * uff ye str and bytes * Remove explicit flushes outside of write ready descriptor handlers * add links to import proxy * Only try websocket upgrade if a route is registered * Add plugin_examples.WebServerPlugin and use precision logging for levelname * Remove redundant comments * Add --devtools-ws-path flag * Add on_websocket_open and on_websocket_close callbacks * Add empty stubs for incomplete CDT responses * Ensure client is ready before final flush * Shutdown on write side of socket, may be client is still reading * Since client.closed can be set, explicitly call client.connection.closed * Add ModifyPostDataPlugin example. Was first asked and referenced here https://github.com/abhinavsingh/proxy.py/issues/115 * Start adding TestHttpProxyPlugin * Fixes #116
2019-10-10 05:36:47 +00:00
.PHONY: profile
2013-12-23 21:51:45 +00:00
all: clean test
clean:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
rm -f .coverage
rm -rf htmlcov dist build .pytest_cache proxy.py.egg-info
2013-12-23 21:51:45 +00:00
test:
python -m unittest tests
2013-12-23 21:51:45 +00:00
2019-02-09 02:57:44 +00:00
package: clean
python setup.py sdist bdist_wheel
2013-12-23 21:51:45 +00:00
2019-02-09 02:57:44 +00:00
test-release: package
2019-09-27 20:42:53 +00:00
twine upload --verbose --repository-url https://test.pypi.org/legacy/ dist/*
2018-12-22 15:08:04 +00:00
2019-02-09 02:57:44 +00:00
release: package
twine upload dist/*
coverage:
Use selectors.DefaultSelector instead of select.select (#106) * Use selectors.DefaultSelector instead of select.select * Unregister to avoid endless loop * Cleanup event register/unregiter * Cleanup event registration * Add google-fluentd.conf. Use if running proxy.py on Google Cloud. * Send server error from proxy if for whatever reason we fail to process the request (or should it be BadRequest based upon situation?) * Fix tests for selectors * Only include proxy.py and tests.py in coverage report * Only include proxy.py for coverage * remove redundant integration test, will rewrite using mocks * Proper unregister of events * Change multi core accept model to avoid client TIME_WAIT. Fixes #97 * Catch BlockingIOError * Remove redundant comments * Simplify with AcceptorPool * Pass family to acceptor processes * Remove plugin.access_log for core plugins * Return 501 not implemented for web socket upgrade requests to inbuilt HTTP server * Add support for websocket upgrade * Websocket frame parser * Enable websocket based routing * Add WebsocketClient * Websocket * mypy fixes * Sync GitHub workflow lint and makefile lint commands. For now comment out tests which are broken :( New tests coming next. * Start fixing tests for new code * Fix formatting * Fix main tests * Add worker tests * GitHub only ran windows tests, may be require unique names * Use 3.6/3.7 dev versions for GitHub actions * Add AcceptorPool test * Add x64 and x86 matrix for actions tests * Dont use dev versions since they dont exists for x86 * Ha no x86 support itself * Add backer link * Remove support badge for 3.5 as it doesnt support typing * Update read me with changed architecture notes * Update read me with changed architecture notes * Add `import proxy` usage instructions. * Add pydoc reference for developers * Put pydoc as internal documentation
2019-10-02 07:09:35 +00:00
coverage3 run --source=proxy tests.py
coverage3 html
open htmlcov/index.html
lint:
flake8 --ignore=W504 --max-line-length=127 proxy.py plugin_examples.py tests.py setup.py
mypy --strict --ignore-missing-imports proxy.py plugin_examples.py tests.py setup.py
autopep8:
autopep8 --recursive --in-place --aggressive proxy.py
autopep8 --recursive --in-place --aggressive tests.py
autopep8 --recursive --in-place --aggressive plugin_examples.py
2019-02-09 02:57:44 +00:00
container:
docker build -t $(LATEST_TAG) -t $(IMAGE_TAG) .
run-container:
docker run -it -p 8899:8899 --rm $(LATEST_TAG)
release-container:
docker push $(IMAGE_TAG)
docker push $(LATEST_TAG)
https-certificates:
# Generate server key
openssl genrsa -out $(HTTPS_KEY_FILE_PATH) 2048
# Generate server certificate
openssl req -new -x509 -days 3650 -key $(HTTPS_KEY_FILE_PATH) -out $(HTTPS_CERT_FILE_PATH)
ca-certificates:
# Generate CA key
openssl genrsa -out $(CA_KEY_FILE_PATH) 2048
# Generate CA certificate
openssl req -new -x509 -days 3650 -key $(CA_KEY_FILE_PATH) -out $(CA_CERT_FILE_PATH)
# Generate key that will be used to generate domain certificates on the fly
# Generated certificates are then signed with CA certificate / key generated above
openssl genrsa -out $(CA_SIGNING_KEY_FILE_PATH) 2048
Chrome Devtool Integration first steps (#109) * Initialize skeleton electron app * Attempt to open devtools * Electron free * Initialize public/devtools * Add basic support for static file serving and chrome devtools. 1. No cache header management for static file serving yet. 2. No chunked encoded responses for static files yet. 3. Chrome Devtool initialization. * Fix static serving with query params * profile using py-spy * Complete websocket client loop * lint check * Add support for building websocket frames * Remove redundant CDT params * Lint check * Refactor web server base plugin name * Devtools integrated, need more polish * Add START_TIME global var * lint fix * Remove outdated chrome rdp * Add FAQs * Add FAQs * socket_connection decorator + context manager * Defer SSL handshake and plugin initialize until protocol handler thread has started. This is a follow up to this PR https://github.com/abhinavsingh/proxy.py/pull/111 * Add tests for new_socket_connection and its friend socket_connection * Address an issue which came back after being fixed in https://github.com/abhinavsingh/proxy.py/pull/92 * Lint fixes * uff ye str and bytes * Remove explicit flushes outside of write ready descriptor handlers * add links to import proxy * Only try websocket upgrade if a route is registered * Add plugin_examples.WebServerPlugin and use precision logging for levelname * Remove redundant comments * Add --devtools-ws-path flag * Add on_websocket_open and on_websocket_close callbacks * Add empty stubs for incomplete CDT responses * Ensure client is ready before final flush * Shutdown on write side of socket, may be client is still reading * Since client.closed can be set, explicitly call client.connection.closed * Add ModifyPostDataPlugin example. Was first asked and referenced here https://github.com/abhinavsingh/proxy.py/issues/115 * Start adding TestHttpProxyPlugin * Fixes #116
2019-10-10 05:36:47 +00:00
profile:
sudo py-spy -F -f profile.svg -d 3600 proxy.py