diff --git a/CHANGELOG.md b/CHANGELOG.md index f176263..5d91630 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ All notable changes to this project are documented here. The project follows yours. Goggle, Faceplant, Comecast and several other selective networks refuse remote members outright. The route server still gets you every open network, and building a real POP removes all of this. +- Amsterdam has a second exchange: FRIES-IX, run by volunteers out of the + Science Park. Ports up to 400G are free, LAG members too. It has fewer + members than HAMS-IX (Drizzle, Akamaybe, Crowdflare, Slowly and Microsnoft), + and you can join either exchange or both. ## [1.3.0] — 2026-10-23 diff --git a/site/index.html b/site/index.html index 8e79e87..f412355 100644 --- a/site/index.html +++ b/site/index.html @@ -766,8 +766,13 @@ function kmBetween(a,b){const A=CITY[a],B=CITY[b];return Math.max(20,Math.round( const isSub=(a,b)=>CITY[a].land!==CITY[b].land; const popUp=c=>S.pops[c]&&!(S.pops[c].down>S.day); const regionsCount=()=>new Set(Object.keys(S.pops).map(c=>CITY[c].reg)).size; -function ixName(c){return S.myIx[c]?S.myIx[c].name:CITY[c].ix;} -function ixMembers(c){if(S.myIx[c])return S.myIx[c].members.slice();if(!CITY[c].ix)return [];return NETS.filter(n=>n.ix==='ALL'||(Array.isArray(n.ix)&&n.ix.includes(c))).map(n=>n.id);} +/* IXs are keyed by city id for a city's main exchange. A second exchange in the same city gets + its own 'city:name' key in XIX, so ports, peers, route servers and outages stay separate. */ +const XIX={'ams:fries':{city:'ams',name:'FRIES-IX',freeTo:2,members:['drz','akm','cfl','slw','msf'],note:'Run by volunteers out of the Science Park. Ports up to 400G are free, sponsored by people who just like peering. Fewer members than HAMS-IX, but the price is hard to beat.'}}; +const ixCity=k=>XIX[k]?XIX[k].city:k; +function cityIxes(c){const a=[];if(S.myIx[c]||CITY[c].ix)a.push(c);for(const k in XIX)if(XIX[k].city===c)a.push(k);return a;} +function ixName(c){return XIX[c]?XIX[c].name:S.myIx[c]?S.myIx[c].name:CITY[c].ix;} +function ixMembers(c){if(XIX[c])return XIX[c].members.slice();if(S.myIx[c])return S.myIx[c].members.slice();if(!CITY[c].ix)return [];return NETS.filter(n=>n.ix==='ALL'||(Array.isArray(n.ix)&&n.ix.includes(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. const LAG_MAX=8; function lagCap(g,n){n=n||1;return g*n*(n>1?0.95:1);} @@ -797,7 +802,7 @@ const SNUB_ALL=['Not accepting new peers in this region right now.','Region froz function hstr(t){let h=2166136261;for(let i=0;i>>0;} function bigPeer(n){return !!n&&n.pol==='selective'&&n.share>=0.03;} function snub(id,c){ - const n=NET[id];if(!c||!bigPeer(n)||!S||S.myIx[c])return null; + const n=NET[id];if(!c||!bigPeer(n)||!S||S.myIx[c])return null;c=ixCity(c); const off=hstr(id+c)%SNUB_WIN,ep=Math.floor((S.day+off)/SNUB_WIN),h=hstr(S.asn+'|'+id+'|'+c+'|'+ep); if(h%1000>=SNUB_P*1000)return null; const all=(h>>>10)%5<2,list=all?SNUB_ALL:SNUB_IX; @@ -808,9 +813,9 @@ function snub(id,c){ const REMOTE_FEE=1.5,REMOTE_CAP=0.8; const REMOTE_WARN=`

Remote peering is a last resort. Ports come through a reseller at 1.5× the price, only 80% of the port is really yours, latency rides the fabric, one fabric outage drops every session, and many selective networks refuse remote members. A POP here is better.

