diff --git a/CHANGELOG.md b/CHANGELOG.md index eb2f3d5..e5ab832 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +- Traffic for a carrier now leaves through that carrier's own transit port at the same POP, instead of being shared with every other transit port there. Networks that buy transit from the carrier get the same treatment, and a new switch on each transit port, Carry here, pulls that traffic across your network from POPs that have no port of that carrier. Prefer, Backup only and RouteScript still win. + ## [1.37.0] — 2026-10-28 - Series of Tubes now speaks German. The game follows your browser's language the first time, and you can switch to German under Settings or on the title screen. Networking terms like Peering and Transit stay in English, the way network engineers say them. diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index b3eb5ec..64120f3 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -112,12 +112,17 @@ never freezes the game. handed back to links the active ones fill first and standby links take the rest. 2. Builds the exit list `E`: embedded caches (rank 0), PNIs (1), IX ports (2), transit (3). Each exit has a capacity, the networks it can reach (`ok(net)`) and an - egress preference (`high`, `normal`, `low` = backup only). + egress preference (`high`, `normal`, `low` = backup only). A transit port can also be set to + carry (`t.carry`): see step 4. 3. Builds flows: for every POP, its demand (eyeballs and customers) split across destination networks by their traffic share (`NSH`, with regional variants for China, Russia and Korea). Incidents can add junk flows or scale demand. 4. Routes flows rank by rank: the nearest usable exit first, ECMP across equal exits, - consuming link, router (`nodeCap`) and exit capacity. With Auto-TE, overflow spills + consuming link, router (`nodeCap`) and exit capacity. A carrier's own transit port also + goes first, before plain transit, for traffic bound for that carrier or for a network that buys + transit from it (`25-direct-egress.js`: the shorter AS path): always at its own POP, and from every + POP when the port is set to carry. Such a port is still an ordinary transit exit for the other + POPs. A Prefer-marked port, backup, RouteScript and Auto-TE rules keep their say. With Auto-TE, overflow spills onto alternate paths; RouteScript rules (`teRules()`) can prefer, avoid, cap, drain or blackhole. 5. Layer-2 customers (L2VPN, SD-WAN, waves) are carved out of link capacity first. diff --git a/site/i18n/de.js b/site/i18n/de.js index 0b751b2..812fad5 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -2102,12 +2102,14 @@ "link_panels.abandon_the_fiber":"Glasfaser aufgeben", "link_panels.add_parallel_link":"Parallelen Link hinzufügen", "link_panels.apply_for_a_license_price_mo":"Lizenz beantragen {price} + {mo}/Monat · ~45 Tage", +"link_panels.at_this_pop_net_s_traffic_always":"In diesem POP nimmt der Verkehr zu {net} immer diesen Port. POPs ohne einen nehmen ihren nächsten Transit-Port.", "link_panels.back_in_n_days":"Zurück in {n} Tagen.", "link_panels.behind_the_great_firewall":"Hinter der Großen Firewall", "link_panels.biggest_fabric_money_can_buy":"Die größte Fabric, die man für Geld kaufen kann.", "link_panels.biggest_feeder_egress_in_city_set":"Größter Zubringer: {egress} in {city}. Stell ihn auf „Nur Backup“, gib den Kunden einen näheren Ausgang (Peering, einen Cache, lokalen Transit) oder erhöhe die Metrik dieses Links.", "link_panels.build_a_pop_here_first":"Bau hier zuerst einen POP.", "link_panels.cancel_the_iru":"IRU kündigen", +"link_panels.carry_here":"Hierher leiten", "link_panels.click_to_tear_down":"Klicken zum Abbauen", "link_panels.collecting_data_check_back_in_a":"Daten werden gesammelt. Schau in ein paar Tagen wieder rein.", "link_panels.congested_upgrade_it_or_add_a":"Überlastet. Rüste ihn auf oder füg einen parallelen Pfad hinzu.", @@ -2116,6 +2118,7 @@ "link_panels.de_kicks_personalised_pricing_p_of_3d4f":"Personalisierte DE-KICKS-Preise: {p} % von dem, was ein normaler IX verlangen würde.", "link_panels.each_channel_is_a_pair_of":"Jeder Kanal ist ein Paar Optiken, eine pro Ende. ZR+-Optiken stecken direkt in deinen Routern. Transponder sitzen in einem Shelf.", "link_panels.enters_your_network_at":"Kommt in dein Netz bei", +"link_panels.every_pop_carries_net_s_traffic":"Jeder POP leitet den Verkehr zu {net} durch dein Netz bis zu diesem Port.", "link_panels.finish_in_1_day_price":"In 1 Tag fertigstellen {price}", "link_panels.foreign_networks_need_a_local_joint":"Ausländische Netze brauchen ein lokales Joint Venture und eine Betriebslizenz, um hier Infrastruktur zu bauen.", "link_panels.found_your_own_ix_cost_mo":"Eigenen IX gründen {cost} + {mo}/Monat", @@ -2148,6 +2151,7 @@ "link_panels.name_is_down_nothing_you_can":"{name} ist down. Da hilft nur Warten, oder ein anderer Pfad.", "link_panels.name_parallel_link":"Paralleler Link {name}", "link_panels.name_wave":"{name}-Wave", +"link_panels.nearest_port":"Nächster Port", "link_panels.needs_a_pop_in_cities_too":"Braucht auch einen POP in {cities}.", "link_panels.needs_what":"braucht {what}", "link_panels.needs_your_own_scrubbing_center":"Braucht ein eigenes Scrubbing-Center (Tab Infra).", @@ -2207,6 +2211,7 @@ "link_panels.this_is_the_only_link_between":"Das ist der einzige Link zwischen diesen Städten. Füg einen parallelen hinzu oder einen Pfad über eine andere Stadt.", "link_panels.tier_1_only_a_pni_and":"Tier 1: nur ein PNI, und nur, wenn du groß genug für den Tier-1-Club bist", "link_panels.totals_for_all_n_links_between":"Summen für alle {n} Links zwischen diesen Städten.", +"link_panels.traffic_for_net":"Verkehr zu {net}", "link_panels.unplugged_optics_go_on_the_spares":"Ausgesteckte Optiken kommen ins Ersatzteilregal und werden beim nächsten Mal zuerst verwendet.", "link_panels.upgrade_fabric_to_name_cost_mo":"Fabric auf {name} upgraden {cost} + {mo}/Monat", "link_panels.upgrade_to_sys_price":"Upgrade auf {sys} {price}", @@ -3050,6 +3055,7 @@ "traceroute.ix_peering_beats_transit":"IX-Peering schlägt Transit", "traceroute.n_network_unreachable":"!N Netz nicht erreichbar", "traceroute.name_transit":"Transit von {name}", +"traceroute.net_buys_transit_from_carrier_so_that":"{net} kauft Transit bei {carrier}, daher schlägt dieser Port die anderen Transit-Ports.", "traceroute.net_carries_it_to_city":"{net} bringt es nach {city}", "traceroute.net_hands_it_to_to":"{net} übergibt es an {to}", "traceroute.no_path_every_route_between_these":"Kein Pfad: Jede Route zwischen diesen Städten ist ausgefallen oder fehlt.", @@ -3058,6 +3064,7 @@ "traceroute.pnis_beat_ix_peering":"PNIs schlagen IX-Peering", "traceroute.private_cross_connect":"privater Cross-Connect", "traceroute.rule_and_closer_exits_win_ties":"{rule}, und bei Gleichstand gewinnt der nähere Ausgang", +"traceroute.the_carrier_s_own_port_beats_other":"Dieser Port führt direkt zu {net} und schlägt daher die anderen Transit-Ports.", "traceroute.this_one_is_set_to_mode":"; dieser steht auf {mode}", "traceroute.transit_is_the_last_resort":"Transit ist der letzte Ausweg", "tutorial.businesses_pop_up_as_bubbles_on":"Unternehmen tauchen als $-Blasen auf der Karte auf. Öffne Deals und gewinne deinen ersten Kunden.", diff --git a/site/i18n/es.js b/site/i18n/es.js index 2f2a645..88d06ce 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -2100,12 +2100,14 @@ "link_panels.abandon_the_fiber":"Abandonar la fibra", "link_panels.add_parallel_link":"Añadir enlace paralelo", "link_panels.apply_for_a_license_price_mo":"Solicitar una licencia {price} + {mo}/mes · ~45 días", +"link_panels.at_this_pop_net_s_traffic_always":"En este POP, el tráfico de {net} siempre usa este puerto. Los POP que no tienen uno usan su puerto de tránsito más cercano.", "link_panels.back_in_n_days":"De vuelta en {n} días.", "link_panels.behind_the_great_firewall":"Tras el Gran Cortafuegos", "link_panels.biggest_fabric_money_can_buy":"La fabric más grande que el dinero puede comprar.", "link_panels.biggest_feeder_egress_in_city_set":"Mayor alimentador: {egress} en {city}. Ponlo en «Solo respaldo», dale a los clientes una salida más cercana (peering, una caché, tránsito local) o sube la métrica de este enlace.", "link_panels.build_a_pop_here_first":"Construye primero un POP aquí.", "link_panels.cancel_the_iru":"Cancelar la IRU", +"link_panels.carry_here":"Llevar aquí", "link_panels.click_to_tear_down":"Haz clic para desmontar", "link_panels.collecting_data_check_back_in_a":"Recopilando datos. Vuelve en unos días.", "link_panels.congested_upgrade_it_or_add_a":"Congestionado. Mejóralo o añade una ruta paralela.", @@ -2114,6 +2116,7 @@ "link_panels.de_kicks_personalised_pricing_p_of_3d4f":"Precio personalizado de DE-KICKS: {p} % de lo que cobraría un IX normal.", "link_panels.each_channel_is_a_pair_of":"Cada canal es un par de ópticas, una por extremo. Las ópticas ZR+ se enchufan directo a tus routers. Los transpondedores van en un estante.", "link_panels.enters_your_network_at":"Entra en tu red por", +"link_panels.every_pop_carries_net_s_traffic":"Cada POP lleva el tráfico de {net} por tu red hasta este puerto.", "link_panels.finish_in_1_day_price":"Terminar en 1 día {price}", "link_panels.foreign_networks_need_a_local_joint":"Las redes extranjeras necesitan una empresa conjunta local y una licencia de operación para construir infraestructura aquí.", "link_panels.found_your_own_ix_cost_mo":"Funda tu propio IX {cost} + {mo}/mes", @@ -2146,6 +2149,7 @@ "link_panels.name_is_down_nothing_you_can":"{name} está caído. No puedes hacer nada salvo esperar, o tener otra ruta.", "link_panels.name_parallel_link":"Enlace paralelo {name}", "link_panels.name_wave":"Onda {name}", +"link_panels.nearest_port":"Puerto más cercano", "link_panels.needs_a_pop_in_cities_too":"Necesita también un POP en {cities}.", "link_panels.needs_what":"necesita {what}", "link_panels.needs_your_own_scrubbing_center":"Necesita tu propio centro de depuración (pestaña Infra).", @@ -2205,6 +2209,7 @@ "link_panels.this_is_the_only_link_between":"Este es el único enlace entre estas ciudades. Añade uno paralelo, o una ruta por otra ciudad.", "link_panels.tier_1_only_a_pni_and":"Tier 1: solo un PNI, y solo cuando seas lo bastante grande para el club de los Tier 1", "link_panels.totals_for_all_n_links_between":"Totales de los {n} enlaces entre estas ciudades.", +"link_panels.traffic_for_net":"Tráfico hacia {net}", "link_panels.unplugged_optics_go_on_the_spares":"Las ópticas desenchufadas van al estante de repuestos y se usan primero la próxima vez.", "link_panels.upgrade_fabric_to_name_cost_mo":"Mejorar la fabric a {name} {cost} + {mo}/mes", "link_panels.upgrade_to_sys_price":"Mejorar a {sys} {price}", @@ -3048,6 +3053,7 @@ "traceroute.ix_peering_beats_transit":"el peering en IX gana al tránsito", "traceroute.n_network_unreachable":"!N red inalcanzable", "traceroute.name_transit":"Tránsito de {name}", +"traceroute.net_buys_transit_from_carrier_so_that":"{net} compra tránsito a {carrier}, así que ese puerto gana a los otros puertos de tránsito.", "traceroute.net_carries_it_to_city":"{net} lo lleva hasta {city}", "traceroute.net_hands_it_to_to":"{net} lo entrega a {to}", "traceroute.no_path_every_route_between_these":"Sin ruta: todas las rutas entre estas ciudades están caídas o no existen.", @@ -3056,6 +3062,7 @@ "traceroute.pnis_beat_ix_peering":"los PNIs ganan al peering en IX", "traceroute.private_cross_connect":"interconexión cruzada privada", "traceroute.rule_and_closer_exits_win_ties":"{rule}, y las salidas más cercanas ganan los empates", +"traceroute.the_carrier_s_own_port_beats_other":"Este puerto va directo a {net}, así que gana a los otros puertos de tránsito.", "traceroute.this_one_is_set_to_mode":"; esta está en {mode}", "traceroute.transit_is_the_last_resort":"el tránsito es el último recurso", "tutorial.businesses_pop_up_as_bubbles_on":"Las empresas aparecen como burbujas de $ en el mapa. Abre Tratos y firma a tu primer cliente.", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index 413ae5f..a08a01d 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -2100,12 +2100,14 @@ "link_panels.abandon_the_fiber":"Abandonner la fibre", "link_panels.add_parallel_link":"Ajouter un lien parallèle", "link_panels.apply_for_a_license_price_mo":"Demander une licence {price} + {mo}/mois · ~45 jours", +"link_panels.at_this_pop_net_s_traffic_always":"Dans ce POP, le trafic de {net} passe toujours par ce port. Les POP qui n’en ont pas utilisent leur port de transit le plus proche.", "link_panels.back_in_n_days":"Retour dans {n} jours.", "link_panels.behind_the_great_firewall":"Derrière le Grand Pare-feu", "link_panels.biggest_fabric_money_can_buy":"Le plus gros fabric que l’argent puisse acheter.", "link_panels.biggest_feeder_egress_in_city_set":"Plus gros contributeur : {egress} à {city}. Passe-le en « Secours seul », donne aux clients une sortie plus proche (peering, cache, transit local) ou augmente la métrique de ce lien.", "link_panels.build_a_pop_here_first":"Construis d’abord un POP ici.", "link_panels.cancel_the_iru":"Résilier l’IRU", +"link_panels.carry_here":"Acheminer ici", "link_panels.click_to_tear_down":"Clique pour couper la session", "link_panels.collecting_data_check_back_in_a":"Collecte des données en cours. Repasse dans quelques jours.", "link_panels.congested_upgrade_it_or_add_a":"Saturé. Augmente sa capacité ou ajoute un chemin parallèle.", @@ -2114,6 +2116,7 @@ "link_panels.de_kicks_personalised_pricing_p_of_3d4f":"Tarif personnalisé DE-KICKS : {p} % de ce que facturerait un IX normal.", "link_panels.each_channel_is_a_pair_of":"Chaque canal, c’est une paire d’optiques, une à chaque bout. Les optiques ZR+ se branchent directement dans tes routeurs. Les transpondeurs vivent sur une étagère.", "link_panels.enters_your_network_at":"Entre dans ton réseau à", +"link_panels.every_pop_carries_net_s_traffic":"Chaque POP achemine le trafic de {net} à travers ton réseau jusqu’à ce port.", "link_panels.finish_in_1_day_price":"Terminer en 1 jour {price}", "link_panels.foreign_networks_need_a_local_joint":"Les réseaux étrangers ont besoin d’une coentreprise locale et d’une licence d’opérateur pour construire ici.", "link_panels.found_your_own_ix_cost_mo":"Fonder ton propre IX {cost} + {mo}/mois", @@ -2146,6 +2149,7 @@ "link_panels.name_is_down_nothing_you_can":"{name} est en panne. Rien à faire à part attendre, ou avoir un autre chemin.", "link_panels.name_parallel_link":"Lien parallèle {name}", "link_panels.name_wave":"Longueur d’onde {name}", +"link_panels.nearest_port":"Port le plus proche", "link_panels.needs_a_pop_in_cities_too":"Il faut aussi un POP à {cities}.", "link_panels.needs_what":"requiert {what}", "link_panels.needs_your_own_scrubbing_center":"Il faut ton propre centre de scrubbing (onglet Infra).", @@ -2205,6 +2209,7 @@ "link_panels.this_is_the_only_link_between":"C’est le seul lien entre ces villes. Ajoutes-en un parallèle, ou un chemin via une autre ville.", "link_panels.tier_1_only_a_pni_and":"Tier 1 : PNI uniquement, et seulement quand tu seras assez gros pour le club des Tier 1", "link_panels.totals_for_all_n_links_between":"Totaux des {n} liens entre ces villes.", +"link_panels.traffic_for_net":"Trafic vers {net}", "link_panels.unplugged_optics_go_on_the_spares":"Les optiques débranchées vont sur l’étagère de rechange et sont utilisées en premier la fois suivante.", "link_panels.upgrade_fabric_to_name_cost_mo":"Passer au fabric {name} {cost} + {mo}/mois", "link_panels.upgrade_to_sys_price":"Passer à {sys} {price}", @@ -3048,6 +3053,7 @@ "traceroute.ix_peering_beats_transit":"le peering IX bat le transit", "traceroute.n_network_unreachable":"!N réseau injoignable", "traceroute.name_transit":"Transit {name}", +"traceroute.net_buys_transit_from_carrier_so_that":"{net} achète du transit chez {carrier}, donc ce port passe avant les autres ports de transit.", "traceroute.net_carries_it_to_city":"{net} l’achemine jusqu’à {city}", "traceroute.net_hands_it_to_to":"{net} le passe à {to}", "traceroute.no_path_every_route_between_these":"Aucun chemin : toutes les routes entre ces villes sont coupées ou inexistantes.", @@ -3056,6 +3062,7 @@ "traceroute.pnis_beat_ix_peering":"les PNI battent le peering IX", "traceroute.private_cross_connect":"cross-connect privé", "traceroute.rule_and_closer_exits_win_ties":"{rule}, et la sortie la plus proche l’emporte en cas d’égalité", +"traceroute.the_carrier_s_own_port_beats_other":"Ce port mène directement chez {net}, donc il passe avant les autres ports de transit.", "traceroute.this_one_is_set_to_mode":" ; celle-ci est réglée sur {mode}", "traceroute.transit_is_the_last_resort":"le transit est le dernier recours", "tutorial.businesses_pop_up_as_bubbles_on":"Les entreprises apparaissent sous forme de bulles $ sur la carte. Ouvre Offres et signe ton premier client.", diff --git a/site/i18n/it.js b/site/i18n/it.js index 103bc61..b763e03 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -2100,12 +2100,14 @@ "link_panels.abandon_the_fiber":"Abbandona la fibra", "link_panels.add_parallel_link":"Aggiungi link parallelo", "link_panels.apply_for_a_license_price_mo":"Richiedi una licenza {price} + {mo}/mese · ~45 giorni", +"link_panels.at_this_pop_net_s_traffic_always":"In questo POP il traffico di {net} usa sempre questa porta. I POP che non ne hanno una usano la porta di transit più vicina.", "link_panels.back_in_n_days":"Torna tra {n} giorni.", "link_panels.behind_the_great_firewall":"Dietro il Great Firewall", "link_panels.biggest_fabric_money_can_buy":"Il fabric più grosso che si possa comprare.", "link_panels.biggest_feeder_egress_in_city_set":"Fonte principale: {egress} a {city}. Impostala su “Solo backup”, dai ai clienti un’uscita più vicina (peering, una cache, transit locale) o alza la metrica di questo link.", "link_panels.build_a_pop_here_first":"Prima costruisci un POP qui.", "link_panels.cancel_the_iru":"Disdici l’IRU", +"link_panels.carry_here":"Porta qui", "link_panels.click_to_tear_down":"Clicca per chiudere la sessione", "link_panels.collecting_data_check_back_in_a":"Raccolta dati in corso. Ripassa tra qualche giorno.", "link_panels.congested_upgrade_it_or_add_a":"Congestionato. Potenzialo o aggiungi un percorso parallelo.", @@ -2114,6 +2116,7 @@ "link_panels.de_kicks_personalised_pricing_p_of_3d4f":"Prezzi personalizzati DE-KICKS: {p}% di quanto chiederebbe un IX normale.", "link_panels.each_channel_is_a_pair_of":"Ogni canale è una coppia di ottiche, una per estremità. Le ottiche ZR+ si infilano direttamente nei tuoi router. I transponder stanno su uno scaffale.", "link_panels.enters_your_network_at":"Entra nella tua rete a", +"link_panels.every_pop_carries_net_s_traffic":"Ogni POP porta il traffico di {net} attraverso la tua rete fino a questa porta.", "link_panels.finish_in_1_day_price":"Termina in 1 giorno {price}", "link_panels.foreign_networks_need_a_local_joint":"Per costruire infrastrutture qui, le reti straniere hanno bisogno di una joint venture locale e di una licenza operativa.", "link_panels.found_your_own_ix_cost_mo":"Fonda il tuo IX {cost} + {mo}/mese", @@ -2146,6 +2149,7 @@ "link_panels.name_is_down_nothing_you_can":"{name} è giù. Non puoi far altro che aspettare, o avere un altro percorso.", "link_panels.name_parallel_link":"Link parallelo {name}", "link_panels.name_wave":"Wave {name}", +"link_panels.nearest_port":"Porta più vicina", "link_panels.needs_a_pop_in_cities_too":"Serve un POP anche a {cities}.", "link_panels.needs_what":"serve {what}", "link_panels.needs_your_own_scrubbing_center":"Serve il tuo centro di scrubbing (scheda Infra).", @@ -2205,6 +2209,7 @@ "link_panels.this_is_the_only_link_between":"È l’unico link tra queste città. Aggiungine uno parallelo, o un percorso che passi da un’altra città.", "link_panels.tier_1_only_a_pni_and":"Tier 1: solo un PNI, e solo quando sarai abbastanza grande per il club dei Tier 1", "link_panels.totals_for_all_n_links_between":"Totali di tutti i {n} link tra queste città.", +"link_panels.traffic_for_net":"Traffico per {net}", "link_panels.unplugged_optics_go_on_the_spares":"Le ottiche scollegate vanno sullo scaffale dei ricambi e la volta dopo si usano per prime.", "link_panels.upgrade_fabric_to_name_cost_mo":"Passa al fabric {name} {cost} + {mo}/mese", "link_panels.upgrade_to_sys_price":"Passa a {sys} {price}", @@ -3048,6 +3053,7 @@ "traceroute.ix_peering_beats_transit":"il peering IX batte il transit", "traceroute.n_network_unreachable":"!N rete irraggiungibile", "traceroute.name_transit":"Transit {name}", +"traceroute.net_buys_transit_from_carrier_so_that":"{net} compra transit da {carrier}, quindi quella porta batte le altre porte di transit.", "traceroute.net_carries_it_to_city":"{net} lo porta fino a {city}", "traceroute.net_hands_it_to_to":"{net} lo passa a {to}", "traceroute.no_path_every_route_between_these":"Nessun percorso: ogni strada tra queste città è giù o non esiste.", @@ -3056,6 +3062,7 @@ "traceroute.pnis_beat_ix_peering":"i PNI battono il peering IX", "traceroute.private_cross_connect":"cross-connect privato", "traceroute.rule_and_closer_exits_win_ties":"{rule}, e a parità vince l’uscita più vicina", +"traceroute.the_carrier_s_own_port_beats_other":"Questa porta va direttamente a {net}, quindi batte le altre porte di transit.", "traceroute.this_one_is_set_to_mode":"; questa è impostata su {mode}", "traceroute.transit_is_the_last_resort":"il transit è l’ultima spiaggia", "tutorial.businesses_pop_up_as_bubbles_on":"Le aziende spuntano come bolle $ sulla mappa. Apri Offerte e firma il tuo primo cliente.", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index 046f9a8..7241d44 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -2100,12 +2100,14 @@ "link_panels.abandon_the_fiber":"Abandonar a fibra", "link_panels.add_parallel_link":"Adicionar link paralelo", "link_panels.apply_for_a_license_price_mo":"Pedir licença {price} + {mo}/mês · ~45 dias", +"link_panels.at_this_pop_net_s_traffic_always":"Neste POP, o tráfego de {net} sempre usa esta porta. POPs sem uma usam a porta de transit mais próxima.", "link_panels.back_in_n_days":"Volta em {n} dias.", "link_panels.behind_the_great_firewall":"Atrás do Great Firewall", "link_panels.biggest_fabric_money_can_buy":"O maior fabric que o dinheiro pode comprar.", "link_panels.biggest_feeder_egress_in_city_set":"Maior fonte: {egress} em {city}. Coloque em “Só backup”, dê aos clientes uma saída mais próxima (peering, um cache, transit local) ou aumente a métrica deste link.", "link_panels.build_a_pop_here_first":"Construa um POP aqui primeiro.", "link_panels.cancel_the_iru":"Cancelar o IRU", +"link_panels.carry_here":"Trazer para cá", "link_panels.click_to_tear_down":"Clique para encerrar", "link_panels.collecting_data_check_back_in_a":"Coletando dados. Volte em alguns dias.", "link_panels.congested_upgrade_it_or_add_a":"Congestionado. Faça upgrade ou adicione um caminho paralelo.", @@ -2114,6 +2116,7 @@ "link_panels.de_kicks_personalised_pricing_p_of_3d4f":"Preço personalizado DE-KICKS: {p}% do que um IX normal cobraria.", "link_panels.each_channel_is_a_pair_of":"Cada canal é um par de ópticas, uma em cada ponta. Ópticas ZR+ encaixam direto nos seus routers. Transponders ficam numa prateleira.", "link_panels.enters_your_network_at":"Entra na sua rede em", +"link_panels.every_pop_carries_net_s_traffic":"Cada POP leva o tráfego de {net} pela sua rede até esta porta.", "link_panels.finish_in_1_day_price":"Concluir em 1 dia {price}", "link_panels.foreign_networks_need_a_local_joint":"Redes estrangeiras precisam de uma joint venture local e de uma licença de operação para construir infraestrutura aqui.", "link_panels.found_your_own_ix_cost_mo":"Fundar seu próprio IX {cost} + {mo}/mês", @@ -2146,6 +2149,7 @@ "link_panels.name_is_down_nothing_you_can":"{name} caiu. Não há o que fazer além de esperar, ou ter outro caminho.", "link_panels.name_parallel_link":"Link paralelo {name}", "link_panels.name_wave":"Wave {name}", +"link_panels.nearest_port":"Porta mais próxima", "link_panels.needs_a_pop_in_cities_too":"Requer um POP em {cities} também.", "link_panels.needs_what":"requer {what}", "link_panels.needs_your_own_scrubbing_center":"Requer seu próprio centro de scrubbing (aba Infra).", @@ -2205,6 +2209,7 @@ "link_panels.this_is_the_only_link_between":"É o único link entre essas cidades. Adicione um paralelo, ou um caminho passando por outra cidade.", "link_panels.tier_1_only_a_pni_and":"Tier 1: só PNI, e só quando você for grande o bastante para o clube dos Tier 1", "link_panels.totals_for_all_n_links_between":"Totais de todos os {n} links entre essas cidades.", +"link_panels.traffic_for_net":"Tráfego para {net}", "link_panels.unplugged_optics_go_on_the_spares":"Ópticos desconectados vão para a prateleira de reservas e são usados primeiro na próxima vez.", "link_panels.upgrade_fabric_to_name_cost_mo":"Upgrade para fabric {name} {cost} + {mo}/mês", "link_panels.upgrade_to_sys_price":"Atualizar para {sys} {price}", @@ -3048,6 +3053,7 @@ "traceroute.ix_peering_beats_transit":"peering no IX vence transit", "traceroute.n_network_unreachable":"!N rede inalcançável", "traceroute.name_transit":"Transit {name}", +"traceroute.net_buys_transit_from_carrier_so_that":"{net} compra transit de {carrier}, então essa porta vence as outras portas de transit.", "traceroute.net_carries_it_to_city":"{net} leva até {city}", "traceroute.net_hands_it_to_to":"{net} passa para {to}", "traceroute.no_path_every_route_between_these":"Sem caminho: todas as rotas entre essas cidades estão fora do ar ou não existem.", @@ -3056,6 +3062,7 @@ "traceroute.pnis_beat_ix_peering":"PNIs vencem peering no IX", "traceroute.private_cross_connect":"cross-connect privado", "traceroute.rule_and_closer_exits_win_ties":"{rule}, e no empate vence a saída mais próxima", +"traceroute.the_carrier_s_own_port_beats_other":"Esta porta vai direto para {net}, então vence as outras portas de transit.", "traceroute.this_one_is_set_to_mode":"; esta está configurada como {mode}", "traceroute.transit_is_the_last_resort":"transit é o último recurso", "tutorial.businesses_pop_up_as_bubbles_on":"Empresas aparecem como bolhas de $ no mapa. Abra Negócios e feche seu primeiro cliente.", diff --git a/src/game/60-features/50-traceroute.js b/src/game/60-features/50-traceroute.js index dd7ad77..db19a5f 100644 --- a/src/game/60-features/50-traceroute.js +++ b/src/game/60-features/50-traceroute.js @@ -10,7 +10,7 @@ function trExits(net){const day=S.day,ev=S.ev,leak=ev.leak&&ev.leak.until>day?ev for(const x of S.caches)if(x.net===net&&popUp(x.city)&&!siteDown(x.city,'a'))out.push({k:'c',rank:0,city:x.city,pref:'normal',lab:tr('common.name_cache',{name:NET[net].cache.name}),used:R.useCache[x.id]||0,cap:CACHE_CAP}); for(const p of S.pni)if(p.net===net&&pniOn(p)&&popUp(p.city)&&liveN(p.city,p.site,p.n))out.push({k:'p',rank:1,city:p.city,pref:p.pref||'normal',lab:tr('common.pni_with_net',{net:NET[net].name}),used:R.usePni[p.id]||0,cap:liveCap(pniG(p),p.city,p.site,p.n)}); for(const c in S.ixp)if(ixSessions(c).has(net)&&(popUp(ixCity(c))||remoteCities().includes(ixCity(c)))&&!(ev.ixdown&&ev.ixdown[c]>day))out.push({k:'ix',rank:2,city:ixCity(c),id:c,pref:(S.ixPref&&S.ixPref[c])||'normal',lab:tr('common.ix_peering',{ix:ixName(c)}),used:R.useIx[c]||0,cap:ixCap(c)}); - for(const t of S.transit)if(popUp(t.city)&&!(t.down>day)&&liveN(t.city,t.site,t.n)&&net!==leak&&!((ev.depeer>day||scnRule('spat'))&&t.net==='cog'&&net==='ggl'))out.push({k:'t',rank:3,city:t.city,pref:t.pref||'normal',lab:tr('traceroute.name_transit',{name:NET[t.net].name}),tnet:t.net,used:R.useT[t.id]||0,cap:liveCap(PORT[t.tier].g,t.city,t.site,t.n)}); + for(const t of S.transit)if(popUp(t.city)&&!(t.down>day)&&liveN(t.city,t.site,t.n)&&net!==leak&&!((ev.depeer>day||scnRule('spat'))&&t.net==='cog'&&net==='ggl'))out.push({k:'t',rank:3,city:t.city,pref:t.pref||'normal',carry:!!t.carry,lab:tr('traceroute.name_transit',{name:NET[t.net].name}),tnet:t.net,used:R.useT[t.id]||0,cap:liveCap(PORT[t.tier].g,t.city,t.site,t.n)}); return out;} function traceroute(src,to){const P=trPaths(src),me=slug(S.name)+'.net',lines=[],ip=(a,b)=>`100.64.${a%250}.${b%250}`;let rtt=0.3,n=1; const hop=(host,addr,extra,note)=>{rtt+=extra;lines.push(`${String(n++).padStart(2)} ${host} (${addr}) ${rtt.toFixed(1)} ms${note?' ← '+note:''}`);}; @@ -20,8 +20,12 @@ function traceroute(src,to){const P=trPaths(src),me=slug(S.name)+'.net',lines=[] const N=NET[to.net],ex=trExits(to.net).filter(e=>P.dist[e.city]!==undefined); lines.unshift(`traceroute to www.${slug(N.name)}.example (${N.name}, AS${N.asn}) from ${CITY[src].name}, 30 hops max`); if(!ex.length){lines.push(' 2 * * *\n 3 * * * ← '+tr('traceroute.n_network_unreachable'));return {text:lines.join('\n'),why:tr('traceroute.nothing_on_your_network_reaches_net',{net:N.name,city:CITY[src].name}),asPath:null};} - ex.sort((a,b)=>(a.pref==='low'?4:a.rank)-(b.pref==='low'?4:b.rank)||(a.pref==='high'?0:1)-(b.pref==='high'?0:1)||P.dist[a.city]-P.dist[b.city]); + // As in compute(): a carrier's own port (or its customers' carrier) goes before other transit, at this POP or anywhere when it carries. + const hiAny=S.transit.some(t=>t.pref==='high'&&popUp(t.city)&&!(t.down>S.day)&&liveN(t.city,t.site,t.n)),dtier=e=>hiAny||e.k!=='t'||e.pref==='low'?0:directTier(e.tnet,N.id); + const rk=e=>{const r=e.pref==='low'?4:e.rank,t=dtier(e);return t&&(e.carry||e.city===src)?Math.min(r,DIRECT_RANK[t][e.carry?0:1]):r;}; + ex.sort((a,b)=>rk(a)-rk(b)||(a.pref==='high'?0:1)-(b.pref==='high'?0:1)||P.dist[a.city]-P.dist[b.city]); const e=ex.find(x=>x.usedkmBetween(e.city,c)S.day?35:20}):''; - return {text:lines.join('\n'),why:`${tr('traceroute.exit_exit_in_city',{exit:e.lab,city:CITY[e.city].name})} ${tr('traceroute.rule_and_closer_exits_win_ties',{rule:order[0].toUpperCase()+order.slice(1)})}${e.pref!=='normal'?tr('traceroute.this_one_is_set_to_mode',{mode:e.pref==='high'?tr('common.prefer'):tr('common.backup_only')}):''}.${e.used>=e.cap*0.999?' '+tr('traceroute.it_is_full_so_some_traffic'):''}${cn}`,asPath};} + return {text:lines.join('\n'),why:`${tr('traceroute.exit_exit_in_city',{exit:e.lab,city:CITY[e.city].name})} ${tr('traceroute.rule_and_closer_exits_win_ties',{rule:order[0].toUpperCase()+order.slice(1)})}${e.pref!=='normal'?tr('traceroute.this_one_is_set_to_mode',{mode:e.pref==='high'?tr('common.prefer'):tr('common.backup_only')}):''}.${direct}${e.used>=e.cap*0.999?' '+tr('traceroute.it_is_full_so_some_traffic'):''}${cn}`,asPath};} function traceModal(src,to){const pops=Object.keys(S.pops).sort((a,b)=>CITY[a].name.localeCompare(CITY[b].name));src=src&&S.pops[src]?src:UI.trFrom&&S.pops[UI.trFrom]?UI.trFrom:S.home&&S.pops[S.home]?S.home:pops[0]; const nets=NETS.slice().sort((a,b)=>b.share-a.share),t=to||UI.trTo||'net:ggl';UI.trFrom=src;UI.trTo=t; const r=t.startsWith('net:')?traceroute(src,{net:t.slice(4)}):traceroute(src,{city:t.slice(5)}); diff --git a/src/game/80-simulation/25-direct-egress.js b/src/game/80-simulation/25-direct-egress.js new file mode 100644 index 0000000..e02750f0 --- /dev/null +++ b/src/game/80-simulation/25-direct-egress.js @@ -0,0 +1,7 @@ +/* A carrier's own transit port beats other transit ports for traffic bound for that carrier (tier 1) or for a network + that buys transit from it (tier 2): the shorter AS path. A port set to carry pulls that traffic from every POP; any + other only takes it at the POP it sits in. These ranks come after RouteScript's `prefer transit` (2.9) and before plain + transit (3), and each port stays in the plain transit list too, so POPs far from it can still use it. + DIRECT_RANK[tier] = [carries, this POP only]. compute() and traceroute() share this. */ +const DIRECT_RANK=[null,[2.92,2.93],[2.94,2.95]]; +const directTier=(carrier,dest)=>carrier===dest?1:(NET[dest].up&&NET[dest].up.includes(carrier))?2:0; diff --git a/src/game/80-simulation/30-compute.js b/src/game/80-simulation/30-compute.js index cbe0fd6..c0e882d 100644 --- a/src/game/80-simulation/30-compute.js +++ b/src/game/80-simulation/30-compute.js @@ -19,7 +19,7 @@ function compute(){ for(const t of S.transit){if(!popUp(t.city)||t.down>day||!liveN(t.city,t.site,t.n))continue; // AS-path prepending (#96) moves part of the port to a last-resort exit of its own. const cap=Math.min(liveCap(PORT[t.tier].g,t.city,t.site,t.n)*lagF(t),TRX&&TRX.cap[t.net]!==undefined?TRX.cap[t.net]:Infinity),pf=TRX&&TRX.prep[t.net]?PREPEND_F[TRX.prep[t.net]]:0; - const ex={k:'t',net:t.net,prem:premOn(t),pref:t.pref||'normal',lab:labOf(N_('common.net_transit'),'net',NET[t.net].name),id:t.id,city:t.city,cap:cap*(1-pf),used:0,rank:3,ok:n=>!(depeer&&t.net==='cog'&&n==='ggl')&&n!==leak}; + const ex={k:'t',net:t.net,prem:premOn(t),pref:t.pref||'normal',carry:!!t.carry,lab:labOf(N_('common.net_transit'),'net',NET[t.net].name),id:t.id,city:t.city,cap:cap*(1-pf),used:0,rank:3,ok:n=>!(depeer&&t.net==='cog'&&n==='ggl')&&n!==leak}; E.push(ex);if(pf)E.push({...ex,cap:cap*pf,prep:true});} // `nets`: every network ok() can say yes to, so it need not be asked about the other hundred. for(const c in S.ixp){const ct=ixCity(c);if(!(popUp(ct)||remote.includes(ct))||(S.ev.ixdown&&S.ev.ixdown[c]>day)||!(S.myIx[c]?myIxLive(c):liveN(ct,(S.ixSite||{})[c],(S.ixn||{})[c])))continue;const set=ixSessions(c);R2.sessions+=set.size; @@ -150,12 +150,19 @@ function compute(){ const base=e=>e.pref==='low'?4:e.rank; // LOCAL_PREF on an upstream moves it ahead of or behind the other transits, never ahead of peering (#96). const eff=(e,n)=>{let r=base(e);if(TR){if(e.k==='t'&&TR.up[e.net])r=TR.up[e.net]==='prefer'?2.9:3.5;if(e.prep)r=4.4;if(e.k!=='c'&&TR.drain.has(e.city))r=4.6;const o=TR.net[n];if(o){if(o.prefer===e.k)r=0.5;else if(o.avoid===e.k)r=4.5;}}return r;}; - const RANKS=TR?[0,0.5,1,2,2.9,3,3.5,4,4.4,4.5,4.6]:[0,1,2,3,4]; + // A carrier's own port for traffic bound for it or for its customers (25-direct-egress.js): tried before plain transit, but + // never over RouteScript, a Prefer-marked port or a port set to backup, which all keep the say they had. Such a port is + // also an ordinary transit exit (rank 3), so POPs without one of its own can still use it. + const hiAny=E.some(e=>e.k==='t'&&e.pref==='high'); + const dr=(e,n)=>{if(hiAny||e.k!=='t')return 0;const t=directTier(e.net,n);return t&&eff(e,n)===3?DIRECT_RANK[t][e.carry?0:1]:0;}; + const RANKS=TR?[0,0.5,1,2,2.9,2.92,2.93,2.94,2.95,3,3.5,4,4.4,4.5,4.6]:[0,1,2,2.92,2.93,2.94,2.95,3,4]; // With `protect customers`, business flows take every rank first; home users get what is left. const PASSES=TR&&TR.protect?[x=>x.bz,x=>!x.bz]:null; // Each network's exits by the rank they route at (RouteScript can move an exit per network), in E's order. // Each list also knows whether it holds a preferred exit (hi) and its exits by city (at), in list order. - const byRank={};for(const id of NET_IDS){const m=byRank[id]={};for(const e of okBy[id]){const r=TR?eff(e,id):base(e);(m[r]||(m[r]=[])).push(e);} + // usedRank: the ranks that have a list for some network, so a rank nobody sits at costs no pass over the flows. + const byRank={},usedRank=new Set();for(const id of NET_IDS){const m=byRank[id]={};for(const e of okBy[id]){const r=TR?eff(e,id):base(e);(m[r]||(m[r]=[])).push(e);usedRank.add(r); + const d=dr(e,id);if(d){(m[d]||(m[d]=[])).push(e);usedRank.add(d);}} for(const r in m){const L=m[r];L.hi=L.some(e=>e.hp===0);L.at=new Map();for(const e of L){const h=L.at.get(e.ci);if(h)h.push(e);else L.at.set(e.ci,[e]);}}} // The flow being routed, and from its POP: distances, arriving edges and the paths walked so far, by city index. let f=null,Dv=null,Pv=null,PP=null,vis=0;const walked=[],G=[],REST=[],NEG=[]; @@ -200,12 +207,15 @@ function compute(){ // same comparison, so the order is the same either way. const sortD=a=>{const n=a.length;if(n>24){a.sort(byDist);return;}for(let i=1;i=0&&byDist(a[j],x)>0){a[j+1]=a[j];j--;}a[j+1]=x;}}; for(const pass of PASSES||[null])for(const rank of RANKS){ - if(TR?!E.length:!E.some(e=>base(e)===rank))continue; + if(!usedRank.has(rank))continue; + // A carrier's own port that is not set to carry only takes the traffic of the POP it sits in. + const LOC=rank===DIRECT_RANK[1][1]||rank===DIRECT_RANK[2][1]; // Index loops in here: plain for…of allocates an iterator per loop until V8 has optimised compute(). for(let fi=0,FN=flows.length;fiv&&typeof v==='object'?{until:num(v.until,0),f:Math.min(1,Math.max(0,num(v.f,1)))}:null; - s.transit=s.transit.filter(t=>t&&isCity(t.city)&&isNet(t.net)).map(t=>(t.lacp=degO(t.lacp),t.site=['a','b','ab'].includes(t.site)?t.site:'a',t.id=sid(t.id),t.tier=tier(t.tier),t.n=lag(t.n),t.down=num(t.down,0),t.clean=!!t.clean,t.premium=premOnlyAt(NET[t.net],t.city)||!!t.premium&&premCity(NET[t.net],t.city),t)); + s.transit=s.transit.filter(t=>t&&isCity(t.city)&&isNet(t.net)).map(t=>(t.lacp=degO(t.lacp),t.site=['a','b','ab'].includes(t.site)?t.site:'a',t.id=sid(t.id),t.tier=tier(t.tier),t.n=lag(t.n),t.down=num(t.down,0),t.clean=!!t.clean,t.carry===true||delete t.carry,t.premium=premOnlyAt(NET[t.net],t.city)||!!t.premium&&premCity(NET[t.net],t.city),t)); s.pni=s.pni.filter(x=>x&&isCity(x.city)&&isNet(x.net)).map(x=>(x.lacp=degO(x.lacp),x.site=['a','b','ab'].includes(x.site)?x.site:'a',x.id=sid(x.id),x.tier=tier(x.tier),x.n=lag(x.n),x.sacrif=!!x.sacrif,x)); // PNIs on order (#…): delivery day, a pending augment, and 1G for the one network that sells it for(const x of s.pni){if(x.ready!==undefined)x.ready=num(x.ready,0);if(x.g1)x.g1=x.tier===0&&x.net==='dtk'?true:undefined;else delete x.g1;if(x.up){const u=x.up;x.up=u&&typeof u==='object'?{tier:tier(u.tier),n:lag(u.n),ready:num(u.ready,0),g1:!!u.g1&&x.net==='dtk'&&tier(u.tier)===0}:undefined;if(!x.up)delete x.up;}} diff --git a/src/game/90-actions/60-links.js b/src/game/90-actions/60-links.js index 0e6faff..4b940cc 100644 --- a/src/game/90-actions/60-links.js +++ b/src/game/90-actions/60-links.js @@ -29,6 +29,7 @@ Object.assign(ACT,{ cancelVxc:({id})=>{if(UI.confirm!==id){UI.confirm=id;renderPanel();return;}S.links=S.links.filter(l=>l.id!==id);prunePairMet();const rem=remoteCities();for(const c in S.ixp){if(!S.pops[ixCity(c)]&&!rem.includes(ixCity(c))){delete S.ixp[c];delete S.rs[c];for(const k in S.peers)if(k.endsWith('@'+c))delete S.peers[k];}}UI.sel=null;UI.confirm=null;after();}, setPref:({kind,id,v})=>{if(!own(PREF,v))return;if(kind!=='t'&&kind!=='p'&&!(isIx(id)&&S.ixp[id]!==undefined))return;if(kind==='t'){const t=S.transit.find(x=>x.id===id);if(t)t.pref=v;}else if(kind==='p'){const x=S.pni.find(y=>y.id===id);if(x)x.pref=v;}else{S.ixPref=S.ixPref||{};S.ixPref[id]=v;}sfx('click');after();}, setMetric:({id,v})=>{if(!own(MET,v))return;const l=S.links.find(x=>x.id===id);if(!l)return;const m=S.pairMet||(S.pairMet={}),k=edgeKey(l);if(v==='normal')delete m[k];else m[k]=v;sfx('click');after();}, + setCarry:({id,on})=>{const t=S.transit.find(x=>x.id===id);if(!t)return;if(on)t.carry=true;else delete t.carry;sfx('click');after();}, setStandby:({id,on})=>{const l=S.links.find(x=>x.id===id);if(!l)return;if(on)l.standby=true;else delete l.standby;sfx('click');after();}, goEgress:({city,k})=>{ACT.focusCity({city});UI.tab=k==='t'?'up':k==='l2'?'cust':k==='nni'?'links':'peer';renderPanel();}, }); diff --git a/src/game/93-ui/50-city-panel.js b/src/game/93-ui/50-city-panel.js index 90aa26a..fd44aba 100644 --- a/src/game/93-ui/50-city-panel.js +++ b/src/game/93-ui/50-city-panel.js @@ -45,7 +45,7 @@ function cityPanel(c){ for(const n of prov){const t=S.transit.find(x=>x.city===c&&x.net===n.id);const pr=transitPerG(n,c,premOnlyAt(n,c)||!!(t&&premOn(t)))*S.priceMul; h+=`
${logo(n)}
${esc(n.name)} ${TYPE_L[n.type]}
${tr('city_panel.price_per_gbps_month_billed_on',{price:pr.toFixed(2)})}
${premOnlyAt(n,c)&&!t?`
${tr('city_panel.only_the_cn_too_premium_crossing')}
`:''}`; if(t){const u=R.useT[t.id]||0,cap=lagCap(PORT[t.tier].g,t.n),tdown=t.down>S.day; - h+=`
${lagName(t.tier,t.n)}${tdown?' · '+tr('common.outage')+'':''}${fmtG(u)}
${prefCtl('t',t.id,t.pref)}${siteCtl('t',t.id,c,t.site)}${premOnlyAt(n,c)?`

${tr('city_panel.only_the_cn_too_premium_crossing')}

`:premCity(n,c)?`
${btn(t.premium?tr('city_panel.cn_too_premium_on'):tr('city_panel.switch_to_cn_too_premium_x',{x:n.premium}),'togglePrem',{id:t.id},t.premium?'green sm':'sm')}
`:''}${(()=>{const top=transitTop([t.id],4);return top.length?`
${tr('city_panel.top_destinations_on_this_port')}
${top.map(([id,v])=>`
${esc(NET[id].name)} · ${fmtG(v)} · ${esc(offTransitHint(id,c))}
`).join('')}
`:'';})()}
${tr('city_panel.95th_pct_p95_commit_commit_bill',{p95:fmtG(R.p95[t.id]||0),commit:fmtG(cap*.2),bill:fmt$(Math.max(R.p95[t.id]||0,PORT[t.tier].g*(t.n||1)*.2)*pr+PORT[t.tier].tmo*(t.n||1))})}
+ h+=`
${lagName(t.tier,t.n)}${tdown?' · '+tr('common.outage')+'':''}${fmtG(u)}
${prefCtl('t',t.id,t.pref)}${carryCtl(t)}${siteCtl('t',t.id,c,t.site)}${premOnlyAt(n,c)?`

${tr('city_panel.only_the_cn_too_premium_crossing')}

`:premCity(n,c)?`
${btn(t.premium?tr('city_panel.cn_too_premium_on'):tr('city_panel.switch_to_cn_too_premium_x',{x:n.premium}),'togglePrem',{id:t.id},t.premium?'green sm':'sm')}
`:''}${(()=>{const top=transitTop([t.id],4);return top.length?`
${tr('city_panel.top_destinations_on_this_port')}
${top.map(([id,v])=>`
${esc(NET[id].name)} · ${fmtG(v)} · ${esc(offTransitHint(id,c))}
`).join('')}
`:'';})()}
${tr('city_panel.95th_pct_p95_commit_commit_bill',{p95:fmtG(R.p95[t.id]||0),commit:fmtG(cap*.2),bill:fmt$(Math.max(R.p95[t.id]||0,PORT[t.tier].g*(t.n||1)*.2)*pr+PORT[t.tier].tmo*(t.n||1))})}
${PORT.map((P2,i)=>i>t.tier&&portShown(i)?btn((t.n||1)>1?tr('common.upgrade_all_to_port_cost_mo',{port:P2.n,cost:fmt$(P2.setup*(t.n||1)),mo:fmt$(P2.tmo*(t.n||1))}):tr('common.upgrade_port_cost_mo_mo',{port:P2.n,cost:fmt$(P2.setup*(t.n||1)),mo:fmt$(P2.tmo*(t.n||1))}),'buyTransit',{city:c,net:n.id,tier:i},'sm',S.cash1?btn(tr('common.member'),'lagT',{id:t.id,d:-1},'ghost sm'):''}${btn(t.clean?tr('city_panel.clean_pipe_on'):tr('city_panel.clean_pipe_mo_mo_scrubs_ddos',{mo:fmt$(cleanMo(t))}),'cleanPipe',{id:t.id},t.clean?'green sm':'sm')}${btn(UI.confirm===t.id?tr('common.really_cancel'):tr('common.cancel'),'cancelTransit',{id:t.id},'ghost sm')}
`;} else h+=`
${PORT.map((P2,i)=>portShown(i)?btn(tr('city_panel.port_cost_mo_mo',{port:P2.n,cost:fmt$(P2.setup),mo:fmt$(P2.tmo)}),'buyTransit',{city:c,net:n.id,tier:i},'sm',S.cash`; h+=`
`;} diff --git a/src/game/93-ui/70-link-panels.js b/src/game/93-ui/70-link-panels.js index 0378b3f..820f834 100644 --- a/src/game/93-ui/70-link-panels.js +++ b/src/game/93-ui/70-link-panels.js @@ -34,6 +34,10 @@ function vxcPanel(l){ return h; } function prefCtl(kind,id,cur){cur=cur||'normal';return `
${tr('common.egress')}${Object.keys(PREF).map(v=>btn(PREF[v],'setPref',{kind,id,v},cur===v?'pink sm':'ghost sm')).join('')}
`;} +// At its own POP a carrier's port always takes that carrier's traffic (25-direct-egress.js). From POPs with no port of it, the +// traffic goes to the nearest transit port, or across your network to this one. Only worth asking when something else could take it. +function carryCtl(t){if(Object.keys(S.pops).length<2||!S.transit.some(x=>x.net!==t.net))return '';const n=esc(NET[t.net].name); + return `
${tr('link_panels.traffic_for_net',{net:n})}${btn(tr('link_panels.nearest_port'),'setCarry',{id:t.id,on:0},t.carry?'ghost sm':'pink sm')}${btn(tr('link_panels.carry_here'),'setCarry',{id:t.id,on:1},t.carry?'pink sm':'ghost sm')}
${t.carry?tr('link_panels.every_pop_carries_net_s_traffic',{net:n}):tr('link_panels.at_this_pop_net_s_traffic_always',{net:n})}
`;} function trafficSection(l){ const rec=R.ef[edgeKey(l)],n=pairLinks(l.a,l.b).length; let h=`

