mitmproxy-linux 0.12.15__tar.gz → 0.12.16__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 (125) hide show
  1. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/.github/workflows/autofix.yml +2 -2
  2. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/.github/workflows/ci.yml +14 -14
  3. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/.github/workflows/docs.yml +5 -5
  4. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/CHANGELOG.md +5 -0
  5. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/Cargo.lock +51 -34
  6. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/Cargo.toml +1 -1
  7. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/PKG-INFO +1 -1
  8. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/version-info.toml +1 -1
  9. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/network/udp.rs +40 -2
  10. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/packet_sources/macos.rs +96 -1
  11. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/packet_sources/wireguard.rs +28 -6
  12. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/.cargo/config.toml +0 -0
  13. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/.github/FUNDING.yml +0 -0
  14. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/.github/actions/setup/action.yml +0 -0
  15. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/.github/dependabot.yml +0 -0
  16. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/.github/python-version.txt +0 -0
  17. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/.github/scripts/build-macos-redirector.sh +0 -0
  18. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/.github/scripts/pin-versions.py +0 -0
  19. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/.github/scripts/release +0 -0
  20. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/.github/workflows/release.yml +0 -0
  21. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/.gitignore +0 -0
  22. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/CONTRIBUTING.md +0 -0
  23. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/LICENSE +0 -0
  24. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/README.md +0 -0
  25. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/architecture.png +0 -0
  26. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/benches/.gitignore +0 -0
  27. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/benches/dns.py +0 -0
  28. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/benches/local.conf +0 -0
  29. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/benches/nonlocal.conf +0 -0
  30. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/benches/openvpnserv.exe +0 -0
  31. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/benches/plot.py +0 -0
  32. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/benches/process.rs +0 -0
  33. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/benches/py_echo_client.py +0 -0
  34. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/benches/py_echo_server.py +0 -0
  35. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/benches/wg_echo_client.py +0 -0
  36. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/benches/wg_echo_server.py +0 -0
  37. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-linux/Cargo.toml +0 -0
  38. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-linux/README.md +0 -0
  39. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-linux/build.rs +0 -0
  40. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-linux/src/main.rs +0 -0
  41. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-linux/src/main2.rs +0 -0
  42. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-linux-ebpf/.cargo/config.toml +0 -0
  43. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-linux-ebpf/Cargo.toml +0 -0
  44. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-linux-ebpf/build.rs +0 -0
  45. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-linux-ebpf/rust-toolchain.toml +0 -0
  46. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-linux-ebpf/src/lib.rs +0 -0
  47. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-linux-ebpf/src/main.rs +0 -0
  48. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-linux-ebpf-common/Cargo.toml +0 -0
  49. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-linux-ebpf-common/src/lib.rs +0 -0
  50. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/.swift-format +0 -0
  51. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/.swiftlint.yml +0 -0
  52. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/README.md +0 -0
  53. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/mitmproxy_macos/__init__.py +0 -0
  54. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/mitmproxy_macos/macos-certificate-truster.app/Contents/Info.plist +0 -0
  55. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/mitmproxy_macos/macos-certificate-truster.app/Contents/Resources/mitmproxy.icns +0 -0
  56. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/pyproject.toml +0 -0
  57. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/.gitignore +0 -0
  58. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/ExportOptions.plist +0 -0
  59. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/README.md +0 -0
  60. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/ipc/mitmproxy_ipc.pb.swift +0 -0
  61. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/ipc/utils.swift +0 -0
  62. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/macos-redirector/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -0
  63. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/macos-redirector/Assets.xcassets/AppIcon.appiconset/logo-circle-1024.png +0 -0
  64. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/macos-redirector/Assets.xcassets/AppIcon.appiconset/logo-circle-128.png +0 -0
  65. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/macos-redirector/Assets.xcassets/AppIcon.appiconset/logo-circle-16.png +0 -0
  66. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/macos-redirector/Assets.xcassets/AppIcon.appiconset/logo-circle-256.png +0 -0
  67. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/macos-redirector/Assets.xcassets/AppIcon.appiconset/logo-circle-32.png +0 -0
  68. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/macos-redirector/Assets.xcassets/AppIcon.appiconset/logo-circle-512.png +0 -0
  69. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/macos-redirector/Assets.xcassets/AppIcon.appiconset/logo-circle-64.png +0 -0
  70. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/macos-redirector/Assets.xcassets/Contents.json +0 -0
  71. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/macos-redirector/app.swift +0 -0
  72. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/macos-redirector/macos_redirector.entitlements +0 -0
  73. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/macos-redirector.xcodeproj/project.pbxproj +0 -0
  74. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/macos-redirector.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
  75. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/macos-redirector.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
  76. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/macos-redirector.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +0 -0
  77. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/macos-redirector.xcodeproj/xcshareddata/xcschemes/macos-redirector.xcscheme +0 -0
  78. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/network-extension/FlowExtensions.swift +0 -0
  79. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/network-extension/Info.plist +0 -0
  80. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/network-extension/InterceptConf.swift +0 -0
  81. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/network-extension/ProcessInfoCache.swift +0 -0
  82. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/network-extension/TransparentProxyProvider.swift +0 -0
  83. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/network-extension/libproc-Bridging-Header.h +0 -0
  84. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/network-extension/main.swift +0 -0
  85. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-macos/redirector/network-extension/network_extension.entitlements +0 -0
  86. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-windows/README.md +0 -0
  87. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-windows/mitmproxy_windows/LICENSE +0 -0
  88. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-windows/mitmproxy_windows/WINDIVERT_VERSION +0 -0
  89. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-windows/mitmproxy_windows/WinDivert.dll +0 -0
  90. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-windows/mitmproxy_windows/WinDivert.lib +0 -0
  91. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-windows/mitmproxy_windows/WinDivert64.sys +0 -0
  92. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-windows/mitmproxy_windows/__init__.py +0 -0
  93. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy-windows/pyproject.toml +0 -0
  94. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/mitmproxy_linux/__init__.py +0 -0
  95. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/pyproject.toml +0 -0
  96. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/bin/process-list.rs +0 -0
  97. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/certificates/macos.rs +0 -0
  98. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/certificates/mod.rs +0 -0
  99. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/dns.rs +0 -0
  100. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/intercept_conf.rs +0 -0
  101. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/ipc/mitmproxy_ipc.proto +0 -0
  102. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/ipc/mitmproxy_ipc.rs +0 -0
  103. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/ipc/mod.rs +0 -0
  104. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/lib.rs +0 -0
  105. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/messages.rs +0 -0
  106. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/network/core.rs +0 -0
  107. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/network/icmp.rs +0 -0
  108. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/network/mod.rs +0 -0
  109. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/network/task.rs +0 -0
  110. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/network/tcp.rs +0 -0
  111. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/network/tests.rs +0 -0
  112. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/network/virtual_device.rs +0 -0
  113. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/packet_sources/linux.rs +0 -0
  114. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/packet_sources/mod.rs +0 -0
  115. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/packet_sources/tun.rs +0 -0
  116. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/packet_sources/udp.rs +0 -0
  117. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/packet_sources/windows.rs +0 -0
  118. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/processes/macos_icons.rs +0 -0
  119. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/processes/mod.rs +0 -0
  120. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/processes/nix_list.rs +0 -0
  121. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/processes/windows_icons.rs +0 -0
  122. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/processes/windows_list.rs +0 -0
  123. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/shutdown.rs +0 -0
  124. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/windows/mod.rs +0 -0
  125. {mitmproxy_linux-0.12.15 → mitmproxy_linux-0.12.16}/src/windows/network.rs +0 -0
@@ -17,7 +17,7 @@ jobs:
17
17
  protobuf:
18
18
  runs-on: macos-latest
19
19
  steps:
20
- - uses: mhils/workflows/checkout@e6b54c0368640a2201137f00272b978b51d26268
20
+ - uses: mhils/workflows/checkout@589b2878317d2d57c315c5825f9a1cfe9c76a7c3
21
21
  # FIXME: https://github.com/mitmproxy/mitmproxy/issues/7877 - bump SwiftProtobuf and then re-add this here.
22
22
  # - run: brew install swift-protobuf
23
23
  - run: brew install protobuf
@@ -39,7 +39,7 @@ jobs:
39
39
  - os: macos-latest
40
40
  - os: ubuntu-latest
41
41
  steps:
42
- - uses: mhils/workflows/checkout@e6b54c0368640a2201137f00272b978b51d26268
42
+ - uses: mhils/workflows/checkout@589b2878317d2d57c315c5825f9a1cfe9c76a7c3
43
43
  - uses: ./.github/actions/setup
44
44
  with:
45
45
  rust-version: ${{ env.MSRV }}
@@ -39,7 +39,7 @@ jobs:
39
39
  env:
40
40
  RUSTFLAGS: ${{ matrix.rust == 'nightly' && '-Zpanic_abort_tests -C panic=abort' || '' }}
41
41
  steps:
42
- - uses: mhils/workflows/checkout@e6b54c0368640a2201137f00272b978b51d26268
42
+ - uses: mhils/workflows/checkout@589b2878317d2d57c315c5825f9a1cfe9c76a7c3
43
43
  - uses: ./.github/actions/setup
44
44
  with:
45
45
  rust-version: ${{ matrix.rust }}
@@ -84,17 +84,17 @@ jobs:
84
84
  runs-on: ${{ matrix.os }}
85
85
  name: build mitmproxy-rs (${{ matrix.name }})
86
86
  steps:
87
- - uses: mhils/workflows/checkout@e6b54c0368640a2201137f00272b978b51d26268
87
+ - uses: mhils/workflows/checkout@589b2878317d2d57c315c5825f9a1cfe9c76a7c3
88
88
  - uses: ./.github/actions/setup
89
89
  with:
90
90
  extra-targets: ${{ matrix.target }}
91
91
 
92
92
  - if: runner.os == 'Linux'
93
93
  name: Install maturin[zig] from PyPI
94
- uses: install-pinned/maturin-with-zig@7f54e6144d8fd17188d0e99742fefc4bcb178e06
94
+ uses: install-pinned/maturin-with-zig@b10cdafc5d601c9f081acd683e4d9e2cb3538528
95
95
  - if: runner.os != 'Linux'
96
96
  name: Install maturin from PyPI
97
- uses: install-pinned/maturin@3bfd83cd34bdcbcc8a10e459c2a9e41e6c33e706
97
+ uses: install-pinned/maturin@499d31ac84c34c8a405f267c9cb60fa7d5592e62
98
98
 
99
99
  - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
100
100
  run: python .github/scripts/pin-versions.py
@@ -115,7 +115,7 @@ jobs:
115
115
  build-macos-app:
116
116
  runs-on: macos-latest
117
117
  steps:
118
- - uses: mhils/workflows/checkout@e6b54c0368640a2201137f00272b978b51d26268
118
+ - uses: mhils/workflows/checkout@589b2878317d2d57c315c5825f9a1cfe9c76a7c3
119
119
  - if: ${{ !startsWith(github.ref, 'refs/tags/') }} # harden against cache poisoning
120
120
  uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
121
121
  id: cache-app
@@ -141,9 +141,9 @@ jobs:
141
141
  runs-on: windows-latest
142
142
  name: build mitmproxy-windows
143
143
  steps:
144
- - uses: mhils/workflows/checkout@e6b54c0368640a2201137f00272b978b51d26268
144
+ - uses: mhils/workflows/checkout@589b2878317d2d57c315c5825f9a1cfe9c76a7c3
145
145
  - uses: ./.github/actions/setup
146
- - uses: install-pinned/build@80919007c59a8977ba4eedf1f3234e73f674aa2e
146
+ - uses: install-pinned/build@9ff7470d36ff1790990e7c6f16201bc35bfe9a73
147
147
 
148
148
  - run: cargo build --release --package windows-redirector
149
149
 
@@ -158,11 +158,11 @@ jobs:
158
158
  needs: build-macos-app
159
159
  runs-on: macos-latest
160
160
  steps:
161
- - uses: mhils/workflows/checkout@e6b54c0368640a2201137f00272b978b51d26268
161
+ - uses: mhils/workflows/checkout@589b2878317d2d57c315c5825f9a1cfe9c76a7c3
162
162
  - uses: ./.github/actions/setup
163
163
  with:
164
164
  extra-targets: aarch64-apple-darwin x86_64-apple-darwin
165
- - uses: install-pinned/build@80919007c59a8977ba4eedf1f3234e73f674aa2e
165
+ - uses: install-pinned/build@9ff7470d36ff1790990e7c6f16201bc35bfe9a73
166
166
 
167
167
  - run: |
168
168
  cargo build --release --package macos-certificate-truster --target x86_64-apple-darwin
@@ -192,10 +192,10 @@ jobs:
192
192
  args: --compatibility manylinux2014 --zig
193
193
  runs-on: ${{ matrix.os }}
194
194
  steps:
195
- - uses: mhils/workflows/checkout@e6b54c0368640a2201137f00272b978b51d26268
195
+ - uses: mhils/workflows/checkout@589b2878317d2d57c315c5825f9a1cfe9c76a7c3
196
196
  - uses: ./.github/actions/setup
197
197
  - name: Install maturin[zig] from PyPI
198
- uses: install-pinned/maturin-with-zig@7f54e6144d8fd17188d0e99742fefc4bcb178e06
198
+ uses: install-pinned/maturin-with-zig@b10cdafc5d601c9f081acd683e4d9e2cb3538528
199
199
  - run: maturin build --release ${{ matrix.args }}
200
200
  working-directory: ./mitmproxy-linux
201
201
  - run: test -f target/wheels/*-py3-none-*.whl # ensure we have a universal wheel
@@ -209,7 +209,7 @@ jobs:
209
209
  needs: build-linux-wheel
210
210
  runs-on: ubuntu-latest
211
211
  steps:
212
- - uses: mhils/workflows/checkout@e6b54c0368640a2201137f00272b978b51d26268
212
+ - uses: mhils/workflows/checkout@589b2878317d2d57c315c5825f9a1cfe9c76a7c3
213
213
  - uses: ./.github/actions/setup
214
214
  - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
215
215
  with:
@@ -226,12 +226,12 @@ jobs:
226
226
  - build-windows-wheel
227
227
  - build-linux-wheel
228
228
  - build-macos-wheel
229
- uses: mhils/workflows/.github/workflows/alls-green.yml@e6b54c0368640a2201137f00272b978b51d26268
229
+ uses: mhils/workflows/.github/workflows/alls-green.yml@589b2878317d2d57c315c5825f9a1cfe9c76a7c3
230
230
  with:
231
231
  jobs: ${{ toJSON(needs) }}
232
232
 
233
233
  deploy:
234
- uses: mhils/workflows/.github/workflows/python-deploy.yml@e6b54c0368640a2201137f00272b978b51d26268
234
+ uses: mhils/workflows/.github/workflows/python-deploy.yml@589b2878317d2d57c315c5825f9a1cfe9c76a7c3
235
235
  needs: check
236
236
  if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
237
237
  with:
@@ -20,11 +20,11 @@ jobs:
20
20
  runs-on: ubuntu-latest
21
21
  steps:
22
22
  # TODO: This should ideally just reuse the main CI artifacts.
23
- - uses: mhils/workflows/checkout@e6b54c0368640a2201137f00272b978b51d26268
23
+ - uses: mhils/workflows/checkout@589b2878317d2d57c315c5825f9a1cfe9c76a7c3
24
24
  - uses: ./.github/actions/setup
25
- - uses: install-pinned/maturin-with-zig@7f54e6144d8fd17188d0e99742fefc4bcb178e06
26
- - uses: install-pinned/mypy@75779f141592e4909d64e13f8a1861f06aa9cd8d
27
- - uses: install-pinned/pdoc@69ba59f9699df21e1026110af4ec6b10a98cf5cd
25
+ - uses: install-pinned/maturin-with-zig@b10cdafc5d601c9f081acd683e4d9e2cb3538528
26
+ - uses: install-pinned/mypy@ca797a92cfcf502e7c9f5d37f8d2d276778d2774
27
+ - uses: install-pinned/pdoc@f06d2d4ffa04927fd830d36f5bafba15f02f3932
28
28
 
29
29
  - run: maturin build --features docs,pyo3/extension-module
30
30
  working-directory: ./mitmproxy-rs
@@ -52,4 +52,4 @@ jobs:
52
52
  url: ${{ steps.deployment.outputs.page_url }}
53
53
  steps:
54
54
  - id: deployment
55
- uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5
55
+ uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5
@@ -1,6 +1,11 @@
1
1
  ## Unreleased: mitmproxy_rs next
2
2
 
3
3
 
4
+ ## 14 November 2026: mitmproxy_rs 0.12.16
5
+
6
+ - Refactor protobuf-YAML conversion, fix missing unknown fields on nested known messages.
7
+
8
+
4
9
  ## 22 October 2026: mitmproxy_rs 0.12.15
5
10
 
6
11
 
@@ -230,7 +230,7 @@ dependencies = [
230
230
  "anyhow",
231
231
  "cargo_metadata",
232
232
  "rustc_version",
233
- "which 8.0.5",
233
+ "which 8.0.6",
234
234
  ]
235
235
 
236
236
  [[package]]
@@ -1093,12 +1093,13 @@ checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
1093
1093
 
1094
1094
  [[package]]
1095
1095
  name = "flate2"
1096
- version = "1.1.9"
1096
+ version = "1.1.10"
1097
1097
  source = "registry+https://github.com/rust-lang/crates.io-index"
1098
- checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
1098
+ checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb"
1099
1099
  dependencies = [
1100
1100
  "crc32fast",
1101
- "miniz_oxide",
1101
+ "miniz_oxide 0.9.1",
1102
+ "zlib-rs",
1102
1103
  ]
1103
1104
 
1104
1105
  [[package]]
@@ -1366,9 +1367,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
1366
1367
 
1367
1368
  [[package]]
1368
1369
  name = "hickory-net"
1369
- version = "0.26.1"
1370
+ version = "0.26.3"
1370
1371
  source = "registry+https://github.com/rust-lang/crates.io-index"
1371
- checksum = "e2295ed2f9c31e471e1428a8f88a3f0e1f4b27c15049592138d1eebe9c35b183"
1372
+ checksum = "c480823ed7c2c5d0f09c41020cb6b7c28029ce60ec42dc942158dcf22f8e0a4d"
1372
1373
  dependencies = [
1373
1374
  "async-trait",
1374
1375
  "cfg-if",
@@ -1390,9 +1391,9 @@ dependencies = [
1390
1391
 
1391
1392
  [[package]]
1392
1393
  name = "hickory-proto"
1393
- version = "0.26.1"
1394
+ version = "0.26.3"
1394
1395
  source = "registry+https://github.com/rust-lang/crates.io-index"
1395
- checksum = "0bab31817bfb44672a252e97fe81cd0c18d1b2cf892108922f6818820df8c643"
1396
+ checksum = "12b92608f679a6fa515dd1d15c1ff89443026e391200a2c840c7afcba482893d"
1396
1397
  dependencies = [
1397
1398
  "data-encoding",
1398
1399
  "idna",
@@ -1411,9 +1412,9 @@ dependencies = [
1411
1412
 
1412
1413
  [[package]]
1413
1414
  name = "hickory-resolver"
1414
- version = "0.26.1"
1415
+ version = "0.26.3"
1415
1416
  source = "registry+https://github.com/rust-lang/crates.io-index"
1416
- checksum = "f0d58d28879ceecde6607729660c2667a081ccdc082e082675042793960f178c"
1417
+ checksum = "3f3da5255c95d5a716857d54b5b8f4e8d67c3484d3beaaaae2ce25063b3ba981"
1417
1418
  dependencies = [
1418
1419
  "cfg-if",
1419
1420
  "futures-util",
@@ -1437,9 +1438,9 @@ dependencies = [
1437
1438
 
1438
1439
  [[package]]
1439
1440
  name = "hickory-server"
1440
- version = "0.26.1"
1441
+ version = "0.26.3"
1441
1442
  source = "registry+https://github.com/rust-lang/crates.io-index"
1442
- checksum = "130236ba6abba90da6a7acf7a87b27d862b592c3145dc74bc47bf86d8ff198ec"
1443
+ checksum = "950c2ad9ba2ad35d6890b725baff91305f65b87d7719a6c6071514dc70f13eeb"
1443
1444
  dependencies = [
1444
1445
  "async-trait",
1445
1446
  "bytes",
@@ -1944,9 +1945,9 @@ dependencies = [
1944
1945
 
1945
1946
  [[package]]
1946
1947
  name = "log"
1947
- version = "0.4.33"
1948
+ version = "0.4.34"
1948
1949
  source = "registry+https://github.com/rust-lang/crates.io-index"
1949
- checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"
1950
+ checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
1950
1951
 
1951
1952
  [[package]]
1952
1953
  name = "lru_time_cache"
@@ -1956,7 +1957,7 @@ checksum = "9106e1d747ffd48e6be5bb2d97fa706ed25b144fbee4d5c02eae110cd8d6badd"
1956
1957
 
1957
1958
  [[package]]
1958
1959
  name = "macos-certificate-truster"
1959
- version = "0.12.15"
1960
+ version = "0.12.16"
1960
1961
  dependencies = [
1961
1962
  "security-framework",
1962
1963
  ]
@@ -2010,6 +2011,16 @@ dependencies = [
2010
2011
  "simd-adler32",
2011
2012
  ]
2012
2013
 
2014
+ [[package]]
2015
+ name = "miniz_oxide"
2016
+ version = "0.9.1"
2017
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2018
+ checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c"
2019
+ dependencies = [
2020
+ "adler2",
2021
+ "simd-adler32",
2022
+ ]
2023
+
2013
2024
  [[package]]
2014
2025
  name = "mio"
2015
2026
  version = "1.2.2"
@@ -2023,7 +2034,7 @@ dependencies = [
2023
2034
 
2024
2035
  [[package]]
2025
2036
  name = "mitm-wg-test-client"
2026
- version = "0.12.15"
2037
+ version = "0.12.16"
2027
2038
  dependencies = [
2028
2039
  "anyhow",
2029
2040
  "boringtun",
@@ -2034,7 +2045,7 @@ dependencies = [
2034
2045
 
2035
2046
  [[package]]
2036
2047
  name = "mitmproxy"
2037
- version = "0.12.15"
2048
+ version = "0.12.16"
2038
2049
  dependencies = [
2039
2050
  "anyhow",
2040
2051
  "boringtun",
@@ -2069,7 +2080,7 @@ dependencies = [
2069
2080
 
2070
2081
  [[package]]
2071
2082
  name = "mitmproxy-contentviews"
2072
- version = "0.12.15"
2083
+ version = "0.12.16"
2073
2084
  dependencies = [
2074
2085
  "anyhow",
2075
2086
  "criterion",
@@ -2088,7 +2099,7 @@ dependencies = [
2088
2099
 
2089
2100
  [[package]]
2090
2101
  name = "mitmproxy-highlight"
2091
- version = "0.12.15"
2102
+ version = "0.12.16"
2092
2103
  dependencies = [
2093
2104
  "anyhow",
2094
2105
  "criterion",
@@ -2102,7 +2113,7 @@ dependencies = [
2102
2113
 
2103
2114
  [[package]]
2104
2115
  name = "mitmproxy-linux"
2105
- version = "0.12.15"
2116
+ version = "0.12.16"
2106
2117
  dependencies = [
2107
2118
  "anyhow",
2108
2119
  "aya",
@@ -2127,24 +2138,24 @@ dependencies = [
2127
2138
 
2128
2139
  [[package]]
2129
2140
  name = "mitmproxy-linux-ebpf"
2130
- version = "0.12.15"
2141
+ version = "0.12.16"
2131
2142
  dependencies = [
2132
2143
  "aya-ebpf",
2133
2144
  "aya-log-ebpf",
2134
2145
  "mitmproxy-linux-ebpf-common",
2135
- "which 8.0.5",
2146
+ "which 8.0.6",
2136
2147
  ]
2137
2148
 
2138
2149
  [[package]]
2139
2150
  name = "mitmproxy-linux-ebpf-common"
2140
- version = "0.12.15"
2151
+ version = "0.12.16"
2141
2152
  dependencies = [
2142
2153
  "aya-ebpf",
2143
2154
  ]
2144
2155
 
2145
2156
  [[package]]
2146
2157
  name = "mitmproxy_rs"
2147
- version = "0.12.15"
2158
+ version = "0.12.16"
2148
2159
  dependencies = [
2149
2160
  "anyhow",
2150
2161
  "boringtun",
@@ -2655,7 +2666,7 @@ dependencies = [
2655
2666
  "crc32fast",
2656
2667
  "fdeflate",
2657
2668
  "flate2",
2658
- "miniz_oxide",
2669
+ "miniz_oxide 0.8.9",
2659
2670
  ]
2660
2671
 
2661
2672
  [[package]]
@@ -2931,9 +2942,9 @@ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
2931
2942
 
2932
2943
  [[package]]
2933
2944
  name = "rand"
2934
- version = "0.10.2"
2945
+ version = "0.10.3"
2935
2946
  source = "registry+https://github.com/rust-lang/crates.io-index"
2936
- checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80"
2947
+ checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af"
2937
2948
  dependencies = [
2938
2949
  "chacha20 0.10.1",
2939
2950
  "getrandom 0.4.3",
@@ -3757,9 +3768,9 @@ dependencies = [
3757
3768
 
3758
3769
  [[package]]
3759
3770
  name = "tree-sitter"
3760
- version = "0.26.12"
3771
+ version = "0.26.13"
3761
3772
  source = "registry+https://github.com/rust-lang/crates.io-index"
3762
- checksum = "83c567a8e18ae93f20982c90370b16fd24023aeaf52f6052b96957ab253a0fec"
3773
+ checksum = "17ebdd3a5a7e28a1890b876fdbd0c3c0fe0a6336cffaa104f11b9f720c9daa29"
3763
3774
  dependencies = [
3764
3775
  "cc",
3765
3776
  "regex",
@@ -3781,9 +3792,9 @@ dependencies = [
3781
3792
 
3782
3793
  [[package]]
3783
3794
  name = "tree-sitter-highlight"
3784
- version = "0.26.12"
3795
+ version = "0.26.13"
3785
3796
  source = "registry+https://github.com/rust-lang/crates.io-index"
3786
- checksum = "12bf7c298789885e63e7c1c9c86976875136064d23f541007bae3a02a23a74f9"
3797
+ checksum = "662316ecd27166f79e18865429638c05194aee76a7bc374136d844f05d778f74"
3787
3798
  dependencies = [
3788
3799
  "regex",
3789
3800
  "streaming-iterator",
@@ -4037,9 +4048,9 @@ dependencies = [
4037
4048
 
4038
4049
  [[package]]
4039
4050
  name = "which"
4040
- version = "8.0.5"
4051
+ version = "8.0.6"
4041
4052
  source = "registry+https://github.com/rust-lang/crates.io-index"
4042
- checksum = "8f3ef584124b911bcc3875c2f1472e80f24361ceb789bd1c62b3e9a3df9ff43c"
4053
+ checksum = "bae2f2b2b816647a1cab1acc91f5bd20812d53cb344382635ec2181940c8034f"
4043
4054
  dependencies = [
4044
4055
  "libc",
4045
4056
  ]
@@ -4198,7 +4209,7 @@ dependencies = [
4198
4209
 
4199
4210
  [[package]]
4200
4211
  name = "windows-redirector"
4201
- version = "0.12.15"
4212
+ version = "0.12.16"
4202
4213
  dependencies = [
4203
4214
  "anyhow",
4204
4215
  "env_logger",
@@ -4567,6 +4578,12 @@ dependencies = [
4567
4578
  "syn 2.0.119",
4568
4579
  ]
4569
4580
 
4581
+ [[package]]
4582
+ name = "zlib-rs"
4583
+ version = "0.6.8"
4584
+ source = "registry+https://github.com/rust-lang/crates.io-index"
4585
+ checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112"
4586
+
4570
4587
  [[package]]
4571
4588
  name = "zmij"
4572
4589
  version = "1.0.23"
@@ -6,7 +6,7 @@ authors = [
6
6
  "Fabio Valentini <decathorpe@gmail.com>",
7
7
  "Maximilian Hils <cargo@maximilianhils.com>",
8
8
  ]
9
- version = "0.12.15"
9
+ version = "0.12.16"
10
10
  publish = false
11
11
  repository = "https://github.com/mitmproxy/mitmproxy-rs"
12
12
  edition = "2024"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mitmproxy_linux
3
- Version: 0.12.15
3
+ Version: 0.12.16
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -28,7 +28,7 @@ authors = [
28
28
  "Fabio Valentini <decathorpe@gmail.com>",
29
29
  "Maximilian Hils <cargo@maximilianhils.com>",
30
30
  ]
31
- version = "0.12.15"
31
+ version = "0.12.16"
32
32
  publish = false
33
33
  repository = "https://github.com/mitmproxy/mitmproxy-rs"
34
34
  edition = "2024"
@@ -144,10 +144,13 @@ impl UdpHandler {
144
144
  .unwrap_or(ConnectionId::unassigned_udp());
145
145
 
146
146
  match self.connections.get_mut(&potential_cid) {
147
- Some((state, _)) => {
147
+ Some((state, _)) if !state.closed => {
148
148
  state.add_packet(packet.payload);
149
149
  }
150
- None => {
150
+ // Packets for a closed connection start a new one. Dropping them instead would also
151
+ // refresh the closed entry, so a client that keeps reusing the same four-tuple (e.g. for
152
+ // DNS) would never get through again.
153
+ _ => {
151
154
  let mut state = ConnectionState::default();
152
155
  state.add_packet(packet.payload);
153
156
  let connection_id = self.connection_id_generator.next_id();
@@ -311,6 +314,41 @@ mod tests {
311
314
  assert!(rx.blocking_recv().is_err());
312
315
  }
313
316
 
317
+ #[test]
318
+ fn test_receive_after_close_opens_new_connection() {
319
+ let mut handler = UdpHandler::new();
320
+ let (events_tx, mut events_rx) = tokio::sync::mpsc::channel(1);
321
+ let mut receive = |handler: &mut UdpHandler| {
322
+ let packet = UdpPacket {
323
+ src_addr: SocketAddr::from_str("10.0.0.1:1").unwrap(),
324
+ dst_addr: SocketAddr::from_str("10.0.0.53:53").unwrap(),
325
+ payload: vec![1, 2, 3],
326
+ };
327
+ handler.receive_data(packet, TunnelInfo::None, events_tx.try_reserve().unwrap());
328
+ match events_rx.try_recv() {
329
+ Ok(TransportEvent::ConnectionEstablished { connection_id, .. }) => {
330
+ Some(connection_id)
331
+ }
332
+ Err(_) => None,
333
+ }
334
+ };
335
+
336
+ let first = receive(&mut handler).expect("first packet opens a connection");
337
+ assert_eq!(
338
+ receive(&mut handler),
339
+ None,
340
+ "same four-tuple reuses the connection"
341
+ );
342
+
343
+ handler.close_connection(first);
344
+ let second = receive(&mut handler).expect("packet after close opens a new connection");
345
+ assert_ne!(first, second);
346
+
347
+ let (tx, rx) = oneshot::channel();
348
+ handler.read_data(second, tx);
349
+ assert_eq!(rx.blocking_recv().unwrap(), vec![1, 2, 3]);
350
+ }
351
+
314
352
  #[tokio::test]
315
353
  async fn test_udp_server_echo() -> anyhow::Result<()> {
316
354
  let (commands_tx, commands_rx) = tokio::sync::mpsc::unbounded_channel();
@@ -247,7 +247,12 @@ impl ConnectionTask {
247
247
  loop {
248
248
  tokio::select! {
249
249
  _ = self.shutdown.recv() => break,
250
- Some(packet) = stream.next(), if state.packet_queue_len() < 10 => {
250
+ packet = stream.next(), if state.packet_queue_len() < 10 => {
251
+ let Some(packet) = packet else {
252
+ // extension closed the flow
253
+ state.close();
254
+ break;
255
+ };
251
256
  let packet = ipc::UdpPacket::decode(
252
257
  packet.context("IPC read error")?
253
258
  ).context("invalid IPC message")?;
@@ -393,6 +398,96 @@ impl ConnectionTask {
393
398
  #[cfg(test)]
394
399
  mod tests {
395
400
  use super::*;
401
+ use tokio::sync::mpsc;
402
+ use tokio::sync::watch;
403
+
404
+ fn udp_handshake() -> NewFlow {
405
+ NewFlow {
406
+ message: Some(ipc::new_flow::Message::Udp(UdpFlow {
407
+ local_address: Some(ipc::Address {
408
+ host: "127.0.0.1".into(),
409
+ port: 12345,
410
+ }),
411
+ tunnel_info: Some(ipc::TunnelInfo {
412
+ pid: Some(42),
413
+ process_name: Some("test".into()),
414
+ }),
415
+ })),
416
+ }
417
+ }
418
+
419
+ async fn write_handshake(client: &mut UnixStream, handshake: &NewFlow) {
420
+ let bytes = handshake.encode_to_vec();
421
+ client.write_u32(bytes.len() as u32).await.unwrap();
422
+ client.write_all(&bytes).await.unwrap();
423
+ client.flush().await.unwrap();
424
+ }
425
+
426
+ async fn spawn_connection_task(
427
+ server: UnixStream,
428
+ ) -> (
429
+ tokio::task::JoinHandle<Result<()>>,
430
+ mpsc::Receiver<TransportEvent>,
431
+ watch::Sender<()>,
432
+ ) {
433
+ let (events_tx, events_rx) = mpsc::channel(16);
434
+ let (shutdown_tx, shutdown_rx) = shutdown::channel();
435
+ let handle = tokio::spawn(ConnectionTask::new(server, events_tx, shutdown_rx).run());
436
+ (handle, events_rx, shutdown_tx)
437
+ }
438
+
439
+ #[tokio::test]
440
+ async fn udp_eof_before_first_datagram_completes() {
441
+ let (mut client, server) = UnixStream::pair().unwrap();
442
+ let (handle, mut events_rx, _shutdown_tx) = spawn_connection_task(server).await;
443
+
444
+ write_handshake(&mut client, &udp_handshake()).await;
445
+ drop(client);
446
+
447
+ timeout(Duration::from_secs(1), handle)
448
+ .await
449
+ .expect("UDP task hung after redirector EOF before the first datagram")
450
+ .unwrap()
451
+ .unwrap();
452
+
453
+ assert!(
454
+ events_rx.try_recv().is_err(),
455
+ "ConnectionEstablished must not be sent when no datagram arrived"
456
+ );
457
+ }
458
+
459
+ #[tokio::test]
460
+ async fn udp_eof_after_first_datagram_completes() {
461
+ let (mut client, server) = UnixStream::pair().unwrap();
462
+ let (handle, mut events_rx, _shutdown_tx) = spawn_connection_task(server).await;
463
+
464
+ write_handshake(&mut client, &udp_handshake()).await;
465
+
466
+ let mut framed = Framed::new(client, LengthDelimitedCodec::new());
467
+ let packet = ipc::UdpPacket {
468
+ data: Bytes::from_static(b"hello"),
469
+ remote_address: Some(ipc::Address {
470
+ host: "8.8.8.8".into(),
471
+ port: 53,
472
+ }),
473
+ };
474
+ framed
475
+ .send(Bytes::from(packet.encode_to_vec()))
476
+ .await
477
+ .unwrap();
478
+ drop(framed);
479
+
480
+ timeout(Duration::from_secs(1), handle)
481
+ .await
482
+ .expect("UDP task hung after redirector EOF following a datagram")
483
+ .unwrap()
484
+ .unwrap();
485
+
486
+ match events_rx.try_recv() {
487
+ Ok(TransportEvent::ConnectionEstablished { .. }) => {}
488
+ other => panic!("expected ConnectionEstablished, got {other:?}"),
489
+ }
490
+ }
396
491
 
397
492
  async fn spawn_tcp_connection() -> (
398
493
  UnixStream,
@@ -1,6 +1,7 @@
1
1
  use std::collections::HashMap;
2
2
  use std::net::{IpAddr, SocketAddr};
3
3
  use std::sync::Arc;
4
+ use std::time::Duration;
4
5
 
5
6
  use crate::messages::{
6
7
  NetworkCommand, NetworkEvent, SmolPacket, TransportCommand, TransportEvent, TunnelInfo,
@@ -10,6 +11,7 @@ use crate::packet_sources::{PacketSourceConf, PacketSourceTask};
10
11
  use anyhow::{Context, Result, anyhow};
11
12
  use boringtun::noise::{
12
13
  Packet, Tunn, TunnResult, errors::WireGuardError, handshake::parse_handshake_anon,
14
+ rate_limiter::RateLimiter,
13
15
  };
14
16
  use boringtun::x25519::{PublicKey, StaticSecret};
15
17
  use pretty_hex::pretty_hex;
@@ -21,6 +23,7 @@ use tokio::{
21
23
  Mutex,
22
24
  mpsc::{Receiver, Sender},
23
25
  },
26
+ time::{MissedTickBehavior, interval},
24
27
  };
25
28
 
26
29
  use crate::packet_sources::udp::{create_and_bind_udp_socket, remote_host_closed_conn};
@@ -29,6 +32,10 @@ use crate::shutdown;
29
32
  // WireGuard headers are 60 bytes for IPv4 and 80 bytes for IPv6
30
33
  const WG_HEADER_SIZE: usize = 80;
31
34
 
35
+ /// Number of handshakes per second we accept before answering with cookie replies
36
+ /// (same value as boringtun's own device implementation).
37
+ const HANDSHAKE_RATE_LIMIT: u64 = 100;
38
+
32
39
  /// A WireGuard peer. We keep track of the tunnel state and the peer address.
33
40
  pub struct WireGuardPeer {
34
41
  tunnel: Tunn,
@@ -59,18 +66,26 @@ impl PacketSourceConf for WireGuardConf {
59
66
  add_network_layer(transport_events_tx, transport_commands_rx, shutdown);
60
67
 
61
68
  // initialize WireGuard server
69
+ let public_key = PublicKey::from(&self.private_key);
70
+
71
+ // If no rate limiter is passed to `Tunn::new`, boringtun creates one per tunnel that only
72
+ // gets reset from `Tunn::update_timers`, which we never call. Its counter would then
73
+ // never be reset and all handshakes after the first ten would be answered with cookie
74
+ // replies. Instead, we share a single rate limiter and reset it ourselves (see `run`).
75
+ let rate_limiter = Arc::new(RateLimiter::new(&public_key, HANDSHAKE_RATE_LIMIT));
76
+
62
77
  let mut peers_by_idx = HashMap::new();
63
78
  let mut peers_by_key = HashMap::new();
64
- for public_key in self.peer_public_keys {
79
+ for peer_public_key in self.peer_public_keys {
65
80
  let index = peers_by_idx.len() as u32;
66
81
 
67
82
  let tunnel = Tunn::new(
68
83
  self.private_key.clone(),
69
- public_key,
84
+ peer_public_key,
70
85
  None,
71
86
  Some(25),
72
87
  index,
73
- None,
88
+ Some(rate_limiter.clone()),
74
89
  );
75
90
 
76
91
  let peer = Arc::new(Mutex::new(WireGuardPeer {
@@ -79,7 +94,7 @@ impl PacketSourceConf for WireGuardConf {
79
94
  }));
80
95
 
81
96
  peers_by_idx.insert(index, peer.clone());
82
- peers_by_key.insert(public_key, peer);
97
+ peers_by_key.insert(peer_public_key, peer);
83
98
  }
84
99
 
85
100
  let socket = create_and_bind_udp_socket(self.listen_addr)?;
@@ -87,13 +102,12 @@ impl PacketSourceConf for WireGuardConf {
87
102
 
88
103
  log::debug!("WireGuard server listening for UDP connections on {local_addr} ...");
89
104
 
90
- let public_key = PublicKey::from(&self.private_key);
91
-
92
105
  Ok((
93
106
  WireGuardTask {
94
107
  socket,
95
108
  private_key: self.private_key,
96
109
  public_key,
110
+ rate_limiter,
97
111
 
98
112
  peers_by_idx,
99
113
  peers_by_key,
@@ -113,6 +127,7 @@ pub struct WireGuardTask {
113
127
  socket: UdpSocket,
114
128
  private_key: StaticSecret,
115
129
  public_key: PublicKey,
130
+ rate_limiter: Arc<RateLimiter>,
116
131
 
117
132
  peers_by_idx: HashMap<u32, Arc<Mutex<WireGuardPeer>>>,
118
133
  peers_by_key: HashMap<PublicKey, Arc<Mutex<WireGuardPeer>>>,
@@ -133,9 +148,16 @@ impl PacketSourceTask for WireGuardTask {
133
148
 
134
149
  let mut udp_buf = vec![0; MAX_PACKET_SIZE];
135
150
 
151
+ // boringtun expects the handshake rate limiter to be reset about once per second.
152
+ let mut reset_rate_limiter = interval(Duration::from_secs(1));
153
+ reset_rate_limiter.set_missed_tick_behavior(MissedTickBehavior::Delay);
154
+
136
155
  loop {
137
156
  tokio::select! {
138
157
  exit = &mut self.network_task_handle => break exit.context("network task panic")?.context("network task error")?,
158
+ _ = reset_rate_limiter.tick() => {
159
+ self.rate_limiter.reset_count();
160
+ },
139
161
  // wait for WireGuard packets incoming on the UDP socket
140
162
  r = self.socket.recv_from(udp_buf.as_mut_slice()) => {
141
163
  if remote_host_closed_conn(&r) {