koon 1.2.2__tar.gz → 2.1.0__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 (167) hide show
  1. {koon-1.2.2 → koon-2.1.0}/Cargo.lock +70 -8
  2. {koon-1.2.2 → koon-2.1.0}/Cargo.toml +1 -6
  3. {koon-1.2.2 → koon-2.1.0}/PKG-INFO +83 -42
  4. {koon-1.2.2 → koon-2.1.0}/README.md +81 -38
  5. koon-2.1.0/crates/core/Cargo.toml +78 -0
  6. {koon-1.2.2 → koon-2.1.0}/crates/core/src/client/alt_svc.rs +0 -92
  7. koon-2.1.0/crates/core/src/client/blink_header_map.rs +131 -0
  8. {koon-1.2.2 → koon-2.1.0}/crates/core/src/client/blocked.rs +19 -144
  9. {koon-1.2.2 → koon-2.1.0}/crates/core/src/client/body.rs +15 -49
  10. koon-2.1.0/crates/core/src/client/cf_header_dict.rs +204 -0
  11. koon-2.1.0/crates/core/src/client/client_hints.rs +524 -0
  12. {koon-1.2.2 → koon-2.1.0}/crates/core/src/client/connection.rs +24 -200
  13. koon-2.1.0/crates/core/src/client/cookies.rs +93 -0
  14. {koon-1.2.2 → koon-2.1.0}/crates/core/src/client/execute.rs +321 -167
  15. {koon-1.2.2 → koon-2.1.0}/crates/core/src/client/h1.rs +3 -14
  16. {koon-1.2.2 → koon-2.1.0}/crates/core/src/client/h2.rs +0 -83
  17. {koon-1.2.2 → koon-2.1.0}/crates/core/src/client/h3.rs +0 -171
  18. koon-2.1.0/crates/core/src/client/headers/context.rs +122 -0
  19. {koon-1.2.2 → koon-2.1.0}/crates/core/src/client/headers/fetch_metadata.rs +125 -63
  20. {koon-1.2.2 → koon-2.1.0}/crates/core/src/client/headers/mod.rs +72 -134
  21. {koon-1.2.2 → koon-2.1.0}/crates/core/src/client/headers/order.rs +64 -113
  22. koon-2.1.0/crates/core/src/client/headers/order_tables.rs +262 -0
  23. koon-2.1.0/crates/core/src/client/headers/safari_map.rs +460 -0
  24. {koon-1.2.2 → koon-2.1.0}/crates/core/src/client/headers/util.rs +1 -15
  25. {koon-1.2.2 → koon-2.1.0}/crates/core/src/client/headers/websocket.rs +0 -26
  26. {koon-1.2.2 → koon-2.1.0}/crates/core/src/client/mod.rs +111 -188
  27. {koon-1.2.2 → koon-2.1.0}/crates/core/src/client/options.rs +0 -100
  28. {koon-1.2.2 → koon-2.1.0}/crates/core/src/client/request_body.rs +0 -50
  29. {koon-1.2.2 → koon-2.1.0}/crates/core/src/client/response.rs +121 -210
  30. {koon-1.2.2 → koon-2.1.0}/crates/core/src/client/ws.rs +0 -27
  31. koon-2.1.0/crates/core/src/cookie.rs +1120 -0
  32. {koon-1.2.2 → koon-2.1.0}/crates/core/src/dns/cache.rs +0 -12
  33. {koon-1.2.2 → koon-2.1.0}/crates/core/src/dns/mod.rs +0 -3
  34. {koon-1.2.2 → koon-2.1.0}/crates/core/src/dns/native.rs +6 -139
  35. {koon-1.2.2 → koon-2.1.0}/crates/core/src/dns/resolver.rs +0 -66
  36. {koon-1.2.2 → koon-2.1.0}/crates/core/src/error.rs +105 -41
  37. koon-2.1.0/crates/core/src/http1.rs +523 -0
  38. {koon-1.2.2 → koon-2.1.0}/crates/core/src/lib.rs +4 -12
  39. {koon-1.2.2 → koon-2.1.0}/crates/core/src/multipart.rs +38 -107
  40. koon-2.1.0/crates/core/src/options/doc.rs +73 -0
  41. koon-2.1.0/crates/core/src/options/mod.rs +737 -0
  42. koon-2.1.0/crates/core/src/options/table.rs +419 -0
  43. {koon-1.2.2 → koon-2.1.0}/crates/core/src/pool.rs +58 -102
  44. {koon-1.2.2 → koon-2.1.0}/crates/core/src/profile/accept_language/mod.rs +0 -42
  45. {koon-1.2.2 → koon-2.1.0}/crates/core/src/profile/accept_language/tables.rs +0 -7
  46. koon-2.1.0/crates/core/src/profile/brave.rs +105 -0
  47. koon-2.1.0/crates/core/src/profile/chrome/client_hints.rs +150 -0
  48. koon-2.1.0/crates/core/src/profile/chrome/headers.rs +139 -0
  49. {koon-1.2.2 → koon-2.1.0}/crates/core/src/profile/chrome/http2.rs +0 -22
  50. {koon-1.2.2 → koon-2.1.0}/crates/core/src/profile/chrome/mod.rs +1 -7
  51. {koon-1.2.2 → koon-2.1.0}/crates/core/src/profile/chrome/quic.rs +0 -15
  52. koon-2.1.0/crates/core/src/profile/chrome/tls.rs +179 -0
  53. koon-2.1.0/crates/core/src/profile/edge.rs +115 -0
  54. {koon-1.2.2 → koon-2.1.0}/crates/core/src/profile/firefox.rs +9 -219
  55. {koon-1.2.2 → koon-2.1.0}/crates/core/src/profile/mod.rs +9 -281
  56. {koon-1.2.2 → koon-2.1.0}/crates/core/src/profile/okhttp.rs +7 -72
  57. {koon-1.2.2 → koon-2.1.0}/crates/core/src/profile/opera.rs +2 -61
  58. {koon-1.2.2 → koon-2.1.0}/crates/core/src/profile/opera_mobile.rs +2 -61
  59. koon-2.1.0/crates/core/src/profile/releases.rs +99 -0
  60. {koon-1.2.2 → koon-2.1.0}/crates/core/src/profile/safari/headers.rs +10 -18
  61. {koon-1.2.2 → koon-2.1.0}/crates/core/src/profile/safari/http2.rs +0 -6
  62. koon-2.1.0/crates/core/src/profile/safari/mod.rs +600 -0
  63. {koon-1.2.2 → koon-2.1.0}/crates/core/src/profile/safari/quic.rs +0 -6
  64. {koon-1.2.2 → koon-2.1.0}/crates/core/src/profile/safari/tls.rs +0 -12
  65. koon-2.1.0/crates/core/src/profile/safari/versions.rs +26 -0
  66. koon-2.1.0/crates/core/src/profile/samsung.rs +129 -0
  67. koon-2.1.0/crates/core/src/proxy/ca.rs +268 -0
  68. {koon-1.2.2 → koon-2.1.0}/crates/core/src/proxy/config.rs +18 -31
  69. {koon-1.2.2 → koon-2.1.0}/crates/core/src/proxy/mod.rs +0 -5
  70. {koon-1.2.2 → koon-2.1.0}/crates/core/src/proxy/server.rs +5 -528
  71. {koon-1.2.2 → koon-2.1.0}/crates/core/src/quic/config.rs +0 -51
  72. {koon-1.2.2 → koon-2.1.0}/crates/core/src/quic/transport.rs +0 -288
  73. {koon-1.2.2 → koon-2.1.0}/crates/core/src/streaming.rs +21 -16
  74. {koon-1.2.2 → koon-2.1.0}/crates/core/src/tls/cert_compression.rs +0 -5
  75. {koon-1.2.2 → koon-2.1.0}/crates/core/src/tls/config.rs +14 -153
  76. {koon-1.2.2 → koon-2.1.0}/crates/core/src/tls/connector.rs +4 -274
  77. koon-2.1.0/crates/core/src/tls/ech_grease.rs +104 -0
  78. {koon-1.2.2 → koon-2.1.0}/crates/core/src/tls/keylog.rs +0 -11
  79. {koon-1.2.2 → koon-2.1.0}/crates/core/src/tls/root_store/chrome_root_store.rs +127 -266
  80. koon-2.1.0/crates/core/src/tls/root_store/mod.rs +100 -0
  81. {koon-1.2.2 → koon-2.1.0}/crates/core/src/tls/session_cache.rs +0 -71
  82. {koon-1.2.2 → koon-2.1.0}/crates/core/src/tls/sigalgs.rs +0 -46
  83. koon-2.1.0/crates/core/src/util.rs +57 -0
  84. koon-2.1.0/crates/core/src/verify/references.rs +411 -0
  85. koon-2.1.0/crates/core/src/verify.rs +718 -0
  86. {koon-1.2.2 → koon-2.1.0}/crates/core/src/websocket.rs +29 -203
  87. {koon-1.2.2 → koon-2.1.0}/crates/python/Cargo.toml +2 -2
  88. {koon-1.2.2 → koon-2.1.0}/crates/python/src/lib.rs +277 -360
  89. {koon-1.2.2 → koon-2.1.0}/pyproject.toml +2 -8
  90. {koon-1.2.2 → koon-2.1.0}/python/koon/__init__.py +34 -20
  91. {koon-1.2.2 → koon-2.1.0}/python/koon/__init__.pyi +256 -195
  92. {koon-1.2.2 → koon-2.1.0}/python/koon/_adapter.py +1 -9
  93. {koon-1.2.2 → koon-2.1.0}/python/koon/httpx.py +19 -17
  94. {koon-1.2.2 → koon-2.1.0}/python/koon/httpx.pyi +14 -4
  95. {koon-1.2.2 → koon-2.1.0}/python/koon/requests.py +15 -8
  96. {koon-1.2.2 → koon-2.1.0}/python/koon/requests.pyi +14 -3
  97. koon-1.2.2/crates/core/Cargo.toml +0 -111
  98. koon-1.2.2/crates/core/src/client/blink_header_map.rs +0 -301
  99. koon-1.2.2/crates/core/src/client/client_hints.rs +0 -868
  100. koon-1.2.2/crates/core/src/client/cookies.rs +0 -516
  101. koon-1.2.2/crates/core/src/client/headers/order_tables.rs +0 -435
  102. koon-1.2.2/crates/core/src/client/headers/tests/basic.rs +0 -1341
  103. koon-1.2.2/crates/core/src/client/headers/tests/client_hints.rs +0 -652
  104. koon-1.2.2/crates/core/src/client/headers/tests/mod.rs +0 -6
  105. koon-1.2.2/crates/core/src/client/headers/tests/safari.rs +0 -969
  106. koon-1.2.2/crates/core/src/client/headers/tests/subresource.rs +0 -270
  107. koon-1.2.2/crates/core/src/client/headers/tests/support.rs +0 -71
  108. koon-1.2.2/crates/core/src/cookie.rs +0 -2010
  109. koon-1.2.2/crates/core/src/http1.rs +0 -1022
  110. koon-1.2.2/crates/core/src/profile/accept_language/tests.rs +0 -619
  111. koon-1.2.2/crates/core/src/profile/brave.rs +0 -188
  112. koon-1.2.2/crates/core/src/profile/chrome/client_hints.rs +0 -456
  113. koon-1.2.2/crates/core/src/profile/chrome/headers.rs +0 -284
  114. koon-1.2.2/crates/core/src/profile/chrome/tls.rs +0 -344
  115. koon-1.2.2/crates/core/src/profile/edge.rs +0 -259
  116. koon-1.2.2/crates/core/src/profile/safari/mod.rs +0 -1427
  117. koon-1.2.2/crates/core/src/profile/samsung.rs +0 -226
  118. koon-1.2.2/crates/core/src/proxy/ca.rs +0 -603
  119. koon-1.2.2/crates/core/src/tls/ech_grease.rs +0 -269
  120. koon-1.2.2/crates/core/src/tls/root_store/mod.rs +0 -278
  121. koon-1.2.2/crates/core/src/util.rs +0 -27
  122. koon-1.2.2/crates/core/src/verify.rs +0 -1965
  123. koon-1.2.2/crates/core/tests/chrome_root_store.rs +0 -492
  124. koon-1.2.2/crates/core/tests/client_hints.rs +0 -428
  125. koon-1.2.2/crates/core/tests/clienthello.rs +0 -706
  126. koon-1.2.2/crates/core/tests/common/h3.rs +0 -443
  127. koon-1.2.2/crates/core/tests/common/mod.rs +0 -256
  128. koon-1.2.2/crates/core/tests/cookies.rs +0 -206
  129. koon-1.2.2/crates/core/tests/fingerprint.rs +0 -84
  130. koon-1.2.2/crates/core/tests/h2_frames.rs +0 -745
  131. koon-1.2.2/crates/core/tests/h3_local.rs +0 -564
  132. koon-1.2.2/crates/core/tests/http_plain.rs +0 -989
  133. koon-1.2.2/crates/core/tests/https_proxy.rs +0 -366
  134. koon-1.2.2/crates/core/tests/https_rr.rs +0 -618
  135. koon-1.2.2/crates/core/tests/keylog.rs +0 -44
  136. koon-1.2.2/crates/core/tests/local_tls.rs +0 -245
  137. koon-1.2.2/crates/core/tests/network_browser_ua.rs +0 -46
  138. koon-1.2.2/crates/core/tests/network_doh.rs +0 -31
  139. koon-1.2.2/crates/core/tests/network_google_client_hints.rs +0 -85
  140. koon-1.2.2/crates/core/tests/network_http.rs +0 -298
  141. koon-1.2.2/crates/core/tests/network_pool.rs +0 -89
  142. koon-1.2.2/crates/core/tests/network_redirects.rs +0 -95
  143. koon-1.2.2/crates/core/tests/network_root_store.rs +0 -99
  144. koon-1.2.2/crates/core/tests/network_sessions.rs +0 -128
  145. koon-1.2.2/crates/core/tests/network_streaming.rs +0 -61
  146. koon-1.2.2/crates/core/tests/network_websocket.rs +0 -35
  147. koon-1.2.2/crates/core/tests/profile_roundtrip.rs +0 -524
  148. koon-1.2.2/crates/core/tests/proxy_server.rs +0 -979
  149. koon-1.2.2/crates/core/tests/quic_initial.rs +0 -1294
  150. koon-1.2.2/crates/core/tests/transport.rs +0 -116
  151. koon-1.2.2/crates/core/tests/websocket_h2.rs +0 -1271
  152. koon-1.2.2/crates/python/tests/conftest.py +0 -370
  153. koon-1.2.2/crates/python/tests/test_adapter_httpx.py +0 -290
  154. koon-1.2.2/crates/python/tests/test_adapter_requests.py +0 -229
  155. koon-1.2.2/crates/python/tests/test_cookies.py +0 -285
  156. koon-1.2.2/crates/python/tests/test_https_proxy.py +0 -164
  157. koon-1.2.2/crates/python/tests/test_network.py +0 -74
  158. koon-1.2.2/crates/python/tests/test_offline.py +0 -993
  159. koon-1.2.2/crates/python/tests/test_proxy.py +0 -173
  160. koon-1.2.2/crates/python/tests/test_streaming.py +0 -207
  161. koon-1.2.2/crates/python/tests/test_stub.py +0 -118
  162. koon-1.2.2/crates/python/tests/test_sync.py +0 -142
  163. {koon-1.2.2 → koon-2.1.0}/crates/core/src/http2/config.rs +0 -0
  164. {koon-1.2.2 → koon-2.1.0}/crates/core/src/http2/mod.rs +0 -0
  165. {koon-1.2.2 → koon-2.1.0}/crates/core/src/quic/mod.rs +0 -0
  166. {koon-1.2.2 → koon-2.1.0}/crates/core/src/tls/mod.rs +0 -0
  167. {koon-1.2.2 → koon-2.1.0}/python/koon/py.typed +0 -0
@@ -174,7 +174,7 @@ dependencies = [
174
174
  [[package]]
175
175
  name = "btls"
176
176
  version = "0.5.5"
177
- source = "git+https://github.com/scrape-hub/btls.git?tag=koon-1.0.0#aa1f43773da59efee4a001f162eb01651ec3a32b"
177
+ source = "git+https://github.com/scrape-hub/btls.git?tag=koon-2.0.0#90905f3f655f0e6cbda31605b445ec24c9832808"
178
178
  dependencies = [
179
179
  "bitflags",
180
180
  "btls-sys",
@@ -186,7 +186,7 @@ dependencies = [
186
186
  [[package]]
187
187
  name = "btls-sys"
188
188
  version = "0.5.5"
189
- source = "git+https://github.com/scrape-hub/btls.git?tag=koon-1.0.0#aa1f43773da59efee4a001f162eb01651ec3a32b"
189
+ source = "git+https://github.com/scrape-hub/btls.git?tag=koon-2.0.0#90905f3f655f0e6cbda31605b445ec24c9832808"
190
190
  dependencies = [
191
191
  "bindgen",
192
192
  "cmake",
@@ -1028,7 +1028,7 @@ dependencies = [
1028
1028
 
1029
1029
  [[package]]
1030
1030
  name = "koon-cli"
1031
- version = "1.2.2"
1031
+ version = "2.1.0"
1032
1032
  dependencies = [
1033
1033
  "bytes",
1034
1034
  "clap",
@@ -1042,7 +1042,7 @@ dependencies = [
1042
1042
 
1043
1043
  [[package]]
1044
1044
  name = "koon-core"
1045
- version = "1.2.2"
1045
+ version = "2.1.0"
1046
1046
  dependencies = [
1047
1047
  "base64",
1048
1048
  "brotli",
@@ -1060,6 +1060,7 @@ dependencies = [
1060
1060
  "httparse",
1061
1061
  "koon-core",
1062
1062
  "lru",
1063
+ "percent-encoding",
1063
1064
  "psl",
1064
1065
  "quinn",
1065
1066
  "quinn-btls",
@@ -1072,6 +1073,7 @@ dependencies = [
1072
1073
  "tokio-btls",
1073
1074
  "tokio-socks",
1074
1075
  "tokio-tungstenite",
1076
+ "toml",
1075
1077
  "tungstenite",
1076
1078
  "url",
1077
1079
  "webpki-root-certs",
@@ -1080,7 +1082,7 @@ dependencies = [
1080
1082
 
1081
1083
  [[package]]
1082
1084
  name = "koon-node"
1083
- version = "1.2.2"
1085
+ version = "2.1.0"
1084
1086
  dependencies = [
1085
1087
  "http",
1086
1088
  "indexmap",
@@ -1093,7 +1095,7 @@ dependencies = [
1093
1095
 
1094
1096
  [[package]]
1095
1097
  name = "koon-python"
1096
- version = "1.2.2"
1098
+ version = "2.1.0"
1097
1099
  dependencies = [
1098
1100
  "koon-core",
1099
1101
  "pyo3",
@@ -1503,7 +1505,7 @@ dependencies = [
1503
1505
  [[package]]
1504
1506
  name = "quinn-btls"
1505
1507
  version = "0.1.0"
1506
- source = "git+https://github.com/scrape-hub/btls.git?tag=koon-1.0.0#aa1f43773da59efee4a001f162eb01651ec3a32b"
1508
+ source = "git+https://github.com/scrape-hub/btls.git?tag=koon-2.0.0#90905f3f655f0e6cbda31605b445ec24c9832808"
1507
1509
  dependencies = [
1508
1510
  "btls",
1509
1511
  "btls-sys",
@@ -1794,6 +1796,15 @@ dependencies = [
1794
1796
  "zmij",
1795
1797
  ]
1796
1798
 
1799
+ [[package]]
1800
+ name = "serde_spanned"
1801
+ version = "1.1.2"
1802
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1803
+ checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c"
1804
+ dependencies = [
1805
+ "serde_core",
1806
+ ]
1807
+
1797
1808
  [[package]]
1798
1809
  name = "sha1"
1799
1810
  version = "0.10.6"
@@ -2004,7 +2015,7 @@ dependencies = [
2004
2015
  [[package]]
2005
2016
  name = "tokio-btls"
2006
2017
  version = "0.5.5"
2007
- source = "git+https://github.com/scrape-hub/btls.git?tag=koon-1.0.0#aa1f43773da59efee4a001f162eb01651ec3a32b"
2018
+ source = "git+https://github.com/scrape-hub/btls.git?tag=koon-2.0.0#90905f3f655f0e6cbda31605b445ec24c9832808"
2008
2019
  dependencies = [
2009
2020
  "btls",
2010
2021
  "tokio",
@@ -2058,6 +2069,45 @@ dependencies = [
2058
2069
  "tokio",
2059
2070
  ]
2060
2071
 
2072
+ [[package]]
2073
+ name = "toml"
2074
+ version = "0.9.12+spec-1.1.0"
2075
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2076
+ checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863"
2077
+ dependencies = [
2078
+ "indexmap",
2079
+ "serde_core",
2080
+ "serde_spanned",
2081
+ "toml_datetime",
2082
+ "toml_parser",
2083
+ "toml_writer",
2084
+ "winnow 0.7.15",
2085
+ ]
2086
+
2087
+ [[package]]
2088
+ name = "toml_datetime"
2089
+ version = "0.7.5+spec-1.1.0"
2090
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2091
+ checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347"
2092
+ dependencies = [
2093
+ "serde_core",
2094
+ ]
2095
+
2096
+ [[package]]
2097
+ name = "toml_parser"
2098
+ version = "1.1.5+spec-1.1.0"
2099
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2100
+ checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c"
2101
+ dependencies = [
2102
+ "winnow 1.0.4",
2103
+ ]
2104
+
2105
+ [[package]]
2106
+ name = "toml_writer"
2107
+ version = "1.1.3+spec-1.1.0"
2108
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2109
+ checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770"
2110
+
2061
2111
  [[package]]
2062
2112
  name = "tracing"
2063
2113
  version = "0.1.44"
@@ -2525,6 +2575,18 @@ version = "0.53.1"
2525
2575
  source = "registry+https://github.com/rust-lang/crates.io-index"
2526
2576
  checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"
2527
2577
 
2578
+ [[package]]
2579
+ name = "winnow"
2580
+ version = "0.7.15"
2581
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2582
+ checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
2583
+
2584
+ [[package]]
2585
+ name = "winnow"
2586
+ version = "1.0.4"
2587
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2588
+ checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81"
2589
+
2528
2590
  [[package]]
2529
2591
  name = "wit-bindgen"
2530
2592
  version = "0.51.0"
@@ -6,7 +6,7 @@ exclude = [
6
6
  ]
7
7
 
8
8
  [workspace.package]
9
- version = "1.2.2"
9
+ version = "2.1.0"
10
10
  edition = "2024"
11
11
  rust-version = "1.85"
12
12
  license = "MIT"
@@ -19,14 +19,9 @@ strip = true
19
19
  lto = true
20
20
  codegen-units = 1
21
21
 
22
- # BoringSSL is built by CMake with the build type cmake-rs derives from this
23
- # package's opt-level; 0 gives Debug, which makes every handshake several
24
- # times slower. Keep it optimised in development builds too.
25
22
  [profile.dev.package.btls-sys]
26
23
  opt-level = 3
27
24
 
28
- # quinn-btls and h3-quinn build on the crates.io releases of quinn and h3;
29
- # koon's forks of both replace them in the whole dependency graph.
30
25
  [patch.crates-io]
31
26
  quinn = { git = "https://github.com/scrape-hub/quinn.git", tag = "koon-1.0.0" }
32
27
  quinn-proto = { git = "https://github.com/scrape-hub/quinn.git", tag = "koon-1.0.0" }
@@ -1,12 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: koon
3
- Version: 1.2.2
3
+ Version: 2.1.0
4
4
  Classifier: Development Status :: 5 - Production/Stable
5
5
  Classifier: Programming Language :: Rust
6
6
  Classifier: Programming Language :: Python :: Implementation :: CPython
7
7
  Classifier: Programming Language :: Python :: 3
8
- Classifier: Programming Language :: Python :: 3.9
9
- Classifier: Programming Language :: Python :: 3.10
10
8
  Classifier: Programming Language :: Python :: 3.11
11
9
  Classifier: Programming Language :: Python :: 3.12
12
10
  Classifier: Programming Language :: Python :: 3.13
@@ -30,7 +28,7 @@ Summary: Browser-impersonating HTTP client: TLS, HTTP/2 and HTTP/3 fingerprints
30
28
  Keywords: tls-fingerprint,browser-impersonation,http2-fingerprint,anti-bot,web-scraping,akamai,cloudflare,ja3,ja4,http-client,proxy,scraping,stealth,curl-impersonate,boringssl
31
29
  Author: scrape-hub
32
30
  License: MIT
33
- Requires-Python: >=3.9
31
+ Requires-Python: >=3.11
34
32
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
35
33
  Project-URL: Changelog, https://github.com/scrape-hub/koon/blob/master/CHANGELOG.md
36
34
  Project-URL: Documentation, https://github.com/scrape-hub/koon#quick-start
@@ -43,7 +41,6 @@ Project-URL: Repository, https://github.com/scrape-hub/koon
43
41
  [![npm](https://img.shields.io/npm/v/koonjs)](https://www.npmjs.com/package/koonjs)
44
42
  [![PyPI](https://img.shields.io/pypi/v/koon)](https://pypi.org/project/koon/)
45
43
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/scrape-hub/koon/blob/master/LICENSE)
46
- [![CI](https://img.shields.io/github/actions/workflow/status/scrape-hub/koon/ci.yml?label=CI)](https://github.com/scrape-hub/koon/actions)
47
44
 
48
45
  An HTTP client that impersonates real browsers at the TLS, HTTP/2, and HTTP/3 fingerprint level.
49
46
 
@@ -58,7 +55,7 @@ Every binding uses the same fingerprint engine, so a profile behaves the same fr
58
55
  npm install koonjs
59
56
  ```
60
57
 
61
- **Python**
58
+ **Python** (3.11 or newer)
62
59
  ```bash
63
60
  pip install koon
64
61
  pip install "koon[httpx]" # with the httpx transport's dependency
@@ -68,17 +65,17 @@ pip install "koon[requests]" # with the requests adapter's dependency
68
65
  **R**
69
66
  ```r
70
67
  # Windows, or macOS on Apple silicon, with R 4.6: the prebuilt package of the release
71
- install.packages("https://github.com/scrape-hub/koon/releases/download/v1.2.2/koon_1.2.2.zip", repos = NULL) # Windows
72
- install.packages("https://github.com/scrape-hub/koon/releases/download/v1.2.2/koon_1.2.2.tgz", repos = NULL) # macOS
68
+ install.packages("https://github.com/scrape-hub/koon/releases/download/v2.1.0/koon_2.1.0.zip", repos = NULL) # Windows
69
+ install.packages("https://github.com/scrape-hub/koon/releases/download/v2.1.0/koon_2.1.0.tgz", repos = NULL) # macOS
73
70
 
74
- # Other platforms and R versions build from source: Rust 1.85+ and CMake, on
75
- # Windows also Rtools, LLVM and `rustup target add x86_64-pc-windows-gnu`
71
+ # Other platforms and R versions build from source: Rust 1.85+ and CMake, on Windows
72
+ # also Rtools and `rustup target add x86_64-pc-windows-gnu`
76
73
  remotes::install_github("scrape-hub/koon", subdir = "crates/r")
77
74
  ```
78
75
 
79
76
  **CLI**: download from [Releases](https://github.com/scrape-hub/koon/releases), or:
80
77
  ```bash
81
- cargo install --git https://github.com/scrape-hub/koon koon-cli
78
+ cargo install --locked --git https://github.com/scrape-hub/koon koon-cli
82
79
  ```
83
80
 
84
81
  **Claude Code**: [koon-mcp](https://github.com/scrape-hub/koon-mcp) fetches web pages and PDFs for Claude through koon.
@@ -149,7 +146,6 @@ Every fingerprint change of every browser is checked against captures from the r
149
146
  |---|---|---|---|
150
147
  | indeed.com | 403 | 403 | 200 |
151
148
  | bloomberg.com | 403 | 403 | 200 |
152
- | reuters.com | 401 | 401 | 200 |
153
149
  | tripadvisor.com | 403 | 403 | 200 |
154
150
  | expedia.com | 429 | 429 | 200 |
155
151
  | stockx.com | 403 | 403 | 200 |
@@ -170,28 +166,28 @@ Match the language to the IP as well. koon asks for English pages unless you set
170
166
 
171
167
  | Browser | Versions | Platforms | Profiles |
172
168
  |---------|----------|-----------|----------|
173
- | Chrome | 131-155 | Windows, macOS, Linux, Android | 100 |
174
- | Firefox | 135-158 | Windows, macOS, Linux, Android | 96 |
169
+ | Chrome | 131-158 | Windows, macOS, Linux, Android | 112 |
170
+ | Firefox | 135-159 | Windows, macOS, Linux, Android | 100 |
175
171
  | Safari | 15.6-27.0 | macOS, iOS | 41 |
176
- | Edge | 131-154 | Windows, macOS, Android | 72 |
177
- | Opera | 124-136 | Windows, macOS, Linux | 39 |
172
+ | Edge | 131-157 | Windows, macOS, Android | 81 |
173
+ | Opera | 124-139 | Windows, macOS, Linux | 48 |
178
174
  | Opera Mobile | 102 | Android | 1 |
179
- | Brave | 153-154 (1.95, 1.96) | Windows, macOS, Linux, Android | 8 |
175
+ | Brave | 153-157 (1.95 to 1.99) | Windows, macOS, Linux, Android | 20 |
180
176
  | Samsung Internet | 29-30 | Android | 2 |
181
177
  | OkHttp | 4, 5 | Android | 2 |
182
178
 
183
- **361 profiles** total. `koon --list-browsers`, `Koon.browsers()` (Node), `koon.browsers()` (Python) and `koon_browsers()` (R) list them all.
179
+ **407 profiles** total. `koon --list-browsers`, `Koon.browsers()` (Node), `koon.browsers()` (Python) and `koon_browsers()` (R) list them all.
184
180
 
185
181
  ### Profile naming
186
182
 
187
- Format: `{browser}{version}{-os}`. All parts but the browser name are optional, dash included (`chrome154-macos` or `chrome154macos`). Omit the version for the latest of any browser. Without an OS, desktop browsers default to Windows except Safari (macOS); Brave is named by the Chromium version it reports (`brave154` = Brave 1.96).
183
+ Format: `{browser}{version}{-os}`. All parts but the browser name are optional, dash included (`chrome154-macos` or `chrome154macos`). Omit the version for the latest of any browser. Without an OS, desktop browsers default to Windows except Safari (macOS); Brave is named by the Chromium version it reports (`brave157` = Brave 1.99).
188
184
 
189
185
  | Browser | Example profiles |
190
186
  |---------|-------------------|
191
- | Chrome, Firefox, Opera | `chrome155`, `-windows`, `-macos`, `-linux` |
192
- | Edge, Brave | `edge154`, `-windows`, `-macos` (Brave also `-linux`) |
187
+ | Chrome, Firefox, Opera | `chrome158`, `-windows`, `-macos`, `-linux` |
188
+ | Edge, Brave | `edge157`, `-windows`, `-macos` (Brave also `-linux`) |
193
189
  | Safari | `safari270-macos` |
194
- | Chrome/Firefox/Edge/Brave Mobile (Android) | `chrome-mobile155`, `firefox-mobile158`, `edge-mobile154`, `brave-mobile154` |
190
+ | Chrome/Firefox/Edge/Brave Mobile (Android) | `chrome-mobile158`, `firefox-mobile159`, `edge-mobile157`, `brave-mobile157` |
195
191
  | Safari Mobile (iOS) | `safari-mobile270` |
196
192
  | Samsung Internet, Opera Mobile (Android) | `samsung30`, `opera-mobile102` |
197
193
  | OkHttp | `okhttp4`, `okhttp5` (`-android` suffix optional) |
@@ -204,15 +200,15 @@ Chrome Mobile and Firefox Mobile send their desktop counterpart's fingerprint wi
204
200
 
205
201
  - **Fingerprints on every layer**: TLS, HTTP/2 and HTTP/3 as in the table above; header order, casing and values of navigations, form posts, fetch() calls and WebSocket handshakes, with cookie, referer, origin and your own headers where the browser puts them; the client hints Chromium sends when a site asks for them
206
202
  - **HTTP/3 like the browser**: found through Alt-Svc or, on the first connection, the DNS HTTPS record; racing TCP like Chrome or straight to QUIC like Safari, with fallback to TCP; 0-RTT on resumed connections
207
- - **Encrypted Client Hello and DNS**: real ECH from DNS HTTPS records over TCP and QUIC, read over DNS-over-HTTPS (Cloudflare, Google) or, as Chrome and Firefox do by default, with a plain query to the system's nameserver; ECH GREASE in the browser's shape otherwise (needs the `doh` feature in Rust)
208
- - **Chrome's field trials**: like a slice of real Chrome installations, a client may be enrolled in Chrome's handshake-padding trial; pin the group with `serverPadding`, `server_padding` or `--server-padding`
203
+ - **Encrypted Client Hello and DNS**: real ECH from DNS HTTPS records over TCP and QUIC, read over DNS-over-HTTPS (Cloudflare, Google) or, as Chrome and Firefox do by default, with a plain query to the system's nameserver; ECH GREASE in the browser's shape otherwise
204
+ - **Chrome's field trials**: while a Chrome field trial runs, a client may be enrolled like a slice of real Chrome installations; the handshake-padding trial ran until 2026-10-30, and `serverPadding`, `server_padding` or `--server-padding` still pin one of its groups
209
205
  - **Fingerprint self-test**: `koon verify` checks your installed koon against the real browsers' fingerprints (see [below](#fingerprint-self-test))
210
206
  - **TLS sessions and certificates**: session tickets per origin, used once, over TCP and QUIC; certificates verified against Mozilla's roots plus every trust anchor of the Chrome Root Store
211
207
  - **Cookies and sessions**: a jar with domain, path, expiry, Secure, HttpOnly, SameSite, `__Host-`/`__Secure-` prefixes and public-suffix protection; import and export as Playwright/CDP cookie objects; save and load cookies and TLS tickets as JSON
212
- - **Proxies**: HTTP, HTTPS and SOCKS5, round-robin rotation, custom CONNECT headers; retries switch the proxy and never send a POST twice; HTTP/3 goes direct
208
+ - **Proxies**: HTTP, HTTPS and SOCKS5 (`socks5://` or `socks5h://`, both resolved by the proxy), round-robin rotation, custom CONNECT headers; retries switch the proxy and never send a POST twice; through a proxy, koon does not use HTTP/3
213
209
  - **MITM proxy server**: re-sends any program's traffic through koon; loopback only unless allowed, optional authentication, capped connections
214
210
  - **WebSocket**: `wss://` and `ws://` with the browser's handshake, over HTTP/2 where the browser uses it; send and receive concurrently
215
- - **Streaming**: response bodies read on demand with backpressure, uploads from a stream, multipart forms with the browser's boundary format
211
+ - **Streaming**: response bodies read on demand with backpressure, uploads from a stream (Rust, and the CLI for files over 16 MiB), multipart forms with the browser's boundary format
216
212
  - **Hooks**: `onRequest`, `onResponse` and `onRedirect` for logging, guards and stopping a redirect to a captcha, per client or per request
217
213
  - **Per-request options**: headers, timeout, proxy and redirect following without touching the client
218
214
  - **Response body cap**: 100 MiB by default, decompression bombs included
@@ -223,7 +219,7 @@ Chrome Mobile and Firefox Mobile send their desktop counterpart's fingerprint wi
223
219
  - **Key logging**: `SSLKEYLOGFILE` writes the TLS secrets (TCP, QUIC and DoH) for Wireshark
224
220
  - **Custom profiles**: export a profile as JSON, change it and load it back (see [Custom profiles](#custom-profiles))
225
221
  - **Drop-in adapters**: an httpx transport, a requests adapter and a `fetch()` for Node; `KoonSync`, a blocking Python client
226
- - **Structured errors**: a machine-readable code on every error (`TIMEOUT`, `TLS_ERROR`, `PROXY_ERROR`, ...)
222
+ - **Structured errors**: a machine-readable code on every error (`TIMEOUT`, `TLS_ERROR`, `PROXY_ERROR`, ...), and for a request's transport failure the phase it failed in (`connect`, `request` or `body`)
227
223
 
228
224
  ## Usage
229
225
 
@@ -373,10 +369,12 @@ console.log(blockedBy(page, await page.text())); // null, or e.g. 'cloudflare'
373
369
 
374
370
  Only the headers you set are added to the browser's, where the browser puts
375
371
  them; Node's own fetch headers (`user-agent: node`, ...) are never sent.
376
- Redirects (`follow`, `manual`, `error`) and cookies are handled by the koon
377
- client, `signal` cancels the request or its body, and failures reject with
378
- `TypeError('fetch failed')` whose `cause` carries the koon error `code`. The
379
- details are in `index.d.ts`.
372
+ A plain GET goes out as a navigation and a POST of a `URLSearchParams` or
373
+ `FormData` body as a form submission, unless you set an `Accept` without
374
+ `text/html`; anything else is a fetch() call. Redirects (`follow`, `manual`,
375
+ `error`) and cookies are handled by the koon client, `signal` cancels the
376
+ request or its body, and failures reject with `TypeError('fetch failed')`
377
+ whose `cause` carries the koon error `code`. The details are in `index.d.ts`.
380
378
 
381
379
  ### Python
382
380
 
@@ -516,7 +514,8 @@ session.mount("https://", KoonAdapter("chrome"))
516
514
 
517
515
  The library keeps its part: redirects, cookies (its jar; koon's is off),
518
516
  auth, hooks, timeouts, and with requests the proxies from `proxies=` and the
519
- environment. Its own default headers, such as `User-Agent: python-httpx/x.y`,
517
+ environment. The redirects it follows still go out as the browser's: a
518
+ fetch() stays a fetch(), and Referer and Origin follow the redirect chain. Its own default headers, such as `User-Agent: python-httpx/x.y`,
520
519
  `python-requests/x.y` and `Accept: */*`, are dropped, so the browser's go out
521
520
  in the browser's order; every header you set is sent where the browser puts
522
521
  it. `files=` uploads go out as the browser encodes multipart forms (its
@@ -587,10 +586,39 @@ resp <- client$get("https://httpbin.org/cookies")
587
586
  # Clear cookies (keeps TLS sessions and connection pool)
588
587
  client$clear_cookies()
589
588
 
590
- # Session save/load
589
+ # Session save/load, as JSON or to a file
591
590
  json <- client$save_session()
592
591
  client2 <- Koon$new("chrome")
593
592
  client2$load_session(json)
593
+ client$save_session_to_file("session.json")
594
+ client2$load_session_from_file("session.json")
595
+
596
+ # Multipart upload
597
+ resp <- client$post_multipart("https://httpbin.org/post", list(
598
+ list(name = "field", value = "text"),
599
+ list(name = "file", file_data = as.raw(c(0x89, 0x50, 0x4e, 0x47)),
600
+ filename = "photo.png", content_type = "image/png")
601
+ ))
602
+
603
+ # Streaming: the head first, then the body chunk by chunk (raw vectors)
604
+ resp <- client$request_streaming("GET", "https://httpbin.org/stream/5")
605
+ while (!is.null(chunk <- resp$stream$next_chunk())) cat(rawToChar(chunk))
606
+
607
+ # WebSocket
608
+ ws <- client$websocket("wss://ws.postman-echo.com/raw")
609
+ ws$send("hello")
610
+ ws$receive() # list(type = "text", data = "hello")
611
+ ws$close()
612
+
613
+ # A request's transport failure names how far it got
614
+ err <- tryCatch(client$get("https://10.255.255.1/", timeout = 1), koon_error = identity)
615
+ err$code # "TIMEOUT"
616
+ err$phase # "connect": nothing was sent, so sending it again cannot repeat it
617
+
618
+ # Local MITM proxy for other programs
619
+ proxy <- KoonProxy$start(browser = "firefox", listen_addr = "127.0.0.1:8080")
620
+ proxy$url() # "http://127.0.0.1:8080"
621
+ proxy$shutdown()
594
622
 
595
623
  # Export profile as JSON
596
624
  client$export_profile()
@@ -688,8 +716,9 @@ one fits (6 host not resolved, 7 connection failed, 22 HTTP error with
688
716
  ```toml
689
717
  [dependencies]
690
718
  koon-core = { git = "https://github.com/scrape-hub/koon.git" }
691
- # DNS-over-HTTPS and ECH from DNS HTTPS records need the `doh` feature:
692
- # koon-core = { git = "https://github.com/scrape-hub/koon.git", features = ["doh"] }
719
+ # Without the default `doh` feature, profiles find neither HTTP/3 nor real ECH
720
+ # from DNS HTTPS records:
721
+ # koon-core = { git = "https://github.com/scrape-hub/koon.git", default-features = false, features = ["socks"] }
693
722
  ```
694
723
 
695
724
  BoringSSL is built with the optimisation level of your profile. Debug builds
@@ -756,17 +785,18 @@ async fn main() -> Result<(), koon_core::Error> {
756
785
  fingerprints of the real browsers. Each profile connects to
757
786
  [tls.browserleaks.com](https://tls.browserleaks.com/json) (tls.peet.ws if that
758
787
  fails), which reports the JA4, JA3N, JA3 and Akamai HTTP/2 fingerprint it sees.
759
- Where a QUIC reference exists (Chrome 134-155, Edge 153-154, Opera 136, Brave, Opera Mobile,
760
- Firefox and the Safari releases whose transport parameters were captured;
788
+ Where a QUIC reference exists (Chrome 134-158, Edge 153-157, Opera 136-139, Brave, Opera Mobile,
789
+ Firefox 155-159 on the desktop and 146-159 on Android, and the Safari releases whose transport
790
+ parameters were captured;
761
791
  Samsung Internet uses no HTTP/3), the
762
792
  check also goes over HTTP/3 to quic.browserleaks.com for the QUIC JA4. Every
763
793
  field is compared with the value captured from the real browser.
764
794
 
765
795
  ```
766
796
  $ koon verify -b firefox
767
- firefox -> firefox158-windows: match
768
- reference firefox-156: Firefox 156-158 (without ffdhe groups): real Firefox 156.0.1 captures; 157 and 158 from the 157.0 and 158.0b5 betas (ClientHello capture and tls.browserleaks.com)
769
- reference firefox-quic: QUIC JA4 of real Firefox 155.0.1, 157.0 beta and 158.0b5 QUIC ClientHellos (157 and 158 also from quic.browserleaks.com)
797
+ firefox -> firefox159-windows: match
798
+ reference firefox-156: Firefox 156-159 (without ffdhe groups): real Firefox 156.0.1 and 159.0.1 captures; 157 and 158 from the 157.0 and 158.0b5 betas (ClientHello capture and tls.browserleaks.com)
799
+ reference firefox-quic: QUIC JA4 of real Firefox 155.0.1, 157.0 beta, 158.0b5 and 159.0.1 QUIC ClientHellos (157 to 159 also from quic.browserleaks.com)
770
800
  service https://tls.browserleaks.com/json
771
801
  http3 https://quic.browserleaks.com/?minify=1
772
802
  ja4 match t13d1517h2_8daaf6152771_3cbfd9057e0d
@@ -816,6 +846,11 @@ report = koon.verify("firefox")
816
846
  print(report["outcome"], [f for f in report["fields"] if f["status"] == "mismatch"])
817
847
  ```
818
848
 
849
+ ```r
850
+ report <- koon_verify("safari", doh = "cloudflare")
851
+ report$outcome
852
+ ```
853
+
819
854
  In Rust, `koon_core::verify::verify("chrome", None)` returns a `VerifyReport`;
820
855
  `verify_with` checks with a client you built (proxy, DNS, local address), and
821
856
  `references_for` gives the reference values of a profile.
@@ -842,6 +877,7 @@ proxy takes a profile the same way (`koon proxy --profile`).
842
877
  | `quic` | Optional; without it the profile does not use HTTP/3. The QUIC stack whose wire behaviour it follows (`chromium`, `neqo` or `apple`), transport parameters, HTTP/3 SETTINGS and an optional QUIC ClientHello (`tls`) |
843
878
  | `headers` | The headers of a navigation and their values |
844
879
  | `header_family` | Optional: `chromium`, `firefox`, `safari`, `okhttp` or `other`, whose header order and browser rules requests follow; detected from the headers when missing |
880
+ | `multipart` | Optional: `webkit`, `gecko`, `okhttp4` or `okhttp5`, how the client encodes multipart bodies; follows `header_family` when missing |
845
881
  | `ua_client_hints` | Optional, for Chromium profiles: the high-entropy client hint values (`full_version`, `full_version_list`, `platform_version`, `architecture`, `bitness`, `model`, `wow64`, `form_factors`) and the device's `device_memory_mib`, `device_pixel_ratio` and `viewport_px` (`[width, height]` in device pixels), sent when a site asks for them |
846
882
 
847
883
  The optional `http2` keys reproduce a browser's frame layout; a key left out
@@ -889,10 +925,15 @@ Key dependencies:
889
925
  Only needed if you want to build koon yourself instead of using the published packages.
890
926
 
891
927
  **Requirements:**
892
- - Rust 1.85+
928
+ - Rust 1.85+ (1.88+ for the Node.js addon)
893
929
  - CMake
894
- - NASM (Windows, optional: without it BoringSSL is built from portable C, which is slower)
930
+ - NASM on Windows x64 (or `BORING_BSSL_NO_ASM=1` for BoringSSL's slower portable C)
895
931
  - C compiler: MSVC (Windows), GCC or Clang (Linux/macOS)
932
+ - libclang only on a platform without prebuilt BoringSSL bindings (other than Linux, macOS and
933
+ Windows on x64 and arm64), for bindgen
934
+
935
+ The same applies to `pip install koon` on a platform without a prebuilt wheel, which builds from
936
+ the source distribution.
896
937
 
897
938
  ```bash
898
939
  # Core library