mitmproxy-linux 0.11.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. mitmproxy_linux-0.11.2/.cargo/config.toml +14 -0
  2. mitmproxy_linux-0.11.2/.github/FUNDING.yml +1 -0
  3. mitmproxy_linux-0.11.2/.github/actions/setup/action.yml +26 -0
  4. mitmproxy_linux-0.11.2/.github/dependabot.yml +18 -0
  5. mitmproxy_linux-0.11.2/.github/python-version.txt +1 -0
  6. mitmproxy_linux-0.11.2/.github/scripts/build-macos-redirector.sh +58 -0
  7. mitmproxy_linux-0.11.2/.github/scripts/pin-versions.py +17 -0
  8. mitmproxy_linux-0.11.2/.github/scripts/release +27 -0
  9. mitmproxy_linux-0.11.2/.github/workflows/autofix.yml +53 -0
  10. mitmproxy_linux-0.11.2/.github/workflows/ci.yml +244 -0
  11. mitmproxy_linux-0.11.2/.github/workflows/docs.yml +55 -0
  12. mitmproxy_linux-0.11.2/.github/workflows/release.yml +30 -0
  13. mitmproxy_linux-0.11.2/.gitignore +10 -0
  14. mitmproxy_linux-0.11.2/CHANGELOG.md +288 -0
  15. mitmproxy_linux-0.11.2/CONTRIBUTING.md +60 -0
  16. mitmproxy_linux-0.11.2/Cargo.lock +4147 -0
  17. mitmproxy_linux-0.11.2/Cargo.toml +114 -0
  18. mitmproxy_linux-0.11.2/LICENSE +19 -0
  19. mitmproxy_linux-0.11.2/PKG-INFO +27 -0
  20. mitmproxy_linux-0.11.2/README.md +43 -0
  21. mitmproxy_linux-0.11.2/architecture.png +0 -0
  22. mitmproxy_linux-0.11.2/benches/.gitignore +3 -0
  23. mitmproxy_linux-0.11.2/benches/dns.py +23 -0
  24. mitmproxy_linux-0.11.2/benches/local.conf +9 -0
  25. mitmproxy_linux-0.11.2/benches/nonlocal.conf +8 -0
  26. mitmproxy_linux-0.11.2/benches/openvpnserv.exe +0 -0
  27. mitmproxy_linux-0.11.2/benches/plot.py +321 -0
  28. mitmproxy_linux-0.11.2/benches/process.rs +78 -0
  29. mitmproxy_linux-0.11.2/benches/py_echo_client.py +101 -0
  30. mitmproxy_linux-0.11.2/benches/py_echo_server.py +54 -0
  31. mitmproxy_linux-0.11.2/benches/wg_echo_client.py +100 -0
  32. mitmproxy_linux-0.11.2/benches/wg_echo_server.py +94 -0
  33. mitmproxy_linux-0.11.2/mitmproxy-linux/Cargo.toml +41 -0
  34. mitmproxy_linux-0.11.2/mitmproxy-linux/README.md +13 -0
  35. mitmproxy_linux-0.11.2/mitmproxy-linux/build.rs +144 -0
  36. mitmproxy_linux-0.11.2/mitmproxy-linux/mitmproxy_linux/__init__.py +37 -0
  37. mitmproxy_linux-0.11.2/mitmproxy-linux/src/main.rs +7 -0
  38. mitmproxy_linux-0.11.2/mitmproxy-linux/src/main2.rs +197 -0
  39. mitmproxy_linux-0.11.2/mitmproxy-linux-ebpf/.cargo/config.toml +12 -0
  40. mitmproxy_linux-0.11.2/mitmproxy-linux-ebpf/Cargo.toml +22 -0
  41. mitmproxy_linux-0.11.2/mitmproxy-linux-ebpf/build.rs +17 -0
  42. mitmproxy_linux-0.11.2/mitmproxy-linux-ebpf/rust-toolchain.toml +3 -0
  43. mitmproxy_linux-0.11.2/mitmproxy-linux-ebpf/src/lib.rs +3 -0
  44. mitmproxy_linux-0.11.2/mitmproxy-linux-ebpf/src/main.rs +54 -0
  45. mitmproxy_linux-0.11.2/mitmproxy-linux-ebpf-common/Cargo.toml +16 -0
  46. mitmproxy_linux-0.11.2/mitmproxy-linux-ebpf-common/src/lib.rs +80 -0
  47. mitmproxy_linux-0.11.2/mitmproxy-macos/.swift-format +6 -0
  48. mitmproxy_linux-0.11.2/mitmproxy-macos/.swiftlint.yml +9 -0
  49. mitmproxy_linux-0.11.2/mitmproxy-macos/README.md +11 -0
  50. mitmproxy_linux-0.11.2/mitmproxy-macos/mitmproxy_macos/__init__.py +0 -0
  51. mitmproxy_linux-0.11.2/mitmproxy-macos/mitmproxy_macos/macos-certificate-truster.app/Contents/Info.plist +30 -0
  52. mitmproxy_linux-0.11.2/mitmproxy-macos/mitmproxy_macos/macos-certificate-truster.app/Contents/Resources/mitmproxy.icns +0 -0
  53. mitmproxy_linux-0.11.2/mitmproxy-macos/pyproject.toml +25 -0
  54. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/.gitignore +2 -0
  55. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/ExportOptions.plist +23 -0
  56. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/README.md +21 -0
  57. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/ipc/mitmproxy_ipc.pb.swift +728 -0
  58. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/ipc/utils.swift +116 -0
  59. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/macos-redirector/Assets.xcassets/AppIcon.appiconset/Contents.json +68 -0
  60. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/macos-redirector/Assets.xcassets/AppIcon.appiconset/logo-circle-1024.png +0 -0
  61. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/macos-redirector/Assets.xcassets/AppIcon.appiconset/logo-circle-128.png +0 -0
  62. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/macos-redirector/Assets.xcassets/AppIcon.appiconset/logo-circle-16.png +0 -0
  63. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/macos-redirector/Assets.xcassets/AppIcon.appiconset/logo-circle-256.png +0 -0
  64. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/macos-redirector/Assets.xcassets/AppIcon.appiconset/logo-circle-32.png +0 -0
  65. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/macos-redirector/Assets.xcassets/AppIcon.appiconset/logo-circle-512.png +0 -0
  66. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/macos-redirector/Assets.xcassets/AppIcon.appiconset/logo-circle-64.png +0 -0
  67. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/macos-redirector/Assets.xcassets/Contents.json +6 -0
  68. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/macos-redirector/app.swift +122 -0
  69. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/macos-redirector/macos_redirector.entitlements +12 -0
  70. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/macos-redirector.xcodeproj/project.pbxproj +606 -0
  71. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/macos-redirector.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  72. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/macos-redirector.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  73. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/macos-redirector.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +14 -0
  74. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/macos-redirector.xcodeproj/xcshareddata/xcschemes/macos-redirector.xcscheme +99 -0
  75. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/network-extension/FlowExtensions.swift +125 -0
  76. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/network-extension/Info.plist +16 -0
  77. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/network-extension/InterceptConf.swift +76 -0
  78. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/network-extension/ProcessInfoCache.swift +48 -0
  79. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/network-extension/TransparentProxyProvider.swift +183 -0
  80. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/network-extension/libproc-Bridging-Header.h +6 -0
  81. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/network-extension/main.swift +14 -0
  82. mitmproxy_linux-0.11.2/mitmproxy-macos/redirector/network-extension/network_extension.entitlements +10 -0
  83. mitmproxy_linux-0.11.2/mitmproxy-macos/version-info.toml +123 -0
  84. mitmproxy_linux-0.11.2/mitmproxy-windows/README.md +13 -0
  85. mitmproxy_linux-0.11.2/mitmproxy-windows/mitmproxy_windows/LICENSE +1191 -0
  86. mitmproxy_linux-0.11.2/mitmproxy-windows/mitmproxy_windows/WINDIVERT_VERSION +1 -0
  87. mitmproxy_linux-0.11.2/mitmproxy-windows/mitmproxy_windows/WinDivert.dll +0 -0
  88. mitmproxy_linux-0.11.2/mitmproxy-windows/mitmproxy_windows/WinDivert.lib +0 -0
  89. mitmproxy_linux-0.11.2/mitmproxy-windows/mitmproxy_windows/WinDivert64.sys +0 -0
  90. mitmproxy_linux-0.11.2/mitmproxy-windows/mitmproxy_windows/__init__.py +34 -0
  91. mitmproxy_linux-0.11.2/mitmproxy-windows/pyproject.toml +23 -0
  92. mitmproxy_linux-0.11.2/mitmproxy_linux/__init__.py +37 -0
  93. mitmproxy_linux-0.11.2/pyproject.toml +17 -0
  94. mitmproxy_linux-0.11.2/src/bin/process-list.rs +56 -0
  95. mitmproxy_linux-0.11.2/src/certificates/macos.rs +49 -0
  96. mitmproxy_linux-0.11.2/src/certificates/mod.rs +4 -0
  97. mitmproxy_linux-0.11.2/src/dns.rs +187 -0
  98. mitmproxy_linux-0.11.2/src/intercept_conf.rs +199 -0
  99. mitmproxy_linux-0.11.2/src/ipc/mitmproxy_ipc.proto +57 -0
  100. mitmproxy_linux-0.11.2/src/ipc/mitmproxy_ipc.rs +95 -0
  101. mitmproxy_linux-0.11.2/src/ipc/mod.rs +39 -0
  102. mitmproxy_linux-0.11.2/src/lib.rs +13 -0
  103. mitmproxy_linux-0.11.2/src/messages.rs +235 -0
  104. mitmproxy_linux-0.11.2/src/network/core.rs +125 -0
  105. mitmproxy_linux-0.11.2/src/network/icmp.rs +111 -0
  106. mitmproxy_linux-0.11.2/src/network/mod.rs +14 -0
  107. mitmproxy_linux-0.11.2/src/network/task.rs +147 -0
  108. mitmproxy_linux-0.11.2/src/network/tcp.rs +357 -0
  109. mitmproxy_linux-0.11.2/src/network/tests.rs +859 -0
  110. mitmproxy_linux-0.11.2/src/network/udp.rs +363 -0
  111. mitmproxy_linux-0.11.2/src/network/virtual_device.rs +108 -0
  112. mitmproxy_linux-0.11.2/src/packet_sources/linux.rs +217 -0
  113. mitmproxy_linux-0.11.2/src/packet_sources/macos.rs +384 -0
  114. mitmproxy_linux-0.11.2/src/packet_sources/mod.rs +135 -0
  115. mitmproxy_linux-0.11.2/src/packet_sources/tun.rs +188 -0
  116. mitmproxy_linux-0.11.2/src/packet_sources/udp.rs +155 -0
  117. mitmproxy_linux-0.11.2/src/packet_sources/windows.rs +133 -0
  118. mitmproxy_linux-0.11.2/src/packet_sources/wireguard.rs +410 -0
  119. mitmproxy_linux-0.11.2/src/processes/macos_icons.rs +111 -0
  120. mitmproxy_linux-0.11.2/src/processes/mod.rs +58 -0
  121. mitmproxy_linux-0.11.2/src/processes/nix_list.rs +161 -0
  122. mitmproxy_linux-0.11.2/src/processes/windows_icons.rs +194 -0
  123. mitmproxy_linux-0.11.2/src/processes/windows_list.rs +333 -0
  124. mitmproxy_linux-0.11.2/src/shutdown.rs +78 -0
  125. mitmproxy_linux-0.11.2/src/windows/mod.rs +1 -0
  126. mitmproxy_linux-0.11.2/src/windows/network.rs +206 -0
@@ -0,0 +1,14 @@
1
+ [env]
2
+ WINDIVERT_PATH = { value = "mitmproxy-windows/mitmproxy_windows/", relative = true }
3
+
4
+ [target.x86_64-apple-darwin]
5
+ rustflags = [
6
+ "-C", "link-arg=-undefined",
7
+ "-C", "link-arg=dynamic_lookup",
8
+ ]
9
+
10
+ [target.aarch64-apple-darwin]
11
+ rustflags = [
12
+ "-C", "link-arg=-undefined",
13
+ "-C", "link-arg=dynamic_lookup",
14
+ ]
@@ -0,0 +1 @@
1
+ github: [decathorpe, mhils]
@@ -0,0 +1,26 @@
1
+ name: 'setup'
2
+ description: 'checkout, setup rust and python'
3
+ inputs:
4
+ rust-version:
5
+ description: 'Rust version'
6
+ required: true
7
+ default: 'stable'
8
+ extra-targets:
9
+ description: 'Extra Rust targets'
10
+ toolchain-args:
11
+ description: 'Extra args for `rustup toolchain`'
12
+ runs:
13
+ using: "composite"
14
+ steps:
15
+ - uses: mhils/workflows/setup-python@v12 # PyO3 wants recent Python on Windows.
16
+ - run: rustup toolchain install ${{ inputs.rust-version }} --profile minimal ${{ inputs.toolchain-args }}
17
+ shell: bash
18
+ - run: rustup default ${{ inputs.rust-version }}
19
+ shell: bash
20
+ - if: inputs.extra-targets
21
+ run: rustup target add ${{ inputs.extra-targets }}
22
+ shell: bash
23
+ - uses: mhils/workflows/rust-cache@v14
24
+ - if: runner.os == 'Linux'
25
+ run: cargo install --locked bpf-linker
26
+ shell: bash
@@ -0,0 +1,18 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: "/"
5
+ schedule:
6
+ interval: "monthly"
7
+ groups:
8
+ dependencies:
9
+ patterns:
10
+ - "*"
11
+ - package-ecosystem: cargo
12
+ directory: "/"
13
+ schedule:
14
+ interval: "monthly"
15
+ groups:
16
+ dependencies:
17
+ patterns:
18
+ - "*"
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -eou pipefail
4
+
5
+ if [ -n "${APPLE_ID-}" ]; then
6
+ echo "Signing keys available, building signed binary..."
7
+
8
+ APPLE_TEAM_ID=S8XHQB96PW
9
+
10
+ # Install provisioning profiles
11
+ mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
12
+ echo -n "$APPLE_PROVISIONING_PROFILE_APP" | base64 --decode -o ~/Library/MobileDevice/Provisioning\ Profiles/app.provisionprofile
13
+ echo -n "$APPLE_PROVISIONING_PROFILE_EXT" | base64 --decode -o ~/Library/MobileDevice/Provisioning\ Profiles/ext.provisionprofile
14
+
15
+ # Create temporary keychain
16
+ KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain
17
+ security create-keychain -p "app-signing" $KEYCHAIN_PATH
18
+ security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
19
+ security unlock-keychain -p "app-signing" $KEYCHAIN_PATH
20
+ # Import certificate to keychain
21
+ security import <(echo -n "$APPLE_CERTIFICATE") -A -k $KEYCHAIN_PATH
22
+ security list-keychain -s $KEYCHAIN_PATH
23
+
24
+ mkdir build
25
+ xcodebuild \
26
+ -scheme macos-redirector \
27
+ -archivePath build/macos-redirector.xcarchive \
28
+ OTHER_CODE_SIGN_FLAGS="--keychain $KEYCHAIN_PATH" \
29
+ archive
30
+ xcodebuild \
31
+ -exportArchive \
32
+ -archivePath build/macos-redirector.xcarchive \
33
+ -exportOptionsPlist ./ExportOptions.plist \
34
+ -exportPath ./build
35
+
36
+ # Notarize
37
+ # https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow
38
+ xcrun notarytool store-credentials "AC_PASSWORD" \
39
+ --keychain "$KEYCHAIN_PATH" \
40
+ --apple-id "$APPLE_ID" \
41
+ --team-id "$APPLE_TEAM_ID" \
42
+ --password "$APPLE_APP_PASSWORD"
43
+ ditto -c -k --keepParent "./build/Mitmproxy Redirector.app" "./build/Mitmproxy Redirector.zip"
44
+ xcrun notarytool submit \
45
+ "./build/Mitmproxy Redirector.zip" \
46
+ --keychain "$KEYCHAIN_PATH" \
47
+ --keychain-profile "AC_PASSWORD" \
48
+ --wait
49
+ xcrun stapler staple "./build/Mitmproxy Redirector.app"
50
+
51
+ mkdir -p dist
52
+ tar --create --file "./dist/Mitmproxy Redirector.app.tar" --cd "./build" "Mitmproxy Redirector.app"
53
+ else
54
+ echo "Signing keys not available, building unsigned binary..."
55
+ xcodebuild -scheme macos-redirector CODE_SIGNING_ALLOWED="NO" build
56
+ mkdir -p dist
57
+ touch "dist/Mitmproxy Redirector.app.tar"
58
+ fi
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env python3
2
+
3
+ import tomllib
4
+ from pathlib import Path
5
+
6
+ with open("Cargo.toml", "rb") as f:
7
+ version = tomllib.load(f)["workspace"]["package"]["version"]
8
+
9
+ pyproject_toml = Path("mitmproxy-rs/pyproject.toml")
10
+ contents = pyproject_toml.read_text()
11
+ contents = (
12
+ contents
13
+ .replace(f"mitmproxy_windows", f"mitmproxy_windows=={version}")
14
+ .replace(f"mitmproxy_linux", f"mitmproxy_linux=={version}")
15
+ .replace(f"mitmproxy_macos", f"mitmproxy_macos=={version}")
16
+ )
17
+ pyproject_toml.write_text(contents)
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env -S python3 -u
2
+ import logging
3
+
4
+ from releasetool import branch
5
+ from releasetool import get_next_dev_version
6
+ from releasetool import git_commit
7
+ from releasetool import git_push
8
+ from releasetool import git_tag
9
+ from releasetool import status_check
10
+ from releasetool import update_changelog
11
+ from releasetool import update_rust_version
12
+
13
+ logger = logging.getLogger(__name__)
14
+
15
+ if __name__ == "__main__":
16
+ status_check()
17
+ update_changelog()
18
+ update_rust_version()
19
+ git_commit()
20
+ git_tag()
21
+
22
+ if branch == "main":
23
+ update_rust_version(version=get_next_dev_version())
24
+ git_commit(message="reopen main for development")
25
+
26
+ git_push()
27
+ logger.info("✅ All done. 🥳")
@@ -0,0 +1,53 @@
1
+ name: autofix.ci
2
+
3
+ on:
4
+ pull_request:
5
+
6
+ permissions:
7
+ contents: read
8
+
9
+ concurrency:
10
+ group: ${{ github.workflow }}-${{ github.ref }}
11
+ cancel-in-progress: true
12
+
13
+ env:
14
+ MSRV: "1.80" # Minimum Supported Rust Version
15
+
16
+ jobs:
17
+ protobuf:
18
+ runs-on: macos-latest
19
+ steps:
20
+ - uses: mhils/workflows/checkout@v12
21
+ - run: brew install swift-protobuf
22
+ - run: cargo install protoc-gen-prost
23
+ - run: protoc --proto_path=./src/ipc/ mitmproxy_ipc.proto
24
+ --prost_out=./src/ipc/
25
+ --prost_opt="bytes=data"
26
+ --swift_out=./mitmproxy-macos/redirector/ipc
27
+ - run: cargo fmt --all
28
+ - uses: autofix-ci/action@ff86a557419858bb967097bfc916833f5647fa8c
29
+
30
+ rustfmt:
31
+ runs-on: ${{ matrix.os }}
32
+ strategy:
33
+ matrix:
34
+ include:
35
+ - os: windows-latest
36
+ - os: macos-latest
37
+ - os: ubuntu-latest
38
+ steps:
39
+ - uses: mhils/workflows/checkout@v12
40
+ - uses: ./.github/actions/setup
41
+ with:
42
+ rust-version: ${{ env.MSRV }}
43
+ toolchain-args: --component rustfmt --component clippy
44
+
45
+ # We could run clippy on mitmproxy-linux-ebpf with
46
+ # cargo +nightly clippy --workspace -- -C panic=abort -Zpanic_abort_tests
47
+ # but that means we'd use nightly clippy, which may change its behavior (and thus break CI).
48
+ # So we rather exempt mitmproxy-linux-ebpf from clippy lints.
49
+ - run: cargo clippy --fix --allow-dirty --workspace --exclude mitmproxy-linux-ebpf
50
+ - run: cargo fmt --all
51
+ - run: git checkout src/ipc/mitmproxy_ipc.rs
52
+
53
+ - uses: autofix-ci/action@ff86a557419858bb967097bfc916833f5647fa8c
@@ -0,0 +1,244 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ tags:
8
+ - 'v[0-9]+.[0-9]+.[0-9]+'
9
+ pull_request:
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ concurrency:
15
+ group: ${{ github.workflow }}-${{ github.ref }}
16
+ cancel-in-progress: true
17
+
18
+ jobs:
19
+ test:
20
+ runs-on: ${{ matrix.os }}
21
+ strategy:
22
+ matrix:
23
+ include:
24
+ - os: windows-latest
25
+ rust: "1.80" # MSRV - can't use variables here.
26
+ args: --exclude mitmproxy-linux-ebpf
27
+ - os: macos-latest
28
+ rust: "1.80" # MSRV - can't use variables here.
29
+ args: --exclude mitmproxy-linux-ebpf
30
+ - os: ubuntu-22.04
31
+ rust: "1.80" # MSRV - can't use variables here.
32
+ args: --exclude mitmproxy-linux-ebpf
33
+ - os: ubuntu-latest
34
+ rust: stable
35
+ args: --exclude mitmproxy-linux-ebpf
36
+ - os: ubuntu-latest # old Ubuntu to test eBPF verifier compatibility
37
+ rust: nightly
38
+ args: --package mitmproxy-linux-ebpf
39
+ env:
40
+ RUSTFLAGS: ${{ matrix.rust == 'nightly' && '-Zpanic_abort_tests -C panic=abort' || '' }}
41
+ steps:
42
+ - uses: mhils/workflows/checkout@v12
43
+ - uses: ./.github/actions/setup
44
+ with:
45
+ rust-version: ${{ matrix.rust }}
46
+
47
+ - name: Run "cargo check"
48
+ # the action-rs/cargo action adds inline annotations for "cargo check" output
49
+ uses: actions-rs/cargo@9e120dd99b0fbad1c065f686657e914e76bd7b72
50
+ with:
51
+ toolchain: ${{ matrix.rust }}
52
+ command: check
53
+ args: --workspace --verbose ${{ matrix.args }}
54
+ - if: matrix.rust != 'nightly' # XXX: weird errors here
55
+ name: Run "cargo test"
56
+ # the action-rs/cargo action adds inline annotations for "cargo test" output
57
+ uses: actions-rs/cargo@9e120dd99b0fbad1c065f686657e914e76bd7b72
58
+ with:
59
+ toolchain: ${{ matrix.rust }}
60
+ command: test
61
+ args: --workspace --verbose ${{ matrix.args }}
62
+ - if: matrix.os == 'ubuntu-22.04' # Test that eBPF loads
63
+ run: cargo test --features root-tests
64
+ working-directory: mitmproxy-linux
65
+ env:
66
+ CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: sudo -E
67
+
68
+ build:
69
+ strategy:
70
+ matrix:
71
+ include:
72
+ - name: windows-x86_64
73
+ os: windows-latest
74
+ - name: linux-x86_64
75
+ os: ubuntu-latest
76
+ args: --compatibility manylinux2014 --zig --sdist
77
+ - name: linux-arm64
78
+ os: ubuntu-latest
79
+ target: aarch64-unknown-linux-gnu
80
+ args: --compatibility manylinux2014 --zig --target aarch64-unknown-linux-gnu -i 3.12
81
+ - name: macos-universal
82
+ os: macos-latest
83
+ target: aarch64-apple-darwin x86_64-apple-darwin
84
+ args: --target universal2-apple-darwin
85
+ runs-on: ${{ matrix.os }}
86
+ name: build mitmproxy-rs (${{ matrix.name }})
87
+ steps:
88
+ - uses: mhils/workflows/checkout@v12
89
+ - uses: ./.github/actions/setup
90
+ with:
91
+ extra-targets: ${{ matrix.target }}
92
+
93
+ - if: runner.os == 'Linux'
94
+ name: Install maturin[zig] from PyPI
95
+ uses: install-pinned/maturin-with-zig@68c027568b7d08df7bc3c52476ae28d1d2d787f5
96
+ - if: runner.os != 'Linux'
97
+ name: Install maturin from PyPI
98
+ uses: install-pinned/maturin@b1e3f698dbd19f284d4363cb361f75b2fa04679c
99
+
100
+ - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
101
+ run: python .github/scripts/pin-versions.py
102
+
103
+ - run: maturin build --release ${{ matrix.args }}
104
+ working-directory: ./mitmproxy-rs
105
+
106
+ # ensure that sdist is building.
107
+ # We do this here instead of a separate job because we don't want to wait for the entire matrix.
108
+ - if: contains(matrix.args, 'sdist')
109
+ run: pip install --no-dependencies target/wheels/*.tar.gz
110
+
111
+ - uses: actions/upload-artifact@v4
112
+ with:
113
+ name: wheels-${{ matrix.name }}
114
+ path: target/wheels
115
+
116
+ build-macos-app:
117
+ runs-on: macos-latest
118
+ steps:
119
+ - uses: mhils/workflows/checkout@v12
120
+ - uses: actions/cache@v4
121
+ id: cache-app
122
+ with:
123
+ path: mitmproxy-macos/redirector/dist/
124
+ key: macos-${{ hashFiles('mitmproxy-macos/redirector/**', '.github/scripts/build-macos-redirector.sh') }}
125
+ - if: steps.cache-app.outputs.cache-hit != 'true' || hashFiles('mitmproxy-macos/redirector/dist/Mitmproxy Redirector.app.tar') == ''
126
+ run: $GITHUB_WORKSPACE/.github/scripts/build-macos-redirector.sh
127
+ working-directory: mitmproxy-macos/redirector
128
+ env:
129
+ APPLE_ID: ${{ secrets.APPLE_ID }}
130
+ APPLE_APP_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }}
131
+ APPLE_PROVISIONING_PROFILE_APP: ${{ secrets.APPLE_PROVISIONING_PROFILE_APP }}
132
+ APPLE_PROVISIONING_PROFILE_EXT: ${{ secrets.APPLE_PROVISIONING_PROFILE_EXT }}
133
+ APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
134
+
135
+ - uses: actions/upload-artifact@v4
136
+ with:
137
+ name: macos-app
138
+ path: mitmproxy-macos/redirector/dist/
139
+
140
+ build-windows-wheel:
141
+ runs-on: windows-latest
142
+ name: build mitmproxy-windows
143
+ steps:
144
+ - uses: mhils/workflows/checkout@v12
145
+ - uses: ./.github/actions/setup
146
+ - uses: install-pinned/build@aa7fb973fec4a5593736c5dc25b322120ca41a98
147
+
148
+ - run: cargo build --release --package windows-redirector
149
+
150
+ - run: python -m build --wheel ./mitmproxy-windows --outdir target/wheels/
151
+ - uses: actions/upload-artifact@v4
152
+ with:
153
+ name: wheels-os-windows
154
+ path: target/wheels
155
+
156
+ build-macos-wheel:
157
+ name: build mitmproxy-macos
158
+ needs: build-macos-app
159
+ runs-on: macos-latest
160
+ steps:
161
+ - uses: mhils/workflows/checkout@v12
162
+ - uses: ./.github/actions/setup
163
+ with:
164
+ extra-targets: aarch64-apple-darwin x86_64-apple-darwin
165
+ - uses: install-pinned/build@aa7fb973fec4a5593736c5dc25b322120ca41a98
166
+
167
+ - run: |
168
+ cargo build --release --package macos-certificate-truster --target x86_64-apple-darwin
169
+ cargo build --release --package macos-certificate-truster --target aarch64-apple-darwin
170
+ lipo -create -output target/release/macos-certificate-truster target/x86_64-apple-darwin/release/macos-certificate-truster target/aarch64-apple-darwin/release/macos-certificate-truster
171
+ - uses: actions/download-artifact@v4
172
+ with:
173
+ name: macos-app
174
+ path: mitmproxy-macos/redirector/dist/
175
+
176
+ - run: python -m build --wheel ./mitmproxy-macos --outdir target/wheels/
177
+ - uses: actions/upload-artifact@v4
178
+ with:
179
+ name: wheels-os-macos
180
+ path: target/wheels
181
+
182
+ build-linux-wheel:
183
+ name: build mitmproxy-${{ matrix.name }}
184
+ strategy:
185
+ matrix:
186
+ include:
187
+ - name: linux-x86_64
188
+ args: --compatibility manylinux2014 --zig --sdist
189
+ - name: linux-arm64
190
+ target: aarch64-unknown-linux-gnu
191
+ args: --compatibility manylinux2014 --zig --target aarch64-unknown-linux-gnu -i 3.12
192
+ runs-on: ubuntu-latest
193
+ steps:
194
+ - uses: mhils/workflows/checkout@v12
195
+ - uses: ./.github/actions/setup
196
+ with:
197
+ extra-targets: ${{ matrix.target }}
198
+ - name: Install maturin[zig] from PyPI
199
+ uses: install-pinned/maturin-with-zig@68c027568b7d08df7bc3c52476ae28d1d2d787f5
200
+
201
+ - run: maturin build --release ${{ matrix.args }}
202
+ working-directory: ./mitmproxy-linux
203
+
204
+ - uses: actions/upload-artifact@v4
205
+ with:
206
+ name: wheels-os-${{ matrix.name }}
207
+ path: target/wheels
208
+
209
+ test-linux-wheel-sdist:
210
+ needs: build-linux-wheel
211
+ runs-on: ubuntu-latest
212
+ steps:
213
+ - uses: mhils/workflows/checkout@v12
214
+ - uses: ./.github/actions/setup
215
+ - uses: actions/download-artifact@v4
216
+ with:
217
+ name: wheels-os-linux-x86_64
218
+ path: target/wheels
219
+ - run: pip install --no-dependencies target/wheels/*.tar.gz
220
+
221
+ check:
222
+ if: always()
223
+ needs:
224
+ - test
225
+ - test-linux-wheel-sdist
226
+ - build
227
+ - build-windows-wheel
228
+ - build-linux-wheel
229
+ - build-macos-wheel
230
+ uses: mhils/workflows/.github/workflows/alls-green.yml@main
231
+ with:
232
+ jobs: ${{ toJSON(needs) }}
233
+
234
+ deploy:
235
+ uses: mhils/workflows/.github/workflows/python-deploy.yml@v13
236
+ needs: check
237
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
238
+ with:
239
+ artifact-pattern: wheels-*
240
+ artifact-merge-multiple: true
241
+ # repository: testpypi
242
+ # environment: deploy-testpypi
243
+ secrets:
244
+ password: ${{ secrets.PYPI_TOKEN }}
@@ -0,0 +1,55 @@
1
+ name: docs
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+
9
+ # security: restrict permissions for CI jobs.
10
+ permissions:
11
+ contents: read
12
+
13
+ concurrency:
14
+ group: ${{ github.workflow }}-${{ github.ref }}
15
+ cancel-in-progress: true
16
+
17
+ jobs:
18
+ # Build the documentation and upload the static HTML files as an artifact.
19
+ build:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ # TODO: This should ideally just reuse the main CI artifacts.
23
+ - uses: mhils/workflows/checkout@v12
24
+ - uses: ./.github/actions/setup
25
+ - uses: install-pinned/maturin-with-zig@68c027568b7d08df7bc3c52476ae28d1d2d787f5
26
+ - uses: install-pinned/mypy@2b552bed479e3f7065314667b670f7303619e989
27
+ - uses: install-pinned/pdoc@fd9469ecb06f32b7012e07e449ce98b217bf1189
28
+
29
+ - run: maturin build --features docs,pyo3/extension-module
30
+ working-directory: ./mitmproxy-rs
31
+ - run: pip install --no-index --no-dependencies --find-links target/wheels/ mitmproxy_rs
32
+
33
+ - run: stubtest --allowlist mitmproxy-rs/stubtest-allowlist.txt --mypy-config-file mitmproxy-rs/pyproject.toml mitmproxy_rs
34
+
35
+ - run: pdoc -o docs/ mitmproxy_rs
36
+
37
+ - uses: actions/upload-pages-artifact@v3
38
+ with:
39
+ path: docs/
40
+
41
+ # Deploy the artifact to GitHub pages.
42
+ # This is a separate job so that only actions/deploy-pages has the necessary permissions.
43
+ deploy:
44
+ if: github.ref == 'refs/heads/main'
45
+ needs: build
46
+ runs-on: ubuntu-latest
47
+ permissions:
48
+ pages: write
49
+ id-token: write
50
+ environment:
51
+ name: github-pages
52
+ url: ${{ steps.deployment.outputs.page_url }}
53
+ steps:
54
+ - id: deployment
55
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,30 @@
1
+ name: Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ version:
7
+ description: 'Version (major.minor.patch)'
8
+ required: true
9
+ type: string
10
+ skip-branch-status-check:
11
+ description: 'Skip CI status check.'
12
+ default: false
13
+ required: false
14
+ type: boolean
15
+
16
+ permissions: {}
17
+
18
+ jobs:
19
+ release:
20
+ environment: deploy
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ with:
25
+ token: ${{ secrets.GH_PUSH_TOKEN }} # this token works to push to the protected main branch.
26
+ - uses: mhils/releasetool@v1
27
+ - run: ./.github/scripts/release
28
+ env:
29
+ PROJECT_VERSION: ${{ inputs.version }}
30
+ STATUS_CHECK_SKIP_GIT: ${{ inputs.skip-branch-status-check }}
@@ -0,0 +1,10 @@
1
+ /.idea/
2
+ /dist/
3
+ /out/
4
+ /target/
5
+ /venv/
6
+ /docs/
7
+ __pycache__/
8
+ *.xcuserstate
9
+ editable.marker
10
+ *.DS_Store