planx 20.21.6 → 20.24.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "planx",
3
- "version": "20.21.6",
3
+ "version": "20.24.2",
4
4
  "author": "Nozomu Miyamoto",
5
5
  "description": "planx — Angular DI ベースの machina ターミナルマルチプレクサ / ピアセッション管理 CLI",
6
6
  "type": "module",
@@ -47,11 +47,11 @@
47
47
  "ws": "8.18.3"
48
48
  },
49
49
  "optionalDependencies": {
50
- "@planx.machina.at/tunnel-darwin-arm64": "20.21.6",
51
- "@planx.machina.at/tunnel-darwin-x64": "20.21.6",
52
- "@planx.machina.at/tunnel-linux-x64-gnu": "20.21.6",
53
- "@planx.machina.at/tunnel-linux-arm64-gnu": "20.21.6",
54
- "@planx.machina.at/tunnel-linux-x64-musl": "20.21.6"
50
+ "@planx.machina.at/tunnel-darwin-arm64": "20.24.2",
51
+ "@planx.machina.at/tunnel-darwin-x64": "20.24.2",
52
+ "@planx.machina.at/tunnel-linux-x64-gnu": "20.24.2",
53
+ "@planx.machina.at/tunnel-linux-arm64-gnu": "20.24.2",
54
+ "@planx.machina.at/tunnel-linux-x64-musl": "20.24.2"
55
55
  },
56
56
  "publishConfig": {
57
57
  "access": "public"
@@ -72,7 +72,7 @@ StandardError=append:/var/log/planx-networkd.err.log
72
72
 
73
73
  [Install]
74
74
  WantedBy=multi-user.target
75
- `});import{writeFileSync as Pr,mkdirSync as Rr,unlinkSync as Nr}from"node:fs";import{execFileSync as Lr}from"node:child_process";function Be(e){if(e.getuid&&e.getuid()!==0)throw new Error("must run as root (try: sudo planx network install)")}var Ir,x,He=B(()=>{Ir=typeof process.getuid=="function"?process.getuid.bind(process):void 0,x={writeFile:(e,t)=>Pr(e,t),mkdir:e=>Rr(e,{recursive:!0}),exec:(e,t)=>Lr(e,t,{stdio:"inherit"}),log:e=>console.log(e),platform:process.platform,getuid:Ir,rm:e=>{try{Nr(e)}catch{}}}});import{dirname as K}from"node:path";function z(e,t=x){t.mkdir(K(C)),t.writeFile(C,se(e.nodePath,e.bundlePath)),t.exec("chmod",["755",C]),t.log(`[planx-networkd install] installed launcher: ${C} -> ${e.bundlePath}`)}function de(e=x){e.mkdir(K(A)),e.writeFile(A,le);try{e.exec("launchctl",["bootout",`system/${$e}`])}catch{}e.exec("launchctl",["bootstrap","system",A]),e.log(`[planx-networkd install] installed launchd unit: ${A}`)}function fe(e=x){e.mkdir(K(P)),e.writeFile(P,ue),e.exec("systemctl",["daemon-reload"]),e.exec("systemctl",["enable","--now","planx-networkd"]),e.log(`[planx-networkd install] installed systemd unit: ${P}`)}function pe(e=x){e.mkdir(K(R)),e.writeFile(R,ae),e.log(`[planx-networkd install] installed macOS resolver hook: ${R}`)}function he(e=x){e.mkdir(K(N)),e.writeFile(N,ce),e.exec("systemctl",["reload-or-restart","systemd-resolved"]),e.log(`[planx-networkd install] installed Linux resolved zone config: ${N}`)}function me(e=x){try{e.exec("launchctl",["bootout",`system/${$e}`])}catch{}e.rm?.(A),e.log(`[planx-networkd uninstall] removed launchd unit: ${A}`)}function ge(e=x){try{e.exec("systemctl",["disable","--now","planx-networkd"])}catch{}e.rm?.(P);try{e.exec("systemctl",["daemon-reload"])}catch{}e.log(`[planx-networkd uninstall] removed systemd unit: ${P}`)}function G(e=x){e.rm?.(C),e.log(`[planx-networkd uninstall] removed launcher: ${C}`)}function ye(e=x){e.rm?.(R),e.log(`[planx-networkd uninstall] removed macOS resolver hook: ${R}`)}function xe(e=x){e.rm?.(N);try{e.exec("systemctl",["reload-or-restart","systemd-resolved"])}catch{}e.log(`[planx-networkd uninstall] removed Linux resolved zone config: ${N}`)}var Me=B(()=>{Ue();He()});var kt={};Ot(kt,{LAUNCHD_DEST:()=>A,LAUNCHD_PLIST:()=>le,LINUX_RESOLVED_CONTENT:()=>ce,LINUX_RESOLVED_DEST:()=>N,MACOS_RESOLVER_CONTENT:()=>ae,MACOS_RESOLVER_DEST:()=>R,NETWORKD_BIN_DEST:()=>C,RESOLVER_DNS_PORT:()=>ie,SYSTEMD_DEST:()=>P,SYSTEMD_UNIT:()=>ue,buildNetworkdWrapper:()=>se,installLaunchd:()=>de,installLinuxResolved:()=>he,installMacosResolver:()=>pe,installNetworkdBin:()=>z,installSystemd:()=>fe,runInstall:()=>$r,runUninstall:()=>Ur,uninstallLaunchd:()=>me,uninstallLinuxResolved:()=>xe,uninstallMacosResolver:()=>ye,uninstallNetworkdBin:()=>G,uninstallSystemd:()=>ge});async function $r(e=x,t){if(Be(e),e.platform==="darwin"){t&&z(t,e),de(e),pe(e);return}if(e.platform==="linux"){t&&z(t,e),fe(e),he(e);return}if(e.platform==="win32"){e.log("[planx-networkd install] Windows: use NSSM or sc.exe to register `planx-networkd` as a service.");return}throw new Error(`unsupported platform: ${e.platform}`)}async function Ur(e=x){if(Be(e),e.platform==="darwin"){me(e),G(e),ye(e);return}if(e.platform==="linux"){ge(e),G(e),xe(e);return}if(e.platform==="win32"){e.log("[planx-networkd uninstall] Windows: remove the `planx-networkd` service via NSSM or sc.exe delete.");return}throw new Error(`unsupported platform: ${e.platform}`)}var vt=B(()=>{Ue();Me();He();Me()});import{createServer as Hr}from"node:http";import{existsSync as Mr,unlinkSync as Ct,chmodSync as Fr}from"node:fs";import{createRequire as Dt}from"node:module";import{readFileSync as Pt}from"node:fs";function Rt(){try{let e=Pt("/usr/bin/ldd","utf8");return/musl/i.test(e)?"musl":"gnu"}catch{return"gnu"}}function Nt(e=process.platform,t=process.arch){if(e==="darwin")return`@planx.machina.at/tunnel-darwin-${t}`;if(e==="linux")return`@planx.machina.at/tunnel-linux-${t}-${Rt()}`;if(e==="win32")return`@planx.machina.at/tunnel-win32-${t}-msvc`;throw new Error(`[planx-networkd] unsupported platform: ${e}/${t}`)}function Ve(e){let t=()=>{throw new Error(`[planx-networkd] native binding unavailable: ${e}`)};return{setupVnet:t,addSelfAddress:t,addPeerAddress:t,removePeerAddress:t,injectTcpData:t,injectTcpClose:t,injectUdpSend:t,setExitCapture:t,injectUdpDatagram:t,onEvent:t,offEvent:t}}function Lt(){let e=Nt();try{let r=Dt(import.meta.url)(e);return!r||typeof r.setupVnet!="function"?Ve(`subpackage ${e} loaded but missing exports`):r}catch(t){return Ve(`${e} not installed (${t.message})`)}}var Se=null;function b(){return Se||(Se=Lt()),Se}var Wr=new Proxy({},{get(e,t){return b()[t]}});var It=new Date(Date.now()-process.uptime()*1e3).toISOString();function $t(){let e=b();if(typeof e.version!="function")return"unknown";try{return e.version()}catch{return"unavailable"}}function je(){return{version:"20.21.6",nativeVersion:$t(),uptime:Math.floor(process.uptime()),pid:process.pid,platform:process.platform,arch:process.arch,nodeVersion:process.version,startedAt:It}}var H=null;function U(){return H}function be(e,t){if(e.enabled&&!e.socksPort)throw new Error("exit capture \u3092 on \u306B\u3059\u308B\u306B\u306F socksPort (front door \u306E port) \u304C\u8981\u308B");if(!e.enabled&&e.socksPort&&H!==null&&e.socksPort!==H)return{bypass:[],failed:[`front door ${H} \u304C capture \u3057\u3066\u3044\u308B\u306E\u3067 ${e.socksPort} \u304B\u3089\u306E off \u306F\u7121\u8996\u3057\u305F`]};let r=t.setExitCapture({enabled:e.enabled,bypass:e.enabled?e.bypass:[],ipv6:e.enabled&&e.ipv6===!0});return H=e.enabled?e.socksPort??null:null,r}var Ut={"/health":()=>je(),"/exit/capture/status":()=>({socksPort:U()})};function Y(e,t,r){e.writeHead(t,{"content-type":"application/json"}),e.end(JSON.stringify(r))}function Ke(e,t){let r=(e.url??"/").split("?")[0],n=Ut[r];if(!n)return Y(t,404,{error:`not found: ${r}`});if(e.method!=="GET")return Y(t,405,{error:`method not allowed: ${e.method}`});try{Y(t,200,n())}catch(s){Y(t,500,{error:s instanceof Error?s.message:String(s)})}}var Bt="/var/run/planx-networkd.sock",Ht="\\\\.\\pipe\\planx-networkd";function ze(e=process.platform){return e==="win32"?Ht:Bt}import*as ct from"node:net";function L(e){let t=e.split(":");if(t.length!==8||t.some(r=>!/^[0-9a-fA-F]{1,4}$/.test(r)))throw new Error(`[planx-networkd] invalid hip string (expected 8 full groups): "${e}"`);return t.map(r=>r.toLowerCase().padStart(4,"0")).join(":")}function we(e){let t=new Uint8Array(16);return L(e).split(":").forEach((r,n)=>{let s=parseInt(r,16);t[n*2]=s>>8,t[n*2+1]=s&255}),t}function Ge(e){if(e.length!==16)throw new Error(`[planx-networkd] invalid hip bytes (expected 16, got ${e.length})`);let t=[];for(let r=0;r<16;r+=2)t.push(((e[r]<<8|e[r+1])>>>0).toString(16).padStart(4,"0"));return t.join(":")}import{Buffer as rt}from"node:buffer";var Te,Xe=!!globalThis.__webrtcProxyDebug||typeof process<"u"&&!!(!((Te=process.env)===null||Te===void 0)&&Te.PLANX_PROXY_DEBUG);var M;(function(e){e[e.Success=0]="Success",e[e.GeneralFailure=1]="GeneralFailure",e[e.ConnectionNotAllowed=2]="ConnectionNotAllowed",e[e.NetworkUnreachable=3]="NetworkUnreachable",e[e.HostUnreachable=4]="HostUnreachable",e[e.ConnectionRefused=5]="ConnectionRefused",e[e.TtlExpired=6]="TtlExpired",e[e.CommandNotSupported=7]="CommandNotSupported",e[e.AddressTypeNotSupported=8]="AddressTypeNotSupported"})(M||(M={}));var k=1,I=3,v=4;var Xt={[k]:4,[v]:16},$=class{constructor(){this.buf=Buffer.alloc(0),this.methodDone=!1,this.replyDone=!1}push(t){this.buf=this.buf.length===0?t:Buffer.concat([this.buf,t])}takeMethodReply(){if(this.methodDone||this.buf.length<2)return null;if(this.buf[0]!==5)throw new Error(`[socks] method reply unsupported version: ${this.buf[0]}`);let t=this.buf[1];return this.buf=this.buf.subarray(2),this.methodDone=!0,{method:t}}takeConnectReply(){if(!this.methodDone||this.replyDone||this.buf.length<4)return null;if(this.buf[0]!==5)throw new Error(`[socks] connect reply unsupported version: ${this.buf[0]}`);let t=this.buf[3],r=t===I?this.buf.length<5?null:this.buf[4]+1:Xt[t];if(r===void 0)throw new Error(`[socks] connect reply unsupported ATYP: ${t}`);if(r===null)return null;let n=4+r+2;if(this.buf.length<n)return null;let s=this.buf[1],u=this.buf[n-2]<<8|this.buf[n-1];return this.buf=this.buf.subarray(n),this.replyDone=!0,{reply:s,atyp:t,bndPort:u}}drainRest(){let t=this.buf;return this.buf=Buffer.alloc(0),t}};var D=e=>new Error(`socks address: ${e}`);function F(e,t){if(!Number.isInteger(t)||t<0||t>65535)throw D(`port out of range: ${t}`);let r=[t>>8,t&255];if(e.kind==="ipv4"){if(e.addr.length!==4)throw D("ipv4 must be 4 bytes");return Uint8Array.from([k,...e.addr,...r])}if(e.kind==="ipv6"){if(e.addr.length!==16)throw D("ipv6 must be 16 bytes");return Uint8Array.from([v,...e.addr,...r])}let n=new TextEncoder().encode(e.name);if(n.length===0||n.length>255)throw D(`domain length ${n.length} is not in 1..255`);return Uint8Array.from([I,n.length,...n,...r])}function qt(e){if(e.length===0)throw D("empty");let t=e[0];if(t===k)return{address:{kind:"ipv4",addr:e.slice(1,5)},end:5};if(t===v)return{address:{kind:"ipv6",addr:e.slice(1,17)},end:17};if(t===I){if(e.length<2)throw D("domain length missing");let r=2+e[1];return{address:{kind:"domain",name:new TextDecoder().decode(e.slice(2,r))},end:r}}throw D(`unknown atyp 0x${t.toString(16)}`)}function ke(e){let{address:t,end:r}=qt(e);if(e.length<r+2)throw D(`truncated (${e.length} < ${r+2})`);return{address:t,port:e[r]<<8|e[r+1],length:r+2}}function ve(e){return Buffer.from([5,1,0,...e])}var Ce=e=>new Error(`socks udp: ${e}`),Jt=Uint8Array.of(k,0,0,0,0,0,0);function Ae(e,t){let r=new Uint8Array(3+e.length+t.length);return r.set(e,3),r.set(t,3+e.length),r}function Oe(e){if(e.length<3)throw Ce(`too short (${e.length})`);if(e[0]!==0||e[1]!==0)throw Ce("reserved bytes must be 0");let t;try{t=ke(e.subarray(3))}catch(r){throw Ce(r instanceof Error?r.message:String(r))}return{frag:e[2],target:t,data:e.subarray(3+t.length)}}function De(e=Jt){return Buffer.from([5,3,0,...e])}function V(){return Buffer.from([5,1,0])}function Pe(e,t){if(e.length!==16)throw new Error(`[socks] connect request addr must be 16 bytes, got ${e.length}`);let r=Buffer.alloc(22);return r.set([5,1,0,v],0),r.set(e,4),r.writeUInt16BE(t&65535,20),r}var q=new TextEncoder,Re=new TextDecoder;var as=q.encode(`0\r
75
+ `});import{writeFileSync as Pr,mkdirSync as Rr,unlinkSync as Nr}from"node:fs";import{execFileSync as Lr}from"node:child_process";function Be(e){if(e.getuid&&e.getuid()!==0)throw new Error("must run as root (try: sudo planx network install)")}var Ir,x,He=B(()=>{Ir=typeof process.getuid=="function"?process.getuid.bind(process):void 0,x={writeFile:(e,t)=>Pr(e,t),mkdir:e=>Rr(e,{recursive:!0}),exec:(e,t)=>Lr(e,t,{stdio:"inherit"}),log:e=>console.log(e),platform:process.platform,getuid:Ir,rm:e=>{try{Nr(e)}catch{}}}});import{dirname as K}from"node:path";function z(e,t=x){t.mkdir(K(C)),t.writeFile(C,se(e.nodePath,e.bundlePath)),t.exec("chmod",["755",C]),t.log(`[planx-networkd install] installed launcher: ${C} -> ${e.bundlePath}`)}function de(e=x){e.mkdir(K(A)),e.writeFile(A,le);try{e.exec("launchctl",["bootout",`system/${$e}`])}catch{}e.exec("launchctl",["bootstrap","system",A]),e.log(`[planx-networkd install] installed launchd unit: ${A}`)}function fe(e=x){e.mkdir(K(P)),e.writeFile(P,ue),e.exec("systemctl",["daemon-reload"]),e.exec("systemctl",["enable","--now","planx-networkd"]),e.log(`[planx-networkd install] installed systemd unit: ${P}`)}function pe(e=x){e.mkdir(K(R)),e.writeFile(R,ae),e.log(`[planx-networkd install] installed macOS resolver hook: ${R}`)}function he(e=x){e.mkdir(K(N)),e.writeFile(N,ce),e.exec("systemctl",["reload-or-restart","systemd-resolved"]),e.log(`[planx-networkd install] installed Linux resolved zone config: ${N}`)}function me(e=x){try{e.exec("launchctl",["bootout",`system/${$e}`])}catch{}e.rm?.(A),e.log(`[planx-networkd uninstall] removed launchd unit: ${A}`)}function ge(e=x){try{e.exec("systemctl",["disable","--now","planx-networkd"])}catch{}e.rm?.(P);try{e.exec("systemctl",["daemon-reload"])}catch{}e.log(`[planx-networkd uninstall] removed systemd unit: ${P}`)}function G(e=x){e.rm?.(C),e.log(`[planx-networkd uninstall] removed launcher: ${C}`)}function ye(e=x){e.rm?.(R),e.log(`[planx-networkd uninstall] removed macOS resolver hook: ${R}`)}function xe(e=x){e.rm?.(N);try{e.exec("systemctl",["reload-or-restart","systemd-resolved"])}catch{}e.log(`[planx-networkd uninstall] removed Linux resolved zone config: ${N}`)}var Me=B(()=>{Ue();He()});var kt={};Ot(kt,{LAUNCHD_DEST:()=>A,LAUNCHD_PLIST:()=>le,LINUX_RESOLVED_CONTENT:()=>ce,LINUX_RESOLVED_DEST:()=>N,MACOS_RESOLVER_CONTENT:()=>ae,MACOS_RESOLVER_DEST:()=>R,NETWORKD_BIN_DEST:()=>C,RESOLVER_DNS_PORT:()=>ie,SYSTEMD_DEST:()=>P,SYSTEMD_UNIT:()=>ue,buildNetworkdWrapper:()=>se,installLaunchd:()=>de,installLinuxResolved:()=>he,installMacosResolver:()=>pe,installNetworkdBin:()=>z,installSystemd:()=>fe,runInstall:()=>$r,runUninstall:()=>Ur,uninstallLaunchd:()=>me,uninstallLinuxResolved:()=>xe,uninstallMacosResolver:()=>ye,uninstallNetworkdBin:()=>G,uninstallSystemd:()=>ge});async function $r(e=x,t){if(Be(e),e.platform==="darwin"){t&&z(t,e),de(e),pe(e);return}if(e.platform==="linux"){t&&z(t,e),fe(e),he(e);return}if(e.platform==="win32"){e.log("[planx-networkd install] Windows: use NSSM or sc.exe to register `planx-networkd` as a service.");return}throw new Error(`unsupported platform: ${e.platform}`)}async function Ur(e=x){if(Be(e),e.platform==="darwin"){me(e),G(e),ye(e);return}if(e.platform==="linux"){ge(e),G(e),xe(e);return}if(e.platform==="win32"){e.log("[planx-networkd uninstall] Windows: remove the `planx-networkd` service via NSSM or sc.exe delete.");return}throw new Error(`unsupported platform: ${e.platform}`)}var vt=B(()=>{Ue();Me();He();Me()});import{createServer as Hr}from"node:http";import{existsSync as Mr,unlinkSync as Ct,chmodSync as Fr}from"node:fs";import{createRequire as Dt}from"node:module";import{readFileSync as Pt}from"node:fs";function Rt(){try{let e=Pt("/usr/bin/ldd","utf8");return/musl/i.test(e)?"musl":"gnu"}catch{return"gnu"}}function Nt(e=process.platform,t=process.arch){if(e==="darwin")return`@planx.machina.at/tunnel-darwin-${t}`;if(e==="linux")return`@planx.machina.at/tunnel-linux-${t}-${Rt()}`;if(e==="win32")return`@planx.machina.at/tunnel-win32-${t}-msvc`;throw new Error(`[planx-networkd] unsupported platform: ${e}/${t}`)}function Ve(e){let t=()=>{throw new Error(`[planx-networkd] native binding unavailable: ${e}`)};return{setupVnet:t,addSelfAddress:t,addPeerAddress:t,removePeerAddress:t,injectTcpData:t,injectTcpClose:t,injectUdpSend:t,setExitCapture:t,injectUdpDatagram:t,onEvent:t,offEvent:t}}function Lt(){let e=Nt();try{let r=Dt(import.meta.url)(e);return!r||typeof r.setupVnet!="function"?Ve(`subpackage ${e} loaded but missing exports`):r}catch(t){return Ve(`${e} not installed (${t.message})`)}}var Se=null;function b(){return Se||(Se=Lt()),Se}var Wr=new Proxy({},{get(e,t){return b()[t]}});var It=new Date(Date.now()-process.uptime()*1e3).toISOString();function $t(){let e=b();if(typeof e.version!="function")return"unknown";try{return e.version()}catch{return"unavailable"}}function je(){return{version:"20.24.2",nativeVersion:$t(),uptime:Math.floor(process.uptime()),pid:process.pid,platform:process.platform,arch:process.arch,nodeVersion:process.version,startedAt:It}}var H=null;function U(){return H}function be(e,t){if(e.enabled&&!e.socksPort)throw new Error("exit capture \u3092 on \u306B\u3059\u308B\u306B\u306F socksPort (front door \u306E port) \u304C\u8981\u308B");if(!e.enabled&&e.socksPort&&H!==null&&e.socksPort!==H)return{bypass:[],failed:[`front door ${H} \u304C capture \u3057\u3066\u3044\u308B\u306E\u3067 ${e.socksPort} \u304B\u3089\u306E off \u306F\u7121\u8996\u3057\u305F`]};let r=t.setExitCapture({enabled:e.enabled,bypass:e.enabled?e.bypass:[],ipv6:e.enabled&&e.ipv6===!0});return H=e.enabled?e.socksPort??null:null,r}var Ut={"/health":()=>je(),"/exit/capture/status":()=>({socksPort:U()})};function Y(e,t,r){e.writeHead(t,{"content-type":"application/json"}),e.end(JSON.stringify(r))}function Ke(e,t){let r=(e.url??"/").split("?")[0],n=Ut[r];if(!n)return Y(t,404,{error:`not found: ${r}`});if(e.method!=="GET")return Y(t,405,{error:`method not allowed: ${e.method}`});try{Y(t,200,n())}catch(s){Y(t,500,{error:s instanceof Error?s.message:String(s)})}}var Bt="/var/run/planx-networkd.sock",Ht="\\\\.\\pipe\\planx-networkd";function ze(e=process.platform){return e==="win32"?Ht:Bt}import*as ct from"node:net";function L(e){let t=e.split(":");if(t.length!==8||t.some(r=>!/^[0-9a-fA-F]{1,4}$/.test(r)))throw new Error(`[planx-networkd] invalid hip string (expected 8 full groups): "${e}"`);return t.map(r=>r.toLowerCase().padStart(4,"0")).join(":")}function we(e){let t=new Uint8Array(16);return L(e).split(":").forEach((r,n)=>{let s=parseInt(r,16);t[n*2]=s>>8,t[n*2+1]=s&255}),t}function Ge(e){if(e.length!==16)throw new Error(`[planx-networkd] invalid hip bytes (expected 16, got ${e.length})`);let t=[];for(let r=0;r<16;r+=2)t.push(((e[r]<<8|e[r+1])>>>0).toString(16).padStart(4,"0"));return t.join(":")}import{Buffer as rt}from"node:buffer";var Te,Xe=!!globalThis.__webrtcProxyDebug||typeof process<"u"&&!!(!((Te=process.env)===null||Te===void 0)&&Te.PLANX_PROXY_DEBUG);var M;(function(e){e[e.Success=0]="Success",e[e.GeneralFailure=1]="GeneralFailure",e[e.ConnectionNotAllowed=2]="ConnectionNotAllowed",e[e.NetworkUnreachable=3]="NetworkUnreachable",e[e.HostUnreachable=4]="HostUnreachable",e[e.ConnectionRefused=5]="ConnectionRefused",e[e.TtlExpired=6]="TtlExpired",e[e.CommandNotSupported=7]="CommandNotSupported",e[e.AddressTypeNotSupported=8]="AddressTypeNotSupported"})(M||(M={}));var k=1,I=3,v=4;var Xt={[k]:4,[v]:16},$=class{constructor(){this.buf=Buffer.alloc(0),this.methodDone=!1,this.replyDone=!1}push(t){this.buf=this.buf.length===0?t:Buffer.concat([this.buf,t])}takeMethodReply(){if(this.methodDone||this.buf.length<2)return null;if(this.buf[0]!==5)throw new Error(`[socks] method reply unsupported version: ${this.buf[0]}`);let t=this.buf[1];return this.buf=this.buf.subarray(2),this.methodDone=!0,{method:t}}takeConnectReply(){if(!this.methodDone||this.replyDone||this.buf.length<4)return null;if(this.buf[0]!==5)throw new Error(`[socks] connect reply unsupported version: ${this.buf[0]}`);let t=this.buf[3],r=t===I?this.buf.length<5?null:this.buf[4]+1:Xt[t];if(r===void 0)throw new Error(`[socks] connect reply unsupported ATYP: ${t}`);if(r===null)return null;let n=4+r+2;if(this.buf.length<n)return null;let s=this.buf[1],u=this.buf[n-2]<<8|this.buf[n-1];return this.buf=this.buf.subarray(n),this.replyDone=!0,{reply:s,atyp:t,bndPort:u}}drainRest(){let t=this.buf;return this.buf=Buffer.alloc(0),t}};var D=e=>new Error(`socks address: ${e}`);function F(e,t){if(!Number.isInteger(t)||t<0||t>65535)throw D(`port out of range: ${t}`);let r=[t>>8,t&255];if(e.kind==="ipv4"){if(e.addr.length!==4)throw D("ipv4 must be 4 bytes");return Uint8Array.from([k,...e.addr,...r])}if(e.kind==="ipv6"){if(e.addr.length!==16)throw D("ipv6 must be 16 bytes");return Uint8Array.from([v,...e.addr,...r])}let n=new TextEncoder().encode(e.name);if(n.length===0||n.length>255)throw D(`domain length ${n.length} is not in 1..255`);return Uint8Array.from([I,n.length,...n,...r])}function qt(e){if(e.length===0)throw D("empty");let t=e[0];if(t===k)return{address:{kind:"ipv4",addr:e.slice(1,5)},end:5};if(t===v)return{address:{kind:"ipv6",addr:e.slice(1,17)},end:17};if(t===I){if(e.length<2)throw D("domain length missing");let r=2+e[1];return{address:{kind:"domain",name:new TextDecoder().decode(e.slice(2,r))},end:r}}throw D(`unknown atyp 0x${t.toString(16)}`)}function ke(e){let{address:t,end:r}=qt(e);if(e.length<r+2)throw D(`truncated (${e.length} < ${r+2})`);return{address:t,port:e[r]<<8|e[r+1],length:r+2}}function ve(e){return Buffer.from([5,1,0,...e])}var Ce=e=>new Error(`socks udp: ${e}`),Jt=Uint8Array.of(k,0,0,0,0,0,0);function Ae(e,t){let r=new Uint8Array(3+e.length+t.length);return r.set(e,3),r.set(t,3+e.length),r}function Oe(e){if(e.length<3)throw Ce(`too short (${e.length})`);if(e[0]!==0||e[1]!==0)throw Ce("reserved bytes must be 0");let t;try{t=ke(e.subarray(3))}catch(r){throw Ce(r instanceof Error?r.message:String(r))}return{frag:e[2],target:t,data:e.subarray(3+t.length)}}function De(e=Jt){return Buffer.from([5,3,0,...e])}function V(){return Buffer.from([5,1,0])}function Pe(e,t){if(e.length!==16)throw new Error(`[socks] connect request addr must be 16 bytes, got ${e.length}`);let r=Buffer.alloc(22);return r.set([5,1,0,v],0),r.set(e,4),r.writeUInt16BE(t&65535,20),r}var q=new TextEncoder,Re=new TextDecoder;var as=q.encode(`0\r
76
76
  \r
77
77
  `);var ms=Buffer.from(`\r
78
78
  \r
@@ -1,4 +1,4 @@
1
- globalThis.__PLANX_SERVICE_VERSION__="20.21.6";
1
+ globalThis.__PLANX_SERVICE_VERSION__="20.24.2";
2
2
  import { createRequire } from 'module';
3
3
  const require = createRequire(import.meta.url);
4
4