`; const REMOTE_WHY=['Policy: no remote peers. Be in the building or be in the transit bill.','Saw your session come in over a fabric and said "we can smell the VXC from here".','Only peers with members they can reach without a 1,500 km hairpin.','Their PearingDB entry says "Remote peering: No (we mean it)".','Tried a remote peer once. It flapped during a product launch. Never again.']; -function isRemote(c){return S.ixp[c]!==undefined&&!S.pops[c]&&!S.myIx[c];} +function isRemote(c){return S.ixp[c]!==undefined&&!S.pops[ixCity(c)]&&!S.myIx[c];} function noRemote(id){const n=NET[id];if(!n||n.pol!=='selective')return false;return hstr(id+'|remote')%100<(n.share>=0.03?60:30);} -function ixPortMo(c,tier){return Math.round(PORT[tier].ix*(S.pops[c]?1:REMOTE_FEE));} +function ixPortMo(c,tier){if(XIX[c]&&tier<=XIX[c].freeTo)return 0;return Math.round(PORT[tier].ix*(S.pops[ixCity(c)]?1:REMOTE_FEE));} function snubWhy(sn){const d=Math.max(1,sn.until-S.day);return `${sn.why} They will reconsider in ${d} day${d===1?'':'s'}.`;} function peerOk(id,via,city){ const n=NET[id],dem=R.demTo[id]||0; @@ -844,8 +849,8 @@ function compute(){ const depeer=ev.depeer>day, leak=ev.leak&&ev.leak.until>day?ev.leak.net:null; for(const t of S.transit){if(!popUp(t.city)||t.down>day)continue; E.push({k:'t',prem:!!t.premium&&t.city==='hkg',pref:t.pref||'normal',lab:NET[t.net].name+' transit',id:t.id,city:t.city,cap:lagCap(PORT[t.tier].g,t.n),used:0,rank:3,ok:n=>!(depeer&&t.net==='cog'&&n==='ggl')&&n!==leak});} - for(const c in S.ixp){if(!(popUp(c)||remote.includes(c))||(S.ev.ixdown&&S.ev.ixdown[c]>day))continue;const set=ixSessions(c);R2.sessions+=set.size; - E.push({k:'ix',pref:(S.ixPref&&S.ixPref[c])||'normal',lab:ixName(c)+' peering',id:c,city:c,cap:ixCap(c),used:0,rank:2,ok:n=>set.has(n)});} + for(const c in S.ixp){const cc=ixCity(c);if(!(popUp(cc)||remote.includes(cc))||(S.ev.ixdown&&S.ev.ixdown[c]>day))continue;const set=ixSessions(c);R2.sessions+=set.size; + E.push({k:'ix',pref:(S.ixPref&&S.ixPref[c])||'normal',lab:ixName(c)+' peering',id:c,city:cc,cap:ixCap(c),used:0,rank:2,ok:n=>set.has(n)});} for(const p of S.pni){R2.sessions++;if(!popUp(p.city))continue;E.push({k:'p',pnc:!!NET[p.net].cn,pref:p.pref||'normal',lab:'PNI with '+NET[p.net].name,id:p.id,city:p.city,cap:lagCap(PORT[p.tier].g,p.n),used:0,rank:1,ok:n=>n===p.net});} for(const c of S.caches){if(!popUp(c.city))continue;E.push({k:'c',pref:'normal',lab:NET[c.net].cache.name+' cache',id:c.id,city:c.city,cap:CACHE_CAP,used:0,rank:0,ok:n=>n===c.net});} {const rp=ev.rpki&&ev.rpki.until>day?new Set(ev.rpki.nets):null;if(rp)for(const e of E){if(e.k==='c')continue;const o=e.ok;e.ok=n=>!rp.has(n)&&o(n);}} @@ -934,7 +939,7 @@ function nniPort(c,prov){return (S.nni||[]).find(x=>x.city===c&&x.prov===prov);} function migrate(s){s.hist=s.hist||[];s.loans=s.loans||[];s.loanOffers=s.loanOffers||[];s.loanStrikes=s.loanStrikes||0;for(const l of s.links||[])if(!l.kind)l.kind='wave'; for(const c in s.pops){const p=s.pops[c];if(p.rgen===undefined){let g=0;const need=(i,key)=>{const k=RG.findIndex(r=>r[key]>=i);if(k>g)g=k;}; for(const l of s.links||[])if((l.a===c||l.b===c)&&l.kind==='wave')need(l.tier,'maxLT'); - for(const t of s.transit||[])if(t.city===c)need(t.tier,'maxP');for(const x of s.pni||[])if(x.city===c)need(x.tier,'maxP');if(s.ixp&&s.ixp[c]!==undefined)need(s.ixp[c],'maxP');p.rgen=g;}}for(const b of s.biz||[])if(!b.reqs)b.reqs=BIZ_T[b.type]&&BIZ_T[b.type].div?['diverse']:[];for(const o of s.offers||[])if(!o.reqs)o.reqs=[];if(!s.lvl)s.lvl=1;s.nni=s.nni||[];s.cnLic=s.cnLic||{state:'none'};if(s.scrubAt===undefined)s.scrubAt=null;s.ev=s.ev||{};for(const l of s.links){if(!l.kind)l.kind='wave';if(l.mo===undefined)l.mo=Math.round(waveMo(l.km,l.sub,l.tier)*(l.mult||1));}for(const c in s.pops){if(!s.pops[c].routers)s.pops[c].routers=1;}return s;} + for(const t of s.transit||[])if(t.city===c)need(t.tier,'maxP');for(const x of s.pni||[])if(x.city===c)need(x.tier,'maxP');for(const k in s.ixp||{})if(ixCity(k)===c)need(s.ixp[k],'maxP');p.rgen=g;}}for(const b of s.biz||[])if(!b.reqs)b.reqs=BIZ_T[b.type]&&BIZ_T[b.type].div?['diverse']:[];for(const o of s.offers||[])if(!o.reqs)o.reqs=[];if(!s.lvl)s.lvl=1;s.nni=s.nni||[];s.cnLic=s.cnLic||{state:'none'};if(s.scrubAt===undefined)s.scrubAt=null;s.ev=s.ev||{};for(const l of s.links){if(!l.kind)l.kind='wave';if(l.mo===undefined)l.mo=Math.round(waveMo(l.km,l.sub,l.tier)*(l.mult||1));}for(const c in s.pops){if(!s.pops[c].routers)s.pops[c].routers=1;}return s;} const REQS={ lat:{only:true,l2:true,bonus:0,l:o=>`One-way latency within ${o.latMax} ms (best now: ${(()=>{const v=R.l2lat[o.id]!==undefined?R.l2lat[o.id]:bestLat(o.city,o.city2);return isFinite(v)?v.toFixed(1)+' ms':'no path'})()})`,ok:b=>(R.l2lat[b.id]!==undefined?R.l2lat[b.id]:bestLat(b.city,b.city2))<=b.latMax}, diverse:{l:'Two paths that share no trench or fabric',bonus:.25,l2:true,ok:b=>R.div[b.id]!==undefined?!!R.div[b.id]:diversePaths(b.city,b.city2)}, @@ -944,7 +949,7 @@ const REQS={ netchill:{l:'Wants NetChill on-net: a cache or a PNI',bonus:.15,ok:()=>S.caches.some(c=>c.net==='nfx')||S.pni.some(p=>p.net==='nfx')}, gen:{l:'Backup generator in every city they touch',bonus:.15,ok:b=>[b.city,b.city2].filter(Boolean).every(c=>S.pops[c]&&S.pops[c].gen)}, routers:{l:'Insists on two routers in their city',bonus:.15,ok:b=>((S.pops[b.city]&&S.pops[b.city].routers)||1)>=2}, - local:{l:'Local breakout: transit or an IX port in their own city',bonus:.2,ip:true,ok:b=>S.transit.some(t=>t.city===b.city)||S.ixp[b.city]!==undefined}, + local:{l:'Local breakout: transit or an IX port in their own city',bonus:.2,ip:true,ok:b=>S.transit.some(t=>t.city===b.city)||Object.keys(S.ixp).some(k=>ixCity(k)===b.city)}, twoup:{l:'Wants two different transit providers (or none at all)',bonus:.15,ip:true,ok:()=>new Set(S.transit.map(t=>t.net)).size>=2||S.transit.length===0}, china:{l:'Needs low-loss reach into China',bonus:.3,ip:true,ok:()=>S.transit.some(t=>t.premium&&t.city==='hkg')||S.links.some(l=>l.premium)||S.pni.some(p=>NET[p.net].cn)}, scrubbed:{l:'Will only sign with a network that runs a DDoS scrubbing center',bonus:.15,ok:()=>!!S.scrubAt}, @@ -1069,7 +1074,7 @@ function fireFailure(){ addInc({type,ref:c,until:pp.down,msg:msg+(type==='oops'&&(pp.routers||1)>=2?' Automation pushed it to every router, so redundancy did not help.':''),cost:1500,fix:type==='oops'?'Roll back the config':'Hide the vacuum'}); }else if(type==='maxpfx'){ const c=pick(Object.keys(S.ixp));S.ev.ixdown=S.ev.ixdown||{};S.ev.ixdown[c]=Math.max(S.ev.ixdown[c]||0,S.day+1+Math.floor(Math.random()*2)); - addInc({type,ref:c,until:S.ev.ixdown[c],msg:`A member at ${ixName(c)} leaked the full routing table into the route server. Max-prefix limits tripped everywhere. Peering in ${CITY[c].name} is down.`,cost:0}); + addInc({type,ref:c,until:S.ev.ixdown[c],msg:`A member at ${ixName(c)} leaked the full routing table into the route server. Max-prefix limits tripped everywhere. Peering there is down.`,cost:0}); }else if(type==='prepend'){ const t=pick(S.transit);t.down=Math.max(t.down||0,S.day+2);addInc({type,ref:t.id,until:t.down,msg:`${NET[t.net].name} fat-fingered a route-map and prepended your AS ${30+Math.floor(Math.random()*60)} times in ${CITY[t.city].name}. Nobody wants that path.`,cost:0}); }else if(type==='rpki'){ @@ -1288,9 +1293,9 @@ const ACT={ buyTransit:({city,net,tier})=>{tier=+tier;if(!S.pops[city]||!NET[net]||!NET[net].price||!NET[net].pops.includes(city)||!PORT[tier])return;if(!portOk(city,tier)){toast(`Your router can't take a ${PORT[tier].n} port.
Upgrade it in the Infra tab.`,'bad');sfx('err');return;}const ex=S.transit.find(t=>t.city===city&&t.net===net);if(ex&&tier<=ex.tier)return;if(!spend(PORT[tier].setup*(ex&&ex.n||1)))return;if(ex)ex.tier=tier;else S.transit.push({id:uid(),city,net,tier,down:0});toast(`${esc(NET[net].name)} transit is live in ${CITY[city].name}.
Full table received: ~1,000,000 routes.`,'good');after();}, lagT:({id,d})=>{const t=S.transit.find(x=>x.id===id);if(!t)return;const n=(t.n||1)+(+d);if(n<1||n>LAG_MAX)return;if(+d>0){if(!portOk(t.city,t.tier))return;if(!spend(PORT[t.tier].setup))return;}t.n=n;toast(+d>0?`LAG member added.
${esc(NET[t.net].name)} in ${CITY[t.city].name} is now ${lagName(t.tier,n)}.`:`LAG member removed.`,'good');after();}, lagP:({id,d})=>{const p=S.pni.find(x=>x.id===id);if(!p)return;const n=(p.n||1)+(+d);if(n<1||n>LAG_MAX)return;if(+d>0&&!spend(1500+PORT[p.tier].setup/2))return;p.n=n;sfx('build');after();}, - lagIx:({city,d})=>{if(S.ixp[city]===undefined||S.myIx[city]||!S.pops[city])return;S.ixn=S.ixn||{};const n=(S.ixn[city]||1)+(+d);if(n<1||n>LAG_MAX)return;if(+d>0&&!spend(PORT[S.ixp[city]].ix))return;S.ixn[city]=n;sfx('build');after();}, + lagIx:({city,d})=>{if(S.ixp[city]===undefined||S.myIx[city]||!S.pops[ixCity(city)])return;S.ixn=S.ixn||{};const n=(S.ixn[city]||1)+(+d);if(n<1||n>LAG_MAX)return;if(+d>0&&!spend(ixPortMo(city,S.ixp[city])))return;S.ixn[city]=n;sfx('build');after();}, cancelTransit:({id})=>{if(UI.confirm!==id){UI.confirm=id;renderPanel();return;}S.transit=S.transit.filter(t=>t.id!==id);UI.confirm=null;after();}, - buyIx:({city,tier})=>{tier=+tier;if(!PORT[tier]||!ixName(city)||(!S.pops[city]&&(!remoteCities().includes(city)||tier>1))||(S.ixp[city]!==undefined&&tier<=S.ixp[city]))return;if(S.pops[city]&&!portOk(city,tier)){toast(`Your router can't take a ${PORT[tier].n} port.
Upgrade it in the Infra tab.`,'bad');sfx('err');return;}const had=S.ixp[city]!==undefined;if(!spend(ixPortMo(city,tier)*(had?((S.ixn||{})[city]||1):1)))return;S.ixp[city]=tier;if(!had)toast(S.pops[city]?`Port up at ${esc(ixName(city))}!
Now request peering, or join the route server.`:`Remote port up at ${esc(ixName(city))}.
It came through a reseller, so expect a markup, a crowded port and some networks that won't talk to you. The route server is your friend here.`,'good');after();}, + buyIx:({city,tier})=>{tier=+tier;const cc=ixCity(city);if(!PORT[tier]||!ixName(city)||(!S.pops[cc]&&(!remoteCities().includes(cc)||tier>1))||(S.ixp[city]!==undefined&&tier<=S.ixp[city]))return;if(S.pops[cc]&&!portOk(cc,tier)){toast(`Your router can't take a ${PORT[tier].n} port.
Upgrade it in the Infra tab.`,'bad');sfx('err');return;}const had=S.ixp[city]!==undefined;if(!spend(ixPortMo(city,tier)*(had?((S.ixn||{})[city]||1):1)))return;S.ixp[city]=tier;if(!had)toast(S.pops[cc]?`Port up at ${esc(ixName(city))}!
Now request peering, or join the route server.`:`Remote port up at ${esc(ixName(city))}.
It came through a reseller, so expect a markup, a crowded port and some networks that won't talk to you. The route server is your friend here.`,'good');after();}, cancelIx:({city})=>{if(UI.confirm!=='ix'+city){UI.confirm='ix'+city;renderPanel();return;}delete S.ixp[city];delete S.rs[city];if(S.ixn)delete S.ixn[city];for(const k in S.peers)if(k.endsWith('@'+city))delete S.peers[k];UI.confirm=null;after();}, rs:({city})=>{S.rs[city]=!S.rs[city];if(S.rs[city])toast('Route server session up.
You now peer with every open network on this IX, in one go.','good');sfx('build');after();}, peer:({city,net})=>{const r=peerOk(net,'ix',city);if(!r.ok){toast(`${esc(NET[net].name)} declined.
${esc(r.why)}`,'bad');sfx('err');return;}S.peers[net+'@'+city]=true; @@ -1331,7 +1336,7 @@ const ACT={ const km=kmBetween(a,b),sub=isSub(a,b),mo=vxcMo(km,sub,t);if(!spend(mo))return;S.links.push({id:uid(),a,b,kind:'vxc',prov,vt:t,km,sub,mo,cut:0,day:S.day});closeModal(); toast(`Circuit up in 59 seconds.
${VXC[t].n} over ${esc(FAB[prov].name)}: ${CITY[a].name} → ${CITY[b].name}.${S.pops[b]?'':' Now grab an IX port there for remote peering.'}`,'good');if(!S.pops[b])selectCity(b);after();}, upVxc:({id,t})=>{t=+t;const l=S.links.find(x=>x.id===id);if(!l)return;const extra=VXC[t].g-VXC[l.vt].g;for(const c of [l.a,l.b]){const pt=nniPort(c,l.prov);if(pt&&nniUsed(c,l.prov)+extra>NNI[pt.tier].g){toast(`Fabric port in ${CITY[c].name} is full.`,'bad');sfx('err');return;}}const mo=vxcMo(l.km,l.sub,t);if(!spend(mo))return;l.vt=t;l.mo=mo;after();}, - cancelVxc:({id})=>{if(UI.confirm!==id){UI.confirm=id;renderPanel();return;}S.links=S.links.filter(l=>l.id!==id);const rem=remoteCities();for(const c in S.ixp){if(!S.pops[c]&&!rem.includes(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();}, + cancelVxc:({id})=>{if(UI.confirm!==id){UI.confirm=id;renderPanel();return;}S.links=S.links.filter(l=>l.id!==id);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(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})=>{const l=S.links.find(x=>x.id===id);if(!l)return;for(const x of pairLinks(l.a,l.b))x.metric=v;sfx('click');after();}, goEgress:({city,k})=>{ACT.focusCity({city});UI.tab=k==='t'?'up':k==='l2'?'cust':'peer';renderPanel();}, @@ -1476,7 +1481,7 @@ function renderPanel(){ function cityPanel(c){ const C=CITY[c],p=S.pops[c],ix=ixName(c),down=p&&p.down>S.day; let h=`
${REG[C.reg]} · ${esc(C.dc)}

