Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
bb60c65
Merge pull request #896 from abhinavsingh/missed-scenarios
abhinavsingh Dec 21, 2021
da1795d
[ProxyPool] Add support for basic authorization with upstream proxies…
abhinavsingh Dec 21, 2021
37c779a
Add `conn_close` kwarg to packet builder utilities (#898)
abhinavsingh Dec 21, 2021
32fb729
Raise `HttpProtocolException` instead of `ValueError` (#899)
abhinavsingh Dec 21, 2021
2d83857
Ensure message for every `HttpProtocolException` raised (#900)
abhinavsingh Dec 22, 2021
c936f7e
Response Packet Utilities (#903)
abhinavsingh Dec 24, 2021
13c64b5
Introduce `ProgramNamePlugin` plugin (#904)
abhinavsingh Dec 25, 2021
904617e
Update defaults for `--hostname` and `--local-executor` (#905)
abhinavsingh Dec 25, 2021
f921f56
`Work` can also be `TcpServerConnection`, not just `TcpClientConnecti…
abhinavsingh Dec 26, 2021
99856a6
Change `--local-executor` flag semantics (#907)
abhinavsingh Dec 27, 2021
d4449b8
Clean shutdown on `SIGINT`, `SIGHUP`, `SIGTERM`, `SIGQUIT` (#908)
abhinavsingh Dec 27, 2021
8e3d724
Fix `HttpWebServerPacFilePlugin` broken routes logic (#915)
abhinavsingh Dec 28, 2021
ea66280
Proxy Auto-Configuration (PAC) file should not be compressed (#916)
abhinavsingh Dec 28, 2021
f6214a4
Move `UpstreamConnectionPool` lifecycle within `Threadless` (#917)
abhinavsingh Dec 28, 2021
263c067
Define work lifecycle events for pool (#918)
abhinavsingh Dec 28, 2021
46c942f
Hook `UpstreamConnectionPool` lifecycle within `Threadless` (#921)
abhinavsingh Dec 29, 2021
48bdcc2
pip prod(deps): bump sphinx from 4.3.1 to 4.3.2 (#902)
dependabot[bot] Dec 29, 2021
498a1bb
pip prod(deps): bump paramiko from 2.8.1 to 2.9.1 (#923)
dependabot[bot] Dec 29, 2021
d22d551
Optimize how `HttpProtocolHandler` delegates to the core plugins (#925)
abhinavsingh Dec 31, 2021
db0c923
[TlsParser] Refactored implementation from #748 (#922)
abhinavsingh Dec 31, 2021
3921b90
pip prod(deps): bump tox from 3.24.4 to 3.24.5 (#924)
dependabot[bot] Dec 31, 2021
4b915c9
pip prod(deps): bump twine from 3.7.0 to 3.7.1 (#927)
dependabot[bot] Dec 31, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ extend-ignore =
WPS420 # FIXME: pointless keyword like `pass`
WPS421 # FIXME: call to `print()`
WPS425 # FIXME: bool non-keyword arg
WPS427 # FIXME: unreachable code
WPS428 # FIXME: pointless statement
WPS430 # FIXME: nested func
WPS431 # FIXME: nested class
Expand Down
113 changes: 82 additions & 31 deletions .github/workflows/test-library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,10 @@ jobs:
path: ${{ steps.pip-cache.outputs.dir }}
key: >-
${{ runner.os }}-pip-${{
steps.calc-cache-key-py.outputs.py-hash-key }}-${{
hashFiles('tox.ini') }}
steps.calc-cache-key-py.outputs.py-hash-key
}}-${{
hashFiles('tox.ini')
}}
restore-keys: |
${{ runner.os }}-pip-${{
steps.calc-cache-key-py.outputs.py-hash-key
Expand Down Expand Up @@ -370,8 +372,10 @@ jobs:
path: ${{ steps.pip-cache.outputs.dir }}
key: >-
${{ runner.os }}-pip-${{
steps.calc-cache-key-py.outputs.py-hash-key }}-${{
hashFiles('tox.ini') }}
steps.calc-cache-key-py.outputs.py-hash-key
}}-${{
hashFiles('tox.ini')
}}
restore-keys: |
${{ runner.os }}-pip-${{
steps.calc-cache-key-py.outputs.py-hash-key
Expand Down Expand Up @@ -485,12 +489,13 @@ jobs:
path: ${{ steps.pip-cache.outputs.dir }}
key: >-
${{ runner.os }}-pip-${{
steps.calc-cache-key-py.outputs.py-hash-key }}-${{
hashFiles('tox.ini', 'requirements.txt', 'requirements-testing.txt')
steps.calc-cache-key-py.outputs.py-hash-key
}}-${{
hashFiles('tox.ini', 'requirements**.txt')
}}
restore-keys: |
${{ runner.os }}-pip-${{
steps.calc-cache-key-py.outputs.py-hash-key
steps.calc-cache-key-py.outputs.py-hash-key
}}-
${{ runner.os }}-pip-
- name: Install tox
Expand Down Expand Up @@ -667,19 +672,41 @@ jobs:
make ca-certificates
python3 -m proxy --version

check: # This job does nothing and is only used for the branch protection
if: always()

needs:
- analyze
- test
- lint
- dashboard
- brew
- developer

runs-on: Ubuntu-latest

steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}

docker:
runs-on: Ubuntu-latest
permissions:
packages: write
if: success()
needs:
- build
- check
- pre-setup # transitive, for accessing settings
name: 🐳 containerize
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.release-commitish }}
- name: Download all the dists
uses: actions/download-artifact@v2
with:
Expand Down Expand Up @@ -727,7 +754,8 @@ jobs:
$CONTAINER_TAG
--hostname 0.0.0.0
--enable-web-server
--local-executor && ./tests/integration/test_integration.sh 8899
&&
./tests/integration/test_integration.sh 8899
- name: Push to GHCR
run: >-
REGISTRY_URL="ghcr.io/abhinavsingh/proxy.py";
Expand All @@ -739,15 +767,19 @@ jobs:
--platform ${{
needs.pre-setup.outputs.container-platforms
}}
--build-arg SKIP_OPENSSL=1
--build-arg PROXYPY_PKG_PATH='dist/${{
needs.pre-setup.outputs.wheel-artifact-name
}}'
-t $CONTAINER_TAG .
- name: Tag latest on GHCR
if: >-
github.event_name == 'push' &&
github.ref == format(
'refs/heads/{0}', github.event.repository.default_branch
(
github.ref == format(
'refs/heads/{0}', github.event.repository.default_branch
) ||
github.ref == 'refs/heads/master'
)
run: >-
REGISTRY_URL="ghcr.io/abhinavsingh/proxy.py";
Expand All @@ -757,6 +789,43 @@ jobs:
--platform ${{
needs.pre-setup.outputs.container-platforms
}}
--build-arg SKIP_OPENSSL=1
--build-arg PROXYPY_PKG_PATH='dist/${{
needs.pre-setup.outputs.wheel-artifact-name
}}'
-t $LATEST_TAG .
- name: Push openssl to GHCR
run: >-
REGISTRY_URL="ghcr.io/abhinavsingh/proxy.py";
CONTAINER_TAG=$REGISTRY_URL:${{
needs.pre-setup.outputs.container-version
}}-openssl;
docker buildx build
--push
--platform ${{
needs.pre-setup.outputs.container-platforms
}}
--build-arg PROXYPY_PKG_PATH='dist/${{
needs.pre-setup.outputs.wheel-artifact-name
}}'
-t $CONTAINER_TAG .
- name: Tag openssl on GHCR
if: >-
github.event_name == 'push' &&
(
github.ref == format(
'refs/heads/{0}', github.event.repository.default_branch
) ||
github.ref == 'refs/heads/master'
)
run: >-
REGISTRY_URL="ghcr.io/abhinavsingh/proxy.py";
LATEST_TAG=$REGISTRY_URL:openssl;
docker buildx build
--push
--platform ${{
needs.pre-setup.outputs.container-platforms
}}
--build-arg PROXYPY_PKG_PATH='dist/${{
needs.pre-setup.outputs.wheel-artifact-name
}}'
Expand All @@ -766,6 +835,7 @@ jobs:
with:
username: abhinavsingh
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
# TODO: openssl image is not published on DockerHub
- name: Push to DockerHub
run: >-
REGISTRY_URL="abhinavsingh/proxy.py";
Expand All @@ -777,31 +847,12 @@ jobs:
--platform ${{
needs.pre-setup.outputs.container-platforms
}}
--build-arg SKIP_OPENSSL=1
--build-arg PROXYPY_PKG_PATH='dist/${{
needs.pre-setup.outputs.wheel-artifact-name
}}'
-t $CONTAINER_TAG .

check: # This job does nothing and is only used for the branch protection
if: always()

needs:
- analyze
- test
- lint
- docker
- dashboard
- brew
- developer

runs-on: Ubuntu-latest

steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}

publish-pypi:
name: Publish 🐍📦 ${{ needs.pre-setup.outputs.git-tag }} to PyPI
needs:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ proxy.py.iml
*.crt
*.key
*.pem

.venv*
venv*

cover
Expand Down
1 change: 0 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ disable=raw-checker-failed,
too-many-return-statements,
too-many-statements,
unnecessary-pass,
unreachable,
unused-argument,
useless-return,
useless-super-delegation,
Expand Down
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.10-alpine as base

LABEL com.abhinavsingh.name="abhinavsingh/proxy.py" \
com.abhinavsingh.description="⚡ Fast • 🪶 Lightweight • 0️⃣ Dependency • 🔌 Pluggable • \
😈 TLS interception • 🔒 DNS-over-HTTPS • 🔥 Poor Man's VPN • ⏪ Reverse & ⏩ Forward • \
Expand All @@ -8,25 +9,27 @@ LABEL com.abhinavsingh.name="abhinavsingh/proxy.py" \
com.abhinavsingh.vcs-url="https://github.com/abhinavsingh/proxy.py" \
com.abhinavsingh.docker.cmd="docker run -it --rm -p 8899:8899 abhinavsingh/proxy.py" \
org.opencontainers.image.source="https://github.com/abhinavsingh/proxy.py"

ENV PYTHONUNBUFFERED 1

ARG SKIP_OPENSSL
ARG PROXYPY_PKG_PATH

COPY README.md /
COPY $PROXYPY_PKG_PATH /

RUN pip install --upgrade pip && \
pip install \
--no-index \
--find-links file:/// \
proxy.py && \
rm *.whl

# Install openssl to enable TLS interception & HTTPS proxy options within container
# NOTE: You can comment out this line if you don't intend to use those features.
RUN apk update && apk add openssl
# Use `--build-arg SKIP_OPENSSL=1` to disable openssl installation
RUN if [[ -z "$SKIP_OPENSSL" ]]; then apk update && apk add openssl; fi

EXPOSE 8899/tcp
ENTRYPOINT [ "proxy" ]
CMD [ \
"--hostname=0.0.0.0" \
"--local-executor" \
]
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ endif
.PHONY: lib-release-test lib-release lib-profile lib-doc
.PHONY: lib-dep lib-flake8 lib-mypy lib-speedscope container-buildx-all-platforms
.PHONY: container container-run container-release container-build container-buildx
.PHONY: devtools dashboard dashboard-clean
.PHONY: devtools dashboard dashboard-clean container-without-openssl

all: lib-test

Expand Down Expand Up @@ -143,7 +143,6 @@ lib-profile:
--num-workers 1 \
--enable-web-server \
--plugin proxy.plugin.WebServerPlugin \
--local-executor \
--backlog 65536 \
--open-file-limit 65536 \
--log-file /dev/null
Expand All @@ -160,7 +159,6 @@ lib-speedscope:
--num-workers 1 \
--enable-web-server \
--plugin proxy.plugin.WebServerPlugin \
--local-executor \
--backlog 65536 \
--open-file-limit 65536 \
--log-file /dev/null
Expand All @@ -175,12 +173,15 @@ dashboard-clean:
if [[ -d dashboard/public ]]; then rm -rf dashboard/public; fi

container: lib-package
$(MAKE) container-build -e PROXYPY_PKG_PATH=$$(ls dist/*.whl)
docker build \
-t $(PROXYPY_CONTAINER_TAG) \
--build-arg PROXYPY_PKG_PATH=$$(ls dist/*.whl) .

container-build:
container-without-openssl: lib-package
docker build \
-t $(PROXYPY_CONTAINER_TAG) \
--build-arg PROXYPY_PKG_PATH=$(PROXYPY_PKG_PATH) .
--build-arg SKIP_OPENSSL=1 \
--build-arg PROXYPY_PKG_PATH=$$(ls dist/*.whl) .

# Usage:
#
Expand Down
Loading