mrok 0.4.3__tar.gz → 0.4.4__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.
- {mrok-0.4.3 → mrok-0.4.4}/PKG-INFO +1 -1
- {mrok-0.4.3 → mrok-0.4.4}/mrok/proxy/app.py +1 -1
- {mrok-0.4.3 → mrok-0.4.4}/mrok/proxy/ziti.py +15 -16
- {mrok-0.4.3 → mrok-0.4.4}/pyproject.toml +1 -1
- {mrok-0.4.3 → mrok-0.4.4}/.github/actions/setup-python-env/action.yml +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/.github/workflows/assets/turing_team_pr_bot.png +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/.github/workflows/notify-pr-closed.yaml +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/.github/workflows/notify-pr-reviewed.yml +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/.github/workflows/pr-build-merge.yaml +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/.github/workflows/release.yml +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/.gitignore +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/.pre-commit-config.yaml +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/.python-version +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/LICENSE.txt +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/README.md +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/dev.Dockerfile +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/docker-compose.yaml +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/entrypoint.sh +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/agent/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/agent/devtools/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/agent/devtools/__main__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/agent/devtools/inspector/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/agent/devtools/inspector/__main__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/agent/devtools/inspector/app.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/agent/devtools/inspector/server.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/agent/sidecar/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/agent/sidecar/app.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/agent/sidecar/main.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/agent/ziticorn.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/admin/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/admin/bootstrap.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/admin/list/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/admin/list/extensions.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/admin/list/instances.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/admin/register/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/admin/register/extensions.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/admin/register/instances.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/admin/unregister/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/admin/unregister/extensions.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/admin/unregister/instances.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/admin/utils.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/agent/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/agent/dev/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/agent/dev/console.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/agent/dev/web.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/agent/run/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/agent/run/asgi.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/agent/run/sidecar.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/agent/utils.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/controller/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/controller/openapi.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/controller/run.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/proxy/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/commands/proxy/run.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/main.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/rich.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/cli/utils.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/conf.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/controller/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/controller/app.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/controller/auth.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/controller/dependencies/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/controller/dependencies/conf.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/controller/dependencies/ziti.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/controller/openapi/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/controller/openapi/examples.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/controller/openapi/utils.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/controller/pagination.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/controller/routes/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/controller/routes/extensions.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/controller/routes/instances.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/controller/schemas.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/datastructures.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/errors.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/http/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/http/config.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/http/constants.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/http/forwarder.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/http/lifespan.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/http/middlewares.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/http/protocol.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/http/server.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/http/types.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/http/utils.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/logging.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/master.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/metrics.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/proxy/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/proxy/main.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/ziti/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/ziti/api.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/ziti/bootstrap.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/ziti/constants.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/ziti/errors.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/ziti/identities.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/ziti/pki.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/mrok/ziti/services.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/prod.Dockerfile +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/scripts/ziti.sh +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/settings.yaml +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/snapshot_report.html +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/sonar-project.properties +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/agent/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/agent/sidecar/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/agent/sidecar/__snapshots__/test_inspector/test_inspector_app.svg +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/agent/sidecar/__snapshots__/test_inspector/test_inspector_app_empty_card.svg +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/agent/sidecar/__snapshots__/test_inspector/test_inspector_app_filed_store_connection.svg +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/agent/sidecar/__snapshots__/test_inspector/test_inspector_app_open_card.svg +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/agent/sidecar/test_app.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/agent/sidecar/test_main.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/agent/test_ziticorn.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/cli/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/cli/admin/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/cli/admin/test_bootstrap.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/cli/admin/test_list.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/cli/admin/test_register.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/cli/admin/test_unregister.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/cli/admin/test_utils.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/cli/agent/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/cli/agent/test_run.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/cli/controller/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/cli/controller/test_openapi.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/cli/controller/test_run.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/cli/proxy/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/cli/proxy/test_run.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/cli/test_main.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/conftest.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/controller/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/controller/test_auth.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/controller/test_extensions.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/controller/test_instances.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/controller/test_openapi.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/http/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/http/test_config.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/http/test_forwarder.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/http/test_lifespan.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/http/test_master.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/http/test_protocol.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/http/test_server.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/proxy/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/proxy/test_app.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/proxy/test_ziti.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/proxy/test_ziti_branches.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/types.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/ziti/__init__.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/ziti/test_api.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/ziti/test_bootstrap.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/ziti/test_identities.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/ziti/test_pki.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/tests/ziti/test_services.py +0 -0
- {mrok-0.4.3 → mrok-0.4.4}/uv.lock +0 -0
|
@@ -59,6 +59,6 @@ class ProxyApp(ForwardAppBase):
|
|
|
59
59
|
headers: dict[str, str],
|
|
60
60
|
) -> tuple[StreamReader, StreamWriter] | tuple[None, None]:
|
|
61
61
|
target_name = self.get_target_name(headers)
|
|
62
|
-
sock = self._ziti_socket_cache.get_or_create(target_name)
|
|
62
|
+
sock = await self._ziti_socket_cache.get_or_create(target_name)
|
|
63
63
|
reader, writer = await asyncio.open_connection(sock=sock)
|
|
64
64
|
return reader, writer
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
import contextlib
|
|
3
|
+
import logging
|
|
3
4
|
from asyncio import Task
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
|
|
@@ -8,6 +9,8 @@ from aiocache import Cache
|
|
|
8
9
|
from openziti.context import ZitiContext
|
|
9
10
|
from openziti.zitisock import ZitiSocket
|
|
10
11
|
|
|
12
|
+
logger = logging.getLogger("mrok.proxy")
|
|
13
|
+
|
|
11
14
|
|
|
12
15
|
class ZitiSocketCache:
|
|
13
16
|
def __init__(
|
|
@@ -42,22 +45,24 @@ class ZitiSocketCache:
|
|
|
42
45
|
sock = await self._cache.get(key)
|
|
43
46
|
|
|
44
47
|
if sock:
|
|
45
|
-
await self._cache.
|
|
48
|
+
await self._cache.expire(key, self._ttl_seconds)
|
|
46
49
|
self._active_sockets[key] = sock
|
|
50
|
+
logger.debug(f"Ziti socket found for service {key}")
|
|
47
51
|
return sock
|
|
48
52
|
|
|
49
53
|
sock = await self._create_socket(key)
|
|
50
|
-
await self._cache.set(key, sock,
|
|
54
|
+
await self._cache.set(key, sock, self._ttl_seconds)
|
|
51
55
|
self._active_sockets[key] = sock
|
|
56
|
+
logger.info(f"New Ziti socket created for service {key}")
|
|
52
57
|
return sock
|
|
53
58
|
|
|
54
|
-
async def invalidate(self, key: str):
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
# async def invalidate(self, key: str):
|
|
60
|
+
# sock = await self._cache.get(key)
|
|
61
|
+
# if sock:
|
|
62
|
+
# await self._close_socket(sock)
|
|
58
63
|
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
# await self._cache.delete(key)
|
|
65
|
+
# self._active_sockets.pop(key, None)
|
|
61
66
|
|
|
62
67
|
async def start(self):
|
|
63
68
|
self._cleanup_task = asyncio.create_task(self._periodic_cleanup())
|
|
@@ -65,9 +70,6 @@ class ZitiSocketCache:
|
|
|
65
70
|
self._get_ziti_ctx()
|
|
66
71
|
|
|
67
72
|
async def stop(self):
|
|
68
|
-
"""
|
|
69
|
-
Cleanup: stop background task + close all sockets.
|
|
70
|
-
"""
|
|
71
73
|
self._cleanup_task.cancel()
|
|
72
74
|
with contextlib.suppress(Exception):
|
|
73
75
|
await self._cleanup_task
|
|
@@ -92,12 +94,9 @@ class ZitiSocketCache:
|
|
|
92
94
|
return
|
|
93
95
|
|
|
94
96
|
async def _cleanup_once(self):
|
|
95
|
-
|
|
96
|
-
known_keys = set(self._active_sockets.keys())
|
|
97
|
-
|
|
98
|
-
expired = known_keys - keys_now
|
|
99
|
-
|
|
97
|
+
expired = {key for key in self._active_sockets.keys() if not self._cache.exists(key)}
|
|
100
98
|
for key in expired:
|
|
99
|
+
logger.debug(f"Cleaning up expired socket connection {key}")
|
|
101
100
|
sock = self._active_sockets.pop(key, None)
|
|
102
101
|
if sock:
|
|
103
102
|
await self._close_socket(sock)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mrok-0.4.3 → mrok-0.4.4}/tests/agent/sidecar/__snapshots__/test_inspector/test_inspector_app.svg
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|