${C.name}

-
${fmtG(C.P)} of eyeballs${regionMult(c)>1?`Transit ${regionMult(c)}× pricier`:''}${C.reg==='AS'&&!C.cn?'Underserved: users grow 60% faster':''}${ix?`IX: ${esc(ix)}`:''}${p?`Your POP`:''}${down?`DOWN`:''}
+
${fmtG(C.P)} of eyeballs${regionMult(c)>1?`Transit ${regionMult(c)}× pricier`:''}${C.reg==='AS'&&!C.cn?'Underserved: users grow 60% faster':''}${ix?`IX: ${cityIxes(c).map(k=>esc(ixName(k))).join(' + ')}`:''}${p?`Your POP`:''}${down?`DOWN`:''}
`; if(!p){ h+=`
${C.note?`

${esc(C.note)}

`:''} @@ -1486,9 +1491,9 @@ function cityPanel(c){ h+=offersHere(c); const tr=NETS.filter(n=>n.price&&n.pops.includes(c)); const fh=FABS.filter(f=>f.cities.includes(c)); - if(ix&&fh.length){if(remoteCities().includes(c))h+=ixSection(c).replace('

Internet Exchange

','

Remote peering at the IX

'); - else h+=`

Remote peering

Peer at ${esc(ix)} without building a POP. Order a virtual circuit here from one of your POPs over ${fh.map(f=>esc(f.name)).join(' or ')}.

${REMOTE_WARN}${btn('Order circuit anyway','openVxc',{to:c},'ghost sm')}
`;} - h+=`

Who's here

Transit sellers: ${tr.map(n=>`${esc(n.name)}`).join(', ')||'none'}
Fabrics: ${fh.map(f=>`${esc(f.name)}`).join(', ')||'none'}
${ix?`IX members on ${esc(ix)}: ${ixMembers(c).length}`:'No IX here yet. You could found one later.'}
`; + if(ix&&fh.length){if(remoteCities().includes(c))h+=ixSection(c).replaceAll('

Internet Exchange

','

Remote peering at the IX

'); + else h+=`

Remote peering

Peer at ${cityIxes(c).map(k=>esc(ixName(k))).join(' or ')} without building a POP. Order a virtual circuit here from one of your POPs over ${fh.map(f=>esc(f.name)).join(' or ')}.

${REMOTE_WARN}${btn('Order circuit anyway','openVxc',{to:c},'ghost sm')}
`;} + h+=`

Who's here

Transit sellers: ${tr.map(n=>`${esc(n.name)}`).join(', ')||'none'}
Fabrics: ${fh.map(f=>`${esc(f.name)}`).join(', ')||'none'}
${ix?cityIxes(c).map(k=>`IX members on ${esc(ixName(k))}: ${ixMembers(k).length}`).join('
'):'No IX here yet. You could found one later.'}
`; return h; } const tabs=[['cust','Customers'],['up','Transit'],['peer','Peering'],['links','Infra']]; @@ -1568,16 +1573,20 @@ function cityPanel(c){ } return h+``; } -function ixSection(c){const C=CITY[c],ix=ixName(c);let h=''; +function ixSection(c){const C=CITY[c],ks=cityIxes(c);if(ks.length)return ks.map(ixBlock).join('');let h=''; h+=`

Internet Exchange

`; - if(!ix&&C.cn){h+=`

Running an exchange in mainland China takes a different license entirely. Peer with Chinese networks over PNIs, or meet them in Hong Kong.

`;} - else if(!ix){h+=`

There's no IX in ${C.name} yet. Found one: networks join over time, pay you for ports, and peer with you for free.

${S.pops[c]?btn(`Found your own IX ${fmt$(MYIX_COST)} + ${fmt$(MYIX_MO)}/mo`,'foundIx',{city:c},'pink',S.cashBuild a POP here first.

'}`;} - else if(S.ixp[c]===undefined){h+=`

${esc(ix)} is a shared switch. One port lets you peer with every member for free. Members: ${ixMembers(c).map(id=>esc(NET[id].name)).join(', ')||'nobody yet'}.

${S.pops[c]?'':REMOTE_WARN}
${PORT.map((P2,i)=>btn(`${P2.n} port ${fmt$(ixPortMo(c,i))}/mo`,'buyIx',{city:c,tier:i},'',S.cash1))).join('')}
`;} + if(C.cn){h+=`

Running an exchange in mainland China takes a different license entirely. Peer with Chinese networks over PNIs, or meet them in Hong Kong.

`;} + else{h+=`

There's no IX in ${C.name} yet. Found one: networks join over time, pay you for ports, and peer with you for free.

${S.pops[c]?btn(`Found your own IX ${fmt$(MYIX_COST)} + ${fmt$(MYIX_MO)}/mo`,'foundIx',{city:c},'pink',S.cashBuild a POP here first.

'}`;} + h+=`
`;return h; +} +const portMo=v=>v?fmt$(v)+'/mo':'free'; +function ixBlock(c){const cc=ixCity(c),ix=ixName(c),x=XIX[c];let h=`

Internet Exchange

${x?`

${esc(x.note)}

`:''}`; + if(S.ixp[c]===undefined){h+=`

${esc(ix)} is a shared switch. One port lets you peer with every member for free. Members: ${ixMembers(c).map(id=>esc(NET[id].name)).join(', ')||'nobody yet'}.

${S.pops[cc]?'':REMOTE_WARN}
${PORT.map((P2,i)=>btn(`${P2.n} port ${portMo(ixPortMo(c,i))}`,'buyIx',{city:c,tier:i},'',S.cash1))).join('')}
`;} else{const mine=!!S.myIx[c],u=R.useIx[c]||0,cap=ixCap(c),set=ixSessions(c),xdown=S.ev.ixdown&&S.ev.ixdown[c]>S.day; h+=`
${mine?'Your own fabric · 400G':lagName(S.ixp[c],(S.ixn||{})[c])}${xdown?' · FABRIC DOWN':''}${fmtG(u)}
${prefCtl('ix',c,S.ixPref&&S.ixPref[c])}`; if(isRemote(c))h+=`

Remote port via a reseller: 1.5× price, 80% usable, and ${ixMembers(c).filter(noRemote).length} member${ixMembers(c).filter(noRemote).length===1?'':'s'} here refuse remote peers.

`; if(mine)h+=`
Members paying you${S.myIx[c].members.length} · ${fmt$(S.myIx[c].members.length*MYIX_FEE)}/mo
`; - else h+=`
${PORT.map((P2,i)=>i>S.ixp[c]?btn(`Upgrade ${P2.n} ${fmt$(ixPortMo(c,i)*((S.ixn||{})[c]||1))}/mo`,'buyIx',{city:c,tier:i},'sm',(!!S.pops[c]&&!portOk(c,i))||(!S.pops[c]&&i>1)):'').join('')}${S.pops[c]&&((S.ixn||{})[c]||1)${fmt$(PORT[S.ixp[c]].ix)}/mo`,'lagIx',{city:c,d:1},'sm',S.cash1?btn('− member','lagIx',{city:c,d:-1},'ghost sm'):''}${btn(S.rs[c]?'Leave route server':'Join route server','rs',{city:c},S.rs[c]?'ghost sm':'pink sm')}${btn(UI.confirm==='ix'+c?'Really leave?':'Leave IX','cancelIx',{city:c},'ghost sm')}
`; + else h+=`
${PORT.map((P2,i)=>i>S.ixp[c]?btn(`Upgrade ${P2.n} ${portMo(ixPortMo(c,i)*((S.ixn||{})[c]||1))}`,'buyIx',{city:c,tier:i},'sm',(!!S.pops[cc]&&!portOk(cc,i))||(!S.pops[cc]&&i>1)):'').join('')}${S.pops[cc]&&((S.ixn||{})[c]||1)${portMo(ixPortMo(c,S.ixp[c]))}`,'lagIx',{city:c,d:1},'sm',S.cash1?btn('− member','lagIx',{city:c,d:-1},'ghost sm'):''}${btn(S.rs[c]?'Leave route server':'Join route server','rs',{city:c},S.rs[c]?'ghost sm':'pink sm')}${btn(UI.confirm==='ix'+c?'Really leave?':'Leave IX','cancelIx',{city:c},'ghost sm')}
`; h+=`
`; for(const id of ixMembers(c)){const n=NET[id],on=set.has(id),viaRs=on&&!S.peers[id+'@'+c]&&!mine,chk=peerOk(id,'ix',c); h+=`
${logo(n)}
${esc(n.name)}
${TYPE_L[n.type]} ${n.pol} · ${(NSH[id]*100).toFixed(0)}%
${!on&&!chk.ok?`
${esc(chk.why)}
`:''}
@@ -1590,7 +1599,7 @@ function vxcPanel(l){ let h=`
Virtual circuit · ${esc(f.name)} · ${l.km.toLocaleString()} km

${CITY[l.a].name} ⇄ ${CITY[l.b].name}

`; if(down)h+=`

Fabric outage

${esc(f.name)} is down. Nothing you can do but wait, or have another path.

`; h+=`

Capacity

${VXC[l.vt].n} circuit${fmtG(load)} / ${fmtG(cap)}
-
Monthly${fmt$(l.mo)}/mo
${!S.pops[l.b]?`

Remote peering leg into ${esc(CITY[l.b].ix)}.

`:''} +
Monthly${fmt$(l.mo)}/mo
${!S.pops[l.b]?`

Remote peering leg into ${cityIxes(l.b).map(k=>esc(ixName(k))).join(' and ')}.

`:''}
${VXC.map((V,t)=>t>l.vt?btn(`${V.n} ${fmt$(vxcMo(l.km,l.sub,t))}/mo`,'upVxc',{id:l.id,t},'sm'):'').join('')}
${trafficSection(l)}${metricSection(l)}
${btn(UI.confirm===l.id?'Really cancel?':'Cancel circuit','cancelVxc',{id:l.id},'ghost sm')}
`; @@ -1818,7 +1827,7 @@ function dfModalBody(a,b,km,pop){ } function openVxcModal({from,to,prov}){ let rows='';const row=(f,a,b)=>{const km=kmBetween(a,b),sub=isSub(a,b),pb=S.pops[b]?nniPort(b,f.id):null,remote=!S.pops[b]; - const label=remote?`Remote peering at ${esc(CITY[b].ix)} · discouraged`:pb?'Your POP':'Your POP · needs a fabric port there'; + const label=remote?`Remote peering at ${cityIxes(b).map(k=>esc(ixName(k))).join(' or ')} · discouraged`:pb?'Your POP':'Your POP · needs a fabric port there'; const freeA=nniPort(a,f.id)?NNI[nniPort(a,f.id).tier].g-nniUsed(a,f.id):0,freeB=remote?1e9:pb?NNI[pb.tier].g-nniUsed(b,f.id):0; return `
${CITY[a].name} → ${CITY[b].name}
${label} · ${km.toLocaleString()} km${sub?' subsea':''}
${VXC.map((V,t)=>btn(`${V.n} ${fmt$(vxcMo(km,sub,t))}/mo`,'buyVxc',{a,b,prov:f.id,t},'sm',(!remote&&!pb)||V.g>freeA||V.g>freeB||S.cash
`;}; @@ -2021,11 +2030,11 @@ function drawCity(C,sx,sy,sc,now,lyOverride){ ctx.translate(0,-2); } const ixn=ixName(C.id); - if(ixn){const mine=!!S.myIx[C.id],joined=S.ixp[C.id]!==undefined;ctx.fillStyle=mine?'#FF4F9A':joined?'#FFD23F':'#FFFFFF';ctx.beginPath();for(let i=0;i<6;i++){const a=Math.PI/3*i+Math.PI/6;ctx.lineTo(19+8.5*Math.cos(a),-h+2+8.5*Math.sin(a));}ctx.closePath();ctx.fill();ctx.lineWidth=2;ctx.stroke(); + if(ixn){const mine=!!S.myIx[C.id],joined=cityIxes(C.id).some(k=>S.ixp[k]!==undefined);ctx.fillStyle=mine?'#FF4F9A':joined?'#FFD23F':'#FFFFFF';ctx.beginPath();for(let i=0;i<6;i++){const a=Math.PI/3*i+Math.PI/6;ctx.lineTo(19+8.5*Math.cos(a),-h+2+8.5*Math.sin(a));}ctx.closePath();ctx.fill();ctx.lineWidth=2;ctx.stroke(); ctx.fillStyle=mine?'#fff':'#1E2640';ctx.font='900 8px Nunito, sans-serif';ctx.textAlign='center';ctx.textBaseline='middle';ctx.fillText('IX',19,-h+2.5);} const off=S.offers.some(o=>bCities(o).includes(C.id)); if(off){const by=-h-16+Math.sin(now/250)*3;ctx.fillStyle='#fff';ctx.lineWidth=2.2;ctx.beginPath();ctx.ellipse(-2,by,11,9,0,0,7);ctx.fill();ctx.stroke();ctx.beginPath();ctx.moveTo(-5,by+8);ctx.lineTo(-7,by+14);ctx.lineTo(0,by+8);ctx.fillStyle='#fff';ctx.fill();const big=S.offers.some(o=>bCities(o).includes(C.id)&&(BIZ_T[o.type].lv>=3||BIZ_T[o.type].event));ctx.fillStyle=big?'#FF4F9A':'#16A866';ctx.font='900 13px "Baloo 2", sans-serif';ctx.textAlign='center';ctx.textBaseline='middle';ctx.fillText(big?'$$':'$',-2,by+1);} - const inc=S.inc.some(i=>i.ref===C.id&&i.type!=='leak'); + const inc=S.inc.some(i=>(IXDOWN.includes(i.type)?ixCity(i.ref):i.ref)===C.id&&i.type!=='leak'); if(inc){ctx.fillStyle='#FF4D5E';ctx.beginPath();ctx.arc(-20,-h+2,7,0,7);ctx.fill();ctx.lineWidth=2;ctx.stroke();ctx.fillStyle='#fff';ctx.font='900 11px Nunito, sans-serif';ctx.textAlign='center';ctx.textBaseline='middle';ctx.fillText('!',-20,-h+3);} ctx.restore(); // label diff --git a/tests/peering.test.js b/tests/peering.test.js index 039095e..73cf865 100644 --- a/tests/peering.test.js +++ b/tests/peering.test.js @@ -72,3 +72,37 @@ test('remote peering is offered but costs more, gives less and gets refused more assert.equal(ev(`peerOk('${refusers[0]}','ix','ams').remote`), undefined); assert.deepEqual(errors, []); }); + +test('Amsterdam has a second IX, FRIES-IX, with free ports up to 400G', () => { + const { ev, errors } = load(); + setup(ev); + assert.deepEqual(JSON.parse(ev("JSON.stringify(cityIxes('ams'))")), ['ams', 'ams:fries']); + ev("ACT.buildPop({city:'ams'});S.pops.ams.rgen=RG.length-1;compute()"); + const cash = () => ev('S.cash'); + let c0 = cash(); + ev("ACT.buyIx({city:'ams:fries',tier:2})"); + assert.equal(ev("S.ixp['ams:fries']"), 2); + assert.equal(cash(), c0, '400G port is free'); + assert.equal(ev("S.ixp.ams"), undefined, 'HAMS-IX is separate'); + c0 = cash(); + ev("ACT.lagIx({city:'ams:fries',d:1})"); + assert.equal(cash(), c0, 'LAG members are free too'); + assert.equal(ev("ixPortMo('ams:fries',3)"), ev('PORT[3].ix'), '800G costs the usual price'); + ev("ACT.buyIx({city:'ams',tier:1});ACT.rs({city:'ams:fries'});compute()"); + assert.ok(ev("ixSessions('ams:fries').has('drz')")); + assert.equal(ev("ixSessions('ams:fries').has('ggl')"), false, 'Goggle is not a member'); + assert.equal(ev("R.useIx['ams:fries']!==undefined&&R.useIx.ams!==undefined"), true, 'both fabrics carry traffic'); + assert.equal(ev("R.cost.ix"), ev("PORT[1].ix"), "only the HAMS-IX port is billed"); + ev("selectCity('ams');ACT.tab({t:'peer'})"); + const txt = ev("document.getElementById('panelBody').textContent"); + assert.match(txt, /FRIES-IX/); assert.match(txt, /HAMS-IX/); + ev("S.ev.ixdown={'ams:fries':S.day+2};compute()"); + assert.equal(ev("R.useIx['ams:fries']"), undefined, 'a FRIES-IX outage drops only that fabric'); + assert.notEqual(ev("R.useIx.ams"), undefined); + ev("S.ev.ixdown={};compute()"); + ev("ACT.cancelIx({city:'ams:fries'});ACT.cancelIx({city:'ams:fries'})"); + assert.equal(ev("S.ixp['ams:fries']"), undefined); + assert.equal(ev("S.ixp.ams"), 1, 'leaving FRIES-IX keeps the HAMS-IX port'); + assert.equal(ev("Object.keys(S.rs).filter(k=>S.rs[k]).length"), 0); + assert.deepEqual(errors, []); +});