Skip to content

Commit

Permalink
feat: add address list support in hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
erfjab committed Jul 21, 2024
1 parent 9bb063d commit e80e119
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion app/subscription/share.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ def process_inbounds_and_tags(
format_variables.update({"TRANSPORT": inbound["network"]})
host_inbound = inbound.copy()
for host in xray.hosts.get(tag, []):

sni = ""
sni_list = host["sni"] or inbound["sni"]
if sni_list:
Expand All @@ -313,9 +314,13 @@ def process_inbounds_and_tags(
if req_host_list:
salt = secrets.token_hex(8)
req_host = random.choice(req_host_list).replace("*", salt)

address = ""
address_list = host['address']
if host['address']:
salt = secrets.token_hex(8)
address = host['address'].replace('*', salt)
address = random.choice(address_list).replace('*', salt)

if host["path"] is not None:
path = host["path"].format_map(format_variables)
else:
Expand Down
2 changes: 1 addition & 1 deletion app/xray/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def hosts(storage: dict):
storage[inbound_tag] = [
{
"remark": host.remark,
"address": host.address,
"address": [i.strip() for i in host.address.split(',')] if host.address else [],
"port": host.port,
"path": host.path if host.path else None,
"sni": [i.strip() for i in host.sni.split(',')] if host.sni else [],
Expand Down

0 comments on commit e80e119

Please sign in to comment.