mrok 0.5.0__py3-none-any.whl → 0.7.0__py3-none-any.whl
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.
- mrok/agent/devtools/inspector/__main__.py +2 -24
- mrok/agent/devtools/inspector/app.py +408 -113
- mrok/agent/devtools/inspector/utils.py +149 -0
- mrok/agent/sidecar/app.py +9 -9
- mrok/agent/sidecar/main.py +31 -5
- mrok/agent/ziticorn.py +8 -2
- mrok/cli/commands/admin/bootstrap.py +3 -2
- mrok/cli/commands/admin/utils.py +2 -2
- mrok/cli/commands/agent/run/sidecar.py +59 -1
- mrok/cli/commands/frontend/run.py +43 -1
- mrok/cli/main.py +17 -1
- mrok/constants.py +21 -0
- mrok/controller/schemas.py +2 -2
- mrok/frontend/app.py +8 -8
- mrok/frontend/main.py +9 -1
- mrok/logging.py +0 -22
- mrok/proxy/app.py +10 -9
- mrok/proxy/asgi.py +96 -0
- mrok/proxy/backend.py +5 -3
- mrok/proxy/event_publisher.py +66 -0
- mrok/proxy/master.py +18 -60
- mrok/proxy/metrics.py +2 -2
- mrok/proxy/{middlewares.py → middleware.py} +11 -42
- mrok/proxy/{datastructures.py → models.py} +43 -17
- mrok/proxy/{streams.py → stream.py} +24 -1
- mrok/proxy/worker.py +64 -0
- mrok/proxy/ziticorn.py +76 -0
- mrok/types/__init__.py +0 -0
- mrok/{proxy/types.py → types/proxy.py} +7 -2
- mrok/types/ziti.py +1 -0
- mrok/ziti/api.py +16 -19
- mrok/ziti/bootstrap.py +3 -7
- mrok/ziti/identities.py +15 -13
- mrok/ziti/services.py +3 -2
- {mrok-0.5.0.dist-info → mrok-0.7.0.dist-info}/METADATA +8 -2
- {mrok-0.5.0.dist-info → mrok-0.7.0.dist-info}/RECORD +39 -40
- mrok/agent/devtools/__main__.py +0 -34
- mrok/cli/commands/agent/utils.py +0 -5
- mrok/proxy/config.py +0 -62
- mrok/proxy/constants.py +0 -22
- mrok/proxy/lifespan.py +0 -10
- mrok/proxy/protocol.py +0 -11
- mrok/proxy/server.py +0 -14
- mrok/proxy/utils.py +0 -90
- {mrok-0.5.0.dist-info → mrok-0.7.0.dist-info}/WHEEL +0 -0
- {mrok-0.5.0.dist-info → mrok-0.7.0.dist-info}/entry_points.txt +0 -0
- {mrok-0.5.0.dist-info → mrok-0.7.0.dist-info}/licenses/LICENSE.txt +0 -0
mrok/proxy/constants.py
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
MAX_REQUEST_BODY_BYTES = 2 * 1024 * 1024
|
|
2
|
-
MAX_RESPONSE_BODY_BYTES = 5 * 1024 * 1024
|
|
3
|
-
|
|
4
|
-
BINARY_CONTENT_TYPES = {
|
|
5
|
-
"application/octet-stream",
|
|
6
|
-
"application/pdf",
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
BINARY_PREFIXES = (
|
|
10
|
-
"image/",
|
|
11
|
-
"video/",
|
|
12
|
-
"audio/",
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
TEXTUAL_CONTENT_TYPES = {
|
|
16
|
-
"application/json",
|
|
17
|
-
"application/xml",
|
|
18
|
-
"application/javascript",
|
|
19
|
-
"application/x-www-form-urlencoded",
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
TEXTUAL_PREFIXES = ("text/",)
|
mrok/proxy/lifespan.py
DELETED
mrok/proxy/protocol.py
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
|
|
3
|
-
from uvicorn.protocols.http.httptools_impl import HttpToolsProtocol
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class MrokHttpToolsProtocol(HttpToolsProtocol):
|
|
7
|
-
def __init__(self, *args, **kwargs):
|
|
8
|
-
super().__init__(*args, **kwargs)
|
|
9
|
-
self.logger = logging.getLogger("mrok.proxy")
|
|
10
|
-
self.access_logger = logging.getLogger("mrok.access")
|
|
11
|
-
self.access_log = self.access_logger.hasHandlers()
|
mrok/proxy/server.py
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
import socket
|
|
3
|
-
|
|
4
|
-
from uvicorn import server
|
|
5
|
-
|
|
6
|
-
server.logger = logging.getLogger("mrok.proxy")
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class MrokServer(server.Server):
|
|
10
|
-
async def serve(self, sockets: list[socket.socket] | None = None) -> None:
|
|
11
|
-
if not sockets:
|
|
12
|
-
sockets = [self.config.bind_socket()]
|
|
13
|
-
with self.capture_signals():
|
|
14
|
-
await self._serve(sockets)
|
mrok/proxy/utils.py
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
from collections.abc import Mapping
|
|
2
|
-
|
|
3
|
-
from mrok.proxy.constants import (
|
|
4
|
-
BINARY_CONTENT_TYPES,
|
|
5
|
-
BINARY_PREFIXES,
|
|
6
|
-
MAX_REQUEST_BODY_BYTES,
|
|
7
|
-
MAX_RESPONSE_BODY_BYTES,
|
|
8
|
-
TEXTUAL_CONTENT_TYPES,
|
|
9
|
-
TEXTUAL_PREFIXES,
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def is_binary(content_type: str) -> bool:
|
|
14
|
-
ct = content_type.lower()
|
|
15
|
-
if ct in BINARY_CONTENT_TYPES:
|
|
16
|
-
return True
|
|
17
|
-
if any(ct.startswith(p) for p in BINARY_PREFIXES):
|
|
18
|
-
return True
|
|
19
|
-
return False
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def is_textual(content_type: str) -> bool:
|
|
23
|
-
ct = content_type.lower()
|
|
24
|
-
if ct in TEXTUAL_CONTENT_TYPES:
|
|
25
|
-
return True
|
|
26
|
-
if any(ct.startswith(p) for p in TEXTUAL_PREFIXES):
|
|
27
|
-
return True
|
|
28
|
-
return False
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def must_capture_request(
|
|
32
|
-
method: str,
|
|
33
|
-
headers: Mapping,
|
|
34
|
-
) -> bool:
|
|
35
|
-
method = method.upper()
|
|
36
|
-
|
|
37
|
-
# No body expected
|
|
38
|
-
if method in ("GET", "HEAD", "OPTIONS", "TRACE"):
|
|
39
|
-
return False
|
|
40
|
-
|
|
41
|
-
content_type = headers.get("content-type", "").lower()
|
|
42
|
-
|
|
43
|
-
content_length = None
|
|
44
|
-
if "content-length" in headers:
|
|
45
|
-
content_length = int(headers["content-length"])
|
|
46
|
-
|
|
47
|
-
if is_binary(content_type):
|
|
48
|
-
return False
|
|
49
|
-
|
|
50
|
-
if content_type.startswith("multipart/form-data"):
|
|
51
|
-
return False
|
|
52
|
-
|
|
53
|
-
if content_length is not None and content_length > MAX_REQUEST_BODY_BYTES:
|
|
54
|
-
return False
|
|
55
|
-
|
|
56
|
-
if is_textual(content_type):
|
|
57
|
-
return True
|
|
58
|
-
|
|
59
|
-
if content_length is None:
|
|
60
|
-
return True
|
|
61
|
-
|
|
62
|
-
return content_length <= MAX_REQUEST_BODY_BYTES
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
def must_capture_response(
|
|
66
|
-
headers: Mapping,
|
|
67
|
-
) -> bool:
|
|
68
|
-
content_type = headers.get("content-type", "").lower()
|
|
69
|
-
disposition = headers.get("content-disposition", "").lower()
|
|
70
|
-
|
|
71
|
-
content_length = None
|
|
72
|
-
if "content-length" in headers:
|
|
73
|
-
content_length = int(headers["content-length"])
|
|
74
|
-
|
|
75
|
-
if "attachment" in disposition:
|
|
76
|
-
return False
|
|
77
|
-
|
|
78
|
-
if is_binary(content_type):
|
|
79
|
-
return False
|
|
80
|
-
|
|
81
|
-
if content_length is not None and content_length > MAX_RESPONSE_BODY_BYTES:
|
|
82
|
-
return False
|
|
83
|
-
|
|
84
|
-
if is_textual(content_type):
|
|
85
|
-
return True
|
|
86
|
-
|
|
87
|
-
if content_length is None:
|
|
88
|
-
return True
|
|
89
|
-
|
|
90
|
-
return content_length <= MAX_RESPONSE_BODY_BYTES
|
|
File without changes
|
|
File without changes
|
|
File without changes
|