${tr('link_panels.what_s_on_this_link')}

`; diff --git a/src/i18n/en.js b/src/i18n/en.js index 008cdfd..fe529d6 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -2101,12 +2101,14 @@ "link_panels.abandon_the_fiber":"Abandon the fiber", "link_panels.add_parallel_link":"Add parallel link", "link_panels.apply_for_a_license_price_mo":"Apply for a license {price} + {mo}/mo · ~45 days", +"link_panels.at_this_pop_net_s_traffic_always":"At this POP, {net}'s traffic always uses this port. POPs without one use their nearest transit port.", "link_panels.back_in_n_days":"Back in {n} days.", "link_panels.behind_the_great_firewall":"Behind the Great Firewall", "link_panels.biggest_fabric_money_can_buy":"Biggest fabric money can buy.", "link_panels.biggest_feeder_egress_in_city_set":"Biggest feeder: {egress} in {city}. Set it to “Backup only”, give the customers a closer egress (peering, a cache, local transit), or raise this link's metric.", "link_panels.build_a_pop_here_first":"Build a POP here first.", "link_panels.cancel_the_iru":"Cancel the IRU", +"link_panels.carry_here":"Carry here", "link_panels.click_to_tear_down":"Click to tear down", "link_panels.collecting_data_check_back_in_a":"Collecting data. Check back in a few days.", "link_panels.congested_upgrade_it_or_add_a":"Congested. Upgrade it or add a parallel path.", @@ -2115,6 +2117,7 @@ "link_panels.de_kicks_personalised_pricing_p_of_3d4f":"DE-KICKS personalised pricing: {p}% of what a normal IX would charge.", "link_panels.each_channel_is_a_pair_of":"Each channel is a pair of optics, one per end. ZR+ optics plug straight into your routers. Transponders sit on a shelf.", "link_panels.enters_your_network_at":"Enters your network at", +"link_panels.every_pop_carries_net_s_traffic":"Every POP carries {net}'s traffic across your network to this port.", "link_panels.finish_in_1_day_price":"Finish in 1 day {price}", "link_panels.foreign_networks_need_a_local_joint":"Foreign networks need a local joint venture and an operating license to build infrastructure here.", "link_panels.found_your_own_ix_cost_mo":"Found your own IX {cost} + {mo}/mo", @@ -2147,6 +2150,7 @@ "link_panels.name_is_down_nothing_you_can":"{name} is down. Nothing you can do but wait, or have another path.", "link_panels.name_parallel_link":"{name} parallel link", "link_panels.name_wave":"{name} wave", +"link_panels.nearest_port":"Nearest port", "link_panels.needs_a_pop_in_cities_too":"Needs a POP in {cities} too.", "link_panels.needs_what":"needs {what}", "link_panels.needs_your_own_scrubbing_center":"Needs your own scrubbing center (Infra tab).", @@ -2206,6 +2210,7 @@ "link_panels.this_is_the_only_link_between":"This is the only link between these cities. Add a parallel one, or a path through another city.", "link_panels.tier_1_only_a_pni_and":"Tier 1: only a PNI, and only once you are big enough for the Tier 1 club", "link_panels.totals_for_all_n_links_between":"Totals for all {n} links between these cities.", +"link_panels.traffic_for_net":"Traffic for {net}", "link_panels.unplugged_optics_go_on_the_spares":"Unplugged optics go on the spares shelf and are used first next time.", "link_panels.upgrade_fabric_to_name_cost_mo":"Upgrade fabric to {name} {cost} + {mo}/mo", "link_panels.upgrade_to_sys_price":"Upgrade to {sys} {price}", @@ -3049,6 +3054,7 @@ "traceroute.ix_peering_beats_transit":"IX peering beats transit", "traceroute.n_network_unreachable":"!N network unreachable", "traceroute.name_transit":"{name} transit", +"traceroute.net_buys_transit_from_carrier_so_that":"{net} buys transit from {carrier}, so that port beats the other transit ports.", "traceroute.net_carries_it_to_city":"{net} carries it to {city}", "traceroute.net_hands_it_to_to":"{net} hands it to {to}", "traceroute.no_path_every_route_between_these":"No path: every route between these cities is down or missing.", @@ -3057,6 +3063,7 @@ "traceroute.pnis_beat_ix_peering":"PNIs beat IX peering", "traceroute.private_cross_connect":"private cross-connect", "traceroute.rule_and_closer_exits_win_ties":"{rule}, and closer exits win ties", +"traceroute.the_carrier_s_own_port_beats_other":"This port goes straight to {net}, so it beats the other transit ports.", "traceroute.this_one_is_set_to_mode":"; this one is set to {mode}", "traceroute.transit_is_the_last_resort":"transit is the last resort", "tutorial.businesses_pop_up_as_bubbles_on":"Businesses pop up as $ bubbles on the map. Open Deals and sign your first customer.", diff --git a/tests/direct-egress.test.js b/tests/direct-egress.test.js new file mode 100644 index 0000000..fd279e1 --- /dev/null +++ b/tests/direct-egress.test.js @@ -0,0 +1,160 @@ +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { load } = require('./harness'); + +const port = (ev, carrier, city) => ev(`S.transit.find(t=>t.net==='${carrier}'${city ? `&&t.city==='${city}'` : ''}).id`); +const via = (ev, id, dest) => ev(`((R.tNet['${id}']||{})['${dest}'])||0`); + +// New York with eyeballs, and Level Tree and Tell-Ya ports in the same POP. +function newYork(lvlTier = 1, demand = 800) { + const g = load(); + g.ev(`ACT.pickStart({city:'nyc'});ACT.start({});S.cash=1e9;ACT.launchBB({city:'nyc'});S.pops.nyc.bb.d=${demand}; + ACT.buyTransit({city:'nyc',net:'lvl',tier:${lvlTier}});ACT.buyTransit({city:'nyc',net:'tly',tier:1});compute()`); + g.lvl = port(g.ev, 'lvl'); g.tly = port(g.ev, 'tly'); + return g; +} + +// Chicago has the eyeballs; Level Tree is in New York, Tell-Ya in Chicago, and a 100G wave joins them. +function twoPops() { + const g = load(); + g.ev(`ACT.pickStart({city:'nyc'});ACT.start({});S.cash=1e9;ACT.buildPop({city:'chi'}); + UI.via=null;UI.route='same';UI.lmode=null;openLinkModal('nyc','chi');ACT.buildLink({tier:1});closeModal(); + ACT.launchBB({city:'chi'});S.pops.chi.bb.d=80; + ACT.buyTransit({city:'nyc',net:'lvl',tier:1});ACT.buyTransit({city:'chi',net:'tly',tier:1});compute()`); + g.lvl = port(g.ev, 'lvl'); g.tly = port(g.ev, 'tly'); + g.link = g.ev("S.links[0].id"); + return g; +} + +test('at its own POP a carrier\'s port takes the traffic bound for that carrier, not an even split', () => { + const { ev, lvl, tly, errors } = newYork(); + assert.ok(via(ev, lvl, 'lvl') > 1, 'Level Tree traffic goes out of the Level Tree port'); + assert.equal(via(ev, tly, 'lvl'), 0, 'and none of it out of Tell-Ya'); + assert.ok(via(ev, tly, 'tly') > 1 && via(ev, lvl, 'tly') === 0, 'the same for Tell-Ya'); + assert.ok(via(ev, lvl, 'cog') > 1 && via(ev, tly, 'cog') > 1, 'traffic for a carrier you have no port of still shares both ports'); + assert.deepEqual(errors, []); +}); + +test('traffic for a carrier\'s customers prefers that carrier too, and a carrier beats its own customers\' other upstreams', () => { + const { ev, lvl, tly, errors } = newYork(); + // Tee-Hee Mobile buys from Level Tree and Not That Telecom, not from Tell-Ya. + assert.deepEqual(JSON.parse(ev("JSON.stringify(NET.tmo.up)")), ['lvl', 'ntt']); + assert.ok(via(ev, lvl, 'tmo') > 0 && via(ev, tly, 'tmo') === 0, 'Tee-Hee Mobile goes out of the Level Tree port'); + // Add Not That Telecom: it is just as good an upstream for Tee-Hee, so the two share it. Its own traffic stays on its own port. + ev("ACT.buyTransit({city:'nyc',net:'ntt',tier:1});compute()"); + const ntt = port(ev, 'ntt'); + assert.ok(via(ev, lvl, 'tmo') > 0 && via(ev, ntt, 'tmo') > 0 && via(ev, tly, 'tmo') === 0, 'two upstreams of the same network share its traffic'); + assert.ok(via(ev, ntt, 'ntt') > 0 && via(ev, lvl, 'ntt') === 0 && via(ev, tly, 'ntt') === 0); + assert.deepEqual(errors, []); +}); + +test('when the carrier\'s own port is full, the rest spills onto the other transit ports', () => { + const { ev, lvl, tly, errors } = newYork(0); // a 10G Level Tree port + assert.ok(ev(`R.useT['${lvl}']`) > 9.99, 'the small port is full'); + assert.ok(via(ev, lvl, 'lvl') > 9, 'mostly with Level Tree traffic'); + assert.ok(via(ev, tly, 'lvl') > 1, 'and the rest of Level Tree\'s traffic goes out of Tell-Ya'); + assert.deepEqual(errors, []); +}); + +test('Prefer, Backup only and RouteScript keep the say they had', () => { + // A Prefer-marked port of another carrier takes everything first, as it always did. + let g = newYork(1, 150); + g.ev(`ACT.setPref({kind:'t',id:'${g.tly}',v:'high'});compute()`); + assert.ok(via(g.ev, g.tly, 'lvl') > 1 && via(g.ev, g.lvl, 'lvl') === 0, 'Prefer on Tell-Ya sends Level Tree traffic there too'); + assert.deepEqual(g.errors, []); + // A port set to Backup only is the last resort, even for its own traffic. + g = newYork(1, 150); + g.ev(`ACT.setPref({kind:'t',id:'${g.lvl}',v:'low'});compute()`); + assert.equal(via(g.ev, g.lvl, 'lvl'), 0, 'Level Tree on backup carries none of its own traffic while Tell-Ya has room'); + assert.ok(via(g.ev, g.tly, 'lvl') > 1); + assert.deepEqual(g.errors, []); + // RouteScript's avoid transit is policy, and beats the shorter path. + g = newYork(1, 150); + g.ev("S.te={on:true,script:'avoid transit level tree'};compute()"); + assert.ok(g.ev("!!teRules()"), 'the script is active'); + assert.equal(via(g.ev, g.lvl, 'lvl'), 0, 'avoid transit level tree keeps even its own traffic off it'); + assert.ok(via(g.ev, g.tly, 'lvl') > 1); + assert.deepEqual(g.errors, []); +}); + +test('from a POP without the carrier\'s port, traffic uses the nearest port, or crosses your network when the port carries', () => { + const { ev, lvl, tly, link, errors } = twoPops(); + ev("S.te=null"); + assert.ok(via(ev, tly, 'lvl') > 1, 'by default Chicago sends Level Tree traffic out of its own nearest port, Tell-Ya'); + assert.equal(via(ev, lvl, 'lvl'), 0); + assert.equal(ev(`R.load['${link}']||0`), 0, 'nothing crosses the link'); + ev(`ACT.setCarry({id:'${lvl}',on:1})`); + assert.equal(ev(`S.transit.find(t=>t.id==='${lvl}').carry`), true); + assert.ok(via(ev, lvl, 'lvl') > 1, 'with Carry here, it crosses to New York and leaves by Level Tree'); + assert.ok(via(ev, tly, 'lvl') < 0.001, 'and not by Tell-Ya'); + assert.ok(ev(`R.load['${link}']`) > 1, 'over the circuit'); + assert.ok(via(ev, tly, 'tly') > 1 && via(ev, lvl, 'tly') === 0, 'Tell-Ya\'s own traffic is not affected'); + ev(`ACT.setCarry({id:'${lvl}',on:0})`); + assert.equal(ev(`S.transit.find(t=>t.id==='${lvl}').carry`), undefined, 'switching it off removes the flag'); + assert.ok(via(ev, tly, 'lvl') > 1, 'and the nearest port is used again'); + assert.deepEqual(errors, []); +}); + +test('traceroute shows the exit that routing uses, and says why', () => { + const { ev, lvl, errors } = twoPops(); + const why = (to, from = 'chi') => ev(`traceroute('${from}',{net:'${to}'}).why`); + const tly = port(ev, 'tly'); + assert.match(why('lvl'), /Tell-Ya.*Chicago/, 'nearest port from Chicago'); + assert.doesNotMatch(why('lvl'), /straight to/); + assert.ok(via(ev, tly, 'lvl') > 1 && via(ev, lvl, 'lvl') === 0, 'and that is the port routing really uses'); + ev(`ACT.setCarry({id:'${lvl}',on:1})`); + assert.ok(via(ev, lvl, 'lvl') > 1 && via(ev, tly, 'lvl') < 0.001, 'routing now uses the carrying port too'); + assert.match(why('lvl'), /Level Tree.*New York/, 'the carrying port, in New York'); + assert.match(why('lvl'), /straight to Level Tree/, 'because it goes straight to the carrier'); + assert.match(why('tmo'), /Tee-Hee Mobile buys transit from Level Tree/, 'and for its customers'); + assert.match(why('lvl', 'nyc'), /Level Tree.*New York/, 'at its own POP the carrier\'s port wins without carrying'); + ev(`ACT.setCarry({id:'${lvl}',on:0})`); + assert.match(why('lvl', 'nyc'), /Level Tree.*New York.*straight to Level Tree/, 'also with carry off'); + assert.deepEqual(errors, []); +}); + +test('the carry setting is saved, repaired and optional', () => { + const { ev, errors } = twoPops(); + ev(`ACT.setCarry({id:'${port(ev, 'lvl')}',on:1});save(true)`); + const saved = ev("localStorage.getItem('sot-save-v1')"); + const again = load({ storage: { 'sot-save-v1': saved } }); + assert.equal(again.ev("S.transit.find(t=>t.net==='lvl').carry"), true, 'survives a reload'); + assert.equal(again.ev("S.transit.find(t=>t.net==='tly').carry"), undefined, 'and is off for the others'); + // Hand-edited or imported garbage is dropped; an old save without the field just loads. + const bad = JSON.parse(saved); + bad.transit.forEach((t, i) => { t.carry = i ? 'yes' : 1; }); + const fixed = load({ storage: { 'sot-save-v1': JSON.stringify(bad) } }); + assert.equal(fixed.ev("S.transit.some(t=>'carry' in t)"), false); + const old = JSON.parse(saved); + old.transit.forEach((t) => { delete t.carry; }); + assert.equal(load({ storage: { 'sot-save-v1': JSON.stringify(old) } }).ev("S.transit.length"), 2); + assert.deepEqual([...errors, ...again.errors, ...fixed.errors], []); +}); + +test('each port offers the choice when it can matter, on a desktop and a phone', () => { + for (const w of [1280, 360]) { + const { ev, dom, errors } = load(); + ev(`window.innerWidth=${w};ACT.pickStart({city:'nyc'});ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.cash=1e9;ACT.buyTransit({city:'nyc',net:'lvl',tier:1});UI.sel={type:'city',id:'nyc'};UI.tab='up';renderPanel()`); + const body = () => dom.window.document.getElementById('panelBody'); + assert.equal(body().querySelectorAll('[data-act="setCarry"]').length, 0, `${w}px: one POP, one carrier: nothing to choose`); + ev("ACT.buildPop({city:'chi'});ACT.buyTransit({city:'chi',net:'tly',tier:1});UI.sel={type:'city',id:'nyc'};UI.tab='up';renderPanel()"); + assert.equal(body().querySelectorAll('[data-act="setCarry"]').length, 2, `${w}px: Nearest port and Carry here for the Level Tree port`); + assert.match(body().textContent, /Traffic for Level Tree/); + assert.match(body().textContent, /At this POP, Level Tree's traffic always uses this port/); + body().querySelector('[data-act="setCarry"][data-args*="\\"on\\":1"]').click(); + assert.equal(ev("S.transit.find(t=>t.net==='lvl').carry"), true, `${w}px: the button works`); + assert.match(body().textContent, /Every POP carries Level Tree's traffic across your network to this port/); + assert.deepEqual(errors, []); + } +}); + +test('the control reads right in every language', () => { + for (const lang of ['it', 'pt', 'fr', 'es', 'de']) { + const { ev, dom, errors } = load({ lang }); + ev("ACT.pickStart({city:'nyc'});ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.cash=1e9;ACT.buyTransit({city:'nyc',net:'lvl',tier:1});ACT.buildPop({city:'chi'});ACT.buyTransit({city:'chi',net:'tly',tier:1});UI.sel={type:'city',id:'nyc'};UI.tab='up';renderPanel()"); + const text = dom.window.document.getElementById('panelBody').textContent; + assert.ok(!/\{net\}|link_panels\./.test(text), `${lang}: no raw placeholders or labels`); + assert.notEqual(ev("tr('link_panels.carry_here')"), 'Carry here', `${lang}: translated`); + assert.deepEqual(errors, []); + } +}); diff --git a/tests/helpers/reference-allocation.js b/tests/helpers/reference-allocation.js index a5c557c..0a36e7c 100644 --- a/tests/helpers/reference-allocation.js +++ b/tests/helpers/reference-allocation.js @@ -5,8 +5,10 @@ module.exports = ` for(f of flows){ if(f.rem<=1e-6||(rank===0&&!f.cache)||(pass&&!pass(f)))continue; Dv=SDi[f.ci];Pv=SPi[f.ci];PP=walked[f.ci]||(walked[f.ci]=[]);vis++; + // A carrier's own port (dr) is also a plain transit exit; one not set to carry only takes its own POP's traffic. const candidates=E.filter(e=>e.used(a.pref==='high'?0:1)-(b.pref==='high'?0:1)||Dv[CIDX[a.city]]-Dv[CIDX[b.city]]); for(let i=0;i1e-6;){ let j=i+1;while(jt.net==='lvl').forEach((t,i)=>{if(i%2===0)t.carry=true})", + "S.transit.filter(t=>t.net==='tly').forEach(t=>{t.carry=true})", + "S.transit.filter(t=>t.net==='lvl').forEach((t,i)=>{t.pref=i%2?'low':'normal'})", "S.pni.forEach((p,i)=>p.pref=i%3===0?'high':i%3===1?'low':'normal')", "S.te={on:true,script:''}", "S.te.script='prefer pni for goggle\\nspill at 80%\\navoid transit for netchill'", + "S.te.script='avoid transit level tree\\nprefer transit tell-ya\\nspill at 80%'", "S.te.script='prefer transit Cogentle\\nprepend transit Cogentle 2\\nprotect customers'", "S.ev.rpki={nets:['ggl','nfx'],until:S.day+3};S.ev.depeer=S.day+3", "S.ev.ddos={city:'fra',until:S.day+3,gbps:300,vec:'syn',entry:{k:'edge'}}",