refactor: remove VLESS/Xray, Hy2-only stack
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+4
-34
@@ -1,4 +1,4 @@
|
||||
"""分享链接生成。"""
|
||||
"""分享链接生成(Hysteria2)。"""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
@@ -21,44 +21,14 @@ def load_env() -> dict[str, str]:
|
||||
return env
|
||||
|
||||
|
||||
def _sni_qs(value: str) -> str:
|
||||
"""SNI in share links — use plain domain; clients decode URL themselves."""
|
||||
return value
|
||||
|
||||
|
||||
def build_links(node: dict, env: dict | None = None) -> dict[str, str | dict[str, str]]:
|
||||
def build_links(node: dict, env: dict | None = None) -> dict[str, str]:
|
||||
env = env or load_env()
|
||||
vps_ip = env["VPS_IP"]
|
||||
domain = env["DOMAIN"]
|
||||
reality_sni = env.get("REALITY_SERVER_NAME", "www.microsoft.com")
|
||||
public_key = env["REALITY_PUBLIC_KEY"]
|
||||
short_id = env["REALITY_SHORT_ID"]
|
||||
name = quote(node["name"])
|
||||
port = hy2_port(node, list_nodes())
|
||||
|
||||
# Parameter order follows Xray VLESS share-link convention; pbk/sid stay raw.
|
||||
vless = (
|
||||
f"vless://{node['uuid']}@{vps_ip}:443"
|
||||
f"?type=tcp&security=reality&encryption=none&flow=xtls-rprx-vision"
|
||||
f"&sni={_sni_qs(reality_sni)}&fp=chrome&pbk={public_key}&sid={short_id}"
|
||||
f"&spx=%2F#{name}"
|
||||
)
|
||||
hy2 = (
|
||||
f"hy2://{quote(node['hy2_password'], safe='')}@{domain}:{port}"
|
||||
f"?sni={_sni_qs(domain)}#{name}-Hy2"
|
||||
f"?sni={domain}#{name}-Hy2"
|
||||
)
|
||||
return {
|
||||
"vless": vless,
|
||||
"hy2": hy2,
|
||||
"meta": {
|
||||
"address": vps_ip,
|
||||
"port": "443",
|
||||
"uuid": node["uuid"],
|
||||
"sni": reality_sni,
|
||||
"pbk": public_key,
|
||||
"sid": short_id,
|
||||
"spx": "/",
|
||||
"fp": "chrome",
|
||||
"flow": "xtls-rprx-vision",
|
||||
},
|
||||
}
|
||||
return {"hy2": hy2}
|
||||
|
||||
Reference in New Issue
Block a user