rogerxavier commited on
Commit
1279d0f
·
verified ·
1 Parent(s): f994297

Update getNode.py

Browse files
Files changed (1) hide show
  1. getNode.py +11 -2
getNode.py CHANGED
@@ -22,8 +22,17 @@ def getNode(background_tasks: BackgroundTasks)->str:
22
  return NodeStr
23
 
24
  def RandomNode(NodeList:list)->str:
25
- #返回一个节点信息
26
- return random.choice(NodeList)
 
 
 
 
 
 
 
 
 
27
 
28
 
29
  def dump_configs(url:str)->list:
 
22
  return NodeStr
23
 
24
  def RandomNode(NodeList:list)->str:
25
+ #返回一个节点信息(优先trojan和vmess,因为ss存活辣鸡)
26
+ # 检查列表中是否存在以'trojan'或'vmess'开头的项
27
+ trojan_vmess_nodes = [node for node in NodeList if node.startswith('trojan') or node.startswith('vmess')]
28
+
29
+ # 如果存在以'trojan'或'vmess'开头的项,则从这些项中随机选择一个返回
30
+ if trojan_vmess_nodes:
31
+ return random.choice(trojan_vmess_nodes)
32
+ else:
33
+ # 否则从整个列表中随机选择一个返回
34
+ return random.choice(NodeList)
35
+
36
 
37
 
38
  def dump_configs(url:str)->list: