mirror of
https://github.com/Gozargah/Marzban.git
synced 2026-05-17 08:35:56 +03:00
feat: Add random selection from reality shortIds (#1490)
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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']}")
|
||||
|
||||
Reference in New Issue
Block a user