From d9868a37575281e4addfd0ce09473d4300dfbfd3 Mon Sep 17 00:00:00 2001 From: Christopher Hawker Date: Sat, 31 Oct 2026 23:28:30 +1100 Subject: [PATCH] Restore what the merge from main dropped from the carrier's own transit port The merge kept main's version of compute(), the link actions and panels, the traceroute exit list and the CHANGELOG, so the city panel called a carryCtl() that no longer existed and routing never ranked a carrier's own port. Put the ranking back into compute() on top of the current rank lists and island split, along with setCarry, carryCtl, the traceroute carry flag, the reference loop in the routing test and the CHANGELOG bullet. Drop a stale label main had removed and sort the dictionaries. The tests follow main too: saves are read from their slot, RouteScript needs the core to run, Not That Telecom stands in for Cogentle (whose share is now small), and the flood test uses a smaller sacrificial PNI and IX flood because a carrier's own traffic now takes its share of the one transit port first. --- CHANGELOG.md | 1 + site/i18n/de.js | 3 +-- site/i18n/es.js | 3 +-- site/i18n/fr.js | 3 +-- site/i18n/it.js | 3 +-- site/i18n/pt.js | 3 +-- src/game/60-features/50-traceroute.js | 2 +- src/game/80-simulation/30-compute.js | 15 ++++++++++++--- src/game/90-actions/60-links.js | 1 + src/game/93-ui/70-link-panels.js | 4 ++++ src/i18n/en.js | 3 +-- tests/direct-egress.test.js | 6 +++--- tests/game.test.js | 7 ++++--- tests/helpers/reference-allocation.js | 3 ++- 14 files changed, 34 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a2e61a..039f7ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] - Cities on the map now show how big they are: zoomed out, bigger cities are bigger dots and megacities glow; zoomed in, a city's skyline grows from a hut to a megacity's towers. When cities crowd together, the smaller ones step back to a dot until you zoom in, so the map stays readable, and exchanges you haven't joined are quieter tags. +- 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. ## [2.1.0] — 2026-10-31 - Your backbone now runs a technology you choose: plain IGP, LDP/MPLS, RSVP-TE, SR-MPLS or SRv6. Each step up costs plenty and uses less router CPU: label switching makes traffic that only passes through a POP cheaper for its router, and Auto-TE and RouteScript now need RSVP-TE or higher. Routers only run what they support, so a POP with an older router stays outside the backbone, and mixing vendors at the very top of what their routers can do brings interop failures. Networks that already have Auto-TE keep it exactly as it is. diff --git a/site/i18n/de.js b/site/i18n/de.js index 97051bb..f2d4095 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -2370,11 +2370,10 @@ "link_panels.a_regen_site_turns_the_light":"Ein Regen-Standort verwandelt das Licht auf halber Strecke zurück in Bits und schickt es frisch weiter, also müssen Optiken nur bis zum nächsten Standort reichen. Jeder braucht eine Regen-Karte für jeden beleuchteten Kanal. {price}/Monat pro Standort für die Hütte.", "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.additional_traffic_lost":"Zusätzlich verlorener Traffic", "link_panels.an_alternate_path_exists_but_current":"Es gibt einen anderen Weg, aber mit dem jetzigen Routing und der Kapazität kommt weniger Traffic an.", "link_panels.apply_for_a_license_price_mo_n_days":"Lizenz beantragen {price} + {mo}/Monat · ~{n} 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.", diff --git a/site/i18n/es.js b/site/i18n/es.js index 1ed72e7..034c133 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -2368,11 +2368,10 @@ "link_panels.a_regen_site_turns_the_light":"Un sitio regenerador convierte la luz de nuevo en bits a mitad de camino y la envía renovada, así que las ópticas solo tienen que llegar al siguiente sitio. Cada uno necesita una tarjeta regeneradora por cada canal iluminado. {price}/mes por sitio por la caseta.", "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.additional_traffic_lost":"Tráfico perdido adicional", "link_panels.an_alternate_path_exists_but_current":"Hay un camino alternativo, pero con el routing y la capacidad actuales llega menos tráfico.", "link_panels.apply_for_a_license_price_mo_n_days":"Solicitar una licencia {price} + {mo}/mes · ~{n} 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.", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index 565032a..b22f557 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -2368,11 +2368,10 @@ "link_panels.a_regen_site_turns_the_light":"Un site de régénération reconvertit la lumière en bits à mi-chemin et la renvoie toute fraîche, donc les optiques n’ont qu’à atteindre le site suivant. Chacun demande une carte de régénération par canal allumé. {price}/mois par site pour l’abri.", "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.additional_traffic_lost":"Trafic perdu en plus", "link_panels.an_alternate_path_exists_but_current":"Un autre chemin existe, mais avec le routage et la capacité actuels, moins de trafic arrive.", "link_panels.apply_for_a_license_price_mo_n_days":"Demander une licence {price} + {mo}/mois · ~{n} 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.", diff --git a/site/i18n/it.js b/site/i18n/it.js index 06b0db6..07bd72b 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -2368,11 +2368,10 @@ "link_panels.a_regen_site_turns_the_light":"Un sito di rigenerazione riconverte la luce in bit a metà strada e la rimanda fresca, così le ottiche devono arrivare solo al sito successivo. Ognuno richiede una scheda di rigenerazione per ogni canale acceso. {price}/mese a sito per la casupola.", "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.additional_traffic_lost":"Ulteriore traffico perso", "link_panels.an_alternate_path_exists_but_current":"Esiste un percorso alternativo, ma con routing e capacità attuali viene consegnato meno traffico.", "link_panels.apply_for_a_license_price_mo_n_days":"Richiedi una licenza {price} + {mo}/mese · ~{n} 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.", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index e52e2d9..2fef169 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -2368,11 +2368,10 @@ "link_panels.a_regen_site_turns_the_light":"Um site de regeneração transforma a luz de volta em bits no meio do caminho e a reenvia novinha, então as ópticas só precisam alcançar o próximo site. Cada um precisa de uma placa de regeneração para cada canal aceso. {price}/mês por site pelo abrigo.", "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.additional_traffic_lost":"Tráfego perdido a mais", "link_panels.an_alternate_path_exists_but_current":"Existe um caminho alternativo, mas com o roteamento e a capacidade atuais chega menos tráfego.", "link_panels.apply_for_a_license_price_mo_n_days":"Pedir licença {price} + {mo}/mês · ~{n} 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.", diff --git a/src/game/60-features/50-traceroute.js b/src/game/60-features/50-traceroute.js index 4856072..e816889 100644 --- a/src/game/60-features/50-traceroute.js +++ b/src/game/60-features/50-traceroute.js @@ -11,7 +11,7 @@ function trExits(net){const day=S.day,ev=S.ev,leak=ev.leak&&ev.leak.until>day?ev // A peer's customer cone (#85): one AS hop more, so tried after direct peering and before transit, as in compute(). for(const p of S.pni)if(CONE_S[p.net].has(net)&&pniOn(p)&&popUp(p.city)&&liveN(p.city,p.site,p.n))out.push({k:'p',rank:p.net===net?1:CONE_RANK,via:p.net===net?null:p.net,city:p.city,pref:p.pref||'normal',lab:tr('common.pni_with_net',{net:NET[p.net].name}),used:R.usePni[p.id]||0,cap:liveCap(pniG(p),p.city,p.site,p.n)}); for(const c in S.ixp){const ses=ixSessions(c),via=ses.has(net)?null:ANC[net].find(u=>ses.has(u))||null;if((ses.has(net)||via)&&(popUp(ixCity(c))||remoteCities().includes(ixCity(c)))&&!(ev.ixdown&&ev.ixdown[c]>day))out.push({k:'ix',rank:via?CONE_RANK:2,via,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;} // coneChain(peer,net): [peer, …, net], the shortest walk down customer links (the network's up lists, read backwards). function coneChain(top,id){const prev={[id]:null},q=[id];while(q.length){const x=q.shift();if(x===top)break;for(const u of NET[x].up||[])if(NET[u]&&!(u in prev)){prev[u]=x;q.push(u);}} diff --git a/src/game/80-simulation/30-compute.js b/src/game/80-simulation/30-compute.js index 79b363e..b96ecef 100644 --- a/src/game/80-simulation/30-compute.js +++ b/src/game/80-simulation/30-compute.js @@ -25,7 +25,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&&!(snd&&NET[n].kr)}; + 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&&!(snd&&NET[n].kr)}; 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; @@ -170,7 +170,12 @@ function compute(){ const base=(e,n)=>e.pref==='low'?4:e.rank>0&&e.rank<3&&coneOf(e,n)?CONE_RANK: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,n);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,CONE_RANK,2.9,3,3.5,4,4.4,4.5,4.6]:[0,1,2,CONE_RANK,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,CONE_RANK,2.9,2.92,2.93,2.94,2.95,3,3.5,4,4.4,4.5,4.6]:[0,1,2,CONE_RANK,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. @@ -179,7 +184,8 @@ function compute(){ const idx=L=>{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]);}}; // Networks with the same exits at a rank share one list (LIST, by content), so what one flow learns serves them all. const LIST=new Map();for(let i=0;ie.xi).join(','),o=LIST.get(key);if(o){m[r]=o;continue;} let V=L;if(NCOMP>1){const cs=[];for(const e of L){const k=COMP[e.ci];if(k>=0)(cs[k]||(cs[k]=[])).push(e);}for(const s of cs)if(s)idx(s);V={cs};}else idx(L);LIST.set(key,V);m[r]=V;}} // The flow being routed, and from its POP: distances, arriving edges and the paths walked so far, by city index. @@ -230,11 +236,14 @@ function compute(){ 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(!RSET.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;fi{const l=S.links.find(x=>x.id===id),t=$('metIn');if(!l||!t)return;const key=edgeKey(l),c=pairCm(key);if(!c)return;const v=parseFloat(String(t.value).replace(',','.'));if(!Number.isFinite(v)){sfx('err');return;} t.blur();S.pairMet[key]={k:c.k,v:clampM(c.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/70-link-panels.js b/src/game/93-ui/70-link-panels.js index fefa29d..c6c3a71 100644 --- a/src/game/93-ui/70-link-panels.js +++ b/src/game/93-ui/70-link-panels.js @@ -51,6 +51,10 @@ function linkCheckModal(l){const t=linkTrial(l.id);if(!t)return; const title=t.split?tr('link_panels.this_backhoe_wins'):t.loss>.01?tr('link_panels.connected_but_tight'):tr('link_panels.one_backhoe_is_not_enough'); openModal(`

${tr('common.redundancy_check')}

${esc(CITY[l.a].name)} ⇄ ${esc(CITY[l.b].name)} · ${dateStr(t.day)}

${title}

${t.split?tr('link_panels.no_alternate_backbone_path_connects'):t.loss>.01?tr('link_panels.an_alternate_path_exists_but_current'):tr('link_panels.with_current_demand_and_routing_this')}

${tr('link_panels.additional_traffic_lost')}${fmtG(t.loss)}
${t.losses.length?`

${tr('common.service_affected')}

${t.losses.map(x=>`
${esc(x.name)}−${fmtG(x.g)}
`).join('')}`:''}${t.busy.length?`

${tr('link_panels.full_links_during_the_test')}

${t.busy.slice(0,6).map(x=>`
${esc(x.name)}${fmtG(x.g)} / ${fmtG(x.cap)}
`).join('')}`:''}

${tr('link_panels.snapshot_only_one_selected_link')}

${btn(tr('common.close'),'closeModal',{},'ghost')}
`,'link-check');} function linkCheckControl(l){return `

${tr('common.redundancy_check')}

${tr('link_panels.what_happens_if_this_link_fails')}

${btn(tr('common.check_redundancy'),'linkCheck',{id:l.id},'ghost sm',linkDown(l))}
`;} +// 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=linkCheckControl(l)+`

${tr('link_panels.what_s_on_this_link')}

`; diff --git a/src/i18n/en.js b/src/i18n/en.js index 32ed88d..753d0d4 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -2369,11 +2369,10 @@ "link_panels.a_regen_site_turns_the_light":"A regen site turns the light back into bits halfway and sends it on fresh, so optics only have to reach the next site. Each needs a regen card for every lit channel. {price}/mo per site for the hut.", "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.additional_traffic_lost":"Additional traffic lost", "link_panels.an_alternate_path_exists_but_current":"An alternate path exists, but current routing and capacity deliver less traffic.", "link_panels.apply_for_a_license_price_mo_n_days":"Apply for a license {price} + {mo}/mo · ~{n} 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.", diff --git a/tests/direct-egress.test.js b/tests/direct-egress.test.js index fd279e1..60e885e 100644 --- a/tests/direct-egress.test.js +++ b/tests/direct-egress.test.js @@ -31,7 +31,7 @@ test('at its own POP a carrier\'s port takes the traffic bound for that carrier, 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.ok(via(ev, lvl, 'ntt') > 1 && via(ev, tly, 'ntt') > 1, 'traffic for a carrier you have no port of still shares both ports'); assert.deepEqual(errors, []); }); @@ -70,7 +70,7 @@ test('Prefer, Backup only and RouteScript keep the say they had', () => { 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()"); + g.ev("S.te={on:true,script:'avoid transit level tree'};S.core={lv:2,run:2,legacy:true};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); @@ -116,7 +116,7 @@ test('traceroute shows the exit that routing uses, and says why', () => { 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 saved = ev('slotRaw(UI.slot)'); 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'); diff --git a/tests/game.test.js b/tests/game.test.js index 246a769..d183c4d 100644 --- a/tests/game.test.js +++ b/tests/game.test.js @@ -297,13 +297,14 @@ test('clean-pipe on the entry transit, a sacrificial PNI, and an IX blackhole ea // Clean-pipe on the transit the attack enters: the provider scrubs it upstream. const clean = ev(`S.transit[0].clean=true;compute();const s=R.served;S.transit[0].clean=false;s`); assert.ok(clean > raw, 'clean-pipe on the entry transit recovers traffic'); - // A sacrificial CN PNI contains a flood entering over it (capped at the small port). - ev("S.pni.push({id:'pn1',city:'fra',net:'ctc',tier:1,n:1,site:'a',sacrif:true});S.ev.ddos.entry={k:'p',id:'pn1'}"); + // A sacrificial CN PNI contains a flood entering over it (capped at the small port). The carrier's own traffic + // takes its share of the one transit port first, so the flood has to be small enough to leave the rest some room. + ev("S.pni.push({id:'pn1',city:'fra',net:'ctc',tier:0,n:1,site:'a',sacrif:true});S.ev.ddos.entry={k:'p',id:'pn1'}"); const contained = ev("compute();R.served"); const uncontained = ev("S.pni[0].sacrif=false;compute();const s=R.served;S.pni[0].sacrif=true;s"); assert.ok(contained > uncontained, 'a sacrificial PNI contains the flood'); // IX blackhole: ~half the junk gone, victim stays up. Shrink the flood so the drop shows in served. - ev("ACT.buyIx({city:'fra',tier:1,signed:true});S.ev.ddos.entry={k:'t',id:S.transit[0].id};S.ev.ddos.gbps=180"); + ev("ACT.buyIx({city:'fra',tier:1,signed:true});S.ev.ddos.entry={k:'t',id:S.transit[0].id};S.ev.ddos.gbps=120"); const before = ev("compute();R.served"); ev("ACT.ixbh()"); assert.equal(ev('S.ev.ddos.ixbh'), true, 'blackhole announced'); diff --git a/tests/helpers/reference-allocation.js b/tests/helpers/reference-allocation.js index f98c3a8..8f18d6c 100644 --- a/tests/helpers/reference-allocation.js +++ b/tests/helpers/reference-allocation.js @@ -9,7 +9,8 @@ module.exports = ` 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(j