重构:核心迁移至 oss/core + NBPF 多重签名加密 + NIR 编译器 + README 全面升级

- 核心功能从 store/ 迁移至 oss/core/ 框架层
- 实现 NBPF 包格式:多重签名(Ed25519+RSA-PSS+HMAC)+ 多重加密(AES-256-GCM)
- 实现 NIR 编译器:基于 compile()+marshal 的跨平台中间表示
- 新增 nebula nbpf CLI 命令组(pack/unpack/verify/sign/keygen)
- 新增 19 个 NBPF 测试用例,覆盖全链路
- 彻底重写 README,大型项目标准框架风格,所有图表使用 SVG
- 更新 LICENSE 版权声明
- 清理旧版 store 插件目录(已迁移至 oss/core)
This commit is contained in:
Falck
2026-05-05 07:29:43 +08:00
parent 4441a968db
commit 3a096f59a9
184 changed files with 5715 additions and 10066 deletions

View File

@@ -1,3 +1,7 @@
from typing import Callable
from functools import lru_cache
class BaseRoute:
__slots__ = ('method', 'path', 'handler', '_pattern_parts')
@@ -9,6 +13,16 @@ class BaseRoute:
self._pattern_parts = path.strip("/").split("/") if ":" in path else None
def _get_pattern_parts(pattern: str):
if ":" not in pattern:
return None
return pattern.strip("/").split("/")
def _is_wildcard_param(param: str) -> bool:
return param.startswith(":") and param.endswith("*")
@lru_cache(maxsize=1024)
def match_path(pattern: str, path: str) -> bool:
if pattern == path:
@@ -41,12 +55,6 @@ def match_path(pattern: str, path: str) -> bool:
return True
def _is_wildcard_param(param: str) -> bool:
if ":" not in pattern:
return None
return pattern.strip("/").split("/")
@lru_cache(maxsize=1024)
def extract_path_params(pattern: str, path: str) -> dict[str, str]:
params = {}
@@ -85,9 +93,15 @@ class BaseRouter:
self.routes: list[BaseRoute] = []
def add(self, method: str, path: str, handler: Callable):
self.routes.append(BaseRoute(method, path, handler))
def get(self, path: str, handler: Callable):
self.add("GET", path, handler)
def post(self, path: str, handler: Callable):
self.add("POST", path, handler)
def put(self, path: str, handler: Callable):
self.add("PUT", path, handler)
def delete(self, path: str, handler: Callable):