zapret-kvn/xray_fluent/application/protocol_core.py
loop-uh d5a4715771
Some checks failed
Windows project source guards / test (push) Has been cancelled
feat: use official Amnezia transport and organize runtime modules
2026-09-06 00:14:08 +03:00

23 lines
713 B
Python

"""Fixed protocol ownership shared by planning, pools and runtime modules."""
from enum import Enum
class ProtocolCore(str, Enum):
SINGBOX = "sing-box"
XRAY = "xray"
HYSTERIA = "hysteria"
AMNEZIA = "amnezia"
def protocol_core(node) -> ProtocolCore:
outbound = node.outbound or {}
protocol = str(outbound.get("protocol", outbound.get("type", node.scheme))).lower()
if protocol == "vless":
return ProtocolCore.XRAY
if protocol in {"wireguard", "awg"}:
return ProtocolCore.AMNEZIA
# The official v2 client cannot consume Hysteria v1 configurations.
if protocol in {"hy2", "hysteria2"}:
return ProtocolCore.HYSTERIA
return ProtocolCore.SINGBOX