-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace Cython with pure Python (#96)
- Loading branch information
1 parent
2496322
commit 3892e56
Showing
16 changed files
with
903 additions
and
958 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,14 +14,13 @@ jobs: | |
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.x" | ||
- uses: dioptra-io/setup-poetry-action@v1 | ||
- name: Install package | ||
run: | | ||
python -m venv venv | ||
./venv/bin/pip install -e .[dev] | ||
run: poetry install | ||
- name: Insert test data | ||
run: ./venv/bin/python tests/data/insert.py | ||
run: poetry run python tests/data/insert.py | ||
- name: Run tests | ||
run: ./venv/bin/pytest --cov=diamond_miner --cov-report=xml | ||
run: poetry run pytest --cov=diamond_miner --cov-report=xml | ||
- uses: codecov/codecov-action@v3 | ||
|
||
mkdocs: | ||
|
@@ -31,42 +30,24 @@ jobs: | |
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.x" | ||
- uses: dioptra-io/setup-poetry-action@v1 | ||
- name: Install package | ||
run: | | ||
python -m venv venv | ||
./venv/bin/pip install -e .[dev] | ||
run: poetry install | ||
- name: Build documentation | ||
run: ./venv/bin/mkdocs build --strict | ||
run: poetry run mkdocs build --strict | ||
- name: Publish documentation | ||
run: ./venv/bin/mkdocs gh-deploy --force --no-history --strict | ||
run: poetry run mkdocs gh-deploy --force --no-history --strict | ||
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
|
||
pypi: | ||
needs: [test] | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.x" | ||
- name: Set up QEMU | ||
if: runner.os == 'Linux' | ||
uses: docker/setup-qemu-action@v2 | ||
with: | ||
platforms: all | ||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
with: | ||
output-dir: dist | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: dist/*.whl | ||
- uses: dioptra-io/publish-python-action@v1 | ||
with: | ||
password: ${{ secrets.PYPI_TOKEN }} | ||
upload: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
wheel: false |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from ipaddress import IPv6Address | ||
|
||
|
||
def format_probe( | ||
dst_addr_v6: int, src_port: int, dst_port: int, ttl: int, protocol: str | ||
) -> str: | ||
""" | ||
Create a Caracal probe string. | ||
Examples: | ||
>>> from diamond_miner.format import format_probe | ||
>>> format_probe(281470816487432, 24000, 33434, 1, "icmp") | ||
'::ffff:808:808,24000,33434,1,icmp' | ||
""" | ||
return f"{format_ipv6(dst_addr_v6)},{src_port},{dst_port},{ttl},{protocol}" | ||
|
||
|
||
def format_ipv6(addr: int) -> str: | ||
""" | ||
Convert an IPv6 UInt128 to a string. | ||
>>> from diamond_miner.format import format_ipv6 | ||
>>> format_ipv6(281470816487432) | ||
'::ffff:808:808' | ||
""" | ||
return str(IPv6Address(addr)) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.