mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-07-07 02:11:29 +02:00
refactor:rename-project-to-openhop
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""Companion identity support for pyMC Repeater.
|
||||
"""Companion identity support for openHop Repeater.
|
||||
|
||||
Exposes the MeshCore companion frame protocol over TCP for standard clients.
|
||||
"""
|
||||
|
||||
@@ -13,7 +13,7 @@ import logging
|
||||
from enum import Enum
|
||||
from typing import Any, Callable, Optional
|
||||
|
||||
from pymc_core.companion import CompanionBridge
|
||||
from openhop_core.companion import CompanionBridge
|
||||
|
||||
logger = logging.getLogger("RepeaterCompanionBridge")
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
"""Companion frame protocol constants — re-exported from pyMC_core.
|
||||
"""Companion frame protocol constants — re-exported from openhop-core.
|
||||
|
||||
All protocol constants now live in :mod:`pymc_core.companion.constants`.
|
||||
All protocol constants now live in :mod:`openhop_core.companion.constants`.
|
||||
This module re-exports them so existing repeater imports continue to work.
|
||||
"""
|
||||
|
||||
# Re-exports; F401 ignored for re-exported names.
|
||||
from pymc_core.companion.constants import ( # noqa: F401
|
||||
from openhop_core.companion.constants import ( # noqa: F401
|
||||
ADV_TYPE_CHAT,
|
||||
ADV_TYPE_REPEATER,
|
||||
ADV_TYPE_ROOM,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
Repeater-specific CompanionFrameServer with SQLite persistence.
|
||||
|
||||
Thin subclass of :class:`pymc_core.companion.frame_server.CompanionFrameServer`
|
||||
Thin subclass of :class:`openhop_core.companion.frame_server.CompanionFrameServer`
|
||||
that adds SQLite-backed message, contact, and channel persistence via a
|
||||
``sqlite_handler`` dependency.
|
||||
"""
|
||||
@@ -12,9 +12,9 @@ import asyncio
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
from pymc_core.companion.constants import RESP_CODE_NO_MORE_MESSAGES
|
||||
from pymc_core.companion.frame_server import CompanionFrameServer as _BaseFrameServer
|
||||
from pymc_core.companion.models import QueuedMessage
|
||||
from openhop_core.companion.constants import RESP_CODE_NO_MORE_MESSAGES
|
||||
from openhop_core.companion.frame_server import CompanionFrameServer as _BaseFrameServer
|
||||
from openhop_core.companion.models import QueuedMessage
|
||||
|
||||
logger = logging.getLogger("CompanionFrameServer")
|
||||
|
||||
@@ -45,8 +45,8 @@ class CompanionFrameServer(_BaseFrameServer):
|
||||
port=port,
|
||||
bind_address=bind_address,
|
||||
client_idle_timeout_sec=client_idle_timeout_sec,
|
||||
device_model="pyMC-Repeater-Companion",
|
||||
device_version=None, # use FIRMWARE_VER_CODE from pyMC_core
|
||||
device_model="openHop-Repeater-Companion",
|
||||
device_version=None, # use FIRMWARE_VER_CODE from openhop-core
|
||||
build_date="13 Feb 2026",
|
||||
local_hash=local_hash,
|
||||
stats_getter=stats_getter,
|
||||
|
||||
@@ -50,7 +50,7 @@ def derive_companion_public_key_hex(identity_key: Any) -> Optional[str]:
|
||||
if raw is None:
|
||||
return None
|
||||
try:
|
||||
from pymc_core import LocalIdentity
|
||||
from openhop_core import LocalIdentity
|
||||
|
||||
identity = LocalIdentity(seed=raw)
|
||||
return identity.get_public_key().hex()
|
||||
|
||||
@@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
import logging
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from pymc_core.companion.constants import DEFAULT_MAX_CONTACTS
|
||||
from openhop_core.companion.constants import DEFAULT_MAX_CONTACTS
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -14,7 +14,7 @@ _INVALID_NODE_NAME_CHARS = "\n\r\x00"
|
||||
# Optional per-companion RepeaterCompanionBridge constructor settings (power-user).
|
||||
COMPANION_BRIDGE_SETTING_KEYS = frozenset({"max_contacts", "offline_queue_size"})
|
||||
|
||||
# Settings that must not be applied from config (fixed at pymc_core defaults).
|
||||
# Settings that must not be applied from config (fixed at openhop_core defaults).
|
||||
_COMPANION_IGNORED_BRIDGE_KEYS = frozenset({"max_channels", "adv_type"})
|
||||
|
||||
# Contact flag bit 0 marks a favourite (protected from forced-trim eviction).
|
||||
@@ -102,7 +102,7 @@ def parse_companion_bridge_kwargs(settings: dict) -> Dict[str, int]:
|
||||
|
||||
|
||||
def effective_max_contacts(bridge_kwargs: Dict[str, int]) -> int:
|
||||
"""Return max_contacts from parsed kwargs or pymc_core default."""
|
||||
"""Return max_contacts from parsed kwargs or openhop_core default."""
|
||||
return bridge_kwargs.get("max_contacts", DEFAULT_MAX_CONTACTS)
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ def format_companion_bridge_limits(bridge_kwargs: Dict[str, int]) -> str:
|
||||
|
||||
def companion_hash_str_from_identity_key(identity_key: Any) -> str:
|
||||
"""Derive companion_hash storage key (0xHH) from an identity_key config value."""
|
||||
from pymc_core import LocalIdentity
|
||||
from openhop_core import LocalIdentity
|
||||
|
||||
if isinstance(identity_key, str):
|
||||
key_bytes = bytes.fromhex(normalize_companion_identity_key(identity_key))
|
||||
|
||||
Reference in New Issue
Block a user