reqrio 0.2.0b2__tar.gz → 0.3.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 (44) hide show
  1. reqrio-0.3.0/PKG-INFO +190 -0
  2. reqrio-0.3.0/README.md +180 -0
  3. {reqrio-0.2.0b2 → reqrio-0.3.0}/pyproject.toml +29 -29
  4. reqrio-0.3.0/reqrio/__init__.py +88 -0
  5. reqrio-0.3.0/reqrio/_finger.py +140 -0
  6. reqrio-0.3.0/reqrio/_session.py +322 -0
  7. {reqrio-0.2.0b2 → reqrio-0.3.0}/reqrio/alpn.py +6 -9
  8. {reqrio-0.2.0b2 → reqrio-0.3.0}/reqrio/b64.py +49 -49
  9. {reqrio-0.2.0b2 → reqrio-0.3.0}/reqrio/bindings.py +252 -190
  10. {reqrio-0.2.0b2 → reqrio-0.3.0}/reqrio/cipher.py +86 -86
  11. {reqrio-0.2.0b2 → reqrio-0.3.0}/reqrio/hash.py +79 -79
  12. {reqrio-0.2.0b2 → reqrio-0.3.0}/reqrio/hooks/hook-reqrio.py +2 -2
  13. reqrio-0.3.0/reqrio/libreqrio.so +0 -0
  14. {reqrio-0.2.0b2 → reqrio-0.3.0}/reqrio/method.py +13 -13
  15. {reqrio-0.2.0b2 → reqrio-0.3.0}/reqrio/rcode.py +48 -48
  16. reqrio-0.3.0/reqrio/reqrio.dll +0 -0
  17. reqrio-0.3.0/reqrio/response.py +67 -0
  18. {reqrio-0.2.0b2 → reqrio-0.3.0}/reqrio/stream.py +67 -60
  19. reqrio-0.3.0/reqrio/util.py +54 -0
  20. {reqrio-0.2.0b2 → reqrio-0.3.0}/reqrio/websocket.py +79 -79
  21. reqrio-0.3.0/reqrio.egg-info/PKG-INFO +190 -0
  22. {reqrio-0.2.0b2 → reqrio-0.3.0}/reqrio.egg-info/SOURCES.txt +2 -2
  23. {reqrio-0.2.0b2 → reqrio-0.3.0}/setup.cfg +4 -4
  24. reqrio-0.3.0/setup.py +13 -0
  25. {reqrio-0.2.0b2 → reqrio-0.3.0}/tests/test_cipher.py +42 -42
  26. reqrio-0.3.0/tests/test_session.py +17 -0
  27. {reqrio-0.2.0b2 → reqrio-0.3.0}/tests/test_websocket.py +21 -21
  28. reqrio-0.2.0b2/PKG-INFO +0 -150
  29. reqrio-0.2.0b2/README.md +0 -140
  30. reqrio-0.2.0b2/reqrio/__init__.py +0 -70
  31. reqrio-0.2.0b2/reqrio/header.py +0 -40
  32. reqrio-0.2.0b2/reqrio/libreqrio.so +0 -0
  33. reqrio-0.2.0b2/reqrio/reqrio.dll +0 -0
  34. reqrio-0.2.0b2/reqrio/response.py +0 -18
  35. reqrio-0.2.0b2/reqrio/session.py +0 -189
  36. reqrio-0.2.0b2/reqrio/util.py +0 -25
  37. reqrio-0.2.0b2/reqrio.egg-info/PKG-INFO +0 -150
  38. reqrio-0.2.0b2/setup.py +0 -13
  39. reqrio-0.2.0b2/tests/test_session.py +0 -66
  40. {reqrio-0.2.0b2 → reqrio-0.3.0}/MANIFEST.in +0 -0
  41. {reqrio-0.2.0b2 → reqrio-0.3.0}/reqrio/hooks/__init__.py +0 -0
  42. {reqrio-0.2.0b2 → reqrio-0.3.0}/reqrio.egg-info/dependency_links.txt +0 -0
  43. {reqrio-0.2.0b2 → reqrio-0.3.0}/reqrio.egg-info/entry_points.txt +0 -0
  44. {reqrio-0.2.0b2 → reqrio-0.3.0}/reqrio.egg-info/top_level.txt +0 -0
