fix: 포트 충돌 회피 — note_bridge 8098, intent_service 8099
Jellyfin(8096), OrbStack(8097) 포트 충돌으로 변경. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from ._socket import SystemResolver
|
||||
|
||||
__all__ = ("SystemResolver",)
|
||||
@@ -0,0 +1,65 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import socket
|
||||
import typing
|
||||
|
||||
from ..protocols import BaseResolver, ProtocolResolver
|
||||
|
||||
|
||||
class SystemResolver(BaseResolver):
|
||||
implementation = "socket"
|
||||
protocol = ProtocolResolver.SYSTEM
|
||||
|
||||
def __init__(self, *patterns: str, **kwargs: typing.Any):
|
||||
if "server" in kwargs:
|
||||
kwargs.pop("server")
|
||||
if "port" in kwargs:
|
||||
kwargs.pop("port")
|
||||
super().__init__(None, None, *patterns, **kwargs)
|
||||
|
||||
def support(self, hostname: str | bytes | None) -> bool | None:
|
||||
if hostname is None:
|
||||
return True
|
||||
if isinstance(hostname, bytes):
|
||||
hostname = hostname.decode("ascii")
|
||||
if hostname == "localhost":
|
||||
return True
|
||||
return super().support(hostname)
|
||||
|
||||
def recycle(self) -> BaseResolver:
|
||||
return self
|
||||
|
||||
def close(self) -> None:
|
||||
pass # no-op!
|
||||
|
||||
def is_available(self) -> bool:
|
||||
return True
|
||||
|
||||
def getaddrinfo(
|
||||
self,
|
||||
host: bytes | str | None,
|
||||
port: str | int | None,
|
||||
family: socket.AddressFamily,
|
||||
type: socket.SocketKind,
|
||||
proto: int = 0,
|
||||
flags: int = 0,
|
||||
*,
|
||||
quic_upgrade_via_dns_rr: bool = False,
|
||||
) -> list[
|
||||
tuple[
|
||||
socket.AddressFamily,
|
||||
socket.SocketKind,
|
||||
int,
|
||||
str,
|
||||
tuple[str, int] | tuple[str, int, int, int],
|
||||
]
|
||||
]:
|
||||
# the | tuple[int, bytes] is silently ignored, can't happen with our cases.
|
||||
return socket.getaddrinfo( # type: ignore[return-value]
|
||||
host=host,
|
||||
port=port,
|
||||
family=family,
|
||||
type=type,
|
||||
proto=proto,
|
||||
flags=flags,
|
||||
)
|
||||
Reference in New Issue
Block a user