Skip to content

Commit 3a36a3f

Browse files
authored
Rewrite it in Rust
1 parent 583423a commit 3a36a3f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+4642
-3167
lines changed

.dockerignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

.github/renovate.json

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,7 @@
1515
"matchUpdateTypes": ["lockFileMaintenance", "patch", "replacement"],
1616
"automerge": true
1717
},
18-
{
19-
"matchDepTypes": ["dependency-groups"],
20-
"matchManagers": ["pep621"],
21-
"automerge": true
22-
},
23-
{ "matchManagers": ["github-actions", "pre-commit"], "automerge": true },
24-
{
25-
"matchCategories": ["docker"],
26-
"matchDepNames": ["docker.io/python"],
27-
"matchUpdateTypes": ["minor"],
28-
"automerge": false
29-
}
18+
{ "matchManagers": ["github-actions", "pre-commit"], "automerge": true }
3019
],
3120
"prConcurrentLimit": 0,
3221
"prHourlyLimit": 0,

.github/workflows/ci.yml

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,61 @@ jobs:
1313
strategy:
1414
matrix:
1515
include:
16+
- runner: macos-15
17+
target: aarch64-apple-darwin
18+
name: arm64-macos
19+
cross: false
1620
- runner: ubuntu-24.04-arm
17-
- runner: ubuntu-22.04-arm
21+
target: aarch64-unknown-linux-gnu
22+
name: arm64-linux
23+
cross: false
24+
- runner: windows-2025
25+
target: i686-pc-windows-msvc
26+
name: 32bit-windows
27+
cross: false
28+
executable: proxy-scraper-checker.exe
1829
- runner: ubuntu-24.04
19-
- runner: ubuntu-22.04
30+
target: i686-unknown-linux-gnu
31+
name: 32bit-linux
32+
cross: true
2033
- runner: macos-15
21-
- runner: macos-14
22-
- runner: macos-13
34+
target: x86_64-apple-darwin
35+
name: 64bit-macos
36+
cross: false
2337
- runner: windows-2025
24-
- runner: windows-2022
25-
- runner: windows-2019
26-
python-version: "3.12"
38+
target: x86_64-pc-windows-msvc
39+
name: 64bit-windows
40+
cross: false
41+
executable: proxy-scraper-checker.exe
42+
- runner: ubuntu-24.04
43+
target: x86_64-unknown-linux-gnu
44+
cross: false
45+
name: 64bit-linux
2746
fail-fast: false
2847
runs-on: ${{ matrix.runner }}
29-
permissions:
30-
id-token: write
31-
attestations: write
3248
steps:
3349
- uses: actions/checkout@v4
3450
with:
3551
persist-credentials: false
36-
- uses: astral-sh/setup-uv@v5
37-
with:
38-
enable-cache: true
39-
- run: uv run --no-dev --group nuitka --frozen --python ${{ matrix.python-version || '3.13' }} python -m nuitka --mode=standalone --python-flag='-m' --assume-yes-for-downloads --deployment --lto=yes proxy_scraper_checker
40-
- run: mv config.toml proxy_scraper_checker.dist/
52+
- run: rustup toolchain install beta --profile minimal --target '${{ matrix.target }}' --allow-downgrade
53+
- run: rustup default beta
54+
- if: ${{ matrix.cross }}
55+
run: cargo +beta install cross --git https://github.com/cross-rs/cross
56+
- if: ${{ matrix.cross }}
57+
run: cross +beta build --release --target '${{ matrix.target }}' --locked
58+
- if: ${{ !matrix.cross }}
59+
run: cargo +beta build --release --target '${{ matrix.target }}' --locked
60+
- run: mkdir dist
61+
- run: mv config.toml dist/
62+
- run: mv target/${{ matrix.target}}/release/${{ matrix.executable || 'proxy-scraper-checker' }} dist/
4163
- if: ${{ github.event_name != 'pull_request' }}
4264
uses: actions/attest-build-provenance@v2
4365
with:
44-
subject-path: proxy_scraper_checker.dist
66+
subject-path: dist
4567
- uses: actions/upload-artifact@v4
4668
with:
47-
name: artifact-${{ matrix.runner }}
48-
path: proxy_scraper_checker.dist/
69+
name: artifact-${{ matrix.name }}
70+
path: dist/
4971
if-no-files-found: error
5072
check:
5173
if: ${{ always() && github.event_name == 'pull_request' }}
@@ -57,6 +79,14 @@ jobs:
5779
- uses: re-actors/alls-green@release/v1
5880
with:
5981
jobs: ${{ toJSON(needs) }}
82+
clippy:
83+
runs-on: ubuntu-24.04
84+
steps:
85+
- uses: actions/checkout@v4
86+
with:
87+
persist-credentials: false
88+
- run: rustup toolchain install beta --profile minimal --component clippy --allow-downgrade
89+
- run: cargo +beta clippy --all-targets --all-features -- -Dwarnings -Wclippy::pedantic
6090
pre-commit:
6191
runs-on: ubuntu-24.04
6292
steps:
@@ -69,3 +99,11 @@ jobs:
6999
- run: uv tool run --from pre-commit@latest --with pre-commit-uv --no-cache --python 3.13 pre-commit run --all-files --show-diff-on-failure
70100
env:
71101
RUFF_OUTPUT_FORMAT: github
102+
rustfmt:
103+
runs-on: ubuntu-24.04
104+
steps:
105+
- uses: actions/checkout@v4
106+
with:
107+
persist-credentials: false
108+
- run: rustup toolchain install nightly --profile minimal --component rustfmt --allow-downgrade
109+
- run: cargo +nightly fmt --check

