186 lines
5.1 KiB
Python
186 lines
5.1 KiB
Python
#!/usr/bin/env python3
|
||
"""
|
||
创建演示数据来测试合并脚本
|
||
"""
|
||
|
||
import os
|
||
import yaml
|
||
|
||
# 创建temp目录
|
||
os.makedirs("temp", exist_ok=True)
|
||
|
||
# 演示数据1: TrustedAccessPath
|
||
demo_data1 = {
|
||
'mixed-port': 7890,
|
||
'allow-lan': True,
|
||
'mode': 'rule',
|
||
'log-level': 'info',
|
||
'proxies': [
|
||
{
|
||
'name': '🇭🇰 香港-01',
|
||
'type': 'ss',
|
||
'server': 'hk1.example.com',
|
||
'port': 443,
|
||
'cipher': 'aes-256-gcm',
|
||
'password': 'password123'
|
||
},
|
||
{
|
||
'name': '🇭🇰 香港-02',
|
||
'type': 'ss',
|
||
'server': 'hk2.example.com',
|
||
'port': 443,
|
||
'cipher': 'aes-256-gcm',
|
||
'password': 'password123'
|
||
},
|
||
{
|
||
'name': '剩余流量: 50GB',
|
||
'type': 'ss',
|
||
'server': 'info.example.com',
|
||
'port': 443,
|
||
'cipher': 'aes-256-gcm',
|
||
'password': 'password123'
|
||
},
|
||
{
|
||
'name': '🇸🇬 新加坡-01',
|
||
'type': 'ss',
|
||
'server': 'sg1.example.com',
|
||
'port': 443,
|
||
'cipher': 'aes-256-gcm',
|
||
'password': 'password123'
|
||
},
|
||
{
|
||
'name': '🇺🇸 美国-01',
|
||
'type': 'ss',
|
||
'server': 'us1.example.com',
|
||
'port': 443,
|
||
'cipher': 'aes-256-gcm',
|
||
'password': 'password123'
|
||
}
|
||
],
|
||
'proxy-groups': [
|
||
{
|
||
'name': 'TrustedAccessPath-All',
|
||
'type': 'select',
|
||
'proxies': ['Auto-Select', '🇭🇰 香港-01', '🇭🇰 香港-02', '剩余流量: 50GB', '🇸🇬 新加坡-01', '🇺🇸 美国-01']
|
||
}
|
||
]
|
||
}
|
||
|
||
# 演示数据2: 流量光机场
|
||
demo_data2 = {
|
||
'mixed-port': 7890,
|
||
'allow-lan': True,
|
||
'mode': 'rule',
|
||
'log-level': 'info',
|
||
'proxies': [
|
||
{
|
||
'name': '🇭🇰 香港-01', # 重复名称测试
|
||
'type': 'ss',
|
||
'server': 'hk3.example.com',
|
||
'port': 443,
|
||
'cipher': 'aes-256-gcm',
|
||
'password': 'password456'
|
||
},
|
||
{
|
||
'name': 'HKG-Premium',
|
||
'type': 'ss',
|
||
'server': 'hk4.example.com',
|
||
'port': 443,
|
||
'cipher': 'aes-256-gcm',
|
||
'password': 'password456'
|
||
},
|
||
{
|
||
'name': 'Singapore-Fast',
|
||
'type': 'ss',
|
||
'server': 'sg2.example.com',
|
||
'port': 443,
|
||
'cipher': 'aes-256-gcm',
|
||
'password': 'password456'
|
||
},
|
||
{
|
||
'name': '距离下次重置剩余:15天',
|
||
'type': 'ss',
|
||
'server': 'info2.example.com',
|
||
'port': 443,
|
||
'cipher': 'aes-256-gcm',
|
||
'password': 'password456'
|
||
},
|
||
{
|
||
'name': 'USA-West',
|
||
'type': 'ss',
|
||
'server': 'us2.example.com',
|
||
'port': 443,
|
||
'cipher': 'aes-256-gcm',
|
||
'password': 'password456'
|
||
}
|
||
],
|
||
'proxy-groups': [
|
||
{
|
||
'name': '流量光机场-全部节点',
|
||
'type': 'select',
|
||
'proxies': ['Auto优选', '🇭🇰 香港-01', 'HKG-Premium', 'Singapore-Fast', '距离下次重置剩余:15天', 'USA-West']
|
||
}
|
||
]
|
||
}
|
||
|
||
# 演示数据3: FacMata
|
||
demo_data3 = {
|
||
'mixed-port': 7890,
|
||
'allow-lan': True,
|
||
'mode': 'rule',
|
||
'log-level': 'info',
|
||
'proxies': [
|
||
{
|
||
'name': 'HongKong-Speed',
|
||
'type': 'ss',
|
||
'server': 'hk5.example.com',
|
||
'port': 443,
|
||
'cipher': 'aes-256-gcm',
|
||
'password': 'password789'
|
||
},
|
||
{
|
||
'name': 'SGP-Ultra',
|
||
'type': 'ss',
|
||
'server': 'sg3.example.com',
|
||
'port': 443,
|
||
'cipher': 'aes-256-gcm',
|
||
'password': 'password789'
|
||
},
|
||
{
|
||
'name': 'United States-Pro',
|
||
'type': 'ss',
|
||
'server': 'us3.example.com',
|
||
'port': 443,
|
||
'cipher': 'aes-256-gcm',
|
||
'password': 'password789'
|
||
},
|
||
{
|
||
'name': '套餐到期:2024-12-31',
|
||
'type': 'ss',
|
||
'server': 'info3.example.com',
|
||
'port': 443,
|
||
'cipher': 'aes-256-gcm',
|
||
'password': 'password789'
|
||
}
|
||
],
|
||
'proxy-groups': [
|
||
{
|
||
'name': 'FacMata®-节点',
|
||
'type': 'select',
|
||
'proxies': ['Auto节点', 'HongKong-Speed', 'SGP-Ultra', 'United States-Pro', '套餐到期:2024-12-31']
|
||
}
|
||
]
|
||
}
|
||
|
||
# 保存演示数据
|
||
with open('temp/TrustedAccessPath.yaml', 'w', encoding='utf-8') as f:
|
||
yaml.dump(demo_data1, f, default_flow_style=False, allow_unicode=True)
|
||
|
||
with open('temp/流量光机场.yaml', 'w', encoding='utf-8') as f:
|
||
yaml.dump(demo_data2, f, default_flow_style=False, allow_unicode=True)
|
||
|
||
with open('temp/FacMata®.yaml', 'w', encoding='utf-8') as f:
|
||
yaml.dump(demo_data3, f, default_flow_style=False, allow_unicode=True)
|
||
|
||
print("演示数据已创建到temp目录")
|
||
print("现在可以运行 python3 merger.py 来测试合并功能") |