diff --git a/tun/ipstack.js b/tun/ipstack.js index 47a7e9b..bc44247 100644 --- a/tun/ipstack.js +++ b/tun/ipstack.js @@ -1 +1,848 @@ -"use strict";/*Compiled using Cheerp (R) by Leaning Technologies Ltd*/var vu=Math.imul;var vv=Math.fround;var oSlot=0;var nullArray=[null];var nullObj={d:nullArray,o:0};function vU(p){return (typeof self==='object')?fetch(p).then(r=>r.arrayBuffer()):new Promise((y,n)=>{import('fs').then(r=>r.readFile(p,(e,d)=>{if(e)n(e);else y(d);}));});}function sO(){a3=sL();}function sN(){ei=sM();}function sM(){return new Map();}function sL(){return new Map();}function m$(k){var i=null,g=null;i=f9();g=f9();k.a0=new Promise(function(__f,__r){i.inner=__f;g.inner=__r;});;k.a1=i.inner;k.a2=g.inner;}function f9(){return new Object();}function dS(){return ~~ +performance.now()|0;}function m8(k,l,i){var g=null;g=new Uint8Array((+(i|0)));g.set(cW(k,l,i));g7(g);}function cW(k,l,i){var m=0,g=null;m=l;g=k;g=g;if((i|0)!==0){if((m|0)===0)if( +g.length===(+(i>>>0)))return g;return g.subarray((+(m>>>0)),(+(m+i>>>0)));}if((m|0)===0)return g;return g.subarray((+(m>>>0)));}function m2(){+setInterval(m1(),10);}function m1(){var g=null,i=null;g={a0:null,a1:null,a2:null};mZ(g);i=mY(g);mX(g);return i;}function mZ(g){pW(g);}function mY(i){var g=null;if(i.a1!==null){g=[{a0:null,a1:null}];g[0].a0=i.a1;g[0].a1=i.a2;g=vL(p0,g[0]);gO(i.a0,g);i.a1=null;}return i.a0;}function mX(i){var g=null;g=i.a1;if(g!==null)g(i.a2);}function p0(g){g.a0(g.a1);}function gO(i,g){if(ej===null)ej=new Map();ej.set(i,g);}function pW(g){pV(g);}function pV(g){var i=null;i=pT;g.a0=i;g.a1=null;g.a2=null;}function pT(){pS();}function pS(){h4();}function vd(g){pR();me();mc();}function vc(I){var D=null,g=null,w=0,k=0,u=null,r=null,p=0,m=0,E=null,i=0,B=null,C=0;D=ci();g=-80+D|0;a5(g);w=64+g|0;cQ(w,I.localIp);k=40+g|0;ls(k);u=I.ipMap;if(u!==undefined){r=Object.keys(u);if(((r.length)|0)>0){p=24+g|0;m=8+g|0;i=0;while(1){B=lp(r,i);C=oSlot;B=B[C];E=u[B];cQ(p,B);cQ(m,E);ln(g|0,k,p,m);cL(m);cL(p);i=i+1|0;if((i|0)<((r.length)|0))continue;break;}}}pN(w,k);lm(k);cL(w);a5(D);}function cQ(k,i){var m=null,n=0,g=0;kn(k|0);lA(k|0,i.length);m=a;n=bY(k|0)|0;if(((i.length)|0)>0){g=0;while(1){m[n+g|0]=i.charCodeAt(g);g=g+1|0;if((g|0)<((i.length)|0))continue;break;}}}function lp(i,g){oSlot=0+g|0;return i;}function vf(){lu();}function ve(m){var i=0,g=0,k=null,l=0;i=~~ +m.length;g=am(0,i)|0;if((g|0)!=(0|0)){l=c[4+g>>2];k=a;cW(k,l,i).set(m);n_(g);}}function vh(g){g7=g;}function n9(m,k,l,i){var g=null;g=b4(a3,((m|0)|0)).port2;if(n8(k,l)|0){dk(m|0);g.postMessage(null);return;}g.postMessage(cW(k,l,i));}function b4(i,g){return i.get(g);}function n8(i,j){var g=0;g=(i.buffer===__heap);if(g){g=j;return ((g|0)===0?1:0)|0;}return 0|0;}function rc(k,i){var g=0,p=null,m=null;g=((k|0)|0);p=rb(ei,g);m=b4(a3,g).port1;if((i|0)!==0)p(null);p(m);}function rb(i,g){return i.get(g);}function vb(p){var k=null,i=null,g=0,m=0;k=ci();i=-16+k|0;a5(i);g=i|0;cQ(g,p);m=l9(g)|0;cL(g);a5(k);return m|0;}function va(r,p,m){var k=0,g=0,i=null;k=cP(p)|0;g=aE(88)|0;f1(g);fJ(g);if(((eU(g,r)|0)&255)===0){i={a0:null,a1:null,a2:null};m$(i);lh(ei,(g|0),i.a1);if(((q$(g,k,m)|0)|0)===0)return i.a0;}cx(g);aa(g|0);return null;}function fJ(i){var k=null,g=null;g=new MessageChannel();g.port1;k=g.port2;dJ(a3,((i|0)|0),g);n5(i|0);g={a0:null,a1:0};g.a0=k;g.a1=(i|0);k.onmessage=lf(g);}function lh(k,i,g){k.set(i,g);}function dJ(k,i,g){k.set(i,g);}function lf(i){var g=null,k=null;g={a0:null,a1:null,a2:null};le(g,i);k=dI(g);dH(g);return k;}function le(i,g){la(i,g);}function dI(i){var g=null;if(i.a1!==null){g=[{a0:null,a1:null}];g[0].a0=i.a1;g[0].a1=i.a2;g=vL(lc,g[0]);gO(i.a0,g);i.a1=null;}return i.a0;}function dH(g){var i=null;i=g.a1;if(i!==null)i(g.a2);}function lc(g){g.a0(g.a1);}function la(i,g){nY(i,g);}function nY(k,i){var g=null,m=null;g=[{a0:null,a1:0}];g[0].a0=i.a0;g[0].a1=(i.a1|0);m=vL(nW,g[0]);k.a0=m;k.a1=null;k.a2=g[0];}function nW(i,g){nU(i,g);}function nU(r,p){var m=null,w=null,i=0,u=null,v=0,k=null,l=0,g=0;m=ci();k=-16+m|0;a5(k);w=p.data;if(w!==null){i=k|0;gu(i,~~ +w.length);if( +w.length>0){g=0;while(1){k=gt(w,g);l=oSlot;u=a;v=f$(i,g)|0;u[v]=k[l]|0;g=g+1|0;if( +w.length>(+(g|0)))continue;break;}}rd(r.a1|0,i);f_(i);}else{dk(r.a1|0);r.a0.onmessage=null;}a5(m);}function gt(i,g){oSlot=0+g|0;return i;}function kV(p,m,k,i){var w=0,u=null,g=null,r=null;w=cP(k)|0;fJ(m|0);u=b4(a3,((p|0)|0)).port2;g=b4(a3,((m|0)|0)).port1;r={addr: w, port: i, arg1: g};u.postMessage(r,new Array(g));}function u$(p){var g=0,m=null,k=null,i=null;g=aE(88)|0;f1(g);if(((eU(g,p)|0)&255)===0)if(((i3(g)|0)&255)===0){i=new MessageChannel();m=i.port1;k=i.port2;dJ(a3,(g|0),i);kS(g);i={a0:0};i.a0=g;k.onmessage=jo(i);return m;}cx(g);aa(g|0);return null;}function jo(i){var g=null,k=null;g={a0:null,a1:null,a2:null};jn(g,i);k=dI(g);dH(g);return k;}function jn(i,g){jm(i,g);}function jm(i,g){jl(i,g);}function jl(k,i){var g=null,m=null;g=[{a0:0}];g[0].a0=(i.a0|0);m=vL(jj,g[0]);k.a0=m;k.a1=null;k.a2=g[0];}function jj(i,g){mW(i);}function mW(g){dk(g.a0|0);}function mV(p,m,n,k,i,g){var u=0,r=null;u=cP(i)|0;r=b4(a3,((p|0)|0)).port2;r.postMessage({addr: u, port: g, data: cW(m,n,k)});}function vg(p){var g=0,m=null,k=null,i=null;g=aE(32)|0;iU(g);if(((iL(g,p)|0)&255)!==0){iG(g);aa(g|0);return null;}i=new MessageChannel();m=i.port1;k=i.port2;dJ(a3,(g|0),i);mU(g);i={a0:0};i.a0=g;k.onmessage=mp(i);return m;}function mp(i){var g=null,k=null;g={a0:null,a1:null,a2:null};mo(g,i);k=dI(g);dH(g);return k;}function mo(i,g){mn(i,g);}function mn(i,g){mm(i,g);}function mm(k,i){var g=null,m=null;g=[{a0:0}];g[0].a0=(i.a0|0);m=vL(mk,g[0]);k.a0=m;k.a1=null;k.a2=g[0];}function mk(i,g){mi(i,g);}function mi(u,r){var p=null,D=null,k=null,i=0,B=null,C=0,w=0,m=null,n=0,g=0;p=ci();m=-16+p|0;a5(m);D=r.data;if(D!==null){k=D.data;i=m|0;gu(i,~~ +k.length);if( +k.length>0){g=0;while(1){m=gt(k,g);n=oSlot;B=a;C=f$(i,g)|0;B[C]=m[n]|0;g=g+1|0;if( +k.length>(+(g|0)))continue;break;}}g=D.addr;w=D.port;ms(u.a0|0,i,g,w);f_(i);}else iH(u.a0|0);a5(p);}function j7(i){var m=null,k=null,g=null;g=[0];g[0]=(1050808|0);m=[0];m[0]=((58|0)|0);k=[nullObj];k[0]={d:null,o:i};g=j5(k,0,g,0,m,0);j4(g);;}function j5(u,v,r,s,p,q){var w=0,k=0,i=null,g=0,m=null;k=d8|0;a:{b:{if((k|0)>1){i=c1;g=1;while(1){if((i[g]&255)!==0){g=g+1|0;if((g|0)===(k|0))break b;continue;}break;}}else{g=1;}if((g|0)!==(k|0)){k=g;break a;}}d8=k<<1;i=d9;g=vu(k,88)|0;if(i!==nullArray||0!==0)i=u6(i,i.length,g/44|0);else i=u5(g/44|0);d9=i;g=d8|0;i=c1;if(i!==nullArray||0!==0)i=(function(){var __old__=i;var __ret__=new Uint8Array(g/1|0);__ret__.set(__old__.subarray(0, Math.min(__ret__.length,__old__.length)));return __ret__;})();else i=new Uint8Array(g/1|0);c1=i;}i=d9;m=u[v];g=r[s]|0;w=p[q]|0;i[k].a1=m.d[m.o];i[k].a2=null;i[k].a3=g;i[k].a4=null;i[k].i5=w;i[k].i6=1;i[k].i7=0;i[k].a9=null;i[k].a10=null;m=c1;m[k]=1;return i[k];}function j4(k){var m=0,i=null,g=null,h=0;m=k.a3|0;h=c[4+m>>2];g=a;g=j3(g,h);i=new CheerpException(g);k.a0=i;throw i;;}function j3(m,n){var g=null,k=0,i=null;g=String();if((m[n]&255)===0)return String(g);k=0;while(1){i=String.fromCharCode(m[n+k|0]<<24>>24);g=g.concat(i);k=k+1|0;if((m[n+k|0]&255)!==0)continue;break;}return String(g);}function ou(m,n,k){var g=null,i=0;g=ot(m,n,k);i=(g.length)-1|0;if(((g.charCodeAt(i))|0)===10){console.log(g.substr(0,i));return;}console.log(g);}function ot(w,x,u){var k=0,i=null,p=0,r=0,m=0,g=0;i=String();if((u|0)===0)return i;r=u;p=0;while(1){k=w[x+p|0]|0;if((k&255)!==0){g=k&255;if(k<<24<=-16777216)if((k&255)<192){g=(g&63)+(m<<6)|0;}else if((k&255)<224){g&=31;}else if((k&255)<240){g&=15;}else{g&=7;}r=r-1|0;p=p+1|0;a:{if((r|0)!==0)if((w[x+p|0]&192)===128){m=g;break a;}if(g>>>0<65536){m=g;}else{m=g-65536|0;i=i.concat(String.fromCharCode((m>>>10)+55296|0));g=(g&1023)+56320|0;}i=i.concat(String.fromCharCode(g));}if((r|0)!==0)continue;return i;}break;}return i;}function hL(){uL();sO();sN();}function pG(i,g){ou(a,i>>0,g);}function hG(p,m,k,i,g){mV(p|0,a,m>>0,k,i,g);}function hH(k,i,g){n9(k|0,a,i>>0,g);}function mz(i,g){m8(a,i>>0,g);}var ei=null;var a3=null;var ej=null;var g7=null;var d8=16;var pb=new Uint8Array(16);var c1=pb;var pc=u5(16);var d9=pc;function u1(){this.a0=null;this.a1=null;this.a2=null;this.a3=0;this.a4=null;this.i5=0;this.i6=0;this.i7=0;this.a8=null;this.a9=null;this.a10=null;}function u5(e){var r=[];for(var i=0;i>16;try{__asm.vV.grow(pages);__heap=__asm.vV.buffer;vQ(__heap);return pages<<16;}catch(e){return -1;}}var IpStack={bind:null,connect:null,down:null,init:null,input:null,listen:null,output:null,parseIP:null,up:null,};var a=null,c=null,__asm=null,__heap=null;function vR(){throw new Error('this should be unreachable');};var uL=null;var aE=null;var iU=null;var iL=null;var iG=null;var mU=null;var iH=null;var gu=null;var f$=null;var ms=null;var f_=null;var cP=null;var f1=null;var eU=null;var i3=null;var kS=null;var cx=null;var dk=null;var n5=null;var rd=null;var q$=null;var l9=null;var cL=null;var kn=null;var lA=null;var bY=null;var am=null;var n_=null;var lu=null;var ls=null;var ln=null;var pN=null;var lm=null;var pR=null;var me=null;var mc=null;var h4=null;var aa=null;var ci=null;var a5=null;export default function(g){return (g&&g.buffer)?Promise.resolve(g.buffer):vU((g&&g.absPath)?g.absPath:new URL('ipstack.wasm', import.meta.url)).then(g=>WebAssembly.instantiate(g,{i:{bA:vR,kh:vR,fv:vR,kf:vR,ke:vR,as:vR,h3:vR,mz:mz,h2:vR,hH:hH,kV:kV,hG:hG,rc:rc,dS:dS,j7:j7,m2:m2,pG:pG,vP:vP,}})).then(g=>{__asm=g.instance.exports;__heap=__asm.vV.buffer;vQ(__heap);uL=__asm.uL;aE=__asm.aE;iU=__asm.iU;iL=__asm.iL;iG=__asm.iG;mU=__asm.mU;iH=__asm.iH;gu=__asm.gu;f$=__asm.f$;ms=__asm.ms;f_=__asm.f_;cP=__asm.cP;f1=__asm.f1;eU=__asm.eU;i3=__asm.i3;kS=__asm.kS;cx=__asm.cx;dk=__asm.dk;n5=__asm.n5;rd=__asm.rd;q$=__asm.q$;l9=__asm.l9;cL=__asm.cL;kn=__asm.kn;lA=__asm.lA;bY=__asm.bY;am=__asm.am;n_=__asm.n_;lu=__asm.lu;ls=__asm.ls;ln=__asm.ln;pN=__asm.pN;lm=__asm.lm;pR=__asm.pR;me=__asm.me;mc=__asm.mc;h4=__asm.h4;aa=__asm.aa;ci=__asm.ci;a5=__asm.a5;IpStack.bind=function(a0){return vg(a0);};IpStack.connect=function(a0,a1,a2){return va(a0,a1,a2);};IpStack.down=function(){return vf();};IpStack.init=function(a0){return vd(a0);};IpStack.input=function(a0){return ve(a0);};IpStack.listen=function(a0){return u$(a0);};IpStack.output=function(a0){return vh(a0);};IpStack.parseIP=function(a0){return vb(a0);};IpStack.up=function(a0){return vc(a0);};hL();return{IpStack:IpStack,};});}function vQ(g){a=new Uint8Array(g);c=new Int32Array(g);} \ No newline at end of file +"use strict"; +/*Compiled using Cheerp (R) by Leaning Technologies Ltd*/ +var __imul=Math.imul; +var __fround=Math.fround; +var oSlot=0;var nullArray=[null];var nullObj={d:nullArray,o:0}; +function fetchBuffer(p){ + return (typeof fetch==='function')? + fetch(p).then(r=>r.arrayBuffer()): + new Promise((y,n)=>{ + import('fs').then(r=>r.readFile(p,(e,d)=>{ + if(e)n(e); + else y(d); + })); + }); +} +function ___cxx_global_var_init$p2(){ + __ZN7IpStackL7chanMapE=_cheerpCreate_ZN6client4TMapIiPNS_14MessageChannelEEC2Ev(); +} +function ___cxx_global_var_init$p3(){ + __ZN7IpStackL11listenerMapE=_cheerpCreate_ZN6client4TMapIiPNS_13EventListenerEEC2Ev(); +} +function _cheerpCreate_ZN6client4TMapIiPNS_13EventListenerEEC2Ev(){ + return new Map(); +} +function _cheerpCreate_ZN6client4TMapIiPNS_14MessageChannelEEC2Ev(){ + return new Map(); +} +function __Z13createPromisev(Lagg$presult){ + var LretConstructor=null,LretConstructor7=null; + LretConstructor=_cheerpCreate_ZN6client9CheerpRefINS_13EventListenerEEC2Ev(); + LretConstructor7=_cheerpCreate_ZN6client9CheerpRefINS_13EventListenerEEC2Ev(); + Lagg$presult.a0=new Promise(function(__f,__r){LretConstructor.inner=__f;LretConstructor7.inner=__r;});; + Lagg$presult.a1=LretConstructor.inner; + Lagg$presult.a2=LretConstructor7.inner; +} +function _cheerpCreate_ZN6client9CheerpRefINS_13EventListenerEEC2Ev(){ + return new Object(); +} +function _sys_now(){ + return ~~ +performance.now()|0; +} +function __Z9output_jsPhi(Lbuf,Mbuf,Llen){ + var LretConstructor=null; + LretConstructor=new Uint8Array((+(Llen|0))); + LretConstructor.set(__ZN6cheerp14MakeTypedArrayIhN6client10Uint8ArrayEEEPT0_PKT_j(Lbuf,Mbuf,Llen)); + __ZL9output_cb(LretConstructor); +} +function __ZN6cheerp14MakeTypedArrayIhN6client10Uint8ArrayEEEPT0_PKT_j(Lptr,Mptr,Lsize){ + var tmp0=0,tmp1=null; + tmp0=Mptr; + tmp1=Lptr; + tmp1=tmp1; + if((Lsize|0)!==0){ + if((tmp0|0)===0)if( +tmp1.length===(+(Lsize>>>0)))return tmp1; + return tmp1.subarray((+(tmp0>>>0)),(+(tmp0+Lsize>>>0))); + } + if((tmp0|0)===0)return tmp1; + return tmp1.subarray((+(tmp0>>>0))); +} +function __Z14start_timeoutsv(){ + +setInterval(__ZN6cheerp8CallbackIZ14start_timeoutsvE3$_0EEPN6client13EventListenerEOT_(),10); +} +function __ZN6cheerp8CallbackIZ14start_timeoutsvE3$_0EEPN6client13EventListenerEOT_(){ + var Lref$ptmp=null,Lcall1=null; + Lref$ptmp={a0:null,a1:null,a2:null}; + __ZN6cheerp12make_closureIZ14start_timeoutsvE3$_0EEDTclsr13ClosureHelperIT_DTadsr3std16remove_referenceIS2_E4typeEonclEEE12make_closureclgssr6cheerpE7forwardIS2_Efp_EEEOS2_(Lref$ptmp); + Lcall1=__ZN6cheerp7ClosureIFvvEEcvPN6client13EventListenerEEv(Lref$ptmp); + __ZN6cheerp7ClosureIFvvEED2Ev(Lref$ptmp); + return Lcall1; +} +function __ZN6cheerp12make_closureIZ14start_timeoutsvE3$_0EEDTclsr13ClosureHelperIT_DTadsr3std16remove_referenceIS2_E4typeEonclEEE12make_closureclgssr6cheerpE7forwardIS2_Efp_EEEOS2_(Lagg$presult){ + __ZN6cheerp13ClosureHelperIZ14start_timeoutsvE3$_0MS1_KFvvEE12make_closureEOS1_(Lagg$presult); +} +function __ZN6cheerp7ClosureIFvvEEcvPN6client13EventListenerEEv(Lthis){ + var tmp0=null; + if(Lthis.a1!==null){ + tmp0=[{a0:null,a1:null}]; + tmp0[0].a0=Lthis.a1; + tmp0[0].a1=Lthis.a2; + tmp0=cheerpCreateClosure(__ZN6cheerp7ClosureIFvvEE14deleter_helperEPNS2_13DeleterHelperE,tmp0[0]); + __ZN6cheerp20EscapedResourcesListIN6client13EventListenerEE3addEPS2_PNS1_6ObjectE(Lthis.a0,tmp0); + Lthis.a1=null; + } + return Lthis.a0; +} +function __ZN6cheerp7ClosureIFvvEED2Ev(Lthis){ + var tmp0=null; + tmp0=Lthis.a1; + if(tmp0!==null)tmp0(Lthis.a2); +} +function __ZN6cheerp7ClosureIFvvEE14deleter_helperEPNS2_13DeleterHelperE(Lh){ + Lh.a0(Lh.a1); +} +function __ZN6cheerp20EscapedResourcesListIN6client13EventListenerEE3addEPS2_PNS1_6ObjectE(Lr,Ld){ + if(__ZN6cheerp20EscapedResourcesListIN6client13EventListenerEE9resourcesE===null)__ZN6cheerp20EscapedResourcesListIN6client13EventListenerEE9resourcesE=new Map(); + __ZN6cheerp20EscapedResourcesListIN6client13EventListenerEE9resourcesE.set(Lr,Ld); +} +function __ZN6cheerp13ClosureHelperIZ14start_timeoutsvE3$_0MS1_KFvvEE12make_closureEOS1_(Lagg$presult){ + __ZN6cheerp7ClosureIFvvEEC2IZ14start_timeoutsvE3$_0EET_PNSt9enable_ifIXsr3std14is_convertibleIS5_PS1_EE5valueEvE4typeE(Lagg$presult); +} +function __ZN6cheerp7ClosureIFvvEEC2IZ14start_timeoutsvE3$_0EET_PNSt9enable_ifIXsr3std14is_convertibleIS5_PS1_EE5valueEvE4typeE(Lthis){ + var tmp0=null; + tmp0=__ZZ14start_timeoutsvEN3$_08__invokeEv; + Lthis.a0=tmp0; + Lthis.a1=null; + Lthis.a2=null; +} +function __ZZ14start_timeoutsvEN3$_08__invokeEv(){ + __ZZ14start_timeoutsvENK3$_0clEv(); +} +function __ZZ14start_timeoutsvENK3$_0clEv(){ + _sys_check_timeouts(); +} +function __ZN7IpStack4initEPN6client9UpOptionsE(Lopts){ + __Z4initv(); + __Z16udpecho_raw_initv(); + __Z16tcpecho_raw_initv(); +} +function __ZN7IpStack2upEPN6client9UpOptionsE(Lopts){ + var LsavedStack=null,tmp1=null,Lip=0,LipMapStr=0,Lcall1=null,Lcall2=null,Lref$ptmp7=0,Lref$ptmp8=0,Lcall6=null,Li$p03=0,Lcall5=null,Lcall5o=0; + LsavedStack=___getStackPtr(); + tmp1=-80+LsavedStack|0; + ___setStackPtr(tmp1); + Lip=64+tmp1|0; + __ZNK6client6StringcvSsEv(Lip,Lopts.localIp); + LipMapStr=40+tmp1|0; + __ZNSt13unordered_mapISsSsSt4hashISsESt8equal_toISsESaISt4pairIKSsSsEEEC2Ev(LipMapStr); + Lcall1=Lopts.ipMap; + if(Lcall1!==undefined){ + Lcall2=Object.keys(Lcall1); + if(((Lcall2.length)|0)>0){ + Lref$ptmp7=24+tmp1|0; + Lref$ptmp8=8+tmp1|0; + Li$p03=0; + while(1){ + Lcall5=__ZN6client5ArrayixEi(Lcall2,Li$p03); + Lcall5o=oSlot; + Lcall5=Lcall5[Lcall5o]; + Lcall6=Lcall1[Lcall5]; + __ZNK6client6StringcvSsEv(Lref$ptmp7,Lcall5); + __ZNK6client6StringcvSsEv(Lref$ptmp8,Lcall6); + __ZNSt13unordered_mapISsSsSt4hashISsESt8equal_toISsESaISt4pairIKSsSsEEE7emplaceIJSsSsEEES4_ISt19__hash_map_iteratorISt15__hash_iteratorIPSt11__hash_nodeISt17__hash_value_typeISsSsEPvEEEbEDpOT_(tmp1|0,LipMapStr,Lref$ptmp7,Lref$ptmp8); + __ZNSsD2Ev(Lref$ptmp8); + __ZNSsD2Ev(Lref$ptmp7); + Li$p03=Li$p03+1|0; + if((Li$p03|0)<((Lcall2.length)|0))continue; + break; + } + } + } + __Z2upRKSsRKSt13unordered_mapISsSsSt4hashISsESt8equal_toISsESaISt4pairIS_SsEEE(Lip,LipMapStr); + __ZNSt13unordered_mapISsSsSt4hashISsESt8equal_toISsESaISt4pairIKSsSsEEED2Ev(LipMapStr); + __ZNSsD2Ev(Lip); + ___setStackPtr(LsavedStack); +} +function __ZNK6client6StringcvSsEv(Lagg$presult,Lthis){ + var Lcall2=null,Lcall2o=0,Li$p03=0; + __ZNSsC2Ev(Lagg$presult|0); + __ZNSs6resizeEj(Lagg$presult|0,Lthis.length); + Lcall2=HEAP8; + Lcall2o=__ZNSsixEj_icf(Lagg$presult|0)|0; + if(((Lthis.length)|0)>0){ + Li$p03=0; + while(1){ + Lcall2[Lcall2o+Li$p03|0]=Lthis.charCodeAt(Li$p03); + Li$p03=Li$p03+1|0; + if((Li$p03|0)<((Lthis.length)|0))continue; + break; + } + } +} +function __ZN6client5ArrayixEi(Lthis,Lindex){ + oSlot=0+Lindex|0; + return Lthis; +} +function __ZN7IpStack4downEv(){ + __Z4downv(); +} +function __ZN7IpStack5inputEPN6client10Uint8ArrayE(Lpkt){ + var Lconv=0,Lcall2=0,tmp2=null,tmp2o=0; + Lconv=~~ +Lpkt.length; + Lcall2=_pbuf_alloc(0,Lconv)|0; + if((Lcall2|0)!=(0|0)){ + tmp2o=HEAP32[4+Lcall2>>2]; + tmp2=HEAP8; + __ZN6cheerp14MakeTypedArrayIhN6client10Uint8ArrayEEEPT0_PKT_j(tmp2,tmp2o,Lconv).set(Lpkt); + __ZN7IpStackL7doInputEP4pbuf(Lcall2); + } +} +function __ZN7IpStack6outputEPFvPN6client10Uint8ArrayEE(Lcallback){ + __ZL9output_cb=Lcallback; +} +function __ZN7IpStack11recvAdapterEPN3tcp6SocketEPhj(Ls,Ldata,Mdata,Llen){ + var Lcall1=null; + Lcall1=__ZN6client4TMapIiPNS_14MessageChannelEE3getEi(__ZN7IpStackL7chanMapE,((Ls|0)|0)).port2; + if(__ZN7IpStack10isWasmNullIhEEbPT_(Ldata,Mdata)|0){ + __ZN3tcp6Socket5closeEv(Ls|0); + Lcall1.postMessage(null); + return; + } + Lcall1.postMessage(__ZN6cheerp14MakeTypedArrayIhN6client10Uint8ArrayEEEPT0_PKT_j(Ldata,Mdata,Llen)); +} +function __ZN6client4TMapIiPNS_14MessageChannelEE3getEi(Lthis,Lk){ + return Lthis.get(Lk); +} +function __ZN7IpStack10isWasmNullIhEEbPT_(Lp,Mp){ + var tmp0=0; + tmp0=(Lp.buffer===__heap); + if(tmp0){ + tmp0=Mp; + return ((tmp0|0)===0?1:0)|0; + } + return 0|0; +} +function __ZN7IpStack11connAdapterEPN3tcp6SocketEi(Ls,Lerr){ + var tmp0=0,Lcall=null,Lcall2=null; + tmp0=((Ls|0)|0); + Lcall=__ZN6client4TMapIiPNS_13EventListenerEE3getEi(__ZN7IpStackL11listenerMapE,tmp0); + Lcall2=__ZN6client4TMapIiPNS_14MessageChannelEE3getEi(__ZN7IpStackL7chanMapE,tmp0).port1; + if((Lerr|0)!==0)Lcall(null); + Lcall(Lcall2); +} +function __ZN6client4TMapIiPNS_13EventListenerEE3getEi(Lthis,Lk){ + return Lthis.get(Lk); +} +function __ZN7IpStack7parseIPEPN6client6StringE(LjsStr){ + var LsavedStack=null,tmp1=null,Lstr=0,Lcall=0; + LsavedStack=___getStackPtr(); + tmp1=-16+LsavedStack|0; + ___setStackPtr(tmp1); + Lstr=tmp1|0; + __ZNK6client6StringcvSsEv(Lstr,LjsStr); + Lcall=__ZN2ip4stonERKSs(Lstr)|0; + __ZNSsD2Ev(Lstr); + ___setStackPtr(LsavedStack); + return Lcall|0; +} +function __ZN7IpStack7connectEiii(LlocalPort,Lip,Lport){ + var Lcall=0,tmp1=0,Lp=null; + Lcall=__ZL6map_ipj(Lip)|0; + tmp1=_malloc(88)|0; + __ZN3tcp6SocketC2Ev(tmp1); + __ZN7IpStackL12setupChannelEPN3tcp6SocketE(tmp1); + if(((__ZN3tcp6Socket4bindEii(tmp1,LlocalPort)|0)&255)===0){ + Lp={a0:null,a1:null,a2:null}; + __Z13createPromisev(Lp); + __ZN6client4TMapIiPNS_13EventListenerEE3setEiS2_(__ZN7IpStackL11listenerMapE,(tmp1|0),Lp.a1); + if(((__ZN7IpStack11connectWasmEPN3tcp6SocketEii(tmp1,Lcall,Lport)|0)|0)===0)return Lp.a0; + } + __ZN3tcp6SocketD2Ev(tmp1); + _free(tmp1|0); + return null; +} +function __ZN7IpStackL12setupChannelEPN3tcp6SocketE(Ls){ + var Lcall1=null,LretConstructor=null; + LretConstructor=new MessageChannel(); + LretConstructor.port1; + Lcall1=LretConstructor.port2; + __ZN6client4TMapIiPNS_14MessageChannelEE3setEiS2_(__ZN7IpStackL7chanMapE,((Ls|0)|0),LretConstructor); + __ZN7IpStack8recvWasmEPN3tcp6SocketE(Ls|0); + LretConstructor={a0:null,a1:0}; + LretConstructor.a0=Lcall1; + LretConstructor.a1=(Ls|0); + Lcall1.onmessage=__ZN6cheerp8CallbackIZN7IpStackL12setupChannelEPN3tcp6SocketEE3$_7EEPN6client13EventListenerEOT_(LretConstructor); +} +function __ZN6client4TMapIiPNS_13EventListenerEE3setEiS2_(Lthis,Lk,Lv){ + Lthis.set(Lk,Lv); +} +function __ZN6client4TMapIiPNS_14MessageChannelEE3setEiS2_(Lthis,Lk,Lv){ + Lthis.set(Lk,Lv); +} +function __ZN6cheerp8CallbackIZN7IpStackL12setupChannelEPN3tcp6SocketEE3$_7EEPN6client13EventListenerEOT_(Lfunc){ + var Lref$ptmp=null,Lcall1=null; + Lref$ptmp={a0:null,a1:null,a2:null}; + __ZN6cheerp12make_closureIZN7IpStackL12setupChannelEPN3tcp6SocketEE3$_7EEDTclsr13ClosureHelperIT_DTadsr3std16remove_referenceIS6_E4typeEonclEEE12make_closureclgssr6cheerpE7forwardIS6_Efp_EEEOS6_(Lref$ptmp,Lfunc); + Lcall1=__ZN6cheerp7ClosureIFvPN6client12MessageEventEEEcvPNS1_13EventListenerEEv(Lref$ptmp); + __ZN6cheerp7ClosureIFvPN6client12MessageEventEEED2Ev(Lref$ptmp); + return Lcall1; +} +function __ZN6cheerp12make_closureIZN7IpStackL12setupChannelEPN3tcp6SocketEE3$_7EEDTclsr13ClosureHelperIT_DTadsr3std16remove_referenceIS6_E4typeEonclEEE12make_closureclgssr6cheerpE7forwardIS6_Efp_EEEOS6_(Lagg$presult,Lfunc){ + __ZN6cheerp13ClosureHelperIZN7IpStackL12setupChannelEPN3tcp6SocketEE3$_7MS5_KFvPN6client12MessageEventEEE12make_closureEOS5_(Lagg$presult,Lfunc); +} +function __ZN6cheerp7ClosureIFvPN6client12MessageEventEEEcvPNS1_13EventListenerEEv(Lthis){ + var tmp0=null; + if(Lthis.a1!==null){ + tmp0=[{a0:null,a1:null}]; + tmp0[0].a0=Lthis.a1; + tmp0[0].a1=Lthis.a2; + tmp0=cheerpCreateClosure(__ZN6cheerp7ClosureIFvPN6client12MessageEventEEE14deleter_helperEPNS5_13DeleterHelperE,tmp0[0]); + __ZN6cheerp20EscapedResourcesListIN6client13EventListenerEE3addEPS2_PNS1_6ObjectE(Lthis.a0,tmp0); + Lthis.a1=null; + } + return Lthis.a0; +} +function __ZN6cheerp7ClosureIFvPN6client12MessageEventEEED2Ev(Lthis){ + var tmp0=null; + tmp0=Lthis.a1; + if(tmp0!==null)tmp0(Lthis.a2); +} +function __ZN6cheerp7ClosureIFvPN6client12MessageEventEEE14deleter_helperEPNS5_13DeleterHelperE(Lh){ + Lh.a0(Lh.a1); +} +function __ZN6cheerp13ClosureHelperIZN7IpStackL12setupChannelEPN3tcp6SocketEE3$_7MS5_KFvPN6client12MessageEventEEE12make_closureEOS5_(Lagg$presult,Lfunc){ + __ZN6cheerp7ClosureIFvPN6client12MessageEventEEEC2IZN7IpStackL12setupChannelEPN3tcp6SocketEE3$_7EEOT_PNSt9enable_ifIXntsr3std14is_convertibleISC_PS4_EE5valueEvE4typeEPNSE_IXntsrNS5_13_must_destroyISC_EE5valueEvE4typeE(Lagg$presult,Lfunc); +} +function __ZN6cheerp7ClosureIFvPN6client12MessageEventEEEC2IZN7IpStackL12setupChannelEPN3tcp6SocketEE3$_7EEOT_PNSt9enable_ifIXntsr3std14is_convertibleISC_PS4_EE5valueEvE4typeEPNSE_IXntsrNS5_13_must_destroyISC_EE5valueEvE4typeE(Lthis,Lf){ + var tmp0=null,tmp1=null; + tmp0=[{a0:null,a1:0}]; + tmp0[0].a0=Lf.a0; + tmp0[0].a1=(Lf.a1|0); + tmp1=cheerpCreateClosure(__ZN6cheerp12InvokeHelperIvE6invokeIZN7IpStackL12setupChannelEPN3tcp6SocketEE3$_7JPN6client12MessageEventEEEEvPT_DpT0_,tmp0[0]); + Lthis.a0=tmp1; + Lthis.a1=null; + Lthis.a2=tmp0[0]; +} +function __ZN6cheerp12InvokeHelperIvE6invokeIZN7IpStackL12setupChannelEPN3tcp6SocketEE3$_7JPN6client12MessageEventEEEEvPT_DpT0_(Lfunc,Largs){ + __ZZN7IpStackL12setupChannelEPN3tcp6SocketEENK3$_7clEPN6client12MessageEventE(Lfunc,Largs); +} +function __ZZN7IpStackL12setupChannelEPN3tcp6SocketEENK3$_7clEPN6client12MessageEventE(Lthis,Lev){ + var LsavedStack=null,Lcall=null,Lbuf=0,Lcall8=null,Lcall8o=0,Lcall7=null,Lcall7o=0,Li$p03=0; + LsavedStack=___getStackPtr(); + Lcall7=-16+LsavedStack|0; + ___setStackPtr(Lcall7); + Lcall=Lev.data; + if(Lcall!==null){ + Lbuf=Lcall7|0; + __ZNSt6vectorIhSaIhEEC2Ej(Lbuf,~~ +Lcall.length); + if( +Lcall.length>0){ + Li$p03=0; + while(1){ + Lcall7=__ZN6client10Uint8ArrayixEi(Lcall,Li$p03); + Lcall7o=oSlot; + Lcall8=HEAP8; + Lcall8o=__ZNSt6vectorIhSaIhEEixEj(Lbuf,Li$p03)|0; + Lcall8[Lcall8o]=Lcall7[Lcall7o]|0; + Li$p03=Li$p03+1|0; + if( +Lcall.length>(+(Li$p03|0)))continue; + break; + } + } + __ZN7IpStack8sendWasmEPN3tcp6SocketERKSt6vectorIhSaIhEE(Lthis.a1|0,Lbuf); + __ZNSt6vectorIhSaIhEED2Ev(Lbuf); + }else{ + __ZN3tcp6Socket5closeEv(Lthis.a1|0); + Lthis.a0.onmessage=null; + } + ___setStackPtr(LsavedStack); +} +function __ZN6client10Uint8ArrayixEi(Lthis,Lindex){ + oSlot=0+Lindex|0; + return Lthis; +} +function __ZN7IpStack13acceptAdapterEPN3tcp6SocketES2_iii(LlistenSock,LnewSock,Laddr,Lport){ + var Lcall=0,Lcall2=null,Lcall4=null,tmp3=null; + Lcall=__ZL6map_ipj(Laddr)|0; + __ZN7IpStackL12setupChannelEPN3tcp6SocketE(LnewSock|0); + Lcall2=__ZN6client4TMapIiPNS_14MessageChannelEE3getEi(__ZN7IpStackL7chanMapE,((LlistenSock|0)|0)).port2; + Lcall4=__ZN6client4TMapIiPNS_14MessageChannelEE3getEi(__ZN7IpStackL7chanMapE,((LnewSock|0)|0)).port1; + tmp3={addr: Lcall, port: Lport, arg1: Lcall4}; + Lcall2.postMessage(tmp3,new Array(Lcall4)); +} +function __ZN7IpStack6listenEi(LlocalPort){ + var tmp0=0,Lcall9=null,Lcall10=null,LretConstructor=null; + tmp0=_malloc(88)|0; + __ZN3tcp6SocketC2Ev(tmp0); + if(((__ZN3tcp6Socket4bindEii(tmp0,LlocalPort)|0)&255)===0)if(((__ZN3tcp6Socket6listenEv(tmp0)|0)&255)===0){ + LretConstructor=new MessageChannel(); + Lcall9=LretConstructor.port1; + Lcall10=LretConstructor.port2; + __ZN6client4TMapIiPNS_14MessageChannelEE3setEiS2_(__ZN7IpStackL7chanMapE,(tmp0|0),LretConstructor); + __ZN7IpStack10acceptWasmEPN3tcp6SocketE(tmp0); + LretConstructor={a0:0}; + LretConstructor.a0=tmp0; + Lcall10.onmessage=__ZN6cheerp8CallbackIZN7IpStack6listenEiE3$_4EEPN6client13EventListenerEOT_(LretConstructor); + return Lcall9; + } + __ZN3tcp6SocketD2Ev(tmp0); + _free(tmp0|0); + return null; +} +function __ZN6cheerp8CallbackIZN7IpStack6listenEiE3$_4EEPN6client13EventListenerEOT_(Lfunc){ + var Lref$ptmp=null,Lcall1=null; + Lref$ptmp={a0:null,a1:null,a2:null}; + __ZN6cheerp12make_closureIZN7IpStack6listenEiE3$_4EEDTclsr13ClosureHelperIT_DTadsr3std16remove_referenceIS3_E4typeEonclEEE12make_closureclgssr6cheerpE7forwardIS3_Efp_EEEOS3_(Lref$ptmp,Lfunc); + Lcall1=__ZN6cheerp7ClosureIFvPN6client12MessageEventEEEcvPNS1_13EventListenerEEv(Lref$ptmp); + __ZN6cheerp7ClosureIFvPN6client12MessageEventEEED2Ev(Lref$ptmp); + return Lcall1; +} +function __ZN6cheerp12make_closureIZN7IpStack6listenEiE3$_4EEDTclsr13ClosureHelperIT_DTadsr3std16remove_referenceIS3_E4typeEonclEEE12make_closureclgssr6cheerpE7forwardIS3_Efp_EEEOS3_(Lagg$presult,Lfunc){ + __ZN6cheerp13ClosureHelperIZN7IpStack6listenEiE3$_4MS2_KFvPN6client12MessageEventEEE12make_closureEOS2_(Lagg$presult,Lfunc); +} +function __ZN6cheerp13ClosureHelperIZN7IpStack6listenEiE3$_4MS2_KFvPN6client12MessageEventEEE12make_closureEOS2_(Lagg$presult,Lfunc){ + __ZN6cheerp7ClosureIFvPN6client12MessageEventEEEC2IZN7IpStack6listenEiE3$_4EEOT_PNSt9enable_ifIXntsr3std14is_convertibleIS9_PS4_EE5valueEvE4typeEPNSB_IXntsrNS5_13_must_destroyIS9_EE5valueEvE4typeE(Lagg$presult,Lfunc); +} +function __ZN6cheerp7ClosureIFvPN6client12MessageEventEEEC2IZN7IpStack6listenEiE3$_4EEOT_PNSt9enable_ifIXntsr3std14is_convertibleIS9_PS4_EE5valueEvE4typeEPNSB_IXntsrNS5_13_must_destroyIS9_EE5valueEvE4typeE(Lthis,Lf){ + var tmp0=null,tmp1=null; + tmp0=[{a0:0}]; + tmp0[0].a0=(Lf.a0|0); + tmp1=cheerpCreateClosure(__ZN6cheerp12InvokeHelperIvE6invokeIZN7IpStack6listenEiE3$_4JPN6client12MessageEventEEEEvPT_DpT0_,tmp0[0]); + Lthis.a0=tmp1; + Lthis.a1=null; + Lthis.a2=tmp0[0]; +} +function __ZN6cheerp12InvokeHelperIvE6invokeIZN7IpStack6listenEiE3$_4JPN6client12MessageEventEEEEvPT_DpT0_(Lfunc,Largs){ + __ZZN7IpStack6listenEiENK3$_4clEPN6client12MessageEventE(Lfunc); +} +function __ZZN7IpStack6listenEiENK3$_4clEPN6client12MessageEventE(Lthis){ + __ZN3tcp6Socket5closeEv(Lthis.a0|0); +} +function __ZN7IpStack14recvAdapterUdpEPN3udp6SocketEPhjii(Ls,Ldata,Mdata,Llen,Laddr,Lport){ + var Lcall=0,Lcall2=null; + Lcall=__ZL6map_ipj(Laddr)|0; + Lcall2=__ZN6client4TMapIiPNS_14MessageChannelEE3getEi(__ZN7IpStackL7chanMapE,((Ls|0)|0)).port2; + Lcall2.postMessage({addr: Lcall, port: Lport, data: __ZN6cheerp14MakeTypedArrayIhN6client10Uint8ArrayEEEPT0_PKT_j(Ldata,Mdata,Llen)}); +} +function __ZN7IpStack4bindEi(LlocalPort){ + var tmp0=0,Lcall1=null,Lcall2=null,LretConstructor=null; + tmp0=_malloc(32)|0; + __ZN3udp6SocketC2Ev(tmp0); + if(((__ZN3udp6Socket4bindEii(tmp0,LlocalPort)|0)&255)!==0){ + __ZN3udp6SocketD2Ev(tmp0); + _free(tmp0|0); + return null; + } + LretConstructor=new MessageChannel(); + Lcall1=LretConstructor.port1; + Lcall2=LretConstructor.port2; + __ZN6client4TMapIiPNS_14MessageChannelEE3setEiS2_(__ZN7IpStackL7chanMapE,(tmp0|0),LretConstructor); + __ZN7IpStack11recvWasmUdpEPN3udp6SocketE(tmp0); + LretConstructor={a0:0}; + LretConstructor.a0=tmp0; + Lcall2.onmessage=__ZN6cheerp8CallbackIZN7IpStack4bindEiE3$_6EEPN6client13EventListenerEOT_(LretConstructor); + return Lcall1; +} +function __ZN6cheerp8CallbackIZN7IpStack4bindEiE3$_6EEPN6client13EventListenerEOT_(Lfunc){ + var Lref$ptmp=null,Lcall1=null; + Lref$ptmp={a0:null,a1:null,a2:null}; + __ZN6cheerp12make_closureIZN7IpStack4bindEiE3$_6EEDTclsr13ClosureHelperIT_DTadsr3std16remove_referenceIS3_E4typeEonclEEE12make_closureclgssr6cheerpE7forwardIS3_Efp_EEEOS3_(Lref$ptmp,Lfunc); + Lcall1=__ZN6cheerp7ClosureIFvPN6client12MessageEventEEEcvPNS1_13EventListenerEEv(Lref$ptmp); + __ZN6cheerp7ClosureIFvPN6client12MessageEventEEED2Ev(Lref$ptmp); + return Lcall1; +} +function __ZN6cheerp12make_closureIZN7IpStack4bindEiE3$_6EEDTclsr13ClosureHelperIT_DTadsr3std16remove_referenceIS3_E4typeEonclEEE12make_closureclgssr6cheerpE7forwardIS3_Efp_EEEOS3_(Lagg$presult,Lfunc){ + __ZN6cheerp13ClosureHelperIZN7IpStack4bindEiE3$_6MS2_KFvPN6client12MessageEventEEE12make_closureEOS2_(Lagg$presult,Lfunc); +} +function __ZN6cheerp13ClosureHelperIZN7IpStack4bindEiE3$_6MS2_KFvPN6client12MessageEventEEE12make_closureEOS2_(Lagg$presult,Lfunc){ + __ZN6cheerp7ClosureIFvPN6client12MessageEventEEEC2IZN7IpStack4bindEiE3$_6EEOT_PNSt9enable_ifIXntsr3std14is_convertibleIS9_PS4_EE5valueEvE4typeEPNSB_IXntsrNS5_13_must_destroyIS9_EE5valueEvE4typeE(Lagg$presult,Lfunc); +} +function __ZN6cheerp7ClosureIFvPN6client12MessageEventEEEC2IZN7IpStack4bindEiE3$_6EEOT_PNSt9enable_ifIXntsr3std14is_convertibleIS9_PS4_EE5valueEvE4typeEPNSB_IXntsrNS5_13_must_destroyIS9_EE5valueEvE4typeE(Lthis,Lf){ + var tmp0=null,tmp1=null; + tmp0=[{a0:0}]; + tmp0[0].a0=(Lf.a0|0); + tmp1=cheerpCreateClosure(__ZN6cheerp12InvokeHelperIvE6invokeIZN7IpStack4bindEiE3$_6JPN6client12MessageEventEEEEvPT_DpT0_,tmp0[0]); + Lthis.a0=tmp1; + Lthis.a1=null; + Lthis.a2=tmp0[0]; +} +function __ZN6cheerp12InvokeHelperIvE6invokeIZN7IpStack4bindEiE3$_6JPN6client12MessageEventEEEEvPT_DpT0_(Lfunc,Largs){ + __ZZN7IpStack4bindEiENK3$_6clEPN6client12MessageEventE(Lfunc,Largs); +} +function __ZZN7IpStack4bindEiENK3$_6clEPN6client12MessageEventE(Lthis,Lev){ + var LsavedStack=null,Lcall=null,Lcall3=null,Lbuf=0,Lcall9=null,Lcall9o=0,Lcall11=0,Lcall8=null,Lcall8o=0,Li$p03=0; + LsavedStack=___getStackPtr(); + Lcall8=-16+LsavedStack|0; + ___setStackPtr(Lcall8); + Lcall=Lev.data; + if(Lcall!==null){ + Lcall3=Lcall.data; + Lbuf=Lcall8|0; + __ZNSt6vectorIhSaIhEEC2Ej(Lbuf,~~ +Lcall3.length); + if( +Lcall3.length>0){ + Li$p03=0; + while(1){ + Lcall8=__ZN6client10Uint8ArrayixEi(Lcall3,Li$p03); + Lcall8o=oSlot; + Lcall9=HEAP8; + Lcall9o=__ZNSt6vectorIhSaIhEEixEj(Lbuf,Li$p03)|0; + Lcall9[Lcall9o]=Lcall8[Lcall8o]|0; + Li$p03=Li$p03+1|0; + if( +Lcall3.length>(+(Li$p03|0)))continue; + break; + } + } + Li$p03=Lcall.addr; + Lcall11=Lcall.port; + __ZN7IpStack11sendWasmUdpEPN3udp6SocketERKSt6vectorIhSaIhEEjj(Lthis.a0|0,Lbuf,Li$p03,Lcall11); + __ZNSt6vectorIhSaIhEED2Ev(Lbuf); + }else __ZN3udp6Socket5closeEv(Lthis.a0|0); + ___setStackPtr(LsavedStack); +} +function __ZN10__cxxabiv1L24__cxa_throw_wasm_adapterEjPSt9type_infoj(Lthrown_object){ + var Ldest$paddr=null,Lref$ptmp=null,Ltinfo$paddr=null; + Ltinfo$paddr=[0]; + Ltinfo$paddr[0]=(1048584|0); + Ldest$paddr=[0]; + Ldest$paddr[0]=((58|0)|0); + Lref$ptmp=[nullObj]; + Lref$ptmp[0]={d:null,o:Lthrown_object}; + Ltinfo$paddr=__ZN10__cxxabiv19Exception8allocateIJPvRPSt9type_infoRjEEEPS0_DpOT_(Lref$ptmp,0,Ltinfo$paddr,0,Ldest$paddr,0); + __ZN10__cxxabiv1L8do_throwEPNS_9ExceptionE(Ltinfo$paddr); + ; +} +function __ZN10__cxxabiv19Exception8allocateIJPvRPSt9type_infoRjEEEPS0_DpOT_(Largs,Margs,Largs1,Margs1,Largs3,Margs3){ + var tmp0=0,Lid$p0$plcssa28$pi$pi=0,tmp2=null,Lid$p022$pi$pi=0,tmp4=null; + Lid$p0$plcssa28$pi$pi=__ZN10__cxxabiv19Exception9allocatorE$p2|0; + a:{ + b:{ + if((Lid$p0$plcssa28$pi$pi|0)>1){ + tmp2=__ZN10__cxxabiv19Exception9allocatorE$p1; + Lid$p022$pi$pi=1; + while(1){ + if((tmp2[Lid$p022$pi$pi]&255)!==0){ + Lid$p022$pi$pi=Lid$p022$pi$pi+1|0; + if((Lid$p022$pi$pi|0)===(Lid$p0$plcssa28$pi$pi|0))break b; + continue; + } + break; + } + }else{ + Lid$p022$pi$pi=1; + } + if((Lid$p022$pi$pi|0)!==(Lid$p0$plcssa28$pi$pi|0)){ + Lid$p0$plcssa28$pi$pi=Lid$p022$pi$pi; + break a; + } + } + __ZN10__cxxabiv19Exception9allocatorE$p2=Lid$p0$plcssa28$pi$pi<<1; + tmp2=__ZN10__cxxabiv19Exception9allocatorE$p0; + Lid$p022$pi$pi=__imul(Lid$p0$plcssa28$pi$pi,88)|0; + if(tmp2!==nullArray||0!==0)tmp2=resizeArray_struct$p_ZN10__cxxabiv19ExceptionE(tmp2,tmp2.length,Lid$p022$pi$pi/44|0); + else tmp2=createArray_struct$p_ZN10__cxxabiv19ExceptionE(Lid$p022$pi$pi/44|0); + __ZN10__cxxabiv19Exception9allocatorE$p0=tmp2; + Lid$p022$pi$pi=__ZN10__cxxabiv19Exception9allocatorE$p2|0; + tmp2=__ZN10__cxxabiv19Exception9allocatorE$p1; + if(tmp2!==nullArray||0!==0)tmp2=(function(){var __old__=tmp2; + var __ret__=new Uint8Array(Lid$p022$pi$pi/1|0); + __ret__.set(__old__.subarray(0, Math.min(__ret__.length,__old__.length))); + return __ret__;})(); + else tmp2=new Uint8Array(Lid$p022$pi$pi/1|0); + __ZN10__cxxabiv19Exception9allocatorE$p1=tmp2; + } + tmp2=__ZN10__cxxabiv19Exception9allocatorE$p0; + tmp4=Largs[Margs]; + Lid$p022$pi$pi=Largs1[Margs1]|0; + tmp0=Largs3[Margs3]|0; + tmp2[Lid$p0$plcssa28$pi$pi].a1=tmp4.d[tmp4.o]; + tmp2[Lid$p0$plcssa28$pi$pi].a2=null; + tmp2[Lid$p0$plcssa28$pi$pi].a3=Lid$p022$pi$pi; + tmp2[Lid$p0$plcssa28$pi$pi].a4=null; + tmp2[Lid$p0$plcssa28$pi$pi].i5=tmp0; + tmp2[Lid$p0$plcssa28$pi$pi].i6=1; + tmp2[Lid$p0$plcssa28$pi$pi].i7=0; + tmp2[Lid$p0$plcssa28$pi$pi].a9=null; + tmp2[Lid$p0$plcssa28$pi$pi].a10=null; + tmp4=__ZN10__cxxabiv19Exception9allocatorE$p1; + tmp4[Lid$p0$plcssa28$pi$pi]=1; + return tmp2[Lid$p0$plcssa28$pi$pi]; +} +function __ZN10__cxxabiv1L8do_throwEPNS_9ExceptionE(Lex){ + var tmp0=0,LretConstructor8=null,LretConstructor=null,LretConstructoro=0; + tmp0=Lex.a3|0; + LretConstructoro=HEAP32[4+tmp0>>2]; + LretConstructor=HEAP8; + LretConstructor=_cheerpCreate_ZN6client6StringC2EPKc(LretConstructor,LretConstructoro); + LretConstructor8=new CheerpException(LretConstructor); + Lex.a0=LretConstructor8; + throw LretConstructor8; + ; +} +function _cheerpCreate_ZN6client6StringC2EPKc(Larg0,Marg0){ + var LretConstructor$pi=null,Lgeptoindexphi=0,LcheerpPtrAlloca$p07$pi=null; + LretConstructor$pi=String(); + if((Larg0[Marg0]&255)===0)return String(LretConstructor$pi); + Lgeptoindexphi=0; + while(1){ + LcheerpPtrAlloca$p07$pi=String.fromCharCode(Larg0[Marg0+Lgeptoindexphi|0]<<24>>24); + LretConstructor$pi=LretConstructor$pi.concat(LcheerpPtrAlloca$p07$pi); + Lgeptoindexphi=Lgeptoindexphi+1|0; + if((Larg0[Marg0+Lgeptoindexphi|0]&255)!==0)continue; + break; + } + return String(LretConstructor$pi); +} +function _print(Lbuf,Mbuf,Llen){ + var Lcall=null,Lsub=0; + Lcall=__ZN6client6String8fromUtf8EPKcj(Lbuf,Mbuf,Llen); + Lsub=(Lcall.length)-1|0; + if(((Lcall.charCodeAt(Lsub))|0)===10){ + console.log(Lcall.substr(0,Lsub)); + return; + } + console.log(Lcall); +} +function __ZN6client6String8fromUtf8EPKcj(Lin,Min,Llen){ + var tmp0=0,LretConstructor=null,Lgeptoindexphi=0,Llen$paddr$p06=0,Lcodepoint$p03=0,Lconv2=0; + LretConstructor=String(); + if((Llen|0)===0)return LretConstructor; + Llen$paddr$p06=Llen; + Lgeptoindexphi=0; + while(1){ + tmp0=Lin[Min+Lgeptoindexphi|0]|0; + if((tmp0&255)!==0){ + Lconv2=tmp0&255; + if(tmp0<<24<=-16777216)if((tmp0&255)<192){ + Lconv2=(Lconv2&63)+(Lcodepoint$p03<<6)|0; + }else if((tmp0&255)<224){ + Lconv2&=31; + }else if((tmp0&255)<240){ + Lconv2&=15; + }else{ + Lconv2&=7; + } + Llen$paddr$p06=Llen$paddr$p06-1|0; + Lgeptoindexphi=Lgeptoindexphi+1|0; + a:{ + if((Llen$paddr$p06|0)!==0)if((Lin[Min+Lgeptoindexphi|0]&192)===128){ + Lcodepoint$p03=Lconv2; + break a; + } + if(Lconv2>>>0<65536){ + Lcodepoint$p03=Lconv2; + }else{ + Lcodepoint$p03=Lconv2-65536|0; + LretConstructor=LretConstructor.concat(String.fromCharCode((Lcodepoint$p03>>>10)+55296|0)); + Lconv2=(Lconv2&1023)+56320|0; + } + LretConstructor=LretConstructor.concat(String.fromCharCode(Lconv2)); + } + if((Llen$paddr$p06|0)!==0)continue; + return LretConstructor; + } + break; + } + return LretConstructor; +} +function __start(){ + ___cxx_global_var_init(); + ___cxx_global_var_init$p2(); + ___cxx_global_var_init$p3(); +} +function ___wrapper__print(Larg0,Larg1){ + _print(HEAP8,Larg0>>0,Larg1); +} +function ___wrapper___ZN7IpStack14recvAdapterUdpEPN3udp6SocketEPhjii(Larg0,Larg1,Larg2,Larg3,Larg4){ + __ZN7IpStack14recvAdapterUdpEPN3udp6SocketEPhjii(Larg0|0,HEAP8,Larg1>>0,Larg2,Larg3,Larg4); +} +function ___wrapper___ZN7IpStack11recvAdapterEPN3tcp6SocketEPhj(Larg0,Larg1,Larg2){ + __ZN7IpStack11recvAdapterEPN3tcp6SocketEPhj(Larg0|0,HEAP8,Larg1>>0,Larg2); +} +function ___wrapper___Z9output_jsPhi(Larg0,Larg1){ + __Z9output_jsPhi(HEAP8,Larg0>>0,Larg1); +} +var __ZN7IpStackL11listenerMapE=null; +var __ZN7IpStackL7chanMapE=null; +var __ZN6cheerp20EscapedResourcesListIN6client13EventListenerEE9resourcesE=null; +var __ZL9output_cb=null; +var __ZN10__cxxabiv19Exception9allocatorE$p2=16; +var _promotedMalloc$p6=new Uint8Array(16); +var __ZN10__cxxabiv19Exception9allocatorE$p1=_promotedMalloc$p6; +var _promotedMalloc$p5=createArray_struct$p_ZN10__cxxabiv19ExceptionE(16); +var __ZN10__cxxabiv19Exception9allocatorE$p0=_promotedMalloc$p5; +function constructor_struct$p_ZN10__cxxabiv19ExceptionE(){ + this.a0=null; + this.a1=null; + this.a2=null; + this.a3=0; + this.a4=null; + this.i5=0; + this.i6=0; + this.i7=0; + this.a8=null; + this.a9=null; + this.a10=null; +} +function createArray_struct$p_ZN10__cxxabiv19ExceptionE(e){ + var r=[]; + for(var i=0;i>16; + try{ + __asm.memory.grow(pages); + __heap=__asm.memory.buffer; + assignHeaps(__heap); + return pages<<16; + }catch(e){ + return -1; + } +} +var IpStack={ + bind:null, + connect:null, + down:null, + init:null, + input:null, + listen:null, + output:null, + parseIP:null, + up:null, +}; +var HEAP8=null,HEAP32=null,__asm=null,__heap=null;function __dummy(){throw new Error('this should be unreachable');}; +var ___cxx_global_var_init=null; +var _malloc=null; +var __ZN3udp6SocketC2Ev=null; +var __ZN3udp6Socket4bindEii=null; +var __ZN3udp6SocketD2Ev=null; +var __ZN7IpStack11recvWasmUdpEPN3udp6SocketE=null; +var __ZN3udp6Socket5closeEv=null; +var __ZNSt6vectorIhSaIhEEC2Ej=null; +var __ZNSt6vectorIhSaIhEEixEj=null; +var __ZN7IpStack11sendWasmUdpEPN3udp6SocketERKSt6vectorIhSaIhEEjj=null; +var __ZNSt6vectorIhSaIhEED2Ev=null; +var __ZL6map_ipj=null; +var __ZN3tcp6SocketC2Ev=null; +var __ZN3tcp6Socket4bindEii=null; +var __ZN3tcp6Socket6listenEv=null; +var __ZN7IpStack10acceptWasmEPN3tcp6SocketE=null; +var __ZN3tcp6SocketD2Ev=null; +var __ZN3tcp6Socket5closeEv=null; +var __ZN7IpStack8recvWasmEPN3tcp6SocketE=null; +var __ZN7IpStack8sendWasmEPN3tcp6SocketERKSt6vectorIhSaIhEE=null; +var __ZN7IpStack11connectWasmEPN3tcp6SocketEii=null; +var __ZN2ip4stonERKSs=null; +var __ZNSsD2Ev=null; +var __ZNSsC2Ev=null; +var __ZNSs6resizeEj=null; +var __ZNSsixEj_icf=null; +var _pbuf_alloc=null; +var __ZN7IpStackL7doInputEP4pbuf=null; +var __Z4downv=null; +var __ZNSt13unordered_mapISsSsSt4hashISsESt8equal_toISsESaISt4pairIKSsSsEEEC2Ev=null; +var __ZNSt13unordered_mapISsSsSt4hashISsESt8equal_toISsESaISt4pairIKSsSsEEE7emplaceIJSsSsEEES4_ISt19__hash_map_iteratorISt15__hash_iteratorIPSt11__hash_nodeISt17__hash_value_typeISsSsEPvEEEbEDpOT_=null; +var __Z2upRKSsRKSt13unordered_mapISsSsSt4hashISsESt8equal_toISsESaISt4pairIS_SsEEE=null; +var __ZNSt13unordered_mapISsSsSt4hashISsESt8equal_toISsESaISt4pairIKSsSsEEED2Ev=null; +var __Z4initv=null; +var __Z16udpecho_raw_initv=null; +var __Z16tcpecho_raw_initv=null; +var _sys_check_timeouts=null; +var _free=null; +var ___getStackPtr=null; +var ___setStackPtr=null; +export default function(Lh){ + return (Lh&&Lh.buffer)? + Promise.resolve(Lh.buffer): + fetchBuffer((Lh&&Lh.absPath)?Lh.absPath:new URL('ipstack.wasm', import.meta.url)).then(Lh=> + WebAssembly.instantiate(Lh, + {i:{ + ___syscall_rt_sigprocmask:__dummy, + ___syscall_rt_sigaction:__dummy, + ___syscall_tkill:__dummy, + ___syscall_exit_group:__dummy, + ___syscall_exit:__dummy, + ___syscall_futex:__dummy, + ___syscall__llseek:__dummy, + ___wrapper___Z9output_jsPhi:___wrapper___Z9output_jsPhi, + ___syscall_close:__dummy, + ___wrapper___ZN7IpStack11recvAdapterEPN3tcp6SocketEPhj:___wrapper___ZN7IpStack11recvAdapterEPN3tcp6SocketEPhj, + __ZN7IpStack13acceptAdapterEPN3tcp6SocketES2_iii:__ZN7IpStack13acceptAdapterEPN3tcp6SocketES2_iii, + ___wrapper___ZN7IpStack14recvAdapterUdpEPN3udp6SocketEPhjii:___wrapper___ZN7IpStack14recvAdapterUdpEPN3udp6SocketEPhjii, + __ZN7IpStack11connAdapterEPN3tcp6SocketEi:__ZN7IpStack11connAdapterEPN3tcp6SocketEi, + _sys_now:_sys_now, + __ZN10__cxxabiv1L24__cxa_throw_wasm_adapterEjPSt9type_infoj:__ZN10__cxxabiv1L24__cxa_throw_wasm_adapterEjPSt9type_infoj, + __Z14start_timeoutsv:__Z14start_timeoutsv, + ___wrapper__print:___wrapper__print, + growLinearMemory:growLinearMemory, + }}) + ).then(Lh=>{ + __asm=Lh.instance.exports; + __heap=__asm.memory.buffer; + assignHeaps(__heap); + ___cxx_global_var_init=__asm.___cxx_global_var_init; + _malloc=__asm._malloc; + __ZN3udp6SocketC2Ev=__asm.__ZN3udp6SocketC2Ev; + __ZN3udp6Socket4bindEii=__asm.__ZN3udp6Socket4bindEii; + __ZN3udp6SocketD2Ev=__asm.__ZN3udp6SocketD2Ev; + __ZN7IpStack11recvWasmUdpEPN3udp6SocketE=__asm.__ZN7IpStack11recvWasmUdpEPN3udp6SocketE; + __ZN3udp6Socket5closeEv=__asm.__ZN3udp6Socket5closeEv; + __ZNSt6vectorIhSaIhEEC2Ej=__asm.__ZNSt6vectorIhSaIhEEC2Ej; + __ZNSt6vectorIhSaIhEEixEj=__asm.__ZNSt6vectorIhSaIhEEixEj; + __ZN7IpStack11sendWasmUdpEPN3udp6SocketERKSt6vectorIhSaIhEEjj=__asm.__ZN7IpStack11sendWasmUdpEPN3udp6SocketERKSt6vectorIhSaIhEEjj; + __ZNSt6vectorIhSaIhEED2Ev=__asm.__ZNSt6vectorIhSaIhEED2Ev; + __ZL6map_ipj=__asm.__ZL6map_ipj; + __ZN3tcp6SocketC2Ev=__asm.__ZN3tcp6SocketC2Ev; + __ZN3tcp6Socket4bindEii=__asm.__ZN3tcp6Socket4bindEii; + __ZN3tcp6Socket6listenEv=__asm.__ZN3tcp6Socket6listenEv; + __ZN7IpStack10acceptWasmEPN3tcp6SocketE=__asm.__ZN7IpStack10acceptWasmEPN3tcp6SocketE; + __ZN3tcp6SocketD2Ev=__asm.__ZN3tcp6SocketD2Ev; + __ZN3tcp6Socket5closeEv=__asm.__ZN3tcp6Socket5closeEv; + __ZN7IpStack8recvWasmEPN3tcp6SocketE=__asm.__ZN7IpStack8recvWasmEPN3tcp6SocketE; + __ZN7IpStack8sendWasmEPN3tcp6SocketERKSt6vectorIhSaIhEE=__asm.__ZN7IpStack8sendWasmEPN3tcp6SocketERKSt6vectorIhSaIhEE; + __ZN7IpStack11connectWasmEPN3tcp6SocketEii=__asm.__ZN7IpStack11connectWasmEPN3tcp6SocketEii; + __ZN2ip4stonERKSs=__asm.__ZN2ip4stonERKSs; + __ZNSsD2Ev=__asm.__ZNSsD2Ev; + __ZNSsC2Ev=__asm.__ZNSsC2Ev; + __ZNSs6resizeEj=__asm.__ZNSs6resizeEj; + __ZNSsixEj_icf=__asm.__ZNSsixEj_icf; + _pbuf_alloc=__asm._pbuf_alloc; + __ZN7IpStackL7doInputEP4pbuf=__asm.__ZN7IpStackL7doInputEP4pbuf; + __Z4downv=__asm.__Z4downv; + __ZNSt13unordered_mapISsSsSt4hashISsESt8equal_toISsESaISt4pairIKSsSsEEEC2Ev=__asm.__ZNSt13unordered_mapISsSsSt4hashISsESt8equal_toISsESaISt4pairIKSsSsEEEC2Ev; + __ZNSt13unordered_mapISsSsSt4hashISsESt8equal_toISsESaISt4pairIKSsSsEEE7emplaceIJSsSsEEES4_ISt19__hash_map_iteratorISt15__hash_iteratorIPSt11__hash_nodeISt17__hash_value_typeISsSsEPvEEEbEDpOT_=__asm.__ZNSt13unordered_mapISsSsSt4hashISsESt8equal_toISsESaISt4pairIKSsSsEEE7emplaceIJSsSsEEES4_ISt19__hash_map_iteratorISt15__hash_iteratorIPSt11__hash_nodeISt17__hash_value_typeISsSsEPvEEEbEDpOT_; + __Z2upRKSsRKSt13unordered_mapISsSsSt4hashISsESt8equal_toISsESaISt4pairIS_SsEEE=__asm.__Z2upRKSsRKSt13unordered_mapISsSsSt4hashISsESt8equal_toISsESaISt4pairIS_SsEEE; + __ZNSt13unordered_mapISsSsSt4hashISsESt8equal_toISsESaISt4pairIKSsSsEEED2Ev=__asm.__ZNSt13unordered_mapISsSsSt4hashISsESt8equal_toISsESaISt4pairIKSsSsEEED2Ev; + __Z4initv=__asm.__Z4initv; + __Z16udpecho_raw_initv=__asm.__Z16udpecho_raw_initv; + __Z16tcpecho_raw_initv=__asm.__Z16tcpecho_raw_initv; + _sys_check_timeouts=__asm._sys_check_timeouts; + _free=__asm._free; + ___getStackPtr=__asm.___getStackPtr; + ___setStackPtr=__asm.___setStackPtr; + IpStack.bind=__ZN7IpStack4bindEi; + IpStack.connect=__ZN7IpStack7connectEiii; + IpStack.down=__ZN7IpStack4downEv; + IpStack.init=__ZN7IpStack4initEPN6client9UpOptionsE; + IpStack.input=__ZN7IpStack5inputEPN6client10Uint8ArrayE; + IpStack.listen=__ZN7IpStack6listenEi; + IpStack.output=__ZN7IpStack6outputEPFvPN6client10Uint8ArrayEE; + IpStack.parseIP=__ZN7IpStack7parseIPEPN6client6StringE; + IpStack.up=__ZN7IpStack2upEPN6client9UpOptionsE; + __start(); + return{ + IpStack:IpStack, + }; + }); +} +function assignHeaps(Lh){ + HEAP8=new Uint8Array(Lh); + HEAP32=new Int32Array(Lh); +} diff --git a/tun/ipstack.wasm b/tun/ipstack.wasm index 044980b..cb516e4 100644 Binary files a/tun/ipstack.wasm and b/tun/ipstack.wasm differ