feat: Add random selection from reality shortIds (#1490)

This commit is contained in:
Mohammad
2024-12-04 18:28:12 +03:30
committed by GitHub
parent f5ca4216c3
commit c5d32633a0
2 changed files with 6 additions and 2 deletions

View File

@@ -21,7 +21,7 @@ from config import (
DISABLED_STATUS_TEXT,
EXPIRED_STATUS_TEXT,
LIMITED_STATUS_TEXT,
ONHOLD_STATUS_TEXT
ONHOLD_STATUS_TEXT,
)
SERVER_IP = get_public_ip()
@@ -272,6 +272,9 @@ def process_inbounds_and_tags(
salt = secrets.token_hex(8)
sni = random.choice(sni_list).replace("*", salt)
if sids := inbound.get("sids"):
inbound["sid"] = random.choice(sids)
req_host = ""
req_host_list = host["host"] or inbound["host"]
if req_host_list:

View File

@@ -237,7 +237,8 @@ class XRayConfig(dict):
f"You need to provide publicKey in realitySettings of {inbound['tag']}")
try:
settings['sid'] = tls_settings.get('shortIds')[0]
settings['sids'] = tls_settings.get('shortIds')
settings['sids'][0] # check if there is any shortIds
except (IndexError, TypeError):
raise ValueError(
f"You need to define at least one shortID in realitySettings of {inbound['tag']}")