fix topology of cards
This commit is contained in:
+57
-17
@@ -1,11 +1,17 @@
|
||||
"""Фикстура, повторяющая профиль BridgeOverNetbird и ноды из панели."""
|
||||
"""Фикстура сети: вход RU-01 (профиль Bridge) + 6 выходных нод (профиль Default)."""
|
||||
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"]
|
||||
EXIT_NAMES = ["FR-01", "NL-01", "FI-01", "NL-04", "CH-01", "BR-01"]
|
||||
|
||||
BRIDGE_UUID = "aaaaaaaa-0000-0000-0000-000000000001"
|
||||
DEFAULT_UUID = "bbbbbbbb-0000-0000-0000-000000000002"
|
||||
INB_BRIDGE = "inb-bridge" # RU_NODE_IN
|
||||
INB_VLESS = "inb-def-vless" # DEFAULT_IN, 443
|
||||
INB_SS = "inb-def-ss" # BRIDGE_SS_IN, 9999
|
||||
|
||||
|
||||
def make_profile() -> dict:
|
||||
def bridge_profile() -> dict:
|
||||
rules = [
|
||||
{"port": 25, "outboundTag": "BLOCK"},
|
||||
{"ip": ["geoip:private"], "outboundTag": "BLOCK"},
|
||||
@@ -32,25 +38,59 @@ def make_profile() -> dict:
|
||||
{"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"}]}
|
||||
return {"uuid": BRIDGE_UUID, "name": "BridgeOverNetbird", "config": config,
|
||||
"inbounds": [{"uuid": INB_BRIDGE, "tag": "RU_NODE_IN", "type": "vless", "port": 443}]}
|
||||
|
||||
|
||||
def default_profile() -> dict:
|
||||
config = {
|
||||
"inbounds": [
|
||||
{"tag": "DEFAULT_IN", "port": 443, "protocol": "vless"},
|
||||
{"tag": "BRIDGE_SS_IN", "port": 9999, "protocol": "shadowsocks",
|
||||
"settings": {"password": "SECRET-SS"}},
|
||||
],
|
||||
"outbounds": [{"tag": "DIRECT", "protocol": "freedom"}, {"tag": "BLOCK", "protocol": "blackhole"}],
|
||||
"routing": {"rules": [
|
||||
{"protocol": ["bittorrent"], "outboundTag": "BLOCK"},
|
||||
{"ip": ["geoip:private"], "outboundTag": "BLOCK"},
|
||||
]},
|
||||
}
|
||||
return {"uuid": DEFAULT_UUID, "name": "Default", "config": config, "inbounds": [
|
||||
{"uuid": INB_VLESS, "tag": "DEFAULT_IN", "type": "vless", "port": 443},
|
||||
{"uuid": INB_SS, "tag": "BRIDGE_SS_IN", "type": "shadowsocks", "port": 9999}]}
|
||||
|
||||
|
||||
def make_profiles() -> list[dict]:
|
||||
return [default_profile(), bridge_profile()]
|
||||
|
||||
|
||||
def make_nodes() -> list[dict]:
|
||||
nodes = [{"name": n, "address": ip, "countryCode": "XX", "isConnected": True, "isDisabled": False,
|
||||
ru = {"uuid": "n-ru", "name": "RU-01", "address": "100.106.247.44", "countryCode": "RU",
|
||||
"isConnected": True, "isDisabled": False,
|
||||
"ips": [{"ip": "91.201.43.187", "status": "OUTBOUND"}, {"ip": "100.106.247.44", "status": "MANAGEMENT"}],
|
||||
"configProfile": {"activeConfigProfileUuid": BRIDGE_UUID, "activeInbounds": [{"uuid": INB_BRIDGE}]},
|
||||
"system": {"info": {"networkInterfaces": ["lo", "wt0"]}}}
|
||||
exits = [{"uuid": f"n-{i}", "name": n, "address": ip, "countryCode": "XX",
|
||||
"isConnected": True, "isDisabled": False,
|
||||
"ips": [{"ip": ip, "status": "MANAGEMENT"}, {"ip": f"1.1.1.{i}", "status": "OUTBOUND"}],
|
||||
"configProfile": {"activeConfigProfileUuid": DEFAULT_UUID,
|
||||
"activeInbounds": [{"uuid": INB_VLESS}, {"uuid": INB_SS}]},
|
||||
"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
|
||||
for i, (n, ip) in enumerate(zip(EXIT_NAMES, BRIDGE_IPS))]
|
||||
unused = {"uuid": "n-us", "name": "US-01", "address": "78.153.155.226", "ips": [],
|
||||
"configProfile": {"activeConfigProfileUuid": None, "activeInbounds": []}, "system": None}
|
||||
return [ru, *exits, unused]
|
||||
|
||||
|
||||
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
|
||||
def host(uuid, remark, node, inbound, route=None):
|
||||
return {"uuid": uuid, "remark": remark, "address": "node-ru.example", "port": 443,
|
||||
"vlessRouteId": route, "nodes": [node],
|
||||
"inbound": {"configProfileUuid": "x", "configProfileInboundUuid": inbound}}
|
||||
return [
|
||||
host("h3", "Bridge-Ivi", "n-ru", INB_BRIDGE, 3),
|
||||
host("h7", "Bridge-Auto", "n-ru", INB_BRIDGE, 7),
|
||||
host("h8", "Bridge-Mira-SC", "n-ru", INB_BRIDGE, 8),
|
||||
host("hn", "Bridge-NoRoute", "n-ru", INB_BRIDGE, None),
|
||||
host("hd", "Direct-FI", "n-2", INB_VLESS), # прямое подключение к выходной ноде
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user