reqrio-0.3.0/PKG-INFO ADDED
@@ -0,0 +1,190 @@
1
+ Metadata-Version: 2.4
2
+ Name: reqrio
3
+ Version: 0.3.0
4
+ Summary: A lightweight, high concurrency HTTP request library
5
+ Author-email: xllgl2017 <xinlanxi2017@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/xllgl2017/reqrio/tree/main/reqrio
8
+ Requires-Python: >=3.9
9
+ Description-Content-Type: text/markdown
10
+
11
+ # reqrio-py
12
+
13
+ `reqrio-py` is the Python binding for `reqrio`, a lightweight and high-concurrency HTTP request library.
14
+
15
+ ## Features
16
+
17
+ - High-performance HTTP/HTTPS request engine with low-copy semantics.
18
+ - Built-in TLS support using BoringSSL.
19
+ - Supports HTTP/1.1 and HTTP/2.0 via `ALPN`.
20
+ - Supports custom headers, cookies, timeouts, proxies, and certificate verification.
21
+ - Supports form data, JSON, text, bytes, and multipart file uploads.
22
+ - Includes a WebSocket client wrapper.
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ pip install reqrio
28
+ ```
29
+
30
+ > Python 3.9 or newer is required.
31
+
32
+ ## Quick Start
33
+
34
+ ```python
35
+ import reqrio
36
+
37
+ session = reqrio.Session(
38
+ headers={
39
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)...",
40
+ "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
41
+ },
42
+ alpn=reqrio.ALPN.HTTP20,
43
+ verify=True,
44
+ )
45
+
46
+ session.set_timeout(3000, 3000, 3000, 30000)
47
+
48
+ response = session.get("https://www.example.com")
49
+ print(response.statue_code())
50
+ print(response.text())
51
+
52
+ session.close()
53
+ ```
54
+
55
+ ## API Reference
56
+
57
+ ### `reqrio.Session`
58
+
59
+ Create a session:
60
+
61
+ ```python
62
+ session = reqrio.Session(
63
+ headers=None,
64
+ alpn=reqrio.ALPN.HTTP11,
65
+ verify=True,
66
+ proxy=None,
67
+ key_log=None,
68
+ ja3=None,
69
+ ja4=None,
70
+ client_hello=None,
71
+ random_tls=False,
72
+ custom_tls=None,
73
+ token="",
74
+ )
75
+ ```
76
+
77
+ Common methods:
78
+
79
+ - `session.set_headers(headers: dict)`
80
+ - `session.add_header(name: str, value: str)`
81
+ - `session.remove_header(name: str)`
82
+ - `session.set_timeout(connect, read, write, handle, connect_times=3, handle_times=3)`
83
+ - `session.set_cookie(cookie: str)`
84
+ - `session.add_cookie(name: str, value: str)`
85
+ - `session.get(url, params=None, data=None, json=None, bytes=None, text=None, **kwargs)`
86
+ - `session.post(url, params=None, data=None, json=None, bytes=None, text=None, **kwargs)`
87
+ - `session.open_stream(method, url, params=None, data=None, json=None, bytes=None, text=None, **kwargs)`
88
+ - `session.close()`
89
+
90
+ ### Helper functions
91
+
92
+ `reqrio` also offers shortcut functions for single requests:
93
+
94
+ ```python
95
+ resp = reqrio.get(
96
+ "https://www.example.com",
97
+ headers={"User-Agent": "..."},
98
+ params={"q": "test"},
99
+ )
100
+ print(resp.statue_code())
101
+
102
+ resp = reqrio.post(
103
+ "https://www.example.com/api",
104
+ headers={"Content-Type": "application/json"},
105
+ json={"key": "value"},
106
+ )
107
+ print(resp.statue_code())
108
+ ```
109
+
110
+ ### WebSocket support
111
+
112
+ ```python
113
+ from reqrio import WebSocket, WsOpCode
114
+
115
+ headers = {
116
+ "Origin": "https://example.com",
117
+ "User-Agent": "Mozilla/5.0...",
118
+ }
119
+
120
+ ws = WebSocket(
121
+ "wss://example.com/",
122
+ uri="wss://example.com/api/ws",
123
+ headers=headers,
124
+ )
125
+ ws.open()
126
+
127
+ while True:
128
+ frame = ws.read()
129
+ if frame.opcode == WsOpCode.PING:
130
+ ws.write(WsOpCode.PONG, frame.payload)
131
+ else:
132
+ print(frame.payload.decode("utf-8"))
133
+
134
+ ws.close()
135
+ ```
136
+
137
+ ## Request Body Types
138
+
139
+ Supported request bodies:
140
+
141
+ - `data={...}` for form data
142
+ - `json={...}` for JSON payloads
143
+ - `text="..."` for plain text
144
+ - `bytes=b"..."` for raw bytes
145
+ - `files=[...]` for multipart file upload
146
+
147
+ File upload example:
148
+
149
+ ```python
150
+ files = [
151
+ {
152
+ "path": "./example.txt",
153
+ "field_name": "file",
154
+ "filetype": "text/plain",
155
+ }
156
+ ]
157
+
158
+ response = session.post(
159
+ "https://www.example.com/upload",
160
+ data={"name": "test"},
161
+ files=files,
162
+ )
163
+ print(response.statue_code())
164
+ ```
165
+
166
+ ## TLS Fingerprinting and Advanced Options
167
+
168
+ `reqrio.Session` supports advanced TLS configuration:
169
+
170
+ - `ja3`: JA3 fingerprint string
171
+ - `ja4`: JA4 fingerprint string
172
+ - `client_hello`: raw TLS ClientHello bytes
173
+ - `random_tls`: random TLS fingerprint
174
+ - `custom_tls`: custom TLS configuration dictionary
175
+ - `token`: fingerprint authentication token
176
+
177
+ Additional options:
178
+
179
+ - `verify=False` to disable certificate verification
180
+ - `proxy` for HTTP/SOCKS proxy support
181
+ - `key_log` to save TLS key material for debugging
182
+
183
+ ## Notes
184
+
185
+ - `reqrio-py` is designed to reuse connections when possible.
186
+ - Be sure to call `session.close()` to release resources.
187
+
188
+ ## License
189
+
190
+ Apache-2.0
reqrio-0.3.0/README.md ADDED
@@ -0,0 +1,180 @@
1
+ # reqrio-py
2
+
3
+ `reqrio-py` is the Python binding for `reqrio`, a lightweight and high-concurrency HTTP request library.
4
+
5
+ ## Features
6
+
7
+ - High-performance HTTP/HTTPS request engine with low-copy semantics.
8
+ - Built-in TLS support using BoringSSL.
9
+ - Supports HTTP/1.1 and HTTP/2.0 via `ALPN`.
10
+ - Supports custom headers, cookies, timeouts, proxies, and certificate verification.
11
+ - Supports form data, JSON, text, bytes, and multipart file uploads.
12
+ - Includes a WebSocket client wrapper.
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ pip install reqrio
18
+ ```
19
+
20
+ > Python 3.9 or newer is required.
21
+
22
+ ## Quick Start
23
+
24
+ ```python
25
+ import reqrio
26
+
27
+ session = reqrio.Session(
28
+ headers={
29
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)...",
30
+ "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
31
+ },
32
+ alpn=reqrio.ALPN.HTTP20,
33
+ verify=True,
34
+ )
35
+
36
+ session.set_timeout(3000, 3000, 3000, 30000)
37
+
38
+ response = session.get("https://www.example.com")
39
+ print(response.statue_code())
40
+ print(response.text())
41
+
42
+ session.close()
43
+ ```
44
+
45
+ ## API Reference
46
+
47
+ ### `reqrio.Session`
48
+
49
+ Create a session:
50
+
51
+ ```python
52
+ session = reqrio.Session(
53
+ headers=None,
54
+ alpn=reqrio.ALPN.HTTP11,
55
+ verify=True,
56
+ proxy=None,
57
+ key_log=None,
58
+ ja3=None,
59
+ ja4=None,
60
+ client_hello=None,
61
+ random_tls=False,
62
+ custom_tls=None,
63
+ token="",
64
+ )
65
+ ```
66
+
67
+ Common methods:
68
+
69
+ - `session.set_headers(headers: dict)`
70
+ - `session.add_header(name: str, value: str)`
71
+ - `session.remove_header(name: str)`
72
+ - `session.set_timeout(connect, read, write, handle, connect_times=3, handle_times=3)`
73
+ - `session.set_cookie(cookie: str)`
74
+ - `session.add_cookie(name: str, value: str)`
75
+ - `session.get(url, params=None, data=None, json=None, bytes=None, text=None, **kwargs)`
76
+ - `session.post(url, params=None, data=None, json=None, bytes=None, text=None, **kwargs)`
77
+ - `session.open_stream(method, url, params=None, data=None, json=None, bytes=None, text=None, **kwargs)`
78
+ - `session.close()`
79
+
80
+ ### Helper functions
81
+
82
+ `reqrio` also offers shortcut functions for single requests:
83
+
84
+ ```python
85
+ resp = reqrio.get(
86
+ "https://www.example.com",
87
+ headers={"User-Agent": "..."},
88
+ params={"q": "test"},
89
+ )
90
+ print(resp.statue_code())
91
+
92
+ resp = reqrio.post(
93
+ "https://www.example.com/api",
94
+ headers={"Content-Type": "application/json"},
95
+ json={"key": "value"},
96
+ )
97
+ print(resp.statue_code())
98
+ ```
99
+
100
+ ### WebSocket support
101
+
102
+ ```python
103
+ from reqrio import WebSocket, WsOpCode
104
+
105
+ headers = {
106
+ "Origin": "https://example.com",
107
+ "User-Agent": "Mozilla/5.0...",
108
+ }
109
+
110
+ ws = WebSocket(
111
+ "wss://example.com/",
112
+ uri="wss://example.com/api/ws",
113
+ headers=headers,
114
+ )
115
+ ws.open()
116
+
117
+ while True:
118
+ frame = ws.read()
119
+ if frame.opcode == WsOpCode.PING:
120
+ ws.write(WsOpCode.PONG, frame.payload)
121
+ else:
122
+ print(frame.payload.decode("utf-8"))
123
+
124
+ ws.close()
125
+ ```
126
+
127
+ ## Request Body Types
128
+
129
+ Supported request bodies:
130
+
131
+ - `data={...}` for form data
132
+ - `json={...}` for JSON payloads
133
+ - `text="..."` for plain text
134
+ - `bytes=b"..."` for raw bytes
135
+ - `files=[...]` for multipart file upload
136
+
137
+ File upload example:
138
+
139
+ ```python
140
+ files = [
141
+ {
142
+ "path": "./example.txt",
143
+ "field_name": "file",
144
+ "filetype": "text/plain",
145
+ }
146
+ ]
147
+
148
+ response = session.post(
149
+ "https://www.example.com/upload",
150
+ data={"name": "test"},
151
+ files=files,
152
+ )
153
+ print(response.statue_code())
154
+ ```
155
+
156
+ ## TLS Fingerprinting and Advanced Options
157
+
158
+ `reqrio.Session` supports advanced TLS configuration:
159
+
160
+ - `ja3`: JA3 fingerprint string
161
+ - `ja4`: JA4 fingerprint string
162
+ - `client_hello`: raw TLS ClientHello bytes
163
+ - `random_tls`: random TLS fingerprint
164
+ - `custom_tls`: custom TLS configuration dictionary
165
+ - `token`: fingerprint authentication token
166
+
167
+ Additional options:
168
+
169
+ - `verify=False` to disable certificate verification
170
+ - `proxy` for HTTP/SOCKS proxy support
171
+ - `key_log` to save TLS key material for debugging
172
+
173
+ ## Notes
174
+
175
+ - `reqrio-py` is designed to reuse connections when possible.
176
+ - Be sure to call `session.close()` to release resources.
177
+
178
+ ## License
179
+
180
+ Apache-2.0
@@ -1,29 +1,29 @@
1
- [build-system]
2
- requires = ["setuptools", "wheel"]
3
- build-backend = "setuptools.build_meta"
4
-
5
- [project]
6
- name = "reqrio"
7
- version = "0.2.0-beta2"
8
- license = "Apache-2.0"
9
- requires-python = ">=3.9"
10
- description = "A lightweight, high concurrency HTTP request library"
11
- readme = "README.md"
12
-
13
- authors = [
14
- { name="xllgl2017", email="xinlanxi2017@gmail.com" },
15
- ]
16
-
17
- [tool.setuptools]
18
- packages = ["reqrio","reqrio.hooks"]
19
- include-package-data = true
20
-
21
- [tool.setuptools.package-data]
22
- reqrio = ["*.dll", "**/*.dll","**/*.so"]
23
-
24
- [project.entry-points."pyinstaller40"]
25
- hook-dirs = "reqrio:_pyinstaller_hooks_dir"
26
-
27
-
28
- [project.urls]
29
- Homepage = "https://github.com/xllgl2017/reqrio/tree/master/reqrio"
1
+ [build-system]
2
+ requires = ["setuptools", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "reqrio"
7
+ version = "0.3.0"
8
+ license = "Apache-2.0"
9
+ requires-python = ">=3.9"
10
+ description = "A lightweight, high concurrency HTTP request library"
11
+ readme = "README.md"
12
+
13
+ authors = [
14
+ { name="xllgl2017", email="xinlanxi2017@gmail.com" },
15
+ ]
16
+
17
+ [tool.setuptools]
18
+ packages = ["reqrio","reqrio.hooks"]
19
+ include-package-data = true
20
+
21
+ [tool.setuptools.package-data]
22
+ reqrio = ["*.dll", "**/*.dll","**/*.so"]
23
+
24
+ [project.entry-points."pyinstaller40"]
25
+ hook-dirs = "reqrio:_pyinstaller_hooks_dir"
26
+
27
+
28
+ [project.urls]
29
+ Homepage = "https://github.com/xllgl2017/reqrio/tree/main/reqrio"
@@ -0,0 +1,88 @@
1
+ from reqrio.alpn import ALPN
2
+ from reqrio.response import Response
3
+ from reqrio._session import Session
4
+ from reqrio.method import Method
5
+ from reqrio.websocket import WebSocket, WsOpCode, WsFrame
6
+ from reqrio.cipher import CipherType, Cipher
7
+ from reqrio.hash import HashType, Hasher, Hmac
8
+ from reqrio.b64 import Base64, b64encode, b64decode
9
+ from typing import Union
10
+ from reqrio.rcode import url_encode, url_decode, hex_encode, hex_decode
11
+ from reqrio._finger import Algorithm, CompressionMethod, Group, Version, EcPointFormat, ExtensionType, CipherSuite, \
12
+ H2Setting
13
+
14
+
15
+ # pyinstaller.exe -F --collect-binaries reqrio .\1.py
16
+
17
+ def _pyinstaller_hooks_dir():
18
+ from pathlib import Path
19
+ return [str(Path(__file__).with_name("hooks").resolve())]
20
+
21
+
22
+ def send(
23
+ method: Method,
24
+ url: str,
25
+ params: dict = None,
26
+
27
+ headers: dict = None,
28
+ alpn=ALPN.HTTP11,
29
+ verify: bool = True,
30
+ proxy: str = None,
31
+ key_log: str = None,
32
+
33
+ data: dict = None,
34
+ json: dict = None,
35
+ bytes: bytes = None,
36
+ text: str = None,
37
+ files: list[dict[str, str]] = None,
38
+ content_type: str = None,
39
+
40
+ auto_redirect: bool = True,
41
+ ja3: str = None,
42
+ ja4: str = None,
43
+ client_hello: bytes = None,
44
+ random_tls: bool = False,
45
+ custom_tls: dict = None,
46
+ token: str = "",
47
+ sni: str = None
48
+
49
+ ):
50
+ req = Session(headers, alpn, verify, proxy, key_log, ja3, ja4, client_hello, random_tls, custom_tls, token)
51
+ resp = req.pre_send(method, url, params, data, json, bytes, text, files, content_type, auto_redirect=auto_redirect,
52
+ sni=sni)
53
+ req.close()
54
+ return resp
55
+
56
+
57
+ def get(url: str, headers: dict = None, data: dict = None, json: dict = None, params: dict = None,
58
+ **kwargs) -> Response:
59
+ return send(Method.GET, url, params, headers, data=data, json=json, **kwargs)
60
+
61
+
62
+ def post(url: str, headers: dict = None, data: dict = None, json: dict = None, params: dict = None,
63
+ **kwargs) -> Response:
64
+ return send(Method.POST, url, params, headers, data=data, json=json, **kwargs)
65
+
66
+
67
+ def en_b64(ct: CipherType, data: Union[str, bytes], key: Union[str, bytes], iv: Union[str, bytes] = None) -> str:
68
+ cipher = Cipher(ct, key, iv)
69
+ en_bs = cipher.encrypt(data)
70
+ return b64encode(en_bs)
71
+
72
+
73
+ def de_b64(ct: CipherType, data: str, key: Union[str, bytes], iv: Union[str, bytes] = None) -> bytes:
74
+ de_bs = b64decode(data)
75
+ cipher = Cipher(ct, key, iv)
76
+ return cipher.decrypt(de_bs)
77
+
78
+
79
+ def en_hex(ct: CipherType, data: Union[str, bytes], key: Union[str, bytes], iv: Union[str, bytes] = None) -> str:
80
+ cipher = Cipher(ct, key, iv)
81
+ en_bs = cipher.encrypt(data)
82
+ return hex_encode(en_bs)
83
+
84
+
85
+ def de_hex(ct: CipherType, data: str, key: Union[str, bytes], iv: Union[str, bytes] = None) -> bytes:
86
+ de_bs = hex_decode(data)
87
+ cipher = Cipher(ct, key, iv)
88
+ return cipher.decrypt(de_bs)
@@ -0,0 +1,140 @@
1
+ from enum import IntEnum
2
+
3
+
4
+ class Algorithm(IntEnum):
5
+ RSA_PKCS1_SHA1 = 0x0201,
6
+ RSA_PKCS1_SHA256 = 0x0401,
7
+ RSA_PKCS1_SHA384 = 0x0501,
8
+ RSA_PKCS1_SHA512 = 0x0601,
9
+ RSA_PSS_RSAE_SHA256 = 0x0804,
10
+ RSA_PSS_RSAE_SHA384 = 0x0805,
11
+ RSA_PSS_RSAE_SHA512 = 0x0806,
12
+ RSA_PSS_PSS_SHA256 = 0x0807,
13
+ RSA_PSS_PSS_SHA384 = 0x0808,
14
+ RSA_PSS_PSS_SHA512 = 0x0809,
15
+ ED25519 = 0x080A,
16
+ ED448 = 0x080B,
17
+ ECDSA_SHA1 = 0x0203,
18
+ ECDSA_SECP256R1_SHA256 = 0x0403,
19
+ ECDSA_SECP384R1_SHA384 = 0x0503,
20
+ ECDSA_SECP521R1_SHA512 = 0x0603,
21
+ SHA1_DSA = 0x0202,
22
+ SHA224_RSA = 0x0301,
23
+ SHA224_DSA = 0x0302,
24
+ SHA224_ECDSA = 0x0303,
25
+ SHA256_DSA = 0x0402,
26
+ SHA384_DSA = 0x0502,
27
+ SHA512_DSA = 0x0602,
28
+
29
+
30
+ class CompressionMethod(IntEnum):
31
+ NULL = 0,
32
+ DEFLATE = 1,
33
+ BROTLI = 2,
34
+ GZIP = 0xFFFF,
35
+ ZSTD = 0xFFFE
36
+
37
+
38
+ class Group(IntEnum):
39
+ X25519 = 0x1d,
40
+ X448 = 0x1e,
41
+ X25519MLKEM768 = 0x11ec,
42
+ Secp256r1 = 0x0017,
43
+ Secp384r1 = 0x0018,
44
+ Secp521r1 = 0x0019,
45
+ FFDHE2048 = 0x0100,
46
+ FFDHE3072 = 0x0101,
47
+ FFDHE4096 = 0x0102,
48
+ FFDHE6144 = 0x0103,
49
+ FFDHE8192 = 0x0104,
50
+
51
+
52
+ class Version(IntEnum):
53
+ TLS_1_0 = 0x301,
54
+ TLS_1_1 = 0x302,
55
+ TLS_1_2 = 0x303,
56
+ TLS_1_3 = 0x304
57
+
58
+
59
+ class EcPointFormat(IntEnum):
60
+ UNCOMPRESSED = 0,
61
+ ANSI_X962_PRIME = 1,
62
+ ANSI_X962_CHAR2 = 2
63
+
64
+
65
+ class ExtensionType:
66
+ ServerName = 0x0
67
+ StatusRequest = 0x5
68
+ SupportedGroup = 0xa
69
+ EcPointFormats = 0xb
70
+ SignatureAlgorithms = 0xd
71
+ ApplicationLayerProtocolNegotiation = 0x10
72
+ SignedCertificateTimestamp = 0x12
73
+ Padding = 0x15
74
+ EncryptTheMac = 0x16
75
+ ExtendMasterSecret = 0x17
76
+ SessionTicket = 0x23
77
+ CompressionCertificate = 0x1b
78
+ SupportedVersions = 0x2b
79
+ PskKeyExchangeMode = 0x2d
80
+ PostHandshakeAuth = 0x31
81
+ KeyShare = 0x33
82
+ RenegotiationInfo = 0xff01
83
+ EncryptedClientHello = 0xfe0d
84
+ ApplicationSetting = 0x44cd
85
+ PreSharedKey = 0x29
86
+ ApplicationSettingOld = 0x4469
87
+
88
+
89
+ class CipherSuite(IntEnum):
90
+ # ecdhe-ecdhe
91
+ TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 = 0xc02b,
92
+ TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 = 0xc02c,
93
+ TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 = 0xc023,
94
+ TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 = 0xc024,
95
+ TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA = 0xc009,
96
+ TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA = 0xc00a,
97
+ TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 = 0xcca9,
98
+
99
+ # ecdhe-rsa
100
+ TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 = 0xc02f,
101
+ TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 = 0xc030,
102
+ TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 = 0xc027,
103
+ TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 = 0xc028,
104
+ TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA = 0xc013,
105
+ TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA = 0xc014,
106
+ TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 = 0xcca8,
107
+
108
+ # dhe-rsa
109
+ TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 = 0x009e,
110
+ TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 = 0x009f,
111
+ TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 = 0x0067,
112
+ TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 = 0x006b,
113
+ TLS_DHE_RSA_WITH_AES_128_CBC_SHA = 0x0033,
114
+ TLS_DHE_RSA_WITH_AES_256_CBC_SHA = 0x0039,
115
+ TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 = 0xccaa,
116
+
117
+ # rsa
118
+ TLS_RSA_WITH_AES_128_GCM_SHA256 = 0x009c,
119
+ TLS_RSA_WITH_AES_256_GCM_SHA384 = 0x009d,
120
+ TLS_RSA_WITH_AES_128_CBC_SHA256 = 0x003c,
121
+ TLS_RSA_WITH_AES_256_CBC_SHA256 = 0x003d,
122
+ TLS_RSA_WITH_AES_128_CBC_SHA = 0x002f,
123
+ TLS_RSA_WITH_AES_256_CBC_SHA = 0x0035,
124
+
125
+ # tls1.3
126
+ TLS_AES_128_GCM_SHA256 = 0x1301,
127
+ TLS_AES_256_GCM_SHA384 = 0x1302,
128
+ TLS_CHACHA20_POLY1305_SHA256 = 0x1303,
129
+
130
+ TLS_EMPTY_RENEGOTIATION_INFO_SCSV = 0x00ff,
131
+
132
+
133
+ class H2Setting:
134
+ HeaderTableSize = "HeaderTableSize"
135
+ EnablePush = "EnablePush"
136
+ MaxConcurrentStreams = "MaxConcurrentStreams"
137
+ InitialWindowSize = "InitialWindowSize"
138
+ MaxFrameSize = "MaxFrameSize"
139
+ MaxHeaderListSize = "MaxHeaderListSize"
140
+ Reserved = "Reserved"