"""Фикстура, повторяющая профиль BridgeOverNetbird и ноды из панели.""" SC = ["domain:soundcloud.com", "domain:sndcdn.com", "domain:soundcloud.cloud"] BRIDGE_IPS = ["100.106.180.60", "100.106.64.26", "100.106.214.118", "100.106.134.18", "100.106.36.222", "100.106.221.7"] NODE_NAMES = ["FR-01", "NL-01", "FI-01", "NL-04", "CH-01", "BR-01"] def make_profile() -> dict: rules = [ {"port": 25, "outboundTag": "BLOCK"}, {"ip": ["geoip:private"], "outboundTag": "BLOCK"}, {"domain": ["geosite:private"], "outboundTag": "BLOCK"}, {"protocol": ["bittorrent"], "outboundTag": "BLOCK"}, {"domain": ["geosite:category-ru", "domain:ru"], "outboundTag": "DIRECT"}, {"ip": ["geoip:ru"], "outboundTag": "DIRECT"}, *[{"vlessRoute": i, "outboundTag": f"BRIDGE_{i}"} for i in range(1, 7)], {"vlessRoute": 7, "balancerTag": "BRIDGE_AUTO"}, {"inboundTag": ["RU_NODE_IN"], "balancerTag": "BRIDGE_AUTO"}, *[{"domain": SC, "vlessRoute": 7 + i, "outboundTag": f"BRIDGE_{i}"} for i in range(1, 7)], {"domain": SC, "vlessRoute": 14, "balancerTag": "BRIDGE_AUTO"}, {"vlessRoute": "8-14", "balancerTag": "BRIDGE_AUTO"}, ] config = { "inbounds": [{"tag": "RU_NODE_IN", "port": 443, "protocol": "vless", "streamSettings": {"realitySettings": {"privateKey": "SECRET-KEY"}}}], "outbounds": [{"tag": "DIRECT", "protocol": "freedom"}, {"tag": "BLOCK", "protocol": "blackhole"}] + [ {"tag": f"BRIDGE_{i + 1}", "protocol": "shadowsocks", "settings": {"servers": [{"address": ip, "port": 9999, "password": "SECRET-PASS"}]}} for i, ip in enumerate(BRIDGE_IPS)], "routing": {"rules": rules, "balancers": [ {"tag": "BRIDGE_AUTO", "selector": ["BRIDGE_"], "strategy": {"type": "leastPing"}, "fallbackTag": "BRIDGE_1"}]}, } return {"uuid": "aaaaaaaa-0000-0000-0000-000000000001", "name": "BridgeOverNetbird", "config": config, "inbounds": [{"uuid": "inb-1", "tag": "RU_NODE_IN"}], "nodes": [{"uuid": "n-ru", "name": "RU-01", "countryCode": "RU"}]} def make_nodes() -> list[dict]: nodes = [{"name": n, "address": ip, "countryCode": "XX", "isConnected": True, "isDisabled": False, "ips": [{"ip": ip, "status": "MANAGEMENT"}, {"ip": f"1.1.1.{i}", "status": "OUTBOUND"}], "system": {"info": {"networkInterfaces": ["lo", "wt0"]}}} for i, (n, ip) in enumerate(zip(NODE_NAMES, BRIDGE_IPS))] nodes.append({"name": "US-01", "address": "78.153.155.226", "ips": [], "system": None}) return nodes def make_hosts() -> list[dict]: inbound = {"configProfileInboundUuid": "inb-1"} hosts = [{"uuid": f"h{r}", "remark": f"host-r{r}", "vlessRouteId": r, "inbound": inbound} for r in (3, 7, 8)] hosts.append({"uuid": "hn", "remark": "no-route", "vlessRouteId": None, "inbound": inbound}) hosts.append({"uuid": "hx", "remark": "other-profile", "vlessRouteId": 1, "inbound": {"configProfileInboundUuid": "foreign"}}) return hosts