diff --git a/CHANGELOG.md b/CHANGELOG.md index 7288a16..24a7242 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] -- Glowball Sakura Lager joins the map: a Tier 2 carrier with a PoP in nearly every city that sells transit, takes PNIs and peers openly at almost every exchange. It is not a Tier 1, so it buys its own transit from three of them, while 24 smaller networks on every continent buy theirs from it. One PNI with it reaches about 5% of all traffic, so give it a big port. In Australia it sells transit too, dearer than elsewhere like everything there, but cheaper than Telstraya. +- Glowball Sakura Lager joins the map: a Tier 2 carrier in the big hubs of the US, Europe and Asia-Pacific that sells transit, takes PNIs and peers openly wherever it is. It is not a Tier 1, so it buys its own transit from three of them, while 13 smaller networks in its regions buy theirs from it, and one PNI with it reaches about 3% of all traffic. Far from home, in Asia and New Zealand, it charges more than the locals, and it sells no transit in Australia. ## [1.36.0] — 2026-10-28 diff --git a/site/i18n/es.js b/site/i18n/es.js index 7a43b19..4d2b6ef 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -1803,7 +1803,7 @@ "geography_and_latency.where_lvl_this_route_is_p":"{where}: {lvl}. Esta ruta está un {p} % por debajo del precio de mercado{since}.", "geography_and_latency.where_lvl_this_route_is_p_0196":"{where}: {lvl}. Esta ruta está un {p} % por encima del precio de mercado{since}.", "geography_and_latency.where_lvl_this_route_is_right":"{where}: {lvl}. Esta ruta está justo al precio de mercado{since}.", -"glowball_sakura_lager.on_tap_in_every_city_resells":"De barril en cada ciudad. Revende tránsito sacado de tres barriles de Tier 1, acepta PNI y hace peering abierto en casi todos los IX. No es un Tier 1, y la flor de cerezo en la factura es puramente decorativa.", +"glowball_sakura_lager.on_tap_in_the_big_hubs":"De barril en los grandes hubs de EE. UU., Europa y Asia-Pacífico. Revende tránsito sacado de tres barriles de Tier 1, acepta PNI y hace peering abierto allí donde está. Lejos de casa la caña sale más cara, y a los australianos no les sirve nada. No es un Tier 1, y la flor de cerezo en la factura es puramente decorativa.", "goals.5_pops_ports_on_3_ixs":"5+ POPs, puertos en 3+ IXs y 15+ sesiones de peering.", "goals.a_private_cross_connect_to_one":"Una interconexión cruzada privada con una red del mismo centro de datos, para cuando el tráfico supera al IX.", "goals.a_terabit_per_second_of_happy":"Un terabit por segundo de tráfico feliz.", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index 11ad8e9..cd081d9 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -1803,7 +1803,7 @@ "geography_and_latency.where_lvl_this_route_is_p":"{where} : {lvl}. Cette route est {p} % sous le prix du marché{since}.", "geography_and_latency.where_lvl_this_route_is_p_0196":"{where} : {lvl}. Cette route est {p} % au-dessus du prix du marché{since}.", "geography_and_latency.where_lvl_this_route_is_right":"{where} : {lvl}. Cette route est pile au prix du marché{since}.", -"glowball_sakura_lager.on_tap_in_every_city_resells":"À la pression dans chaque ville. Revend du transit tiré de trois fûts de Tier 1, accepte les PNI et fait du peering ouvert sur presque tous les IX. Ce n’est pas un Tier 1, et la fleur de cerisier sur la facture est purement décorative.", +"glowball_sakura_lager.on_tap_in_the_big_hubs":"À la pression dans les grands hubs des États-Unis, d’Europe et d’Asie-Pacifique. Revend du transit tiré de trois fûts de Tier 1, accepte les PNI et fait du peering ouvert partout où il est. Loin de chez lui la pinte coûte plus cher, et il ne sert rien aux Australiens. Ce n’est pas un Tier 1, et la fleur de cerisier sur la facture est purement décorative.", "goals.5_pops_ports_on_3_ixs":"5+ POP, des ports sur 3+ IX et 15+ sessions de peering.", "goals.a_private_cross_connect_to_one":"Un cross-connect privé vers un réseau dans le même datacenter, pour quand le trafic devient trop gros pour l’IX.", "goals.a_terabit_per_second_of_happy":"Un térabit par seconde de trafic heureux.", diff --git a/site/i18n/it.js b/site/i18n/it.js index a82a60d..cf0cb47 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -1803,7 +1803,7 @@ "geography_and_latency.where_lvl_this_route_is_p":"{where}: {lvl}. Questa rotta è il {p}% sotto il prezzo di mercato{since}.", "geography_and_latency.where_lvl_this_route_is_p_0196":"{where}: {lvl}. Questa rotta è il {p}% sopra il prezzo di mercato{since}.", "geography_and_latency.where_lvl_this_route_is_right":"{where}: {lvl}. Questa rotta è esattamente al prezzo di mercato{since}.", -"glowball_sakura_lager.on_tap_in_every_city_resells":"Alla spina in ogni città. Rivende transit spillato da tre fusti di Tier 1, accetta PNI e fa peering aperto su quasi tutti gli IX. Non è un Tier 1, e il fiore di ciliegio in fattura è puramente decorativo.", +"glowball_sakura_lager.on_tap_in_the_big_hubs":"Alla spina nei grandi hub di USA, Europa e Asia-Pacifico. Rivende transit spillato da tre fusti di Tier 1, accetta PNI e fa peering aperto ovunque sia presente. Lontano da casa la pinta costa di più, e agli australiani non versa niente. Non è un Tier 1, e il fiore di ciliegio in fattura è puramente decorativo.", "goals.5_pops_ports_on_3_ixs":"5+ POP, porte su 3+ IX e 15+ sessioni di peering.", "goals.a_private_cross_connect_to_one":"Un cross-connect privato verso una rete nello stesso data center, per quando il traffico è troppo per l’IX.", "goals.a_terabit_per_second_of_happy":"Un terabit al secondo di traffico felice.", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index 3b16a97..c5d4cff 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -1803,7 +1803,7 @@ "geography_and_latency.where_lvl_this_route_is_p":"{where}: {lvl}. Esta rota está {p}% abaixo do preço de mercado{since}.", "geography_and_latency.where_lvl_this_route_is_p_0196":"{where}: {lvl}. Esta rota está {p}% acima do preço de mercado{since}.", "geography_and_latency.where_lvl_this_route_is_right":"{where}: {lvl}. Esta rota está bem no preço de mercado{since}.", -"glowball_sakura_lager.on_tap_in_every_city_resells":"Na torneira em toda cidade. Revende transit tirado de três barris de Tier 1, aceita PNIs e faz peering aberto em quase todos os IX. Não é um Tier 1, e a flor de cerejeira na fatura é puramente decorativa.", +"glowball_sakura_lager.on_tap_in_the_big_hubs":"Na torneira nos grandes hubs dos EUA, da Europa e da Ásia-Pacífico. Revende transit tirado de três barris de Tier 1, aceita PNIs e faz peering aberto onde estiver. Longe de casa o copo sai mais caro, e para australianos não serve nada. Não é um Tier 1, e a flor de cerejeira na fatura é puramente decorativa.", "goals.5_pops_ports_on_3_ixs":"5+ POPs, portas em 3+ IXs e 15+ sessões de peering.", "goals.a_private_cross_connect_to_one":"Um cross-connect privado com uma rede no mesmo data center, para quando o tráfego não cabe mais no IX.", "goals.a_terabit_per_second_of_happy":"Um terabit por segundo de tráfego feliz.", diff --git a/src/game/30-networks/35-glowball-sakura-lager.js b/src/game/30-networks/35-glowball-sakura-lager.js index 5f84dff..d993af0 100644 --- a/src/game/30-networks/35-glowball-sakura-lager.js +++ b/src/game/30-networks/35-glowball-sakura-lager.js @@ -1,18 +1,15 @@ -/* Glowball Sakura Lager: a Tier 2 with a PoP in every city the big content networks reach, except Pitcairn, where no - provider may sell transit so that you must land your own cable (#124). Not a Tier 1, so it buys transit from three of - them and resells it, in Australia too (see AU_SELLERS). Open peering and a port on nearly every exchange (the real - thing lists an open policy and route servers at dozens of IXs). Sits before 40-traffic-shares.js, which indexes NETS. */ +/* Glowball Sakura Lager: a Tier 2 that buys transit from three Tier 1s and resells it, with open peering wherever it + is. Its PoPs are the real network's (Netify, Oct 2026: 38 cities in 17 countries) that are on our map: Asia-Pacific + and New Zealand, the US and a handful of European hubs, and nothing in Africa or South America. It sits in four + Australian cities and peers on their big exchanges, but is not one of the AU_SELLERS: like the Pacific carriers it + sells Australians nothing, so Australia stays as hard as it was. Far from its US and European core it costs more + (far), so it never undercuts the locals there. Sits before 40-traffic-shares.js, which indexes NETS. */ +const GSL_POPS=['adl','akl','ams','bne','bom','chi','dal','fra','hkg','icn','ist','jkt','lax','lon','mel','mia','mil','mnl','nyc','osa','par','per','phx','sin','syd','tok','waw']; NETS.push( - {id:'gsl',name:'Glowball Sakura Lager',asn:137409,type:'t2',pol:'open',up:['lvl','cog','ntt'],share:.02,price:5,col:'#C94F7C',auIx:['syd','mel','bne','per'],pops:ALLC.filter(c=>c!=='pcn'),ix:'ALL',blurb:tr('glowball_sakura_lager.on_tap_in_every_city_resells')}); -/* Its downstreams: networks that buy their transit from it, so a PNI with it reaches them too. Small and mid-size - networks on every continent, one per line, sorted within each. Kept here rather than in their own entries so the - whole carrier lives in one file. */ + {id:'gsl',name:'Glowball Sakura Lager',asn:137409,type:'t2',pol:'open',up:['lvl','cog','ntt'],share:.02,price:5,far:{AS:1.6,OC:2},col:'#C94F7C',auIx:['syd','mel','bne','per'],pops:GSL_POPS,ix:GSL_POPS,blurb:tr('glowball_sakura_lager.on_tap_in_the_big_hubs')}); +/* Its downstreams: networks that buy their transit from it, so a PNI with it reaches them too. Only where it has + PoPs itself, and no Australians: a PNI with it is no back door into Australia. One per line, sorted within each. */ const GSL_DOWN=[ - // Africa - 'art', // Air-Tell Africa - 'mtc', // Dodo Telecom - 'sfc', // Safari-Comic - 'zeo', // Zealot // Asia 'dhr', // Dhiraa-goo 'ptc', // PTC-hell @@ -28,15 +25,7 @@ const GSL_DOWN=[ 'pes', // Pessimum 'snc', // Sonic Boomer 'wnt', // Whirled Net - // Oceania - 'abb', // Aussie Boyband - 'lpt', // Frogtel - 'npt', // Neptoon Internet + // New Zealand 'spk', // Spark-le - // South America - 'ant', // Antelope - 'bsn', // Brisanada - 'mvs', // Moviestar - 'tgo', // Tiger Mobile ]; for(const id of GSL_DOWN){const n=NETS.find(x=>x.id===id);n.up=(n.up||[]).concat('gsl');} diff --git a/src/game/70-rules/20-exchanges.js b/src/game/70-rules/20-exchanges.js index a243448..8a054d5 100644 --- a/src/game/70-rules/20-exchanges.js +++ b/src/game/70-rules/20-exchanges.js @@ -3,10 +3,9 @@ /* Transit in Australia is sold only by carriers with an Australian site and at least ten Australian networks buying from them (RIPEstat, Oct 2026): Telstraya, Hocus Pocus, Speedyloop, SingTell, Drizzle Electric, Cogentle, Not That Telecom and Level Tree (whose real-world network lists no sites in PeeringDB at all, but sells in Sydney). Others can sit in - an Australian city, like the Pacific carriers backhauling to Sydney, but reach Australian customers only from overseas. - Glowball Sakura Lager is the one exception that is a design choice, not a measurement: it sells everywhere, at the - Australian price (3×, so well under Telstraya's). */ -const AU_SELLERS=['tsy','voc','spl','sgt','drz','cog','ntt','lvl','gsl'],sellsAt=(n,c)=>!!n.price&&n.pops.includes(c)&&(!CITY[c].au||AU_SELLERS.includes(n.id)); + an Australian city, like the Pacific carriers backhauling to Sydney (or Glowball Sakura Lager), but reach Australian + customers only from overseas. */ +const AU_SELLERS=['tsy','voc','spl','sgt','drz','cog','ntt','lvl'],sellsAt=(n,c)=>!!n.price&&n.pops.includes(c)&&(!CITY[c].au||AU_SELLERS.includes(n.id)); const onIx=(n,c)=>CITY[c].au&&n.auIx?n.auIx.includes(c):n.ix==='ALL'||Array.isArray(n.ix)&&n.ix.includes(c); function ixMembers(c){if(XIXM[c])return XIXM[c].members.slice();if(S.myIx[c])return S.myIx[c].members.slice();if(!CITY[c].ix)return [];return NETS.filter(n=>onIx(n,c)).map(n=>n.id);} // LAG: several identical ports bundled into one logical link. Flow hashing is never perfectly even, so a bundle carries ~95% of the sum. diff --git a/src/game/80-simulation/20-routescript.js b/src/game/80-simulation/20-routescript.js index 05d0232..3a6d720 100644 --- a/src/game/80-simulation/20-routescript.js +++ b/src/game/80-simulation/20-routescript.js @@ -46,7 +46,7 @@ const PREPEND_F=[0,0.35,0.6,0.75]; function teOptimize(){const L=[tr('routescript.suggested_by_the_optimizer_from_live'),'spill at 85%']; // Protecting customers costs a second routing pass: only worth it where IP customers would get unhappy (under 95% served). if(S.biz.some(b=>!BIZ_T[b.type].l2&&!BIZ_T[b.type].fiber&&!BIZ_T[b.type].event&&sfOf(R,b.city)<0.95))L.push('protect customers'); - const ups=[...new Set(S.transit.map(t=>t.net))].map(n=>({n,p:Math.min(...S.transit.filter(t=>t.net===n).map(t=>NET[n].price*regionMult(t.city)))})).sort((a,b)=>a.p-b.p); + const ups=[...new Set(S.transit.map(t=>t.net))].map(n=>({n,p:Math.min(...S.transit.filter(t=>t.net===n).map(t=>NET[n].price*netMult(NET[n],t.city)))})).sort((a,b)=>a.p-b.p); if(ups.length>1){L.push('prefer transit '+NET[ups[0].n].name.toLowerCase());L.push('avoid transit '+NET[ups[ups.length-1].n].name.toLowerCase());} const tips=[]; for(const n of NETS){const g=(R.netEg[n.id]||{}).t||0;if(g<1)continue;// The exchange where it is a member and you have no port yet, in a city where you have a POP. @@ -56,7 +56,7 @@ function teOptimize(){const L=[tr('routescript.suggested_by_the_optimizer_from_l tips.sort((a,b)=>b[0]-a[0]).slice(0,5).forEach(x=>L.push(x[1])); return L.join('\n');} // Ready-made RouteScripts, filled in from the live network. Players load them from the help; the AI button picks them too. -const teUps=()=>[...new Set(S.transit.map(t=>t.net))].map(n=>({n,p:Math.min(...S.transit.filter(t=>t.net===n).map(t=>NET[n].price*regionMult(t.city)))})).sort((a,b)=>a.p-b.p); +const teUps=()=>[...new Set(S.transit.map(t=>t.net))].map(n=>({n,p:Math.min(...S.transit.filter(t=>t.net===n).map(t=>NET[n].price*netMult(NET[n],t.city)))})).sort((a,b)=>a.p-b.p); const teNm=n=>NET[n].name.toLowerCase(),teAtk=()=>!!(S.ev.ddos&&S.ev.ddos.until>S.day); const teSad=()=>S.biz.some(b=>!BIZ_T[b.type].l2&&!BIZ_T[b.type].fiber&&!BIZ_T[b.type].event&&sfOf(R,b.city)<0.95); const TE_RECIPES=[ diff --git a/src/game/80-simulation/40-billing.js b/src/game/80-simulation/40-billing.js index 668c6d6..8584b95 100644 --- a/src/game/80-simulation/40-billing.js +++ b/src/game/80-simulation/40-billing.js @@ -3,7 +3,7 @@ function linkDown(l){return l.cut>S.day||(S.ev.runet>S.day&&ruCity(l.a)!==ruCity function remoteCities(){return [...new Set(S.links.filter(l=>l.kind==='vxc').flatMap(l=>[l.a,l.b]))].filter(c=>!S.pops[c]);} function nniUsed(c,prov){return S.links.filter(l=>l.kind==='vxc'&&l.prov===prov&&(l.a===c||l.b===c)).reduce((a,l)=>a+VXC[l.vt].g,0)+S.biz.filter(b=>BIZ_T[b.type].nni&&b.prov===prov&&b.city===c).reduce((a,b)=>a+b.bw,0);} // Monthly price of one connection; compute() sums these, the connections overview lists them. -function transitMo(t,q){const n=t.n||1;return Math.max(q,PORT[t.tier].g*n*0.2)*NET[t.net].price*(t.premium&&t.city==='hkg'?NET[t.net].premium:1)*S.priceMul*regionMult(t.city)+PORT[t.tier].tmo*n+(t.clean?cleanMo(t):0);} +function transitMo(t,q){const n=t.n||1;return Math.max(q,PORT[t.tier].g*n*0.2)*NET[t.net].price*(t.premium&&t.city==='hkg'?NET[t.net].premium:1)*S.priceMul*netMult(NET[t.net],t.city)+PORT[t.tier].tmo*n+(t.clean?cleanMo(t):0);} function pniMo(p,use){if(!pniOn(p))return 0;return (p.g1?Math.round(PORT[0].pni/2):PORT[p.tier].pni)*(p.n||1)+(NET[p.net].pol==='paid'&&!paidFree(NET[p.net])?NET[p.net].paidFee:0)+(NET[p.net].perG?Math.round(NET[p.net].perG*use):0);} function ixMo(c){return S.myIx[c]?Math.round(myFab(c).mo*((S.ixSite||{})[c]==='ab'?1.5:1)):ixPortMo(c,S.ixp[c])*((S.ixn||{})[c]||1)+dkAddonMo(c);} function nniPort(c,prov){return (S.nni||[]).find(x=>x.city===c&&x.prov===prov);} diff --git a/src/game/80-simulation/80-geography-and-latency.js b/src/game/80-simulation/80-geography-and-latency.js index cab5a75..c928d65 100644 --- a/src/game/80-simulation/80-geography-and-latency.js +++ b/src/game/80-simulation/80-geography-and-latency.js @@ -1,5 +1,7 @@ function cnOk(){return S.cnLic&&S.cnLic.state==='ok';} function regionMult(c){const C=CITY[c];if(!C||C.cn)return 1;if(C.kr)return KR_TRANSIT;if(C.au)return AU_TRANSIT;if(C.tape)return 1.5;return C.reg==='AS'?2.5:C.reg==='AF'?2:C.reg==='OC'?1.8:C.reg==='SA'?1.6:1;} +// A network's own markup on top of that, where it is far from home (Glowball Sakura Lager in Asia and New Zealand). +const netMult=(n,c)=>regionMult(c)*((n&&n.far&&CITY[c]&&n.far[CITY[c].reg])||1); const uaePair=(a,b)=>!!CITY[a].uae&&!!CITY[b].uae; const rainPair=(a,b)=>!!(CITY[a].rain||CITY[b].rain); const borderPair=(a,b)=>!!CITY[a].cc&&!!CITY[b].cc&&CITY[a].cc!==CITY[b].cc; diff --git a/src/game/93-ui/50-city-panel.js b/src/game/93-ui/50-city-panel.js index 853d518..e63ae76 100644 --- a/src/game/93-ui/50-city-panel.js +++ b/src/game/93-ui/50-city-panel.js @@ -42,7 +42,7 @@ function cityPanel(c){ h+=`