.gitignore

Lines changed: 18 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Created by https://www.toptal.com/developers/gitignore/api/jetbrains+all,linux,macos,python,vim,visualstudiocode,windows
2-
# Edit at https://www.toptal.com/developers/gitignore?templates=jetbrains+all,linux,macos,python,vim,visualstudiocode,windows
1+
# Created by https://www.toptal.com/developers/gitignore/api/jetbrains+all,linux,macos,rust,vim,visualstudiocode,windows
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=jetbrains+all,linux,macos,rust,vim,visualstudiocode,windows
33

44
### JetBrains+all ###
55
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
@@ -137,177 +137,21 @@ Temporary Items
137137
# iCloud generated files
138138
*.icloud
139139

140-
### Python ###
141-
# Byte-compiled / optimized / DLL files
142-
__pycache__/
143-
*.py[cod]
144-
*$py.class
145-
146-
# C extensions
147-
*.so
148-
149-
# Distribution / packaging
150-
.Python
151-
build/
152-
develop-eggs/
153-
dist/
154-
downloads/
155-
eggs/
156-
.eggs/
157-
lib/
158-
lib64/
159-
parts/
160-
sdist/
161-
var/
162-
wheels/
163-
share/python-wheels/
164-
*.egg-info/
165-
.installed.cfg
166-
*.egg
167-
MANIFEST
168-
169-
# PyInstaller
170-
# Usually these files are written by a python script from a template
171-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
172-
*.manifest
173-
*.spec
174-
175-
# Installer logs
176-
pip-log.txt
177-
pip-delete-this-directory.txt
178-
179-
# Unit test / coverage reports
180-
htmlcov/
181-
.tox/
182-
.nox/
183-
.coverage
184-
.coverage.*
185-
.cache
186-
nosetests.xml
187-
coverage.xml
188-
*.cover
189-
*.py,cover
190-
.hypothesis/
191-
.pytest_cache/
192-
cover/
193-
194-
# Translations
195-
*.mo
196-
*.pot
197-
198-
# Django stuff:
199-
*.log
200-
local_settings.py
201-
db.sqlite3
202-
db.sqlite3-journal
203-
204-
# Flask stuff:
205-
instance/
206-
.webassets-cache
207-
208-
# Scrapy stuff:
209-
.scrapy
210-
211-
# Sphinx documentation
212-
docs/_build/
213-
214-
# PyBuilder
215-
.pybuilder/
140+
### Rust ###
141+
# Generated by Cargo
142+
# will have compiled files and executables
143+
debug/
216144
target/
217145

