Show the cache hop in traceroute only when a cache is the exit
The hop for an embedded cache sat in a bare else, so every trace that left over transit, an exchange or a PNI without a peer's cone printed an "embedded cache in your rack" hop, even with no cache box at all.
This commit is contained in:
parent
de4a750cdd
commit
a47fc0735f
3 changed files with 23 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ All notable changes to this project are documented here. The project follows
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
- Traceroute no longer shows an "embedded cache in your rack" hop on paths that leave over transit, an exchange or a PNI. Only traffic that really ends at one of your cache boxes shows it now.
|
||||||
- Networks you reach through an exchange's route server now stay "via RS" (#265). With an Open peering policy, the peering desk used to turn some of them into separate sessions of their own.
|
- Networks you reach through an exchange's route server now stay "via RS" (#265). With an Open peering policy, the peering desk used to turn some of them into separate sessions of their own.
|
||||||
- The intern's "Light more fiber" order has a new Optics setting: light new fiber with the biggest optic it can afford, to save channels for later (#262). Once a fiber is lit, the intern still adds more of the same optic and never swaps what is in there.
|
- The intern's "Light more fiber" order has a new Optics setting: light new fiber with the biggest optic it can afford, to save channels for later (#262). Once a fiber is lit, the intern still adds more of the same optic and never swaps what is in there.
|
||||||
- The Build POP button now shows the whole price of a new POP, including the routers of your standard POP (#261). Before, it showed only the site, although the standard routers were paid for on top; a note under the button now lists them, and the intern's one-tap template prices them in as well. POPs that come with a new wave, dark fiber, your own subsea cable or a consortium seat now get the standard routers too, and those offers show the price with them.
|
- The Build POP button now shows the whole price of a new POP, including the routers of your standard POP (#261). Before, it showed only the site, although the standard routers were paid for on top; a note under the button now lists them, and the intern's one-tap template prices them in as well. POPs that come with a new wave, dark fiber, your own subsea cable or a consortium seat now get the standard routers too, and those offers show the price with them.
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ function traceroute(src,to){const P=trPaths(src),me=slug(S.name)+'.net',lines=[]
|
||||||
else if(e.k==='p'){hop(`pni-${slug(NET[e.via||N.id].name)}.${e.city}.${me}`,ip(hstr(N.id),3),0.2,tr('traceroute.private_cross_connect'));}
|
else if(e.k==='p'){hop(`pni-${slug(NET[e.via||N.id].name)}.${e.city}.${me}`,ip(hstr(N.id),3),0.2,tr('traceroute.private_cross_connect'));}
|
||||||
// Down the cone one customer at a time: the shortest chain of upstreams from the peer to the network, each AS on the path.
|
// Down the cone one customer at a time: the shortest chain of upstreams from the peer to the network, each AS on the path.
|
||||||
if(e.via){const ch=coneChain(e.via,N.id);for(let i=0;i<ch.length-1;i++){const V=NET[ch[i]],C=NET[ch[i+1]];asPath.push(V.asn);hop(`${slug(C.name)}-cust.${e.city}.${slug(V.name)}.net`,`198.51.100.${(hstr(V.id)+3)%250}`,1.2,tr('traceroute.net_hands_it_to_its_customer',{net:V.name,to:C.name}));}}
|
if(e.via){const ch=coneChain(e.via,N.id);for(let i=0;i<ch.length-1;i++){const V=NET[ch[i]],C=NET[ch[i+1]];asPath.push(V.asn);hop(`${slug(C.name)}-cust.${e.city}.${slug(V.name)}.net`,`198.51.100.${(hstr(V.id)+3)%250}`,1.2,tr('traceroute.net_hands_it_to_its_customer',{net:V.name,to:C.name}));}}
|
||||||
else{hop(`cache-${slug(N.name)}.${e.city}.${me}`,ip(hstr(N.id),4),0.1,tr('traceroute.embedded_cache_in_your_rack'));}
|
else if(e.k==='c'){hop(`cache-${slug(N.name)}.${e.city}.${me}`,ip(hstr(N.id),4),0.1,tr('traceroute.embedded_cache_in_your_rack'));}
|
||||||
asPath.push(N.asn);if(e.k!=='c')hop(`www.${slug(N.name)}.example`,`198.51.100.${(hstr(N.id)+1)%250}`,0.5+(e.k==='t'?1:0.2),`${N.name}`);
|
asPath.push(N.asn);if(e.k!=='c')hop(`www.${slug(N.name)}.example`,`198.51.100.${(hstr(N.id)+1)%250}`,0.5+(e.k==='t'?1:0.2),`${N.name}`);
|
||||||
const order=e.via?tr('traceroute.a_peer_s_customers_come_after'):{c:tr('traceroute.caches_beat_pnis'),p:tr('traceroute.pnis_beat_ix_peering'),ix:tr('traceroute.ix_peering_beats_transit'),t:tr('traceroute.transit_is_the_last_resort')}[e.k];
|
const order=e.via?tr('traceroute.a_peer_s_customers_come_after'):{c:tr('traceroute.caches_beat_pnis'),p:tr('traceroute.pnis_beat_ix_peering'),ix:tr('traceroute.ix_peering_beats_transit'),t:tr('traceroute.transit_is_the_last_resort')}[e.k];
|
||||||
const cn=cnCity(src)!==!!N.cn?' '+tr('traceroute.crossing_the_great_firewall_here',{p:S.ev.gfw>S.day?35:20}):'';
|
const cn=cnCity(src)!==!!N.cn?' '+tr('traceroute.crossing_the_great_firewall_here',{p:S.ev.gfw>S.day?35:20}):'';
|
||||||
|
|
|
||||||
21
tests/traceroute.test.js
Normal file
21
tests/traceroute.test.js
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
const test = require('node:test');
|
||||||
|
const assert = require('node:assert/strict');
|
||||||
|
const { load } = require('./harness');
|
||||||
|
|
||||||
|
test('traceroute shows an embedded cache hop only when a cache is the exit', () => {
|
||||||
|
const { ev, errors } = load();
|
||||||
|
ev("ACT.start({});S.cash=1e8;for(const g of GOALS)S.done[g.id]=0");
|
||||||
|
ev("S.pops.fra.bb={d:20/NSH.cfl};ACT.buyTransit({city:'fra',net:'cog',tier:1});compute()");
|
||||||
|
// The hops, without the "traceroute to …" header line.
|
||||||
|
const trace = () => { const r = ev("traceroute('fra',{net:'cfl'})"); return { ...r, hops: r.text.split('\n').slice(1).join('\n') }; };
|
||||||
|
const before = trace();
|
||||||
|
assert.match(before.why, /Cogentle/, 'over transit');
|
||||||
|
assert.doesNotMatch(before.hops, /cache-|embedded cache/, 'no cache hop without a cache');
|
||||||
|
assert.match(before.hops, /www\.crowdflare\.example/, 'ends at the network itself');
|
||||||
|
ev("ACT.cache({city:'fra',net:'cfl'});compute()");
|
||||||
|
assert.equal(ev('S.caches.length'), 1);
|
||||||
|
const after = trace();
|
||||||
|
assert.match(after.hops, /cache-crowdflare\.fra\..*embedded cache in your rack$/, 'the cache is the last hop');
|
||||||
|
assert.doesNotMatch(after.hops, /cogentle|www\.crowdflare/, 'nothing leaves the network');
|
||||||
|
assert.deepEqual(errors, []);
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue