IPv6-only broadband: 464XLAT city by city, a NAT64 pool next to CGNAT
A broadband city can swap its home routers for ones with a CLAT (ip6Go / ip6Stop, from the city panel's Home broadband). Over 30 to 180 days an even share of the homes moves each day, paid as the routers go in ($4 a home), waiting while cash is short; starting needs only the first day's share. New homes in a swapping or finished city get the new router at the same price. The panel says how many addresses it frees and what it does to the monthly IPv4 bill. ip4Use splits homes into public, behind CGNAT and IPv6-only: the NAT64 pool (ceil(IPv6-only homes / NAT64 ratio), 64/128/256, default 128) comes right after business blocks, before dual-stack homes. NAT64 gateways cost the same per Gbps of IPv4 as CGNAT boxes; NAT64 refunds sit under CGNAT's at the same ratio and never reach zero. The IPv4 share of home traffic is now a curve: 0.55 on day 0, two points less a year, floor 0.2. Out-of-space advice names the sharing left to stretch. Everything is under rule ip4; old saves load unchanged (no field means dual stack).
This commit is contained in:
parent
3bc1641a46
commit
69328ce257
25 changed files with 812 additions and 54 deletions
|
|
@ -88,9 +88,10 @@ const API_DOMAINS={
|
|||
pieSpatId:{table:'PIE_SPAT_DEF',kind:'key'},
|
||||
pieSpatChoice:{kind:'enum',values:[0,1]},
|
||||
countryCode:{kind:'enum',values:()=>[...new Set(CITIES.map(c=>c.cc))].sort()},
|
||||
// Address space: an IPv4 prefix length the market sells, and the CGNAT ratios.
|
||||
// Address space: an IPv4 prefix length the market sells, and the CGNAT and NAT64 ratios.
|
||||
ip4Len:{kind:'enum',values:()=>Array.from({length:IP4_MAX-IP4_MIN+1},(_,i)=>IP4_MIN+i)},
|
||||
ip4Ratio:{kind:'enum',values:()=>IP4_NAT.slice()},
|
||||
ip4Ratio64:{kind:'enum',values:()=>IP4_N64.slice()},
|
||||
scnId:{table:'SCN',kind:'id'},
|
||||
// A traceroute target in the modal's own terms.
|
||||
};
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ const API_CMD={
|
|||
quote:a=>({setup:0,monthly:ip4InMo(Number(a.len)),blocked:[ip4On()?'':tr('ip4.off'),ip4On()&&ip4Full()?tr('ip4.too_many',{n:IP4_BLK}):''].filter(Boolean)}),
|
||||
doc:'Lease an IPv4 block of this prefix length by the month, at today\'s rate (fixed for the lease). Hand it back with ip4Return. Refused at 256 blocks, like ip4Buy.'},
|
||||
ip4Sell:{args:[['id','entityId']],confirm:'double',watch:['ip4'],
|
||||
doc:'Sell an owned block (not leased out) for 92% of the market price. Refused within two years of its last transfer, or when the customers signed would no longer fit with every home behind CGNAT.'},
|
||||
doc:'Sell an owned block (not leased out) for 92% of the market price. Refused within two years of its last transfer, or when the customers signed would no longer fit with every dual-stack home behind CGNAT and the IPv6-only homes in the NAT64 pool.'},
|
||||
ip4Out:{args:[['id','entityId']],watch:['ip4'],
|
||||
doc:'Lease an owned block out through a broker for a monthly income, while your own customers still fit without it.'},
|
||||
ip4Back:{args:[['id','entityId']],watch:['ip4'],
|
||||
|
|
@ -324,6 +324,13 @@ const API_CMD={
|
|||
doc:'Hand a leased-in block back, ending its monthly fee, when your customers still fit without it.'},
|
||||
ip4Nat:{args:[['v','ip4Ratio']],watch:['ip4'],
|
||||
doc:'Set how many broadband homes share one IPv4 address behind CGNAT (8, 16, 32 or 64). More frees space for business customers but more gamers ask for refunds; fewer is refused when the customers signed would not fit.'},
|
||||
ip4Nat64:{args:[['v','ip4Ratio64']],watch:['ip4'],
|
||||
doc:'Set how many IPv6-only homes share one IPv4 address in the NAT64 pool (64, 128 or 256). Their refunds are well under CGNAT\'s at the same ratio and shrink as the world moves to IPv6; fewer is refused when the customers signed would not fit.'},
|
||||
ip6Go:{args:[['city','cityId']],watch:['pops.#city'],
|
||||
quote:a=>({setup:ip6Cost(a.city),days:ip6Days(a.city),monthly:Math.round(ip6Mo(a.city,(R.rev&&R.rev.eyeballs)||0)),blocked:[ip6Why(a.city)].filter(Boolean)}),
|
||||
doc:'Take a broadband city IPv6-only (464XLAT): swap its dual-stack home routers for ones with a CLAT over the quoted days, paid day by day as they go in (setup is the whole swap; starting needs only the first day\'s share on hand, and it waits while cash is short). Those homes then need no IPv4 of their own, only a share of the NAT64 pool; new homes there get the new router too, at the swap\'s price a router, paid the day they join (even short of cash: a new home needs it). monthly is what it does to the IPv4 bill (NAT64 gateways and refunds against the CGNAT it saves; negative saves). Frees what the city panel says for new customers.'},
|
||||
ip6Stop:{args:[['city','cityId']],watch:['pops.#city'],
|
||||
doc:'Stop a city\'s swap to IPv6-only. The homes already swapped stay IPv6-only (their routers are paid for, nothing comes back); new homes come dual stack again. ip6Go resumes it for the rest.'},
|
||||
/* ---------- security, China, incidents ---------- */
|
||||
buildScrub:{args:[['city','cityId'],['tier','scrubTier',false]],watch:['scrubs'],
|
||||
quote:a=>{const T=SCRUB_TIERS[a.tier||0];return {setup:T?T.cost:undefined,monthly:T?T.mo:undefined};},
|
||||
|
|
@ -498,7 +505,7 @@ const API_CMD={
|
|||
|
||||
const API_VIEW={
|
||||
pieOpen:{args:[],doc:'Open Pie Control, the rocket company\'s panel.'},
|
||||
ip4Open:{args:[],doc:'Open the bank at its Address space section: your IPv4 blocks, who uses them, CGNAT and the transfer market.'},
|
||||
ip4Open:{args:[],doc:'Open the bank at its Address space section: your IPv4 blocks, who uses them, CGNAT, the NAT64 pool and the transfer market.'},
|
||||
ip4Pick:{args:[['v','ip4Len']],doc:'Pick the block size the Address space market quotes (a prefix length, 24 to 16).'},
|
||||
pieGovOpen:{args:[],doc:'Open the bank at its Government money section: the rocket company\'s fund auctions, the Pitcairn grant and the Ex-Im Pie Bank (it used to be Pie Control\'s Gov tab).'},
|
||||
pieTab:{args:[['t','pieTab']],doc:'Switch the Pie Control tab: traffic, co (the company, its books and the Founder\'s posts), fly (launches) or dish.'},
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ const API_STATE_DOC={
|
|||
t1v:{type:'integer',doc:'Level at which Tier 1 transit was offered.'},
|
||||
auV:{type:'integer',doc:'Australia content level gate.'},
|
||||
seen:{type:'array',doc:'Network ids the deals panel has already shown. Vestigial: written by newGame, read nowhere.'},
|
||||
pops:{type:'map',doc:'Your POPs by city id: day opened, broadband (bb), ad boost, downtime, routers, generator, second site, teleport (tele: 1 GEO dishes, 2 with MEO tracking antennas).'},
|
||||
pops:{type:'map',doc:'Your POPs by city id: day opened, broadband (bb: d, its demand in Gbps; v6, the share of its homes that are IPv6-only behind NAT64, absent for dual stack; v6e, the day a swap to IPv6-only finishes, while it runs), ad boost, downtime, routers, generator, second site, teleport (tele: 1 GEO dishes, 2 with MEO tracking antennas).'},
|
||||
links:{type:'array',doc:'Your links: waves, dark fiber (df), own cables, fabric circuits (vxc), express lightpaths (xp: via lists the dark fibers it rides from a, ch its optics) and rented satellite circuits (sat: bird, g Gbps, km of radio path, ready day), each with an entity id.'},
|
||||
transit:{type:'array',doc:'Transit ports: city, net, tier, LAG members, port history for 95th-percentile billing.'},
|
||||
ixp:{type:'map',doc:'IX ports by exchange city; tier per port (may exceed 1 with LAG members in ixn).'},
|
||||
|
|
@ -61,7 +61,7 @@ const API_STATE_DOC={
|
|||
ops:{type:'map',doc:'The NOC intern: who is hired, each standing order\'s on/off switch and settings (network work only: deals belong to the sales desk, slAuto), the monthly budget and what it spent, per-POP exceptions, the new-POP template and the weekly log.'},
|
||||
core:{type:'map',doc:'Your backbone technology: lv bought, the level it runs at, the interop lab.'},
|
||||
ddosAuto:{type:'map',doc:'The NOC\'s auto-mitigation switches: rtbh and scrub.'},
|
||||
ip4:{type:'map',doc:'IPv4 address space (rule ip4): b, the blocks, at most 256 (len: prefix length 16-24, k: rir from the registry, buy bought, in leased in; d: the day it last moved, out: leased out, mo: the monthly fee or income), nat: homes per address behind CGNAT, w: which warnings were shown. What customers use is derived from their kind and size.'},
|
||||
ip4:{type:'map',doc:'IPv4 address space (rule ip4): b, the blocks, at most 256 (len: prefix length 16-24, k: rir from the registry, buy bought, in leased in; d: the day it last moved, out: leased out, mo: the monthly fee or income), nat: homes per address behind CGNAT, n64: IPv6-only homes per address in the NAT64 pool, w: which warnings were shown. What customers use is derived from their kind and size.'},
|
||||
popStd:{type:'map',doc:'The build standard, or null for none. g router model (an RG index), rt routers, then only the targets that are set: site2, gen (true), lag (2 or 4 members), split, ix (true), pni (2 or 3 cities per network), sys (roadm, cl), opt (fast), wv (an LT index). New POPs get g, rt, site2 and gen at once; the std standing order and bstdApply bring the rest up. g and sys are also the model the routers order and the line system the optup order standardize on.'},
|
||||
mp:{type:'map',doc:'Multiplayer, only in a self-hosted copy with a session server: the session code, your player id, the AS number and seed the session gave you, its rules preset, your colour, its title and the last save number the server holds; null in every other game.'},
|
||||
demo:{type:'map',doc:'Vendor demo units on order, by "kind:id" → ready day.'},
|
||||
|
|
|
|||
|
|
@ -14,8 +14,13 @@
|
|||
so the first months fit with room for a few customers (gameplay rule F1). */
|
||||
// IP4_BLK: the most blocks a network holds; buying and leasing stop there, and a save keeps that many.
|
||||
const IP4_START=21,IP4_MIN=16,IP4_MAX=24,IP4_HOLD=730,IP4_NAT=[8,16,32,64],IP4_NAT0=16,IP4_BLK=256;
|
||||
// Public addresses per Gbps of busy-hour broadband (a home each), and the part of it CGNAT still carries: the rest is IPv6.
|
||||
const IP4_BB=10,IP4_V4=0.55,IP4_CGN=2;
|
||||
// Public addresses per Gbps of busy-hour broadband (a home each), and the part of it CGNAT still carries on day 0: the rest
|
||||
// is IPv6. The world moves on, two points a year to a floor that never goes (ip4V4).
|
||||
const IP4_BB=10,IP4_V4=0.55,IP4_V4_YR=0.02,IP4_V4_MIN=0.2,IP4_CGN=2;
|
||||
// IPv6-only homes (464XLAT, 34-ipv6-only.js) have no address of their own: their IPv4 shares a NAT64 pool, at a wider ratio
|
||||
// than CGNAT can take. Only what still needs IPv4 notices (consoles, IPv4-only VPNs): a share of the bill comes back, well
|
||||
// under CGNAT's at the same ratio, and shrinking as the world goes IPv6.
|
||||
const IP4_N64=[64,128,256],IP4_N640=128,IP4_ANNOY64={64:0.006,128:0.01,256:0.016};
|
||||
// The market: dollars per address, flat for half a year, then +3% a year on a slow four-year swing. Leases are by the
|
||||
// month (a broker keeps a cut of what yours earn), sales pay 92% of the price after the broker's fee.
|
||||
const IP4_PX=38,IP4_FREE=180,IP4_YR=0.03,IP4_IN=0.5,IP4_OUT=0.4,IP4_SELL=0.92;
|
||||
|
|
@ -30,17 +35,22 @@ const ip4Sz=len=>2**(32-len),ip4LenOk=len=>Number.isInteger(len)&&len>=IP4_MIN&&
|
|||
const ip4Cidr=n=>'/'+(32-Math.ceil(Math.log2(Math.max(1,n)))),ip4N=n=>Math.round(n).toLocaleString();
|
||||
function ip4On(){return !!S&&!!S.ip4&&rule('ip4')===true&&(S.scn?scnRule('ip4'):S.mode==='normal');}
|
||||
function ip4Need(b){const k=b&&IP4_BIZ[b.type];if(!k||!(b.bw>0))return 0;return Math.min(4096,2**Math.ceil(Math.log2(Math.max(k[1],b.bw*k[0]))));}
|
||||
/* Who uses what. T: usable addresses (owned and leased in, without what is leased out); B: business customers; H: homes;
|
||||
cg: homes behind CGNAT; over: the share of homes that do not fit even at the ratio; free: what a new customer can have
|
||||
with every home behind CGNAT. */
|
||||
function ip4Use(s=S){const I=s.ip4,r=I.nat;let own=0,inn=0,out=0,B=0,H=0;
|
||||
/* Who uses what. T: usable addresses (owned and leased in, without what is leased out); B: business customers; H: homes,
|
||||
of them H6 IPv6-only (Hd dual stack); p6: the NAT64 pool; cg: dual-stack homes behind CGNAT; over: the share of homes
|
||||
that do not fit even at the ratios; need: the least the homes can live with; free: what a new customer can have with
|
||||
every dual-stack home behind CGNAT. The NAT64 pool comes right after business customers: its homes gave their own
|
||||
addresses up already and cannot fall back on anything, while dual-stack homes still can (behind CGNAT). */
|
||||
function ip4Use(s=S){const I=s.ip4,r=I.nat,r6=I.n64||IP4_N640;let own=0,inn=0,out=0,B=0,H=0,H6=0;
|
||||
for(const b of I.b){const n=ip4Sz(b.len);if(b.k==='in')inn+=n;else if(b.out)out+=n;else own+=n;}
|
||||
for(const b of s.biz)B+=ip4Need(b);
|
||||
for(const c in s.pops){const p=s.pops[c];if(p.bb)H+=p.bb.d*IP4_BB;}
|
||||
H=Math.ceil(H);const T=own+inn,A=Math.max(0,T-B),min=Math.ceil(H/r);let cg=0,over=0;
|
||||
if(A<H){if(A>=min)cg=Math.min(H,Math.ceil((H-A)*r/(r-1)));else{cg=H;over=min?1-A/min:0;}}
|
||||
return {T,own,inn,out,B,H,cg,over,free:T-B-min,r};}
|
||||
for(const c in s.pops){const p=s.pops[c];if(p.bb){const h=p.bb.d*IP4_BB;H+=h;if(p.bb.v6)H6+=h*p.bb.v6;}}
|
||||
H=Math.ceil(H);H6=Math.min(H,Math.ceil(H6));const Hd=H-H6,T=own+inn,A=Math.max(0,T-B),p6=Math.ceil(H6/r6),min=Math.ceil(Hd/r),need=p6+min,A2=A-p6;let cg=0,over=0;
|
||||
if(A2<Hd){if(A2>=min)cg=Math.min(Hd,Math.ceil((Hd-A2)*r/(r-1)));else{cg=Hd;over=need?1-A/need:0;}}
|
||||
return {T,own,inn,out,B,H,H6,Hd,p6,cg,over,need,free:T-B-need,r,r6};}
|
||||
const ip4Fits=o=>!ip4On()||ip4Need(o)<=Math.max(0,ip4Use().free);
|
||||
// Which sharing is left to stretch when space runs out, for the advice: CGNAT (0, no IPv6-only homes), the NAT64 pool alone
|
||||
// (1, every home IPv6-only) or both (2).
|
||||
const ip4Pools=u=>!u.H6?0:u.Hd?2:1;
|
||||
// A customer renewing at bw: does the bigger block it needs fit what is free?
|
||||
const ip4GrowOk=(b,bw)=>!ip4On()||ip4Need({type:b.type,bw})-ip4Need(b)<=Math.max(0,ip4Use().free);
|
||||
const ip4Full=()=>S.ip4.b.length>=IP4_BLK;
|
||||
|
|
@ -54,11 +64,17 @@ function ip4Px(d=S.day){if(!rule('market')||d<=IP4_FREE)return IP4_PX;const y=(d
|
|||
const ip4Cost=len=>Math.round(ip4Sz(len)*ip4Px()*(1-0.015*(IP4_MAX-len))/100)*100;
|
||||
const ip4Value=len=>Math.round(ip4Cost(len)*IP4_SELL/100)*100;
|
||||
const ip4InMo=len=>Math.round(ip4Sz(len)*IP4_IN*ip4Px()/IP4_PX),ip4OutMo=len=>Math.round(ip4Sz(len)*IP4_OUT*ip4Px()/IP4_PX);
|
||||
// The month's IPv4 bill: leases in and out, CGNAT boxes, refunds (eye: what broadband earns a month).
|
||||
function ip4Bill(eye){const u=ip4Use();let lin=0,lout=0;for(const b of S.ip4.b){if(b.k==='in')lin+=b.mo||0;else if(b.out)lout+=b.mo||0;}
|
||||
const cgS=u.H?u.cg/u.H:0;return {u,lin,lout,box:u.cg/IP4_BB*IP4_V4*IP4_CGN,refund:eye*(cgS*IP4_ANNOY[u.r]+u.over*IP4_SQZ)};}
|
||||
// The IPv4 share of home traffic on day d: 55% on day 0 (so nothing changes at the start), two points less a year, never
|
||||
// under a fifth (old consoles, old VPNs, old everything).
|
||||
const ip4V4=(d=S.day)=>Math.max(IP4_V4_MIN,IP4_V4-IP4_V4_YR*Math.max(0,d)/365.2425);
|
||||
/* The month's IPv4 bill: leases in and out, CGNAT boxes and NAT64 gateways (the same price per Gbps of IPv4 they carry),
|
||||
refunds (eye: what broadband earns a month). NAT64 refunds shrink with the IPv4 share: in an IPv6-only home only what
|
||||
still needs IPv4 meets the NAT at all. s: the network as ip4Use() takes it (a city panel asks about one that might be). */
|
||||
function ip4Bill(eye,s=S){const u=ip4Use(s),v4=ip4V4();let lin=0,lout=0;for(const b of s.ip4.b){if(b.k==='in')lin+=b.mo||0;else if(b.out)lout+=b.mo||0;}
|
||||
const cgS=u.H?u.cg/u.H:0,v6S=u.H?u.H6/u.H:0;
|
||||
return {u,lin,lout,v4,box:u.cg/IP4_BB*v4*IP4_CGN,box64:u.H6/IP4_BB*v4*IP4_CGN,refund:eye*(cgS*IP4_ANNOY[u.r]+v6S*IP4_ANNOY64[u.r6]*v4/IP4_V4+u.over*IP4_SQZ)};}
|
||||
// computeMoney: only what is there, so a network with nothing to pay keeps its money rows as they were.
|
||||
function ip4Money(C,V){if(!ip4On())return;const b=ip4Bill(V.eyeballs||0),c=Math.round(b.lin+b.box+b.refund);if(c>0)C.ip4=c;if(b.lout>0)V.ip4=b.lout;}
|
||||
function ip4Money(C,V){if(!ip4On())return;const b=ip4Bill(V.eyeballs||0),c=Math.round(b.lin+b.box+b.box64+b.refund);if(c>0)C.ip4=c;if(b.lout>0)V.ip4=b.lout;}
|
||||
/* A new network gets its /21 from the RIR. An older save gets what it already uses registered to it and a quarter more to
|
||||
grow into (about a month for a big, fast-growing network), rounded up to /24s in real CIDR blocks (a /21 at the
|
||||
least), so nothing changes on load; those blocks move like any other two years on.
|
||||
|
|
@ -69,19 +85,22 @@ function ip4Grant(s){const d=s.day||0,b=[],add=len=>b.push({id:'rir'+b.length,le
|
|||
need=Math.max(ip4Sz(IP4_START),Math.ceil(need*1.25/256)*256);
|
||||
while(need>=ip4Sz(IP4_MIN)&&b.length<200){add(IP4_MIN);need-=ip4Sz(IP4_MIN);}
|
||||
for(let len=IP4_MIN+1;len<=IP4_MAX;len++)if(need>=ip4Sz(len)){add(len);need-=ip4Sz(len);}
|
||||
return {b,nat:IP4_NAT0,w:0};}
|
||||
return {b,nat:IP4_NAT0,n64:IP4_N640,w:0};}
|
||||
const ip4New=()=>ip4Grant({});
|
||||
function ip4Fix(s){const I=s.ip4&&typeof s.ip4==='object'&&!Array.isArray(s.ip4)?s.ip4:null;if(!I){s.ip4=ip4Grant(s);return;}
|
||||
const day=Math.max(0,num(s.day,0)),mo=v=>Math.round(Math.min(1e8,Math.max(0,num(v,0))));
|
||||
const b=(Array.isArray(I.b)?I.b:[]).filter(x=>x&&typeof x==='object'&&ip4LenOk(x.len)&&['rir','buy','in'].includes(x.k)).slice(0,IP4_BLK).map(x=>{
|
||||
const o={id:typeof x.id==='string'&&x.id&&x.id.length<=40?x.id:uid(),len:x.len,k:x.k,d:int(x.d,0,day,0)};
|
||||
if(x.k==='in')o.mo=mo(x.mo);else if(x.out===true){o.out=true;o.mo=mo(x.mo);}return o;});
|
||||
s.ip4={b,nat:IP4_NAT.includes(I.nat)?I.nat:IP4_NAT0,w:int(I.w,0,3,0)};}
|
||||
s.ip4={b,nat:IP4_NAT.includes(I.nat)?I.nat:IP4_NAT0,n64:IP4_N64.includes(I.n64)?I.n64:IP4_N640,w:int(I.w,0,3,0)};}
|
||||
/* Once a day: say so when homes go behind CGNAT (a percent of them at least), and when even CGNAT cannot fit them all
|
||||
(w: what was said). Each rearms only with room to spare again, so homes hovering at the limit hear it once. */
|
||||
function ip4Day(d){if(!ip4On())return;const I=S.ip4,u=ip4Use(),A=u.T-u.B,go=[{l:tr('ip4.section'),act:'ip4Open'}];
|
||||
if(u.cg>=Math.max(1,u.H*0.01)){if(!(I.w&1)){I.w|=1;toast(tr('ip4.toast_cgnat',{p:pct(u.cg/u.H)}),'',go);}}else if(A>=u.H*1.05)I.w&=~1;
|
||||
if(u.over>0){if(!(I.w&2)){I.w|=2;toast(tr('ip4.toast_out',{r:u.r}),'bad',go);sfx('err');}}else if(A>=Math.ceil(u.H/u.r)*1.1)I.w&=~2;}
|
||||
function ip4Day(d){if(!ip4On())return;ip6Day(d);const I=S.ip4,u=ip4Use(),A=u.T-u.B,go=[{l:tr('ip4.section'),act:'ip4Open'}];
|
||||
if(u.cg>=Math.max(1,u.H*0.01)){if(!(I.w&1)){I.w|=1;toast(tr('ip4.toast_cgnat',{p:pct(u.cg/u.H)}),'',go);}}else if(A-u.p6>=u.Hd*1.05)I.w&=~1;
|
||||
if(u.over>0){if(!(I.w&2)){I.w|=2;const k=ip4Pools(u);toast(k===1?tr('ip4.toast_out_v6',{r:u.r6}):k?tr('ip4.toast_out_both',{r:u.r,r6:u.r6}):tr('ip4.toast_out',{r:u.r}),'bad',go);sfx('err');}}
|
||||
else if(A>=u.need*1.1)I.w&=~2;}
|
||||
// Your customers need the addresses: what to stretch or get instead (ip4Busy, the bank's block rows).
|
||||
function ip4InUse(u=ip4Use()){const k=ip4Pools(u);return k===1?tr('ip4.in_use_v6'):k?tr('ip4.in_use_both'):tr('ip4.in_use');}
|
||||
// Renewals that wanted a bigger block than is free (clGrow, [customer, bandwidth]): they stay as they are, and hear why.
|
||||
function ip4News(l=[]){for(const [b,bw] of l.slice(0,3))toast(tr('ip4.no_grow',{name:esc(b.name),city:esc(clWhere(b)),bw:fmtG(bw)}),'',[{l:tr('ip4.section'),act:'ip4Open'}]);}
|
||||
// The line under an offer that cannot be signed for want of addresses.
|
||||
|
|
|
|||
58
src/game/60-features/34-ipv6-only.js
Normal file
58
src/game/60-features/34-ipv6-only.js
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/* ---------- IPv6-only broadband (464XLAT), city by city, next to CGNAT (33-address-space.js) ----------
|
||||
A broadband city can go IPv6-only: every home router is swapped for one with a CLAT, and the network runs NAT64/DNS64
|
||||
for whatever still needs IPv4. Those homes hold no IPv4 address of their own: their IPv4 shares the NAT64 pool at the
|
||||
player's NAT64 ratio (S.ip4.n64), which ip4Use() sets aside right after business customers. CGNAT costs nothing to
|
||||
start; this costs a home router per home, paid as each one goes in, and some days per city.
|
||||
p.bb.v6: the share of the city's homes that are IPv6-only (absent: none, dual stack, as in every older save);
|
||||
p.bb.v6e: the day the swap finishes, while it runs. Homes that join a city that is swapping or done get the new router
|
||||
from the start, at the same price (ip6Grow): a city that goes IPv6-only the day it launches pays for every home it grows
|
||||
into, as one that switches years later does. Stop halfway and the swapped ones stay, the new ones come dual stack
|
||||
again. A POP closed and rebuilt starts dual stack: its homes, and the routers they had, left with it. Rule ip4, like
|
||||
the rest of the address space. */
|
||||
// Dollars per home router; a swap takes IP6_D0 days plus one for every IP6_PER homes, IP6_DMAX at most.
|
||||
const IP6_CPE=4,IP6_D0=30,IP6_PER=200,IP6_DMAX=180;
|
||||
const ip6Pop=c=>own(S.pops,c)?S.pops[c]:null;
|
||||
// Dual-stack homes still to swap in a city.
|
||||
const ip6Homes=p=>p&&p.bb?Math.max(0,p.bb.d*IP4_BB*(1-(p.bb.v6||0))):0;
|
||||
const ip6Cost=c=>{const n=ip6Homes(ip6Pop(c));return n>0?Math.max(100,Math.round(n*IP6_CPE/100)*100):0;};
|
||||
const ip6Days=c=>Math.min(IP6_DMAX,IP6_D0+Math.ceil(ip6Homes(ip6Pop(c))/IP6_PER));
|
||||
// To start, the first day's routers on hand: the rest is paid as they go in, and the swap waits while cash is short.
|
||||
const ip6First=c=>ip6Cost(c)/Math.max(1,ip6Days(c));
|
||||
// The network as it would be with every home here IPv6-only (p: the city's POP, with broadband).
|
||||
const ip6If=(c,p)=>({ip4:S.ip4,biz:S.biz,pops:{...S.pops,[c]:{...p,bb:{...p.bb,v6:1}}}});
|
||||
// Exactly what going IPv6-only here frees for new customers: the address space counted again with every home here on it.
|
||||
function ip6Free(c){const p=ip6Pop(c);if(!p||!p.bb)return 0;return ip4Use(ip6If(c,p)).free-ip4Use().free;}
|
||||
/* And what it does to the month's IPv4 bill, counted the same way (eye: what broadband earns a month): NAT64 gateways and
|
||||
refunds against the CGNAT boxes and refunds it saves. While no home is behind CGNAT it only adds. */
|
||||
function ip6Mo(c,eye){const p=ip6Pop(c);if(!p||!p.bb)return 0;const m=b=>b.box+b.box64+b.refund;return m(ip4Bill(eye,ip6If(c,p)))-m(ip4Bill(eye));}
|
||||
// Why this city cannot start a swap now ('' when it can).
|
||||
function ip6Why(c){const p=ip6Pop(c);if(!ip4On())return tr('ip4.off');if(!p||!p.bb)return tr('ip6.no_bb');if(p.bb.v6e)return tr('ip6.busy');if(p.bb.v6>=1)return tr('ip6.already');return '';}
|
||||
// Today's routers: an even share of what is left, so the swap ends on its day however the city grows meanwhile.
|
||||
const ip6Left=(b,d)=>Math.max(1,b.v6e-d+1),ip6Slice=(b,d)=>b.d*IP4_BB*(1-(b.v6||0))/ip6Left(b,d)*IP6_CPE;
|
||||
/* Once a day (from ip4Day): every running swap does its share of the homes and pays for their routers. Short of cash,
|
||||
the crews wait a day and the end slides with them, so a swap never pushes the network into the red. */
|
||||
function ip6Day(d){if(!ip4On())return;for(const c in S.pops){const b=S.pops[c].bb;if(!b||!b.v6e)continue;
|
||||
const k=ip6Left(b,d),cost=ip6Slice(b,d);if(cost>Math.max(0,S.cash)){b.v6e++;continue;}
|
||||
S.cash-=cost;const v=b.v6||0;b.v6=k<=1?1:Math.min(1,v+(1-v)/k);
|
||||
if(k<=1){delete b.v6e;toast(tr('ip6.done',{city:esc(CITY[c].name)}),'good',[{l:tr('ip4.section'),act:'ip4Open'}]);}}}
|
||||
/* The day's new homes (d0: demand before it grew): while swapping or done each gets the new router, IP6_CPE like a swapped
|
||||
one, dual stack after a stop. The swap of old routers is a project and waits for cash; a home that signs up today
|
||||
needs its router today, so that is spent like any running cost (homes only join where the service is good, and they
|
||||
pay it back within days). */
|
||||
function ip6Grow(b,d0){if(!ip4On()||!(b.d>d0))return;const v=b.v6||0;
|
||||
if(b.v6e||v>=1){S.cash-=(b.d-d0)*IP4_BB*IP6_CPE;if(v<1)b.v6=1-(1-v)*d0/b.d;}else if(v>0)b.v6=v*d0/b.d;}
|
||||
// Saves: v6 is a share (none at all is no field, so a dual-stack city saves as it always did); v6e a day, gone once done.
|
||||
function ip6Fix(b,day){if(b.v6!==undefined){const v=num(b.v6,0);if(v>0)b.v6=Math.min(1,v);else delete b.v6;}
|
||||
if(b.v6e!==undefined){if(b.v6>=1||!Number.isFinite(b.v6e))delete b.v6e;else b.v6e=int(b.v6e,day,day+3650,day);}}
|
||||
// The city panel's Home broadband: where the city stands, and the swap to start or stop.
|
||||
function ip6Html(c){if(!ip4On())return '';const p=ip6Pop(c),b=p&&p.bb;if(!b)return '';const v=b.v6||0,r=S.ip4.n64||IP4_N640;
|
||||
let h=`<div style="margin-top:8px"><div class="kv"><span>${tr('ip6.title')}</span><b>${v>=1?tr('ip6.every_home'):v>0||b.v6e?tr('ip6.share_homes',{p:pct(v)}):tr('ip6.dual_stack')}</b></div>`;
|
||||
if(b.v6e){const wait=ip6Slice(b,S.day+1)>Math.max(0,S.cash);
|
||||
h+=`<div class="bar me"><i style="width:${Math.min(100,v*100)}%"></i></div><p class="note">${tr('ip6.swapping_home_routers_paid',{cost:fmt$(IP6_CPE),date:dateStr(b.v6e)})}</p>${wait?`<p class="why">${tr('ip6.waiting')}</p>`:''}<div class="btns">${btn(tr('ip6.stop'),'ip6Stop',{city:c},'ghost sm')}</div>`;}
|
||||
else if(v>=1)h+=`<p class="note">${tr('ip6.new_homes_get_a_clat',{cost:fmt$(IP6_CPE),r})}</p>`;
|
||||
else{const n=Math.ceil(ip6Homes(p)),cost=ip6Cost(c),f=Math.max(0,ip6Free(c)),mo=Math.round(ip6Mo(c,(R.rev&&R.rev.eyeballs)||0));
|
||||
// Before the player commits: what the month costs after it too, and that it buys nothing yet while IPv4 still fits.
|
||||
const bill=mo>0?tr('ip6.your_ipv4_bill_goes_up',{price:fmt$(mo)})+(ip4Use().cg?'':' '+tr('ip6.no_home_is_behind_cgnat')):mo<0?tr('ip6.your_ipv4_bill_goes_down',{price:fmt$(-mo)}):'';
|
||||
h+=`<p class="note">${v>0?tr('ip6.part_note',{p:pct(v)}):tr('ip6.pitch',{r})} ${tr('ip6.what',{routers:trn('ip6.n_routers',n,{n:ip4N(n)}),days:ip6Days(c),addr:trn('ip4.n_addresses',f,{n:ip4N(f)})})} ${tr('ip6.homes_that_join_later',{cost:fmt$(IP6_CPE)})}${bill?' '+bill:''}</p>
|
||||
<div class="btns">${btn(tr('ip6.go',{cost:fmt$(cost)}),'ip6Go',{city:c},'sm',S.cash<ip6First(c))}</div>`;}
|
||||
return h+'</div>';}
|
||||
|
|
@ -17,7 +17,7 @@ function sanitize(s){
|
|||
{const m=s.monkey&&typeof s.monkey==='object'&&!Array.isArray(s.monkey)?s.monkey:{},on=m.on?1:0,o={next:m.next==null?null:int(m.next,0,1e7,s.day+90),on};
|
||||
if(on){o.start=int(m.start,0,s.day,s.day);o.until=int(m.until,o.start,o.start+400,s.day+30);o.snip=int(m.snip,0,1e7,s.day+3);o.n=int(m.n,0,1e4,0);o.hurt=int(m.hurt,0,o.n,0);o.c=isCity(m.c)?m.c:isCity(s.home)?s.home:null;}
|
||||
s.monkey=o;}
|
||||
for(const c of Object.keys(s.pops)){const p=s.pops[c];if(!isCity(c)||!p||typeof p!=='object'){delete s.pops[c];continue;}p.routers=int(p.routers,1,RMAX,1);if(p.rupDay!==undefined)p.rupDay=num(p.rupDay,-1);if(p.rgen!==undefined)p.rgen=int(p.rgen,0,RG.length-1,0);p.down=num(p.down,0);if(p.bb&&typeof p.bb==='object')p.bb.d=num(p.bb.d,0);else p.bb=null;}
|
||||
for(const c of Object.keys(s.pops)){const p=s.pops[c];if(!isCity(c)||!p||typeof p!=='object'){delete s.pops[c];continue;}p.routers=int(p.routers,1,RMAX,1);if(p.rupDay!==undefined)p.rupDay=num(p.rupDay,-1);if(p.rgen!==undefined)p.rgen=int(p.rgen,0,RG.length-1,0);p.down=num(p.down,0);if(p.bb&&typeof p.bb==='object'){p.bb.d=num(p.bb.d,0);ip6Fix(p.bb,s.day);}else p.bb=null;}
|
||||
if(!isCity(s.home))s.home=Object.keys(s.pops)[0]||'fra';
|
||||
opsSanitize(s);
|
||||
const tier=v=>int(v,0,PORT.length-1,0),lag=v=>int(v,1,LAG_MAX,1),sid=v=>String(v==null?uid():v).slice(0,40);
|
||||
|
|
|
|||
|
|
@ -49,9 +49,10 @@ function* dayPreRun(){
|
|||
toast(where?tr('day_tick.resolved_what_where_is_back_to',{what:incTitle(i.type),where:esc(where)}):tr('day_tick.resolved_what',{what:incTitle(i.type)}),'good',[],o);}
|
||||
yield DAY_REST;
|
||||
// eyeball growth / churn uses last computed service
|
||||
for(const c in S.pops){const p=S.pops[c];if(!p.bb)continue;const sf=sfOf(R,c)*((R.bbF&&R.bbF[c])??1),P=eyeP(c);
|
||||
for(const c in S.pops){const p=S.pops[c];if(!p.bb)continue;const sf=sfOf(R,c)*((R.bbF&&R.bbF[c])??1),P=eyeP(c),d0=p.bb.d;
|
||||
if(sf>=0.9){const g=(CITY[c].be&&!(p.boost>d)?0.35:1)*0.025*(scnRule('boom')?1.5:1)*(p.boost>d?2:1)*sf*(0.7+0.6*(R.peerShare||0))*(CITY[c].reg==='AS'&&!CITY[c].cn?1.6:1);p.bb.d+=g*p.bb.d*(1-p.bb.d/P);}
|
||||
else p.bb.d=Math.max(Math.min(3,P),p.bb.d*(1-(0.9-sf)*0.04));}
|
||||
else p.bb.d=Math.max(Math.min(3,P),p.bb.d*(1-(0.9-sf)*0.04));
|
||||
if(p.bb.v6||p.bb.v6e)ip6Grow(p.bb,d0);}
|
||||
return d;}
|
||||
function* dayPost(d){
|
||||
yield* ddosNewsRun();ddosTrack();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Object.assign(ACT,{
|
|||
if(!w&&!p){toast(tr('customers.nothing_spare_to_sell_on_this'),'bad');sfx('err');return;}const L=l.list||(l.list={w:0,p:0});L.w+=w;L.p+=p;
|
||||
toast(tr('broker.listed',{a:CITY[l.a].name,b:CITY[l.b].name}),'good');sfx('click');after();},
|
||||
unlistFiber:({id})=>{const l=S.links.find(x=>x.id===id);if(!l||!l.list)return;delete l.list;sfx('click');after();},
|
||||
accept:({id,auto=false})=>{const o=S.offers.find(x=>x.id===id);if(!o)return;if(!ip4Fits(o)){const n=ip4Need(o);toast(tr('ip4.no_space',{name:esc(o.name),p:ip4Cidr(n),n:ip4N(n),free:ip4N(Math.max(0,ip4Use().free))}),'bad',[{l:tr('ip4.section'),act:'ip4Open'}]);sfx('err');return;}const customer=auto?autoOffer(o):offerCustomer(o);if(!customer)return;if(!bHas(o)){toast(tr('customers.you_need_a_pop_in_every'),'bad');return;}
|
||||
accept:({id,auto=false})=>{const o=S.offers.find(x=>x.id===id);if(!o)return;if(!ip4Fits(o)){const n=ip4Need(o),u=ip4Use(),k=ip4Pools(u),v={name:esc(o.name),p:ip4Cidr(n),n:ip4N(n),free:ip4N(Math.max(0,u.free))};toast(k===1?tr('ip4.no_space_v6',v):k?tr('ip4.no_space_both',v):tr('ip4.no_space',v),'bad',[{l:tr('ip4.section'),act:'ip4Open'}]);sfx('err');return;}const customer=auto?autoOffer(o):offerCustomer(o);if(!customer)return;if(!bHas(o)){toast(tr('customers.you_need_a_pop_in_every'),'bad');return;}
|
||||
if(o.type==='wwave'){const l=S.links.find(x=>x.id===o.link);if(!l||chMax(l)-(l.ch||[]).length-soldSlots(l)-xpSlots(l)<o.slots){toast(tr('customers.not_enough_free_channels_on_that'),'bad');return;}}
|
||||
if(BIZ_T[o.type].event&&S.day>=o.start){toast(tr('customers.too_late_the_event_has_already'),'bad');return;}
|
||||
// A carrier renting more alien waves on a fiber it already rents grows its contract, like a real order for extra waves,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
/* Address space (#150, 33-address-space.js): buy, lease in, lease out, sell, hand back, and the CGNAT ratio. Every block
|
||||
change keeps room for the customers already signed, with every home behind CGNAT. */
|
||||
/* Address space (#150, 33-address-space.js): buy, lease in, lease out, sell, hand back, and the CGNAT and NAT64 ratios.
|
||||
Every block change keeps room for the customers already signed, with every dual-stack home behind CGNAT. */
|
||||
const ip4Re=()=>{after();renderBank();};
|
||||
function ip4Can(){if(ip4On())return true;toast(tr('ip4.off'),'bad');sfx('err');return false;}
|
||||
const ip4Blk=id=>S.ip4.b.find(b=>b.id===id);
|
||||
function ip4Busy(){toast(tr('ip4.in_use'),'bad');sfx('err');}
|
||||
function ip4Busy(){toast(ip4InUse(),'bad');sfx('err');}
|
||||
// No more blocks than a save keeps (IP4_BLK): a new one is refused with the way out.
|
||||
function ip4Room(){if(!ip4Full())return true;toast(tr('ip4.too_many',{n:IP4_BLK}),'bad');sfx('err');return false;}
|
||||
Object.assign(ACT,{
|
||||
|
|
@ -25,5 +25,8 @@ Object.assign(ACT,{
|
|||
S.ip4.b=S.ip4.b.filter(x=>x!==b);sfx('click');ip4Re();},
|
||||
// Fewer homes per address needs more addresses: refused when the customers already signed would not fit.
|
||||
ip4Nat:({v})=>{if(!ip4Can())return;const r=Number(v);if(!IP4_NAT.includes(r)||r===S.ip4.nat)return;const u=ip4Use();
|
||||
if(r<S.ip4.nat&&u.T-u.B<Math.ceil(u.H/r)){ip4Busy();UI._bh=null;renderBank();return;}S.ip4.nat=r;sfx('click');ip4Re();},
|
||||
if(r<S.ip4.nat&&u.T-u.B<u.p6+Math.ceil(u.Hd/r)){ip4Busy();UI._bh=null;renderBank();return;}S.ip4.nat=r;sfx('click');ip4Re();},
|
||||
// The same for the NAT64 pool of the IPv6-only homes (34-ipv6-only.js).
|
||||
ip4Nat64:({v})=>{if(!ip4Can())return;const r=Number(v);if(!IP4_N64.includes(r)||r===S.ip4.n64)return;const u=ip4Use();
|
||||
if(r<S.ip4.n64&&u.T-u.B<Math.ceil(u.H6/r)+Math.ceil(u.Hd/u.r)){ip4Busy();UI._bh=null;renderBank();return;}S.ip4.n64=r;sfx('click');ip4Re();},
|
||||
});
|
||||
|
|
|
|||
9
src/game/90-actions/55-ipv6-only.js
Normal file
9
src/game/90-actions/55-ipv6-only.js
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/* IPv6-only broadband (34-ipv6-only.js): start a city's home-router swap, or stop it. The routers are paid for as they go
|
||||
in, so a stop owes nothing and gives nothing back. */
|
||||
Object.assign(ACT,{
|
||||
ip6Go:({city})=>{if(!ip4Can())return;const why=ip6Why(city);if(why){toast(why,'bad');sfx('err');return;}const p=ip6Pop(city);
|
||||
if(S.cash<ip6First(city)){toast(tr('interface.not_enough_cash_wait_for_revenue'),'bad');sfx('err');return;}const n=Math.ceil(ip6Homes(p)),days=ip6Days(city);
|
||||
p.bb.v6e=S.day+days;sfx('build');toast(tr('ip6.started',{city:esc(CITY[city].name),routers:trn('ip6.n_routers',n,{n:ip4N(n)}),days}),'good');after();},
|
||||
ip6Stop:({city})=>{if(!ip4Can())return;const p=ip6Pop(city);if(!p||!p.bb||!p.bb.v6e)return;delete p.bb.v6e;sfx('click');
|
||||
toast(tr('ip6.stopped',{city:esc(CITY[city].name),p:pct(p.bb.v6||0)}),'');after();},
|
||||
});
|
||||
|
|
@ -33,7 +33,7 @@ function cityPanel(c){
|
|||
<div class="kv"><span>${tr('common.revenue')}</span><b>${tr('common.price_mo',{price:fmt$(eye*sf*EYE_RATE*arpuOf(c))})}</b></div>
|
||||
<div class="kv"><span>${tr('city_panel.network_wide_peering_ratio')}</span><b>${pct(R.peerShare||0)}</b></div><p class="note">${tr('city_panel.more_traffic_over_peering_pnis_and')}</p>
|
||||
${sf<0.9?`<p class="why">${tr('city_panel.customers_are_unhappy_and_leaving')}</p>`:''}
|
||||
<div class="btns">${p.boost>S.day?`<span class="tag st on">${tr('city_panel.ad_campaign_n_d_left',{n:p.boost-S.day})}</span>`:btn(tr('city_panel.run_ad_campaign_8k_2_growth'),'ad',{city:c},'',S.cash<8000)}</div>`;}
|
||||
<div class="btns">${p.boost>S.day?`<span class="tag st on">${tr('city_panel.ad_campaign_n_d_left',{n:p.boost-S.day})}</span>`:btn(tr('city_panel.run_ad_campaign_8k_2_growth'),'ad',{city:c},'',S.cash<8000)}</div>${ip6Html(c)}`;}
|
||||
h+=`</section><section><h3>${tr('common.business_customers')}</h3>`;
|
||||
const bz=S.biz.filter(b=>bCities(b).includes(c));
|
||||
if(!bz.length)h+=`<p class="empty">${tr('city_panel.no_businesses_yet_offers_pop_up')}</p>`;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ function renderDash(){checkLayer();
|
|||
<div class="dgrid">${tile(tr('common.traffic_now'),fmtG(R.served),tr('dashboard.of_g_wanted',{g:fmtG(R.demand)}))}${tile(tr('common.peak'),fmtG(S.stats.peak))}${tile(tr('dashboard.delivered_30_days'),(up*100).toFixed(1)+'%',up>=0.999?tr('dashboard.five_nines_ish'):up>=0.99?tr('dashboard.two_nines_and_change'):tr('dashboard.customers_are_upset'))}${tile(tr('common.peering_ratio'),pct(R.peerShare||0),tr('dashboard.caches_pnis_and_ix'))}${tile(tr('dashboard.monthly_p_l'),`<span style="color:${net>=0?'var(--eye)':'var(--bad)'}">${net>=0?'+':''}${fmt$(net)}</span>`,tr('dashboard.in_in_out_out',{in:fmt$(R.revMo),out:fmt$(R.costMo)}))}${tile(tr('common.incidents'),S.stats.incidents,tr('dashboard.n_shrugged_off',{n:S.stats.survived}))}</div>
|
||||
<div class="dcols"><div class="panel2"><h3>${tr('dashboard.traffic_by_way_out')}</h3>${svgChart(rows,['c','p','ix','t','l2'],[{k:'dem',col:'var(--text)',dash:true}],v=>fmtCap(Math.round(v)),'traffic')}${chartLegend('traffic',k=>k==='dem'?'':' '+pct((R.egT[k]||0)/tot))}</div>
|
||||
<div class="panel2"><h3>${tr('dashboard.money_per_month')}</h3>${svgChart(rows,[],[{k:'rev',col:'#16A866'},{k:'cost',col:'#FF4D5E'}],v=>fmt$(v),'money')}${chartLegend('money')}
|
||||
<h3 style="margin-top:8px">${tr('dashboard.where_the_money_goes')}</h3>${Object.entries(R.cost).filter(([k,v])=>v>0).sort((a,b)=>b[1]-a[1]).map(([k,v])=>`<div class="kv"><span>${{pops:tr('dashboard.pops_and_routers'),links:tr('dashboard.waves_and_fiber'),transit:tr('common.transit'),ix:tr('common.ix_ports'),pni:tr('common.pnis'),caches:tr('common.cache_power'),nni:tr('common.fabric_ports'),optical:tr('dashboard.amp_huts_and_spares'),loans:tr('common.loan_repayments'),revshare:tr('dashboard.investor_revenue_share'),extras:tr('dashboard.licenses_and_scrubbing'),wholesale:tr('dashboard.nearly_broadband_network_wholesale'),levy:tr('dashboard.regional_broadband_levy'),pie:tr('pie.costs_row'),ip4:tr('ip4.costs_row'),sat:tr('satellites.costs_row')}[k]||k}</span><b>${tr('common.price_mo',{price:fmt$(v)})}</b></div>`).join('')}</div></div>`;
|
||||
<h3 style="margin-top:8px">${tr('dashboard.where_the_money_goes')}</h3>${Object.entries(R.cost).filter(([k,v])=>v>0).sort((a,b)=>b[1]-a[1]).map(([k,v])=>`<div class="kv"><span>${{pops:tr('dashboard.pops_and_routers'),links:tr('dashboard.waves_and_fiber'),transit:tr('common.transit'),ix:tr('common.ix_ports'),pni:tr('common.pnis'),caches:tr('common.cache_power'),nni:tr('common.fabric_ports'),optical:tr('dashboard.amp_huts_and_spares'),loans:tr('common.loan_repayments'),revshare:tr('dashboard.investor_revenue_share'),extras:tr('dashboard.licenses_and_scrubbing'),wholesale:tr('dashboard.nearly_broadband_network_wholesale'),levy:tr('dashboard.regional_broadband_levy'),pie:tr('pie.costs_row'),ip4:tr('ip4.leases_cgnat_nat64'),sat:tr('satellites.costs_row')}[k]||k}</span><b>${tr('common.price_mo',{price:fmt$(v)})}</b></div>`).join('')}</div></div>`;
|
||||
const tT=(R.egT.t||0)||1;
|
||||
const offMix=(UI.chartOff&&UI.chartOff.mix)||{},filt=Object.keys(offMix).length>0;
|
||||
// The legend above the table picks which ways in count; "lost" still looks at everything the network gets.
|
||||
|
|
|
|||
|
|
@ -1,21 +1,29 @@
|
|||
/* The bank's Address space section (#150, 33-address-space.js): what you hold and who uses it, the CGNAT ratio, your
|
||||
blocks, and the transfer market. Phones: the boxes are full width, the dropdowns stack and every button row wraps. */
|
||||
/* The bank's Address space section (#150, 33-address-space.js): what you hold and who uses it (homes in three groups once
|
||||
some are IPv6-only), the CGNAT and NAT64 ratios, your blocks, and the transfer market. Phones: the boxes are full
|
||||
width, the dropdowns stack and every button row wraps. */
|
||||
const ip4Pc=x=>(x*100).toFixed(1).replace(/\.0$/,'')+'%';
|
||||
function ip4Bank(){if(!S||!ip4On())return '';const I=S.ip4,B=ip4Bill((R.rev&&R.rev.eyeballs)||0),u=B.u,len=ip4LenOk(UI.ip4Len)?UI.ip4Len:IP4_MAX,px=ip4Px(),full=ip4Full();
|
||||
const kv=(l,v,bad)=>`<div class="kv"><span>${l}</span><b${bad?' style="color:var(--bad)"':''}>${v}</b></div>`,mo=v=>tr('common.price_mo',{price:fmt$(v)});
|
||||
let h=`<section class="bank-gov bank-ip4"><h3 id="bankIp4" style="font-size:18px;margin-top:14px">🔢 ${tr('ip4.section')}</h3><p class="meta">${tr('ip4.note')}</p>`;
|
||||
h+=`<div class="ops-o">${kv(tr('ip4.yours'),ip4N(u.T))}${kv(tr('ip4.business'),ip4N(u.B))}${kv(tr('ip4.homes'),u.cg?tr('ip4.homes_cgnat',{n:ip4N(u.H),p:pct(u.cg/u.H)}):ip4N(u.H))}${kv(tr('ip4.free'),ip4N(Math.max(0,u.free)),u.free<=0)}`;
|
||||
if(u.over>0)h+=`<div class="why">${tr('ip4.squeezed',{p:pct(u.over),r:u.r})}</div>`;
|
||||
if(B.lin>0)h+=kv(tr('ip4.leases_in'),mo(B.lin));if(B.box>=1)h+=kv(tr('ip4.cgnat_boxes'),mo(B.box));if(B.refund>=1)h+=kv(tr('ip4.refunds'),mo(B.refund));if(B.lout>0)h+=kv(tr('ip4.leases_out'),'+'+mo(B.lout));
|
||||
h+=`<div class="ops-o">${kv(tr('ip4.yours'),ip4N(u.T))}${kv(tr('ip4.business'),ip4N(u.B))}`;
|
||||
// Public, behind CGNAT, IPv6-only: the three groups once there is a third.
|
||||
h+=u.H6>0?kv(tr('ip4.homes'),ip4N(u.H))+kv(tr('ip4.homes_public'),ip4N(u.H-u.H6-u.cg))+kv(tr('ip4.homes_behind_cgnat'),ip4N(u.cg))+kv(tr('ip4.homes_v6'),tr('ip4.homes_v6_pool',{n:ip4N(u.H6),pool:ip4N(u.p6)}))
|
||||
:kv(tr('ip4.homes'),u.cg?tr('ip4.homes_cgnat',{n:ip4N(u.H),p:pct(u.cg/u.H)}):ip4N(u.H));
|
||||
h+=kv(tr('ip4.free'),ip4N(Math.max(0,u.free)),u.free<=0);
|
||||
if(u.over>0){const k=ip4Pools(u);h+=`<div class="why">${k===1?tr('ip4.squeezed_v6',{p:pct(u.over),r:u.r6}):k?tr('ip4.squeezed_both',{p:pct(u.over),r:u.r,r6:u.r6}):tr('ip4.squeezed',{p:pct(u.over),r:u.r})}</div>`;}
|
||||
if(B.lin>0)h+=kv(tr('ip4.leases_in'),mo(B.lin));if(B.box>=1)h+=kv(tr('ip4.cgnat_boxes'),mo(B.box));if(B.box64>=1)h+=kv(tr('ip4.nat64_gateways'),mo(B.box64));if(B.refund>=1)h+=kv(tr('ip4.refunds'),mo(B.refund));if(B.lout>0)h+=kv(tr('ip4.leases_out'),'+'+mo(B.lout));
|
||||
h+=kv(tr('ip4.v6_share'),pct(1-B.v4));
|
||||
h+=`<label class="ops-sel" style="margin-top:6px"><span>${tr('ip4.cgnat_ratio')}</span><select data-chg="ip4Nat">${IP4_NAT.map(r=>`<option value="${r}"${r===I.nat?' selected':''}>${trn('ip4.n_homes_per_address',r)}</option>`).join('')}</select></label>
|
||||
<p class="meta">${tr('ip4.cgnat_note',{p:ip4Pc(IP4_ANNOY[I.nat])})}</p></div>`;
|
||||
h+=`<div class="ops-o"><div class="nm">${tr('ip4.blocks')}</div>`;
|
||||
<p class="meta">${tr('ip4.cgnat_note',{p:ip4Pc(IP4_ANNOY[I.nat])})}</p>
|
||||
<label class="ops-sel" style="margin-top:6px"><span>${tr('ip4.nat64_ratio')}</span><select data-chg="ip4Nat64">${IP4_N64.map(r=>`<option value="${r}"${r===u.r6?' selected':''}>${trn('ip4.n_homes_per_address',r)}</option>`).join('')}</select></label>
|
||||
<p class="meta">${tr('ip4.nat64_note',{p:ip4Pc(IP4_ANNOY64[u.r6]*B.v4/IP4_V4)})}</p></div>`;
|
||||
h+=`<div class="ops-o"><div class="nm">${tr('ip4.blocks')}</div>`;const inUse=ip4InUse(u);
|
||||
for(const b of I.b){const n=ip4Sz(b.len),spare=u.free>=n,held=ip4Held(b),sure=UI.confirm===b.id;
|
||||
const what=b.k==='in'?tr('ip4.leased_in_mo',{price:fmt$(b.mo||0)}):b.out?tr('ip4.leased_out_mo',{price:fmt$(b.mo||0)}):b.k==='buy'?tr('ip4.bought_on',{date:dateStr(b.d)}):tr('ip4.from_rir');
|
||||
const btns=b.k==='in'?btn(tr('ip4.give_back'),'ip4Return',{id:b.id},'ghost sm',!spare):b.out?btn(tr('ip4.take_back'),'ip4Back',{id:b.id},'ghost sm')
|
||||
:btn(tr('ip4.lease_out',{price:fmt$(ip4OutMo(b.len))}),'ip4Out',{id:b.id},'sm',!spare)+btn(sure?tr('ip4.really_sell',{price:fmt$(ip4Value(b.len))}):tr('ip4.sell',{price:fmt$(ip4Value(b.len))}),'ip4Sell',{id:b.id},sure?'red sm':'ghost sm',held||!spare);
|
||||
// Greyed for want of room: say so (a disabled button never gets to show ip4Busy's toast).
|
||||
h+=`<div class="row"><div class="grow"><div class="nm">/${b.len} · ${trn('ip4.n_addresses',n,{n:ip4N(n)})}</div><div class="meta">${what}${held&&!b.out?' · '+tr('ip4.movable_from',{date:dateStr(b.d+IP4_HOLD)}):''}</div>${!spare&&!b.out?`<div class="why">${tr('ip4.in_use')}</div>`:''}<div class="btns">${btns}</div></div></div>`;}
|
||||
h+=`<div class="row"><div class="grow"><div class="nm">/${b.len} · ${trn('ip4.n_addresses',n,{n:ip4N(n)})}</div><div class="meta">${what}${held&&!b.out?' · '+tr('ip4.movable_from',{date:dateStr(b.d+IP4_HOLD)}):''}</div>${!spare&&!b.out?`<div class="why">${inUse}</div>`:''}<div class="btns">${btns}</div></div></div>`;}
|
||||
h+=`</div><div class="ops-o"><div class="nm">${tr('ip4.market')}</div><p class="meta">${tr('ip4.market_note',{px:fmt$(px),lin:'$'+(IP4_IN*px/IP4_PX).toFixed(2),lout:'$'+(IP4_OUT*px/IP4_PX).toFixed(2),p:pct(IP4_SELL)})}</p>
|
||||
<label class="ops-sel"><span>${tr('ip4.block_size')}</span><select data-chg="ip4Pick">${Array.from({length:IP4_MAX-IP4_MIN+1},(_,i)=>IP4_MAX-i).map(l=>`<option value="${l}"${l===len?' selected':''}>/${l} · ${trn('ip4.n_addresses',ip4Sz(l),{n:ip4N(ip4Sz(l))})}</option>`).join('')}</select></label>
|
||||
${full?`<div class="why">${tr('ip4.too_many',{n:IP4_BLK})}</div>`:''}<div class="btns">${btn(tr('ip4.buy',{price:fmt$(ip4Cost(len))}),'ip4Buy',{len},'pink sm',full||S.cash<ip4Cost(len))}${btn(tr('ip4.lease',{price:fmt$(ip4InMo(len))}),'ip4Lease',{len},'sm',full)}</div></div></section>`;
|
||||
|
|
|
|||
|
|
@ -2692,20 +2692,26 @@
|
|||
"ip4.cgnat_boxes":"CGNAT boxes",
|
||||
"ip4.cgnat_note":"More homes per address frees space for customers, but games and port forwarding suffer: {p} of a CGNAT home's bill comes back as refunds.",
|
||||
"ip4.cgnat_ratio":"CGNAT: homes sharing one address",
|
||||
"ip4.costs_row":"IPv4 leases and CGNAT",
|
||||
"ip4.free":"Free for new customers (homes move behind CGNAT first)",
|
||||
"ip4.from_rir":"From the RIR",
|
||||
"ip4.give_back":"Give it back",
|
||||
"ip4.held":"The RIR won't transfer that block again before {date}.",
|
||||
"ip4.homes":"Broadband homes",
|
||||
"ip4.homes_behind_cgnat":"Homes behind CGNAT",
|
||||
"ip4.homes_cgnat":"{n}, {p} behind CGNAT",
|
||||
"ip4.homes_public":"Homes with their own address",
|
||||
"ip4.homes_v6":"IPv6-only homes (464XLAT)",
|
||||
"ip4.homes_v6_pool":"{n}, NAT64 pool {pool}",
|
||||
"ip4.in_use":"Your customers need those addresses: put more homes behind CGNAT or get another block first.",
|
||||
"ip4.in_use_both":"Your customers need those addresses: put more homes on each CGNAT or NAT64 address or get another block first.",
|
||||
"ip4.in_use_v6":"Your customers need those addresses: put more IPv6-only homes on each NAT64 address or get another block first.",
|
||||
"ip4.lease":"Lease {price}/mo",
|
||||
"ip4.lease_out":"Lease out +{price}/mo",
|
||||
"ip4.leased_in":"Leased a {p} ({n} addresses) for {price}/mo.",
|
||||
"ip4.leased_in_mo":"Leased in · {price}/mo",
|
||||
"ip4.leased_out":"Your {p} is leased out: +{price}/mo.",
|
||||
"ip4.leased_out_mo":"Leased out · +{price}/mo",
|
||||
"ip4.leases_cgnat_nat64":"IPv4 leases, CGNAT and NAT64",
|
||||
"ip4.leases_in":"Blocks leased in",
|
||||
"ip4.leases_out":"Blocks leased out",
|
||||
"ip4.market":"Transfer market",
|
||||
|
|
@ -2713,8 +2719,13 @@
|
|||
"ip4.movable_from":"can move again from {date}",
|
||||
"ip4.n_addresses":{"one":"{n} address","other":"{n} addresses"},
|
||||
"ip4.n_homes_per_address":{"one":"{n} home per address","other":"{n} homes per address"},
|
||||
"ip4.nat64_gateways":"NAT64 gateways",
|
||||
"ip4.nat64_note":"IPv6-only homes have no IPv4 of their own: what still needs it (consoles, IPv4-only VPNs) shares your NAT64 pool, and {p} of their bill comes back as refunds, less each year as the world moves to IPv6. A city goes IPv6-only from its Home broadband.",
|
||||
"ip4.nat64_ratio":"NAT64: IPv6-only homes sharing one address",
|
||||
"ip4.no_grow":"{name} ({city}) wanted to grow to {bw}, but you had no IPv4 addresses free for it.",
|
||||
"ip4.no_space":"{name} needs a {p} of IPv4 ({n} addresses), and only {free} are free. Buy or lease a block, or put more homes behind CGNAT.",
|
||||
"ip4.no_space_both":"{name} needs a {p} of IPv4 ({n} addresses), and only {free} are free. Buy or lease a block, or put more homes on each CGNAT or NAT64 address.",
|
||||
"ip4.no_space_v6":"{name} needs a {p} of IPv4 ({n} addresses), and only {free} are free. Buy or lease a block, or put more IPv6-only homes on each NAT64 address.",
|
||||
"ip4.note":"IPv6 is free and endless. IPv4 ran out years ago: business customers need public blocks of it, and homes that don't fit share addresses behind CGNAT (IPv6 traffic goes around the box).",
|
||||
"ip4.off":"IPv4 is plentiful under this game's rules.",
|
||||
"ip4.offer_needs":"Needs a {p} of IPv4 ({n} addresses); only {free} free.",
|
||||
|
|
@ -2726,11 +2737,39 @@
|
|||
"ip4.sell":"Sell {price}",
|
||||
"ip4.sold":"Sold your {p} for {price}.",
|
||||
"ip4.squeezed":"Out of space: {p} of homes don't fit even at {r} homes per address. Their connections break and they want refunds: buy or lease a block.",
|
||||
"ip4.squeezed_both":"Out of space: {p} of homes don't fit even at {r} homes per CGNAT address and {r6} per NAT64 address. Their connections break and they want refunds: buy or lease a block.",
|
||||
"ip4.squeezed_v6":"Out of space: {p} of homes don't fit even at {r} IPv6-only homes per NAT64 address. Their connections break and they want refunds: buy or lease a block.",
|
||||
"ip4.take_back":"Take it back",
|
||||
"ip4.toast_cgnat":"<b>Your IPv4 is full.</b> {p} of your homes now share addresses behind CGNAT, and a few gamers have already written in.",
|
||||
"ip4.toast_out":"<b>Out of IPv4.</b> Even at {r} homes per address, CGNAT can't fit everyone: buy or lease a block at the bank.",
|
||||
"ip4.toast_out_both":"<b>Out of IPv4.</b> Even at {r} homes per address behind CGNAT and {r6} on NAT64, not every home fits: buy or lease a block at the bank.",
|
||||
"ip4.toast_out_v6":"<b>Out of IPv4.</b> Even at {r} homes per address, your NAT64 pool can't fit every IPv6-only home: buy or lease a block at the bank.",
|
||||
"ip4.too_many":"You hold {n} IPv4 blocks, the most one network can keep track of. Sell or give back small ones to make room for a bigger block.",
|
||||
"ip4.v6_share":"IPv6 share of home traffic this year",
|
||||
"ip4.yours":"Your IPv4 addresses",
|
||||
"ip6.already":"Every home here is IPv6-only already.",
|
||||
"ip6.busy":"The swap here is already under way.",
|
||||
"ip6.done":"<b>{city} is IPv6-only.</b> Every home there runs 464XLAT, and what still needs IPv4 shares your NAT64 pool.",
|
||||
"ip6.dual_stack":"Dual stack",
|
||||
"ip6.every_home":"Every home",
|
||||
"ip6.go":"Go IPv6-only {cost}",
|
||||
"ip6.homes_that_join_later":"Homes that join later get one too, at {cost} each.",
|
||||
"ip6.n_routers":{"one":"{n} home router","other":"{n} home routers"},
|
||||
"ip6.new_homes_get_a_clat":"New homes get a CLAT router from the start, at {cost} each, and what still needs IPv4 shares your NAT64 pool, {r} homes per address.",
|
||||
"ip6.no_bb":"Launch broadband here first.",
|
||||
"ip6.no_home_is_behind_cgnat":"No home is behind CGNAT yet: this pays off once your IPv4 runs short.",
|
||||
"ip6.part_note":"The swap stopped at {p} of homes, and new homes come dual stack again.",
|
||||
"ip6.pitch":"Swap the home routers here for ones with a CLAT: the homes run on IPv6 alone and hold no IPv4 of their own, and what still needs IPv4 shares your NAT64 pool, {r} homes per address.",
|
||||
"ip6.share_homes":"{p} of homes",
|
||||
"ip6.started":"Swapping {routers} in {city} for IPv6-only ones: about {days} days.",
|
||||
"ip6.stop":"Stop the swap",
|
||||
"ip6.stopped":"Stopped the swap in {city} at {p} of homes. The routers already swapped stay; new homes come dual stack again.",
|
||||
"ip6.swapping_home_routers_paid":"Swapping home routers, paid as they go in; new homes get the new one from the start, at {cost} each. Done around {date}.",
|
||||
"ip6.title":"IPv6-only (464XLAT)",
|
||||
"ip6.waiting":"Waiting for cash: the crews go on once you can pay for the day's routers.",
|
||||
"ip6.what":"Swaps {routers} in about {days} days, paid as they go in, and frees {addr} for new customers.",
|
||||
"ip6.your_ipv4_bill_goes_down":"Your IPv4 bill goes down by {price}/mo (fewer CGNAT boxes and refunds).",
|
||||
"ip6.your_ipv4_bill_goes_up":"Your IPv4 bill goes up by {price}/mo (NAT64 gateways and refunds).",
|
||||
"ix_downgrade.pni_downgraded":"The PNI with {net} in {city} is now {port}.",
|
||||
"ix_downgrade.port_downgraded_at_ix":"Port at {ix} is now {port}.",
|
||||
"ix_downgrade.transit_downgraded":"{net} transit in {city} is now {port}.",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue