From 0b39c3beb0e77d63135141d8bfc2bc690141881c Mon Sep 17 00:00:00 2001 From: Shelikhoo Date: Fri, 2 Apr 2021 14:07:21 +0100 Subject: [PATCH] Update bundled browserforwarder firmware --- common/platform/securedload/embedded.go | 2 +- release/extra/browserforwarder/index.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/platform/securedload/embedded.go b/common/platform/securedload/embedded.go index bc4e997da..84c520443 100644 --- a/common/platform/securedload/embedded.go +++ b/common/platform/securedload/embedded.go @@ -4,6 +4,6 @@ const allowedHashes = `SHA256 (!#project==v2fly) = fffffffffffffffffffffffffffff SHA256 (!#version==embedded) = ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff SHA256 (subscriptions/subscriptionsDefinition.v2flyTemplate) = 3f165dba7de0d7c506fbdff3275ea64b76f307df435316a3ea0914ee957793ab SHA256 (browserforwarder/index.html) = 34f2c573724256421ade769bda18eeac85172bf0aaed00d7b90e41e843a2caef -SHA256 (browserforwarder/index.js) = fbc533343c9ea292b7e7a1b6ecc56c8b54a81bc48e4b939dba76e355b5a5eb15 +SHA256 (browserforwarder/index.js) = cf502dfb70fc81429d3848d21dae4ac9f04d7da1386849392ebd0c5b73cccdcc ` diff --git a/release/extra/browserforwarder/index.js b/release/extra/browserforwarder/index.js index 9db5fe91e..a3d236c9f 100644 --- a/release/extra/browserforwarder/index.js +++ b/release/extra/browserforwarder/index.js @@ -47,11 +47,11 @@ $packages["net/url"]=(function(){var $pkg={},$init,A,B,C,D,E,F,G,H,L,M,U,X,AH,AO $packages["github.com/v2fly/BrowserBridge/vendor/github.com/gopherjs/websocket"]=(function(){var $pkg={},$init,B,C,G,H,D,E,A,F,I,K,M,P,Q,S,T,U,V,W,X,Y,Z,AA,AB,AC,AD,AE,N,J,L,O,R;B=$packages["bytes"];C=$packages["fmt"];G=$packages["github.com/gopherjs/gopherjs/js"];H=$packages["github.com/v2fly/BrowserBridge/vendor/github.com/gopherjs/websocket/websocketjs"];D=$packages["io"];E=$packages["net"];A=$packages["net/url"];F=$packages["time"];I=$pkg.addr=$newType(0,$kindStruct,"websocket.addr",true,"github.com/v2fly/BrowserBridge/vendor/github.com/gopherjs/websocket",false,function(URL_){this.$val=this;if(arguments.length===0){this.URL=Y.nil;return;}this.URL=URL_;});K=$pkg.closeError=$newType(0,$kindStruct,"websocket.closeError",true,"github.com/v2fly/BrowserBridge/vendor/github.com/gopherjs/websocket",false,function(Object_,Code_,Reason_,WasClean_){this.$val=this;if(arguments.length===0){this.Object=null;this.Code=0;this.Reason="";this.WasClean=false;return;}this.Object=Object_;this.Code=Code_;this.Reason=Reason_;this.WasClean=WasClean_;});M=$pkg.deadlineErr=$newType(0,$kindStruct,"websocket.deadlineErr",true,"github.com/v2fly/BrowserBridge/vendor/github.com/gopherjs/websocket",false,function(){this.$val=this;if(arguments.length===0){return;}});P=$pkg.conn=$newType(0,$kindStruct,"websocket.conn",true,"github.com/v2fly/BrowserBridge/vendor/github.com/gopherjs/websocket",false,function(WebSocket_,ch_,readBuf_,readDeadline_){this.$val=this;if(arguments.length===0){this.WebSocket=T.nil;this.ch=$chanNil;this.readBuf=U.nil;this.readDeadline=new F.Time.ptr(new $Uint64(0,0),new $Int64(0,0),V.nil);return;}this.WebSocket=WebSocket_;this.ch=ch_;this.readBuf=readBuf_;this.readDeadline=readDeadline_;});Q=$pkg.messageEvent=$newType(0,$kindStruct,"websocket.messageEvent",true,"github.com/v2fly/BrowserBridge/vendor/github.com/gopherjs/websocket",false,function(Object_,Data_){this.$val=this;if(arguments.length===0){this.Object=null;this.Data=null;return;}this.Object=Object_;this.Data=Data_;});S=$sliceType($emptyInterface);T=$ptrType(H.WebSocket);U=$ptrType(B.Reader);V=$ptrType(F.Location);W=$ptrType(Q);X=$sliceType($Uint8);Y=$ptrType(A.URL);Z=$ptrType(I);AA=$ptrType(K);AB=$ptrType(G.Object);AC=$ptrType(M);AD=$ptrType(P);AE=$chanType(W,false,false);I.ptr.prototype.Network=function(){var a;a=this;return"websocket";};I.prototype.Network=function(){return this.$val.Network();};J=function(a,b){var a,b;return(function $b(c){var c,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;c=$f.c;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=b();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$close(a);$s=-1;return;}return;}if($f===undefined){$f={$blk:$b};}$f.c=c;$f.$s=$s;$f.$r=$r;return $f;});};K.ptr.prototype.Error=function(){var a,b,c,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=this;b="";if(!!(a.Object.wasClean)){b="clean";}else{b="unclean";}c=C.Sprintf("CloseEvent: (%s) (%d) %s",new S([new $String(b),new $Int(($parseInt(a.Object.code)>>0)),new $String($internalize(a.Object.reason,$String))]));$s=1;case 1:if($c){$c=false;c=c.$blk();}if(c&&c.$blk!==undefined){break s;}$s=-1;return c;}return;}if($f===undefined){$f={$blk:K.ptr.prototype.Error};}$f.a=a;$f.b=b;$f.c=c;$f.$s=$s;$f.$r=$r;return $f;};K.prototype.Error=function(){return this.$val.Error();};L=function(a,b){var a,b;return(function $b(c){var c,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;c=$f.c;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:c=[c];$r=b();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$go((function(c){return function $b(){var $s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=$send(a,new K.ptr(c[0],0,"",false));$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$close(a);$s=-1;return;}return;}if($f===undefined){$f={$blk:$b};}$f.$s=$s;$f.$r=$r;return $f;};})(c),[]);$s=-1;return;}return;}if($f===undefined){$f={$blk:$b};}$f.c=c;$f.$s=$s;$f.$r=$r;return $f;});};M.ptr.prototype.Error=function(){var a;a=this;return"i/o timeout: deadline reached";};M.prototype.Error=function(){return this.$val.Error();};M.ptr.prototype.Timeout=function(){var a;a=this;return true;};M.prototype.Timeout=function(){return this.$val.Timeout();};M.ptr.prototype.Temporary=function(){var a;a=this;return true;};M.prototype.Temporary=function(){return this.$val.Temporary();};O=function(a){var a,b,c,d,e,f,g,h,i,j,k,l,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=[b];c=[c];d=[d];e=H.New(a);d[0]=e[0];f=e[1];if(!($interfaceIsEqual(f,$ifaceNil))){$s=-1;return[$ifaceNil,f];}g=new P.ptr(d[0],new $Chan(W,1),U.nil,new F.Time.ptr(new $Uint64(0,0),new $Int64(0,0),V.nil));g.initialize();h=new $Chan($error,1);c[0]=$throwNilPointerError;b[0]=$throwNilPointerError;i=(function(b,c,d){return function(){d[0].RemoveEventListener("open",false,c[0]);d[0].RemoveEventListener("close",false,b[0]);};})(b,c,d);c[0]=J(h,i);b[0]=L(h,i);d[0].AddEventListener("open",false,c[0]);d[0].AddEventListener("close",false,b[0]);k=$recv(h);$s=1;case 1:if($c){$c=false;k=k.$blk();}if(k&&k.$blk!==undefined){break s;}j=k;f=j[0];l=j[1];if(l&&!($interfaceIsEqual(f,$ifaceNil))){$s=-1;return[$ifaceNil,f];}$s=-1;return[g,$ifaceNil];}return;}if($f===undefined){$f={$blk:O};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.l=l;$f.$s=$s;$f.$r=$r;return $f;};$pkg.Dial=O;P.ptr.prototype.onMessage=function(a){var a,b;b=this;$go((function $b(){var $s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=$send(b.ch,new Q.ptr(a,null));$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return;}return;}if($f===undefined){$f={$blk:$b};}$f.$s=$s;$f.$r=$r;return $f;}),[]);};P.prototype.onMessage=function(a){return this.$val.onMessage(a);};P.ptr.prototype.onClose=function(a){var a,b;b=this;$go((function $b(){var $s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=$send(b.ch,W.nil);$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return;}return;}if($f===undefined){$f={$blk:$b};}$f.$s=$s;$f.$r=$r;return $f;}),[]);};P.prototype.onClose=function(a){return this.$val.onClose(a);};P.ptr.prototype.initialize=function(){var a;a=this;a.WebSocket.Object.binaryType=$externalize("arraybuffer",$String);a.WebSocket.AddEventListener("message",false,$methodVal(a,"onMessage"));a.WebSocket.AddEventListener("close",false,$methodVal(a,"onClose"));};P.prototype.initialize=function(){return this.$val.initialize();};P.ptr.prototype.handleFrame=function(a,b){var a,b,c;c=this;if(!b){return[W.nil,D.EOF];}else if(a===W.nil){$close(c.ch);return[W.nil,D.EOF];}return[a,$ifaceNil];};P.prototype.handleFrame=function(a,b){return this.$val.handleFrame(a,b);};P.ptr.prototype.receiveFrame=function(a){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,$s,$deferred,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;$s=$f.$s;$deferred=$f.$deferred;$r=$f.$r;}var $err=null;try{s:while(true){switch($s){case 0:$deferred=[];$deferred.index=$curGoroutine.deferStack.length;$curGoroutine.deferStack.push($deferred);b=this;c=$chanNil;if(a&&!$clone(b.readDeadline,F.Time).IsZero()){$s=1;continue;}$s=2;continue;case 1:d=$clone(F.Now(),F.Time);if($clone(d,F.Time).After($clone(b.readDeadline,F.Time))){e=$select([[b.ch],[]]);if(e[0]===0){f=e[1];g=f[0];h=f[1];$s=-1;return b.handleFrame(g,h);}else if(e[0]===1){$s=-1;return[W.nil,N];}}i=F.NewTimer($clone(b.readDeadline,F.Time).Sub($clone(d,F.Time)));$deferred.push([$methodVal(i,"Stop"),[]]);c=i.C;case 2:k=$select([[b.ch],[c]]);$s=3;case 3:if($c){$c=false;k=k.$blk();}if(k&&k.$blk!==undefined){break s;}j=k;if(j[0]===0){l=j[1];m=l[0];n=l[1];$s=-1;return b.handleFrame(m,n);}else if(j[0]===1){$s=-1;return[W.nil,N];}$s=-1;return[W.nil,$ifaceNil];}return;}}catch(err){$err=err;$s=-1;return[W.nil,$ifaceNil];}finally{$callDeferred($deferred,$err);if($curGoroutine.asleep){if($f===undefined){$f={$blk:P.ptr.prototype.receiveFrame};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.l=l;$f.m=m;$f.n=n;$f.$s=$s;$f.$deferred=$deferred;$f.$r=$r;return $f;}}};P.prototype.receiveFrame=function(a){return this.$val.receiveFrame(a);};R=function(a){var a,b,c;b=a.constructor;if(b===$global.ArrayBuffer){c=new($global.Uint8Array)(a);return $assertType($internalize(c,$emptyInterface),X);}return(new X($stringToBytes($internalize(a,$String))));};P.ptr.prototype.Read=function(a){var a,b,c,d,e,f,g,h,i,j,k,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=0;c=$ifaceNil;d=this;if(!(d.readBuf===U.nil)){e=d.readBuf.Read(a);b=e[0];c=e[1];if($interfaceIsEqual(c,D.EOF)){d.readBuf=U.nil;c=$ifaceNil;}if(b>0){$s=-1;return[b,c];}}g=d.receiveFrame(true);$s=1;case 1:if($c){$c=false;g=g.$blk();}if(g&&g.$blk!==undefined){break s;}f=g;h=f[0];c=f[1];if(!($interfaceIsEqual(c,$ifaceNil))){i=0;j=c;b=i;c=j;$s=-1;return[b,c];}k=R(h.Object.data);b=$copySlice(a,k);if(b>=k.$length){$s=-1;return[b,c];}d.readBuf=B.NewReader($subslice(k,b));$s=-1;return[b,c];}return;}if($f===undefined){$f={$blk:P.ptr.prototype.Read};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.$s=$s;$f.$r=$r;return $f;};P.prototype.Read=function(a){return this.$val.Read(a);};P.ptr.prototype.Write=function(a){var a,b,c,d,e,f,g,h;b=0;c=$ifaceNil;d=this;c=d.WebSocket.Send(a);if(!($interfaceIsEqual(c,$ifaceNil))){e=0;f=c;b=e;c=f;return[b,c];}g=a.$length;h=$ifaceNil;b=g;c=h;return[b,c];};P.prototype.Write=function(a){return this.$val.Write(a);};P.ptr.prototype.LocalAddr=function(){var a;a=this;$panic(new $String("we are unable to implement websocket.conn.LocalAddr() due to limitations in the underlying JavaScript API"));};P.prototype.LocalAddr=function(){return this.$val.LocalAddr();};P.ptr.prototype.RemoteAddr=function(){var a,b,c,d,e,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=this;c=A.Parse($internalize(a.WebSocket.Object.url,$String));$s=1;case 1:if($c){$c=false;c=c.$blk();}if(c&&c.$blk!==undefined){break s;}b=c;d=b[0];e=b[1];if(!($interfaceIsEqual(e,$ifaceNil))){$panic(e);}$s=-1;return new I.ptr(d);}return;}if($f===undefined){$f={$blk:P.ptr.prototype.RemoteAddr};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.$s=$s;$f.$r=$r;return $f;};P.prototype.RemoteAddr=function(){return this.$val.RemoteAddr();};P.ptr.prototype.SetDeadline=function(a){var a,b;b=this;F.Time.copy(b.readDeadline,a);return $ifaceNil;};P.prototype.SetDeadline=function(a){return this.$val.SetDeadline(a);};P.ptr.prototype.SetReadDeadline=function(a){var a,b;b=this;F.Time.copy(b.readDeadline,a);return $ifaceNil;};P.prototype.SetReadDeadline=function(a){return this.$val.SetReadDeadline(a);};P.ptr.prototype.SetWriteDeadline=function(a){var a,b;b=this;return $ifaceNil;};P.prototype.SetWriteDeadline=function(a){return this.$val.SetWriteDeadline(a);};Z.methods=[{prop:"Network",name:"Network",pkg:"",typ:$funcType([],[$String],false)}];AA.methods=[{prop:"Error",name:"Error",pkg:"",typ:$funcType([],[$String],false)}];AC.methods=[{prop:"Error",name:"Error",pkg:"",typ:$funcType([],[$String],false)},{prop:"Timeout",name:"Timeout",pkg:"",typ:$funcType([],[$Bool],false)},{prop:"Temporary",name:"Temporary",pkg:"",typ:$funcType([],[$Bool],false)}];AD.methods=[{prop:"onMessage",name:"onMessage",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/gopherjs/websocket",typ:$funcType([AB],[],false)},{prop:"onClose",name:"onClose",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/gopherjs/websocket",typ:$funcType([AB],[],false)},{prop:"initialize",name:"initialize",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/gopherjs/websocket",typ:$funcType([],[],false)},{prop:"handleFrame",name:"handleFrame",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/gopherjs/websocket",typ:$funcType([W,$Bool],[W,$error],false)},{prop:"receiveFrame",name:"receiveFrame",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/gopherjs/websocket",typ:$funcType([$Bool],[W,$error],false)},{prop:"Read",name:"Read",pkg:"",typ:$funcType([X],[$Int,$error],false)},{prop:"Write",name:"Write",pkg:"",typ:$funcType([X],[$Int,$error],false)},{prop:"LocalAddr",name:"LocalAddr",pkg:"",typ:$funcType([],[E.Addr],false)},{prop:"RemoteAddr",name:"RemoteAddr",pkg:"",typ:$funcType([],[E.Addr],false)},{prop:"SetDeadline",name:"SetDeadline",pkg:"",typ:$funcType([F.Time],[$error],false)},{prop:"SetReadDeadline",name:"SetReadDeadline",pkg:"",typ:$funcType([F.Time],[$error],false)},{prop:"SetWriteDeadline",name:"SetWriteDeadline",pkg:"",typ:$funcType([F.Time],[$error],false)}];I.init("",[{prop:"URL",name:"URL",embedded:true,exported:true,typ:Y,tag:""}]);K.init("",[{prop:"Object",name:"Object",embedded:true,exported:true,typ:AB,tag:""},{prop:"Code",name:"Code",embedded:false,exported:true,typ:$Int,tag:"js:\"code\""},{prop:"Reason",name:"Reason",embedded:false,exported:true,typ:$String,tag:"js:\"reason\""},{prop:"WasClean",name:"WasClean",embedded:false,exported:true,typ:$Bool,tag:"js:\"wasClean\""}]);M.init("",[]);P.init("github.com/v2fly/BrowserBridge/vendor/github.com/gopherjs/websocket",[{prop:"WebSocket",name:"WebSocket",embedded:true,exported:true,typ:T,tag:""},{prop:"ch",name:"ch",embedded:false,exported:false,typ:AE,tag:""},{prop:"readBuf",name:"readBuf",embedded:false,exported:false,typ:U,tag:""},{prop:"readDeadline",name:"readDeadline",embedded:false,exported:false,typ:F.Time,tag:""}]);Q.init("",[{prop:"Object",name:"Object",embedded:true,exported:true,typ:AB,tag:""},{prop:"Data",name:"Data",embedded:false,exported:true,typ:AB,tag:"js:\"data\""}]);$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=B.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=C.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=G.$init();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=H.$init();$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=D.$init();$s=5;case 5:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=E.$init();$s=6;case 6:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=A.$init();$s=7;case 7:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=F.$init();$s=8;case 8:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}N=new M.ptr();}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})(); $packages["container/heap"]=(function(){var $pkg={},$init,A,D,E,H,I;A=$packages["sort"];D=function(a,b){var a,b,c,d,e,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=a.Push(b);$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}c=a;d=a.Len();$s=2;case 2:if($c){$c=false;d=d.$blk();}if(d&&d.$blk!==undefined){break s;}e=d-1>>0;$r=H(c,e);$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return;}return;}if($f===undefined){$f={$blk:D};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.$s=$s;$f.$r=$r;return $f;};$pkg.Push=D;E=function(a){var a,b,c,d,e,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=a.Len();$s=1;case 1:if($c){$c=false;b=b.$blk();}if(b&&b.$blk!==undefined){break s;}c=b-1>>0;$r=a.Swap(0,c);$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}d=I(a,0,c);$s=3;case 3:if($c){$c=false;d=d.$blk();}if(d&&d.$blk!==undefined){break s;}d;e=a.Pop();$s=4;case 4:if($c){$c=false;e=e.$blk();}if(e&&e.$blk!==undefined){break s;}$s=-1;return e;}return;}if($f===undefined){$f={$blk:E};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.$s=$s;$f.$r=$r;return $f;};$pkg.Pop=E;H=function(a,b){var a,b,c,d,e,f,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:case 1:d=(c=((b-1>>0))/2,(c===c&&c!==1/0&&c!==-1/0)?c>>0:$throwRuntimeError("integer divide by zero"));if(d===b){e=true;$s=5;continue s;}f=a.Less(b,d);$s=6;case 6:if($c){$c=false;f=f.$blk();}if(f&&f.$blk!==undefined){break s;}e=!f;case 5:if(e){$s=3;continue;}$s=4;continue;case 3:$s=2;continue;case 4:$r=a.Swap(d,b);$s=7;case 7:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}b=d;$s=1;continue;case 2:$s=-1;return;}return;}if($f===undefined){$f={$blk:H};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.$s=$s;$f.$r=$r;return $f;};I=function(a,b,c){var a,b,c,d,e,f,g,h,i,j,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:d=b;case 1:e=($imul(2,d))+1>>0;if(e>=c||e<0){$s=2;continue;}f=e;g=e+1>>0;if(!(gb;}return;}if($f===undefined){$f={$blk:I};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.$s=$s;$f.$r=$r;return $f;};$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})(); $packages["github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux"]=(function(){var $pkg={},$init,H,C,A,D,E,F,I,B,J,G,N,Q,S,T,U,Z,AA,AB,AC,AE,AF,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR,AS,AT,AU,AV,AW,AX,AY,AZ,BA,BB,BC,BD,K,L,M,O,P,R,V,W,Y,AD,AG;H=$packages["container/heap"];C=$packages["encoding/binary"];A=$packages["errors"];D=$packages["fmt"];E=$packages["io"];F=$packages["math"];I=$packages["net"];B=$packages["sync"];J=$packages["sync/atomic"];G=$packages["time"];N=$pkg.Allocator=$newType(0,$kindStruct,"smux.Allocator",true,"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",true,function(buffers_){this.$val=this;if(arguments.length===0){this.buffers=AI.nil;return;}this.buffers=buffers_;});Q=$pkg.Frame=$newType(0,$kindStruct,"smux.Frame",true,"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",true,function(ver_,cmd_,sid_,data_){this.$val=this;if(arguments.length===0){this.ver=0;this.cmd=0;this.sid=0;this.data=AJ.nil;return;}this.ver=ver_;this.cmd=cmd_;this.sid=sid_;this.data=data_;});S=$pkg.rawHeader=$newType(8,$kindArray,"smux.rawHeader",true,"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",false,null);T=$pkg.updHeader=$newType(8,$kindArray,"smux.updHeader",true,"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",false,null);U=$pkg.Config=$newType(0,$kindStruct,"smux.Config",true,"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",true,function(Version_,KeepAliveDisabled_,KeepAliveInterval_,KeepAliveTimeout_,MaxFrameSize_,MaxReceiveBuffer_,MaxStreamBuffer_){this.$val=this;if(arguments.length===0){this.Version=0;this.KeepAliveDisabled=false;this.KeepAliveInterval=new G.Duration(0,0);this.KeepAliveTimeout=new G.Duration(0,0);this.MaxFrameSize=0;this.MaxReceiveBuffer=0;this.MaxStreamBuffer=0;return;}this.Version=Version_;this.KeepAliveDisabled=KeepAliveDisabled_;this.KeepAliveInterval=KeepAliveInterval_;this.KeepAliveTimeout=KeepAliveTimeout_;this.MaxFrameSize=MaxFrameSize_;this.MaxReceiveBuffer=MaxReceiveBuffer_;this.MaxStreamBuffer=MaxStreamBuffer_;});Z=$pkg.writeRequest=$newType(0,$kindStruct,"smux.writeRequest",true,"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",false,function(prio_,frame_,result_){this.$val=this;if(arguments.length===0){this.prio=new $Uint64(0,0);this.frame=new Q.ptr(0,0,0,AJ.nil);this.result=$chanNil;return;}this.prio=prio_;this.frame=frame_;this.result=result_;});AA=$pkg.writeResult=$newType(0,$kindStruct,"smux.writeResult",true,"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",false,function(n_,err_){this.$val=this;if(arguments.length===0){this.n=0;this.err=$ifaceNil;return;}this.n=n_;this.err=err_;});AB=$pkg.buffersWriter=$newType(8,$kindInterface,"smux.buffersWriter",true,"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",false,null);AC=$pkg.Session=$newType(0,$kindStruct,"smux.Session",true,"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",true,function(conn_,config_,nextStreamID_,nextStreamIDLock_,bucket_,bucketNotify_,streams_,streamLock_,die_,dieOnce_,socketReadError_,socketWriteError_,chSocketReadError_,chSocketWriteError_,socketReadErrorOnce_,socketWriteErrorOnce_,protoError_,chProtoError_,protoErrorOnce_,chAccepts_,dataReady_,goAway_,deadline_,shaper_,writes_){this.$val=this;if(arguments.length===0){this.conn=$ifaceNil;this.config=AL.nil;this.nextStreamID=0;this.nextStreamIDLock=new B.Mutex.ptr(0,0);this.bucket=0;this.bucketNotify=$chanNil;this.streams=false;this.streamLock=new B.Mutex.ptr(0,0);this.die=$chanNil;this.dieOnce=new B.Once.ptr(new B.Mutex.ptr(0,0),0);this.socketReadError=new J.Value.ptr($ifaceNil);this.socketWriteError=new J.Value.ptr($ifaceNil);this.chSocketReadError=$chanNil;this.chSocketWriteError=$chanNil;this.socketReadErrorOnce=new B.Once.ptr(new B.Mutex.ptr(0,0),0);this.socketWriteErrorOnce=new B.Once.ptr(new B.Mutex.ptr(0,0),0);this.protoError=new J.Value.ptr($ifaceNil);this.chProtoError=$chanNil;this.protoErrorOnce=new B.Once.ptr(new B.Mutex.ptr(0,0),0);this.chAccepts=$chanNil;this.dataReady=0;this.goAway=0;this.deadline=new J.Value.ptr($ifaceNil);this.shaper=$chanNil;this.writes=$chanNil;return;}this.conn=conn_;this.config=config_;this.nextStreamID=nextStreamID_;this.nextStreamIDLock=nextStreamIDLock_;this.bucket=bucket_;this.bucketNotify=bucketNotify_;this.streams=streams_;this.streamLock=streamLock_;this.die=die_;this.dieOnce=dieOnce_;this.socketReadError=socketReadError_;this.socketWriteError=socketWriteError_;this.chSocketReadError=chSocketReadError_;this.chSocketWriteError=chSocketWriteError_;this.socketReadErrorOnce=socketReadErrorOnce_;this.socketWriteErrorOnce=socketWriteErrorOnce_;this.protoError=protoError_;this.chProtoError=chProtoError_;this.protoErrorOnce=protoErrorOnce_;this.chAccepts=chAccepts_;this.dataReady=dataReady_;this.goAway=goAway_;this.deadline=deadline_;this.shaper=shaper_;this.writes=writes_;});AE=$pkg.shaperHeap=$newType(12,$kindSlice,"smux.shaperHeap",true,"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",false,null);AF=$pkg.Stream=$newType(0,$kindStruct,"smux.Stream",true,"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",true,function(id_,sess_,buffers_,heads_,bufferLock_,frameSize_,chReadEvent_,die_,dieOnce_,chFinEvent_,finEventOnce_,readDeadline_,writeDeadline_,numRead_,numWritten_,incr_,peerConsumed_,peerWindow_,chUpdate_){this.$val=this;if(arguments.length===0){this.id=0;this.sess=AM.nil;this.buffers=AU.nil;this.heads=AU.nil;this.bufferLock=new B.Mutex.ptr(0,0);this.frameSize=0;this.chReadEvent=$chanNil;this.die=$chanNil;this.dieOnce=new B.Once.ptr(new B.Mutex.ptr(0,0),0);this.chFinEvent=$chanNil;this.finEventOnce=new B.Once.ptr(new B.Mutex.ptr(0,0),0);this.readDeadline=new J.Value.ptr($ifaceNil);this.writeDeadline=new J.Value.ptr($ifaceNil);this.numRead=0;this.numWritten=0;this.incr=0;this.peerConsumed=0;this.peerWindow=0;this.chUpdate=$chanNil;return;}this.id=id_;this.sess=sess_;this.buffers=buffers_;this.heads=heads_;this.bufferLock=bufferLock_;this.frameSize=frameSize_;this.chReadEvent=chReadEvent_;this.die=die_;this.dieOnce=dieOnce_;this.chFinEvent=chFinEvent_;this.finEventOnce=finEventOnce_;this.readDeadline=readDeadline_;this.writeDeadline=writeDeadline_;this.numRead=numRead_;this.numWritten=numWritten_;this.incr=incr_;this.peerConsumed=peerConsumed_;this.peerWindow=peerWindow_;this.chUpdate=chUpdate_;});AH=$ptrType(N);AI=$sliceType(B.Pool);AJ=$sliceType($Uint8);AK=$sliceType($emptyInterface);AL=$ptrType(U);AM=$ptrType(AC);AN=$structType("",[]);AO=$ptrType(AF);AP=$interfaceType([{prop:"LocalAddr",name:"LocalAddr",pkg:"",typ:$funcType([],[I.Addr],false)}]);AQ=$interfaceType([{prop:"RemoteAddr",name:"RemoteAddr",pkg:"",typ:$funcType([],[I.Addr],false)}]);AR=$ptrType($Int32);AS=$arrayType($Uint8,8);AT=$ptrType(AE);AU=$sliceType(AJ);AV=$ptrType(G.Timer);AW=$ptrType($Uint32);AX=$chanType(AA,false,false);AY=$chanType(G.Time,false,true);AZ=$chanType(AN,false,false);BA=$mapType($Uint32,AO);BB=$chanType(AO,false,false);BC=$chanType(Z,false,false);BD=$chanType(AN,false,true);M=function(){K=O();};O=function(){var a,b,c,d,e,f;a=new N.ptr(AI.nil);a.buffers=$makeSlice(AI,17);b=a.buffers;c=0;while(true){if(!(c=f.$length)?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+e])).New=(function(d){return function(){var f;return $makeSlice(AJ,((f=((d[0]>>>0)),f<32?(1<>0));};})(d);c++;}return a;};$pkg.NewAllocator=O;N.ptr.prototype.Get=function(a){var a,b,c,d,e,f,g,h,i,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=this;if(a<=0||a>65536){$s=-1;return AJ.nil;}c=P(a);if(a===((d=c,d<32?(1<>0)){$s=1;continue;}$s=2;continue;case 1:f=(e=b.buffers,((c<0||c>=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+c])).Get();$s=4;case 4:if($c){$c=false;f=f.$blk();}if(f&&f.$blk!==undefined){break s;}$s=-1;return $subslice($assertType(f,AJ),0,a);case 2:i=(g=b.buffers,h=c+1<<24>>>24,((h<0||h>=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+h])).Get();$s=5;case 5:if($c){$c=false;i=i.$blk();}if(i&&i.$blk!==undefined){break s;}$s=-1;return $subslice($assertType(i,AJ),0,a);case 3:$s=-1;return AJ.nil;}return;}if($f===undefined){$f={$blk:N.ptr.prototype.Get};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.$s=$s;$f.$r=$r;return $f;};N.prototype.Get=function(a){return this.$val.Get(a);};N.ptr.prototype.Put=function(a){var a,b,c,d,e;b=this;c=P(a.$capacity);if((a.$capacity===0)||a.$capacity>65536||!((a.$capacity===((d=c,d<32?(1<>0)))){return A.New("allocator Put() incorrect buffer size");}(e=b.buffers,((c<0||c>=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+c])).Put(a);return $ifaceNil;};N.prototype.Put=function(a){return this.$val.Put(a);};P=function(a){var a,b,c;b=((a>>>0));b=(b|((b>>>1>>>0)))>>>0;b=(b|((b>>>2>>>0)))>>>0;b=(b|((b>>>4>>>0)))>>>0;b=(b|((b>>>8>>>0)))>>>0;b=(b|((b>>>16>>>0)))>>>0;return(c=(($imul(b,130329821)>>>0))>>>27>>>0,((c<0||c>=L.length)?($throwRuntimeError("index out of range"),undefined):L[c]));};R=function(a,b,c){var a,b,c;return new Q.ptr(a,b,c,AJ.nil);};S.prototype.Version=function(){var a;a=this.$val;return a[0];};$ptrType(S).prototype.Version=function(){return new S(this.$get()).Version();};S.prototype.Cmd=function(){var a;a=this.$val;return a[1];};$ptrType(S).prototype.Cmd=function(){return new S(this.$get()).Cmd();};S.prototype.Length=function(){var a;a=this.$val;return $clone(C.LittleEndian,C.littleEndian).Uint16($subslice(new AJ(a),2));};$ptrType(S).prototype.Length=function(){return new S(this.$get()).Length();};S.prototype.StreamID=function(){var a;a=this.$val;return $clone(C.LittleEndian,C.littleEndian).Uint32($subslice(new AJ(a),4));};$ptrType(S).prototype.StreamID=function(){return new S(this.$get()).StreamID();};S.prototype.String=function(){var a,b,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=this.$val;b=D.Sprintf("Version:%d Cmd:%d StreamID:%d Length:%d",new AK([new $Uint8(new S($clone(a,S)).Version()),new $Uint8(new S($clone(a,S)).Cmd()),new $Uint32(new S($clone(a,S)).StreamID()),new $Uint16(new S($clone(a,S)).Length())]));$s=1;case 1:if($c){$c=false;b=b.$blk();}if(b&&b.$blk!==undefined){break s;}$s=-1;return b;}return;}if($f===undefined){$f={$blk:S.prototype.String};}$f.a=a;$f.b=b;$f.$s=$s;$f.$r=$r;return $f;};$ptrType(S).prototype.String=function(){return new S(this.$get()).String();};T.prototype.Consumed=function(){var a;a=this.$val;return $clone(C.LittleEndian,C.littleEndian).Uint32(new AJ(a));};$ptrType(T).prototype.Consumed=function(){return new T(this.$get()).Consumed();};T.prototype.Window=function(){var a;a=this.$val;return $clone(C.LittleEndian,C.littleEndian).Uint32($subslice(new AJ(a),4));};$ptrType(T).prototype.Window=function(){return new T(this.$get()).Window();};V=function(){return new U.ptr(1,false,new G.Duration(2,1410065408),new G.Duration(6,4230196224),32768,4194304,65536);};$pkg.DefaultConfig=V;W=function(a){var a,b,c,d,e,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:if(!((a.Version===1)||(a.Version===2))){$s=-1;return A.New("unsupported protocol version");}if(!a.KeepAliveDisabled){$s=1;continue;}$s=2;continue;case 1:if((b=a.KeepAliveInterval,(b.$high===0&&b.$low===0))){$s=-1;return A.New("keep-alive interval must be positive");}if((c=a.KeepAliveTimeout,d=a.KeepAliveInterval,(c.$high65535){$s=-1;return A.New("max frame size must not be larger than 65535");}if(a.MaxReceiveBuffer<=0){$s=-1;return A.New("max receive buffer must be positive");}if(a.MaxStreamBuffer<=0){$s=-1;return A.New("max stream buffer must be positive");}if(a.MaxStreamBuffer>a.MaxReceiveBuffer){$s=-1;return A.New("max stream buffer must not be larger than max receive buffer");}if(a.MaxStreamBuffer>2147483647){$s=-1;return A.New("max stream buffer cannot be larger than 2147483647");}$s=-1;return $ifaceNil;}return;}if($f===undefined){$f={$blk:W};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.$s=$s;$f.$r=$r;return $f;};$pkg.VerifyConfig=W;Y=function(a,b){var a,b,c,d,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:if(b===AL.nil){b=V();}c=W(b);$s=1;case 1:if($c){$c=false;c=c.$blk();}if(c&&c.$blk!==undefined){break s;}d=c;if(!($interfaceIsEqual(d,$ifaceNil))){$s=-1;return[AM.nil,d];}$s=-1;return[AD(b,a,true),$ifaceNil];}return;}if($f===undefined){$f={$blk:Y};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.$s=$s;$f.$r=$r;return $f;};$pkg.Client=Y;AD=function(a,b,c){var a,b,c,d;d=new AC.ptr($ifaceNil,AL.nil,0,new B.Mutex.ptr(0,0),0,$chanNil,false,new B.Mutex.ptr(0,0),$chanNil,new B.Once.ptr(new B.Mutex.ptr(0,0),0),new J.Value.ptr($ifaceNil),new J.Value.ptr($ifaceNil),$chanNil,$chanNil,new B.Once.ptr(new B.Mutex.ptr(0,0),0),new B.Once.ptr(new B.Mutex.ptr(0,0),0),new J.Value.ptr($ifaceNil),$chanNil,new B.Once.ptr(new B.Mutex.ptr(0,0),0),$chanNil,0,0,new J.Value.ptr($ifaceNil),$chanNil,$chanNil);d.die=new $Chan(AN,0);d.conn=b;d.config=a;d.streams={};d.chAccepts=new $Chan(AO,1024);d.bucket=((a.MaxReceiveBuffer>>0));d.bucketNotify=new $Chan(AN,1);d.shaper=new $Chan(Z,0);d.writes=new $Chan(Z,0);d.chSocketReadError=new $Chan(AN,0);d.chSocketWriteError=new $Chan(AN,0);d.chProtoError=new $Chan(AN,0);if(c){d.nextStreamID=1;}else{d.nextStreamID=0;}$go($methodVal(d,"shaperLoop"),[]);$go($methodVal(d,"recvLoop"),[]);$go($methodVal(d,"sendLoop"),[]);if(!a.KeepAliveDisabled){$go($methodVal(d,"keepalive"),[]);}return d;};AC.ptr.prototype.OpenStream=function(){var a,b,c,d,e,f,g,h,i,$s,$deferred,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;$s=$f.$s;$deferred=$f.$deferred;$r=$f.$r;}var $err=null;try{s:while(true){switch($s){case 0:$deferred=[];$deferred.index=$curGoroutine.deferStack.length;$curGoroutine.deferStack.push($deferred);a=this;if(a.IsClosed()){$s=-1;return[AO.nil,E.ErrClosedPipe];}$r=a.nextStreamIDLock.Lock();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}if(a.goAway>0){$s=2;continue;}$s=3;continue;case 2:$r=a.nextStreamIDLock.Unlock();$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return[AO.nil,$pkg.ErrGoAway];case 3:a.nextStreamID=a.nextStreamID+(2)>>>0;b=a.nextStreamID;if(b===(c=b%2,c===c?c:$throwRuntimeError("integer divide by zero"))){$s=5;continue;}$s=6;continue;case 5:a.goAway=1;$r=a.nextStreamIDLock.Unlock();$s=7;case 7:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return[AO.nil,$pkg.ErrGoAway];case 6:$r=a.nextStreamIDLock.Unlock();$s=8;case 8:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}d=AG(b,a.config.MaxFrameSize,a);f=a.writeFrame($clone(R(((a.config.Version<<24>>>24)),0,b),Q));$s=9;case 9:if($c){$c=false;f=f.$blk();}if(f&&f.$blk!==undefined){break s;}e=f;g=e[1];if(!($interfaceIsEqual(g,$ifaceNil))){$s=-1;return[AO.nil,g];}$r=a.streamLock.Lock();$s=10;case 10:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$deferred.push([$methodVal(a.streamLock,"Unlock"),[]]);h=$select([[a.chSocketReadError],[a.chSocketWriteError],[a.die],[]]);if(h[0]===0){$s=-1;return[AO.nil,$assertType(a.socketReadError.Load(),$error)];}else if(h[0]===1){$s=-1;return[AO.nil,$assertType(a.socketWriteError.Load(),$error)];}else if(h[0]===2){$s=-1;return[AO.nil,E.ErrClosedPipe];}else if(h[0]===3){i=b;(a.streams||$throwRuntimeError("assignment to entry in nil map"))[$Uint32.keyFor(i)]={k:i,v:d};$s=-1;return[d,$ifaceNil];}$s=-1;return[AO.nil,$ifaceNil];}return;}}catch(err){$err=err;$s=-1;return[AO.nil,$ifaceNil];}finally{$callDeferred($deferred,$err);if($curGoroutine.asleep){if($f===undefined){$f={$blk:AC.ptr.prototype.OpenStream};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.$s=$s;$f.$deferred=$deferred;$f.$r=$r;return $f;}}};AC.prototype.OpenStream=function(){return this.$val.OpenStream();};AC.ptr.prototype.Open=function(){var a,b,c,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=this;b=a.OpenStream();$s=1;case 1:if($c){$c=false;b=b.$blk();}if(b&&b.$blk!==undefined){break s;}c=b;$s=-1;return[c[0],c[1]];}return;}if($f===undefined){$f={$blk:AC.ptr.prototype.Open};}$f.a=a;$f.b=b;$f.c=c;$f.$s=$s;$f.$r=$r;return $f;};AC.prototype.Open=function(){return this.$val.Open();};AC.ptr.prototype.AcceptStream=function(){var a,b,c,d,e,f,g,h,i,$s,$deferred,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;$s=$f.$s;$deferred=$f.$deferred;$r=$f.$r;}var $err=null;try{s:while(true){switch($s){case 0:$deferred=[];$deferred.index=$curGoroutine.deferStack.length;$curGoroutine.deferStack.push($deferred);a=this;b=$chanNil;c=$assertType(a.deadline.Load(),G.Time,true);d=$clone(c[0],G.Time);e=c[1];if(e&&!$clone(d,G.Time).IsZero()){f=G.NewTimer(G.Until($clone(d,G.Time)));$deferred.push([$methodVal(f,"Stop"),[]]);b=f.C;}h=$select([[a.chAccepts],[b],[a.chSocketReadError],[a.chProtoError],[a.die]]);$s=1;case 1:if($c){$c=false;h=h.$blk();}if(h&&h.$blk!==undefined){break s;}g=h;if(g[0]===0){i=g[1][0];$s=-1;return[i,$ifaceNil];}else if(g[0]===1){$s=-1;return[AO.nil,$pkg.ErrTimeout];}else if(g[0]===2){$s=-1;return[AO.nil,$assertType(a.socketReadError.Load(),$error)];}else if(g[0]===3){$s=-1;return[AO.nil,$assertType(a.protoError.Load(),$error)];}else if(g[0]===4){$s=-1;return[AO.nil,E.ErrClosedPipe];}$s=-1;return[AO.nil,$ifaceNil];}return;}}catch(err){$err=err;$s=-1;return[AO.nil,$ifaceNil];}finally{$callDeferred($deferred,$err);if($curGoroutine.asleep){if($f===undefined){$f={$blk:AC.ptr.prototype.AcceptStream};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.$s=$s;$f.$deferred=$deferred;$f.$r=$r;return $f;}}};AC.prototype.AcceptStream=function(){return this.$val.AcceptStream();};AC.ptr.prototype.Accept=function(){var a,b,c,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=this;b=a.AcceptStream();$s=1;case 1:if($c){$c=false;b=b.$blk();}if(b&&b.$blk!==undefined){break s;}c=b;$s=-1;return[c[0],c[1]];}return;}if($f===undefined){$f={$blk:AC.ptr.prototype.Accept};}$f.a=a;$f.b=b;$f.c=c;$f.$s=$s;$f.$r=$r;return $f;};AC.prototype.Accept=function(){return this.$val.Accept();};AC.ptr.prototype.Close=function(){var a,b,c,d,e,f,g,h,i,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=[a];b=[b];b[0]=this;a[0]=false;$r=b[0].dieOnce.Do((function(a,b){return function(){$close(b[0].die);a[0]=true;};})(a,b));$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}if(a[0]){$s=2;continue;}$s=3;continue;case 2:$r=b[0].streamLock.Lock();$s=5;case 5:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}c=b[0].streams;d=0;e=$keys(c);case 6:if(!(d0){if(J.AddInt32((b.$ptr_bucket||(b.$ptr_bucket=new AR(function(){return this.$target.bucket;},function($v){this.$target.bucket=$v;},b))),((e>>0)))>0){b.notifyBucket();}}delete b.streams[$Uint32.keyFor(a)];$r=b.streamLock.Unlock();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return;}return;}if($f===undefined){$f={$blk:AC.ptr.prototype.streamClosed};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.$s=$s;$f.$r=$r;return $f;};AC.prototype.streamClosed=function(a){return this.$val.streamClosed(a);};AC.ptr.prototype.returnTokens=function(a){var a,b;b=this;if(J.AddInt32((b.$ptr_bucket||(b.$ptr_bucket=new AR(function(){return this.$target.bucket;},function($v){this.$target.bucket=$v;},b))),((a>>0)))>0){b.notifyBucket();}};AC.prototype.returnTokens=function(a){return this.$val.returnTokens(a);};AC.ptr.prototype.recvLoop=function(){var a,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;aa=$f.aa;ab=$f.ab;ac=$f.ac;ad=$f.ad;ae=$f.ae;af=$f.af;ag=$f.ag;ah=$f.ah;ai=$f.ai;aj=$f.aj;ak=$f.ak;al=$f.al;am=$f.am;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;o=$f.o;p=$f.p;q=$f.q;r=$f.r;s=$f.s;t=$f.t;u=$f.u;v=$f.v;w=$f.w;x=$f.x;y=$f.y;z=$f.z;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=this;b=AS.zero();c=AS.zero();case 1:case 3:if(!(J.LoadInt32((a.$ptr_bucket||(a.$ptr_bucket=new AR(function(){return this.$target.bucket;},function($v){this.$target.bucket=$v;},a))))<=0&&!a.IsClosed())){$s=4;continue;}e=$select([[a.bucketNotify],[a.die]]);$s=5;case 5:if($c){$c=false;e=e.$blk();}if(e&&e.$blk!==undefined){break s;}d=e;if(d[0]===0){}else if(d[0]===1){$s=-1;return;}$s=3;continue;case 4:g=E.ReadFull(a.conn,new AJ(b));$s=6;case 6:if($c){$c=false;g=g.$blk();}if(g&&g.$blk!==undefined){break s;}f=g;h=f[1];if($interfaceIsEqual(h,$ifaceNil)){$s=7;continue;}$s=8;continue;case 7:J.StoreInt32((a.$ptr_dataReady||(a.$ptr_dataReady=new AR(function(){return this.$target.dataReady;},function($v){this.$target.dataReady=$v;},a))),1);if(!((new S($clone(b,S)).Version()===((a.config.Version<<24>>>24))))){$s=10;continue;}$s=11;continue;case 10:$r=a.notifyProtoError($pkg.ErrInvalidProtocol);$s=12;case 12:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return;case 11:i=new S($clone(b,S)).StreamID();j=new S($clone(b,S)).Cmd();if(j===(3)){$s=14;continue;}if(j===(0)){$s=15;continue;}if(j===(1)){$s=16;continue;}if(j===(2)){$s=17;continue;}if(j===(4)){$s=18;continue;}$s=19;continue;case 14:$s=20;continue;case 15:$r=a.streamLock.Lock();$s=21;case 21:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}k=(l=a.streams[$Uint32.keyFor(i)],l!==undefined?[l.v,true]:[AO.nil,false]);m=k[1];if(!m){$s=22;continue;}$s=23;continue;case 22:n=AG(i,a.config.MaxFrameSize,a);o=i;(a.streams||$throwRuntimeError("assignment to entry in nil map"))[$Uint32.keyFor(o)]={k:o,v:n};q=$select([[a.chAccepts,n],[a.die]]);$s=24;case 24:if($c){$c=false;q=q.$blk();}if(q&&q.$blk!==undefined){break s;}p=q;if(p[0]===0){}else if(p[0]===1){}case 23:$r=a.streamLock.Unlock();$s=25;case 25:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=20;continue;case 16:$r=a.streamLock.Lock();$s=26;case 26:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}r=(s=a.streams[$Uint32.keyFor(i)],s!==undefined?[s.v,true]:[AO.nil,false]);t=r[0];u=r[1];if(u){$s=27;continue;}$s=28;continue;case 27:$r=t.fin();$s=29;case 29:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}t.notifyReadEvent();case 28:$r=a.streamLock.Unlock();$s=30;case 30:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=20;continue;case 17:if(new S($clone(b,S)).Length()>0){$s=31;continue;}$s=32;continue;case 31:v=K.Get(((new S($clone(b,S)).Length()>>0)));$s=33;case 33:if($c){$c=false;v=v.$blk();}if(v&&v.$blk!==undefined){break s;}w=v;y=E.ReadFull(a.conn,w);$s=34;case 34:if($c){$c=false;y=y.$blk();}if(y&&y.$blk!==undefined){break s;}x=y;z=x[0];aa=x[1];if($interfaceIsEqual(aa,$ifaceNil)){$s=35;continue;}$s=36;continue;case 35:$r=a.streamLock.Lock();$s=38;case 38:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}ab=(ac=a.streams[$Uint32.keyFor(i)],ac!==undefined?[ac.v,true]:[AO.nil,false]);ad=ab[0];ae=ab[1];if(ae){$s=39;continue;}$s=40;continue;case 39:af=ad.pushBytes(w);$s=41;case 41:if($c){$c=false;af=af.$blk();}if(af&&af.$blk!==undefined){break s;}af;J.AddInt32((a.$ptr_bucket||(a.$ptr_bucket=new AR(function(){return this.$target.bucket;},function($v){this.$target.bucket=$v;},a))),-((z>>0)));ad.notifyReadEvent();case 40:$r=a.streamLock.Unlock();$s=42;case 42:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=37;continue;case 36:$r=a.notifyReadError(aa);$s=43;case 43:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return;case 37:case 32:$s=20;continue;case 18:ah=E.ReadFull(a.conn,new AJ(c));$s=44;case 44:if($c){$c=false;ah=ah.$blk();}if(ah&&ah.$blk!==undefined){break s;}ag=ah;ai=ag[1];if($interfaceIsEqual(ai,$ifaceNil)){$s=45;continue;}$s=46;continue;case 45:$r=a.streamLock.Lock();$s=48;case 48:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}aj=(ak=a.streams[$Uint32.keyFor(i)],ak!==undefined?[ak.v,true]:[AO.nil,false]);al=aj[0];am=aj[1];if(am){al.update(new T($clone(c,T)).Consumed(),new T($clone(c,T)).Window());}$r=a.streamLock.Unlock();$s=49;case 49:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=47;continue;case 46:$r=a.notifyReadError(ai);$s=50;case 50:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return;case 47:$s=20;continue;case 19:$r=a.notifyProtoError($pkg.ErrInvalidProtocol);$s=51;case 51:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return;case 20:case 13:$s=9;continue;case 8:$r=a.notifyReadError(h);$s=52;case 52:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return;case 9:$s=1;continue;case 2:$s=-1;return;}return;}if($f===undefined){$f={$blk:AC.ptr.prototype.recvLoop};}$f.a=a;$f.aa=aa;$f.ab=ab;$f.ac=ac;$f.ad=ad;$f.ae=ae;$f.af=af;$f.ag=ag;$f.ah=ah;$f.ai=ai;$f.aj=aj;$f.ak=ak;$f.al=al;$f.am=am;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.l=l;$f.m=m;$f.n=n;$f.o=o;$f.p=p;$f.q=q;$f.r=r;$f.s=s;$f.t=t;$f.u=u;$f.v=v;$f.w=w;$f.x=x;$f.y=y;$f.z=z;$f.$s=$s;$f.$r=$r;return $f;};AC.prototype.recvLoop=function(){return this.$val.recvLoop();};AC.ptr.prototype.keepalive=function(){var a,b,c,d,e,f,g,$s,$deferred,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;$s=$f.$s;$deferred=$f.$deferred;$r=$f.$r;}var $err=null;try{s:while(true){switch($s){case 0:$deferred=[];$deferred.index=$curGoroutine.deferStack.length;$curGoroutine.deferStack.push($deferred);a=this;b=G.NewTicker(a.config.KeepAliveInterval);c=G.NewTicker(a.config.KeepAliveTimeout);$deferred.push([$methodVal(b,"Stop"),[]]);$deferred.push([$methodVal(c,"Stop"),[]]);case 1:e=$select([[b.C],[c.C],[a.die]]);$s=3;case 3:if($c){$c=false;e=e.$blk();}if(e&&e.$blk!==undefined){break s;}d=e;if(d[0]===0){$s=4;continue;}if(d[0]===1){$s=5;continue;}if(d[0]===2){$s=6;continue;}$s=7;continue;case 4:f=a.writeFrameInternal($clone(R(((a.config.Version<<24>>>24)),3,0),Q),b.C,new $Uint64(0,0));$s=8;case 8:if($c){$c=false;f=f.$blk();}if(f&&f.$blk!==undefined){break s;}f;a.notifyBucket();$s=7;continue;case 5:if(!J.CompareAndSwapInt32((a.$ptr_dataReady||(a.$ptr_dataReady=new AR(function(){return this.$target.dataReady;},function($v){this.$target.dataReady=$v;},a))),1,0)){$s=9;continue;}$s=10;continue;case 9:if(J.LoadInt32((a.$ptr_bucket||(a.$ptr_bucket=new AR(function(){return this.$target.bucket;},function($v){this.$target.bucket=$v;},a))))>0){$s=11;continue;}$s=12;continue;case 11:g=a.Close();$s=13;case 13:if($c){$c=false;g=g.$blk();}if(g&&g.$blk!==undefined){break s;}g;$s=-1;return;case 12:case 10:$s=7;continue;case 6:$s=-1;return;case 7:$s=1;continue;case 2:$s=-1;return;}return;}}catch(err){$err=err;$s=-1;}finally{$callDeferred($deferred,$err);if($curGoroutine.asleep){if($f===undefined){$f={$blk:AC.ptr.prototype.keepalive};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.$s=$s;$f.$deferred=$deferred;$f.$r=$r;return $f;}}};AC.prototype.keepalive=function(){return this.$val.keepalive();};AC.ptr.prototype.shaperLoop=function(){var a,b,c,d,e,f,g,h,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=[a];b=this;a[0]=AE.nil;c=new Z.ptr(new $Uint64(0,0),new Q.ptr(0,0,0,AJ.nil),$chanNil);d=$chanNil;case 1:if(a[0].$length>0){$s=3;continue;}$s=4;continue;case 3:d=b.writes;e=H.Pop((a.$ptr||(a.$ptr=new AT(function(){return this.$target[0];},function($v){this.$target[0]=$v;},a))));$s=6;case 6:if($c){$c=false;e=e.$blk();}if(e&&e.$blk!==undefined){break s;}Z.copy(c,$assertType(e,Z));$s=5;continue;case 4:d=$chanNil;case 5:g=$select([[b.die],[b.shaper],[d,$clone(c,Z)]]);$s=7;case 7:if($c){$c=false;g=g.$blk();}if(g&&g.$blk!==undefined){break s;}f=g;if(f[0]===0){$s=8;continue;}if(f[0]===1){$s=9;continue;}if(f[0]===2){$s=10;continue;}$s=11;continue;case 8:$s=-1;return;case 9:h=$clone(f[1][0],Z);if(!(d===$chanNil)){$s=12;continue;}$s=13;continue;case 12:$r=H.Push((a.$ptr||(a.$ptr=new AT(function(){return this.$target[0];},function($v){this.$target[0]=$v;},a))),new c.constructor.elem(c));$s=14;case 14:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}case 13:$r=H.Push((a.$ptr||(a.$ptr=new AT(function(){return this.$target[0];},function($v){this.$target[0]=$v;},a))),new h.constructor.elem(h));$s=15;case 15:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=11;continue;case 10:case 11:$s=1;continue;case 2:$s=-1;return;}return;}if($f===undefined){$f={$blk:AC.ptr.prototype.shaperLoop};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.$s=$s;$f.$r=$r;return $f;};AC.prototype.shaperLoop=function(){return this.$val.shaperLoop();};AC.ptr.prototype.sendLoop=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;o=$f.o;p=$f.p;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=this;b=AJ.nil;c=0;d=$ifaceNil;e=AU.nil;f=$assertType(a.conn,AB,true);g=f[0];h=f[1];if(h){b=$makeSlice(AJ,8);e=$makeSlice(AU,2);}else{b=$makeSlice(AJ,65544);}case 1:j=$select([[a.die],[a.writes]]);$s=3;case 3:if($c){$c=false;j=j.$blk();}if(j&&j.$blk!==undefined){break s;}i=j;if(i[0]===0){$s=4;continue;}if(i[0]===1){$s=5;continue;}$s=6;continue;case 4:$s=-1;return;case 5:k=$clone(i[1][0],Z);(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0]=k.frame.ver);(1>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+1]=k.frame.cmd);$clone(C.LittleEndian,C.littleEndian).PutUint16($subslice(b,2),((k.frame.data.$length<<16>>>16)));$clone(C.LittleEndian,C.littleEndian).PutUint32($subslice(b,4),k.frame.sid);if(e.$length>0){$s=7;continue;}$s=8;continue;case 7:(0>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+0]=$subslice(b,0,8));(1>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+1]=k.frame.data);m=g.WriteBuffers(e);$s=10;case 10:if($c){$c=false;m=m.$blk();}if(m&&m.$blk!==undefined){break s;}l=m;c=l[0];d=l[1];$s=9;continue;case 8:$copySlice($subslice(b,8),k.frame.data);o=a.conn.Write($subslice(b,0,(8+k.frame.data.$length>>0)));$s=11;case 11:if($c){$c=false;o=o.$blk();}if(o&&o.$blk!==undefined){break s;}n=o;c=n[0];d=n[1];case 9:c=c-(8)>>0;if(c<0){c=0;}p=new AA.ptr(c,d);$r=$send(k.result,$clone($clone(p,AA),AA));$s=12;case 12:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$close(k.result);if(!($interfaceIsEqual(d,$ifaceNil))){$s=13;continue;}$s=14;continue;case 13:$r=a.notifyWriteError(d);$s=15;case 15:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return;case 14:case 6:$s=1;continue;case 2:$s=-1;return;}return;}if($f===undefined){$f={$blk:AC.ptr.prototype.sendLoop};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.l=l;$f.m=m;$f.n=n;$f.o=o;$f.p=p;$f.$s=$s;$f.$r=$r;return $f;};AC.prototype.sendLoop=function(){return this.$val.sendLoop();};AC.ptr.prototype.writeFrame=function(a){var a,b,c,d,e,f,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=0;c=$ifaceNil;d=this;f=d.writeFrameInternal($clone(a,Q),$chanNil,new $Uint64(0,0));$s=1;case 1:if($c){$c=false;f=f.$blk();}if(f&&f.$blk!==undefined){break s;}e=f;b=e[0];c=e[1];$s=-1;return[b,c];}return;}if($f===undefined){$f={$blk:AC.ptr.prototype.writeFrame};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.$s=$s;$f.$r=$r;return $f;};AC.prototype.writeFrame=function(a){return this.$val.writeFrame(a);};AC.ptr.prototype.writeFrameInternal=function(a,b,c){var a,b,c,d,e,f,g,h,i,j,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:d=this;e=new Z.ptr(c,$clone(a,Q),new $Chan(AA,1));g=$select([[d.shaper,$clone(e,Z)],[d.die],[d.chSocketWriteError],[b]]);$s=1;case 1:if($c){$c=false;g=g.$blk();}if(g&&g.$blk!==undefined){break s;}f=g;if(f[0]===0){$s=2;continue;}if(f[0]===1){$s=3;continue;}if(f[0]===2){$s=4;continue;}if(f[0]===3){$s=5;continue;}$s=6;continue;case 2:$s=6;continue;case 3:$s=-1;return[0,E.ErrClosedPipe];case 4:$s=-1;return[0,$assertType(d.socketWriteError.Load(),$error)];case 5:$s=-1;return[0,$pkg.ErrTimeout];case 6:i=$select([[e.result],[d.die],[d.chSocketWriteError],[b]]);$s=7;case 7:if($c){$c=false;i=i.$blk();}if(i&&i.$blk!==undefined){break s;}h=i;if(h[0]===0){j=$clone(h[1][0],AA);$s=-1;return[j.n,j.err];}else if(h[0]===1){$s=-1;return[0,E.ErrClosedPipe];}else if(h[0]===2){$s=-1;return[0,$assertType(d.socketWriteError.Load(),$error)];}else if(h[0]===3){$s=-1;return[0,$pkg.ErrTimeout];}$s=-1;return[0,$ifaceNil];}return;}if($f===undefined){$f={$blk:AC.ptr.prototype.writeFrameInternal};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.$s=$s;$f.$r=$r;return $f;};AC.prototype.writeFrameInternal=function(a,b,c){return this.$val.writeFrameInternal(a,b,c);};AE.prototype.Len=function(){var a;a=this;return a.$length;};$ptrType(AE).prototype.Len=function(){return this.$get().Len();};AE.prototype.Less=function(a,b){var a,b,c,d,e;c=this;return(d=((a<0||a>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+a]).prio,e=((b<0||b>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+b]).prio,(d.$high=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+b]),Z);e=$clone(((a<0||a>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+a]),Z);Z.copy(((a<0||a>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+a]),d);Z.copy(((b<0||b>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+b]),e);};$ptrType(AE).prototype.Swap=function(a,b){return this.$get().Swap(a,b);};$ptrType(AE).prototype.Push=function(a){var a,b;b=this;b.$set($append(b.$get(),$assertType(a,Z)));};$ptrType(AE).prototype.Pop=function(){var a,b,c,d,e;a=this;b=a.$get();c=b.$length;e=$clone((d=c-1>>0,((d<0||d>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+d])),Z);a.$set($subslice(b,0,(c-1>>0)));return new e.constructor.elem(e);};AG=function(a,b,c){var a,b,c,d;d=new AF.ptr(0,AM.nil,AU.nil,AU.nil,new B.Mutex.ptr(0,0),0,$chanNil,$chanNil,new B.Once.ptr(new B.Mutex.ptr(0,0),0),$chanNil,new B.Once.ptr(new B.Mutex.ptr(0,0),0),new J.Value.ptr($ifaceNil),new J.Value.ptr($ifaceNil),0,0,0,0,0,$chanNil);d.id=a;d.chReadEvent=new $Chan(AN,1);d.chUpdate=new $Chan(AN,1);d.frameSize=b;d.sess=c;d.die=new $Chan(AN,0);d.chFinEvent=new $Chan(AN,0);d.peerWindow=262144;return d;};AF.ptr.prototype.ID=function(){var a;a=this;return a.id;};AF.prototype.ID=function(){return this.$val.ID();};AF.ptr.prototype.Read=function(a){var a,b,c,d,e,f,g,h,i,j,k,l,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=0;c=$ifaceNil;d=this;case 1:f=d.tryRead(a);$s=3;case 3:if($c){$c=false;f=f.$blk();}if(f&&f.$blk!==undefined){break s;}e=f;b=e[0];c=e[1];if($interfaceIsEqual(c,$pkg.ErrWouldBlock)){$s=4;continue;}$s=5;continue;case 4:g=d.waitRead();$s=7;case 7:if($c){$c=false;g=g.$blk();}if(g&&g.$blk!==undefined){break s;}h=g;if(!($interfaceIsEqual(h,$ifaceNil))){i=0;j=h;b=i;c=j;$s=-1;return[b,c];}$s=6;continue;case 5:k=b;l=c;b=k;c=l;$s=-1;return[b,c];case 6:$s=1;continue;case 2:$s=-1;return[b,c];}return;}if($f===undefined){$f={$blk:AF.ptr.prototype.Read};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.l=l;$f.$s=$s;$f.$r=$r;return $f;};AF.prototype.Read=function(a){return this.$val.Read(a);};AF.ptr.prototype.tryRead=function(a){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;o=$f.o;p=$f.p;q=$f.q;r=$f.r;s=$f.s;t=$f.t;u=$f.u;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=0;c=$ifaceNil;d=this;if(d.sess.config.Version===2){$s=1;continue;}$s=2;continue;case 1:f=d.tryReadv2(a);$s=3;case 3:if($c){$c=false;f=f.$blk();}if(f&&f.$blk!==undefined){break s;}e=f;b=e[0];c=e[1];$s=-1;return[b,c];case 2:if(a.$length===0){g=0;h=$ifaceNil;b=g;c=h;$s=-1;return[b,c];}$r=d.bufferLock.Lock();$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}if(d.buffers.$length>0){b=$copySlice(a,(i=d.buffers,(0>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+0])));(k=d.buffers,(0>=k.$length?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+0]=$subslice((j=d.buffers,(0>=j.$length?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+0])),b)));if((l=d.buffers,(0>=l.$length?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+0])).$length===0){(m=d.buffers,(0>=m.$length?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+0]=AJ.nil));d.buffers=$subslice(d.buffers,1);K.Put((n=d.heads,(0>=n.$length?($throwRuntimeError("index out of range"),undefined):n.$array[n.$offset+0])));d.heads=$subslice(d.heads,1);}}$r=d.bufferLock.Unlock();$s=5;case 5:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}if(b>0){d.sess.returnTokens(b);o=b;p=$ifaceNil;b=o;c=p;$s=-1;return[b,c];}q=$select([[d.die],[]]);if(q[0]===0){r=0;s=E.EOF;b=r;c=s;$s=-1;return[b,c];}else if(q[0]===1){t=0;u=$pkg.ErrWouldBlock;b=t;c=u;$s=-1;return[b,c];}$s=-1;return[b,c];}return;}if($f===undefined){$f={$blk:AF.ptr.prototype.tryRead};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.l=l;$f.m=m;$f.n=n;$f.o=o;$f.p=p;$f.q=q;$f.r=r;$f.s=s;$f.t=t;$f.u=u;$f.$s=$s;$f.$r=$r;return $f;};AF.prototype.tryRead=function(a){return this.$val.tryRead(a);};AF.ptr.prototype.tryReadv2=function(a){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;o=$f.o;p=$f.p;q=$f.q;r=$f.r;s=$f.s;t=$f.t;u=$f.u;v=$f.v;w=$f.w;x=$f.x;y=$f.y;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=0;c=$ifaceNil;d=this;if(a.$length===0){e=0;f=$ifaceNil;b=e;c=f;$s=-1;return[b,c];}g=0;$r=d.bufferLock.Lock();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}if(d.buffers.$length>0){b=$copySlice(a,(h=d.buffers,(0>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+0])));(j=d.buffers,(0>=j.$length?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+0]=$subslice((i=d.buffers,(0>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+0])),b)));if((k=d.buffers,(0>=k.$length?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+0])).$length===0){(l=d.buffers,(0>=l.$length?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+0]=AJ.nil));d.buffers=$subslice(d.buffers,1);K.Put((m=d.heads,(0>=m.$length?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+0])));d.heads=$subslice(d.heads,1);}}d.numRead=d.numRead+(((b>>>0)))>>>0;d.incr=d.incr+(((b>>>0)))>>>0;if(d.incr>=(((n=d.sess.config.MaxStreamBuffer/2,(n===n&&n!==1/0&&n!==-1/0)?n>>0:$throwRuntimeError("integer divide by zero"))>>>0))||(d.numRead===((b>>>0)))){g=d.numRead;d.incr=0;}$r=d.bufferLock.Unlock();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}if(b>0){$s=3;continue;}$s=4;continue;case 3:d.sess.returnTokens(b);if(g>0){$s=5;continue;}$s=6;continue;case 5:o=d.sendWindowUpdate(g);$s=8;case 8:if($c){$c=false;o=o.$blk();}if(o&&o.$blk!==undefined){break s;}p=o;q=b;r=p;b=q;c=r;$s=-1;return[b,c];case 6:s=b;t=$ifaceNil;b=s;c=t;$s=-1;return[b,c];case 7:case 4:u=$select([[d.die],[]]);if(u[0]===0){v=0;w=E.EOF;b=v;c=w;$s=-1;return[b,c];}else if(u[0]===1){x=0;y=$pkg.ErrWouldBlock;b=x;c=y;$s=-1;return[b,c];}$s=-1;return[b,c];}return;}if($f===undefined){$f={$blk:AF.ptr.prototype.tryReadv2};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.l=l;$f.m=m;$f.n=n;$f.o=o;$f.p=p;$f.q=q;$f.r=r;$f.s=s;$f.t=t;$f.u=u;$f.v=v;$f.w=w;$f.x=x;$f.y=y;$f.$s=$s;$f.$r=$r;return $f;};AF.prototype.tryReadv2=function(a){return this.$val.tryReadv2(a);};AF.ptr.prototype.WriteTo=function(a){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;o=$f.o;p=$f.p;q=$f.q;r=$f.r;s=$f.s;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=new $Int64(0,0);c=$ifaceNil;d=this;if(d.sess.config.Version===2){$s=1;continue;}$s=2;continue;case 1:f=d.writeTov2(a);$s=3;case 3:if($c){$c=false;f=f.$blk();}if(f&&f.$blk!==undefined){break s;}e=f;b=e[0];c=e[1];$s=-1;return[b,c];case 2:case 4:g=AJ.nil;$r=d.bufferLock.Lock();$s=6;case 6:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}if(d.buffers.$length>0){g=(h=d.buffers,(0>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+0]));d.buffers=$subslice(d.buffers,1);d.heads=$subslice(d.heads,1);}$r=d.bufferLock.Unlock();$s=7;case 7:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}if(!(g===AJ.nil)){$s=8;continue;}$s=9;continue;case 8:j=a.Write(g);$s=11;case 11:if($c){$c=false;j=j.$blk();}if(j&&j.$blk!==undefined){break s;}i=j;k=i[0];l=i[1];d.sess.returnTokens(g.$length);K.Put(g);if(k>0){b=(m=(new $Int64(0,k)),new $Int64(b.$high+m.$high,b.$low+m.$low));}if(!($interfaceIsEqual(l,$ifaceNil))){n=b;o=l;b=n;c=o;$s=-1;return[b,c];}$s=10;continue;case 9:p=d.waitRead();$s=12;case 12:if($c){$c=false;p=p.$blk();}if(p&&p.$blk!==undefined){break s;}q=p;if(!($interfaceIsEqual(q,$ifaceNil))){r=b;s=q;b=r;c=s;$s=-1;return[b,c];}case 10:$s=4;continue;case 5:$s=-1;return[b,c];}return;}if($f===undefined){$f={$blk:AF.ptr.prototype.WriteTo};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.l=l;$f.m=m;$f.n=n;$f.o=o;$f.p=p;$f.q=q;$f.r=r;$f.s=s;$f.$s=$s;$f.$r=$r;return $f;};AF.prototype.WriteTo=function(a){return this.$val.WriteTo(a);};AF.ptr.prototype.writeTov2=function(a){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;o=$f.o;p=$f.p;q=$f.q;r=$f.r;s=$f.s;t=$f.t;u=$f.u;v=$f.v;w=$f.w;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=new $Int64(0,0);c=$ifaceNil;d=this;case 1:e=0;f=AJ.nil;$r=d.bufferLock.Lock();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}if(d.buffers.$length>0){f=(g=d.buffers,(0>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0]));d.buffers=$subslice(d.buffers,1);d.heads=$subslice(d.heads,1);}d.numRead=d.numRead+(((f.$length>>>0)))>>>0;d.incr=d.incr+(((f.$length>>>0)))>>>0;if(d.incr>=(((h=d.sess.config.MaxStreamBuffer/2,(h===h&&h!==1/0&&h!==-1/0)?h>>0:$throwRuntimeError("integer divide by zero"))>>>0))||(d.numRead===((f.$length>>>0)))){e=d.numRead;d.incr=0;}$r=d.bufferLock.Unlock();$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}if(!(f===AJ.nil)){$s=5;continue;}$s=6;continue;case 5:j=a.Write(f);$s=8;case 8:if($c){$c=false;j=j.$blk();}if(j&&j.$blk!==undefined){break s;}i=j;k=i[0];l=i[1];d.sess.returnTokens(f.$length);K.Put(f);if(k>0){b=(m=(new $Int64(0,k)),new $Int64(b.$high+m.$high,b.$low+m.$low));}if(!($interfaceIsEqual(l,$ifaceNil))){n=b;o=l;b=n;c=o;$s=-1;return[b,c];}if(e>0){$s=9;continue;}$s=10;continue;case 9:p=d.sendWindowUpdate(e);$s=11;case 11:if($c){$c=false;p=p.$blk();}if(p&&p.$blk!==undefined){break s;}q=p;if(!($interfaceIsEqual(q,$ifaceNil))){r=b;s=q;b=r;c=s;$s=-1;return[b,c];}case 10:$s=7;continue;case 6:t=d.waitRead();$s=12;case 12:if($c){$c=false;t=t.$blk();}if(t&&t.$blk!==undefined){break s;}u=t;if(!($interfaceIsEqual(u,$ifaceNil))){v=b;w=u;b=v;c=w;$s=-1;return[b,c];}case 7:$s=1;continue;case 2:$s=-1;return[b,c];}return;}if($f===undefined){$f={$blk:AF.ptr.prototype.writeTov2};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.l=l;$f.m=m;$f.n=n;$f.o=o;$f.p=p;$f.q=q;$f.r=r;$f.s=s;$f.t=t;$f.u=u;$f.v=v;$f.w=w;$f.$s=$s;$f.$r=$r;return $f;};AF.prototype.writeTov2=function(a){return this.$val.writeTov2(a);};AF.ptr.prototype.sendWindowUpdate=function(a){var a,b,c,d,e,f,g,h,i,j,k,l,$s,$deferred,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;$s=$f.$s;$deferred=$f.$deferred;$r=$f.$r;}var $err=null;try{s:while(true){switch($s){case 0:$deferred=[];$deferred.index=$curGoroutine.deferStack.length;$curGoroutine.deferStack.push($deferred);b=this;c=AV.nil;d=$chanNil;e=$assertType(b.readDeadline.Load(),G.Time,true);f=$clone(e[0],G.Time);g=e[1];if(g&&!$clone(f,G.Time).IsZero()){c=G.NewTimer(G.Until($clone(f,G.Time)));$deferred.push([$methodVal(c,"Stop"),[]]);d=c.C;}h=$clone(R(((b.sess.config.Version<<24>>>24)),4,b.id),Q);i=AS.zero();$clone(C.LittleEndian,C.littleEndian).PutUint32(new AJ(i),a);$clone(C.LittleEndian,C.littleEndian).PutUint32($subslice(new AJ(i),4),((b.sess.config.MaxStreamBuffer>>>0)));h.data=new AJ(i);k=b.sess.writeFrameInternal($clone(h,Q),d,new $Uint64(0,0));$s=1;case 1:if($c){$c=false;k=k.$blk();}if(k&&k.$blk!==undefined){break s;}j=k;l=j[1];$s=-1;return l;}return;}}catch(err){$err=err;$s=-1;return $ifaceNil;}finally{$callDeferred($deferred,$err);if($curGoroutine.asleep){if($f===undefined){$f={$blk:AF.ptr.prototype.sendWindowUpdate};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.l=l;$f.$s=$s;$f.$deferred=$deferred;$f.$r=$r;return $f;}}};AF.prototype.sendWindowUpdate=function(a){return this.$val.sendWindowUpdate(a);};AF.ptr.prototype.waitRead=function(){var a,b,c,d,e,f,g,h,$s,$deferred,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;$s=$f.$s;$deferred=$f.$deferred;$r=$f.$r;}var $err=null;try{s:while(true){switch($s){case 0:$deferred=[];$deferred.index=$curGoroutine.deferStack.length;$curGoroutine.deferStack.push($deferred);a=this;b=AV.nil;c=$chanNil;d=$assertType(a.readDeadline.Load(),G.Time,true);e=$clone(d[0],G.Time);f=d[1];if(f&&!$clone(e,G.Time).IsZero()){b=G.NewTimer(G.Until($clone(e,G.Time)));$deferred.push([$methodVal(b,"Stop"),[]]);c=b.C;}h=$select([[a.chReadEvent],[a.chFinEvent],[a.sess.chSocketReadError],[a.sess.chProtoError],[c],[a.die]]);$s=1;case 1:if($c){$c=false;h=h.$blk();}if(h&&h.$blk!==undefined){break s;}g=h;if(g[0]===0){$s=2;continue;}if(g[0]===1){$s=3;continue;}if(g[0]===2){$s=4;continue;}if(g[0]===3){$s=5;continue;}if(g[0]===4){$s=6;continue;}if(g[0]===5){$s=7;continue;}$s=8;continue;case 2:$s=-1;return $ifaceNil;case 3:$r=a.bufferLock.Lock();$s=9;case 9:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$deferred.push([$methodVal(a.bufferLock,"Unlock"),[]]);if(a.buffers.$length>0){$s=-1;return $ifaceNil;}$s=-1;return E.EOF;case 4:$s=-1;return $assertType(a.sess.socketReadError.Load(),$error);case 5:$s=-1;return $assertType(a.sess.protoError.Load(),$error);case 6:$s=-1;return $pkg.ErrTimeout;case 7:$s=-1;return E.ErrClosedPipe;case 8:$s=-1;return $ifaceNil;}return;}}catch(err){$err=err;$s=-1;return $ifaceNil;}finally{$callDeferred($deferred,$err);if($curGoroutine.asleep){if($f===undefined){$f={$blk:AF.ptr.prototype.waitRead};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.$s=$s;$f.$deferred=$deferred;$f.$r=$r;return $f;}}};AF.prototype.waitRead=function(){return this.$val.waitRead();};AF.ptr.prototype.Write=function(a){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,$s,$deferred,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;o=$f.o;p=$f.p;q=$f.q;r=$f.r;s=$f.s;t=$f.t;u=$f.u;v=$f.v;w=$f.w;x=$f.x;y=$f.y;z=$f.z;$s=$f.$s;$deferred=$f.$deferred;$r=$f.$r;}var $err=null;try{s:while(true){switch($s){case 0:$deferred=[];$deferred.index=$curGoroutine.deferStack.length;$curGoroutine.deferStack.push($deferred);b=0;c=$ifaceNil;d=this;if(d.sess.config.Version===2){$s=1;continue;}$s=2;continue;case 1:f=d.writeV2(a);$s=3;case 3:if($c){$c=false;f=f.$blk();}if(f&&f.$blk!==undefined){break s;}e=f;b=e[0];c=e[1];$s=-1;return[b,c];case 2:g=$chanNil;h=$assertType(d.writeDeadline.Load(),G.Time,true);i=$clone(h[0],G.Time);j=h[1];if(j&&!$clone(i,G.Time).IsZero()){k=G.NewTimer(G.Until($clone(i,G.Time)));$deferred.push([$methodVal(k,"Stop"),[]]);g=k.C;}l=$select([[d.die],[]]);if(l[0]===0){m=0;n=E.ErrClosedPipe;b=m;c=n;$s=-1;return[b,c];}else if(l[0]===1){}o=0;p=$clone(R(((d.sess.config.Version<<24>>>24)),2,d.id),Q);q=a;case 4:if(!(q.$length>0)){$s=5;continue;}r=q.$length;if(r>d.frameSize){r=d.frameSize;}p.data=$subslice(q,0,r);q=$subslice(q,r);t=d.sess.writeFrameInternal($clone(p,Q),g,(new $Uint64(0,d.numWritten)));$s=6;case 6:if($c){$c=false;t=t.$blk();}if(t&&t.$blk!==undefined){break s;}s=t;u=s[0];v=s[1];d.numWritten=d.numWritten+(1)>>>0;o=o+(u)>>0;if(!($interfaceIsEqual(v,$ifaceNil))){w=o;x=v;b=w;c=x;$s=-1;return[b,c];}$s=4;continue;case 5:y=o;z=$ifaceNil;b=y;c=z;$s=-1;return[b,c];}return;}}catch(err){$err=err;$s=-1;}finally{$callDeferred($deferred,$err);if(!$curGoroutine.asleep){return[b,c];}if($curGoroutine.asleep){if($f===undefined){$f={$blk:AF.ptr.prototype.Write};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.l=l;$f.m=m;$f.n=n;$f.o=o;$f.p=p;$f.q=q;$f.r=r;$f.s=s;$f.t=t;$f.u=u;$f.v=v;$f.w=w;$f.x=x;$f.y=y;$f.z=z;$f.$s=$s;$f.$deferred=$deferred;$f.$r=$r;return $f;}}};AF.prototype.Write=function(a){return this.$val.Write(a);};AF.ptr.prototype.writeV2=function(a){var a,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,$s,$deferred,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;aa=$f.aa;ab=$f.ab;ac=$f.ac;ad=$f.ad;ae=$f.ae;af=$f.af;ag=$f.ag;ah=$f.ah;ai=$f.ai;aj=$f.aj;ak=$f.ak;al=$f.al;am=$f.am;an=$f.an;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;o=$f.o;p=$f.p;q=$f.q;r=$f.r;s=$f.s;t=$f.t;u=$f.u;v=$f.v;w=$f.w;x=$f.x;y=$f.y;z=$f.z;$s=$f.$s;$deferred=$f.$deferred;$r=$f.$r;}var $err=null;try{s:while(true){switch($s){case 0:$deferred=[];$deferred.index=$curGoroutine.deferStack.length;$curGoroutine.deferStack.push($deferred);b=0;c=$ifaceNil;d=this;if(a.$length===0){e=0;f=$ifaceNil;b=e;c=f;$s=-1;return[b,c];}g=$select([[d.die],[]]);if(g[0]===0){h=0;i=E.ErrClosedPipe;b=h;c=i;$s=-1;return[b,c];}else if(g[0]===1){}j=$chanNil;k=$assertType(d.writeDeadline.Load(),G.Time,true);l=$clone(k[0],G.Time);m=k[1];if(m&&!$clone(l,G.Time).IsZero()){n=G.NewTimer(G.Until($clone(l,G.Time)));$deferred.push([$methodVal(n,"Stop"),[]]);j=n.C;}o=0;p=$clone(R(((d.sess.config.Version<<24>>>24)),2,d.id),Q);case 1:q=AJ.nil;r=(((J.LoadUint32((d.$ptr_numWritten||(d.$ptr_numWritten=new AW(function(){return this.$target.numWritten;},function($v){this.$target.numWritten=$v;},d))))-J.LoadUint32((d.$ptr_peerConsumed||(d.$ptr_peerConsumed=new AW(function(){return this.$target.peerConsumed;},function($v){this.$target.peerConsumed=$v;},d))))>>>0)>>0));if(r<0){s=0;t=$pkg.ErrConsumed;b=s;c=t;$s=-1;return[b,c];}u=((J.LoadUint32((d.$ptr_peerWindow||(d.$ptr_peerWindow=new AW(function(){return this.$target.peerWindow;},function($v){this.$target.peerWindow=$v;},d))))>>0))-r>>0;if(u>0){$s=3;continue;}$s=4;continue;case 3:if(u>((a.$length>>0))){q=a;a=AJ.nil;}else{q=$subslice(a,0,u);a=$subslice(a,u);}case 5:if(!(q.$length>0)){$s=6;continue;}v=q.$length;if(v>d.frameSize){v=d.frameSize;}p.data=$subslice(q,0,v);q=$subslice(q,v);x=d.sess.writeFrameInternal($clone(p,Q),j,(new $Uint64(0,J.LoadUint32((d.$ptr_numWritten||(d.$ptr_numWritten=new AW(function(){return this.$target.numWritten;},function($v){this.$target.numWritten=$v;},d)))))));$s=7;case 7:if($c){$c=false;x=x.$blk();}if(x&&x.$blk!==undefined){break s;}w=x;y=w[0];z=w[1];J.AddUint32((d.$ptr_numWritten||(d.$ptr_numWritten=new AW(function(){return this.$target.numWritten;},function($v){this.$target.numWritten=$v;},d))),((v>>>0)));o=o+(y)>>0;if(!($interfaceIsEqual(z,$ifaceNil))){aa=o;ab=z;b=aa;c=ab;$s=-1;return[b,c];}$s=5;continue;case 6:case 4:if(a.$length>0){$s=8;continue;}$s=9;continue;case 8:ad=$select([[d.chFinEvent],[d.die],[j],[d.sess.chSocketWriteError],[d.chUpdate]]);$s=11;case 11:if($c){$c=false;ad=ad.$blk();}if(ad&&ad.$blk!==undefined){break s;}ac=ad;if(ac[0]===0){ae=0;af=E.EOF;b=ae;c=af;$s=-1;return[b,c];}else if(ac[0]===1){ag=o;ah=E.ErrClosedPipe;b=ag;c=ah;$s=-1;return[b,c];}else if(ac[0]===2){ai=o;aj=$pkg.ErrTimeout;b=ai;c=aj;$s=-1;return[b,c];}else if(ac[0]===3){ak=o;al=$assertType(d.sess.socketWriteError.Load(),$error);b=ak;c=al;$s=-1;return[b,c];}else if(ac[0]===4){$s=1;continue;}$s=10;continue;case 9:am=o;an=$ifaceNil;b=am;c=an;$s=-1;return[b,c];case 10:$s=1;continue;case 2:$s=-1;return[b,c];}return;}}catch(err){$err=err;$s=-1;}finally{$callDeferred($deferred,$err);if(!$curGoroutine.asleep){return[b,c];}if($curGoroutine.asleep){if($f===undefined){$f={$blk:AF.ptr.prototype.writeV2};}$f.a=a;$f.aa=aa;$f.ab=ab;$f.ac=ac;$f.ad=ad;$f.ae=ae;$f.af=af;$f.ag=ag;$f.ah=ah;$f.ai=ai;$f.aj=aj;$f.ak=ak;$f.al=al;$f.am=am;$f.an=an;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.l=l;$f.m=m;$f.n=n;$f.o=o;$f.p=p;$f.q=q;$f.r=r;$f.s=s;$f.t=t;$f.u=u;$f.v=v;$f.w=w;$f.x=x;$f.y=y;$f.z=z;$f.$s=$s;$f.$deferred=$deferred;$f.$r=$r;return $f;}}};AF.prototype.writeV2=function(a){return this.$val.writeV2(a);};AF.ptr.prototype.Close=function(){var a,b,c,d,e,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=[a];b=[b];b[0]=this;a[0]=false;c=$ifaceNil;$r=b[0].dieOnce.Do((function(a,b){return function(){$close(b[0].die);a[0]=true;};})(a,b));$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}if(a[0]){$s=2;continue;}$s=3;continue;case 2:e=b[0].sess.writeFrame($clone(R(((b[0].sess.config.Version<<24>>>24)),1,b[0].id),Q));$s=5;case 5:if($c){$c=false;e=e.$blk();}if(e&&e.$blk!==undefined){break s;}d=e;c=d[1];$r=b[0].sess.streamClosed(b[0].id);$s=6;case 6:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return c;case 3:$s=-1;return E.ErrClosedPipe;case 4:$s=-1;return $ifaceNil;}return;}if($f===undefined){$f={$blk:AF.ptr.prototype.Close};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.$s=$s;$f.$r=$r;return $f;};AF.prototype.Close=function(){return this.$val.Close();};AF.ptr.prototype.GetDieCh=function(){var a;a=this;return a.die;};AF.prototype.GetDieCh=function(){return this.$val.GetDieCh();};AF.ptr.prototype.SetReadDeadline=function(a){var a,b;b=this;b.readDeadline.Store(new a.constructor.elem(a));b.notifyReadEvent();return $ifaceNil;};AF.prototype.SetReadDeadline=function(a){return this.$val.SetReadDeadline(a);};AF.ptr.prototype.SetWriteDeadline=function(a){var a,b;b=this;b.writeDeadline.Store(new a.constructor.elem(a));return $ifaceNil;};AF.prototype.SetWriteDeadline=function(a){return this.$val.SetWriteDeadline(a);};AF.ptr.prototype.SetDeadline=function(a){var a,b,c,d;b=this;c=b.SetReadDeadline($clone(a,G.Time));if(!($interfaceIsEqual(c,$ifaceNil))){return c;}d=b.SetWriteDeadline($clone(a,G.Time));if(!($interfaceIsEqual(d,$ifaceNil))){return d;}return $ifaceNil;};AF.prototype.SetDeadline=function(a){return this.$val.SetDeadline(a);};AF.ptr.prototype.sessionClose=function(){var a,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=[a];a[0]=this;$r=a[0].dieOnce.Do((function(a){return function(){$close(a[0].die);};})(a));$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return;}return;}if($f===undefined){$f={$blk:AF.ptr.prototype.sessionClose};}$f.a=a;$f.$s=$s;$f.$r=$r;return $f;};AF.prototype.sessionClose=function(){return this.$val.sessionClose();};AF.ptr.prototype.LocalAddr=function(){var a,b,c,d,e,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=this;b=$assertType(a.sess.conn,AP,true);c=b[0];d=b[1];if(d){$s=1;continue;}$s=2;continue;case 1:e=c.LocalAddr();$s=3;case 3:if($c){$c=false;e=e.$blk();}if(e&&e.$blk!==undefined){break s;}$s=-1;return e;case 2:$s=-1;return $ifaceNil;}return;}if($f===undefined){$f={$blk:AF.ptr.prototype.LocalAddr};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.$s=$s;$f.$r=$r;return $f;};AF.prototype.LocalAddr=function(){return this.$val.LocalAddr();};AF.ptr.prototype.RemoteAddr=function(){var a,b,c,d,e,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=this;b=$assertType(a.sess.conn,AQ,true);c=b[0];d=b[1];if(d){$s=1;continue;}$s=2;continue;case 1:e=c.RemoteAddr();$s=3;case 3:if($c){$c=false;e=e.$blk();}if(e&&e.$blk!==undefined){break s;}$s=-1;return e;case 2:$s=-1;return $ifaceNil;}return;}if($f===undefined){$f={$blk:AF.ptr.prototype.RemoteAddr};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.$s=$s;$f.$r=$r;return $f;};AF.prototype.RemoteAddr=function(){return this.$val.RemoteAddr();};AF.ptr.prototype.pushBytes=function(a){var a,b,c,d,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=0;c=$ifaceNil;d=this;$r=d.bufferLock.Lock();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}d.buffers=$append(d.buffers,a);d.heads=$append(d.heads,a);$r=d.bufferLock.Unlock();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return[b,c];}return;}if($f===undefined){$f={$blk:AF.ptr.prototype.pushBytes};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.$s=$s;$f.$r=$r;return $f;};AF.prototype.pushBytes=function(a){return this.$val.pushBytes(a);};AF.ptr.prototype.recycleTokens=function(){var a,b,c,d,e,f,g,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=0;b=this;$r=b.bufferLock.Lock();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}c=b.buffers;d=0;while(true){if(!(d=f.$length)?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+e])).$length)>>0;K.Put((g=b.heads,((e<0||e>=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+e])));d++;}b.buffers=AU.nil;b.heads=AU.nil;$r=b.bufferLock.Unlock();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return a;}return;}if($f===undefined){$f={$blk:AF.ptr.prototype.recycleTokens};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.$s=$s;$f.$r=$r;return $f;};AF.prototype.recycleTokens=function(){return this.$val.recycleTokens();};AF.ptr.prototype.notifyReadEvent=function(){var a,b,$r;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;$r=$f.$r;}a=this;b=$select([[a.chReadEvent,new AN.ptr()],[]]);if(b[0]===0){}else if(b[0]===1){}if($f===undefined){$f={$blk:AF.ptr.prototype.notifyReadEvent};}$f.a=a;$f.b=b;$f.$r=$r;return $f;};AF.prototype.notifyReadEvent=function(){return this.$val.notifyReadEvent();};AF.ptr.prototype.update=function(a,b){var a,b,c,d,$r;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;$r=$f.$r;}c=this;J.StoreUint32((c.$ptr_peerConsumed||(c.$ptr_peerConsumed=new AW(function(){return this.$target.peerConsumed;},function($v){this.$target.peerConsumed=$v;},c))),a);J.StoreUint32((c.$ptr_peerWindow||(c.$ptr_peerWindow=new AW(function(){return this.$target.peerWindow;},function($v){this.$target.peerWindow=$v;},c))),b);d=$select([[c.chUpdate,new AN.ptr()],[]]);if(d[0]===0){}else if(d[0]===1){}if($f===undefined){$f={$blk:AF.ptr.prototype.update};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.$r=$r;return $f;};AF.prototype.update=function(a,b){return this.$val.update(a,b);};AF.ptr.prototype.fin=function(){var a,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=[a];a[0]=this;$r=a[0].finEventOnce.Do((function(a){return function(){$close(a[0].chFinEvent);};})(a));$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return;}return;}if($f===undefined){$f={$blk:AF.ptr.prototype.fin};}$f.a=a;$f.$s=$s;$f.$r=$r;return $f;};AF.prototype.fin=function(){return this.$val.fin();};AH.methods=[{prop:"Get",name:"Get",pkg:"",typ:$funcType([$Int],[AJ],false)},{prop:"Put",name:"Put",pkg:"",typ:$funcType([AJ],[$error],false)}];S.methods=[{prop:"Version",name:"Version",pkg:"",typ:$funcType([],[$Uint8],false)},{prop:"Cmd",name:"Cmd",pkg:"",typ:$funcType([],[$Uint8],false)},{prop:"Length",name:"Length",pkg:"",typ:$funcType([],[$Uint16],false)},{prop:"StreamID",name:"StreamID",pkg:"",typ:$funcType([],[$Uint32],false)},{prop:"String",name:"String",pkg:"",typ:$funcType([],[$String],false)}];T.methods=[{prop:"Consumed",name:"Consumed",pkg:"",typ:$funcType([],[$Uint32],false)},{prop:"Window",name:"Window",pkg:"",typ:$funcType([],[$Uint32],false)}];AM.methods=[{prop:"OpenStream",name:"OpenStream",pkg:"",typ:$funcType([],[AO,$error],false)},{prop:"Open",name:"Open",pkg:"",typ:$funcType([],[E.ReadWriteCloser,$error],false)},{prop:"AcceptStream",name:"AcceptStream",pkg:"",typ:$funcType([],[AO,$error],false)},{prop:"Accept",name:"Accept",pkg:"",typ:$funcType([],[E.ReadWriteCloser,$error],false)},{prop:"Close",name:"Close",pkg:"",typ:$funcType([],[$error],false)},{prop:"notifyBucket",name:"notifyBucket",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([],[],false)},{prop:"notifyReadError",name:"notifyReadError",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([$error],[],false)},{prop:"notifyWriteError",name:"notifyWriteError",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([$error],[],false)},{prop:"notifyProtoError",name:"notifyProtoError",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([$error],[],false)},{prop:"IsClosed",name:"IsClosed",pkg:"",typ:$funcType([],[$Bool],false)},{prop:"NumStreams",name:"NumStreams",pkg:"",typ:$funcType([],[$Int],false)},{prop:"SetDeadline",name:"SetDeadline",pkg:"",typ:$funcType([G.Time],[$error],false)},{prop:"LocalAddr",name:"LocalAddr",pkg:"",typ:$funcType([],[I.Addr],false)},{prop:"RemoteAddr",name:"RemoteAddr",pkg:"",typ:$funcType([],[I.Addr],false)},{prop:"streamClosed",name:"streamClosed",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([$Uint32],[],false)},{prop:"returnTokens",name:"returnTokens",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([$Int],[],false)},{prop:"recvLoop",name:"recvLoop",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([],[],false)},{prop:"keepalive",name:"keepalive",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([],[],false)},{prop:"shaperLoop",name:"shaperLoop",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([],[],false)},{prop:"sendLoop",name:"sendLoop",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([],[],false)},{prop:"writeFrame",name:"writeFrame",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([Q],[$Int,$error],false)},{prop:"writeFrameInternal",name:"writeFrameInternal",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([Q,AY,$Uint64],[$Int,$error],false)}];AE.methods=[{prop:"Len",name:"Len",pkg:"",typ:$funcType([],[$Int],false)},{prop:"Less",name:"Less",pkg:"",typ:$funcType([$Int,$Int],[$Bool],false)},{prop:"Swap",name:"Swap",pkg:"",typ:$funcType([$Int,$Int],[],false)}];AT.methods=[{prop:"Push",name:"Push",pkg:"",typ:$funcType([$emptyInterface],[],false)},{prop:"Pop",name:"Pop",pkg:"",typ:$funcType([],[$emptyInterface],false)}];AO.methods=[{prop:"ID",name:"ID",pkg:"",typ:$funcType([],[$Uint32],false)},{prop:"Read",name:"Read",pkg:"",typ:$funcType([AJ],[$Int,$error],false)},{prop:"tryRead",name:"tryRead",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([AJ],[$Int,$error],false)},{prop:"tryReadv2",name:"tryReadv2",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([AJ],[$Int,$error],false)},{prop:"WriteTo",name:"WriteTo",pkg:"",typ:$funcType([E.Writer],[$Int64,$error],false)},{prop:"writeTov2",name:"writeTov2",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([E.Writer],[$Int64,$error],false)},{prop:"sendWindowUpdate",name:"sendWindowUpdate",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([$Uint32],[$error],false)},{prop:"waitRead",name:"waitRead",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([],[$error],false)},{prop:"Write",name:"Write",pkg:"",typ:$funcType([AJ],[$Int,$error],false)},{prop:"writeV2",name:"writeV2",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([AJ],[$Int,$error],false)},{prop:"Close",name:"Close",pkg:"",typ:$funcType([],[$error],false)},{prop:"GetDieCh",name:"GetDieCh",pkg:"",typ:$funcType([],[BD],false)},{prop:"SetReadDeadline",name:"SetReadDeadline",pkg:"",typ:$funcType([G.Time],[$error],false)},{prop:"SetWriteDeadline",name:"SetWriteDeadline",pkg:"",typ:$funcType([G.Time],[$error],false)},{prop:"SetDeadline",name:"SetDeadline",pkg:"",typ:$funcType([G.Time],[$error],false)},{prop:"sessionClose",name:"sessionClose",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([],[],false)},{prop:"LocalAddr",name:"LocalAddr",pkg:"",typ:$funcType([],[I.Addr],false)},{prop:"RemoteAddr",name:"RemoteAddr",pkg:"",typ:$funcType([],[I.Addr],false)},{prop:"pushBytes",name:"pushBytes",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([AJ],[$Int,$error],false)},{prop:"recycleTokens",name:"recycleTokens",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([],[$Int],false)},{prop:"notifyReadEvent",name:"notifyReadEvent",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([],[],false)},{prop:"update",name:"update",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([$Uint32,$Uint32],[],false)},{prop:"fin",name:"fin",pkg:"github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",typ:$funcType([],[],false)}];N.init("github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",[{prop:"buffers",name:"buffers",embedded:false,exported:false,typ:AI,tag:""}]);Q.init("github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",[{prop:"ver",name:"ver",embedded:false,exported:false,typ:$Uint8,tag:""},{prop:"cmd",name:"cmd",embedded:false,exported:false,typ:$Uint8,tag:""},{prop:"sid",name:"sid",embedded:false,exported:false,typ:$Uint32,tag:""},{prop:"data",name:"data",embedded:false,exported:false,typ:AJ,tag:""}]);S.init($Uint8,8);T.init($Uint8,8);U.init("",[{prop:"Version",name:"Version",embedded:false,exported:true,typ:$Int,tag:""},{prop:"KeepAliveDisabled",name:"KeepAliveDisabled",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"KeepAliveInterval",name:"KeepAliveInterval",embedded:false,exported:true,typ:G.Duration,tag:""},{prop:"KeepAliveTimeout",name:"KeepAliveTimeout",embedded:false,exported:true,typ:G.Duration,tag:""},{prop:"MaxFrameSize",name:"MaxFrameSize",embedded:false,exported:true,typ:$Int,tag:""},{prop:"MaxReceiveBuffer",name:"MaxReceiveBuffer",embedded:false,exported:true,typ:$Int,tag:""},{prop:"MaxStreamBuffer",name:"MaxStreamBuffer",embedded:false,exported:true,typ:$Int,tag:""}]);Z.init("github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",[{prop:"prio",name:"prio",embedded:false,exported:false,typ:$Uint64,tag:""},{prop:"frame",name:"frame",embedded:false,exported:false,typ:Q,tag:""},{prop:"result",name:"result",embedded:false,exported:false,typ:AX,tag:""}]);AA.init("github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",[{prop:"n",name:"n",embedded:false,exported:false,typ:$Int,tag:""},{prop:"err",name:"err",embedded:false,exported:false,typ:$error,tag:""}]);AB.init([{prop:"WriteBuffers",name:"WriteBuffers",pkg:"",typ:$funcType([AU],[$Int,$error],false)}]);AC.init("github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",[{prop:"conn",name:"conn",embedded:false,exported:false,typ:E.ReadWriteCloser,tag:""},{prop:"config",name:"config",embedded:false,exported:false,typ:AL,tag:""},{prop:"nextStreamID",name:"nextStreamID",embedded:false,exported:false,typ:$Uint32,tag:""},{prop:"nextStreamIDLock",name:"nextStreamIDLock",embedded:false,exported:false,typ:B.Mutex,tag:""},{prop:"bucket",name:"bucket",embedded:false,exported:false,typ:$Int32,tag:""},{prop:"bucketNotify",name:"bucketNotify",embedded:false,exported:false,typ:AZ,tag:""},{prop:"streams",name:"streams",embedded:false,exported:false,typ:BA,tag:""},{prop:"streamLock",name:"streamLock",embedded:false,exported:false,typ:B.Mutex,tag:""},{prop:"die",name:"die",embedded:false,exported:false,typ:AZ,tag:""},{prop:"dieOnce",name:"dieOnce",embedded:false,exported:false,typ:B.Once,tag:""},{prop:"socketReadError",name:"socketReadError",embedded:false,exported:false,typ:J.Value,tag:""},{prop:"socketWriteError",name:"socketWriteError",embedded:false,exported:false,typ:J.Value,tag:""},{prop:"chSocketReadError",name:"chSocketReadError",embedded:false,exported:false,typ:AZ,tag:""},{prop:"chSocketWriteError",name:"chSocketWriteError",embedded:false,exported:false,typ:AZ,tag:""},{prop:"socketReadErrorOnce",name:"socketReadErrorOnce",embedded:false,exported:false,typ:B.Once,tag:""},{prop:"socketWriteErrorOnce",name:"socketWriteErrorOnce",embedded:false,exported:false,typ:B.Once,tag:""},{prop:"protoError",name:"protoError",embedded:false,exported:false,typ:J.Value,tag:""},{prop:"chProtoError",name:"chProtoError",embedded:false,exported:false,typ:AZ,tag:""},{prop:"protoErrorOnce",name:"protoErrorOnce",embedded:false,exported:false,typ:B.Once,tag:""},{prop:"chAccepts",name:"chAccepts",embedded:false,exported:false,typ:BB,tag:""},{prop:"dataReady",name:"dataReady",embedded:false,exported:false,typ:$Int32,tag:""},{prop:"goAway",name:"goAway",embedded:false,exported:false,typ:$Int32,tag:""},{prop:"deadline",name:"deadline",embedded:false,exported:false,typ:J.Value,tag:""},{prop:"shaper",name:"shaper",embedded:false,exported:false,typ:BC,tag:""},{prop:"writes",name:"writes",embedded:false,exported:false,typ:BC,tag:""}]);AE.init(Z);AF.init("github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux",[{prop:"id",name:"id",embedded:false,exported:false,typ:$Uint32,tag:""},{prop:"sess",name:"sess",embedded:false,exported:false,typ:AM,tag:""},{prop:"buffers",name:"buffers",embedded:false,exported:false,typ:AU,tag:""},{prop:"heads",name:"heads",embedded:false,exported:false,typ:AU,tag:""},{prop:"bufferLock",name:"bufferLock",embedded:false,exported:false,typ:B.Mutex,tag:""},{prop:"frameSize",name:"frameSize",embedded:false,exported:false,typ:$Int,tag:""},{prop:"chReadEvent",name:"chReadEvent",embedded:false,exported:false,typ:AZ,tag:""},{prop:"die",name:"die",embedded:false,exported:false,typ:AZ,tag:""},{prop:"dieOnce",name:"dieOnce",embedded:false,exported:false,typ:B.Once,tag:""},{prop:"chFinEvent",name:"chFinEvent",embedded:false,exported:false,typ:AZ,tag:""},{prop:"finEventOnce",name:"finEventOnce",embedded:false,exported:false,typ:B.Once,tag:""},{prop:"readDeadline",name:"readDeadline",embedded:false,exported:false,typ:J.Value,tag:""},{prop:"writeDeadline",name:"writeDeadline",embedded:false,exported:false,typ:J.Value,tag:""},{prop:"numRead",name:"numRead",embedded:false,exported:false,typ:$Uint32,tag:""},{prop:"numWritten",name:"numWritten",embedded:false,exported:false,typ:$Uint32,tag:""},{prop:"incr",name:"incr",embedded:false,exported:false,typ:$Uint32,tag:""},{prop:"peerConsumed",name:"peerConsumed",embedded:false,exported:false,typ:$Uint32,tag:""},{prop:"peerWindow",name:"peerWindow",embedded:false,exported:false,typ:$Uint32,tag:""},{prop:"chUpdate",name:"chUpdate",embedded:false,exported:false,typ:AZ,tag:""}]);$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=H.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=C.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=A.$init();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=D.$init();$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=E.$init();$s=5;case 5:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=F.$init();$s=6;case 6:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=I.$init();$s=7;case 7:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=B.$init();$s=8;case 8:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=J.$init();$s=9;case 9:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=G.$init();$s=10;case 10:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}K=AH.nil;L=$toNativeArray($kindUint8,[0,9,1,10,13,21,2,29,11,14,16,18,22,25,3,30,8,12,20,28,15,17,24,7,19,27,23,6,26,5,4,31]);$pkg.ErrInvalidProtocol=A.New("invalid protocol");$pkg.ErrConsumed=A.New("peer consumed more than sent");$pkg.ErrGoAway=A.New("stream id overflows, should start a new connection");$pkg.ErrTimeout=A.New("timeout");$pkg.ErrWouldBlock=A.New("operation would block on IO");M();}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})(); -$packages["github.com/v2fly/BrowserBridge/bridge"]=(function(){var $pkg={},$init,A,F,D,E,B,C,G,I,J,H;A=$packages["fmt"];F=$packages["github.com/v2fly/BrowserBridge/proto"];D=$packages["github.com/v2fly/BrowserBridge/vendor/github.com/gopherjs/websocket"];E=$packages["github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux"];B=$packages["io"];C=$packages["time"];G=$pkg.Settings=$newType(0,$kindStruct,"bridge.Settings",true,"github.com/v2fly/BrowserBridge/bridge",true,function(DialAddr_){this.$val=this;if(arguments.length===0){this.DialAddr="";return;}this.DialAddr=DialAddr_;});I=$sliceType($emptyInterface);J=$ptrType(E.Config);H=function(a){var a,b,c,d,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=[a];case 1:b=C.NewTimer(new C.Duration(0,1000000000));c=(function(a){return function $b(){var c,d,e,f,g,h,i,j,k,l,m,n,o,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;o=$f.o;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:d=D.Dial(a[0].DialAddr);$s=1;case 1:if($c){$c=false;d=d.$blk();}if(d&&d.$blk!==undefined){break s;}c=d;e=c[0];f=c[1];if(!($interfaceIsEqual(f,$ifaceNil))){$s=2;continue;}$s=3;continue;case 2:g=A.Println(new I([f,new $String(a[0].DialAddr)]));$s=4;case 4:if($c){$c=false;g=g.$blk();}if(g&&g.$blk!==undefined){break s;}g;$s=-1;return;case 3:i=E.Client(e,J.nil);$s=5;case 5:if($c){$c=false;i=i.$blk();}if(i&&i.$blk!==undefined){break s;}h=i;j=h[0];f=h[1];if(!($interfaceIsEqual(f,$ifaceNil))){$s=-1;return;}case 6:k=[k];m=j.Accept();$s=8;case 8:if($c){$c=false;m=m.$blk();}if(m&&m.$blk!==undefined){break s;}l=m;k[0]=l[0];n=l[1];if(!($interfaceIsEqual(n,$ifaceNil))){$s=9;continue;}$s=10;continue;case 9:o=A.Println(new I([n]));$s=11;case 11:if($c){$c=false;o=o.$blk();}if(o&&o.$blk!==undefined){break s;}o;$s=-1;return;case 10:$go((function(a,k){return function $b(){var aa,p,q,r,s,t,u,v,w,x,y,z,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;aa=$f.aa;p=$f.p;q=$f.q;r=$f.r;s=$f.s;t=$f.t;u=$f.u;v=$f.v;w=$f.w;x=$f.x;y=$f.y;z=$f.z;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:q=F.ReadRequest(k[0]);$s=1;case 1:if($c){$c=false;q=q.$blk();}if(q&&q.$blk!==undefined){break s;}p=q;r=p[0];s=p[1];if(!($interfaceIsEqual(r,$ifaceNil))){$s=2;continue;}$s=3;continue;case 2:t=A.Println(new I([r]));$s=4;case 4:if($c){$c=false;t=t.$blk();}if(t&&t.$blk!==undefined){break s;}t;$s=-1;return;case 3:v=D.Dial(s.Destination);$s=5;case 5:if($c){$c=false;v=v.$blk();}if(v&&v.$blk!==undefined){break s;}u=v;w=u[0];r=u[1];if(!($interfaceIsEqual(r,$ifaceNil))){$s=6;continue;}$s=7;continue;case 6:x=A.Println(new I([r]));$s=8;case 8:if($c){$c=false;x=x.$blk();}if(x&&x.$blk!==undefined){break s;}x;y=k[0].Close();$s=9;case 9:if($c){$c=false;y=y.$blk();}if(y&&y.$blk!==undefined){break s;}y;$s=-1;return;case 7:$go(B.Copy,[k[0],w]);z=B.Copy(w,k[0]);$s=10;case 10:if($c){$c=false;z=z.$blk();}if(z&&z.$blk!==undefined){break s;}z;aa=k[0].Close();$s=11;case 11:if($c){$c=false;aa=aa.$blk();}if(aa&&aa.$blk!==undefined){break s;}aa;$s=-1;return;}return;}if($f===undefined){$f={$blk:$b};}$f.aa=aa;$f.p=p;$f.q=q;$f.r=r;$f.s=s;$f.t=t;$f.u=u;$f.v=v;$f.w=w;$f.x=x;$f.y=y;$f.z=z;$f.$s=$s;$f.$r=$r;return $f;};})(a,k),[]);$s=6;continue;case 7:$s=-1;return;}return;}if($f===undefined){$f={$blk:$b};}$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.l=l;$f.m=m;$f.n=n;$f.o=o;$f.$s=$s;$f.$r=$r;return $f;};})(a);$r=c();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}d=$recv(b.C);$s=4;case 4:if($c){$c=false;d=d.$blk();}if(d&&d.$blk!==undefined){break s;}d[0];$s=1;continue;case 2:$s=-1;return;}return;}if($f===undefined){$f={$blk:H};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.$s=$s;$f.$r=$r;return $f;};$pkg.Bridge=H;G.init("",[{prop:"DialAddr",name:"DialAddr",embedded:false,exported:true,typ:$String,tag:""}]);$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=F.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=D.$init();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=E.$init();$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=B.$init();$s=5;case 5:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=C.$init();$s=6;case 6:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})(); +$packages["github.com/v2fly/BrowserBridge/bridge"]=(function(){var $pkg={},$init,A,C,B,D,E,F,G,I,J,H;A=$packages["fmt"];C=$packages["github.com/v2fly/BrowserBridge/proto"];B=$packages["github.com/v2fly/BrowserBridge/vendor/github.com/gopherjs/websocket"];D=$packages["github.com/v2fly/BrowserBridge/vendor/github.com/xtaci/smux"];E=$packages["io"];F=$packages["time"];G=$pkg.Settings=$newType(0,$kindStruct,"bridge.Settings",true,"github.com/v2fly/BrowserBridge/bridge",true,function(DialAddr_){this.$val=this;if(arguments.length===0){this.DialAddr="";return;}this.DialAddr=DialAddr_;});I=$sliceType($emptyInterface);J=$ptrType(D.Config);H=function(a){var a,b,c,d,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=[a];case 1:b=F.NewTimer(new F.Duration(0,1000000000));c=(function(a){return function $b(){var c,d,e,f,g,h,i,j,k,l,m,n,o,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;o=$f.o;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:d=B.Dial(a[0].DialAddr);$s=1;case 1:if($c){$c=false;d=d.$blk();}if(d&&d.$blk!==undefined){break s;}c=d;e=c[0];f=c[1];if(!($interfaceIsEqual(f,$ifaceNil))){$s=2;continue;}$s=3;continue;case 2:g=A.Println(new I([f,new $String(a[0].DialAddr)]));$s=4;case 4:if($c){$c=false;g=g.$blk();}if(g&&g.$blk!==undefined){break s;}g;$s=-1;return;case 3:i=D.Client(e,J.nil);$s=5;case 5:if($c){$c=false;i=i.$blk();}if(i&&i.$blk!==undefined){break s;}h=i;j=h[0];f=h[1];if(!($interfaceIsEqual(f,$ifaceNil))){$s=-1;return;}case 6:k=[k];m=j.Accept();$s=8;case 8:if($c){$c=false;m=m.$blk();}if(m&&m.$blk!==undefined){break s;}l=m;k[0]=l[0];n=l[1];if(!($interfaceIsEqual(n,$ifaceNil))){$s=9;continue;}$s=10;continue;case 9:o=A.Println(new I([n]));$s=11;case 11:if($c){$c=false;o=o.$blk();}if(o&&o.$blk!==undefined){break s;}o;$s=-1;return;case 10:$go((function(a,k){return function $b(){var aa,p,q,r,s,t,u,v,w,x,y,z,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;aa=$f.aa;p=$f.p;q=$f.q;r=$f.r;s=$f.s;t=$f.t;u=$f.u;v=$f.v;w=$f.w;x=$f.x;y=$f.y;z=$f.z;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:q=C.ReadRequest(k[0]);$s=1;case 1:if($c){$c=false;q=q.$blk();}if(q&&q.$blk!==undefined){break s;}p=q;r=p[0];s=p[1];if(!($interfaceIsEqual(r,$ifaceNil))){$s=2;continue;}$s=3;continue;case 2:t=A.Println(new I([r]));$s=4;case 4:if($c){$c=false;t=t.$blk();}if(t&&t.$blk!==undefined){break s;}t;$s=-1;return;case 3:v=B.Dial(s.Destination);$s=5;case 5:if($c){$c=false;v=v.$blk();}if(v&&v.$blk!==undefined){break s;}u=v;w=u[0];r=u[1];if(!($interfaceIsEqual(r,$ifaceNil))){$s=6;continue;}$s=7;continue;case 6:x=A.Println(new I([r]));$s=8;case 8:if($c){$c=false;x=x.$blk();}if(x&&x.$blk!==undefined){break s;}x;y=k[0].Close();$s=9;case 9:if($c){$c=false;y=y.$blk();}if(y&&y.$blk!==undefined){break s;}y;$s=-1;return;case 7:$go(E.Copy,[k[0],w]);z=E.Copy(w,k[0]);$s=10;case 10:if($c){$c=false;z=z.$blk();}if(z&&z.$blk!==undefined){break s;}z;aa=k[0].Close();$s=11;case 11:if($c){$c=false;aa=aa.$blk();}if(aa&&aa.$blk!==undefined){break s;}aa;$s=-1;return;}return;}if($f===undefined){$f={$blk:$b};}$f.aa=aa;$f.p=p;$f.q=q;$f.r=r;$f.s=s;$f.t=t;$f.u=u;$f.v=v;$f.w=w;$f.x=x;$f.y=y;$f.z=z;$f.$s=$s;$f.$r=$r;return $f;};})(a,k),[]);$s=6;continue;case 7:$s=-1;return;}return;}if($f===undefined){$f={$blk:$b};}$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.l=l;$f.m=m;$f.n=n;$f.o=o;$f.$s=$s;$f.$r=$r;return $f;};})(a);$r=c();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}d=$recv(b.C);$s=4;case 4:if($c){$c=false;d=d.$blk();}if(d&&d.$blk!==undefined){break s;}d[0];$s=1;continue;case 2:$s=-1;return;}return;}if($f===undefined){$f={$blk:H};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.$s=$s;$f.$r=$r;return $f;};$pkg.Bridge=H;G.init("",[{prop:"DialAddr",name:"DialAddr",embedded:false,exported:true,typ:$String,tag:""}]);$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=C.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=B.$init();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=D.$init();$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=E.$init();$s=5;case 5:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=F.$init();$s=6;case 6:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})(); $packages["log"]=(function(){var $pkg={},$init,A,E,B,C,D,F,G,Z,AA,AB,AC,AD,I,H,J,R;A=$packages["fmt"];E=$packages["github.com/gopherjs/gopherjs/nosync"];B=$packages["io"];C=$packages["os"];D=$packages["runtime"];F=$packages["time"];G=$pkg.Logger=$newType(0,$kindStruct,"log.Logger",true,"log",true,function(mu_,prefix_,flag_,out_,buf_){this.$val=this;if(arguments.length===0){this.mu=new E.Mutex.ptr(false);this.prefix="";this.flag=0;this.out=$ifaceNil;this.buf=Z.nil;return;}this.mu=mu_;this.prefix=prefix_;this.flag=flag_;this.out=out_;this.buf=buf_;});Z=$sliceType($Uint8);AA=$arrayType($Uint8,20);AB=$ptrType(Z);AC=$sliceType($emptyInterface);AD=$ptrType(G);H=function(a,b,c){var a,b,c;return new G.ptr(new E.Mutex.ptr(false),b,c,a,Z.nil);};$pkg.New=H;G.ptr.prototype.SetOutput=function(a){var a,b,$deferred;var $err=null;try{$deferred=[];$deferred.index=$curGoroutine.deferStack.length;$curGoroutine.deferStack.push($deferred);b=this;b.mu.Lock();$deferred.push([$methodVal(b.mu,"Unlock"),[]]);b.out=a;}catch(err){$err=err;}finally{$callDeferred($deferred,$err);}};G.prototype.SetOutput=function(a){return this.$val.SetOutput(a);};J=function(a,b,c){var a,b,c,d,e,f,g;d=AA.zero();e=19;while(true){if(!(b>=10||c>1)){break;}c=c-(1)>>0;g=(f=b/10,(f===f&&f!==1/0&&f!==-1/0)?f>>0:$throwRuntimeError("integer divide by zero"));((e<0||e>=d.length)?($throwRuntimeError("index out of range"),undefined):d[e]=((((48+b>>0)-($imul(g,10))>>0)<<24>>>24)));e=e-(1)>>0;b=g;}((e<0||e>=d.length)?($throwRuntimeError("index out of range"),undefined):d[e]=(((48+b>>0)<<24>>>24)));a.$set($appendSlice(a.$get(),$subslice(new Z(d),e)));};G.ptr.prototype.formatHeader=function(a,b,c,d){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;o=$f.o;p=$f.p;q=$f.q;r=$f.r;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:e=this;a.$set($appendSlice(a.$get(),e.prefix));if(!(((e.flag&7)===0))){$s=1;continue;}$s=2;continue;case 1:if(!(((e.flag&32)===0))){F.Time.copy(b,$clone(b,F.Time).UTC());}if(!(((e.flag&1)===0))){$s=3;continue;}$s=4;continue;case 3:g=$clone(b,F.Time).Date();$s=5;case 5:if($c){$c=false;g=g.$blk();}if(g&&g.$blk!==undefined){break s;}f=g;h=f[0];i=f[1];j=f[2];J(a,h,4);a.$set($append(a.$get(),47));J(a,((i>>0)),2);a.$set($append(a.$get(),47));J(a,j,2);a.$set($append(a.$get(),32));case 4:if(!(((e.flag&6)===0))){$s=6;continue;}$s=7;continue;case 6:l=$clone(b,F.Time).Clock();$s=8;case 8:if($c){$c=false;l=l.$blk();}if(l&&l.$blk!==undefined){break s;}k=l;m=k[0];n=k[1];o=k[2];J(a,m,2);a.$set($append(a.$get(),58));J(a,n,2);a.$set($append(a.$get(),58));J(a,o,2);if(!(((e.flag&4)===0))){a.$set($append(a.$get(),46));J(a,(p=$clone(b,F.Time).Nanosecond()/1000,(p===p&&p!==1/0&&p!==-1/0)?p>>0:$throwRuntimeError("integer divide by zero")),6);}a.$set($append(a.$get(),32));case 7:case 2:if(!(((e.flag&24)===0))){if(!(((e.flag&16)===0))){q=c;r=c.length-1>>0;while(true){if(!(r>0)){break;}if(c.charCodeAt(r)===47){q=$substring(c,(r+1>>0));break;}r=r-(1)>>0;}c=q;}a.$set($appendSlice(a.$get(),c));a.$set($append(a.$get(),58));J(a,d,-1);a.$set($appendSlice(a.$get(),": "));}$s=-1;return;}return;}if($f===undefined){$f={$blk:G.ptr.prototype.formatHeader};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.l=l;$f.m=m;$f.n=n;$f.o=o;$f.p=p;$f.q=q;$f.r=r;$f.$s=$s;$f.$r=$r;return $f;};G.prototype.formatHeader=function(a,b,c,d){return this.$val.formatHeader(a,b,c,d);};G.ptr.prototype.Output=function(a,b){var a,b,c,d,e,f,g,h,i,j,k,$s,$deferred,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;$s=$f.$s;$deferred=$f.$deferred;$r=$f.$r;}var $err=null;try{s:while(true){switch($s){case 0:$deferred=[];$deferred.index=$curGoroutine.deferStack.length;$curGoroutine.deferStack.push($deferred);c=this;d=$clone(F.Now(),F.Time);e="";f=0;c.mu.Lock();$deferred.push([$methodVal(c.mu,"Unlock"),[]]);if(!(((c.flag&24)===0))){c.mu.Unlock();g=false;h=D.Caller(a);e=h[1];f=h[2];g=h[3];if(!g){e="???";f=0;}c.mu.Lock();}c.buf=$subslice(c.buf,0,0);$r=c.formatHeader((c.$ptr_buf||(c.$ptr_buf=new AB(function(){return this.$target.buf;},function($v){this.$target.buf=$v;},c))),$clone(d,F.Time),e,f);$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}c.buf=$appendSlice(c.buf,b);if((b.length===0)||!((b.charCodeAt((b.length-1>>0))===10))){c.buf=$append(c.buf,10);}j=c.out.Write(c.buf);$s=2;case 2:if($c){$c=false;j=j.$blk();}if(j&&j.$blk!==undefined){break s;}i=j;k=i[1];$s=-1;return k;}return;}}catch(err){$err=err;$s=-1;return $ifaceNil;}finally{$callDeferred($deferred,$err);if($curGoroutine.asleep){if($f===undefined){$f={$blk:G.ptr.prototype.Output};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.$s=$s;$f.$deferred=$deferred;$f.$r=$r;return $f;}}};G.prototype.Output=function(a,b){return this.$val.Output(a,b);};G.ptr.prototype.Printf=function(a,b){var a,b,c,d,e,f,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:c=this;d=A.Sprintf(a,b);$s=1;case 1:if($c){$c=false;d=d.$blk();}if(d&&d.$blk!==undefined){break s;}e=d;f=c.Output(2,e);$s=2;case 2:if($c){$c=false;f=f.$blk();}if(f&&f.$blk!==undefined){break s;}f;$s=-1;return;}return;}if($f===undefined){$f={$blk:G.ptr.prototype.Printf};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.$s=$s;$f.$r=$r;return $f;};G.prototype.Printf=function(a,b){return this.$val.Printf(a,b);};G.ptr.prototype.Print=function(a){var a,b,c,d,e,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=this;c=A.Sprint(a);$s=1;case 1:if($c){$c=false;c=c.$blk();}if(c&&c.$blk!==undefined){break s;}d=c;e=b.Output(2,d);$s=2;case 2:if($c){$c=false;e=e.$blk();}if(e&&e.$blk!==undefined){break s;}e;$s=-1;return;}return;}if($f===undefined){$f={$blk:G.ptr.prototype.Print};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.$s=$s;$f.$r=$r;return $f;};G.prototype.Print=function(a){return this.$val.Print(a);};G.ptr.prototype.Println=function(a){var a,b,c,d,e,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=this;c=A.Sprintln(a);$s=1;case 1:if($c){$c=false;c=c.$blk();}if(c&&c.$blk!==undefined){break s;}d=c;e=b.Output(2,d);$s=2;case 2:if($c){$c=false;e=e.$blk();}if(e&&e.$blk!==undefined){break s;}e;$s=-1;return;}return;}if($f===undefined){$f={$blk:G.ptr.prototype.Println};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.$s=$s;$f.$r=$r;return $f;};G.prototype.Println=function(a){return this.$val.Println(a);};G.ptr.prototype.Fatal=function(a){var a,b,c,d,e,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=this;c=A.Sprint(a);$s=1;case 1:if($c){$c=false;c=c.$blk();}if(c&&c.$blk!==undefined){break s;}d=c;e=b.Output(2,d);$s=2;case 2:if($c){$c=false;e=e.$blk();}if(e&&e.$blk!==undefined){break s;}e;C.Exit(1);$s=-1;return;}return;}if($f===undefined){$f={$blk:G.ptr.prototype.Fatal};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.$s=$s;$f.$r=$r;return $f;};G.prototype.Fatal=function(a){return this.$val.Fatal(a);};G.ptr.prototype.Fatalf=function(a,b){var a,b,c,d,e,f,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:c=this;d=A.Sprintf(a,b);$s=1;case 1:if($c){$c=false;d=d.$blk();}if(d&&d.$blk!==undefined){break s;}e=d;f=c.Output(2,e);$s=2;case 2:if($c){$c=false;f=f.$blk();}if(f&&f.$blk!==undefined){break s;}f;C.Exit(1);$s=-1;return;}return;}if($f===undefined){$f={$blk:G.ptr.prototype.Fatalf};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.$s=$s;$f.$r=$r;return $f;};G.prototype.Fatalf=function(a,b){return this.$val.Fatalf(a,b);};G.ptr.prototype.Fatalln=function(a){var a,b,c,d,e,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=this;c=A.Sprintln(a);$s=1;case 1:if($c){$c=false;c=c.$blk();}if(c&&c.$blk!==undefined){break s;}d=c;e=b.Output(2,d);$s=2;case 2:if($c){$c=false;e=e.$blk();}if(e&&e.$blk!==undefined){break s;}e;C.Exit(1);$s=-1;return;}return;}if($f===undefined){$f={$blk:G.ptr.prototype.Fatalln};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.$s=$s;$f.$r=$r;return $f;};G.prototype.Fatalln=function(a){return this.$val.Fatalln(a);};G.ptr.prototype.Panic=function(a){var a,b,c,d,e,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=this;c=A.Sprint(a);$s=1;case 1:if($c){$c=false;c=c.$blk();}if(c&&c.$blk!==undefined){break s;}d=c;e=b.Output(2,d);$s=2;case 2:if($c){$c=false;e=e.$blk();}if(e&&e.$blk!==undefined){break s;}e;$panic(new $String(d));$s=-1;return;}return;}if($f===undefined){$f={$blk:G.ptr.prototype.Panic};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.$s=$s;$f.$r=$r;return $f;};G.prototype.Panic=function(a){return this.$val.Panic(a);};G.ptr.prototype.Panicf=function(a,b){var a,b,c,d,e,f,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:c=this;d=A.Sprintf(a,b);$s=1;case 1:if($c){$c=false;d=d.$blk();}if(d&&d.$blk!==undefined){break s;}e=d;f=c.Output(2,e);$s=2;case 2:if($c){$c=false;f=f.$blk();}if(f&&f.$blk!==undefined){break s;}f;$panic(new $String(e));$s=-1;return;}return;}if($f===undefined){$f={$blk:G.ptr.prototype.Panicf};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.$s=$s;$f.$r=$r;return $f;};G.prototype.Panicf=function(a,b){return this.$val.Panicf(a,b);};G.ptr.prototype.Panicln=function(a){var a,b,c,d,e,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=this;c=A.Sprintln(a);$s=1;case 1:if($c){$c=false;c=c.$blk();}if(c&&c.$blk!==undefined){break s;}d=c;e=b.Output(2,d);$s=2;case 2:if($c){$c=false;e=e.$blk();}if(e&&e.$blk!==undefined){break s;}e;$panic(new $String(d));$s=-1;return;}return;}if($f===undefined){$f={$blk:G.ptr.prototype.Panicln};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.$s=$s;$f.$r=$r;return $f;};G.prototype.Panicln=function(a){return this.$val.Panicln(a);};G.ptr.prototype.Flags=function(){var a,$deferred;var $err=null;try{$deferred=[];$deferred.index=$curGoroutine.deferStack.length;$curGoroutine.deferStack.push($deferred);a=this;a.mu.Lock();$deferred.push([$methodVal(a.mu,"Unlock"),[]]);return a.flag;}catch(err){$err=err;return 0;}finally{$callDeferred($deferred,$err);}};G.prototype.Flags=function(){return this.$val.Flags();};G.ptr.prototype.SetFlags=function(a){var a,b,$deferred;var $err=null;try{$deferred=[];$deferred.index=$curGoroutine.deferStack.length;$curGoroutine.deferStack.push($deferred);b=this;b.mu.Lock();$deferred.push([$methodVal(b.mu,"Unlock"),[]]);b.flag=a;}catch(err){$err=err;}finally{$callDeferred($deferred,$err);}};G.prototype.SetFlags=function(a){return this.$val.SetFlags(a);};G.ptr.prototype.Prefix=function(){var a,$deferred;var $err=null;try{$deferred=[];$deferred.index=$curGoroutine.deferStack.length;$curGoroutine.deferStack.push($deferred);a=this;a.mu.Lock();$deferred.push([$methodVal(a.mu,"Unlock"),[]]);return a.prefix;}catch(err){$err=err;return"";}finally{$callDeferred($deferred,$err);}};G.prototype.Prefix=function(){return this.$val.Prefix();};G.ptr.prototype.SetPrefix=function(a){var a,b,$deferred;var $err=null;try{$deferred=[];$deferred.index=$curGoroutine.deferStack.length;$curGoroutine.deferStack.push($deferred);b=this;b.mu.Lock();$deferred.push([$methodVal(b.mu,"Unlock"),[]]);b.prefix=a;}catch(err){$err=err;}finally{$callDeferred($deferred,$err);}};G.prototype.SetPrefix=function(a){return this.$val.SetPrefix(a);};G.ptr.prototype.Writer=function(){var a,$deferred;var $err=null;try{$deferred=[];$deferred.index=$curGoroutine.deferStack.length;$curGoroutine.deferStack.push($deferred);a=this;a.mu.Lock();$deferred.push([$methodVal(a.mu,"Unlock"),[]]);return a.out;}catch(err){$err=err;return $ifaceNil;}finally{$callDeferred($deferred,$err);}};G.prototype.Writer=function(){return this.$val.Writer();};R=function(a){var a,b,c,d,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=A.Sprintln(a);$s=1;case 1:if($c){$c=false;b=b.$blk();}if(b&&b.$blk!==undefined){break s;}c=b;d=I.Output(2,c);$s=2;case 2:if($c){$c=false;d=d.$blk();}if(d&&d.$blk!==undefined){break s;}d;$s=-1;return;}return;}if($f===undefined){$f={$blk:R};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.$s=$s;$f.$r=$r;return $f;};$pkg.Println=R;AD.methods=[{prop:"SetOutput",name:"SetOutput",pkg:"",typ:$funcType([B.Writer],[],false)},{prop:"formatHeader",name:"formatHeader",pkg:"log",typ:$funcType([AB,F.Time,$String,$Int],[],false)},{prop:"Output",name:"Output",pkg:"",typ:$funcType([$Int,$String],[$error],false)},{prop:"Printf",name:"Printf",pkg:"",typ:$funcType([$String,AC],[],true)},{prop:"Print",name:"Print",pkg:"",typ:$funcType([AC],[],true)},{prop:"Println",name:"Println",pkg:"",typ:$funcType([AC],[],true)},{prop:"Fatal",name:"Fatal",pkg:"",typ:$funcType([AC],[],true)},{prop:"Fatalf",name:"Fatalf",pkg:"",typ:$funcType([$String,AC],[],true)},{prop:"Fatalln",name:"Fatalln",pkg:"",typ:$funcType([AC],[],true)},{prop:"Panic",name:"Panic",pkg:"",typ:$funcType([AC],[],true)},{prop:"Panicf",name:"Panicf",pkg:"",typ:$funcType([$String,AC],[],true)},{prop:"Panicln",name:"Panicln",pkg:"",typ:$funcType([AC],[],true)},{prop:"Flags",name:"Flags",pkg:"",typ:$funcType([],[$Int],false)},{prop:"SetFlags",name:"SetFlags",pkg:"",typ:$funcType([$Int],[],false)},{prop:"Prefix",name:"Prefix",pkg:"",typ:$funcType([],[$String],false)},{prop:"SetPrefix",name:"SetPrefix",pkg:"",typ:$funcType([$String],[],false)},{prop:"Writer",name:"Writer",pkg:"",typ:$funcType([],[B.Writer],false)}];G.init("log",[{prop:"mu",name:"mu",embedded:false,exported:false,typ:E.Mutex,tag:""},{prop:"prefix",name:"prefix",embedded:false,exported:false,typ:$String,tag:""},{prop:"flag",name:"flag",embedded:false,exported:false,typ:$Int,tag:""},{prop:"out",name:"out",embedded:false,exported:false,typ:B.Writer,tag:""},{prop:"buf",name:"buf",embedded:false,exported:false,typ:Z,tag:""}]);$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=E.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=B.$init();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=C.$init();$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=D.$init();$s=5;case 5:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=F.$init();$s=6;case 6:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}I=H(C.Stderr,"",3);}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})(); -$packages["github.com/xiaokangwang/BrowserBridge/bridge/bridgejs"]=(function(){var $pkg={},$init,A,B,C,D,E,G,F;A=$packages["fmt"];B=$packages["github.com/gopherjs/gopherjs/js"];C=$packages["github.com/v2fly/BrowserBridge/bridge"];D=$packages["log"];E=$packages["net/url"];G=$sliceType($emptyInterface);F=function(){var a,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=A.Println(new G([new $String("V3")]));$s=1;case 1:if($c){$c=false;a=a.$blk();}if(a&&a.$blk!==undefined){break s;}a;$go((function $b(){var b,c,d,e,f,g,h,i,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=$internalize($global.window.location.href,$String);d=E.Parse(b);$s=1;case 1:if($c){$c=false;d=d.$blk();}if(d&&d.$blk!==undefined){break s;}c=d;e=c[0];f=c[1];if(!($interfaceIsEqual(f,$ifaceNil))){$s=2;continue;}$s=3;continue;case 2:$r=D.Println(new G([f]));$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}case 3:g=e.Host;h=A.Sprintf("ws://%v/link",new G([new $String(g)]));$s=5;case 5:if($c){$c=false;h=h.$blk();}if(h&&h.$blk!==undefined){break s;}$r=D.Println(new G([new $String(h)]));$s=6;case 6:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}i=A.Sprintf("ws://%v/link",new G([new $String(g)]));$s=7;case 7:if($c){$c=false;i=i.$blk();}if(i&&i.$blk!==undefined){break s;}$r=C.Bridge(new C.Settings.ptr(i));$s=8;case 8:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$global.location.reload();$s=-1;return;}return;}if($f===undefined){$f={$blk:$b};}$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.$s=$s;$f.$r=$r;return $f;}),[]);$s=-1;return;}return;}if($f===undefined){$f={$blk:F};}$f.a=a;$f.$s=$s;$f.$r=$r;return $f;};$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=B.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=C.$init();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=D.$init();$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=E.$init();$s=5;case 5:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}if($pkg===$mainPkg){$s=6;continue;}$s=7;continue;case 6:$r=F();$s=8;case 8:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$mainFinished=true;case 7:}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})(); +$packages["github.com/v2fly/BrowserBridge/bridge/bridgejs"]=(function(){var $pkg={},$init,A,B,C,D,E,G,F;A=$packages["fmt"];B=$packages["github.com/gopherjs/gopherjs/js"];C=$packages["github.com/v2fly/BrowserBridge/bridge"];D=$packages["log"];E=$packages["net/url"];G=$sliceType($emptyInterface);F=function(){var a,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=A.Println(new G([new $String("V3")]));$s=1;case 1:if($c){$c=false;a=a.$blk();}if(a&&a.$blk!==undefined){break s;}a;$go((function $b(){var b,c,d,e,f,g,h,i,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=$internalize($global.window.location.href,$String);d=E.Parse(b);$s=1;case 1:if($c){$c=false;d=d.$blk();}if(d&&d.$blk!==undefined){break s;}c=d;e=c[0];f=c[1];if(!($interfaceIsEqual(f,$ifaceNil))){$s=2;continue;}$s=3;continue;case 2:$r=D.Println(new G([f]));$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}case 3:g=e.Host;h=A.Sprintf("ws://%v/link",new G([new $String(g)]));$s=5;case 5:if($c){$c=false;h=h.$blk();}if(h&&h.$blk!==undefined){break s;}$r=D.Println(new G([new $String(h)]));$s=6;case 6:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}i=A.Sprintf("ws://%v/link",new G([new $String(g)]));$s=7;case 7:if($c){$c=false;i=i.$blk();}if(i&&i.$blk!==undefined){break s;}$r=C.Bridge(new C.Settings.ptr(i));$s=8;case 8:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$global.location.reload();$s=-1;return;}return;}if($f===undefined){$f={$blk:$b};}$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.$s=$s;$f.$r=$r;return $f;}),[]);$s=-1;return;}return;}if($f===undefined){$f={$blk:F};}$f.a=a;$f.$s=$s;$f.$r=$r;return $f;};$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=B.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=C.$init();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=D.$init();$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=E.$init();$s=5;case 5:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}if($pkg===$mainPkg){$s=6;continue;}$s=7;continue;case 6:$r=F();$s=8;case 8:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$mainFinished=true;case 7:}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})(); $synthesizeMethods(); -var $mainPkg = $packages["github.com/xiaokangwang/BrowserBridge/bridge/bridgejs"]; +var $mainPkg = $packages["github.com/v2fly/BrowserBridge/bridge/bridgejs"]; $packages["runtime"].$init(); $go($mainPkg.$init, []); $flushConsole();