218-
# Jupyter Notebook
219-
.ipynb_checkpoints
220-
221-
# IPython
222-
profile_default/
223-
ipython_config.py
224-
225-
# pyenv
226-
# For a library or package, you might want to ignore these files since the code is
227-
# intended to run in multiple environments; otherwise, check them in:
228-
# .python-version
229-
230-
# pipenv
231-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
232-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
233-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
234-
# install all needed dependencies.
235-
#Pipfile.lock
236-
237-
# poetry
238-
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
239-
# This is especially recommended for binary packages to ensure reproducibility, and is more
240-
# commonly ignored for libraries.
241-
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
242-
#poetry.lock
243-
244-
# pdm
245-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
246-
#pdm.lock
247-
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
248-
# in version control.
249-
# https://pdm.fming.dev/#use-with-ide
250-
.pdm.toml
251-
252-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
253-
__pypackages__/
254-
255-
# Celery stuff
256-
celerybeat-schedule
257-
celerybeat.pid
258-
259-
# SageMath parsed files
260-
*.sage.py
261-
262-
# Environments
263-
.env
264-
.venv
265-
env/
266-
venv/
267-
ENV/
268-
env.bak/
269-
venv.bak/
270-
271-
# Spyder project settings
272-
.spyderproject
273-
.spyproject
274-
275-
# Rope project settings
276-
.ropeproject
277-
278-
# mkdocs documentation
279-
/site
280-
281-
# mypy
282-
.mypy_cache/
283-
.dmypy.json
284-
dmypy.json
285-
286-
# Pyre type checker
287-
.pyre/
288-
289-
# pytype static type analyzer
290-
.pytype/
291-
292-
# Cython debug symbols
293-
cython_debug/
294-
295-
# PyCharm
296-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
297-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
298-
# and can be added to the global gitignore or merged into this file. For a more nuclear
299-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
300-
#.idea/
301-
302-
### Python Patch ###
303-
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
304-
poetry.toml
305-
306-
# ruff
307-
.ruff_cache/
308-
309-
# LSP config files
310-
pyrightconfig.json
146+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
147+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
148+
Cargo.lock
149+
150+
# These are backup files generated by rustfmt
151+
**/*.rs.bk
152+
153+
# MSVC Windows builds of rustc generate these, which store debugging information
154+
*.pdb
311155

312156
### Vim ###
313157
# Swap
@@ -374,4 +218,6 @@ $RECYCLE.BIN/
374218
# Windows shortcuts
375219
*.lnk
376220

377-
# End of https://www.toptal.com/developers/gitignore/api/jetbrains+all,linux,macos,python,vim,visualstudiocode,windows
221+
# End of https://www.toptal.com/developers/gitignore/api/jetbrains+all,linux,macos,rust,vim,visualstudiocode,windows
222+
223+
!Cargo.lock

.pre-commit-config.yaml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,3 @@ repos:
2121
rev: v3.5.3
2222
hooks:
2323
- id: prettier
24-
- repo: https://github.com/charliermarsh/ruff-pre-commit
25-
rev: v0.11.4
26-
hooks:
27-
- id: ruff
28-
args:
29-
- --fix
30-
- id: ruff-format
31-
- repo: https://github.com/pre-commit/mirrors-mypy
32-
rev: v1.15.0
33-
hooks:
34-
- id: mypy
35-
args:
36-
- --scripts-are-modules
37-
additional_dependencies:
38-
- aiohttp<4
39-
- aiohttp-socks<0.11
40-
- attrs
41-
- certifi
42-
- maxminddb<3
43-
- orjson<4
44-
- platformdirs<5
45-
- rich<15
46-
- tomli<3
47-
- typing-extensions<5
48-
- uvloop<0.22; implementation_name=='cpython' and (sys_platform=='darwin' or sys_platform=='linux')
49-
- winloop<0.1.9; implementation_name=='cpython' and (sys_platform=='cygwin' or sys_platform=='win32')

0 commit comments

Comments
 (0)