${tr('common.ip_transit')}

${tr('city_panel.pay_a_bigger_network_per_gbps')}

`; const prov=NETS.filter(n=>sellsAt(n,c)).sort((a,b)=>a.price-b.price); if(!prov.length)h+=`

${tr('city_panel.nobody_sells_transit_here_haul_your')}

`; - for(const n of prov){const t=S.transit.find(x=>x.city===c&&x.net===n.id);const pr=n.price*S.priceMul*(t&&t.premium&&c==='hkg'?n.premium:1)*regionMult(c); + for(const n of prov){const t=S.transit.find(x=>x.city===c&&x.net===n.id);const pr=n.price*S.priceMul*(t&&t.premium&&c==='hkg'?n.premium:1)*netMult(n,c); h+=`
${logo(n)}
${esc(n.name)} ${TYPE_L[n.type]}
${tr('city_panel.price_per_gbps_month_billed_on',{price:pr.toFixed(2)})}
`; 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)}${n.premium&&c==='hkg'?`
${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))})}
diff --git a/src/i18n/en.js b/src/i18n/en.js index b6bb4ea..142625b 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -1804,7 +1804,7 @@ "geography_and_latency.where_lvl_this_route_is_p":"{where}: {lvl}. This route is {p}% below the going rate{since}.", "geography_and_latency.where_lvl_this_route_is_p_0196":"{where}: {lvl}. This route is {p}% above the going rate{since}.", "geography_and_latency.where_lvl_this_route_is_right":"{where}: {lvl}. This route is right at the going rate{since}.", -"glowball_sakura_lager.on_tap_in_every_city_resells":"On tap in every city. Resells transit poured from three Tier 1 kegs, takes PNIs and peers openly at almost every exchange. Not a Tier 1 itself, and the cherry blossom on the invoice is purely decorative.", +"glowball_sakura_lager.on_tap_in_the_big_hubs":"On tap in the big hubs of the US, Europe and Asia-Pacific. Resells transit poured from three Tier 1 kegs, takes PNIs and peers openly wherever it is. Far from home the pint costs more, and it pours nothing for Australians. Not a Tier 1 itself, and the cherry blossom on the invoice is purely decorative.", "goals.5_pops_ports_on_3_ixs":"5+ POPs, ports on 3+ IXs and 15+ peering sessions.", "goals.a_private_cross_connect_to_one":"A private cross-connect to one network in the same data center, for when traffic outgrows the IX.", "goals.a_terabit_per_second_of_happy":"A terabit per second of happy traffic.", diff --git a/tests/glowball-sakura-lager.test.js b/tests/glowball-sakura-lager.test.js index 31a311f..6231197 100644 --- a/tests/glowball-sakura-lager.test.js +++ b/tests/glowball-sakura-lager.test.js @@ -2,13 +2,17 @@ const test = require('node:test'); const assert = require('node:assert/strict'); const { load } = require('./harness'); -test('Glowball Sakura Lager is a Tier 2 that is everywhere on the map but China and Russia', () => { +test('Glowball Sakura Lager is a Tier 2 in the big hubs, not everywhere', () => { const { ev, errors } = load(); assert.equal(ev("NET.gsl.name"), 'Glowball Sakura Lager'); assert.equal(ev("NET.gsl.type"), 't2'); assert.equal(ev("NET.gsl.pol"), 'open'); - assert.equal(ev("ALLC.filter(c=>c!=='pcn').every(c=>NET.gsl.pops.includes(c))"), true, 'a PoP in every city the big content networks reach'); - assert.equal(ev("NET.gsl.pops.includes('pcn')"), false, 'Pitcairn has no provider but you (#124)'); + const n = ev("NET.gsl.pops.length"); + assert.ok(n >= 20 && n <= 40, `a few dozen cities, like the real network (${n})`); + for (const c of ['nyc', 'lon', 'fra', 'sin', 'tok', 'akl']) assert.ok(ev(`NET.gsl.pops.includes('${c}')`), `in ${c}`); + assert.equal(ev("NET.gsl.pops.some(c=>['AF','SA'].includes(CITY[c].reg))"), false, 'nothing in Africa or South America'); + assert.equal(ev("NET.gsl.pops.includes('pcn')||NET.gsl.pops.includes('ivc')||NET.gsl.pops.includes('prr')"), false, 'not in the remote towns'); + assert.equal(ev("NET.gsl.ix.every(c=>NET.gsl.pops.includes(c))"), true, 'exchanges only where it has a PoP'); assert.equal(ev("NET.gsl.pops.some(c=>CITY[c].cn||CITY[c].ru)"), false); assert.equal(ev("t1Need().some(n=>n.id==='gsl')"), false, 'not a Tier 1, so no Tier 1 club PNI is needed for it'); assert.equal(ev("NET.gsl.up.every(u=>NET[u].type==='t1')"), true, 'it buys its own transit from Tier 1s'); @@ -18,25 +22,33 @@ test('Glowball Sakura Lager is a Tier 2 that is everywhere on the map but China assert.deepEqual(errors, []); }); -test('it sells transit in every city, Australia included, and sits on the exchanges', () => { +test('it sells transit only where it is, and never to Australians, but peers on the big Australian exchanges', () => { const { ev, errors } = load(); ev("ACT.start({})"); - assert.equal(ev("ALLC.filter(c=>c!=='pcn').every(c=>sellsAt(NET.gsl,c))"), true); - assert.equal(ev("sellsAt(NET.gsl,'ivc')&&sellsAt(NET.gsl,'prr')"), true, 'the small towns nobody else sells transit in'); - assert.equal(ev("CITIES.filter(c=>c.au).every(c=>sellsAt(NET.gsl,c.id))"), true, 'every Australian city'); + assert.equal(ev("NET.gsl.pops.filter(c=>!CITY[c].au).every(c=>sellsAt(NET.gsl,c))"), true); + assert.equal(ev("Object.keys(CITY).filter(c=>!NET.gsl.pops.includes(c)).some(c=>sellsAt(NET.gsl,c))"), false, 'nowhere else'); + assert.equal(ev("sellsAt(NET.gsl,'ivc')||sellsAt(NET.gsl,'prr')"), false, 'the remote towns stay without transit'); + assert.equal(ev("Object.keys(CITY).filter(c=>CITY[c].au).some(c=>sellsAt(NET.gsl,c))"), false, 'no transit for Australians'); + assert.equal(ev("AU_SELLERS.includes('gsl')"), false); assert.equal(ev("ixMembers('fra').includes('gsl')&&ixMembers('lon').includes('gsl')"), true); assert.equal(ev("ixMembers('syd').includes('gsl')"), true, 'Australian exchanges follow auIx'); assert.equal(ev("ixMembers('adl').includes('gsl')"), false); + assert.equal(ev("ixMembers('lag').includes('gsl')"), false, 'not on exchanges where it has no PoP'); assert.deepEqual(errors, []); }); -test('in Australia it is dear, like everything there, but cheaper than Telstraya', () => { +test('far from home it costs more than the locals, so it is never the cheap way in', () => { const { ev, errors } = load(); - const per = (net, c) => ev(`NET.${net}.price*regionMult('${c}')`); - assert.ok(per('gsl', 'syd') > per('gsl', 'fra'), 'dearer at home in Sydney than in Frankfurt'); - assert.ok(per('gsl', 'syd') < per('tsy', 'syd'), 'but cheaper than Telstraya'); - ev("ACT.start({});S.cash=1e8;ACT.buildPop({city:'syd'});ACT.buyTransit({city:'syd',net:'gsl',tier:1});compute()"); - assert.equal(ev("S.transit.filter(t=>t.net==='gsl'&&t.city==='syd').length"), 1, 'the order went through'); + ev("ACT.start({})"); + const price = (net, c) => ev(`NET.${net}.price*netMult(NET.${net},'${c}')`); + assert.equal(price('gsl', 'nyc'), 5, 'its own price at home in the US'); + assert.ok(price('gsl', 'sin') > ev("NET.gsl.price*regionMult('sin')"), 'a markup in Asia on top of the regional price'); + assert.ok(price('gsl', 'akl') > ev("NET.gsl.price*regionMult('akl')"), 'and in New Zealand'); + assert.equal(ev("NET.gsl.pops.filter(c=>sellsAt(NET.gsl,c)).some(c=>{const p=n=>n.price*netMult(n,c);return NETS.some(n=>n.id!=='gsl'&&sellsAt(n,c))&&p(NET.gsl)n.id!=='gsl'&&sellsAt(n,c)).map(p));})"), false, 'never the cheapest seller in any of its cities'); + // The bill uses the same price as the panel. + ev("S.cash=1e8;ACT.buildPop({city:'sin'});ACT.buyTransit({city:'sin',net:'gsl',tier:1});compute()"); + const t = "S.transit.find(t=>t.net==='gsl')"; + assert.equal(ev(`transitMo(${t},100)`), ev(`Math.max(100,PORT[${t}.tier].g*0.2)*NET.gsl.price*S.priceMul*netMult(NET.gsl,'sin')+PORT[${t}.tier].tmo`), 'billed with the markup'); assert.deepEqual(errors, []); }); @@ -64,20 +76,22 @@ test('it takes a PNI and open peering at an exchange, and carries its own traffi assert.deepEqual(errors, []); }); -test('networks on every continent buy their transit from it, so a PNI with it reaches them', () => { +test('networks in its own regions buy their transit from it, so a PNI with it reaches them; none in Australia', () => { const { ev, errors } = load(); // Each downstream's home continent is where most of its PoPs are. const home = JSON.parse(ev(`JSON.stringify(PNI_NETS.gsl.slice(1).map(id=>{const c={};for(const p of NET[id].pops){const r=CITY[p].reg;c[r]=(c[r]||0)+1;}return Object.entries(c).sort((a,b)=>b[1]-a[1])[0][0];}))`)); - for (const r of ['AF', 'AM', 'AS', 'EU', 'OC', 'SA']) assert.ok(home.filter((x) => x === r).length >= 3, `${r} has at least three downstreams`); + for (const r of ['AM', 'AS', 'EU']) assert.ok(home.filter((x) => x === r).length >= 3, `${r} has at least three downstreams`); + for (const r of ['AF', 'SA']) assert.equal(home.filter((x) => x === r).length, 0, `none in ${r}, where it has no PoPs`); + assert.equal(ev("PNI_NETS.gsl.slice(1).some(id=>NET[id].pops.filter(c=>CITY[c].au).length>NET[id].pops.length/2)"), false, 'no Australian downstreams: no back door into Australia'); assert.equal(ev("PNI_NETS.gsl.slice(1).every(id=>NET[id].up.includes('gsl')&&new Set(NET[id].up).size===NET[id].up.length)"), true); assert.equal(ev("PNI_NETS.gsl.some(id=>NET[id].type==='t1'||NET[id].cn)"), false); assert.equal(ev("PNI_NETS.gsl.slice(1).some(id=>merged(id)||MERGERS.some(m=>m.id===id))"), false, 'none of them is about to be bought'); // Their own upstreams still reach them: nothing was replaced, only added. assert.equal(ev("NET.pes.up.join()"), 'cog,lvl,gsl'); - // One PNI with it carries a downstream's traffic as well as its own (a 100G port: 25 networks share it). + // One PNI with it carries a downstream's traffic as well as its own (one port, shared by it and its downstreams). ev("ACT.start({});S.cash=1e8;ACT.launchBB({city:'fra'});ACT.buyTransit({city:'fra',net:'cog',tier:1});S.pops.fra.bb.d=400;ACT.pni({city:'fra',net:'gsl',tier:1});for(const p of S.pni)p.ready=0;compute()"); assert.ok(ev("(R.netEg.pes||{}).p") > 0, 'Pessimum is reached over the PNI with its upstream'); - assert.ok(ev("(R.netEg.abb||{}).p") > 0, 'so is Aussie Boyband'); + assert.equal(ev("(NET.abb.up||[]).includes('gsl')"), false, 'Aussie Boyband does not buy from it'); ev("S.pni=[];compute()"); assert.equal(ev("(R.netEg.pes||{}).p||0"), 0, 'and not without it'); assert.deepEqual(errors, []); diff --git a/tests/regions.test.js b/tests/regions.test.js index 292f2d5..1ac3be1 100644 --- a/tests/regions.test.js +++ b/tests/regions.test.js @@ -572,7 +572,7 @@ test('a Tier 1 reaches every Latin American and African network through the carr const { ev, errors } = load(); ev("ACT.start({});S.cash=1e9;for(const g of GOALS)S.done[g.id]=0;ACT.launchBB({city:'fra'});S.transit=[];S.ixp={};S.pni=[];for(const n of t1Need())S.pni.push({id:n.id,net:n.id,city:'fra',tier:0});compute()"); for (const n of ['oio', 'tmt', 'bsn', 'mvs', 'llt', 'ant', 'tgo', 'liq', 'scm', 'agc', 'djt', 'mtx', 'art', 'eth', 'mrc']) { - assert.equal(ev(`NET.${n}.up.some(id=>NET[id].type==='t1')`), true, `${n} buys from a Tier 1`); + assert.equal(ev(`NET.${n}.up.every(id=>NET[id].type==='t1')`), true, `${n} buys from Tier 1s`); assert.equal(ev(`R.reachable.${n}`), true, `${n} is reachable`); } assert.deepEqual(errors, []); @@ -708,7 +708,7 @@ test('Australian peering follows PeeringDB: IX Straya and At-The-Edge IX in Sydn assert.ok(hba.includes('cfl') && hba.includes('voc') && !hba.includes('nfx'), 'Hobart: Crowdflare and Hocus Pocus, but no NetChill'); assert.ok(JSON.parse(ev("JSON.stringify(ixMembers('fra'))")).includes('nfx'), 'networks on every IX elsewhere are unchanged outside Australia'); const sellers = JSON.parse(ev("JSON.stringify(NETS.filter(n=>CITIES.some(c=>c.au&&sellsAt(n,c.id))).map(n=>n.id).sort())")); - assert.deepEqual(sellers, ['cog', 'drz', 'gsl', 'lvl', 'ntt', 'sgt', 'spl', 'tsy', 'voc'], 'only carriers that really sell transit in Australia, and Glowball Sakura Lager by design'); + assert.deepEqual(sellers, ['cog', 'drz', 'lvl', 'ntt', 'sgt', 'spl', 'tsy', 'voc'], 'only carriers that really sell transit in Australia'); assert.ok(!ev("NET.ntt.pops.includes('per')"), 'NTT is only in Sydney'); assert.ok(ev("['dsp','fnt','pft'].every(n=>NET[n].pops.includes('syd')&&!sellsAt(NET[n],'syd'))"), 'Pacific carriers backhaul to Sydney but do not sell transit there'); });